diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/auto-implement-methods.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/auto-implement-methods.js new file mode 100644 index 0000000000000000000000000000000000000000..a0f9abdecf94dfdcd57f7a01f2d7aabb55faf824 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/auto-implement-methods.js @@ -0,0 +1,71 @@ +import { HTTP_METHODS } from '../../../web/http'; +const AUTOMATIC_ROUTE_METHODS = [ + 'HEAD', + 'OPTIONS' +]; +function handleMethodNotAllowedResponse() { + return new Response(null, { + status: 405 + }); +} +export function autoImplementMethods(handlers) { + // Loop through all the HTTP methods to create the initial methods object. + // Each of the methods will be set to the 405 response handler. + const methods = HTTP_METHODS.reduce((acc, method)=>({ + ...acc, + // If the userland module implements the method, then use it. Otherwise, + // use the 405 response handler. + [method]: handlers[method] ?? handleMethodNotAllowedResponse + }), {}); + // Get all the methods that could be automatically implemented that were not + // implemented by the userland module. + const implemented = new Set(HTTP_METHODS.filter((method)=>handlers[method])); + const missing = AUTOMATIC_ROUTE_METHODS.filter((method)=>!implemented.has(method)); + // Loop over the missing methods to automatically implement them if we can. + for (const method of missing){ + // If the userland module doesn't implement the HEAD method, then + // we'll automatically implement it by calling the GET method (if it + // exists). + if (method === 'HEAD') { + if (handlers.GET) { + // Implement the HEAD method by calling the GET method. + methods.HEAD = handlers.GET; + // Mark it as implemented. + implemented.add('HEAD'); + } + continue; + } + // If OPTIONS is not provided then implement it. + if (method === 'OPTIONS') { + // TODO: check if HEAD is implemented, if so, use it to add more headers + // Get all the methods that were implemented by the userland module. + const allow = [ + 'OPTIONS', + ...implemented + ]; + // If the list of methods doesn't include HEAD, but it includes GET, then + // add HEAD as it's automatically implemented. + if (!implemented.has('HEAD') && implemented.has('GET')) { + allow.push('HEAD'); + } + // Sort and join the list with commas to create the `Allow` header. See: + // https://httpwg.org/specs/rfc9110.html#field.allow + const headers = { + Allow: allow.sort().join(', ') + }; + // Implement the OPTIONS method by returning a 204 response with the + // `Allow` header. + methods.OPTIONS = ()=>new Response(null, { + status: 204, + headers + }); + // Mark this method as implemented. + implemented.add('OPTIONS'); + continue; + } + throw new Error(`Invariant: should handle all automatic implementable methods, got method: ${method}`); + } + return methods; +} + +//# sourceMappingURL=auto-implement-methods.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/auto-implement-methods.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/auto-implement-methods.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0168b75b5f0a5446d4f4b077400f37f87d1a5c2e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/auto-implement-methods.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/server/route-modules/app-route/helpers/auto-implement-methods.ts"],"sourcesContent":["import type { AppRouteHandlerFn, AppRouteHandlers } from '../module'\n\nimport { HTTP_METHODS, type HTTP_METHOD } from '../../../web/http'\n\nconst AUTOMATIC_ROUTE_METHODS = ['HEAD', 'OPTIONS'] as const\n\nfunction handleMethodNotAllowedResponse(): Response {\n return new Response(null, { status: 405 })\n}\n\nexport function autoImplementMethods(\n handlers: AppRouteHandlers\n): Record {\n // Loop through all the HTTP methods to create the initial methods object.\n // Each of the methods will be set to the 405 response handler.\n const methods: Record = HTTP_METHODS.reduce(\n (acc, method) => ({\n ...acc,\n // If the userland module implements the method, then use it. Otherwise,\n // use the 405 response handler.\n [method]: handlers[method] ?? handleMethodNotAllowedResponse,\n }),\n {} as Record\n )\n\n // Get all the methods that could be automatically implemented that were not\n // implemented by the userland module.\n const implemented = new Set(HTTP_METHODS.filter((method) => handlers[method]))\n const missing = AUTOMATIC_ROUTE_METHODS.filter(\n (method) => !implemented.has(method)\n )\n\n // Loop over the missing methods to automatically implement them if we can.\n for (const method of missing) {\n // If the userland module doesn't implement the HEAD method, then\n // we'll automatically implement it by calling the GET method (if it\n // exists).\n if (method === 'HEAD') {\n if (handlers.GET) {\n // Implement the HEAD method by calling the GET method.\n methods.HEAD = handlers.GET\n\n // Mark it as implemented.\n implemented.add('HEAD')\n }\n continue\n }\n\n // If OPTIONS is not provided then implement it.\n if (method === 'OPTIONS') {\n // TODO: check if HEAD is implemented, if so, use it to add more headers\n\n // Get all the methods that were implemented by the userland module.\n const allow: HTTP_METHOD[] = ['OPTIONS', ...implemented]\n\n // If the list of methods doesn't include HEAD, but it includes GET, then\n // add HEAD as it's automatically implemented.\n if (!implemented.has('HEAD') && implemented.has('GET')) {\n allow.push('HEAD')\n }\n\n // Sort and join the list with commas to create the `Allow` header. See:\n // https://httpwg.org/specs/rfc9110.html#field.allow\n const headers = { Allow: allow.sort().join(', ') }\n\n // Implement the OPTIONS method by returning a 204 response with the\n // `Allow` header.\n methods.OPTIONS = () => new Response(null, { status: 204, headers })\n\n // Mark this method as implemented.\n implemented.add('OPTIONS')\n\n continue\n }\n\n throw new Error(\n `Invariant: should handle all automatic implementable methods, got method: ${method}`\n )\n }\n\n return methods\n}\n"],"names":["HTTP_METHODS","AUTOMATIC_ROUTE_METHODS","handleMethodNotAllowedResponse","Response","status","autoImplementMethods","handlers","methods","reduce","acc","method","implemented","Set","filter","missing","has","GET","HEAD","add","allow","push","headers","Allow","sort","join","OPTIONS","Error"],"mappings":"AAEA,SAASA,YAAY,QAA0B,oBAAmB;AAElE,MAAMC,0BAA0B;IAAC;IAAQ;CAAU;AAEnD,SAASC;IACP,OAAO,IAAIC,SAAS,MAAM;QAAEC,QAAQ;IAAI;AAC1C;AAEA,OAAO,SAASC,qBACdC,QAA0B;IAE1B,0EAA0E;IAC1E,+DAA+D;IAC/D,MAAMC,UAAkDP,aAAaQ,MAAM,CACzE,CAACC,KAAKC,SAAY,CAAA;YAChB,GAAGD,GAAG;YACN,wEAAwE;YACxE,gCAAgC;YAChC,CAACC,OAAO,EAAEJ,QAAQ,CAACI,OAAO,IAAIR;QAChC,CAAA,GACA,CAAC;IAGH,4EAA4E;IAC5E,sCAAsC;IACtC,MAAMS,cAAc,IAAIC,IAAIZ,aAAaa,MAAM,CAAC,CAACH,SAAWJ,QAAQ,CAACI,OAAO;IAC5E,MAAMI,UAAUb,wBAAwBY,MAAM,CAC5C,CAACH,SAAW,CAACC,YAAYI,GAAG,CAACL;IAG/B,2EAA2E;IAC3E,KAAK,MAAMA,UAAUI,QAAS;QAC5B,iEAAiE;QACjE,oEAAoE;QACpE,WAAW;QACX,IAAIJ,WAAW,QAAQ;YACrB,IAAIJ,SAASU,GAAG,EAAE;gBAChB,uDAAuD;gBACvDT,QAAQU,IAAI,GAAGX,SAASU,GAAG;gBAE3B,0BAA0B;gBAC1BL,YAAYO,GAAG,CAAC;YAClB;YACA;QACF;QAEA,gDAAgD;QAChD,IAAIR,WAAW,WAAW;YACxB,wEAAwE;YAExE,oEAAoE;YACpE,MAAMS,QAAuB;gBAAC;mBAAcR;aAAY;YAExD,yEAAyE;YACzE,8CAA8C;YAC9C,IAAI,CAACA,YAAYI,GAAG,CAAC,WAAWJ,YAAYI,GAAG,CAAC,QAAQ;gBACtDI,MAAMC,IAAI,CAAC;YACb;YAEA,wEAAwE;YACxE,oDAAoD;YACpD,MAAMC,UAAU;gBAAEC,OAAOH,MAAMI,IAAI,GAAGC,IAAI,CAAC;YAAM;YAEjD,oEAAoE;YACpE,kBAAkB;YAClBjB,QAAQkB,OAAO,GAAG,IAAM,IAAItB,SAAS,MAAM;oBAAEC,QAAQ;oBAAKiB;gBAAQ;YAElE,mCAAmC;YACnCV,YAAYO,GAAG,CAAC;YAEhB;QACF;QAEA,MAAM,IAAIQ,MACR,CAAC,0EAA0E,EAAEhB,QAAQ;IAEzF;IAEA,OAAOH;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/clean-url.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/clean-url.js new file mode 100644 index 0000000000000000000000000000000000000000..a38af4a2d8cefaba51c878caf08aa4e5030e68c6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/clean-url.js @@ -0,0 +1,14 @@ +/** + * Cleans a URL by stripping the protocol, host, and search params. + * + * @param urlString the url to clean + * @returns the cleaned url + */ export function cleanURL(url) { + const u = new URL(url); + u.host = 'localhost:3000'; + u.search = ''; + u.protocol = 'http'; + return u; +} + +//# sourceMappingURL=clean-url.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/clean-url.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/clean-url.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e8af213d4a0e5f82a5585cf66817378513348628 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/clean-url.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/server/route-modules/app-route/helpers/clean-url.ts"],"sourcesContent":["/**\n * Cleans a URL by stripping the protocol, host, and search params.\n *\n * @param urlString the url to clean\n * @returns the cleaned url\n */\n\nexport function cleanURL(url: string | URL): URL {\n const u = new URL(url)\n u.host = 'localhost:3000'\n u.search = ''\n u.protocol = 'http'\n return u\n}\n"],"names":["cleanURL","url","u","URL","host","search","protocol"],"mappings":"AAAA;;;;;CAKC,GAED,OAAO,SAASA,SAASC,GAAiB;IACxC,MAAMC,IAAI,IAAIC,IAAIF;IAClBC,EAAEE,IAAI,GAAG;IACTF,EAAEG,MAAM,GAAG;IACXH,EAAEI,QAAQ,GAAG;IACb,OAAOJ;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/get-pathname-from-absolute-path.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/get-pathname-from-absolute-path.js new file mode 100644 index 0000000000000000000000000000000000000000..b2bfdce9b7cd72e931141000634e928ef8d06e74 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/get-pathname-from-absolute-path.js @@ -0,0 +1,19 @@ +/** + * Get pathname from absolute path. + * + * @param absolutePath the absolute path + * @returns the pathname + */ export function getPathnameFromAbsolutePath(absolutePath) { + // Remove prefix including app dir + let appDir = '/app/'; + if (!absolutePath.includes(appDir)) { + appDir = '\\app\\'; + } + const [, ...parts] = absolutePath.split(appDir); + const relativePath = appDir[0] + parts.join(appDir); + // remove extension + const pathname = relativePath.split('.').slice(0, -1).join('.'); + return pathname; +} + +//# sourceMappingURL=get-pathname-from-absolute-path.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/get-pathname-from-absolute-path.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/get-pathname-from-absolute-path.js.map new file mode 100644 index 0000000000000000000000000000000000000000..bac1220731cdd5302a8fcb5ab81e07a42c9ea6b7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/get-pathname-from-absolute-path.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/server/route-modules/app-route/helpers/get-pathname-from-absolute-path.ts"],"sourcesContent":["/**\n * Get pathname from absolute path.\n *\n * @param absolutePath the absolute path\n * @returns the pathname\n */\nexport function getPathnameFromAbsolutePath(absolutePath: string) {\n // Remove prefix including app dir\n let appDir = '/app/'\n if (!absolutePath.includes(appDir)) {\n appDir = '\\\\app\\\\'\n }\n const [, ...parts] = absolutePath.split(appDir)\n const relativePath = appDir[0] + parts.join(appDir)\n\n // remove extension\n const pathname = relativePath.split('.').slice(0, -1).join('.')\n return pathname\n}\n"],"names":["getPathnameFromAbsolutePath","absolutePath","appDir","includes","parts","split","relativePath","join","pathname","slice"],"mappings":"AAAA;;;;;CAKC,GACD,OAAO,SAASA,4BAA4BC,YAAoB;IAC9D,kCAAkC;IAClC,IAAIC,SAAS;IACb,IAAI,CAACD,aAAaE,QAAQ,CAACD,SAAS;QAClCA,SAAS;IACX;IACA,MAAM,GAAG,GAAGE,MAAM,GAAGH,aAAaI,KAAK,CAACH;IACxC,MAAMI,eAAeJ,MAAM,CAAC,EAAE,GAAGE,MAAMG,IAAI,CAACL;IAE5C,mBAAmB;IACnB,MAAMM,WAAWF,aAAaD,KAAK,CAAC,KAAKI,KAAK,CAAC,GAAG,CAAC,GAAGF,IAAI,CAAC;IAC3D,OAAOC;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/is-static-gen-enabled.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/is-static-gen-enabled.js new file mode 100644 index 0000000000000000000000000000000000000000..cb67b528e274fd0d95bc02372125cf2d9bab6043 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/is-static-gen-enabled.js @@ -0,0 +1,12 @@ +// route handlers are only statically optimized if they define +// one of these top-level configs manually +// - dynamic = 'force-static' +// - dynamic = 'error' +// - revalidate > 0 +// - revalidate = false +// - generateStaticParams +export function isStaticGenEnabled(mod) { + return mod.dynamic === 'force-static' || mod.dynamic === 'error' || mod.revalidate === false || mod.revalidate !== undefined && mod.revalidate > 0 || typeof mod.generateStaticParams == 'function'; +} + +//# sourceMappingURL=is-static-gen-enabled.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/is-static-gen-enabled.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/is-static-gen-enabled.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b681a61cabc5c2ed8e7d47184889c95ceb09d8a7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/is-static-gen-enabled.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/server/route-modules/app-route/helpers/is-static-gen-enabled.ts"],"sourcesContent":["import type { AppRouteModule } from '../module.compiled'\n\n// route handlers are only statically optimized if they define\n// one of these top-level configs manually\n// - dynamic = 'force-static'\n// - dynamic = 'error'\n// - revalidate > 0\n// - revalidate = false\n// - generateStaticParams\nexport function isStaticGenEnabled(\n mod: AppRouteModule['routeModule']['userland']\n) {\n return (\n mod.dynamic === 'force-static' ||\n mod.dynamic === 'error' ||\n mod.revalidate === false ||\n (mod.revalidate !== undefined && mod.revalidate > 0) ||\n typeof mod.generateStaticParams == 'function'\n )\n}\n"],"names":["isStaticGenEnabled","mod","dynamic","revalidate","undefined","generateStaticParams"],"mappings":"AAEA,8DAA8D;AAC9D,0CAA0C;AAC1C,+BAA+B;AAC/B,wBAAwB;AACxB,qBAAqB;AACrB,yBAAyB;AACzB,2BAA2B;AAC3B,OAAO,SAASA,mBACdC,GAA8C;IAE9C,OACEA,IAAIC,OAAO,KAAK,kBAChBD,IAAIC,OAAO,KAAK,WAChBD,IAAIE,UAAU,KAAK,SAClBF,IAAIE,UAAU,KAAKC,aAAaH,IAAIE,UAAU,GAAG,KAClD,OAAOF,IAAII,oBAAoB,IAAI;AAEvC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/parsed-url-query-to-params.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/parsed-url-query-to-params.js new file mode 100644 index 0000000000000000000000000000000000000000..04c0fd95dd2afe9d05f4f9593acb646e35420298 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/parsed-url-query-to-params.js @@ -0,0 +1,15 @@ +/** + * Converts the query into params. + * + * @param query the query to convert to params + * @returns the params + */ export function parsedUrlQueryToParams(query) { + const params = {}; + for (const [key, value] of Object.entries(query)){ + if (typeof value === 'undefined') continue; + params[key] = value; + } + return params; +} + +//# sourceMappingURL=parsed-url-query-to-params.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/parsed-url-query-to-params.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/parsed-url-query-to-params.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7d26fab87e6d26515873e89de9e7bf87a9993305 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/helpers/parsed-url-query-to-params.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/server/route-modules/app-route/helpers/parsed-url-query-to-params.ts"],"sourcesContent":["import type { ParsedUrlQuery } from 'querystring'\n\n/**\n * Converts the query into params.\n *\n * @param query the query to convert to params\n * @returns the params\n */\nexport function parsedUrlQueryToParams(\n query: ParsedUrlQuery\n): Record {\n const params: Record = {}\n\n for (const [key, value] of Object.entries(query)) {\n if (typeof value === 'undefined') continue\n params[key] = value\n }\n\n return params\n}\n"],"names":["parsedUrlQueryToParams","query","params","key","value","Object","entries"],"mappings":"AAEA;;;;;CAKC,GACD,OAAO,SAASA,uBACdC,KAAqB;IAErB,MAAMC,SAA4C,CAAC;IAEnD,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACL,OAAQ;QAChD,IAAI,OAAOG,UAAU,aAAa;QAClCF,MAAM,CAACC,IAAI,GAAGC;IAChB;IAEA,OAAOF;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/module.compiled.d.ts b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/module.compiled.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5401340695abe4a87f20f88a898449b7a42edfd6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/module.compiled.d.ts @@ -0,0 +1 @@ +export * from './module' diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/module.compiled.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/module.compiled.js new file mode 100644 index 0000000000000000000000000000000000000000..953e2846f4ec4f837a199d93e2a0ea366441677d --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/module.compiled.js @@ -0,0 +1,35 @@ +if (process.env.NEXT_RUNTIME === 'edge') { + module.exports = require('next/dist/server/route-modules/app-route/module.js'); +} else { + if (process.env.__NEXT_EXPERIMENTAL_REACT) { + if (process.env.NODE_ENV === 'development') { + if (process.env.TURBOPACK) { + module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.dev.js'); + } else { + module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.dev.js'); + } + } else { + if (process.env.TURBOPACK) { + module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.prod.js'); + } else { + module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.prod.js'); + } + } + } else { + if (process.env.NODE_ENV === 'development') { + if (process.env.TURBOPACK) { + module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.dev.js'); + } else { + module.exports = require('next/dist/compiled/next-server/app-route.runtime.dev.js'); + } + } else { + if (process.env.TURBOPACK) { + module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.prod.js'); + } else { + module.exports = require('next/dist/compiled/next-server/app-route.runtime.prod.js'); + } + } + } +} + +//# sourceMappingURL=module.compiled.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/module.compiled.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/module.compiled.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b6b8ba905d1e5d14f3f825fbe8f5cdf412568af7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/module.compiled.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/route-modules/app-route/module.compiled.js"],"sourcesContent":["if (process.env.NEXT_RUNTIME === 'edge') {\n module.exports = require('next/dist/server/route-modules/app-route/module.js')\n} else {\n if (process.env.__NEXT_EXPERIMENTAL_REACT) {\n if (process.env.NODE_ENV === 'development') {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.dev.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.dev.js')\n }\n } else {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-route-turbo-experimental.runtime.prod.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-route-experimental.runtime.prod.js')\n }\n }\n } else {\n if (process.env.NODE_ENV === 'development') {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.dev.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-route.runtime.dev.js')\n }\n } else {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-route-turbo.runtime.prod.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-route.runtime.prod.js')\n }\n }\n }\n}\n"],"names":["process","env","NEXT_RUNTIME","module","exports","require","__NEXT_EXPERIMENTAL_REACT","NODE_ENV","TURBOPACK"],"mappings":"AAAA,IAAIA,QAAQC,GAAG,CAACC,YAAY,KAAK,QAAQ;IACvCC,OAAOC,OAAO,GAAGC,QAAQ;AAC3B,OAAO;IACL,IAAIL,QAAQC,GAAG,CAACK,yBAAyB,EAAE;QACzC,IAAIN,QAAQC,GAAG,CAACM,QAAQ,KAAK,eAAe;YAC1C,IAAIP,QAAQC,GAAG,CAACO,SAAS,EAAE;gBACzBL,OAAOC,OAAO,GAAGC,QAAQ;YAC3B,OAAO;gBACLF,OAAOC,OAAO,GAAGC,QAAQ;YAC3B;QACF,OAAO;YACL,IAAIL,QAAQC,GAAG,CAACO,SAAS,EAAE;gBACzBL,OAAOC,OAAO,GAAGC,QAAQ;YAC3B,OAAO;gBACLF,OAAOC,OAAO,GAAGC,QAAQ;YAC3B;QACF;IACF,OAAO;QACL,IAAIL,QAAQC,GAAG,CAACM,QAAQ,KAAK,eAAe;YAC1C,IAAIP,QAAQC,GAAG,CAACO,SAAS,EAAE;gBACzBL,OAAOC,OAAO,GAAGC,QAAQ;YAC3B,OAAO;gBACLF,OAAOC,OAAO,GAAGC,QAAQ;YAC3B;QACF,OAAO;YACL,IAAIL,QAAQC,GAAG,CAACO,SAAS,EAAE;gBACzBL,OAAOC,OAAO,GAAGC,QAAQ;YAC3B,OAAO;gBACLF,OAAOC,OAAO,GAAGC,QAAQ;YAC3B;QACF;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/module.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/module.js new file mode 100644 index 0000000000000000000000000000000000000000..fc3f5b2c838095ca2831f7c71141df7f3b268d9b --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/module.js @@ -0,0 +1,854 @@ +import { RouteModule } from '../route-module'; +import { createRequestStoreForAPI } from '../../async-storage/request-store'; +import { createPrerenderWorkStore, createWorkStore } from '../../async-storage/work-store'; +import { HTTP_METHODS, isHTTPMethod } from '../../web/http'; +import { getImplicitTags } from '../../lib/implicit-tags'; +import { patchFetch } from '../../lib/patch-fetch'; +import { getTracer } from '../../lib/trace/tracer'; +import { AppRouteRouteHandlersSpan, AppRouteRouteModuleSpan } from '../../lib/trace/constants'; +import * as Log from '../../../build/output/log'; +import { autoImplementMethods } from './helpers/auto-implement-methods'; +import { appendMutableCookies } from '../../web/spec-extension/adapters/request-cookies'; +import { HeadersAdapter } from '../../web/spec-extension/adapters/headers'; +import { RequestCookiesAdapter } from '../../web/spec-extension/adapters/request-cookies'; +import { parsedUrlQueryToParams } from './helpers/parsed-url-query-to-params'; +import { Phase, printDebugThrownValueForProspectiveRender } from '../../app-render/prospective-render-utils'; +import * as serverHooks from '../../../client/components/hooks-server-context'; +import { DynamicServerError } from '../../../client/components/hooks-server-context'; +import { workAsyncStorage } from '../../app-render/work-async-storage.external'; +import { workUnitAsyncStorage } from '../../app-render/work-unit-async-storage.external'; +import { actionAsyncStorage } from '../../app-render/action-async-storage.external'; +import * as sharedModules from './shared-modules'; +import { getIsPossibleServerAction } from '../../lib/server-action-request-meta'; +import { RequestCookies } from 'next/dist/compiled/@edge-runtime/cookies'; +import { cleanURL } from './helpers/clean-url'; +import { StaticGenBailoutError } from '../../../client/components/static-generation-bailout'; +import { isStaticGenEnabled } from './helpers/is-static-gen-enabled'; +import { abortAndThrowOnSynchronousRequestDataAccess, createDynamicTrackingState, getFirstDynamicReason } from '../../app-render/dynamic-rendering'; +import { ReflectAdapter } from '../../web/spec-extension/adapters/reflect'; +import { CacheSignal } from '../../app-render/cache-signal'; +import { scheduleImmediate } from '../../../lib/scheduler'; +import { createServerParamsForRoute } from '../../request/params'; +import { getRedirectStatusCodeFromError, getURLFromRedirectError } from '../../../client/components/redirect'; +import { isRedirectError } from '../../../client/components/redirect-error'; +import { getAccessFallbackHTTPStatus, isHTTPAccessFallbackError } from '../../../client/components/http-access-fallback/http-access-fallback'; +import { RedirectStatusCode } from '../../../client/components/redirect-status-code'; +import { INFINITE_CACHE } from '../../../lib/constants'; +import { executeRevalidates } from '../../revalidation-utils'; +import { trackPendingModules } from '../../app-render/module-loading/track-module-loading.external'; +import { InvariantError } from '../../../shared/lib/invariant-error'; +import { LazyModule } from '../../lib/lazy-module'; +import { createPrerenderResumeDataCache } from '../../resume-data-cache/resume-data-cache'; +import { createRouteHandlerRequestInUseCacheError, createRouteHandlerRequestInUnstableCacheError } from '../../use-cache/use-cache-messages'; +export class WrappedNextRouterError { + constructor(error, headers){ + this.error = error; + this.headers = headers; + } +} +/** + * AppRouteRouteHandler is the handler for app routes. + */ export class AppRouteRouteModule extends RouteModule { + static #_ = this.sharedModules = sharedModules; + get userland() { + return this._lazyUserland.assertLoaded(); + } + /** + * Ensures the userland module is fully loaded before it's accessed via + * `userland`. Required for route files that use top-level await, where + * require() returns a promise instead of the module directly. Must be called + * before accessing `userland` in contexts where the module may not yet be + * resolved (e.g. the export/static-generation worker). + */ async ensureUserland() { + await this._lazyUserland.waitUntilLoaded(); + } + constructor({ userland, getUserland, definition, distDir, relativeProjectDir, resolvedPagePath, nextConfigOutput }){ + super({ + userland: undefined, + definition, + distDir, + relativeProjectDir + }), /** + * A reference to the request async storage. + */ this.workUnitAsyncStorage = workUnitAsyncStorage, /** + * A reference to the static generation async storage. + */ this.workAsyncStorage = workAsyncStorage, /** + * An interface to call server hooks which interact with the underlying + * storage. + */ this.serverHooks = serverHooks, /** + * A reference to the mutation related async storage, such as mutations of + * cookies. + */ this.actionAsyncStorage = actionAsyncStorage; + this.resolvedPagePath = resolvedPagePath; + this.nextConfigOutput = nextConfigOutput; + this._getUserland = getUserland; + this._lazyUserland = new LazyModule(()=>getTracer().trace(AppRouteRouteModuleSpan.loadUserland, { + spanName: 'load app route module', + attributes: { + 'next.route': this.definition.pathname + } + }, userland), (module)=>this._onUserlandLoaded(module)); + // output:export routes load eagerly, so that errors surface at module + // load time (as a Redbox in dev) rather than at request time. + if (nextConfigOutput === 'export') { + this._lazyUserland.loadIfNeeded(); + } + } + _onUserlandLoaded(userland) { + // Automatically implement some methods if they aren't implemented by the + // userland module. + this._methods = autoImplementMethods(userland); + // Get the non-static methods for this route. + this._hasNonStaticMethods = hasNonStaticMethods(userland); + // Get the dynamic property from the userland module. + this._dynamic = userland.dynamic; + if (this.nextConfigOutput === 'export') { + if (this._dynamic === 'force-dynamic') { + throw new Error(`export const dynamic = "force-dynamic" on page "${this.definition.pathname}" cannot be used with "output: export". See more info here: https://nextjs.org/docs/advanced-features/static-html-export`); + } else if (!isStaticGenEnabled(userland) && userland['GET']) { + throw new Error(`export const dynamic = "force-static"/export const revalidate not configured on route "${this.definition.pathname}" with "output: export". See more info here: https://nextjs.org/docs/advanced-features/static-html-export`); + } else { + this._dynamic = 'error'; + } + } + // We only warn in development after here, so return if we're not in + // development. + if (process.env.NODE_ENV === 'development') { + // Print error in development if the exported handlers are in lowercase, only + // uppercase handlers are supported. + const lowercased = HTTP_METHODS.map((method)=>method.toLowerCase()); + for (const method of lowercased){ + if (method in userland) { + Log.error(`Detected lowercase method '${method}' in '${this.resolvedPagePath}'. Export the uppercase '${method.toUpperCase()}' method name to fix this error.`); + } + } + // Print error if the module exports a default handler, they must use named + // exports for each HTTP method. + if ('default' in userland) { + Log.error(`Detected default export in '${this.resolvedPagePath}'. Export a named export for each HTTP method instead.`); + } + // If there is no methods exported by this module, then return a not found + // response. + if (!HTTP_METHODS.some((method)=>method in userland)) { + Log.error(`No HTTP methods exported in '${this.resolvedPagePath}'. Export a named export for each HTTP method.`); + } + } + } + /** + * Returns the handler function for the given HTTP method. + * Must be called after ensureUserland() has resolved so that _methods is + * populated. + */ resolveHandler(method) { + // Prevent RCE: only allow recognized HTTP methods. + if (!isHTTPMethod(method)) return ()=>new Response(null, { + status: 400 + }); + return this._methods[method]; + } + /** + * Returns the handler for the given method using a live userland snapshot. + * Used in Turbopack dev mode to pick up server HMR updates. The userland + * is fetched synchronously via require() so no async overhead is added. + */ resolveHandlerFromUserland(method, userland) { + if (!isHTTPMethod(method)) return ()=>new Response(null, { + status: 400 + }); + return autoImplementMethods(userland)[method]; + } + resolvePendingRevalidations(workStore, requestStore, context) { + const maybeRevalidatesPromise = executeRevalidates(workStore); + if (maybeRevalidatesPromise !== false) { + context.renderOpts.pendingWaitUntil = maybeRevalidatesPromise.finally(()=>{ + if (process.env.NEXT_PRIVATE_DEBUG_CACHE) { + console.log('pending revalidates promise finished for:', requestStore.url.pathname + requestStore.url.search); + } + }); + } + } + handleHandlerError(err, actionStore, workStore, requestStore, context) { + if (isRedirectError(err)) { + const url = getURLFromRedirectError(err); + if (!url) { + throw new Error('Invariant: Unexpected redirect url format'); + } + // We need to capture any headers that should be sent on the response. + const headers = new Headers({ + Location: url + }); + // Let's append any cookies that were added by the cookie API. + // TODO leaving the gate here b/c it indicates that we might not actually + // want to do this on every handler invocation. During prerender there + // should be no mutableCookies because then they'd be dynamic. + appendMutableCookies(headers, requestStore.mutableCookies); + this.resolvePendingRevalidations(workStore, requestStore, context); + return new Response(null, { + // If we're in an action, we want to use a 303 redirect as we don't + // want the POST request to follow the redirect, as it could result in + // erroneous re-submissions. + status: actionStore.isAction ? RedirectStatusCode.SeeOther : getRedirectStatusCodeFromError(err), + headers + }); + } + if (isHTTPAccessFallbackError(err)) { + const httpStatus = getAccessFallbackHTTPStatus(err); + return new Response(null, { + status: httpStatus + }); + } + throw err; + } + finalizeResponse(res, request, workStore, requestStore, prerenderStore, context) { + if (!(res instanceof Response)) { + var _res_constructor; + const invalidType = res === null ? 'null' : res === undefined ? 'undefined' : typeof res === 'object' ? ((_res_constructor = res.constructor) == null ? void 0 : _res_constructor.name) || 'object' : typeof res; + throw new Error(`No response is returned from route handler '${this.resolvedPagePath}'. ` + `Expected a Response object but received '${invalidType}' (method: ${request.method}, url: ${requestStore.url.pathname}). ` + `Ensure you return a \`Response\` or a \`NextResponse\` in all branches of your handler.`); + } + context.renderOpts.fetchMetrics = workStore.fetchMetrics; + this.resolvePendingRevalidations(workStore, requestStore, context); + if (prerenderStore) { + var _prerenderStore_tags; + context.renderOpts.collectedTags = (_prerenderStore_tags = prerenderStore.tags) == null ? void 0 : _prerenderStore_tags.join(','); + context.renderOpts.collectedRevalidate = prerenderStore.revalidate; + context.renderOpts.collectedExpire = prerenderStore.expire; + context.renderOpts.collectedStale = prerenderStore.stale; + } + // It's possible cookies were set in the handler, so we need to merge the + // modified cookies and the returned response here. + const headers = new Headers(res.headers); + if (appendMutableCookies(headers, requestStore.mutableCookies)) { + return new Response(res.body, { + status: res.status, + statusText: res.statusText, + headers + }); + } + return res; + } + async prerenderToResponse(handler, actionStore, workStore, requestStore, implicitTags, request, context) { + const cacheComponentsEnabled = !!context.renderOpts.cacheComponents; + // Patch the global fetch. + patchFetch({ + workAsyncStorage: this.workAsyncStorage, + workUnitAsyncStorage: this.workUnitAsyncStorage + }); + const handlerContext = { + params: context.params ? createServerParamsForRoute(parsedUrlQueryToParams(context.params)) : undefined + }; + let prerenderStore; + let res; + try { + const userlandRevalidate = this.userland.revalidate; + const defaultRevalidate = // If the static generation store does not have a revalidate value + // set, then we should set it the revalidate value from the userland + // module or default to false. + userlandRevalidate === false || userlandRevalidate === undefined ? INFINITE_CACHE : userlandRevalidate; + if (cacheComponentsEnabled) { + /** + * When we are attempting to statically prerender the GET handler of a route.ts module + * and cacheComponents is on we follow a similar pattern to rendering. + * + * We first run the handler letting caches fill. If something synchronously dynamic occurs + * during this prospective render then we can infer it will happen on every render and we + * just bail out of prerendering. + * + * Next we run the handler again and we check if we get a result back in a microtask. + * Next.js expects the return value to be a Response or a Thenable that resolves to a Response. + * Unfortunately Response's do not allow for accessing the response body synchronously or in + * a microtask so we need to allow one more task to unwrap the response body. This is a slightly + * different semantic than what we have when we render and it means that certain tasks can still + * execute before a prerender completes such as a carefully timed setImmediate. + * + * Functionally though IO should still take longer than the time it takes to unwrap the response body + * so our heuristic of excluding any IO should be preserved. + */ const prospectiveController = new AbortController(); + let prospectiveRenderIsDynamic = false; + const cacheSignal = new CacheSignal(null); + let dynamicTracking = createDynamicTrackingState(undefined); + // TODO: Route handlers are never resumed, so it's counter-intuitive + // to use an RDC here. However, we need the data cache to store cached + // results in memory during the prospective prerender, so that they + // can be retrieved during the final prerender within microtasks. This + // is crucial when doing revalidations of a deployed route handler, + // where the default cache handler does not do any in-memory caching. + const prerenderResumeDataCache = createPrerenderResumeDataCache(); + const prospectiveRoutePrerenderStore = prerenderStore = { + type: 'prerender', + phase: 'action', + // This replicates prior behavior where rootParams is empty in routes + // TODO we need to make this have the proper rootParams for this route + rootParams: {}, + fallbackRouteParams: null, + implicitTags, + renderSignal: prospectiveController.signal, + controller: prospectiveController, + stagedRendering: null, + cacheSignal, + // During prospective render we don't use a controller + // because we need to let all caches fill. + dynamicTracking, + revalidate: defaultRevalidate, + expire: INFINITE_CACHE, + stale: INFINITE_CACHE, + tags: [ + ...implicitTags.tags + ], + resumeDataCache: prerenderResumeDataCache, + hmrRefreshHash: undefined, + varyParamsAccumulator: null, + ensureStaticLevel: null, + prerenderDataTracking: null, + isFallbackUpgradeable: false + }; + let prospectiveResult; + try { + prospectiveResult = this.workUnitAsyncStorage.run(prospectiveRoutePrerenderStore, handler, request, handlerContext); + } catch (err) { + if (prospectiveController.signal.aborted) { + // the route handler called an API which is always dynamic + // there is no need to try again + prospectiveRenderIsDynamic = true; + } else if (process.env.NEXT_DEBUG_BUILD || process.env.__NEXT_VERBOSE_LOGGING) { + printDebugThrownValueForProspectiveRender(err, workStore.route, Phase.ProspectiveRender); + } + } + if (typeof prospectiveResult === 'object' && prospectiveResult !== null && typeof prospectiveResult.then === 'function') { + // The handler returned a Thenable. We'll listen for rejections to determine + // if the route is erroring for dynamic reasons. + ; + prospectiveResult.then(()=>{}, (err)=>{ + if (prospectiveController.signal.aborted) { + // the route handler called an API which is always dynamic + // there is no need to try again + prospectiveRenderIsDynamic = true; + } else if (process.env.NEXT_DEBUG_BUILD) { + printDebugThrownValueForProspectiveRender(err, workStore.route, Phase.ProspectiveRender); + } + }); + } + trackPendingModules(cacheSignal); + await cacheSignal.cacheReady(); + if (prospectiveRenderIsDynamic) { + // the route handler called an API which is always dynamic + // there is no need to try again + const dynamicReason = getFirstDynamicReason(dynamicTracking); + if (dynamicReason) { + throw new DynamicServerError(`Route ${workStore.route} couldn't be rendered statically because it used \`${dynamicReason}\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`); + } else { + console.error('Expected Next.js to keep track of reason for opting out of static rendering but one was not found. This is a bug in Next.js'); + throw new DynamicServerError(`Route ${workStore.route} couldn't be rendered statically because it used a dynamic API. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`); + } + } + // TODO start passing this controller to the route handler. We should expose + // it so the handler to abort inflight requests and other operations if we abort + // the prerender. + const finalController = new AbortController(); + dynamicTracking = createDynamicTrackingState(undefined); + const finalRoutePrerenderStore = prerenderStore = { + type: 'prerender', + phase: 'action', + rootParams: {}, + fallbackRouteParams: null, + implicitTags, + renderSignal: finalController.signal, + controller: finalController, + stagedRendering: null, + cacheSignal: null, + dynamicTracking, + revalidate: defaultRevalidate, + expire: INFINITE_CACHE, + stale: INFINITE_CACHE, + tags: [ + ...implicitTags.tags + ], + resumeDataCache: prerenderResumeDataCache, + hmrRefreshHash: undefined, + varyParamsAccumulator: null, + ensureStaticLevel: null, + prerenderDataTracking: null, + isFallbackUpgradeable: false + }; + let responseHandled = false; + res = await new Promise((resolve, reject)=>{ + scheduleImmediate(async ()=>{ + try { + const result = await this.workUnitAsyncStorage.run(finalRoutePrerenderStore, handler, request, handlerContext); + if (responseHandled) { + // we already rejected in the followup task + return; + } else if (!(result instanceof Response)) { + // This is going to error but we let that happen below + resolve(result); + return; + } + responseHandled = true; + let bodyHandled = false; + result.arrayBuffer().then((body)=>{ + if (!bodyHandled) { + bodyHandled = true; + resolve(new Response(body, { + headers: result.headers, + status: result.status, + statusText: result.statusText + })); + } + }, reject); + scheduleImmediate(()=>{ + if (!bodyHandled) { + bodyHandled = true; + finalController.abort(); + reject(createCacheComponentsError(workStore.route)); + } + }); + } catch (err) { + reject(err); + } + }); + scheduleImmediate(()=>{ + if (!responseHandled) { + responseHandled = true; + finalController.abort(); + reject(createCacheComponentsError(workStore.route)); + } + }); + }); + if (finalController.signal.aborted) { + // We aborted from within the execution + throw createCacheComponentsError(workStore.route); + } else { + // We didn't abort during the execution. We can abort now as a matter of semantics + // though at the moment nothing actually consumes this signal so it won't halt any + // inflight work. + finalController.abort(); + } + } else { + prerenderStore = { + type: 'prerender-legacy', + phase: 'action', + rootParams: {}, + implicitTags, + revalidate: defaultRevalidate, + expire: INFINITE_CACHE, + stale: INFINITE_CACHE, + tags: [ + ...implicitTags.tags + ] + }; + res = await workUnitAsyncStorage.run(prerenderStore, handler, request, handlerContext); + } + } catch (err) { + return this.handleHandlerError(err, actionStore, workStore, requestStore, context); + } + return this.finalizeResponse(res, request, workStore, requestStore, prerenderStore, context); + } + async renderToResponse(handler, actionStore, workStore, requestStore, request, context) { + // Patch the global fetch. + patchFetch({ + workAsyncStorage: this.workAsyncStorage, + workUnitAsyncStorage: this.workUnitAsyncStorage + }); + const handlerContext = { + params: context.params ? createServerParamsForRoute(parsedUrlQueryToParams(context.params)) : undefined + }; + let res; + try { + res = await workUnitAsyncStorage.run(requestStore, handler, request, handlerContext); + } catch (err) { + return this.handleHandlerError(err, actionStore, workStore, requestStore, context); + } + return this.finalizeResponse(res, request, workStore, requestStore, null, context); + } + async prepareExecution(req, context) { + // Ensure userland is fully loaded (handles async modules with top-level + // await, where require() returns a Promise instead of the module). + await this.ensureUserland(); + // In Turbopack dev mode, fetch the live userland module on every request + // via the synchronous require() getter so server HMR updates are reflected + // immediately. This is cheap — it is just a devModuleCache lookup. + // For routes with top-level await, require() may still return a Promise + // (async module); in that case fall back to the already-resolved + // userland module resolved by ensureUserland() above. + const rawLiveUserland = this._getUserland == null ? void 0 : this._getUserland.call(this); + const liveUserland = rawLiveUserland instanceof Promise ? undefined : rawLiveUserland; + const handler = liveUserland ? this.resolveHandlerFromUserland(req.method, liveUserland) : this.resolveHandler(req.method); + // Use the live userland (if available) for per-request values so HMR + // changes to fetchCache, dynamic, etc. are also picked up. + const userland = liveUserland ?? this.userland; + // Add the fetchCache option to the renderOpts. + context.renderOpts.fetchCache = userland.fetchCache; + const actionStore = { + isAppRoute: true, + isAction: getIsPossibleServerAction(req) + }; + const implicitTags = await getImplicitTags(this.definition.page, req.nextUrl.pathname, // App Routes don't support unknown route params. + null); + const requestStore = createRequestStoreForAPI(req, req.nextUrl, implicitTags, undefined, context.previewProps, context.renderOpts.hmrRefreshHash); + return { + handler, + dynamic: (liveUserland == null ? void 0 : liveUserland.dynamic) ?? this._dynamic, + hasNonStaticMethods: liveUserland ? hasNonStaticMethods(liveUserland) : this._hasNonStaticMethods, + actionStore, + implicitTags, + requestStore + }; + } + validateExecutionResponse(response) { + // If the handler didn't return a valid response, then return the internal + // error response. + if (!(response instanceof Response)) { + // TODO: validate the correct handling behavior, maybe log something? + return new Response(null, { + status: 500 + }); + } + if (response.headers.has('x-middleware-rewrite')) { + throw new Error('NextResponse.rewrite() was used in a app route handler, this is not currently supported. Please remove the invocation to continue.'); + } + if (response.headers.get('x-middleware-next') === '1') { + // TODO: move this error into the `NextResponse.next()` function. + throw new Error('NextResponse.next() was used in a app route handler, this is not supported. See here for more info: https://nextjs.org/docs/messages/next-response-next-in-app-route-handler'); + } + return response; + } + async executeRequest(req, context, prepared, workStore) { + const { actionStore, handler, requestStore } = prepared; + const response = await this.actionAsyncStorage.run(actionStore, ()=>this.workUnitAsyncStorage.run(requestStore, ()=>this.workAsyncStorage.run(workStore, ()=>{ + let request = req; + switch(prepared.dynamic){ + case 'force-dynamic': + workStore.forceDynamic = true; + break; + case 'force-static': + workStore.forceStatic = true; + request = new Proxy(req, forceStaticRequestHandlers); + break; + case 'error': + workStore.dynamicShouldError = true; + break; + case undefined: + case 'auto': + request = proxyNextRequest(req, workStore); + break; + default: + prepared.dynamic; + } + const tracer = getTracer(); + const { pathname } = this.definition; + tracer.setRootSpanAttribute('next.route', pathname); + return tracer.trace(AppRouteRouteHandlersSpan.runHandler, { + spanName: `executing api route (app) ${pathname}`, + attributes: { + 'next.route': pathname + } + }, ()=>this.renderToResponse(handler, actionStore, workStore, requestStore, request, context)); + }))); + return this.validateExecutionResponse(response); + } + async executePrerender(req, context, prepared, workStore) { + const { actionStore, handler, implicitTags, requestStore } = prepared; + // Run the handler with the request AsyncLocalStorage to inject the helper + // support. We set this to `unknown` because the type is not known until + // runtime when we do a instanceof check below. + const response = await this.actionAsyncStorage.run(actionStore, ()=>this.workUnitAsyncStorage.run(requestStore, ()=>this.workAsyncStorage.run(workStore, ()=>{ + if (prepared.hasNonStaticMethods) { + const err = new DynamicServerError('Route is configured with methods that cannot be statically generated.'); + workStore.dynamicUsageDescription = err.message; + workStore.dynamicUsageStack = err.stack; + throw err; + } + let request = req; + switch(prepared.dynamic){ + case 'force-dynamic': + { + workStore.forceDynamic = true; + const err = new DynamicServerError('Route is configured with dynamic = error which cannot be statically generated.'); + workStore.dynamicUsageDescription = err.message; + workStore.dynamicUsageStack = err.stack; + throw err; + } + case 'force-static': + workStore.forceStatic = true; + request = new Proxy(req, forceStaticRequestHandlers); + break; + case 'error': + workStore.dynamicShouldError = true; + request = new Proxy(req, ensureStaticRequestHandlers); + break; + case undefined: + case 'auto': + request = proxyNextRequest(req, workStore); + break; + default: + prepared.dynamic; + } + const tracer = getTracer(); + const { pathname } = this.definition; + tracer.setRootSpanAttribute('next.route', pathname); + return tracer.trace(AppRouteRouteHandlersSpan.runHandler, { + spanName: `executing api route (app) ${pathname}`, + attributes: { + 'next.route': pathname + } + }, ()=>this.prerenderToResponse(handler, actionStore, workStore, requestStore, implicitTags, request, context)); + }))); + return this.validateExecutionResponse(response); + } + async handle(req, context) { + const prepared = await this.prepareExecution(req, context); + const workStore = createWorkStore({ + page: this.definition.page, + renderOpts: context.renderOpts, + buildId: context.sharedContext.buildId, + deploymentId: context.sharedContext.deploymentId, + previouslyRevalidatedTags: [] + }); + return this.executeRequest(req, context, prepared, workStore); + } + async prerender(req, context) { + const prepared = await this.prepareExecution(req, context); + const workStore = createPrerenderWorkStore({ + page: this.definition.page, + renderOpts: context.renderOpts, + buildId: context.sharedContext.buildId, + deploymentId: context.sharedContext.deploymentId, + previouslyRevalidatedTags: [] + }); + return this.executePrerender(req, context, prepared, workStore); + } +} +export default AppRouteRouteModule; +/** + * Gets all the method names for handlers that are not considered static. + * + * @param handlers the handlers from the userland module + * @returns the method names that are not considered static or false if all + * methods are static + */ export function hasNonStaticMethods(handlers) { + if (// Order these by how common they are to be used + handlers.POST || handlers.PUT || handlers.DELETE || handlers.PATCH || handlers.OPTIONS) { + return true; + } + return false; +} +// These symbols will be used to stash cached values on Proxied requests without requiring +// additional closures or storage such as WeakMaps. +const nextURLSymbol = Symbol('nextUrl'); +const requestCloneSymbol = Symbol('clone'); +const urlCloneSymbol = Symbol('clone'); +const searchParamsSymbol = Symbol('searchParams'); +const hrefSymbol = Symbol('href'); +const toStringSymbol = Symbol('toString'); +const headersSymbol = Symbol('headers'); +const cookiesSymbol = Symbol('cookies'); +/** + * The general technique with these proxy handlers is to prioritize keeping them static + * by stashing computed values on the Proxy itself. This is safe because the Proxy is + * inaccessible to the consumer since all operations are forwarded + */ const forceStaticRequestHandlers = { + get (target, prop, receiver) { + switch(prop){ + case 'headers': + return target[headersSymbol] || (target[headersSymbol] = HeadersAdapter.seal(new Headers({}))); + case 'cookies': + return target[cookiesSymbol] || (target[cookiesSymbol] = RequestCookiesAdapter.seal(new RequestCookies(new Headers({})))); + case 'nextUrl': + return target[nextURLSymbol] || (target[nextURLSymbol] = new Proxy(target.nextUrl, forceStaticNextUrlHandlers)); + case 'url': + // we don't need to separately cache this we can just read the nextUrl + // and return the href since we know it will have been stripped of any + // dynamic parts. We access via the receiver to trigger the get trap + return receiver.nextUrl.href; + case 'geo': + case 'ip': + return undefined; + case 'clone': + return target[requestCloneSymbol] || (target[requestCloneSymbol] = ()=>new Proxy(// This is vaguely unsafe but it's required since NextRequest does not implement + // clone. The reason we might expect this to work in this context is the Proxy will + // respond with static-amenable values anyway somewhat restoring the interface. + // @TODO we need to rethink NextRequest and NextURL because they are not sufficientlly + // sophisticated to adequately represent themselves in all contexts. A better approach is + // to probably embed the static generation logic into the class itself removing the need + // for any kind of proxying + target.clone(), forceStaticRequestHandlers)); + default: + return ReflectAdapter.get(target, prop, receiver); + } + } +}; +const forceStaticNextUrlHandlers = { + get (target, prop, receiver) { + switch(prop){ + // URL properties + case 'search': + return ''; + case 'searchParams': + return target[searchParamsSymbol] || (target[searchParamsSymbol] = new URLSearchParams()); + case 'href': + return target[hrefSymbol] || (target[hrefSymbol] = cleanURL(target.href).href); + case 'toJSON': + case 'toString': + return target[toStringSymbol] || (target[toStringSymbol] = ()=>receiver.href); + // NextUrl properties + case 'url': + // Currently nextURL does not expose url but our Docs indicate that it is an available property + // I am forcing this to undefined here to avoid accidentally exposing a dynamic value later if + // the underlying nextURL ends up adding this property + return undefined; + case 'clone': + return target[urlCloneSymbol] || (target[urlCloneSymbol] = ()=>new Proxy(target.clone(), forceStaticNextUrlHandlers)); + default: + return ReflectAdapter.get(target, prop, receiver); + } + } +}; +function proxyNextRequest(request, workStore) { + const nextUrlHandlers = { + get (target, prop, receiver) { + switch(prop){ + case 'search': + case 'searchParams': + case 'url': + case 'href': + case 'toJSON': + case 'toString': + case 'origin': + { + const workUnitStore = workUnitAsyncStorage.getStore(); + trackDynamic(workStore, workUnitStore, `nextUrl.${prop}`); + return ReflectAdapter.get(target, prop, receiver); + } + case 'clone': + return target[urlCloneSymbol] || (target[urlCloneSymbol] = ()=>new Proxy(target.clone(), nextUrlHandlers)); + default: + return ReflectAdapter.get(target, prop, receiver); + } + } + }; + const nextRequestHandlers = { + get (target, prop) { + switch(prop){ + case 'nextUrl': + return target[nextURLSymbol] || (target[nextURLSymbol] = new Proxy(target.nextUrl, nextUrlHandlers)); + case 'headers': + case 'cookies': + case 'url': + case 'body': + case 'blob': + case 'json': + case 'text': + case 'arrayBuffer': + case 'formData': + { + const workUnitStore = workUnitAsyncStorage.getStore(); + trackDynamic(workStore, workUnitStore, `request.${prop}`); + // The receiver arg is intentionally the same as the target to fix an issue with + // edge runtime, where attempting to access internal slots with the wrong `this` context + // results in an error. + return ReflectAdapter.get(target, prop, target); + } + case 'clone': + return target[requestCloneSymbol] || (target[requestCloneSymbol] = ()=>new Proxy(// This is vaguely unsafe but it's required since NextRequest does not implement + // clone. The reason we might expect this to work in this context is the Proxy will + // respond with static-amenable values anyway somewhat restoring the interface. + // @TODO we need to rethink NextRequest and NextURL because they are not sufficientlly + // sophisticated to adequately represent themselves in all contexts. A better approach is + // to probably embed the static generation logic into the class itself removing the need + // for any kind of proxying + target.clone(), nextRequestHandlers)); + default: + // The receiver arg is intentionally the same as the target to fix an issue with + // edge runtime, where attempting to access internal slots with the wrong `this` context + // results in an error. + return ReflectAdapter.get(target, prop, target); + } + } + }; + return new Proxy(request, nextRequestHandlers); +} +const ensureStaticRequestHandlers = { + get (target, prop, receiver) { + switch(prop){ + case 'nextUrl': + return target[nextURLSymbol] || (target[nextURLSymbol] = new Proxy(target.nextUrl, ensureStaticNextUrlHandlers)); + case 'headers': + case 'cookies': + case 'url': + case 'body': + case 'blob': + case 'json': + case 'text': + case 'arrayBuffer': + case 'formData': + throw new StaticGenBailoutError(`Route ${target.nextUrl.pathname} with \`dynamic = "error"\` couldn't be rendered statically because it used \`request.${prop}\`.`); + case 'clone': + return target[requestCloneSymbol] || (target[requestCloneSymbol] = ()=>new Proxy(// This is vaguely unsafe but it's required since NextRequest does not implement + // clone. The reason we might expect this to work in this context is the Proxy will + // respond with static-amenable values anyway somewhat restoring the interface. + // @TODO we need to rethink NextRequest and NextURL because they are not sufficientlly + // sophisticated to adequately represent themselves in all contexts. A better approach is + // to probably embed the static generation logic into the class itself removing the need + // for any kind of proxying + target.clone(), ensureStaticRequestHandlers)); + default: + return ReflectAdapter.get(target, prop, receiver); + } + } +}; +const ensureStaticNextUrlHandlers = { + get (target, prop, receiver) { + switch(prop){ + case 'search': + case 'searchParams': + case 'url': + case 'href': + case 'toJSON': + case 'toString': + case 'origin': + throw new StaticGenBailoutError(`Route ${target.pathname} with \`dynamic = "error"\` couldn't be rendered statically because it used \`nextUrl.${prop}\`.`); + case 'clone': + return target[urlCloneSymbol] || (target[urlCloneSymbol] = ()=>new Proxy(target.clone(), ensureStaticNextUrlHandlers)); + default: + return ReflectAdapter.get(target, prop, receiver); + } + } +}; +function createCacheComponentsError(route) { + return new DynamicServerError(`Route ${route} couldn't be rendered statically because it used IO that was not cached. See more info here: https://nextjs.org/docs/messages/cache-components`); +} +function trackDynamic(store, workUnitStore, expression) { + if (store.dynamicShouldError) { + throw new StaticGenBailoutError(`Route ${store.route} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${expression}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`); + } + if (workUnitStore) { + switch(workUnitStore.type){ + case 'cache': + case 'private-cache': + // TODO: Should we allow reading cookies and search params from the + // request for private caches in route handlers? + throw createRouteHandlerRequestInUseCacheError(store.route, expression); + case 'unstable-cache': + throw createRouteHandlerRequestInUnstableCacheError(store.route, expression); + case 'prerender': + const error = new Error(`Route ${store.route} used ${expression} without first calling \`await connection()\`. See more info here: https://nextjs.org/docs/messages/next-prerender-sync-request`); + return abortAndThrowOnSynchronousRequestDataAccess(store.route, expression, error, workUnitStore); + case 'prerender-client': + case 'validation-client': + throw new InvariantError('A client prerender store should not be used for a route handler.'); + case 'prerender-runtime': + throw new InvariantError('A runtime prerender store should not be used for a route handler.'); + case 'prerender-legacy': + workUnitStore.revalidate = 0; + const err = new DynamicServerError(`Route ${store.route} couldn't be rendered statically because it used \`${expression}\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`); + store.dynamicUsageDescription = expression; + store.dynamicUsageStack = err.stack; + throw err; + case 'request': + break; + case 'build-time-generator': + break; + default: + workUnitStore; + } + } +} + +//# sourceMappingURL=module.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/module.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/module.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e23ccf21af71f24ea1d18f0daa6b779855be088e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/module.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/route-modules/app-route/module.ts"],"sourcesContent":["import type { NextConfig } from '../../config-shared'\nimport type { AppRouteRouteDefinition } from '../../route-definitions/app-route-route-definition'\nimport type { AppSegmentConfig } from '../../../build/segment-config/app/app-segment-config'\nimport type { NextRequest } from '../../web/spec-extension/request'\nimport type { NextURL } from '../../web/next-url'\nimport type { DeepReadonly } from '../../../shared/lib/deep-readonly'\nimport type { WorkUnitStore } from '../../app-render/work-unit-async-storage.external'\nimport type { __ApiPreviewProps } from '../../api-utils'\n\nimport {\n RouteModule,\n type RouteModuleHandleContext,\n type RouteModuleOptions,\n} from '../route-module'\nimport { createRequestStoreForAPI } from '../../async-storage/request-store'\nimport {\n createPrerenderWorkStore,\n createWorkStore,\n type WorkStoreContext,\n} from '../../async-storage/work-store'\nimport { type HTTP_METHOD, HTTP_METHODS, isHTTPMethod } from '../../web/http'\nimport { getImplicitTags, type ImplicitTags } from '../../lib/implicit-tags'\nimport { patchFetch } from '../../lib/patch-fetch'\nimport { getTracer } from '../../lib/trace/tracer'\nimport {\n AppRouteRouteHandlersSpan,\n AppRouteRouteModuleSpan,\n} from '../../lib/trace/constants'\nimport * as Log from '../../../build/output/log'\nimport { autoImplementMethods } from './helpers/auto-implement-methods'\nimport {\n appendMutableCookies,\n type ReadonlyRequestCookies,\n} from '../../web/spec-extension/adapters/request-cookies'\nimport { HeadersAdapter } from '../../web/spec-extension/adapters/headers'\nimport { RequestCookiesAdapter } from '../../web/spec-extension/adapters/request-cookies'\nimport { parsedUrlQueryToParams } from './helpers/parsed-url-query-to-params'\nimport {\n Phase,\n printDebugThrownValueForProspectiveRender,\n} from '../../app-render/prospective-render-utils'\n\nimport * as serverHooks from '../../../client/components/hooks-server-context'\nimport { DynamicServerError } from '../../../client/components/hooks-server-context'\n\nimport {\n workAsyncStorage,\n type WorkStore,\n} from '../../app-render/work-async-storage.external'\nimport {\n workUnitAsyncStorage,\n type RequestStore,\n type PrerenderStore,\n} from '../../app-render/work-unit-async-storage.external'\nimport {\n actionAsyncStorage,\n type ActionStore,\n} from '../../app-render/action-async-storage.external'\nimport * as sharedModules from './shared-modules'\nimport { getIsPossibleServerAction } from '../../lib/server-action-request-meta'\nimport { RequestCookies } from 'next/dist/compiled/@edge-runtime/cookies'\nimport { cleanURL } from './helpers/clean-url'\nimport { StaticGenBailoutError } from '../../../client/components/static-generation-bailout'\nimport { isStaticGenEnabled } from './helpers/is-static-gen-enabled'\nimport {\n abortAndThrowOnSynchronousRequestDataAccess,\n createDynamicTrackingState,\n getFirstDynamicReason,\n} from '../../app-render/dynamic-rendering'\nimport { ReflectAdapter } from '../../web/spec-extension/adapters/reflect'\nimport { CacheSignal } from '../../app-render/cache-signal'\nimport { scheduleImmediate } from '../../../lib/scheduler'\nimport { createServerParamsForRoute } from '../../request/params'\nimport type { AppSegment } from '../../../build/segment-config/app/app-segments'\nimport {\n getRedirectStatusCodeFromError,\n getURLFromRedirectError,\n} from '../../../client/components/redirect'\nimport {\n isRedirectError,\n type RedirectError,\n} from '../../../client/components/redirect-error'\nimport {\n getAccessFallbackHTTPStatus,\n isHTTPAccessFallbackError,\n} from '../../../client/components/http-access-fallback/http-access-fallback'\nimport { RedirectStatusCode } from '../../../client/components/redirect-status-code'\nimport { INFINITE_CACHE } from '../../../lib/constants'\nimport { executeRevalidates } from '../../revalidation-utils'\nimport { trackPendingModules } from '../../app-render/module-loading/track-module-loading.external'\nimport { InvariantError } from '../../../shared/lib/invariant-error'\nimport { LazyModule } from '../../lib/lazy-module'\nimport { createPrerenderResumeDataCache } from '../../resume-data-cache/resume-data-cache'\nimport {\n createRouteHandlerRequestInUseCacheError,\n createRouteHandlerRequestInUnstableCacheError,\n} from '../../use-cache/use-cache-messages'\n\nexport class WrappedNextRouterError {\n constructor(\n public readonly error: RedirectError,\n public readonly headers?: Headers\n ) {}\n}\n\n/**\n * The AppRouteModule is the type of the module exported by the bundled App\n * Route module.\n */\nexport type AppRouteModule = typeof import('../../../build/templates/app-route')\n\nexport type AppRouteSharedContext = {\n buildId: string\n deploymentId: string\n}\n\n/**\n * AppRouteRouteHandlerContext is the context that is passed to the route\n * handler for app routes.\n */\nexport interface AppRouteRouteHandlerContext extends RouteModuleHandleContext {\n renderOpts: WorkStoreContext['renderOpts'] & CollectedCacheInfo\n previewProps: DeepReadonly<__ApiPreviewProps>\n sharedContext: AppRouteSharedContext\n}\n\ntype CollectedCacheInfo = {\n collectedTags?: string\n collectedRevalidate?: number\n collectedExpire?: number\n collectedStale?: number\n}\n\n/**\n * AppRouteHandlerFnContext is the context that is passed to the handler as the\n * second argument.\n */\ntype AppRouteHandlerFnContext = {\n params?: Promise>\n}\n\ntype PreparedAppRouteExecution = {\n handler: AppRouteHandlerFn\n dynamic: AppSegmentConfig['dynamic']\n hasNonStaticMethods: boolean\n actionStore: ActionStore\n implicitTags: ImplicitTags\n requestStore: RequestStore\n}\n\n/**\n * Handler function for app routes. If a non-Response value is returned, an error\n * will be thrown.\n */\nexport type AppRouteHandlerFn = (\n /**\n * Incoming request object.\n */\n req: NextRequest,\n /**\n * Context properties on the request (including the parameters if this was a\n * dynamic route).\n */\n ctx: AppRouteHandlerFnContext\n) => unknown\n\n/**\n * AppRouteHandlers describes the handlers for app routes that is provided by\n * the userland module.\n */\nexport type AppRouteHandlers = {\n [method in HTTP_METHOD]?: AppRouteHandlerFn\n}\n\n/**\n * AppRouteUserlandModule is the userland module that is provided for app\n * routes. This contains all the user generated code.\n */\nexport type AppRouteUserlandModule = AppRouteHandlers &\n Pick<\n AppSegmentConfig,\n 'dynamic' | 'revalidate' | 'dynamicParams' | 'fetchCache'\n > &\n Pick\n\n/**\n * AppRouteRouteModuleOptions is the options that are passed to the app route\n * module from the bundled code.\n */\nexport interface AppRouteRouteModuleOptions\n extends Omit<\n RouteModuleOptions,\n 'userland'\n > {\n readonly userland: () =>\n | AppRouteUserlandModule\n | Promise\n readonly resolvedPagePath: string\n readonly nextConfigOutput: NextConfig['output']\n /**\n * Optional synchronous getter that returns the live userland module. When\n * provided (Turbopack dev mode), it is called on every request so that\n * server HMR updates are picked up without re-executing the entry chunk.\n * Using require() instead of import() keeps this synchronous so the time\n * spent here is not incorrectly attributed to application-code in timing.\n */\n readonly getUserland?: () => AppRouteUserlandModule\n}\n\n/**\n * AppRouteRouteHandler is the handler for app routes.\n */\nexport class AppRouteRouteModule extends RouteModule<\n AppRouteRouteDefinition,\n AppRouteUserlandModule\n> {\n /**\n * A reference to the request async storage.\n */\n public readonly workUnitAsyncStorage = workUnitAsyncStorage\n\n /**\n * A reference to the static generation async storage.\n */\n public readonly workAsyncStorage = workAsyncStorage\n\n /**\n * An interface to call server hooks which interact with the underlying\n * storage.\n */\n public readonly serverHooks = serverHooks\n\n public static readonly sharedModules = sharedModules\n\n /**\n * A reference to the mutation related async storage, such as mutations of\n * cookies.\n */\n public readonly actionAsyncStorage = actionAsyncStorage\n\n public readonly resolvedPagePath: string\n public readonly nextConfigOutput: NextConfig['output'] | undefined\n\n // Loaded lazily since the route file may be an async module (top-level\n // await).\n private readonly _lazyUserland: LazyModule\n // Synchronous per-request userland getter for Turbopack dev mode.\n // Called on every request to pick up server HMR updates.\n private readonly _getUserland?: () => AppRouteUserlandModule\n private _methods!: Record\n private _hasNonStaticMethods!: boolean\n private _dynamic!: AppRouteUserlandModule['dynamic']\n\n override get userland(): AppRouteUserlandModule {\n return this._lazyUserland.assertLoaded()\n }\n\n /**\n * Ensures the userland module is fully loaded before it's accessed via\n * `userland`. Required for route files that use top-level await, where\n * require() returns a promise instead of the module directly. Must be called\n * before accessing `userland` in contexts where the module may not yet be\n * resolved (e.g. the export/static-generation worker).\n */\n async ensureUserland(): Promise {\n await this._lazyUserland.waitUntilLoaded()\n }\n\n constructor({\n userland,\n getUserland,\n definition,\n distDir,\n relativeProjectDir,\n resolvedPagePath,\n nextConfigOutput,\n }: AppRouteRouteModuleOptions) {\n super({\n userland: undefined! as AppRouteUserlandModule,\n definition,\n distDir,\n relativeProjectDir,\n })\n\n this.resolvedPagePath = resolvedPagePath\n this.nextConfigOutput = nextConfigOutput\n this._getUserland = getUserland\n this._lazyUserland = new LazyModule(\n () =>\n getTracer().trace(\n AppRouteRouteModuleSpan.loadUserland,\n {\n spanName: 'load app route module',\n attributes: {\n 'next.route': this.definition.pathname,\n },\n },\n userland\n ),\n (module) => this._onUserlandLoaded(module)\n )\n\n // output:export routes load eagerly, so that errors surface at module\n // load time (as a Redbox in dev) rather than at request time.\n if (nextConfigOutput === 'export') {\n this._lazyUserland.loadIfNeeded()\n }\n }\n\n private _onUserlandLoaded(userland: AppRouteUserlandModule): void {\n // Automatically implement some methods if they aren't implemented by the\n // userland module.\n this._methods = autoImplementMethods(userland)\n\n // Get the non-static methods for this route.\n this._hasNonStaticMethods = hasNonStaticMethods(userland)\n\n // Get the dynamic property from the userland module.\n this._dynamic = userland.dynamic\n if (this.nextConfigOutput === 'export') {\n if (this._dynamic === 'force-dynamic') {\n throw new Error(\n `export const dynamic = \"force-dynamic\" on page \"${this.definition.pathname}\" cannot be used with \"output: export\". See more info here: https://nextjs.org/docs/advanced-features/static-html-export`\n )\n } else if (!isStaticGenEnabled(userland) && userland['GET']) {\n throw new Error(\n `export const dynamic = \"force-static\"/export const revalidate not configured on route \"${this.definition.pathname}\" with \"output: export\". See more info here: https://nextjs.org/docs/advanced-features/static-html-export`\n )\n } else {\n this._dynamic = 'error'\n }\n }\n\n // We only warn in development after here, so return if we're not in\n // development.\n if (process.env.NODE_ENV === 'development') {\n // Print error in development if the exported handlers are in lowercase, only\n // uppercase handlers are supported.\n const lowercased = HTTP_METHODS.map((method) => method.toLowerCase())\n for (const method of lowercased) {\n if (method in userland) {\n Log.error(\n `Detected lowercase method '${method}' in '${\n this.resolvedPagePath\n }'. Export the uppercase '${method.toUpperCase()}' method name to fix this error.`\n )\n }\n }\n\n // Print error if the module exports a default handler, they must use named\n // exports for each HTTP method.\n if ('default' in userland) {\n Log.error(\n `Detected default export in '${this.resolvedPagePath}'. Export a named export for each HTTP method instead.`\n )\n }\n\n // If there is no methods exported by this module, then return a not found\n // response.\n if (!HTTP_METHODS.some((method) => method in userland)) {\n Log.error(\n `No HTTP methods exported in '${this.resolvedPagePath}'. Export a named export for each HTTP method.`\n )\n }\n }\n }\n\n /**\n * Returns the handler function for the given HTTP method.\n * Must be called after ensureUserland() has resolved so that _methods is\n * populated.\n */\n private resolveHandler(method: string): AppRouteHandlerFn {\n // Prevent RCE: only allow recognized HTTP methods.\n if (!isHTTPMethod(method)) return () => new Response(null, { status: 400 })\n\n return this._methods[method]\n }\n\n /**\n * Returns the handler for the given method using a live userland snapshot.\n * Used in Turbopack dev mode to pick up server HMR updates. The userland\n * is fetched synchronously via require() so no async overhead is added.\n */\n private resolveHandlerFromUserland(\n method: string,\n userland: AppRouteUserlandModule\n ): AppRouteHandlerFn {\n if (!isHTTPMethod(method)) return () => new Response(null, { status: 400 })\n return autoImplementMethods(userland)[method]\n }\n\n private resolvePendingRevalidations(\n workStore: WorkStore,\n requestStore: RequestStore,\n context: AppRouteRouteHandlerContext\n ): void {\n const maybeRevalidatesPromise = executeRevalidates(workStore)\n\n if (maybeRevalidatesPromise !== false) {\n context.renderOpts.pendingWaitUntil = maybeRevalidatesPromise.finally(\n () => {\n if (process.env.NEXT_PRIVATE_DEBUG_CACHE) {\n console.log(\n 'pending revalidates promise finished for:',\n requestStore.url.pathname + requestStore.url.search\n )\n }\n }\n )\n }\n }\n\n private handleHandlerError(\n err: unknown,\n actionStore: ActionStore,\n workStore: WorkStore,\n requestStore: RequestStore,\n context: AppRouteRouteHandlerContext\n ): Response {\n if (isRedirectError(err)) {\n const url = getURLFromRedirectError(err)\n if (!url) {\n throw new Error('Invariant: Unexpected redirect url format')\n }\n\n // We need to capture any headers that should be sent on the response.\n const headers = new Headers({ Location: url })\n\n // Let's append any cookies that were added by the cookie API.\n // TODO leaving the gate here b/c it indicates that we might not actually\n // want to do this on every handler invocation. During prerender there\n // should be no mutableCookies because then they'd be dynamic.\n appendMutableCookies(headers, requestStore.mutableCookies)\n\n this.resolvePendingRevalidations(workStore, requestStore, context)\n\n return new Response(null, {\n // If we're in an action, we want to use a 303 redirect as we don't\n // want the POST request to follow the redirect, as it could result in\n // erroneous re-submissions.\n status: actionStore.isAction\n ? RedirectStatusCode.SeeOther\n : getRedirectStatusCodeFromError(err),\n headers,\n })\n }\n\n if (isHTTPAccessFallbackError(err)) {\n const httpStatus = getAccessFallbackHTTPStatus(err)\n return new Response(null, { status: httpStatus })\n }\n\n throw err\n }\n\n private finalizeResponse(\n res: unknown,\n request: NextRequest,\n workStore: WorkStore,\n requestStore: RequestStore,\n prerenderStore: PrerenderStore | null,\n context: AppRouteRouteHandlerContext\n ): Response {\n if (!(res instanceof Response)) {\n const invalidType =\n res === null\n ? 'null'\n : res === undefined\n ? 'undefined'\n : typeof res === 'object'\n ? res.constructor?.name || 'object'\n : typeof res\n\n throw new Error(\n `No response is returned from route handler '${this.resolvedPagePath}'. ` +\n `Expected a Response object but received '${invalidType}' (method: ${request.method}, url: ${requestStore.url.pathname}). ` +\n `Ensure you return a \\`Response\\` or a \\`NextResponse\\` in all branches of your handler.`\n )\n }\n\n context.renderOpts.fetchMetrics = workStore.fetchMetrics\n this.resolvePendingRevalidations(workStore, requestStore, context)\n\n if (prerenderStore) {\n context.renderOpts.collectedTags = prerenderStore.tags?.join(',')\n context.renderOpts.collectedRevalidate = prerenderStore.revalidate\n context.renderOpts.collectedExpire = prerenderStore.expire\n context.renderOpts.collectedStale = prerenderStore.stale\n }\n\n // It's possible cookies were set in the handler, so we need to merge the\n // modified cookies and the returned response here.\n const headers = new Headers(res.headers)\n if (appendMutableCookies(headers, requestStore.mutableCookies)) {\n return new Response(res.body, {\n status: res.status,\n statusText: res.statusText,\n headers,\n })\n }\n\n return res\n }\n\n private async prerenderToResponse(\n handler: AppRouteHandlerFn,\n actionStore: ActionStore,\n workStore: WorkStore,\n requestStore: RequestStore,\n implicitTags: ImplicitTags,\n request: NextRequest,\n context: AppRouteRouteHandlerContext\n ) {\n const cacheComponentsEnabled = !!context.renderOpts.cacheComponents\n\n // Patch the global fetch.\n patchFetch({\n workAsyncStorage: this.workAsyncStorage,\n workUnitAsyncStorage: this.workUnitAsyncStorage,\n })\n\n const handlerContext: AppRouteHandlerFnContext = {\n params: context.params\n ? createServerParamsForRoute(parsedUrlQueryToParams(context.params))\n : undefined,\n }\n\n let prerenderStore: PrerenderStore\n\n let res: unknown\n try {\n const userlandRevalidate = this.userland.revalidate\n const defaultRevalidate: number =\n // If the static generation store does not have a revalidate value\n // set, then we should set it the revalidate value from the userland\n // module or default to false.\n userlandRevalidate === false || userlandRevalidate === undefined\n ? INFINITE_CACHE\n : userlandRevalidate\n\n if (cacheComponentsEnabled) {\n /**\n * When we are attempting to statically prerender the GET handler of a route.ts module\n * and cacheComponents is on we follow a similar pattern to rendering.\n *\n * We first run the handler letting caches fill. If something synchronously dynamic occurs\n * during this prospective render then we can infer it will happen on every render and we\n * just bail out of prerendering.\n *\n * Next we run the handler again and we check if we get a result back in a microtask.\n * Next.js expects the return value to be a Response or a Thenable that resolves to a Response.\n * Unfortunately Response's do not allow for accessing the response body synchronously or in\n * a microtask so we need to allow one more task to unwrap the response body. This is a slightly\n * different semantic than what we have when we render and it means that certain tasks can still\n * execute before a prerender completes such as a carefully timed setImmediate.\n *\n * Functionally though IO should still take longer than the time it takes to unwrap the response body\n * so our heuristic of excluding any IO should be preserved.\n */\n const prospectiveController = new AbortController()\n let prospectiveRenderIsDynamic = false\n const cacheSignal = new CacheSignal(null)\n let dynamicTracking = createDynamicTrackingState(undefined)\n\n // TODO: Route handlers are never resumed, so it's counter-intuitive\n // to use an RDC here. However, we need the data cache to store cached\n // results in memory during the prospective prerender, so that they\n // can be retrieved during the final prerender within microtasks. This\n // is crucial when doing revalidations of a deployed route handler,\n // where the default cache handler does not do any in-memory caching.\n const prerenderResumeDataCache = createPrerenderResumeDataCache()\n\n const prospectiveRoutePrerenderStore: PrerenderStore = (prerenderStore =\n {\n type: 'prerender',\n phase: 'action',\n // This replicates prior behavior where rootParams is empty in routes\n // TODO we need to make this have the proper rootParams for this route\n rootParams: {},\n fallbackRouteParams: null,\n implicitTags,\n renderSignal: prospectiveController.signal,\n controller: prospectiveController,\n stagedRendering: null,\n cacheSignal,\n // During prospective render we don't use a controller\n // because we need to let all caches fill.\n dynamicTracking,\n revalidate: defaultRevalidate,\n expire: INFINITE_CACHE,\n stale: INFINITE_CACHE,\n tags: [...implicitTags.tags],\n resumeDataCache: prerenderResumeDataCache,\n hmrRefreshHash: undefined,\n varyParamsAccumulator: null,\n ensureStaticLevel: null,\n prerenderDataTracking: null,\n isFallbackUpgradeable: false,\n })\n\n let prospectiveResult\n try {\n prospectiveResult = this.workUnitAsyncStorage.run(\n prospectiveRoutePrerenderStore,\n handler,\n request,\n handlerContext\n )\n } catch (err) {\n if (prospectiveController.signal.aborted) {\n // the route handler called an API which is always dynamic\n // there is no need to try again\n prospectiveRenderIsDynamic = true\n } else if (\n process.env.NEXT_DEBUG_BUILD ||\n process.env.__NEXT_VERBOSE_LOGGING\n ) {\n printDebugThrownValueForProspectiveRender(\n err,\n workStore.route,\n Phase.ProspectiveRender\n )\n }\n }\n if (\n typeof prospectiveResult === 'object' &&\n prospectiveResult !== null &&\n typeof (prospectiveResult as any).then === 'function'\n ) {\n // The handler returned a Thenable. We'll listen for rejections to determine\n // if the route is erroring for dynamic reasons.\n ;(prospectiveResult as any as Promise).then(\n () => {},\n (err) => {\n if (prospectiveController.signal.aborted) {\n // the route handler called an API which is always dynamic\n // there is no need to try again\n prospectiveRenderIsDynamic = true\n } else if (process.env.NEXT_DEBUG_BUILD) {\n printDebugThrownValueForProspectiveRender(\n err,\n workStore.route,\n Phase.ProspectiveRender\n )\n }\n }\n )\n }\n\n trackPendingModules(cacheSignal)\n await cacheSignal.cacheReady()\n\n if (prospectiveRenderIsDynamic) {\n // the route handler called an API which is always dynamic\n // there is no need to try again\n const dynamicReason = getFirstDynamicReason(dynamicTracking)\n if (dynamicReason) {\n throw new DynamicServerError(\n `Route ${workStore.route} couldn't be rendered statically because it used \\`${dynamicReason}\\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`\n )\n } else {\n console.error(\n 'Expected Next.js to keep track of reason for opting out of static rendering but one was not found. This is a bug in Next.js'\n )\n throw new DynamicServerError(\n `Route ${workStore.route} couldn't be rendered statically because it used a dynamic API. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`\n )\n }\n }\n\n // TODO start passing this controller to the route handler. We should expose\n // it so the handler to abort inflight requests and other operations if we abort\n // the prerender.\n const finalController = new AbortController()\n dynamicTracking = createDynamicTrackingState(undefined)\n\n const finalRoutePrerenderStore: PrerenderStore = (prerenderStore = {\n type: 'prerender',\n phase: 'action',\n rootParams: {},\n fallbackRouteParams: null,\n implicitTags,\n renderSignal: finalController.signal,\n controller: finalController,\n stagedRendering: null,\n cacheSignal: null,\n dynamicTracking,\n revalidate: defaultRevalidate,\n expire: INFINITE_CACHE,\n stale: INFINITE_CACHE,\n tags: [...implicitTags.tags],\n resumeDataCache: prerenderResumeDataCache,\n hmrRefreshHash: undefined,\n varyParamsAccumulator: null,\n ensureStaticLevel: null,\n prerenderDataTracking: null,\n isFallbackUpgradeable: false,\n })\n\n let responseHandled = false\n res = await new Promise((resolve, reject) => {\n scheduleImmediate(async () => {\n try {\n const result = await (this.workUnitAsyncStorage.run(\n finalRoutePrerenderStore,\n handler,\n request,\n handlerContext\n ) as Promise)\n if (responseHandled) {\n // we already rejected in the followup task\n return\n } else if (!(result instanceof Response)) {\n // This is going to error but we let that happen below\n resolve(result)\n return\n }\n\n responseHandled = true\n\n let bodyHandled = false\n result.arrayBuffer().then((body) => {\n if (!bodyHandled) {\n bodyHandled = true\n\n resolve(\n new Response(body, {\n headers: result.headers,\n status: result.status,\n statusText: result.statusText,\n })\n )\n }\n }, reject)\n scheduleImmediate(() => {\n if (!bodyHandled) {\n bodyHandled = true\n finalController.abort()\n reject(createCacheComponentsError(workStore.route))\n }\n })\n } catch (err) {\n reject(err)\n }\n })\n scheduleImmediate(() => {\n if (!responseHandled) {\n responseHandled = true\n finalController.abort()\n reject(createCacheComponentsError(workStore.route))\n }\n })\n })\n if (finalController.signal.aborted) {\n // We aborted from within the execution\n throw createCacheComponentsError(workStore.route)\n } else {\n // We didn't abort during the execution. We can abort now as a matter of semantics\n // though at the moment nothing actually consumes this signal so it won't halt any\n // inflight work.\n finalController.abort()\n }\n } else {\n prerenderStore = {\n type: 'prerender-legacy',\n phase: 'action',\n rootParams: {},\n implicitTags,\n revalidate: defaultRevalidate,\n expire: INFINITE_CACHE,\n stale: INFINITE_CACHE,\n tags: [...implicitTags.tags],\n }\n\n res = await workUnitAsyncStorage.run(\n prerenderStore,\n handler,\n request,\n handlerContext\n )\n }\n } catch (err) {\n return this.handleHandlerError(\n err,\n actionStore,\n workStore,\n requestStore,\n context\n )\n }\n\n return this.finalizeResponse(\n res,\n request,\n workStore,\n requestStore,\n prerenderStore,\n context\n )\n }\n\n private async renderToResponse(\n handler: AppRouteHandlerFn,\n actionStore: ActionStore,\n workStore: WorkStore,\n requestStore: RequestStore,\n request: NextRequest,\n context: AppRouteRouteHandlerContext\n ): Promise {\n // Patch the global fetch.\n patchFetch({\n workAsyncStorage: this.workAsyncStorage,\n workUnitAsyncStorage: this.workUnitAsyncStorage,\n })\n\n const handlerContext: AppRouteHandlerFnContext = {\n params: context.params\n ? createServerParamsForRoute(parsedUrlQueryToParams(context.params))\n : undefined,\n }\n\n let res: unknown\n try {\n res = await workUnitAsyncStorage.run(\n requestStore,\n handler,\n request,\n handlerContext\n )\n } catch (err) {\n return this.handleHandlerError(\n err,\n actionStore,\n workStore,\n requestStore,\n context\n )\n }\n\n return this.finalizeResponse(\n res,\n request,\n workStore,\n requestStore,\n null,\n context\n )\n }\n\n private async prepareExecution(\n req: NextRequest,\n context: AppRouteRouteHandlerContext\n ): Promise {\n // Ensure userland is fully loaded (handles async modules with top-level\n // await, where require() returns a Promise instead of the module).\n await this.ensureUserland()\n\n // In Turbopack dev mode, fetch the live userland module on every request\n // via the synchronous require() getter so server HMR updates are reflected\n // immediately. This is cheap — it is just a devModuleCache lookup.\n // For routes with top-level await, require() may still return a Promise\n // (async module); in that case fall back to the already-resolved\n // userland module resolved by ensureUserland() above.\n const rawLiveUserland = this._getUserland?.()\n const liveUserland =\n rawLiveUserland instanceof Promise\n ? undefined\n : (rawLiveUserland as AppRouteUserlandModule | undefined)\n\n const handler = liveUserland\n ? this.resolveHandlerFromUserland(req.method, liveUserland)\n : this.resolveHandler(req.method)\n\n // Use the live userland (if available) for per-request values so HMR\n // changes to fetchCache, dynamic, etc. are also picked up.\n const userland = liveUserland ?? this.userland\n\n // Add the fetchCache option to the renderOpts.\n context.renderOpts.fetchCache = userland.fetchCache\n\n const actionStore: ActionStore = {\n isAppRoute: true,\n isAction: getIsPossibleServerAction(req),\n }\n\n const implicitTags = await getImplicitTags(\n this.definition.page,\n req.nextUrl.pathname,\n // App Routes don't support unknown route params.\n null\n )\n\n const requestStore = createRequestStoreForAPI(\n req,\n req.nextUrl,\n implicitTags,\n undefined,\n context.previewProps,\n context.renderOpts.hmrRefreshHash\n )\n\n return {\n handler,\n dynamic: liveUserland?.dynamic ?? this._dynamic,\n hasNonStaticMethods: liveUserland\n ? hasNonStaticMethods(liveUserland)\n : this._hasNonStaticMethods,\n actionStore,\n implicitTags,\n requestStore,\n }\n }\n\n private validateExecutionResponse(response: unknown): Response {\n // If the handler didn't return a valid response, then return the internal\n // error response.\n if (!(response instanceof Response)) {\n // TODO: validate the correct handling behavior, maybe log something?\n return new Response(null, { status: 500 })\n }\n\n if (response.headers.has('x-middleware-rewrite')) {\n throw new Error(\n 'NextResponse.rewrite() was used in a app route handler, this is not currently supported. Please remove the invocation to continue.'\n )\n }\n\n if (response.headers.get('x-middleware-next') === '1') {\n // TODO: move this error into the `NextResponse.next()` function.\n throw new Error(\n 'NextResponse.next() was used in a app route handler, this is not supported. See here for more info: https://nextjs.org/docs/messages/next-response-next-in-app-route-handler'\n )\n }\n\n return response\n }\n\n private async executeRequest(\n req: NextRequest,\n context: AppRouteRouteHandlerContext,\n prepared: PreparedAppRouteExecution,\n workStore: WorkStore\n ): Promise {\n const { actionStore, handler, requestStore } = prepared\n\n const response: unknown = await this.actionAsyncStorage.run(\n actionStore,\n () =>\n this.workUnitAsyncStorage.run(requestStore, () =>\n this.workAsyncStorage.run(workStore, () => {\n let request = req\n\n switch (prepared.dynamic) {\n case 'force-dynamic':\n workStore.forceDynamic = true\n break\n case 'force-static':\n workStore.forceStatic = true\n request = new Proxy(req, forceStaticRequestHandlers)\n break\n case 'error':\n workStore.dynamicShouldError = true\n break\n case undefined:\n case 'auto':\n request = proxyNextRequest(req, workStore)\n break\n default:\n prepared.dynamic satisfies never\n }\n\n const tracer = getTracer()\n const { pathname } = this.definition\n tracer.setRootSpanAttribute('next.route', pathname)\n\n return tracer.trace(\n AppRouteRouteHandlersSpan.runHandler,\n {\n spanName: `executing api route (app) ${pathname}`,\n attributes: {\n 'next.route': pathname,\n },\n },\n () =>\n this.renderToResponse(\n handler,\n actionStore,\n workStore,\n requestStore,\n request,\n context\n )\n )\n })\n )\n )\n\n return this.validateExecutionResponse(response)\n }\n\n private async executePrerender(\n req: NextRequest,\n context: AppRouteRouteHandlerContext,\n prepared: PreparedAppRouteExecution,\n workStore: WorkStore\n ): Promise {\n const { actionStore, handler, implicitTags, requestStore } = prepared\n\n // Run the handler with the request AsyncLocalStorage to inject the helper\n // support. We set this to `unknown` because the type is not known until\n // runtime when we do a instanceof check below.\n const response: unknown = await this.actionAsyncStorage.run(\n actionStore,\n () =>\n this.workUnitAsyncStorage.run(requestStore, () =>\n this.workAsyncStorage.run(workStore, () => {\n if (prepared.hasNonStaticMethods) {\n const err = new DynamicServerError(\n 'Route is configured with methods that cannot be statically generated.'\n )\n workStore.dynamicUsageDescription = err.message\n workStore.dynamicUsageStack = err.stack\n throw err\n }\n\n let request = req\n\n switch (prepared.dynamic) {\n case 'force-dynamic': {\n workStore.forceDynamic = true\n const err = new DynamicServerError(\n 'Route is configured with dynamic = error which cannot be statically generated.'\n )\n workStore.dynamicUsageDescription = err.message\n workStore.dynamicUsageStack = err.stack\n throw err\n }\n case 'force-static':\n workStore.forceStatic = true\n request = new Proxy(req, forceStaticRequestHandlers)\n break\n case 'error':\n workStore.dynamicShouldError = true\n request = new Proxy(req, ensureStaticRequestHandlers)\n break\n case undefined:\n case 'auto':\n request = proxyNextRequest(req, workStore)\n break\n default:\n prepared.dynamic satisfies never\n }\n\n const tracer = getTracer()\n const { pathname } = this.definition\n tracer.setRootSpanAttribute('next.route', pathname)\n\n return tracer.trace(\n AppRouteRouteHandlersSpan.runHandler,\n {\n spanName: `executing api route (app) ${pathname}`,\n attributes: {\n 'next.route': pathname,\n },\n },\n () =>\n this.prerenderToResponse(\n handler,\n actionStore,\n workStore,\n requestStore,\n implicitTags,\n request,\n context\n )\n )\n })\n )\n )\n\n return this.validateExecutionResponse(response)\n }\n\n public async handle(\n req: NextRequest,\n context: AppRouteRouteHandlerContext\n ): Promise {\n const prepared = await this.prepareExecution(req, context)\n const workStore = createWorkStore({\n page: this.definition.page,\n renderOpts: context.renderOpts,\n buildId: context.sharedContext.buildId,\n deploymentId: context.sharedContext.deploymentId,\n previouslyRevalidatedTags: [],\n })\n\n return this.executeRequest(req, context, prepared, workStore)\n }\n\n public async prerender(\n req: NextRequest,\n context: AppRouteRouteHandlerContext\n ): Promise {\n const prepared = await this.prepareExecution(req, context)\n const workStore = createPrerenderWorkStore({\n page: this.definition.page,\n renderOpts: context.renderOpts,\n buildId: context.sharedContext.buildId,\n deploymentId: context.sharedContext.deploymentId,\n previouslyRevalidatedTags: [],\n })\n\n return this.executePrerender(req, context, prepared, workStore)\n }\n}\n\nexport default AppRouteRouteModule\n\n/**\n * Gets all the method names for handlers that are not considered static.\n *\n * @param handlers the handlers from the userland module\n * @returns the method names that are not considered static or false if all\n * methods are static\n */\nexport function hasNonStaticMethods(handlers: AppRouteHandlers): boolean {\n if (\n // Order these by how common they are to be used\n handlers.POST ||\n handlers.PUT ||\n handlers.DELETE ||\n handlers.PATCH ||\n handlers.OPTIONS\n ) {\n return true\n }\n return false\n}\n\n// These symbols will be used to stash cached values on Proxied requests without requiring\n// additional closures or storage such as WeakMaps.\nconst nextURLSymbol = Symbol('nextUrl')\nconst requestCloneSymbol = Symbol('clone')\nconst urlCloneSymbol = Symbol('clone')\nconst searchParamsSymbol = Symbol('searchParams')\nconst hrefSymbol = Symbol('href')\nconst toStringSymbol = Symbol('toString')\nconst headersSymbol = Symbol('headers')\nconst cookiesSymbol = Symbol('cookies')\n\ntype RequestSymbolTarget = {\n [headersSymbol]?: Headers\n [cookiesSymbol]?: RequestCookies | ReadonlyRequestCookies\n [nextURLSymbol]?: NextURL\n [requestCloneSymbol]?: () => NextRequest\n}\n\ntype UrlSymbolTarget = {\n [searchParamsSymbol]?: URLSearchParams\n [hrefSymbol]?: string\n [toStringSymbol]?: () => string\n [urlCloneSymbol]?: () => NextURL\n}\n\n/**\n * The general technique with these proxy handlers is to prioritize keeping them static\n * by stashing computed values on the Proxy itself. This is safe because the Proxy is\n * inaccessible to the consumer since all operations are forwarded\n */\nconst forceStaticRequestHandlers = {\n get(\n target: NextRequest & RequestSymbolTarget,\n prop: string | symbol,\n receiver: any\n ): unknown {\n switch (prop) {\n case 'headers':\n return (\n target[headersSymbol] ||\n (target[headersSymbol] = HeadersAdapter.seal(new Headers({})))\n )\n case 'cookies':\n return (\n target[cookiesSymbol] ||\n (target[cookiesSymbol] = RequestCookiesAdapter.seal(\n new RequestCookies(new Headers({}))\n ))\n )\n case 'nextUrl':\n return (\n target[nextURLSymbol] ||\n (target[nextURLSymbol] = new Proxy(\n target.nextUrl,\n forceStaticNextUrlHandlers\n ))\n )\n case 'url':\n // we don't need to separately cache this we can just read the nextUrl\n // and return the href since we know it will have been stripped of any\n // dynamic parts. We access via the receiver to trigger the get trap\n return receiver.nextUrl.href\n case 'geo':\n case 'ip':\n return undefined\n case 'clone':\n return (\n target[requestCloneSymbol] ||\n (target[requestCloneSymbol] = () =>\n new Proxy(\n // This is vaguely unsafe but it's required since NextRequest does not implement\n // clone. The reason we might expect this to work in this context is the Proxy will\n // respond with static-amenable values anyway somewhat restoring the interface.\n // @TODO we need to rethink NextRequest and NextURL because they are not sufficientlly\n // sophisticated to adequately represent themselves in all contexts. A better approach is\n // to probably embed the static generation logic into the class itself removing the need\n // for any kind of proxying\n target.clone() as NextRequest,\n forceStaticRequestHandlers\n ))\n )\n default:\n return ReflectAdapter.get(target, prop, receiver)\n }\n },\n // We don't need to proxy set because all the properties we proxy are ready only\n // and will be ignored\n}\n\nconst forceStaticNextUrlHandlers = {\n get(\n target: NextURL & UrlSymbolTarget,\n prop: string | symbol,\n receiver: any\n ): unknown {\n switch (prop) {\n // URL properties\n case 'search':\n return ''\n case 'searchParams':\n return (\n target[searchParamsSymbol] ||\n (target[searchParamsSymbol] = new URLSearchParams())\n )\n case 'href':\n return (\n target[hrefSymbol] ||\n (target[hrefSymbol] = cleanURL(target.href).href)\n )\n case 'toJSON':\n case 'toString':\n return (\n target[toStringSymbol] ||\n (target[toStringSymbol] = () => receiver.href)\n )\n\n // NextUrl properties\n case 'url':\n // Currently nextURL does not expose url but our Docs indicate that it is an available property\n // I am forcing this to undefined here to avoid accidentally exposing a dynamic value later if\n // the underlying nextURL ends up adding this property\n return undefined\n case 'clone':\n return (\n target[urlCloneSymbol] ||\n (target[urlCloneSymbol] = () =>\n new Proxy(target.clone(), forceStaticNextUrlHandlers))\n )\n default:\n return ReflectAdapter.get(target, prop, receiver)\n }\n },\n}\n\nfunction proxyNextRequest(request: NextRequest, workStore: WorkStore) {\n const nextUrlHandlers = {\n get(\n target: NextURL & UrlSymbolTarget,\n prop: string | symbol,\n receiver: any\n ): unknown {\n switch (prop) {\n case 'search':\n case 'searchParams':\n case 'url':\n case 'href':\n case 'toJSON':\n case 'toString':\n case 'origin': {\n const workUnitStore = workUnitAsyncStorage.getStore()\n trackDynamic(workStore, workUnitStore, `nextUrl.${prop}`)\n return ReflectAdapter.get(target, prop, receiver)\n }\n case 'clone':\n return (\n target[urlCloneSymbol] ||\n (target[urlCloneSymbol] = () =>\n new Proxy(target.clone(), nextUrlHandlers))\n )\n default:\n return ReflectAdapter.get(target, prop, receiver)\n }\n },\n }\n\n const nextRequestHandlers = {\n get(\n target: NextRequest & RequestSymbolTarget,\n prop: string | symbol\n ): unknown {\n switch (prop) {\n case 'nextUrl':\n return (\n target[nextURLSymbol] ||\n (target[nextURLSymbol] = new Proxy(target.nextUrl, nextUrlHandlers))\n )\n case 'headers':\n case 'cookies':\n case 'url':\n case 'body':\n case 'blob':\n case 'json':\n case 'text':\n case 'arrayBuffer':\n case 'formData': {\n const workUnitStore = workUnitAsyncStorage.getStore()\n trackDynamic(workStore, workUnitStore, `request.${prop}`)\n // The receiver arg is intentionally the same as the target to fix an issue with\n // edge runtime, where attempting to access internal slots with the wrong `this` context\n // results in an error.\n return ReflectAdapter.get(target, prop, target)\n }\n case 'clone':\n return (\n target[requestCloneSymbol] ||\n (target[requestCloneSymbol] = () =>\n new Proxy(\n // This is vaguely unsafe but it's required since NextRequest does not implement\n // clone. The reason we might expect this to work in this context is the Proxy will\n // respond with static-amenable values anyway somewhat restoring the interface.\n // @TODO we need to rethink NextRequest and NextURL because they are not sufficientlly\n // sophisticated to adequately represent themselves in all contexts. A better approach is\n // to probably embed the static generation logic into the class itself removing the need\n // for any kind of proxying\n target.clone() as NextRequest,\n nextRequestHandlers\n ))\n )\n default:\n // The receiver arg is intentionally the same as the target to fix an issue with\n // edge runtime, where attempting to access internal slots with the wrong `this` context\n // results in an error.\n return ReflectAdapter.get(target, prop, target)\n }\n },\n // We don't need to proxy set because all the properties we proxy are ready only\n // and will be ignored\n }\n\n return new Proxy(request, nextRequestHandlers)\n}\n\nconst ensureStaticRequestHandlers = {\n get(\n target: NextRequest & RequestSymbolTarget,\n prop: string | symbol,\n receiver: any\n ): unknown {\n switch (prop) {\n case 'nextUrl':\n return (\n target[nextURLSymbol] ||\n (target[nextURLSymbol] = new Proxy(\n target.nextUrl,\n ensureStaticNextUrlHandlers\n ))\n )\n case 'headers':\n case 'cookies':\n case 'url':\n case 'body':\n case 'blob':\n case 'json':\n case 'text':\n case 'arrayBuffer':\n case 'formData':\n throw new StaticGenBailoutError(\n `Route ${target.nextUrl.pathname} with \\`dynamic = \"error\"\\` couldn't be rendered statically because it used \\`request.${prop}\\`.`\n )\n case 'clone':\n return (\n target[requestCloneSymbol] ||\n (target[requestCloneSymbol] = () =>\n new Proxy(\n // This is vaguely unsafe but it's required since NextRequest does not implement\n // clone. The reason we might expect this to work in this context is the Proxy will\n // respond with static-amenable values anyway somewhat restoring the interface.\n // @TODO we need to rethink NextRequest and NextURL because they are not sufficientlly\n // sophisticated to adequately represent themselves in all contexts. A better approach is\n // to probably embed the static generation logic into the class itself removing the need\n // for any kind of proxying\n target.clone() as NextRequest,\n ensureStaticRequestHandlers\n ))\n )\n default:\n return ReflectAdapter.get(target, prop, receiver)\n }\n },\n // We don't need to proxy set because all the properties we proxy are ready only\n // and will be ignored\n}\n\nconst ensureStaticNextUrlHandlers = {\n get(\n target: NextURL & UrlSymbolTarget,\n prop: string | symbol,\n receiver: any\n ): unknown {\n switch (prop) {\n case 'search':\n case 'searchParams':\n case 'url':\n case 'href':\n case 'toJSON':\n case 'toString':\n case 'origin':\n throw new StaticGenBailoutError(\n `Route ${target.pathname} with \\`dynamic = \"error\"\\` couldn't be rendered statically because it used \\`nextUrl.${prop}\\`.`\n )\n case 'clone':\n return (\n target[urlCloneSymbol] ||\n (target[urlCloneSymbol] = () =>\n new Proxy(target.clone(), ensureStaticNextUrlHandlers))\n )\n default:\n return ReflectAdapter.get(target, prop, receiver)\n }\n },\n}\n\nfunction createCacheComponentsError(route: string) {\n return new DynamicServerError(\n `Route ${route} couldn't be rendered statically because it used IO that was not cached. See more info here: https://nextjs.org/docs/messages/cache-components`\n )\n}\n\nfunction trackDynamic(\n store: WorkStore,\n workUnitStore: undefined | WorkUnitStore,\n expression: string\n): void {\n if (store.dynamicShouldError) {\n throw new StaticGenBailoutError(\n `Route ${store.route} with \\`dynamic = \"error\"\\` couldn't be rendered statically because it used \\`${expression}\\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`\n )\n }\n\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'cache':\n case 'private-cache':\n // TODO: Should we allow reading cookies and search params from the\n // request for private caches in route handlers?\n throw createRouteHandlerRequestInUseCacheError(store.route, expression)\n case 'unstable-cache':\n throw createRouteHandlerRequestInUnstableCacheError(\n store.route,\n expression\n )\n case 'prerender':\n const error = new Error(\n `Route ${store.route} used ${expression} without first calling \\`await connection()\\`. See more info here: https://nextjs.org/docs/messages/next-prerender-sync-request`\n )\n return abortAndThrowOnSynchronousRequestDataAccess(\n store.route,\n expression,\n error,\n workUnitStore\n )\n case 'prerender-client':\n case 'validation-client':\n throw new InvariantError(\n 'A client prerender store should not be used for a route handler.'\n )\n case 'prerender-runtime':\n throw new InvariantError(\n 'A runtime prerender store should not be used for a route handler.'\n )\n case 'prerender-legacy':\n workUnitStore.revalidate = 0\n\n const err = new DynamicServerError(\n `Route ${store.route} couldn't be rendered statically because it used \\`${expression}\\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`\n )\n store.dynamicUsageDescription = expression\n store.dynamicUsageStack = err.stack\n\n throw err\n case 'request':\n break\n case 'build-time-generator':\n break\n default:\n workUnitStore satisfies never\n }\n }\n}\n"],"names":["RouteModule","createRequestStoreForAPI","createPrerenderWorkStore","createWorkStore","HTTP_METHODS","isHTTPMethod","getImplicitTags","patchFetch","getTracer","AppRouteRouteHandlersSpan","AppRouteRouteModuleSpan","Log","autoImplementMethods","appendMutableCookies","HeadersAdapter","RequestCookiesAdapter","parsedUrlQueryToParams","Phase","printDebugThrownValueForProspectiveRender","serverHooks","DynamicServerError","workAsyncStorage","workUnitAsyncStorage","actionAsyncStorage","sharedModules","getIsPossibleServerAction","RequestCookies","cleanURL","StaticGenBailoutError","isStaticGenEnabled","abortAndThrowOnSynchronousRequestDataAccess","createDynamicTrackingState","getFirstDynamicReason","ReflectAdapter","CacheSignal","scheduleImmediate","createServerParamsForRoute","getRedirectStatusCodeFromError","getURLFromRedirectError","isRedirectError","getAccessFallbackHTTPStatus","isHTTPAccessFallbackError","RedirectStatusCode","INFINITE_CACHE","executeRevalidates","trackPendingModules","InvariantError","LazyModule","createPrerenderResumeDataCache","createRouteHandlerRequestInUseCacheError","createRouteHandlerRequestInUnstableCacheError","WrappedNextRouterError","constructor","error","headers","AppRouteRouteModule","userland","_lazyUserland","assertLoaded","ensureUserland","waitUntilLoaded","getUserland","definition","distDir","relativeProjectDir","resolvedPagePath","nextConfigOutput","undefined","_getUserland","trace","loadUserland","spanName","attributes","pathname","module","_onUserlandLoaded","loadIfNeeded","_methods","_hasNonStaticMethods","hasNonStaticMethods","_dynamic","dynamic","Error","process","env","NODE_ENV","lowercased","map","method","toLowerCase","toUpperCase","some","resolveHandler","Response","status","resolveHandlerFromUserland","resolvePendingRevalidations","workStore","requestStore","context","maybeRevalidatesPromise","renderOpts","pendingWaitUntil","finally","NEXT_PRIVATE_DEBUG_CACHE","console","log","url","search","handleHandlerError","err","actionStore","Headers","Location","mutableCookies","isAction","SeeOther","httpStatus","finalizeResponse","res","request","prerenderStore","invalidType","name","fetchMetrics","collectedTags","tags","join","collectedRevalidate","revalidate","collectedExpire","expire","collectedStale","stale","body","statusText","prerenderToResponse","handler","implicitTags","cacheComponentsEnabled","cacheComponents","handlerContext","params","userlandRevalidate","defaultRevalidate","prospectiveController","AbortController","prospectiveRenderIsDynamic","cacheSignal","dynamicTracking","prerenderResumeDataCache","prospectiveRoutePrerenderStore","type","phase","rootParams","fallbackRouteParams","renderSignal","signal","controller","stagedRendering","resumeDataCache","hmrRefreshHash","varyParamsAccumulator","ensureStaticLevel","prerenderDataTracking","isFallbackUpgradeable","prospectiveResult","run","aborted","NEXT_DEBUG_BUILD","__NEXT_VERBOSE_LOGGING","route","ProspectiveRender","then","cacheReady","dynamicReason","finalController","finalRoutePrerenderStore","responseHandled","Promise","resolve","reject","result","bodyHandled","arrayBuffer","abort","createCacheComponentsError","renderToResponse","prepareExecution","req","rawLiveUserland","liveUserland","fetchCache","isAppRoute","page","nextUrl","previewProps","validateExecutionResponse","response","has","get","executeRequest","prepared","forceDynamic","forceStatic","Proxy","forceStaticRequestHandlers","dynamicShouldError","proxyNextRequest","tracer","setRootSpanAttribute","runHandler","executePrerender","dynamicUsageDescription","message","dynamicUsageStack","stack","ensureStaticRequestHandlers","handle","buildId","sharedContext","deploymentId","previouslyRevalidatedTags","prerender","handlers","POST","PUT","DELETE","PATCH","OPTIONS","nextURLSymbol","Symbol","requestCloneSymbol","urlCloneSymbol","searchParamsSymbol","hrefSymbol","toStringSymbol","headersSymbol","cookiesSymbol","target","prop","receiver","seal","forceStaticNextUrlHandlers","href","clone","URLSearchParams","nextUrlHandlers","workUnitStore","getStore","trackDynamic","nextRequestHandlers","ensureStaticNextUrlHandlers","store","expression"],"mappings":"AASA,SACEA,WAAW,QAGN,kBAAiB;AACxB,SAASC,wBAAwB,QAAQ,oCAAmC;AAC5E,SACEC,wBAAwB,EACxBC,eAAe,QAEV,iCAAgC;AACvC,SAA2BC,YAAY,EAAEC,YAAY,QAAQ,iBAAgB;AAC7E,SAASC,eAAe,QAA2B,0BAAyB;AAC5E,SAASC,UAAU,QAAQ,wBAAuB;AAClD,SAASC,SAAS,QAAQ,yBAAwB;AAClD,SACEC,yBAAyB,EACzBC,uBAAuB,QAClB,4BAA2B;AAClC,YAAYC,SAAS,4BAA2B;AAChD,SAASC,oBAAoB,QAAQ,mCAAkC;AACvE,SACEC,oBAAoB,QAEf,oDAAmD;AAC1D,SAASC,cAAc,QAAQ,4CAA2C;AAC1E,SAASC,qBAAqB,QAAQ,oDAAmD;AACzF,SAASC,sBAAsB,QAAQ,uCAAsC;AAC7E,SACEC,KAAK,EACLC,yCAAyC,QACpC,4CAA2C;AAElD,YAAYC,iBAAiB,kDAAiD;AAC9E,SAASC,kBAAkB,QAAQ,kDAAiD;AAEpF,SACEC,gBAAgB,QAEX,+CAA8C;AACrD,SACEC,oBAAoB,QAGf,oDAAmD;AAC1D,SACEC,kBAAkB,QAEb,iDAAgD;AACvD,YAAYC,mBAAmB,mBAAkB;AACjD,SAASC,yBAAyB,QAAQ,uCAAsC;AAChF,SAASC,cAAc,QAAQ,2CAA0C;AACzE,SAASC,QAAQ,QAAQ,sBAAqB;AAC9C,SAASC,qBAAqB,QAAQ,uDAAsD;AAC5F,SAASC,kBAAkB,QAAQ,kCAAiC;AACpE,SACEC,2CAA2C,EAC3CC,0BAA0B,EAC1BC,qBAAqB,QAChB,qCAAoC;AAC3C,SAASC,cAAc,QAAQ,4CAA2C;AAC1E,SAASC,WAAW,QAAQ,gCAA+B;AAC3D,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]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/shared-modules.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/shared-modules.js new file mode 100644 index 0000000000000000000000000000000000000000..da1a7befc986296045d4d0bd01b519cb79f4f0e4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/shared-modules.js @@ -0,0 +1,5 @@ +// the name of the export has to be the camelCase version of the file name (without the extension) +// TODO: remove this. We need it because using notFound from next/navigation imports this file :( +export * as appRouterContext from '../../../shared/lib/app-router-context.shared-runtime'; + +//# sourceMappingURL=shared-modules.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/shared-modules.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/shared-modules.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0085eef9e8118ea197a4c7d1369f98f00ff8b8e1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/app-route/shared-modules.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/route-modules/app-route/shared-modules.ts"],"sourcesContent":["// the name of the export has to be the camelCase version of the file name (without the extension)\n// TODO: remove this. We need it because using notFound from next/navigation imports this file :(\nexport * as appRouterContext from '../../../shared/lib/app-router-context.shared-runtime'\n"],"names":["appRouterContext"],"mappings":"AAAA,kGAAkG;AAClG,iGAAiG;AACjG,OAAO,KAAKA,gBAAgB,MAAM,wDAAuD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/checks.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/checks.js new file mode 100644 index 0000000000000000000000000000000000000000..8df42120b74905bf5e33366b8ca058ceb8a74d52 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/checks.js @@ -0,0 +1,15 @@ +import { RouteKind } from '../route-kind'; +export function isAppRouteRouteModule(routeModule) { + return routeModule.definition.kind === RouteKind.APP_ROUTE; +} +export function isAppPageRouteModule(routeModule) { + return routeModule.definition.kind === RouteKind.APP_PAGE; +} +export function isPagesRouteModule(routeModule) { + return routeModule.definition.kind === RouteKind.PAGES; +} +export function isPagesAPIRouteModule(routeModule) { + return routeModule.definition.kind === RouteKind.PAGES_API; +} + +//# sourceMappingURL=checks.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/checks.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/checks.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c5f332cd179aeb474271981b4abf3d6055fbeaf7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/checks.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/route-modules/checks.ts"],"sourcesContent":["import type { AppRouteRouteModule } from './app-route/module'\nimport type { AppPageRouteModule } from './app-page/module'\nimport type { PagesRouteModule } from './pages/module'\nimport type { PagesAPIRouteModule } from './pages-api/module'\n\nimport type { RouteModule } from './route-module'\n\nimport { RouteKind } from '../route-kind'\n\nexport function isAppRouteRouteModule(\n routeModule: RouteModule\n): routeModule is AppRouteRouteModule {\n return routeModule.definition.kind === RouteKind.APP_ROUTE\n}\n\nexport function isAppPageRouteModule(\n routeModule: RouteModule\n): routeModule is AppPageRouteModule {\n return routeModule.definition.kind === RouteKind.APP_PAGE\n}\n\nexport function isPagesRouteModule(\n routeModule: RouteModule\n): routeModule is PagesRouteModule {\n return routeModule.definition.kind === RouteKind.PAGES\n}\n\nexport function isPagesAPIRouteModule(\n routeModule: RouteModule\n): routeModule is PagesAPIRouteModule {\n return routeModule.definition.kind === RouteKind.PAGES_API\n}\n"],"names":["RouteKind","isAppRouteRouteModule","routeModule","definition","kind","APP_ROUTE","isAppPageRouteModule","APP_PAGE","isPagesRouteModule","PAGES","isPagesAPIRouteModule","PAGES_API"],"mappings":"AAOA,SAASA,SAAS,QAAQ,gBAAe;AAEzC,OAAO,SAASC,sBACdC,WAAwB;IAExB,OAAOA,YAAYC,UAAU,CAACC,IAAI,KAAKJ,UAAUK,SAAS;AAC5D;AAEA,OAAO,SAASC,qBACdJ,WAAwB;IAExB,OAAOA,YAAYC,UAAU,CAACC,IAAI,KAAKJ,UAAUO,QAAQ;AAC3D;AAEA,OAAO,SAASC,mBACdN,WAAwB;IAExB,OAAOA,YAAYC,UAAU,CAACC,IAAI,KAAKJ,UAAUS,KAAK;AACxD;AAEA,OAAO,SAASC,sBACdR,WAAwB;IAExB,OAAOA,YAAYC,UAAU,CAACC,IAAI,KAAKJ,UAAUW,SAAS;AAC5D","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages-api/module.compiled.d.ts b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages-api/module.compiled.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5401340695abe4a87f20f88a898449b7a42edfd6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages-api/module.compiled.d.ts @@ -0,0 +1 @@ +export * from './module' diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages-api/module.compiled.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages-api/module.compiled.js new file mode 100644 index 0000000000000000000000000000000000000000..9bbc835c7e37ceaa21f8dc89f5b1aa8bdf2db6b7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages-api/module.compiled.js @@ -0,0 +1,19 @@ +if (process.env.NEXT_RUNTIME === 'edge') { + module.exports = require('next/dist/server/route-modules/pages-api/module.js'); +} else { + if (process.env.NODE_ENV === 'development') { + if (process.env.TURBOPACK) { + module.exports = require('next/dist/compiled/next-server/pages-api-turbo.runtime.dev.js'); + } else { + module.exports = require('next/dist/compiled/next-server/pages-api.runtime.dev.js'); + } + } else { + if (process.env.TURBOPACK) { + module.exports = require('next/dist/compiled/next-server/pages-api-turbo.runtime.prod.js'); + } else { + module.exports = require('next/dist/compiled/next-server/pages-api.runtime.prod.js'); + } + } +} + +//# sourceMappingURL=module.compiled.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages-api/module.compiled.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages-api/module.compiled.js.map new file mode 100644 index 0000000000000000000000000000000000000000..20b0f18fdcb1aed6f1d38feaf2da54a7d9151408 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages-api/module.compiled.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/route-modules/pages-api/module.compiled.js"],"sourcesContent":["if (process.env.NEXT_RUNTIME === 'edge') {\n module.exports = require('next/dist/server/route-modules/pages-api/module.js')\n} else {\n if (process.env.NODE_ENV === 'development') {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/pages-api-turbo.runtime.dev.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/pages-api.runtime.dev.js')\n }\n } else {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/pages-api-turbo.runtime.prod.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/pages-api.runtime.prod.js')\n }\n }\n}\n"],"names":["process","env","NEXT_RUNTIME","module","exports","require","NODE_ENV","TURBOPACK"],"mappings":"AAAA,IAAIA,QAAQC,GAAG,CAACC,YAAY,KAAK,QAAQ;IACvCC,OAAOC,OAAO,GAAGC,QAAQ;AAC3B,OAAO;IACL,IAAIL,QAAQC,GAAG,CAACK,QAAQ,KAAK,eAAe;QAC1C,IAAIN,QAAQC,GAAG,CAACM,SAAS,EAAE;YACzBJ,OAAOC,OAAO,GAAGC,QAAQ;QAC3B,OAAO;YACLF,OAAOC,OAAO,GAAGC,QAAQ;QAC3B;IACF,OAAO;QACL,IAAIL,QAAQC,GAAG,CAACM,SAAS,EAAE;YACzBJ,OAAOC,OAAO,GAAGC,QAAQ;QAC3B,OAAO;YACLF,OAAOC,OAAO,GAAGC,QAAQ;QAC3B;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages-api/module.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages-api/module.js new file mode 100644 index 0000000000000000000000000000000000000000..2249753ae5b6768cd459a8d27a00e952c2336e1a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages-api/module.js @@ -0,0 +1,32 @@ +import { wrapApiHandler } from '../../api-utils'; +import { RouteModule } from '../route-module'; +import { apiResolver } from '../../api-utils/node/api-resolver'; +export class PagesAPIRouteModule extends RouteModule { + constructor(options){ + super(options); + if (typeof options.userland.default !== 'function') { + throw new Error(`Page ${options.definition.page} does not export a default function.`); + } + this.apiResolverWrapped = wrapApiHandler(options.definition.page, apiResolver); + } + /** + * + * @param req the incoming server request + * @param res the outgoing server response + * @param context the context for the render + */ async render(req, res, context) { + const { apiResolverWrapped } = this; + await apiResolverWrapped(req, res, context.query, this.userland, { + ...context.previewProps, + trustHostHeader: context.trustHostHeader, + allowedRevalidateHeaderKeys: context.allowedRevalidateHeaderKeys, + hostname: context.hostname, + multiZoneDraftMode: context.multiZoneDraftMode, + dev: context.dev, + internalRevalidate: context.internalRevalidate + }, context.propagateError, context.dev, context.page, context.onError); + } +} +export default PagesAPIRouteModule; + +//# sourceMappingURL=module.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages-api/module.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages-api/module.js.map new file mode 100644 index 0000000000000000000000000000000000000000..2a76477e130ea958b9e4be50a5604b8a9a08d72f --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages-api/module.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/route-modules/pages-api/module.ts"],"sourcesContent":["import type { IncomingMessage, ServerResponse } from 'http'\nimport type { PagesAPIRouteDefinition } from '../../route-definitions/pages-api-route-definition'\nimport type { PageConfig } from '../../../types'\nimport type { ParsedUrlQuery } from 'querystring'\nimport { wrapApiHandler, type __ApiPreviewProps } from '../../api-utils'\nimport type { RouteModuleOptions } from '../route-module'\n\nimport { RouteModule, type RouteModuleHandleContext } from '../route-module'\nimport { apiResolver } from '../../api-utils/node/api-resolver'\nimport type { RevalidateFn } from '../../lib/router-utils/router-server-context'\n\ntype PagesAPIHandleFn = (\n req: IncomingMessage,\n res: ServerResponse\n) => Promise\n\n/**\n * The PagesAPIModule is the type of the module exported by the bundled Pages\n * API module.\n */\nexport type PagesAPIModule = typeof import('../../../build/templates/pages-api')\n\ntype PagesAPIUserlandModule = {\n /**\n * The exported handler method.\n */\n readonly default: PagesAPIHandleFn\n\n /**\n * The exported page config.\n */\n readonly config?: PageConfig\n}\n\ntype PagesAPIRouteHandlerContext = RouteModuleHandleContext & {\n /**\n * The incoming server request in non-edge runtime.\n */\n req?: IncomingMessage\n\n /**\n * The outgoing server response in non-edge runtime.\n */\n res?: ServerResponse\n\n /**\n * The hostname for the request.\n */\n hostname?: string\n\n /**\n * Keys allowed in the revalidate call.\n */\n allowedRevalidateHeaderKeys?: string[]\n\n /**\n * Whether to trust the host header.\n */\n trustHostHeader?: boolean\n\n /**\n * The query for the request.\n */\n query: ParsedUrlQuery\n\n /**\n * The preview props used by the `preview` API.\n */\n previewProps: __ApiPreviewProps\n\n /**\n * True if the server is in development mode.\n */\n dev: boolean\n\n /**\n * Whether errors should be left uncaught to handle\n * higher up\n */\n propagateError: boolean\n\n /**\n * The page that's being rendered.\n */\n page: string\n\n /**\n * The error handler for the request.\n */\n onError?: Parameters[8]\n\n /**\n * whether multi-zone flag is enabled for draft mode\n */\n multiZoneDraftMode?: boolean\n\n /**\n * Internal revalidate function to avoid revalidating\n * over the network\n */\n internalRevalidate?: RevalidateFn\n}\n\nexport type PagesAPIRouteModuleOptions = RouteModuleOptions<\n PagesAPIRouteDefinition,\n PagesAPIUserlandModule\n>\n\nexport class PagesAPIRouteModule extends RouteModule<\n PagesAPIRouteDefinition,\n PagesAPIUserlandModule\n> {\n private apiResolverWrapped: typeof apiResolver\n\n constructor(options: PagesAPIRouteModuleOptions) {\n super(options)\n\n if (typeof options.userland.default !== 'function') {\n throw new Error(\n `Page ${options.definition.page} does not export a default function.`\n )\n }\n\n this.apiResolverWrapped = wrapApiHandler(\n options.definition.page,\n apiResolver\n )\n }\n\n /**\n *\n * @param req the incoming server request\n * @param res the outgoing server response\n * @param context the context for the render\n */\n public async render(\n req: IncomingMessage,\n res: ServerResponse,\n context: PagesAPIRouteHandlerContext\n ): Promise {\n const { apiResolverWrapped } = this\n await apiResolverWrapped(\n req,\n res,\n context.query,\n this.userland,\n {\n ...context.previewProps,\n trustHostHeader: context.trustHostHeader,\n allowedRevalidateHeaderKeys: context.allowedRevalidateHeaderKeys,\n hostname: context.hostname,\n multiZoneDraftMode: context.multiZoneDraftMode,\n dev: context.dev,\n internalRevalidate: context.internalRevalidate,\n },\n context.propagateError,\n context.dev,\n context.page,\n context.onError\n )\n }\n}\n\nexport default PagesAPIRouteModule\n"],"names":["wrapApiHandler","RouteModule","apiResolver","PagesAPIRouteModule","constructor","options","userland","default","Error","definition","page","apiResolverWrapped","render","req","res","context","query","previewProps","trustHostHeader","allowedRevalidateHeaderKeys","hostname","multiZoneDraftMode","dev","internalRevalidate","propagateError","onError"],"mappings":"AAIA,SAASA,cAAc,QAAgC,kBAAiB;AAGxE,SAASC,WAAW,QAAuC,kBAAiB;AAC5E,SAASC,WAAW,QAAQ,oCAAmC;AAoG/D,OAAO,MAAMC,4BAA4BF;IAMvCG,YAAYC,OAAmC,CAAE;QAC/C,KAAK,CAACA;QAEN,IAAI,OAAOA,QAAQC,QAAQ,CAACC,OAAO,KAAK,YAAY;YAClD,MAAM,IAAIC,MACR,CAAC,KAAK,EAAEH,QAAQI,UAAU,CAACC,IAAI,CAAC,oCAAoC,CAAC;QAEzE;QAEA,IAAI,CAACC,kBAAkB,GAAGX,eACxBK,QAAQI,UAAU,CAACC,IAAI,EACvBR;IAEJ;IAEA;;;;;GAKC,GACD,MAAaU,OACXC,GAAoB,EACpBC,GAAmB,EACnBC,OAAoC,EACrB;QACf,MAAM,EAAEJ,kBAAkB,EAAE,GAAG,IAAI;QACnC,MAAMA,mBACJE,KACAC,KACAC,QAAQC,KAAK,EACb,IAAI,CAACV,QAAQ,EACb;YACE,GAAGS,QAAQE,YAAY;YACvBC,iBAAiBH,QAAQG,eAAe;YACxCC,6BAA6BJ,QAAQI,2BAA2B;YAChEC,UAAUL,QAAQK,QAAQ;YAC1BC,oBAAoBN,QAAQM,kBAAkB;YAC9CC,KAAKP,QAAQO,GAAG;YAChBC,oBAAoBR,QAAQQ,kBAAkB;QAChD,GACAR,QAAQS,cAAc,EACtBT,QAAQO,GAAG,EACXP,QAAQL,IAAI,EACZK,QAAQU,OAAO;IAEnB;AACF;AAEA,eAAetB,oBAAmB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/builtin/_error.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/builtin/_error.js new file mode 100644 index 0000000000000000000000000000000000000000..c43e4603dc596b68abbc9863167ffe8abca4f7d2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/builtin/_error.js @@ -0,0 +1,32 @@ +import App from '../../../../pages/_app'; +import Document from '../../../../pages/_document'; +import { RouteKind } from '../../../route-kind'; +import * as moduleError from '../../../../pages/_error'; +import PagesRouteModule from '../module'; +import { getHandler } from '../pages-handler'; +export const routeModule = new PagesRouteModule({ + // TODO: add descriptor for internal error page + definition: { + kind: RouteKind.PAGES, + page: '/_error', + pathname: '/_error', + filename: '', + bundlePath: '' + }, + distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '', + relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '', + components: { + App, + Document + }, + userland: moduleError +}); +export const handler = getHandler({ + srcPage: '/_error', + routeModule, + userland: moduleError, + config: {}, + isFallbackError: true +}); + +//# sourceMappingURL=_error.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/builtin/_error.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/builtin/_error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a980edb272c7a0bc34a8cd844d79c3772b6c47b7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/builtin/_error.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/server/route-modules/pages/builtin/_error.tsx"],"sourcesContent":["import App from '../../../../pages/_app'\nimport Document from '../../../../pages/_document'\nimport { RouteKind } from '../../../route-kind'\n\nimport * as moduleError from '../../../../pages/_error'\n\nimport PagesRouteModule from '../module'\nimport { getHandler } from '../pages-handler'\n\nexport const routeModule = new PagesRouteModule({\n // TODO: add descriptor for internal error page\n definition: {\n kind: RouteKind.PAGES,\n page: '/_error',\n pathname: '/_error',\n filename: '',\n bundlePath: '',\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n components: {\n App,\n Document,\n },\n userland: moduleError,\n})\n\nexport const handler = getHandler({\n srcPage: '/_error',\n routeModule,\n userland: moduleError,\n config: {},\n isFallbackError: true,\n})\n"],"names":["App","Document","RouteKind","moduleError","PagesRouteModule","getHandler","routeModule","definition","kind","PAGES","page","pathname","filename","bundlePath","distDir","process","env","__NEXT_RELATIVE_DIST_DIR","relativeProjectDir","__NEXT_RELATIVE_PROJECT_DIR","components","userland","handler","srcPage","config","isFallbackError"],"mappings":"AAAA,OAAOA,SAAS,yBAAwB;AACxC,OAAOC,cAAc,8BAA6B;AAClD,SAASC,SAAS,QAAQ,sBAAqB;AAE/C,YAAYC,iBAAiB,2BAA0B;AAEvD,OAAOC,sBAAsB,YAAW;AACxC,SAASC,UAAU,QAAQ,mBAAkB;AAE7C,OAAO,MAAMC,cAAc,IAAIF,iBAAiB;IAC9C,+CAA+C;IAC/CG,YAAY;QACVC,MAAMN,UAAUO,KAAK;QACrBC,MAAM;QACNC,UAAU;QACVC,UAAU;QACVC,YAAY;IACd;IACAC,SAASC,QAAQC,GAAG,CAACC,wBAAwB,IAAI;IACjDC,oBAAoBH,QAAQC,GAAG,CAACG,2BAA2B,IAAI;IAC/DC,YAAY;QACVpB;QACAC;IACF;IACAoB,UAAUlB;AACZ,GAAE;AAEF,OAAO,MAAMmB,UAAUjB,WAAW;IAChCkB,SAAS;IACTjB;IACAe,UAAUlB;IACVqB,QAAQ,CAAC;IACTC,iBAAiB;AACnB,GAAE","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.compiled.d.ts b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.compiled.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5401340695abe4a87f20f88a898449b7a42edfd6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.compiled.d.ts @@ -0,0 +1 @@ +export * from './module' diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.compiled.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.compiled.js new file mode 100644 index 0000000000000000000000000000000000000000..4059e125a1c51e982a236cb53a145ed1472ef75a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.compiled.js @@ -0,0 +1,19 @@ +if (process.env.NEXT_RUNTIME === 'edge') { + module.exports = require('next/dist/server/route-modules/pages/module.js'); +} else { + if (process.env.NODE_ENV === 'development') { + if (process.env.TURBOPACK) { + module.exports = require('next/dist/compiled/next-server/pages-turbo.runtime.dev.js'); + } else { + module.exports = require('next/dist/compiled/next-server/pages.runtime.dev.js'); + } + } else { + if (process.env.TURBOPACK) { + module.exports = require('next/dist/compiled/next-server/pages-turbo.runtime.prod.js'); + } else { + module.exports = require('next/dist/compiled/next-server/pages.runtime.prod.js'); + } + } +} + +//# sourceMappingURL=module.compiled.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.compiled.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.compiled.js.map new file mode 100644 index 0000000000000000000000000000000000000000..90a96bb294ebe61acd8103c30f4f742f783fcacf --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.compiled.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/route-modules/pages/module.compiled.js"],"sourcesContent":["if (process.env.NEXT_RUNTIME === 'edge') {\n module.exports = require('next/dist/server/route-modules/pages/module.js')\n} else {\n if (process.env.NODE_ENV === 'development') {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/pages-turbo.runtime.dev.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/pages.runtime.dev.js')\n }\n } else {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/pages-turbo.runtime.prod.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/pages.runtime.prod.js')\n }\n }\n}\n"],"names":["process","env","NEXT_RUNTIME","module","exports","require","NODE_ENV","TURBOPACK"],"mappings":"AAAA,IAAIA,QAAQC,GAAG,CAACC,YAAY,KAAK,QAAQ;IACvCC,OAAOC,OAAO,GAAGC,QAAQ;AAC3B,OAAO;IACL,IAAIL,QAAQC,GAAG,CAACK,QAAQ,KAAK,eAAe;QAC1C,IAAIN,QAAQC,GAAG,CAACM,SAAS,EAAE;YACzBJ,OAAOC,OAAO,GAAGC,QAAQ;QAC3B,OAAO;YACLF,OAAOC,OAAO,GAAGC,QAAQ;QAC3B;IACF,OAAO;QACL,IAAIL,QAAQC,GAAG,CAACM,SAAS,EAAE;YACzBJ,OAAOC,OAAO,GAAGC,QAAQ;QAC3B,OAAO;YACLF,OAAOC,OAAO,GAAGC,QAAQ;QAC3B;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.js new file mode 100644 index 0000000000000000000000000000000000000000..199fd904be244da61c4c1148bcf9f592a49085b5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.js @@ -0,0 +1,23 @@ +import { RouteModule } from '../route-module'; +import { renderToHTMLImpl, renderToHTML } from '../../render'; +import * as vendoredContexts from './vendored/contexts/entrypoints'; +export class PagesRouteModule extends RouteModule { + constructor(options){ + super(options); + this.components = options.components; + } + render(req, res, context) { + return renderToHTMLImpl(req, res, context.page, context.query, context.renderOpts, { + App: this.components.App, + Document: this.components.Document + }, context.sharedContext, context.renderContext); + } +} +const vendored = { + contexts: vendoredContexts +}; +// needed for the static build +export { renderToHTML, vendored }; +export default PagesRouteModule; + +//# sourceMappingURL=module.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c18f4ef4116ec13eda5a5c0f79e324dc6dd46ab0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/route-modules/pages/module.ts"],"sourcesContent":["import type { IncomingMessage, ServerResponse } from 'http'\nimport type {\n GetServerSideProps,\n GetStaticPaths,\n GetStaticProps,\n NextComponentType,\n PageConfig,\n} from '../../../types'\nimport type { PagesRouteDefinition } from '../../route-definitions/pages-route-definition'\nimport type { NextParsedUrlQuery } from '../../request-meta'\nimport type {\n PagesRenderContext,\n PagesSharedContext,\n RenderOpts,\n} from '../../render'\nimport type RenderResult from '../../render-result'\nimport type { AppType, DocumentType } from '../../../shared/lib/utils'\n\nimport {\n RouteModule,\n type RouteModuleHandleContext,\n type RouteModuleOptions,\n} from '../route-module'\nimport { renderToHTMLImpl, renderToHTML } from '../../render'\nimport * as vendoredContexts from './vendored/contexts/entrypoints'\n\n/**\n * The PagesModule is the type of the module exported by the bundled pages\n * module.\n */\nexport type PagesModule = typeof import('../../../build/templates/pages')\n\n/**\n * The userland module for a page. This is the module that is exported from the\n * page file that contains the page component, page config, and any page data\n * fetching functions.\n */\nexport type PagesUserlandModule = {\n /**\n * The exported page component.\n */\n readonly default: NextComponentType\n\n /**\n * The exported page config.\n */\n readonly config?: PageConfig\n\n /**\n * The exported `getStaticProps` function.\n */\n readonly getStaticProps?: GetStaticProps\n\n /**\n * The exported `getStaticPaths` function.\n */\n readonly getStaticPaths?: GetStaticPaths\n\n /**\n * The exported `getServerSideProps` function.\n */\n readonly getServerSideProps?: GetServerSideProps\n}\n\n/**\n * The components that are used to render a page. These aren't tied to the\n * specific page being rendered, but rather are the components that are used to\n * render all pages.\n */\ntype PagesComponents = {\n /**\n * The `App` component. This could be exported by a user's custom `_app` page\n * file, or it could be the default `App` component.\n */\n readonly App: AppType\n\n /**\n * The `Document` component. This could be exported by a user's custom\n * `_document` page file, or it could be the default `Document` component.\n */\n readonly Document: DocumentType\n}\n\nexport interface PagesRouteModuleOptions\n extends RouteModuleOptions {\n readonly components: PagesComponents\n}\n\n/**\n * AppRouteRouteHandlerContext is the context that is passed to the route\n * handler for app routes.\n */\nexport interface PagesRouteHandlerContext extends RouteModuleHandleContext {\n /**\n * The page for the given route.\n */\n page: string\n\n /**\n * The parsed URL query for the given request.\n */\n query: NextParsedUrlQuery\n\n /**\n * The shared context used for all page renders.\n */\n sharedContext: PagesSharedContext\n\n /**\n * The context for the given request.\n */\n renderContext: PagesRenderContext\n\n /**\n * The arguments for the given request.\n /**\n * The RenderOpts for the given request which include the specific modules to\n * use for rendering.\n */\n // TODO: (wyattjoh) break this out into smaller parts, it currently includes the userland components\n renderOpts: Omit\n}\n\nexport class PagesRouteModule extends RouteModule<\n PagesRouteDefinition,\n PagesUserlandModule\n> {\n private readonly components: PagesComponents\n\n constructor(options: PagesRouteModuleOptions) {\n super(options)\n\n this.components = options.components\n }\n\n public render(\n req: IncomingMessage,\n res: ServerResponse,\n context: PagesRouteHandlerContext\n ): Promise {\n return renderToHTMLImpl(\n req,\n res,\n context.page,\n context.query,\n context.renderOpts,\n {\n App: this.components.App,\n Document: this.components.Document,\n },\n context.sharedContext,\n context.renderContext\n )\n }\n}\n\nconst vendored = {\n contexts: vendoredContexts,\n}\n\n// needed for the static build\nexport { renderToHTML, vendored }\n\nexport default PagesRouteModule\n"],"names":["RouteModule","renderToHTMLImpl","renderToHTML","vendoredContexts","PagesRouteModule","constructor","options","components","render","req","res","context","page","query","renderOpts","App","Document","sharedContext","renderContext","vendored","contexts"],"mappings":"AAkBA,SACEA,WAAW,QAGN,kBAAiB;AACxB,SAASC,gBAAgB,EAAEC,YAAY,QAAQ,eAAc;AAC7D,YAAYC,sBAAsB,kCAAiC;AAmGnE,OAAO,MAAMC,yBAAyBJ;IAMpCK,YAAYC,OAAgC,CAAE;QAC5C,KAAK,CAACA;QAEN,IAAI,CAACC,UAAU,GAAGD,QAAQC,UAAU;IACtC;IAEOC,OACLC,GAAoB,EACpBC,GAAmB,EACnBC,OAAiC,EACV;QACvB,OAAOV,iBACLQ,KACAC,KACAC,QAAQC,IAAI,EACZD,QAAQE,KAAK,EACbF,QAAQG,UAAU,EAClB;YACEC,KAAK,IAAI,CAACR,UAAU,CAACQ,GAAG;YACxBC,UAAU,IAAI,CAACT,UAAU,CAACS,QAAQ;QACpC,GACAL,QAAQM,aAAa,EACrBN,QAAQO,aAAa;IAEzB;AACF;AAEA,MAAMC,WAAW;IACfC,UAAUjB;AACZ;AAEA,8BAA8B;AAC9B,SAASD,YAAY,EAAEiB,QAAQ,GAAE;AAEjC,eAAef,iBAAgB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.render.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.render.js new file mode 100644 index 0000000000000000000000000000000000000000..faff73ca91db9811146431dd715d2c81080ace90 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.render.js @@ -0,0 +1,10 @@ +export const lazyRenderPagesPage = (...args)=>{ + if (process.env.NEXT_MINIMAL) { + throw new Error("Can't use lazyRenderPagesPage in minimal mode"); + } else { + const render = require('./module.compiled').renderToHTML; + return render(...args); + } +}; + +//# sourceMappingURL=module.render.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.render.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.render.js.map new file mode 100644 index 0000000000000000000000000000000000000000..882173ffede90a50d29e4ca43d4d817d4594e144 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/module.render.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/route-modules/pages/module.render.ts"],"sourcesContent":["import type { PagesRender } from '../../render'\n\nexport const lazyRenderPagesPage: PagesRender = (...args) => {\n if (process.env.NEXT_MINIMAL) {\n throw new Error(\"Can't use lazyRenderPagesPage in minimal mode\")\n } else {\n const render: PagesRender = (\n require('./module.compiled') as typeof import('./module.compiled')\n ).renderToHTML\n\n return render(...args)\n }\n}\n"],"names":["lazyRenderPagesPage","args","process","env","NEXT_MINIMAL","Error","render","require","renderToHTML"],"mappings":"AAEA,OAAO,MAAMA,sBAAmC,CAAC,GAAGC;IAClD,IAAIC,QAAQC,GAAG,CAACC,YAAY,EAAE;QAC5B,MAAM,IAAIC,MAAM;IAClB,OAAO;QACL,MAAMC,SAAsB,AAC1BC,QAAQ,qBACRC,YAAY;QAEd,OAAOF,UAAUL;IACnB;AACF,EAAC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/pages-handler.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/pages-handler.js new file mode 100644 index 0000000000000000000000000000000000000000..c88cb408947ffc7b186984d1e969c2ddab6af2a8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/pages-handler.js @@ -0,0 +1,561 @@ +import { RouteKind } from '../../route-kind'; +import { BaseServerSpan } from '../../lib/trace/constants'; +import { getTracer, SpanKind } from '../../lib/trace/tracer'; +import { formatUrl } from '../../../shared/lib/router/utils/format-url'; +import { addRequestMeta, getRequestMeta, setRequestMeta } from '../../request-meta'; +import { interopDefault } from '../../app-render/interop-default'; +import { getRevalidateReason } from '../../instrumentation/utils'; +import { normalizeDataPath } from '../../../shared/lib/page-path/normalize-data-path'; +import { CachedRouteKind } from '../../response-cache'; +import { getCacheControlHeader } from '../../lib/cache-control'; +import { normalizeRepeatedSlashes } from '../../../shared/lib/utils'; +import { getRedirectStatus } from '../../../lib/redirect-status'; +import { CACHE_ONE_YEAR_SECONDS, HTML_CONTENT_TYPE_HEADER, JSON_CONTENT_TYPE_HEADER, NEXT_NAV_DEPLOYMENT_ID_HEADER } from '../../../lib/constants'; +import path from 'path'; +import { sendRenderResult } from '../../send-payload'; +import RenderResult from '../../render-result'; +import { toResponseCacheEntry } from '../../response-cache/utils'; +import { NoFallbackError } from '../../../shared/lib/no-fallback-error.external'; +import { RedirectStatusCode } from '../../../client/components/redirect-status-code'; +import { isBot } from '../../../shared/lib/router/utils/is-bot'; +import { addPathPrefix } from '../../../shared/lib/router/utils/add-path-prefix'; +import { removeTrailingSlash } from '../../../shared/lib/router/utils/remove-trailing-slash'; +import { isRouteCacheOwner } from '../../lib/route-cache-key'; +export const getHandler = ({ srcPage: originalSrcPage, config, userland, routeModule, isFallbackError, getStaticPaths, getStaticProps, getServerSideProps })=>{ + return async function handler(req, res, ctx) { + var _serverFilesManifest_config_experimental, _serverFilesManifest_config, _parsedUrl_pathname; + if (ctx.requestMeta) { + setRequestMeta(req, ctx.requestMeta); + } + if (routeModule.isDev) { + addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint()); + } + let srcPage = originalSrcPage; + // turbopack doesn't normalize `/index` in the page name + // so we need to to process dynamic routes properly + // TODO: fix turbopack providing differing value from webpack + if (process.env.TURBOPACK) { + srcPage = srcPage.replace(/\/index$/, '') || '/'; + } else if (srcPage === '/index') { + // we always normalize /index specifically + srcPage = '/'; + } + const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE; + const prepareResult = await routeModule.prepare(req, res, { + srcPage, + multiZoneDraftMode + }); + if (!prepareResult) { + res.statusCode = 400; + res.end('Bad Request'); + ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve()); + return; + } + const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode')); + const render404 = async ()=>{ + // TODO: should route-module itself handle rendering the 404 + if (routerServerContext == null ? void 0 : routerServerContext.render404) { + // When the Pages and App Routers coexist, a Pages Router 404 renders + // the App Router not-found page. A direct route-module invocation + // cannot provide the postponed state needed to resume that App Router + // output, so an empty postponed state signals that the renderer must + // perform a complete dynamic render instead. + // + // TODO: Re-enter routing with the App Router not-found output so its + // prerender and postponed state can be selected and resumed. + if (nextConfig.cacheComponents && !routerServerContext.isWrappedByNextServer && typeof getRequestMeta(req, 'postponed') !== 'string') { + addRequestMeta(req, 'postponed', ''); + } + await routerServerContext.render404(req, res, parsedUrl, false); + } else { + res.end('This page could not be found'); + } + }; + const { buildId, query, params, parsedUrl, originalQuery, originalPathname, buildManifest, fallbackBuildManifest, nextFontManifest, serverFilesManifest, reactLoadableManifest, prerenderManifest, previewProps, isDraftMode, isOnDemandRevalidate, revalidateOnlyGenerated, locale, locales, defaultLocale, routerServerContext, nextConfig, resolvedPathname, encodedResolvedPathname, deploymentId, clientAssetToken } = prepareResult; + const isExperimentalCompile = serverFilesManifest == null ? void 0 : (_serverFilesManifest_config = serverFilesManifest.config) == null ? void 0 : (_serverFilesManifest_config_experimental = _serverFilesManifest_config.experimental) == null ? void 0 : _serverFilesManifest_config_experimental.isExperimentalCompile; + const hasServerProps = Boolean(getServerSideProps); + const hasStaticProps = Boolean(getStaticProps); + const hasStaticPaths = Boolean(getStaticPaths); + const hasGetInitialProps = Boolean((userland.default || userland).getInitialProps); + let cacheKey = null; + let isIsrFallback = false; + let isNextDataRequest = prepareResult.isNextDataRequest && (hasStaticProps || hasServerProps); + const is404Page = srcPage === '/404'; + const is500Page = srcPage === '/500'; + const isErrorPage = srcPage === '/_error'; + if (!routeModule.isDev && !isDraftMode && hasStaticProps) { + cacheKey = `${locale ? `/${locale}` : ''}${(srcPage === '/' || resolvedPathname === '/') && locale ? '' : resolvedPathname}`; + if (is404Page || is500Page || isErrorPage) { + cacheKey = `${locale ? `/${locale}` : ''}${srcPage}`; + } + // ensure /index and / is normalized to one key + cacheKey = cacheKey === '/index' ? '/' : cacheKey; + } + if (hasStaticPaths && !isDraftMode) { + var _nextConfig_i18n; + const decodedPathname = removeTrailingSlash(locale ? addPathPrefix(resolvedPathname, `/${locale}`) : resolvedPathname); + const isPrerendered = (Boolean(prerenderManifest.routes[decodedPathname]) || prerenderManifest.notFoundRoutes.includes(decodedPathname)) && // A sibling's positive or negative prerender cannot admit parameters + // that this route excluded. Development computes static paths on demand + // instead of reading build-time prerender metadata. + (routeModule.isDev || isRouteCacheOwner(decodedPathname, routeModule.cacheOwner, prerenderManifest.routes[decodedPathname], (_nextConfig_i18n = nextConfig.i18n) == null ? void 0 : _nextConfig_i18n.locales)); + const prerenderInfo = prerenderManifest.dynamicRoutes[srcPage]; + if (prerenderInfo) { + if (prerenderInfo.fallback === false && !isPrerendered) { + if (nextConfig.adapterPath) { + return await render404(); + } + throw new NoFallbackError(); + } + if (typeof prerenderInfo.fallback === 'string' && !isPrerendered && !isNextDataRequest) { + isIsrFallback = true; + } + } + } + // When serving a bot request, we want to serve a blocking render and not + // the prerendered page. This ensures that the correct content is served + // to the bot in the head. + if (isIsrFallback && isBot(req.headers['user-agent'] || '') || isMinimalMode) { + isIsrFallback = false; + } + const tracer = getTracer(); + const activeSpan = tracer.getActiveScopeSpan(); + const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer); + const method = req.method || 'GET'; + const resolvedUrl = formatUrl({ + pathname: nextConfig.trailingSlash ? `${encodedResolvedPathname}${!encodedResolvedPathname.endsWith('/') && ((_parsedUrl_pathname = parsedUrl.pathname) == null ? void 0 : _parsedUrl_pathname.endsWith('/')) ? '/' : ''}` : removeTrailingSlash(encodedResolvedPathname || '/'), + // make sure to only add query values from original URL + query: hasStaticProps ? {} : originalQuery + }); + let parentSpan; + const handleResponse = async (span)=>{ + const responseGenerator = async ({ previousCacheEntry })=>{ + var _previousCacheEntry_value; + const doRender = async ()=>{ + try { + var _nextConfig_i18n; + return await routeModule.render(req, res, { + query: hasStaticProps && !isExperimentalCompile ? { + ...params + } : { + ...query, + ...params + }, + params, + page: srcPage, + renderContext: { + isDraftMode, + isFallback: isIsrFallback, + developmentNotFoundSourcePage: getRequestMeta(req, 'developmentNotFoundSourcePage') + }, + sharedContext: { + buildId, + customServer: Boolean(routerServerContext == null ? void 0 : routerServerContext.isCustomServer) || undefined, + deploymentId, + clientAssetToken + }, + renderOpts: { + params, + routeModule, + page: srcPage, + pageConfig: config || {}, + Component: interopDefault(userland), + ComponentMod: userland, + getStaticProps, + getStaticPaths, + getServerSideProps, + supportsDynamicResponse: !hasStaticProps, + buildManifest: isFallbackError ? fallbackBuildManifest : buildManifest, + nextFontManifest, + reactLoadableManifest, + assetPrefix: routeModule.getAssetPrefixForRender(routerServerContext, nextConfig.assetPrefix), + previewProps, + images: nextConfig.images, + nextConfigOutput: nextConfig.output, + optimizeCss: Boolean(nextConfig.experimental.optimizeCss), + nextScriptWorkers: Boolean(nextConfig.experimental.nextScriptWorkers), + domainLocales: (_nextConfig_i18n = nextConfig.i18n) == null ? void 0 : _nextConfig_i18n.domains, + crossOrigin: nextConfig.crossOrigin, + multiZoneDraftMode, + basePath: nextConfig.basePath, + disableOptimizedLoading: nextConfig.experimental.disableOptimizedLoading, + largePageDataBytes: nextConfig.experimental.largePageDataBytes, + isExperimentalCompile, + experimental: { + clientTraceMetadata: nextConfig.experimental.clientTraceMetadata || [] + }, + locale, + locales, + defaultLocale, + setIsrStatus: routerServerContext == null ? void 0 : routerServerContext.setIsrStatus, + isNextDataRequest: isNextDataRequest && (hasServerProps || hasStaticProps), + resolvedUrl, + // For getServerSideProps and getInitialProps we need to ensure we use the original URL + // and not the resolved URL to prevent a hydration mismatch on + // asPath + resolvedAsPath: hasServerProps || hasGetInitialProps ? formatUrl({ + // we use the original URL pathname less the _next/data prefix if + // present + pathname: isNextDataRequest ? normalizeDataPath(originalPathname) : originalPathname, + query: originalQuery + }) : resolvedUrl, + isOnDemandRevalidate, + ErrorDebug: getRequestMeta(req, 'PagesErrorDebug'), + err: getRequestMeta(req, 'invokeError'), + // needed for experimental.optimizeCss feature + distDir: path.join(/* turbopackIgnore: true */ process.cwd(), routeModule.relativeProjectDir, routeModule.distDir) + } + }).then((renderResult)=>{ + const { metadata } = renderResult; + let cacheControl = metadata.cacheControl; + // Apply the `expireTime` fallback as soon as we have the + // render's `cacheControl`, so every downstream consumer (the + // cache stored via `incrementalCache.set`, the response + // Cache-Control header, the outgoing entry returned from this + // responseGenerator) sees a finalized `cacheControl` with a + // populated `expire`. This mirrors the build-time fallback in + // `build/index.ts` so we don't apply an expire to routes that + // opt out of revalidation entirely (`revalidate: false`) or + // that are dynamic (`revalidate: 0`). + if (cacheControl && cacheControl.revalidate !== false && cacheControl.revalidate > 0 && cacheControl.expire === undefined) { + cacheControl.expire = nextConfig.expireTime; + } + if ('isNotFound' in metadata && metadata.isNotFound) { + return { + value: null, + cacheControl + }; + } + // Handle `isRedirect`. + if (metadata.isRedirect) { + return { + value: { + kind: CachedRouteKind.REDIRECT, + props: metadata.pageData ?? metadata.flightData + }, + cacheControl + }; + } + return { + value: { + kind: CachedRouteKind.PAGES, + html: renderResult, + pageData: renderResult.metadata.pageData, + headers: renderResult.metadata.headers, + status: renderResult.metadata.statusCode + }, + cacheControl + }; + }); + } catch (err) { + // if this is a background revalidate we need to report + // the request error here as it won't be bubbled + if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) { + const silenceLog = false; + await routeModule.onRequestError(req, err, { + routerKind: 'Pages Router', + routePath: srcPage, + routeType: 'render', + revalidateReason: getRevalidateReason({ + isStaticGeneration: hasStaticProps, + isOnDemandRevalidate + }) + }, silenceLog, routerServerContext); + } + throw err; + } + }; + // if we've already generated this page we no longer + // serve the fallback + if (previousCacheEntry) { + isIsrFallback = false; + } + if (isIsrFallback) { + const fallbackResponse = await routeModule.getResponseCache(req).get(routeModule.isDev ? null : locale ? `/${locale}${srcPage}` : srcPage, async ({ previousCacheEntry: previousFallbackCacheEntry = null })=>{ + if (!routeModule.isDev) { + return toResponseCacheEntry(previousFallbackCacheEntry); + } + return doRender(); + }, { + routeKind: RouteKind.PAGES, + isFallback: true, + isRoutePPREnabled: false, + isOnDemandRevalidate: false, + incrementalCache: await routeModule.getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode), + waitUntil: ctx.waitUntil + }); + if (fallbackResponse !== null && 'error' in fallbackResponse) { + throw fallbackResponse.error; + } + if (fallbackResponse) { + // Remove the cache control from the response to prevent it from being + // used in the surrounding cache. + delete fallbackResponse.cacheControl; + fallbackResponse.isMiss = true; + return fallbackResponse; + } + } + if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) { + res.statusCode = 404; + // on-demand revalidate always sets this header + res.setHeader('x-nextjs-cache', 'REVALIDATED'); + res.end('This page could not be found'); + return null; + } + if (isIsrFallback && (previousCacheEntry == null ? void 0 : (_previousCacheEntry_value = previousCacheEntry.value) == null ? void 0 : _previousCacheEntry_value.kind) === CachedRouteKind.PAGES) { + return { + value: { + kind: CachedRouteKind.PAGES, + html: new RenderResult(previousCacheEntry.value.html, { + contentType: HTML_CONTENT_TYPE_HEADER, + metadata: { + statusCode: previousCacheEntry.value.status, + headers: previousCacheEntry.value.headers + } + }), + pageData: {}, + status: previousCacheEntry.value.status, + headers: previousCacheEntry.value.headers + }, + cacheControl: { + revalidate: 0, + expire: undefined + } + }; + } + return doRender(); + }; + try { + const result = await routeModule.handleResponse({ + cacheKey, + req, + nextConfig, + routeKind: RouteKind.PAGES, + isOnDemandRevalidate, + revalidateOnlyGenerated, + waitUntil: ctx.waitUntil, + responseGenerator: responseGenerator, + previewProps, + prerenderManifest, + isMinimalMode + }); + if (result !== null && 'error' in result) { + throw result.error; + } + // if we got a cache hit this wasn't an ISR fallback + // but it wasn't generated during build so isn't in the + // prerender-manifest + if (isIsrFallback && !(result == null ? void 0 : result.isMiss)) { + isIsrFallback = false; + } + // response is finished is no cache entry + if (!result) { + return; + } + if (hasStaticProps && !isMinimalMode) { + res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : result.isMiss ? 'MISS' : result.isStale ? 'STALE' : 'HIT'); + } + let cacheControl; + if (!hasStaticProps || isIsrFallback) { + if (!res.getHeader('Cache-Control')) { + cacheControl = { + revalidate: 0, + expire: undefined + }; + } + } else if (is404Page) { + const notFoundRevalidate = getRequestMeta(req, 'notFoundRevalidate'); + cacheControl = { + revalidate: typeof notFoundRevalidate === 'undefined' ? 0 : notFoundRevalidate, + expire: undefined + }; + } else if (is500Page) { + cacheControl = { + revalidate: 0, + expire: undefined + }; + } else if (result.cacheControl) { + // If the cache entry has a cache control with a revalidate value that's + // a number, use it. + if (typeof result.cacheControl.revalidate === 'number') { + if (result.cacheControl.revalidate < 1) { + throw new Error(`Invalid revalidate configuration provided: ${result.cacheControl.revalidate} < 1`); + } + cacheControl = { + revalidate: result.cacheControl.revalidate, + expire: result.cacheControl.expire + }; + } else { + // revalidate: false + cacheControl = { + revalidate: CACHE_ONE_YEAR_SECONDS, + expire: undefined + }; + } + } + // If cache control is already set on the response we don't + // override it to allow users to customize it via next.config + if (cacheControl && !res.getHeader('Cache-Control')) { + res.setHeader('Cache-Control', getCacheControlHeader(cacheControl)); + } + // notFound: true case + if (!result.value) { + var _result_cacheControl; + // add revalidate metadata before rendering 404 page + // so that we can use this as source of truth for the + // cache-control header instead of what the 404 page returns + // for the revalidate value + addRequestMeta(req, 'notFoundRevalidate', (_result_cacheControl = result.cacheControl) == null ? void 0 : _result_cacheControl.revalidate); + res.statusCode = 404; + if (isNextDataRequest) { + if (deploymentId) { + res.setHeader(NEXT_NAV_DEPLOYMENT_ID_HEADER, deploymentId); + } + res.end('{"notFound":true}'); + return; + } + return await render404(); + } + if (result.value.kind === CachedRouteKind.REDIRECT) { + if (isNextDataRequest) { + if (deploymentId) { + res.setHeader(NEXT_NAV_DEPLOYMENT_ID_HEADER, deploymentId); + } + res.setHeader('content-type', JSON_CONTENT_TYPE_HEADER); + res.end(JSON.stringify(result.value.props)); + return; + } else { + const handleRedirect = (pageData)=>{ + const redirect = { + destination: pageData.pageProps.__N_REDIRECT, + statusCode: pageData.pageProps.__N_REDIRECT_STATUS, + basePath: pageData.pageProps.__N_REDIRECT_BASE_PATH + }; + const statusCode = getRedirectStatus(redirect); + const { basePath } = nextConfig; + if (basePath && redirect.basePath !== false && redirect.destination.startsWith('/')) { + redirect.destination = `${basePath}${redirect.destination}`; + } + if (redirect.destination.startsWith('/')) { + redirect.destination = normalizeRepeatedSlashes(redirect.destination); + } + res.statusCode = statusCode; + res.setHeader('Location', redirect.destination); + if (statusCode === RedirectStatusCode.PermanentRedirect) { + res.setHeader('Refresh', `0;url=${redirect.destination}`); + } + res.end(redirect.destination); + }; + await handleRedirect(result.value.props); + return null; + } + } + if (result.value.kind !== CachedRouteKind.PAGES) { + throw new Error(`Invariant: received non-pages cache entry in pages handler`); + } + // Documents and data responses must not be stored in development. + // Browsers reuse a stored response for a history navigation without + // revalidating it, so a back navigation would restore a page from + // before the latest edit. Static assets never reach this code. They + // keep a revalidatable `Cache-Control`, so the browser caches them + // between page loads. + if (routeModule.isDev) { + res.setHeader('Cache-Control', 'no-store'); + } + // Draft mode should never be cached + if (isDraftMode) { + res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate'); + } + // when invoking _error before pages/500 we don't actually + // send the _error response + if (getRequestMeta(req, 'customErrorRender') || isErrorPage && isMinimalMode && res.statusCode === 500) { + return null; + } + // Add deployment ID header for data requests + if (isNextDataRequest && !isErrorPage && !is500Page) { + if (deploymentId) { + res.setHeader(NEXT_NAV_DEPLOYMENT_ID_HEADER, deploymentId); + } + } + await sendRenderResult({ + req, + res, + // If we are rendering the error page it's not a data request + // anymore + result: isNextDataRequest && !isErrorPage && !is500Page ? new RenderResult(JSON.stringify(result.value.pageData), { + contentType: JSON_CONTENT_TYPE_HEADER, + metadata: result.value.html.metadata + }) : result.value.html, + generateEtags: nextConfig.generateEtags, + poweredByHeader: nextConfig.poweredByHeader, + cacheControl: routeModule.isDev ? undefined : cacheControl + }); + } catch (err) { + if (!(err instanceof NoFallbackError)) { + const silenceLog = false; + await routeModule.onRequestError(req, err, { + routerKind: 'Pages Router', + routePath: srcPage, + routeType: 'render', + revalidateReason: getRevalidateReason({ + isStaticGeneration: hasStaticProps, + isOnDemandRevalidate + }) + }, silenceLog, routerServerContext); + } + // rethrow so that we can handle serving error page + throw err; + } finally{ + // An IIFE to make early returns easier. + ; + (()=>{ + if (!span) return; + span.setAttributes({ + 'http.status_code': res.statusCode, + 'next.rsc': false + }); + const rootSpanAttributes = tracer.getRootSpanAttributes(); + // We were unable to get attributes, probably OTEL is not enabled + if (!rootSpanAttributes) { + return; + } + if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) { + console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`); + return; + } + const route = rootSpanAttributes.get('next.route') || srcPage; + const name = `${method} ${route}`; + span.setAttributes({ + 'next.route': route, + 'http.route': route, + 'next.span_name': name + }); + span.updateName(name); + // Propagate http.route to the parent span if one exists + // (e.g. a platform-created HTTP span in adapter + // deployments). + if (parentSpan && parentSpan !== span) { + parentSpan.setAttribute('http.route', route); + parentSpan.updateName(name); + } + })(); + } + }; + // TODO: activeSpan code path is for when wrapped by + // next-server can be removed when this is no longer used + if (isWrappedByNextServer && activeSpan) { + await handleResponse(activeSpan); + } else { + parentSpan = tracer.getActiveScopeSpan(); + await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, { + spanName: `${method} ${srcPage}`, + kind: SpanKind.SERVER, + attributes: { + 'http.method': method, + 'http.target': req.url + } + }, handleResponse), undefined, !isWrappedByNextServer); + } + }; +}; + +//# sourceMappingURL=pages-handler.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/pages-handler.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/pages-handler.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d84efb9360145a47c1d77eb943929ba79e628720 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/pages-handler.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/route-modules/pages/pages-handler.ts"],"sourcesContent":["import type { IncomingMessage, ServerResponse } from 'node:http'\nimport type { ParsedUrlQuery } from 'node:querystring'\nimport { RouteKind } from '../../route-kind'\nimport { BaseServerSpan } from '../../lib/trace/constants'\nimport { getTracer, SpanKind, type Span } from '../../lib/trace/tracer'\nimport { formatUrl } from '../../../shared/lib/router/utils/format-url'\nimport {\n addRequestMeta,\n getRequestMeta,\n setRequestMeta,\n type RequestMeta,\n} from '../../request-meta'\nimport { interopDefault } from '../../app-render/interop-default'\nimport { getRevalidateReason } from '../../instrumentation/utils'\nimport { normalizeDataPath } from '../../../shared/lib/page-path/normalize-data-path'\nimport {\n CachedRouteKind,\n type CachedPageValue,\n type CachedRedirectValue,\n type ResponseCacheEntry,\n type ResponseGenerator,\n} from '../../response-cache'\n\nimport {\n getCacheControlHeader,\n type CacheControl,\n} from '../../lib/cache-control'\nimport { normalizeRepeatedSlashes } from '../../../shared/lib/utils'\nimport { getRedirectStatus } from '../../../lib/redirect-status'\nimport {\n CACHE_ONE_YEAR_SECONDS,\n HTML_CONTENT_TYPE_HEADER,\n JSON_CONTENT_TYPE_HEADER,\n NEXT_NAV_DEPLOYMENT_ID_HEADER,\n} from '../../../lib/constants'\nimport path from 'path'\nimport { sendRenderResult } from '../../send-payload'\nimport RenderResult from '../../render-result'\nimport { toResponseCacheEntry } from '../../response-cache/utils'\nimport { NoFallbackError } from '../../../shared/lib/no-fallback-error.external'\nimport { RedirectStatusCode } from '../../../client/components/redirect-status-code'\nimport { isBot } from '../../../shared/lib/router/utils/is-bot'\nimport { addPathPrefix } from '../../../shared/lib/router/utils/add-path-prefix'\nimport { removeTrailingSlash } from '../../../shared/lib/router/utils/remove-trailing-slash'\nimport { isRouteCacheOwner } from '../../lib/route-cache-key'\nimport type { PagesRouteModule } from './module.compiled'\nimport type {\n GetServerSideProps,\n GetStaticPaths,\n GetStaticProps,\n} from '../../../types'\n\nexport const getHandler = ({\n srcPage: originalSrcPage,\n config,\n userland,\n routeModule,\n isFallbackError,\n getStaticPaths,\n getStaticProps,\n getServerSideProps,\n}: {\n srcPage: string\n config: Record | undefined\n userland: any\n isFallbackError?: boolean\n routeModule: PagesRouteModule\n getStaticProps?: GetStaticProps\n getStaticPaths?: GetStaticPaths\n getServerSideProps?: GetServerSideProps\n}) => {\n return async function handler(\n req: IncomingMessage,\n res: ServerResponse,\n ctx: {\n waitUntil?: (prom: Promise) => void\n requestMeta?: RequestMeta\n }\n ) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta)\n }\n if (routeModule.isDev) {\n addRequestMeta(\n req,\n 'devRequestTimingInternalsEnd',\n process.hrtime.bigint()\n )\n }\n let srcPage = originalSrcPage\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/'\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/'\n }\n const multiZoneDraftMode = process.env\n .__NEXT_MULTI_ZONE_DRAFT_MODE as any as boolean\n\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode,\n })\n\n if (!prepareResult) {\n res.statusCode = 400\n res.end('Bad Request')\n ctx.waitUntil?.(Promise.resolve())\n return\n }\n\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'))\n\n const render404 = async () => {\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext?.render404) {\n // When the Pages and App Routers coexist, a Pages Router 404 renders\n // the App Router not-found page. A direct route-module invocation\n // cannot provide the postponed state needed to resume that App Router\n // output, so an empty postponed state signals that the renderer must\n // perform a complete dynamic render instead.\n //\n // TODO: Re-enter routing with the App Router not-found output so its\n // prerender and postponed state can be selected and resumed.\n if (\n nextConfig.cacheComponents &&\n !routerServerContext.isWrappedByNextServer &&\n typeof getRequestMeta(req, 'postponed') !== 'string'\n ) {\n addRequestMeta(req, 'postponed', '')\n }\n await routerServerContext.render404(req, res, parsedUrl, false)\n } else {\n res.end('This page could not be found')\n }\n }\n\n const {\n buildId,\n query,\n params,\n parsedUrl,\n originalQuery,\n originalPathname,\n buildManifest,\n fallbackBuildManifest,\n nextFontManifest,\n serverFilesManifest,\n reactLoadableManifest,\n prerenderManifest,\n previewProps,\n isDraftMode,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n locale,\n locales,\n defaultLocale,\n routerServerContext,\n nextConfig,\n resolvedPathname,\n encodedResolvedPathname,\n deploymentId,\n clientAssetToken,\n } = prepareResult\n\n const isExperimentalCompile =\n serverFilesManifest?.config?.experimental?.isExperimentalCompile\n\n const hasServerProps = Boolean(getServerSideProps)\n const hasStaticProps = Boolean(getStaticProps)\n const hasStaticPaths = Boolean(getStaticPaths)\n const hasGetInitialProps = Boolean(\n (userland.default || userland).getInitialProps\n )\n let cacheKey: null | string = null\n let isIsrFallback = false\n let isNextDataRequest =\n prepareResult.isNextDataRequest && (hasStaticProps || hasServerProps)\n\n const is404Page = srcPage === '/404'\n const is500Page = srcPage === '/500'\n const isErrorPage = srcPage === '/_error'\n\n if (!routeModule.isDev && !isDraftMode && hasStaticProps) {\n cacheKey = `${locale ? `/${locale}` : ''}${\n (srcPage === '/' || resolvedPathname === '/') && locale\n ? ''\n : resolvedPathname\n }`\n\n if (is404Page || is500Page || isErrorPage) {\n cacheKey = `${locale ? `/${locale}` : ''}${srcPage}`\n }\n\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey\n }\n\n if (hasStaticPaths && !isDraftMode) {\n const decodedPathname = removeTrailingSlash(\n locale\n ? addPathPrefix(resolvedPathname, `/${locale}`)\n : resolvedPathname\n )\n const isPrerendered =\n (Boolean(prerenderManifest.routes[decodedPathname]) ||\n prerenderManifest.notFoundRoutes.includes(decodedPathname)) &&\n // A sibling's positive or negative prerender cannot admit parameters\n // that this route excluded. Development computes static paths on demand\n // instead of reading build-time prerender metadata.\n (routeModule.isDev ||\n isRouteCacheOwner(\n decodedPathname,\n routeModule.cacheOwner,\n prerenderManifest.routes[decodedPathname],\n nextConfig.i18n?.locales\n ))\n\n const prerenderInfo = prerenderManifest.dynamicRoutes[srcPage]\n\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404()\n }\n throw new NoFallbackError()\n }\n\n if (\n typeof prerenderInfo.fallback === 'string' &&\n !isPrerendered &&\n !isNextDataRequest\n ) {\n isIsrFallback = true\n }\n }\n }\n\n // When serving a bot request, we want to serve a blocking render and not\n // the prerendered page. This ensures that the correct content is served\n // to the bot in the head.\n if (\n (isIsrFallback && isBot(req.headers['user-agent'] || '')) ||\n isMinimalMode\n ) {\n isIsrFallback = false\n }\n\n const tracer = getTracer()\n const activeSpan = tracer.getActiveScopeSpan()\n const isWrappedByNextServer = Boolean(\n routerServerContext?.isWrappedByNextServer\n )\n\n const method = req.method || 'GET'\n\n const resolvedUrl = formatUrl({\n pathname: nextConfig.trailingSlash\n ? `${encodedResolvedPathname}${!encodedResolvedPathname.endsWith('/') && parsedUrl.pathname?.endsWith('/') ? '/' : ''}`\n : removeTrailingSlash(encodedResolvedPathname || '/'),\n // make sure to only add query values from original URL\n query: hasStaticProps ? {} : originalQuery,\n })\n\n let parentSpan: Span | undefined\n const handleResponse = async (span?: Span) => {\n const responseGenerator: ResponseGenerator = async ({\n previousCacheEntry,\n }) => {\n const doRender = async () => {\n try {\n return await routeModule\n .render(req, res, {\n query:\n hasStaticProps && !isExperimentalCompile\n ? ({\n ...params,\n } as ParsedUrlQuery)\n : {\n ...query,\n ...params,\n },\n params,\n page: srcPage,\n renderContext: {\n isDraftMode,\n isFallback: isIsrFallback,\n developmentNotFoundSourcePage: getRequestMeta(\n req,\n 'developmentNotFoundSourcePage'\n ),\n },\n sharedContext: {\n buildId,\n customServer:\n Boolean(routerServerContext?.isCustomServer) || undefined,\n deploymentId,\n clientAssetToken,\n },\n renderOpts: {\n params,\n routeModule,\n page: srcPage,\n pageConfig: config || {},\n Component: interopDefault(userland),\n ComponentMod: userland,\n getStaticProps,\n getStaticPaths,\n getServerSideProps,\n supportsDynamicResponse: !hasStaticProps,\n buildManifest: isFallbackError\n ? fallbackBuildManifest\n : buildManifest,\n nextFontManifest,\n reactLoadableManifest,\n\n assetPrefix: routeModule.getAssetPrefixForRender(\n routerServerContext,\n nextConfig.assetPrefix\n ),\n previewProps,\n images: nextConfig.images as any,\n nextConfigOutput: nextConfig.output,\n optimizeCss: Boolean(nextConfig.experimental.optimizeCss),\n nextScriptWorkers: Boolean(\n nextConfig.experimental.nextScriptWorkers\n ),\n domainLocales: nextConfig.i18n?.domains,\n crossOrigin: nextConfig.crossOrigin,\n\n multiZoneDraftMode,\n basePath: nextConfig.basePath,\n disableOptimizedLoading:\n nextConfig.experimental.disableOptimizedLoading,\n largePageDataBytes:\n nextConfig.experimental.largePageDataBytes,\n\n isExperimentalCompile,\n\n experimental: {\n clientTraceMetadata:\n nextConfig.experimental.clientTraceMetadata ||\n ([] as any),\n },\n\n locale,\n locales,\n defaultLocale,\n setIsrStatus: routerServerContext?.setIsrStatus,\n\n isNextDataRequest:\n isNextDataRequest && (hasServerProps || hasStaticProps),\n\n resolvedUrl,\n // For getServerSideProps and getInitialProps we need to ensure we use the original URL\n // and not the resolved URL to prevent a hydration mismatch on\n // asPath\n resolvedAsPath:\n hasServerProps || hasGetInitialProps\n ? formatUrl({\n // we use the original URL pathname less the _next/data prefix if\n // present\n pathname: isNextDataRequest\n ? normalizeDataPath(originalPathname)\n : originalPathname,\n query: originalQuery,\n })\n : resolvedUrl,\n\n isOnDemandRevalidate,\n\n ErrorDebug: getRequestMeta(req, 'PagesErrorDebug'),\n err: getRequestMeta(req, 'invokeError'),\n\n // needed for experimental.optimizeCss feature\n distDir: path.join(\n /* turbopackIgnore: true */\n process.cwd(),\n routeModule.relativeProjectDir,\n routeModule.distDir\n ),\n },\n })\n .then((renderResult): ResponseCacheEntry => {\n const { metadata } = renderResult\n\n let cacheControl: CacheControl | undefined =\n metadata.cacheControl\n\n // Apply the `expireTime` fallback as soon as we have the\n // render's `cacheControl`, so every downstream consumer (the\n // cache stored via `incrementalCache.set`, the response\n // Cache-Control header, the outgoing entry returned from this\n // responseGenerator) sees a finalized `cacheControl` with a\n // populated `expire`. This mirrors the build-time fallback in\n // `build/index.ts` so we don't apply an expire to routes that\n // opt out of revalidation entirely (`revalidate: false`) or\n // that are dynamic (`revalidate: 0`).\n if (\n cacheControl &&\n cacheControl.revalidate !== false &&\n cacheControl.revalidate > 0 &&\n cacheControl.expire === undefined\n ) {\n cacheControl.expire = nextConfig.expireTime\n }\n\n if ('isNotFound' in metadata && metadata.isNotFound) {\n return {\n value: null,\n cacheControl,\n } satisfies ResponseCacheEntry\n }\n\n // Handle `isRedirect`.\n if (metadata.isRedirect) {\n return {\n value: {\n kind: CachedRouteKind.REDIRECT,\n props: metadata.pageData ?? metadata.flightData,\n } satisfies CachedRedirectValue,\n cacheControl,\n } satisfies ResponseCacheEntry\n }\n\n return {\n value: {\n kind: CachedRouteKind.PAGES,\n html: renderResult,\n pageData: renderResult.metadata.pageData,\n headers: renderResult.metadata.headers,\n status: renderResult.metadata.statusCode,\n },\n cacheControl,\n }\n })\n } catch (err: unknown) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry?.isStale) {\n const silenceLog = false\n await routeModule.onRequestError(\n req,\n err,\n {\n routerKind: 'Pages Router',\n routePath: srcPage,\n routeType: 'render',\n revalidateReason: getRevalidateReason({\n isStaticGeneration: hasStaticProps,\n isOnDemandRevalidate,\n }),\n },\n silenceLog,\n routerServerContext\n )\n }\n throw err\n }\n }\n\n // if we've already generated this page we no longer\n // serve the fallback\n if (previousCacheEntry) {\n isIsrFallback = false\n }\n\n if (isIsrFallback) {\n const fallbackResponse = await routeModule.getResponseCache(req).get(\n routeModule.isDev\n ? null\n : locale\n ? `/${locale}${srcPage}`\n : srcPage,\n async ({\n previousCacheEntry: previousFallbackCacheEntry = null,\n }) => {\n if (!routeModule.isDev) {\n return toResponseCacheEntry(previousFallbackCacheEntry)\n }\n return doRender()\n },\n {\n routeKind: RouteKind.PAGES,\n isFallback: true,\n isRoutePPREnabled: false,\n isOnDemandRevalidate: false,\n incrementalCache: await routeModule.getIncrementalCache(\n req,\n nextConfig,\n previewProps,\n prerenderManifest,\n isMinimalMode\n ),\n waitUntil: ctx.waitUntil,\n }\n )\n if (fallbackResponse !== null && 'error' in fallbackResponse) {\n throw fallbackResponse.error\n }\n\n if (fallbackResponse) {\n // Remove the cache control from the response to prevent it from being\n // used in the surrounding cache.\n delete fallbackResponse.cacheControl\n fallbackResponse.isMiss = true\n return fallbackResponse\n }\n }\n\n if (\n !isMinimalMode &&\n isOnDemandRevalidate &&\n revalidateOnlyGenerated &&\n !previousCacheEntry\n ) {\n res.statusCode = 404\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED')\n res.end('This page could not be found')\n return null\n }\n\n if (\n isIsrFallback &&\n previousCacheEntry?.value?.kind === CachedRouteKind.PAGES\n ) {\n return {\n value: {\n kind: CachedRouteKind.PAGES,\n html: new RenderResult(previousCacheEntry.value.html, {\n contentType: HTML_CONTENT_TYPE_HEADER,\n metadata: {\n statusCode: previousCacheEntry.value.status,\n headers: previousCacheEntry.value.headers,\n },\n }),\n pageData: {},\n status: previousCacheEntry.value.status,\n headers: previousCacheEntry.value.headers,\n } satisfies CachedPageValue,\n cacheControl: { revalidate: 0, expire: undefined },\n } satisfies ResponseCacheEntry\n }\n return doRender()\n }\n\n try {\n const result = await routeModule.handleResponse({\n cacheKey,\n req,\n nextConfig,\n routeKind: RouteKind.PAGES,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n waitUntil: ctx.waitUntil,\n responseGenerator: responseGenerator,\n previewProps,\n prerenderManifest,\n isMinimalMode,\n })\n\n if (result !== null && 'error' in result) {\n throw result.error\n }\n\n // if we got a cache hit this wasn't an ISR fallback\n // but it wasn't generated during build so isn't in the\n // prerender-manifest\n if (isIsrFallback && !result?.isMiss) {\n isIsrFallback = false\n }\n\n // response is finished is no cache entry\n if (!result) {\n return\n }\n\n if (hasStaticProps && !isMinimalMode) {\n res.setHeader(\n 'x-nextjs-cache',\n isOnDemandRevalidate\n ? 'REVALIDATED'\n : result.isMiss\n ? 'MISS'\n : result.isStale\n ? 'STALE'\n : 'HIT'\n )\n }\n\n let cacheControl: CacheControl | undefined\n\n if (!hasStaticProps || isIsrFallback) {\n if (!res.getHeader('Cache-Control')) {\n cacheControl = { revalidate: 0, expire: undefined }\n }\n } else if (is404Page) {\n const notFoundRevalidate = getRequestMeta(req, 'notFoundRevalidate')\n\n cacheControl = {\n revalidate:\n typeof notFoundRevalidate === 'undefined'\n ? 0\n : notFoundRevalidate,\n expire: undefined,\n }\n } else if (is500Page) {\n cacheControl = { revalidate: 0, expire: undefined }\n } else if (result.cacheControl) {\n // If the cache entry has a cache control with a revalidate value that's\n // a number, use it.\n if (typeof result.cacheControl.revalidate === 'number') {\n if (result.cacheControl.revalidate < 1) {\n throw new Error(\n `Invalid revalidate configuration provided: ${result.cacheControl.revalidate} < 1`\n )\n }\n cacheControl = {\n revalidate: result.cacheControl.revalidate,\n expire: result.cacheControl.expire,\n }\n } else {\n // revalidate: false\n cacheControl = {\n revalidate: CACHE_ONE_YEAR_SECONDS,\n expire: undefined,\n }\n }\n }\n\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheControl && !res.getHeader('Cache-Control')) {\n res.setHeader('Cache-Control', getCacheControlHeader(cacheControl))\n }\n\n // notFound: true case\n if (!result.value) {\n // add revalidate metadata before rendering 404 page\n // so that we can use this as source of truth for the\n // cache-control header instead of what the 404 page returns\n // for the revalidate value\n addRequestMeta(\n req,\n 'notFoundRevalidate',\n result.cacheControl?.revalidate\n )\n\n res.statusCode = 404\n\n if (isNextDataRequest) {\n if (deploymentId) {\n res.setHeader(NEXT_NAV_DEPLOYMENT_ID_HEADER, deploymentId)\n }\n res.end('{\"notFound\":true}')\n return\n }\n return await render404()\n }\n\n if (result.value.kind === CachedRouteKind.REDIRECT) {\n if (isNextDataRequest) {\n if (deploymentId) {\n res.setHeader(NEXT_NAV_DEPLOYMENT_ID_HEADER, deploymentId)\n }\n res.setHeader('content-type', JSON_CONTENT_TYPE_HEADER)\n res.end(JSON.stringify(result.value.props))\n return\n } else {\n const handleRedirect = (pageData: any) => {\n const redirect = {\n destination: pageData.pageProps.__N_REDIRECT,\n statusCode: pageData.pageProps.__N_REDIRECT_STATUS,\n basePath: pageData.pageProps.__N_REDIRECT_BASE_PATH,\n }\n const statusCode = getRedirectStatus(redirect)\n const { basePath } = nextConfig\n\n if (\n basePath &&\n redirect.basePath !== false &&\n redirect.destination.startsWith('/')\n ) {\n redirect.destination = `${basePath}${redirect.destination}`\n }\n\n if (redirect.destination.startsWith('/')) {\n redirect.destination = normalizeRepeatedSlashes(\n redirect.destination\n )\n }\n\n res.statusCode = statusCode\n res.setHeader('Location', redirect.destination)\n if (statusCode === RedirectStatusCode.PermanentRedirect) {\n res.setHeader('Refresh', `0;url=${redirect.destination}`)\n }\n res.end(redirect.destination)\n }\n await handleRedirect(result.value.props)\n return null\n }\n }\n\n if (result.value.kind !== CachedRouteKind.PAGES) {\n throw new Error(\n `Invariant: received non-pages cache entry in pages handler`\n )\n }\n\n // Documents and data responses must not be stored in development.\n // Browsers reuse a stored response for a history navigation without\n // revalidating it, so a back navigation would restore a page from\n // before the latest edit. Static assets never reach this code. They\n // keep a revalidatable `Cache-Control`, so the browser caches them\n // between page loads.\n if (routeModule.isDev) {\n res.setHeader('Cache-Control', 'no-store')\n }\n\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader(\n 'Cache-Control',\n 'private, no-cache, no-store, max-age=0, must-revalidate'\n )\n }\n\n // when invoking _error before pages/500 we don't actually\n // send the _error response\n if (\n getRequestMeta(req, 'customErrorRender') ||\n (isErrorPage && isMinimalMode && res.statusCode === 500)\n ) {\n return null\n }\n\n // Add deployment ID header for data requests\n if (isNextDataRequest && !isErrorPage && !is500Page) {\n if (deploymentId) {\n res.setHeader(NEXT_NAV_DEPLOYMENT_ID_HEADER, deploymentId)\n }\n }\n\n await sendRenderResult({\n req,\n res,\n // If we are rendering the error page it's not a data request\n // anymore\n result:\n isNextDataRequest && !isErrorPage && !is500Page\n ? new RenderResult(JSON.stringify(result.value.pageData), {\n contentType: JSON_CONTENT_TYPE_HEADER,\n metadata: result.value.html.metadata,\n })\n : result.value.html,\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n cacheControl: routeModule.isDev ? undefined : cacheControl,\n })\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false\n await routeModule.onRequestError(\n req,\n err,\n {\n routerKind: 'Pages Router',\n routePath: srcPage,\n routeType: 'render',\n revalidateReason: getRevalidateReason({\n isStaticGeneration: hasStaticProps,\n isOnDemandRevalidate,\n }),\n },\n silenceLog,\n routerServerContext\n )\n }\n\n // rethrow so that we can handle serving error page\n throw err\n } finally {\n // An IIFE to make early returns easier.\n ;(() => {\n if (!span) return\n\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false,\n })\n\n const rootSpanAttributes = tracer.getRootSpanAttributes()\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return\n }\n\n if (\n rootSpanAttributes.get('next.span_type') !==\n BaseServerSpan.handleRequest\n ) {\n console.warn(\n `Unexpected root span type '${rootSpanAttributes.get(\n 'next.span_type'\n )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n )\n return\n }\n\n const route = rootSpanAttributes.get('next.route') || srcPage\n const name = `${method} ${route}`\n\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name,\n })\n span.updateName(name)\n\n // Propagate http.route to the parent span if one exists\n // (e.g. a platform-created HTTP span in adapter\n // deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route)\n parentSpan.updateName(name)\n }\n })()\n }\n }\n\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan)\n } else {\n parentSpan = tracer.getActiveScopeSpan()\n await tracer.withPropagatedContext(\n req.headers,\n () =>\n tracer.trace(\n BaseServerSpan.handleRequest,\n {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url,\n },\n },\n handleResponse\n ),\n undefined,\n !isWrappedByNextServer\n )\n }\n }\n}\n"],"names":["RouteKind","BaseServerSpan","getTracer","SpanKind","formatUrl","addRequestMeta","getRequestMeta","setRequestMeta","interopDefault","getRevalidateReason","normalizeDataPath","CachedRouteKind","getCacheControlHeader","normalizeRepeatedSlashes","getRedirectStatus","CACHE_ONE_YEAR_SECONDS","HTML_CONTENT_TYPE_HEADER","JSON_CONTENT_TYPE_HEADER","NEXT_NAV_DEPLOYMENT_ID_HEADER","path","sendRenderResult","RenderResult","toResponseCacheEntry","NoFallbackError","RedirectStatusCode","isBot","addPathPrefix","removeTrailingSlash","isRouteCacheOwner","getHandler","srcPage","originalSrcPage","config","userland","routeModule","isFallbackError","getStaticPaths","getStaticProps","getServerSideProps","handler","req","res","ctx","serverFilesManifest","parsedUrl","requestMeta","isDev","process","hrtime","bigint","env","TURBOPACK","replace","multiZoneDraftMode","__NEXT_MULTI_ZONE_DRAFT_MODE","prepareResult","prepare","statusCode","end","waitUntil","Promise","resolve","isMinimalMode","Boolean","render404","routerServerContext","nextConfig","cacheComponents","isWrappedByNextServer","buildId","query","params","originalQuery","originalPathname","buildManifest","fallbackBuildManifest","nextFontManifest","reactLoadableManifest","prerenderManifest","previewProps","isDraftMode","isOnDemandRevalidate","revalidateOnlyGenerated","locale","locales","defaultLocale","resolvedPathname","encodedResolvedPathname","deploymentId","clientAssetToken","isExperimentalCompile","experimental","hasServerProps","hasStaticProps","hasStaticPaths","hasGetInitialProps","default","getInitialProps","cacheKey","isIsrFallback","isNextDataRequest","is404Page","is500Page","isErrorPage","decodedPathname","isPrerendered","routes","notFoundRoutes","includes","cacheOwner","i18n","prerenderInfo","dynamicRoutes","fallback","adapterPath","headers","tracer","activeSpan","getActiveScopeSpan","method","resolvedUrl","pathname","trailingSlash","endsWith","parentSpan","handleResponse","span","responseGenerator","previousCacheEntry","doRender","render","page","renderContext","isFallback","developmentNotFoundSourcePage","sharedContext","customServer","isCustomServer","undefined","renderOpts","pageConfig","Component","ComponentMod","supportsDynamicResponse","assetPrefix","getAssetPrefixForRender","images","nextConfigOutput","output","optimizeCss","nextScriptWorkers","domainLocales","domains","crossOrigin","basePath","disableOptimizedLoading","largePageDataBytes","clientTraceMetadata","setIsrStatus","resolvedAsPath","ErrorDebug","err","distDir","join","cwd","relativeProjectDir","then","renderResult","metadata","cacheControl","revalidate","expire","expireTime","isNotFound","value","isRedirect","kind","REDIRECT","props","pageData","flightData","PAGES","html","status","isStale","silenceLog","onRequestError","routerKind","routePath","routeType","revalidateReason","isStaticGeneration","fallbackResponse","getResponseCache","get","previousFallbackCacheEntry","routeKind","isRoutePPREnabled","incrementalCache","getIncrementalCache","error","isMiss","setHeader","contentType","result","getHeader","notFoundRevalidate","Error","JSON","stringify","handleRedirect","redirect","destination","pageProps","__N_REDIRECT","__N_REDIRECT_STATUS","__N_REDIRECT_BASE_PATH","startsWith","PermanentRedirect","generateEtags","poweredByHeader","setAttributes","rootSpanAttributes","getRootSpanAttributes","handleRequest","console","warn","route","name","updateName","setAttribute","withPropagatedContext","trace","spanName","SERVER","attributes","url"],"mappings":"AAEA,SAASA,SAAS,QAAQ,mBAAkB;AAC5C,SAASC,cAAc,QAAQ,4BAA2B;AAC1D,SAASC,SAAS,EAAEC,QAAQ,QAAmB,yBAAwB;AACvE,SAASC,SAAS,QAAQ,8CAA6C;AACvE,SACEC,cAAc,EACdC,cAAc,EACdC,cAAc,QAET,qBAAoB;AAC3B,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,mBAAmB,QAAQ,8BAA6B;AACjE,SAASC,iBAAiB,QAAQ,oDAAmD;AACrF,SACEC,eAAe,QAKV,uBAAsB;AAE7B,SACEC,qBAAqB,QAEhB,0BAAyB;AAChC,SAASC,wBAAwB,QAAQ,4BAA2B;AACpE,SAASC,iBAAiB,QAAQ,+BAA8B;AAChE,SACEC,sBAAsB,EACtBC,wBAAwB,EACxBC,wBAAwB,EACxBC,6BAA6B,QACxB,yBAAwB;AAC/B,OAAOC,UAAU,OAAM;AACvB,SAASC,gBAAgB,QAAQ,qBAAoB;AACrD,OAAOC,kBAAkB,sBAAqB;AAC9C,SAASC,oBAAoB,QAAQ,6BAA4B;AACjE,SAASC,eAAe,QAAQ,iDAAgD;AAChF,SAASC,kBAAkB,QAAQ,kDAAiD;AACpF,SAASC,KAAK,QAAQ,0CAAyC;AAC/D,SAASC,aAAa,QAAQ,mDAAkD;AAChF,SAASC,mBAAmB,QAAQ,yDAAwD;AAC5F,SAASC,iBAAiB,QAAQ,4BAA2B;AAQ7D,OAAO,MAAMC,aAAa,CAAC,EACzBC,SAASC,eAAe,EACxBC,MAAM,EACNC,QAAQ,EACRC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,cAAc,EACdC,kBAAkB,EAUnB;IACC,OAAO,eAAeC,QACpBC,GAAoB,EAC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AoB;wBACvB;oBACF;oBAEA,IACEA,mBAAmB5B,GAAG,CAAC,sBACvBjM,eAAe+N,aAAa,EAC5B;wBACAC,QAAQC,IAAI,CACV,CAAC,2BAA2B,EAAEJ,mBAAmB5B,GAAG,CAClD,kBACA,qEAAqE,CAAC;wBAE1E;oBACF;oBAEA,MAAMiC,QAAQL,mBAAmB5B,GAAG,CAAC,iBAAiBpK;oBACtD,MAAMsM,OAAO,GAAG7G,OAAO,CAAC,EAAE4G,OAAO;oBAEjCrG,KAAK+F,aAAa,CAAC;wBACjB,cAAcM;wBACd,cAAcA;wBACd,kBAAkBC;oBACpB;oBACAtG,KAAKuG,UAAU,CAACD;oBAEhB,wDAAwD;oBACxD,gDAAgD;oBAChD,gBAAgB;oBAChB,IAAIxG,cAAcA,eAAeE,MAAM;wBACrCF,WAAW0G,YAAY,CAAC,cAAcH;wBACtCvG,WAAWyG,UAAU,CAACD;oBACxB;gBACF,CAAA;YACF;QACF;QAEA,oDAAoD;QACpD,yDAAyD;QACzD,IAAIhK,yBAAyBiD,YAAY;YACvC,MAAMQ,eAAeR;QACvB,OAAO;YACLO,aAAaR,OAAOE,kBAAkB;YACtC,MAAMF,OAAOmH,qBAAqB,CAChC/L,IAAI2E,OAAO,EACX,IACEC,OAAOoH,KAAK,CACVvO,eAAe+N,aAAa,EAC5B;oBACES,UAAU,GAAGlH,OAAO,CAAC,EAAEzF,SAAS;oBAChCkJ,MAAM7K,SAASuO,MAAM;oBACrBC,YAAY;wBACV,eAAepH;wBACf,eAAe/E,IAAIoM,GAAG;oBACxB;gBACF,GACA/G,iBAEJa,WACA,CAACtE;QAEL;IACF;AACF,EAAC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/app-router-context.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/app-router-context.js new file mode 100644 index 0000000000000000000000000000000000000000..bbda416f7179d7bbd48c416767fd44d305523a9d --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/app-router-context.js @@ -0,0 +1,3 @@ +module.exports = require('../../module.compiled').vendored['contexts'].AppRouterContext; + +//# sourceMappingURL=app-router-context.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/app-router-context.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/app-router-context.js.map new file mode 100644 index 0000000000000000000000000000000000000000..2fad6b21a0f9f8f943384c51e8e149f63f03d930 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/app-router-context.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../../src/server/route-modules/pages/vendored/contexts/app-router-context.ts"],"sourcesContent":["module.exports = (\n require('../../module.compiled') as typeof import('../../module.compiled')\n).vendored['contexts'].AppRouterContext\n"],"names":["module","exports","require","vendored","AppRouterContext"],"mappings":"AAAAA,OAAOC,OAAO,GAAG,AACfC,QAAQ,yBACRC,QAAQ,CAAC,WAAW,CAACC,gBAAgB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/entrypoints.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/entrypoints.js new file mode 100644 index 0000000000000000000000000000000000000000..c9ed3015df2fa5d1679fa3e88117474ad8ed5d8f --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/entrypoints.js @@ -0,0 +1,11 @@ +export * as RouterContext from '../../../../../shared/lib/router-context.shared-runtime'; +export * as LoadableContext from '../../../../../shared/lib/loadable-context.shared-runtime'; +export * as Loadable from '../../../../../shared/lib/loadable.shared-runtime'; +export * as ImageConfigContext from '../../../../../shared/lib/image-config-context.shared-runtime'; +export * as HtmlContext from '../../../../../shared/lib/html-context.shared-runtime'; +export * as HooksClientContext from '../../../../../shared/lib/hooks-client-context.shared-runtime'; +export * as HeadManagerContext from '../../../../../shared/lib/head-manager-context.shared-runtime'; +export * as AppRouterContext from '../../../../../shared/lib/app-router-context.shared-runtime'; +export * as ServerInsertedHtml from '../../../../../shared/lib/server-inserted-html.shared-runtime'; + +//# sourceMappingURL=entrypoints.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/entrypoints.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/entrypoints.js.map new file mode 100644 index 0000000000000000000000000000000000000000..fbfd96c6d88b544ff4dce64c8569c6f743555112 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/entrypoints.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../../src/server/route-modules/pages/vendored/contexts/entrypoints.ts"],"sourcesContent":["export * as RouterContext from '../../../../../shared/lib/router-context.shared-runtime'\nexport * as LoadableContext from '../../../../../shared/lib/loadable-context.shared-runtime'\nexport * as Loadable from '../../../../../shared/lib/loadable.shared-runtime'\nexport * as ImageConfigContext from '../../../../../shared/lib/image-config-context.shared-runtime'\nexport * as HtmlContext from '../../../../../shared/lib/html-context.shared-runtime'\nexport * as HooksClientContext from '../../../../../shared/lib/hooks-client-context.shared-runtime'\nexport * as HeadManagerContext from '../../../../../shared/lib/head-manager-context.shared-runtime'\nexport * as AppRouterContext from '../../../../../shared/lib/app-router-context.shared-runtime'\nexport * as ServerInsertedHtml from '../../../../../shared/lib/server-inserted-html.shared-runtime'\n"],"names":["RouterContext","LoadableContext","Loadable","ImageConfigContext","HtmlContext","HooksClientContext","HeadManagerContext","AppRouterContext","ServerInsertedHtml"],"mappings":"AAAA,OAAO,KAAKA,aAAa,MAAM,0DAAyD;AACxF,OAAO,KAAKC,eAAe,MAAM,4DAA2D;AAC5F,OAAO,KAAKC,QAAQ,MAAM,oDAAmD;AAC7E,OAAO,KAAKC,kBAAkB,MAAM,gEAA+D;AACnG,OAAO,KAAKC,WAAW,MAAM,wDAAuD;AACpF,OAAO,KAAKC,kBAAkB,MAAM,gEAA+D;AACnG,OAAO,KAAKC,kBAAkB,MAAM,gEAA+D;AACnG,OAAO,KAAKC,gBAAgB,MAAM,8DAA6D;AAC/F,OAAO,KAAKC,kBAAkB,MAAM,gEAA+D","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/head-manager-context.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/head-manager-context.js new file mode 100644 index 0000000000000000000000000000000000000000..de0979a6475fa661fb310e5b8548e909ecc08238 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/head-manager-context.js @@ -0,0 +1,3 @@ +module.exports = require('../../module.compiled').vendored['contexts'].HeadManagerContext; + +//# sourceMappingURL=head-manager-context.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/head-manager-context.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/head-manager-context.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e72a241a4fa4568513edf0405fe31d56cced87e2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/head-manager-context.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../../src/server/route-modules/pages/vendored/contexts/head-manager-context.ts"],"sourcesContent":["module.exports = (\n require('../../module.compiled') as typeof import('../../module.compiled')\n).vendored['contexts'].HeadManagerContext\n"],"names":["module","exports","require","vendored","HeadManagerContext"],"mappings":"AAAAA,OAAOC,OAAO,GAAG,AACfC,QAAQ,yBACRC,QAAQ,CAAC,WAAW,CAACC,kBAAkB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/hooks-client-context.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/hooks-client-context.js new file mode 100644 index 0000000000000000000000000000000000000000..1349196710dec50e14ab4356abc23b0a633bc3d0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/hooks-client-context.js @@ -0,0 +1,3 @@ +module.exports = require('../../module.compiled').vendored['contexts'].HooksClientContext; + +//# sourceMappingURL=hooks-client-context.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/hooks-client-context.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/hooks-client-context.js.map new file mode 100644 index 0000000000000000000000000000000000000000..38b0097fe63deb84182ca65ac23bf5423a077698 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/hooks-client-context.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../../src/server/route-modules/pages/vendored/contexts/hooks-client-context.ts"],"sourcesContent":["module.exports = (\n require('../../module.compiled') as typeof import('../../module.compiled')\n).vendored['contexts'].HooksClientContext\n"],"names":["module","exports","require","vendored","HooksClientContext"],"mappings":"AAAAA,OAAOC,OAAO,GAAG,AACfC,QAAQ,yBACRC,QAAQ,CAAC,WAAW,CAACC,kBAAkB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/html-context.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/html-context.js new file mode 100644 index 0000000000000000000000000000000000000000..9fe917ddaddb0bb826f9d5104a561757fa37e394 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/html-context.js @@ -0,0 +1,3 @@ +module.exports = require('../../module.compiled').vendored['contexts'].HtmlContext; + +//# sourceMappingURL=html-context.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/html-context.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/html-context.js.map new file mode 100644 index 0000000000000000000000000000000000000000..55264f17eb35f2a24ae6ff851b4363aa6ca28788 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/html-context.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../../src/server/route-modules/pages/vendored/contexts/html-context.ts"],"sourcesContent":["module.exports = (\n require('../../module.compiled') as typeof import('../../module.compiled')\n).vendored['contexts'].HtmlContext\n"],"names":["module","exports","require","vendored","HtmlContext"],"mappings":"AAAAA,OAAOC,OAAO,GAAG,AACfC,QAAQ,yBACRC,QAAQ,CAAC,WAAW,CAACC,WAAW","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/image-config-context.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/image-config-context.js new file mode 100644 index 0000000000000000000000000000000000000000..747f7d59efc4da7ce7cdc4e8c22ca25e0b033a92 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/image-config-context.js @@ -0,0 +1,3 @@ +module.exports = require('../../module.compiled').vendored['contexts'].ImageConfigContext; + +//# sourceMappingURL=image-config-context.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/image-config-context.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/image-config-context.js.map new file mode 100644 index 0000000000000000000000000000000000000000..94044d07cf385773b5a0fc346c0e66a13e86c262 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/image-config-context.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../../src/server/route-modules/pages/vendored/contexts/image-config-context.ts"],"sourcesContent":["module.exports = (\n require('../../module.compiled') as typeof import('../../module.compiled')\n).vendored['contexts'].ImageConfigContext\n"],"names":["module","exports","require","vendored","ImageConfigContext"],"mappings":"AAAAA,OAAOC,OAAO,GAAG,AACfC,QAAQ,yBACRC,QAAQ,CAAC,WAAW,CAACC,kBAAkB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/loadable-context.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/loadable-context.js new file mode 100644 index 0000000000000000000000000000000000000000..90bd4f5be34d732cb41858fd60db5f9fc98b924e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/loadable-context.js @@ -0,0 +1,3 @@ +module.exports = require('../../module.compiled').vendored['contexts'].LoadableContext; + +//# sourceMappingURL=loadable-context.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/loadable-context.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/loadable-context.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ad39f82d428b3b46a857764723e19769042601a5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/loadable-context.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../../src/server/route-modules/pages/vendored/contexts/loadable-context.ts"],"sourcesContent":["module.exports = (\n require('../../module.compiled') as typeof import('../../module.compiled')\n).vendored['contexts'].LoadableContext\n"],"names":["module","exports","require","vendored","LoadableContext"],"mappings":"AAAAA,OAAOC,OAAO,GAAG,AACfC,QAAQ,yBACRC,QAAQ,CAAC,WAAW,CAACC,eAAe","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/loadable.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/loadable.js new file mode 100644 index 0000000000000000000000000000000000000000..e3dbc2fcc17ff21f77bfdba57925554a04d79821 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/loadable.js @@ -0,0 +1,3 @@ +module.exports = require('../../module.compiled').vendored['contexts'].Loadable; + +//# sourceMappingURL=loadable.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/loadable.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/loadable.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6e51cf4c795359305c306cfa998dac05641ba36f --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/loadable.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../../src/server/route-modules/pages/vendored/contexts/loadable.ts"],"sourcesContent":["module.exports = (\n require('../../module.compiled') as typeof import('../../module.compiled')\n).vendored['contexts'].Loadable\n"],"names":["module","exports","require","vendored","Loadable"],"mappings":"AAAAA,OAAOC,OAAO,GAAG,AACfC,QAAQ,yBACRC,QAAQ,CAAC,WAAW,CAACC,QAAQ","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/router-context.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/router-context.js new file mode 100644 index 0000000000000000000000000000000000000000..30ccbfa8e2e1012a49d47d855dbaac7e9dd4c9ae --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/router-context.js @@ -0,0 +1,3 @@ +module.exports = require('../../module.compiled').vendored['contexts'].RouterContext; + +//# sourceMappingURL=router-context.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/router-context.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/router-context.js.map new file mode 100644 index 0000000000000000000000000000000000000000..5264ac17a1ddf9276dd1d71dc0a7a79a16f15fa5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/router-context.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../../src/server/route-modules/pages/vendored/contexts/router-context.ts"],"sourcesContent":["module.exports = (\n require('../../module.compiled') as typeof import('../../module.compiled')\n).vendored['contexts'].RouterContext\n"],"names":["module","exports","require","vendored","RouterContext"],"mappings":"AAAAA,OAAOC,OAAO,GAAG,AACfC,QAAQ,yBACRC,QAAQ,CAAC,WAAW,CAACC,aAAa","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/server-inserted-html.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/server-inserted-html.js new file mode 100644 index 0000000000000000000000000000000000000000..4c3f006a78601e34d02d835827e332e902f82877 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/server-inserted-html.js @@ -0,0 +1,3 @@ +module.exports = require('../../module.compiled').vendored['contexts'].ServerInsertedHtml; + +//# sourceMappingURL=server-inserted-html.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/server-inserted-html.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/server-inserted-html.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b8d7a56864096bfa1b46fda43f3296504d3d8907 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/pages/vendored/contexts/server-inserted-html.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../../src/server/route-modules/pages/vendored/contexts/server-inserted-html.ts"],"sourcesContent":["module.exports = (\n require('../../module.compiled') as typeof import('../../module.compiled')\n).vendored['contexts'].ServerInsertedHtml\n"],"names":["module","exports","require","vendored","ServerInsertedHtml"],"mappings":"AAAAA,OAAOC,OAAO,GAAG,AACfC,QAAQ,yBACRC,QAAQ,CAAC,WAAW,CAACC,kBAAkB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/route-module.js b/e-commerce/node_modules/next/dist/esm/server/route-modules/route-module.js new file mode 100644 index 0000000000000000000000000000000000000000..00779f4970f48310fa428bfd244454a2cfe19a76 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/route-module.js @@ -0,0 +1,688 @@ +import '../../build/adapter/setup-node-env.external'; +import { BUILD_ID_FILE, BUILD_MANIFEST, CLIENT_REFERENCE_MANIFEST, DYNAMIC_CSS_MANIFEST, NEXT_FONT_MANIFEST, PREFETCH_HINTS, PRERENDER_MANIFEST, PREVIEW_PROPS_MANIFEST, REACT_LOADABLE_MANIFEST, ROUTES_MANIFEST, SERVER_FILES_MANIFEST, SERVER_REFERENCE_MANIFEST, SUBRESOURCE_INTEGRITY_MANIFEST } from '../../shared/lib/constants'; +import { parseReqUrl } from '../../lib/url'; +import { normalizeLocalePath } from '../../shared/lib/i18n/normalize-locale-path'; +import { isDynamicRoute } from '../../shared/lib/router/utils'; +import { removePathPrefix } from '../../shared/lib/router/utils/remove-path-prefix'; +import { getServerUtils } from '../server-utils'; +import { detectDomainLocale } from '../../shared/lib/i18n/detect-domain-locale'; +import { getHostname } from '../../shared/lib/get-hostname'; +import { checkIsOnDemandRevalidate } from '../api-utils'; +import { normalizeDataPath } from '../../shared/lib/page-path/normalize-data-path'; +import { pathHasPrefix } from '../../shared/lib/router/utils/path-has-prefix'; +import { addRequestMeta, getRequestMeta } from '../request-meta'; +import { patchSetHeaderWithCookieSupport } from '../lib/patch-set-header'; +import { normalizePagePath } from '../../shared/lib/page-path/normalize-page-path'; +import { isStaticMetadataRoute } from '../../lib/metadata/is-metadata-route'; +import { IncrementalCache } from '../lib/incremental-cache'; +import { initializeCacheHandlers, registerCustomCacheHandlers, setCacheHandler } from '../use-cache/handlers'; +import { interopDefault } from '../app-render/interop-default'; +import { RouteKind } from '../route-kind'; +import { getResponseCacheOwner } from '../lib/route-cache-key'; +import ResponseCache from '../response-cache'; +import { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'; +import { RouterServerContextSymbol, routerServerGlobal } from '../lib/router-utils/router-server-context'; +import { decodePathParams } from '../lib/router-utils/decode-path-params'; +import { removeTrailingSlash } from '../../shared/lib/router/utils/remove-trailing-slash'; +import { isInterceptionRouteRewrite } from '../../lib/is-interception-route-rewrite'; +import { getTracer } from '../lib/trace/tracer'; +import { RouteModuleSpan } from '../lib/trace/constants'; +const dynamicImportEsmDefault = (id)=>import(/* webpackIgnore: true */ /* turbopackIgnore: true */ id).then((mod)=>mod.default || mod); +/** + * RouteModule is the base class for all route modules. This class should be + * extended by all route modules. + */ export class RouteModule { + get userland() { + return this._userland; + } + constructor({ userland, definition, distDir, relativeProjectDir }){ + this._userland = userland; + this.definition = definition; + this.cacheOwner = getResponseCacheOwner(definition); + this.isDev = !!process.env.__NEXT_DEV_SERVER; + this.distDir = distDir; + this.relativeProjectDir = relativeProjectDir; + } + getRouterServerContext(req) { + var _routerServerGlobal_RouterServerContextSymbol; + const hostname = getRequestMeta(req, 'hostname'); + const revalidate = getRequestMeta(req, 'revalidate'); + const render404 = getRequestMeta(req, 'render404'); + const relativeProjectDir = getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir; + const routerServerContext = (_routerServerGlobal_RouterServerContextSymbol = routerServerGlobal[RouterServerContextSymbol]) == null ? void 0 : _routerServerGlobal_RouterServerContextSymbol[relativeProjectDir]; + return { + ...routerServerContext, + ...hostname !== undefined ? { + hostname + } : {}, + ...revalidate !== undefined ? { + revalidate + } : {}, + ...render404 !== undefined ? { + render404 + } : {} + }; + } + getAssetPrefixForRender(routerServerContext, configuredAssetPrefix) { + // A running NextServer owns overrides from app.setAssetPrefix(). + if (routerServerContext && routerServerContext.getAssetPrefix) { + return routerServerContext.getAssetPrefix(); + } + // Direct route invocations use the configured prefix. + return configuredAssetPrefix; + } + normalizeUrl(_req, _parsedUrl) {} + async instrumentationOnRequestError(req, ...args) { + if (process.env.NEXT_RUNTIME === 'edge') { + const { getEdgeInstrumentationModule } = await import('../web/globals'); + const instrumentation = await getEdgeInstrumentationModule(); + if (instrumentation) { + await (instrumentation.onRequestError == null ? void 0 : instrumentation.onRequestError.call(instrumentation, ...args)); + } + } else { + const { join } = require('node:path'); + const absoluteProjectDir = join(/* turbopackIgnore: true */ process.cwd(), getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir); + const { instrumentationOnRequestError } = await import('../lib/router-utils/instrumentation-globals.external.js'); + return instrumentationOnRequestError(absoluteProjectDir, this.distDir, ...args); + } + } + loadManifests(srcPage, projectDir) { + let result; + if (process.env.NEXT_RUNTIME === 'edge') { + var _self___RSC_MANIFEST; + const { getEdgePreviewProps } = require('../web/get-edge-preview-props'); + const maybeJSONParse = (str)=>str ? JSON.parse(str) : undefined; + result = { + buildId: process.env.__NEXT_BUILD_ID || '', + buildManifest: self.__BUILD_MANIFEST, + fallbackBuildManifest: {}, + reactLoadableManifest: maybeJSONParse(self.__REACT_LOADABLE_MANIFEST), + nextFontManifest: maybeJSONParse(self.__NEXT_FONT_MANIFEST), + prerenderManifest: { + routes: {}, + dynamicRoutes: {}, + notFoundRoutes: [], + version: 4, + preview: getEdgePreviewProps() + }, + previewProps: getEdgePreviewProps(), + routesManifest: { + version: 4, + caseSensitive: Boolean(process.env.__NEXT_CASE_SENSITIVE_ROUTES), + basePath: process.env.__NEXT_BASE_PATH || '', + rewrites: process.env.__NEXT_REWRITES || { + beforeFiles: [], + afterFiles: [], + fallback: [] + }, + redirects: [], + headers: [], + onMatchHeaders: [], + i18n: process.env.__NEXT_I18N_CONFIG || undefined, + skipProxyUrlNormalize: Boolean(process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE) + }, + serverFilesManifest: self.__SERVER_FILES_MANIFEST, + clientReferenceManifest: (_self___RSC_MANIFEST = self.__RSC_MANIFEST) == null ? void 0 : _self___RSC_MANIFEST[srcPage], + serverActionsManifest: maybeJSONParse(self.__RSC_SERVER_MANIFEST), + subresourceIntegrityManifest: maybeJSONParse(self.__SUBRESOURCE_INTEGRITY_MANIFEST), + dynamicCssManifest: maybeJSONParse(self.__DYNAMIC_CSS_MANIFEST), + // Edge pages are always dynamic so prefetch inlining hints + // don't apply. The runtime handles missing hints gracefully. + prefetchHintsManifest: undefined, + interceptionRoutePatterns: (maybeJSONParse(self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST) ?? []).map((rewrite)=>new RegExp(rewrite.regex)) + }; + } else { + var _clientReferenceManifest___RSC_MANIFEST; + if (!projectDir) { + throw new Error('Invariant: projectDir is required for node runtime'); + } + const { loadManifestFromRelativePath, evalManifestFromRelativePath } = require('../load-manifest.external'); + const normalizedPagePath = normalizePagePath(srcPage); + const router = this.definition.kind === RouteKind.PAGES || this.definition.kind === RouteKind.PAGES_API ? 'pages' : 'app'; + const [routesManifest, prerenderManifest, previewProps, buildManifest, fallbackBuildManifest, reactLoadableManifest, nextFontManifest, clientReferenceManifest, serverActionsManifest, subresourceIntegrityManifest, serverFilesManifest, buildId, dynamicCssManifest, prefetchHintsManifest] = [ + loadManifestFromRelativePath({ + projectDir, + distDir: this.distDir, + manifest: ROUTES_MANIFEST, + shouldCache: !this.isDev + }), + loadManifestFromRelativePath({ + projectDir, + distDir: this.distDir, + manifest: PRERENDER_MANIFEST, + shouldCache: !this.isDev + }), + loadManifestFromRelativePath({ + projectDir, + distDir: this.distDir, + manifest: `server/${PREVIEW_PROPS_MANIFEST}`, + shouldCache: !this.isDev + }), + loadManifestFromRelativePath({ + projectDir, + distDir: this.distDir, + manifest: BUILD_MANIFEST, + shouldCache: !this.isDev + }), + srcPage === '/_error' ? loadManifestFromRelativePath({ + projectDir, + distDir: this.distDir, + manifest: `fallback-${BUILD_MANIFEST}`, + shouldCache: !this.isDev, + handleMissing: true + }) ?? {} : {}, + loadManifestFromRelativePath({ + projectDir, + distDir: this.distDir, + manifest: process.env.TURBOPACK ? `server/${router === 'app' ? 'app' : 'pages'}${normalizedPagePath}/${REACT_LOADABLE_MANIFEST}` : REACT_LOADABLE_MANIFEST, + handleMissing: true, + shouldCache: !this.isDev + }) ?? {}, + loadManifestFromRelativePath({ + projectDir, + distDir: this.distDir, + manifest: `server/${NEXT_FONT_MANIFEST}.json`, + shouldCache: !this.isDev + }), + router === 'app' && !isStaticMetadataRoute(srcPage) ? evalManifestFromRelativePath({ + distDir: this.distDir, + projectDir, + handleMissing: true, + manifest: `server/app${srcPage.replace(/%5F/g, '_') + '_' + CLIENT_REFERENCE_MANIFEST}.js`, + shouldCache: !this.isDev + }) : undefined, + router === 'app' ? loadManifestFromRelativePath({ + distDir: this.distDir, + projectDir, + manifest: `server/${SERVER_REFERENCE_MANIFEST}.json`, + handleMissing: true, + shouldCache: !this.isDev + }) : {}, + loadManifestFromRelativePath({ + projectDir, + distDir: this.distDir, + manifest: `server/${SUBRESOURCE_INTEGRITY_MANIFEST}.json`, + handleMissing: true, + shouldCache: !this.isDev + }), + this.isDev ? undefined : loadManifestFromRelativePath({ + projectDir, + distDir: this.distDir, + shouldCache: true, + manifest: `${SERVER_FILES_MANIFEST}.json` + }), + this.isDev ? 'development' : loadManifestFromRelativePath({ + projectDir, + distDir: this.distDir, + manifest: BUILD_ID_FILE, + skipParse: true, + shouldCache: true + }), + loadManifestFromRelativePath({ + projectDir, + distDir: this.distDir, + manifest: DYNAMIC_CSS_MANIFEST, + shouldCache: !this.isDev, + handleMissing: true + }), + router === 'app' ? loadManifestFromRelativePath({ + projectDir, + distDir: this.distDir, + manifest: `server/${PREFETCH_HINTS}`, + shouldCache: !this.isDev, + handleMissing: true + }) : undefined + ]; + result = { + buildId, + buildManifest, + fallbackBuildManifest, + routesManifest, + nextFontManifest, + prerenderManifest, + previewProps, + serverFilesManifest, + reactLoadableManifest, + clientReferenceManifest: clientReferenceManifest == null ? void 0 : (_clientReferenceManifest___RSC_MANIFEST = clientReferenceManifest.__RSC_MANIFEST) == null ? void 0 : _clientReferenceManifest___RSC_MANIFEST[srcPage.replace(/%5F/g, '_')], + serverActionsManifest, + subresourceIntegrityManifest, + dynamicCssManifest, + prefetchHintsManifest, + interceptionRoutePatterns: routesManifest.rewrites.beforeFiles.filter(isInterceptionRouteRewrite).map((rewrite)=>new RegExp(rewrite.regex)) + }; + } + return result; + } + async loadCustomCacheHandlers(req, nextConfig) { + if (process.env.NEXT_RUNTIME !== 'edge') { + const { cacheMaxMemorySize, cacheHandlers } = nextConfig; + if (!cacheHandlers) return; + initializeCacheHandlers(cacheMaxMemorySize); + await registerCustomCacheHandlers(async ()=>{ + for (const [kind, handler] of Object.entries(cacheHandlers)){ + if (!handler) continue; + const { formatDynamicImportPath } = require('../../lib/format-dynamic-import-path'); + const { join } = require('node:path'); + const absoluteProjectDir = join(/* turbopackIgnore: true */ process.cwd(), getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir); + setCacheHandler(kind, interopDefault(await dynamicImportEsmDefault(formatDynamicImportPath(`${absoluteProjectDir}/${this.distDir}`, handler)))); + } + }); + } + } + async getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode) { + if (process.env.NEXT_RUNTIME === 'edge') { + return globalThis.__incrementalCache; + } else { + var _nextConfig_i18n; + let CacheHandler; + const { cacheHandler } = nextConfig; + if (cacheHandler) { + const { formatDynamicImportPath } = require('../../lib/format-dynamic-import-path'); + CacheHandler = interopDefault(await dynamicImportEsmDefault(formatDynamicImportPath(this.distDir, cacheHandler))); + } + const { join } = require('node:path'); + const projectDir = join(/* turbopackIgnore: true */ process.cwd(), getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir); + await this.loadCustomCacheHandlers(req, nextConfig); + // incremental-cache is request specific + // although can have shared caches in module scope + // per-cache handler + const incrementalCache = new IncrementalCache({ + fs: require('../lib/node-fs-methods').nodeFs, + dev: this.isDev, + requestHeaders: req.headers, + allowedRevalidateHeaderKeys: nextConfig.experimental.allowedRevalidateHeaderKeys, + minimalMode: isMinimalMode, + serverDistDir: `${projectDir}/${this.distDir}/server`, + fetchCacheKeyPrefix: nextConfig.experimental.fetchCacheKeyPrefix, + maxMemoryCacheSize: nextConfig.cacheMaxMemorySize, + flushToDisk: !isMinimalMode && nextConfig.experimental.isrFlushToDisk, + previewProps, + prerenderManifest, + CurCacheHandler: CacheHandler, + locales: (_nextConfig_i18n = nextConfig.i18n) == null ? void 0 : _nextConfig_i18n.locales + }); + globalThis.__incrementalCache = incrementalCache; + return incrementalCache; + } + } + async onRequestError(req, err, errorContext, silenceLog, routerServerContext) { + if (!silenceLog) { + if (routerServerContext == null ? void 0 : routerServerContext.logErrorWithOriginalStack) { + routerServerContext.logErrorWithOriginalStack(err, 'app-dir'); + } else { + console.error(err); + } + } + await this.instrumentationOnRequestError(req, err, { + path: req.url || '/', + headers: req.headers, + method: req.method || 'GET' + }, errorContext); + } + /** A more lightweight version of `prepare()` for only retrieving the config on edge */ getNextConfigEdge(req) { + var _nextConfig_experimental; + if (process.env.NEXT_RUNTIME !== 'edge') { + throw new Error('Invariant: getNextConfigEdge must only be called in edge runtime'); + } + let serverFilesManifest = self.__SERVER_FILES_MANIFEST; + const routerServerContext = this.getRouterServerContext(req); + const nextConfig = (routerServerContext == null ? void 0 : routerServerContext.nextConfig) || (serverFilesManifest == null ? void 0 : serverFilesManifest.config); + if (!nextConfig) { + throw new Error("Invariant: nextConfig couldn't be loaded"); + } + let deploymentId; + if ((_nextConfig_experimental = nextConfig.experimental) == null ? void 0 : _nextConfig_experimental.runtimeServerDeploymentId) { + if (!process.env.NEXT_DEPLOYMENT_ID) { + throw new Error('process.env.NEXT_DEPLOYMENT_ID is missing but runtimeServerDeploymentId is enabled'); + } + deploymentId = process.env.NEXT_DEPLOYMENT_ID; + } else { + deploymentId = nextConfig.deploymentId || ''; + } + return { + nextConfig, + deploymentId + }; + } + prepare(req, res, options) { + return getTracer().trace(RouteModuleSpan.prepare, { + spanName: 'prepare route module' + }, ()=>this.prepareImpl(req, res, options)); + } + async prepareImpl(req, res, { srcPage, multiZoneDraftMode }) { + var _req_headers_xforwardedproto, _nextConfig_experimental; + let absoluteProjectDir; + // edge runtime handles loading instrumentation at the edge adapter level + if (process.env.NEXT_RUNTIME !== 'edge') { + if (res) { + patchSetHeaderWithCookieSupport(req, res); + } + const { join, relative } = require('node:path'); + absoluteProjectDir = join(/* turbopackIgnore: true */ process.cwd(), getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir); + const absoluteDistDir = getRequestMeta(req, 'distDir'); + if (absoluteDistDir) { + this.distDir = relative(absoluteProjectDir, absoluteDistDir); + } + const { ensureInstrumentationRegistered } = await import('../lib/router-utils/instrumentation-globals.external.js'); + // ensure instrumentation is registered and pass + // onRequestError below. Awaited so any caller of `RouteModule.prepare` + // that bypasses `BaseServer.handleRequest` (where this is also awaited + // via `prepareImpl`) still observes the instrumentation hook completing + // before the userland route handler runs. + await ensureInstrumentationRegistered(absoluteProjectDir, this.distDir); + } + const manifests = getTracer().trace(RouteModuleSpan.loadManifests, { + spanName: 'load route manifests' + }, ()=>this.loadManifests(srcPage, absoluteProjectDir)); + const { routesManifest, previewProps, serverFilesManifest } = manifests; + const { basePath, i18n, rewrites } = routesManifest; + const routerServerContext = this.getRouterServerContext(req); + const nextConfig = (routerServerContext == null ? void 0 : routerServerContext.nextConfig) || (serverFilesManifest == null ? void 0 : serverFilesManifest.config); + // Injected in base-server.ts + const protocol = ((_req_headers_xforwardedproto = req.headers['x-forwarded-proto']) == null ? void 0 : _req_headers_xforwardedproto.includes('https')) ? 'https' : 'http'; + // When there are hostname and port we build an absolute URL + if (!getRequestMeta(req, 'initURL')) { + const initUrl = (serverFilesManifest == null ? void 0 : serverFilesManifest.config.experimental.trustHostHeader) ? `${protocol}://${req.headers.host || 'localhost'}${req.url}` : `${protocol}://${(routerServerContext == null ? void 0 : routerServerContext.hostname) || 'localhost'}${req.url}`; + addRequestMeta(req, 'initURL', initUrl); + addRequestMeta(req, 'initProtocol', protocol); + } + if (basePath) { + req.url = removePathPrefix(req.url || '/', basePath); + } + const parsedUrl = parseReqUrl(req.url || '/'); + addRequestMeta(req, 'initQuery', { + ...parsedUrl == null ? void 0 : parsedUrl.query + }); + // if we couldn't parse the URL we can't continue + if (!parsedUrl) { + return; + } + let isNextDataRequest = false; + if (pathHasPrefix(parsedUrl.pathname || '/', '/_next/data')) { + isNextDataRequest = true; + parsedUrl.pathname = normalizeDataPath(parsedUrl.pathname || '/'); + } + this.normalizeUrl(req, parsedUrl); + let originalPathname = parsedUrl.pathname || '/'; + const originalQuery = { + ...parsedUrl.query + }; + const pageIsDynamic = isDynamicRoute(srcPage); + let localeResult; + let detectedLocale; + if (i18n) { + localeResult = normalizeLocalePath(parsedUrl.pathname || '/', i18n.locales); + if (localeResult.detectedLocale) { + req.url = `${localeResult.pathname}${parsedUrl.search}`; + originalPathname = localeResult.pathname; + if (!detectedLocale) { + detectedLocale = localeResult.detectedLocale; + } + } + } + // Normalize the page path for route matching. The srcPage contains the + // internal page path (e.g., /app/[slug]/page), but route matchers expect + // the pathname format (e.g., /app/[slug]). + const normalizedSrcPage = normalizeAppPath(srcPage); + const serverUtils = getServerUtils({ + page: normalizedSrcPage, + i18n, + basePath, + rewrites, + pageIsDynamic, + trailingSlash: process.env.__NEXT_TRAILING_SLASH, + caseSensitive: Boolean(routesManifest.caseSensitive) + }); + const domainLocale = detectDomainLocale(i18n == null ? void 0 : i18n.domains, getHostname(parsedUrl, req.headers), detectedLocale); + if (Boolean(domainLocale)) { + addRequestMeta(req, 'isLocaleDomain', Boolean(domainLocale)); + } + const defaultLocale = getRequestMeta(req, 'defaultLocale') || (domainLocale == null ? void 0 : domainLocale.defaultLocale) || (i18n == null ? void 0 : i18n.defaultLocale); + // Ensure parsedUrl.pathname includes locale before processing + // rewrites or they won't match correctly. + if (defaultLocale && !detectedLocale) { + parsedUrl.pathname = `/${defaultLocale}${parsedUrl.pathname === '/' ? '' : parsedUrl.pathname}`; + } + const locale = getRequestMeta(req, 'locale') || detectedLocale || defaultLocale; + // we apply rewrites against cloned URL so that we don't + // modify the original with the rewrite destination + const { rewriteParams, rewrittenParsedUrl } = serverUtils.handleRewrites(req, parsedUrl); + const rewriteParamKeys = Object.keys(rewriteParams); + Object.assign(parsedUrl.query, rewrittenParsedUrl.query); + // after processing rewrites we want to remove locale + // from parsedUrl pathname + if (i18n) { + parsedUrl.pathname = normalizeLocalePath(parsedUrl.pathname || '/', i18n.locales).pathname; + rewrittenParsedUrl.pathname = normalizeLocalePath(rewrittenParsedUrl.pathname || '/', i18n.locales).pathname; + } + let params = getRequestMeta(req, 'params'); + // attempt parsing from pathname + if (!params && serverUtils.dynamicRouteMatcher) { + const paramsMatch = serverUtils.dynamicRouteMatcher(normalizeDataPath((rewrittenParsedUrl == null ? void 0 : rewrittenParsedUrl.pathname) || parsedUrl.pathname || '/')); + const paramsResult = serverUtils.normalizeDynamicRouteParams(paramsMatch || {}, true); + if (paramsResult.hasValidParams) { + params = paramsResult.params; + } + } + // Local "next start" expects the routing parsed query values + // to not be present in the URL although when deployed proxies + // will add query values from resolving the routes to pass to function. + // TODO: do we want to change expectations for "next start" + // to include these query values in the URL which affects asPath + // but would match deployed behavior, e.g. a rewrite from middleware + // that adds a query param would be in asPath as query but locally + // it won't be in the asPath but still available in the query object + const query = getRequestMeta(req, 'query') || { + ...parsedUrl.query + }; + const routeParamKeys = new Set(); + const combinedParamKeys = []; + // We don't include rewriteParamKeys in the combinedParamKeys + // for app router since the searchParams is populated from the + // URL so we don't want to strip the rewrite params from the URL + // so that searchParams can include them. + if (this.definition.kind === RouteKind.PAGES || this.definition.kind === RouteKind.PAGES_API) { + for (const key of [ + ...rewriteParamKeys, + ...Object.keys(serverUtils.defaultRouteMatches || {}) + ]){ + // We only want to filter rewrite param keys from the URL + // if they are matches from the URL e.g. the key/value matches + // before and after applying the rewrites /:path for /hello and + // { path: 'hello' } but not for { path: 'another' } and /hello + // TODO: we should prefix rewrite param keys the same as we do + // for dynamic routes so we can identify them properly + const originalValue = Array.isArray(originalQuery[key]) ? originalQuery[key].join('') : originalQuery[key]; + const queryValue = Array.isArray(query[key]) ? query[key].join('') : query[key]; + if (!(key in originalQuery) || originalValue === queryValue) { + combinedParamKeys.push(key); + } + } + } + serverUtils.normalizeCdnUrl(req, combinedParamKeys); + // When Next is not hosted in a single process, upstream proxies will add query values for route params that were used to match the route. + // Outside of that environment, there is no reason to do any normalization to honor those query values. + if (!(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer)) { + serverUtils.normalizeQueryParams(query, routeParamKeys); + } else { + serverUtils.filterInternalQuery(query, []); + } + serverUtils.filterInternalQuery(originalQuery, combinedParamKeys); + if (pageIsDynamic) { + const queryResult = serverUtils.normalizeDynamicRouteParams(query, true); + const paramsResult = serverUtils.normalizeDynamicRouteParams(params || {}, true); + let paramsToInterpolate; + if (// if both query and params are valid but one + // provided more information and the query params + // were nxtP prefixed rely on that one + query && params && paramsResult.hasValidParams && queryResult.hasValidParams && routeParamKeys.size > 0 && Object.keys(paramsResult.params).length <= Object.keys(queryResult.params).length) { + paramsToInterpolate = queryResult.params; + params = Object.assign(queryResult.params); + } else { + paramsToInterpolate = paramsResult.hasValidParams && params ? params : queryResult.hasValidParams ? query : {}; + } + req.url = serverUtils.interpolateDynamicPath(req.url || '/', paramsToInterpolate); + parsedUrl.pathname = serverUtils.interpolateDynamicPath(parsedUrl.pathname || '/', paramsToInterpolate); + originalPathname = serverUtils.interpolateDynamicPath(originalPathname, paramsToInterpolate); + // try pulling from query if valid + if (!params) { + if (queryResult.hasValidParams) { + params = Object.assign({}, queryResult.params); + // If we pulled from query remove it so it's + // only in params + for(const key in serverUtils.defaultRouteMatches){ + delete query[key]; + } + } else { + // use final params from URL matching + const paramsMatch = serverUtils.dynamicRouteMatcher == null ? void 0 : serverUtils.dynamicRouteMatcher.call(serverUtils, normalizeDataPath((localeResult == null ? void 0 : localeResult.pathname) || parsedUrl.pathname || '/')); + // we don't normalize these as they are allowed to be + // the literal slug matches here e.g. /blog/[slug] + // actually being requested + if (paramsMatch) { + params = Object.assign({}, paramsMatch); + } + } + } + // When partial nxtP* params are provided (e.g. background + // revalidation for intermediate PPR shells), both + // normalizeDynamicRouteParams calls above fail because not all + // route params are present. Merge the normalized query params + // (from nxtP*) into the current params to override placeholders + // with concrete values. + if (params && routeParamKeys.size > 0 && !paramsResult.hasValidParams && !queryResult.hasValidParams) { + for (const key of routeParamKeys){ + if (query[key] !== undefined) { + params[key] = query[key]; + } + } + addRequestMeta(req, 'resolvedRouteParamKeys', routeParamKeys); + } + } + // Remove any normalized params from the query if they + // weren't present as non-prefixed query key e.g. + // ?search=1&nxtPsearch=hello we don't delete search + for (const key of routeParamKeys){ + if (!(key in originalQuery)) { + delete query[key]; + // handle the case where there's collision and we + // normalized nxtPid=123 -> id=123 but user also + // sends id=456 as separate key + } else if (originalQuery[key] && query[key] && originalQuery[key] !== query[key]) { + query[key] = originalQuery[key]; + } + } + const { isOnDemandRevalidate, revalidateOnlyGenerated } = checkIsOnDemandRevalidate(req.headers, previewProps); + let isDraftMode = false; + let previewData; + // preview data relies on non-edge utils + if (process.env.NEXT_RUNTIME !== 'edge' && res) { + const { tryGetPreviewData } = require('../api-utils/node/try-get-preview-data'); + previewData = tryGetPreviewData(req, res, previewProps, Boolean(multiZoneDraftMode)); + isDraftMode = previewData !== false; + } + if (!nextConfig) { + throw new Error("Invariant: nextConfig couldn't be loaded"); + } + if (process.env.NEXT_RUNTIME !== 'edge') { + const { installProcessErrorHandlers } = require('../node-environment-extensions/process-error-handlers'); + installProcessErrorHandlers(Boolean(nextConfig.experimental.removeUncaughtErrorAndRejectionListeners)); + } + let resolvedPathname = normalizedSrcPage; + if (isDynamicRoute(resolvedPathname) && params) { + resolvedPathname = serverUtils.interpolateDynamicPath(resolvedPathname, params); + } + if (resolvedPathname === '/index') { + resolvedPathname = '/'; + } + if (res && Boolean(req.headers['x-nextjs-data']) && (!res.statusCode || res.statusCode === 200)) { + res.setHeader('x-nextjs-matched-path', removeTrailingSlash(`${locale ? `/${locale}` : ''}${normalizedSrcPage}`)); + } + const encodedResolvedPathname = resolvedPathname; + // we decode for cache key/manifest usage encoded is + // for URL building + try { + resolvedPathname = decodePathParams(resolvedPathname); + } catch (_) {} + resolvedPathname = removeTrailingSlash(resolvedPathname); + let deploymentId; + if ((_nextConfig_experimental = nextConfig.experimental) == null ? void 0 : _nextConfig_experimental.runtimeServerDeploymentId) { + if (!process.env.NEXT_DEPLOYMENT_ID) { + throw new Error('process.env.NEXT_DEPLOYMENT_ID is missing but runtimeServerDeploymentId is enabled'); + } + deploymentId = process.env.NEXT_DEPLOYMENT_ID; + } else { + deploymentId = nextConfig.deploymentId || ''; + } + return { + query, + originalQuery, + originalPathname, + params, + parsedUrl, + locale, + isNextDataRequest, + locales: i18n == null ? void 0 : i18n.locales, + defaultLocale, + isDraftMode, + previewData, + pageIsDynamic, + resolvedPathname, + encodedResolvedPathname, + isOnDemandRevalidate, + revalidateOnlyGenerated, + ...manifests, + // loadManifest returns a readonly object, but we don't want to propagate that throughout the + // whole codebase (for now) + nextConfig: nextConfig, + routerServerContext, + deploymentId, + clientAssetToken: nextConfig.supportsImmutableAssets ? '' : deploymentId + }; + } + getResponseCache(req) { + if (!this.responseCache) { + const minimalMode = getRequestMeta(req, 'minimalMode') ?? false; + this.responseCache = new ResponseCache({ + minimalMode, + route: this.cacheOwner + }); + } + return this.responseCache; + } + async handleResponse({ req, nextConfig, cacheKey, routeKind, isFallback, previewProps, prerenderManifest, isRoutePPREnabled, isOnDemandRevalidate, revalidateOnlyGenerated, responseGenerator, waitUntil, isMinimalMode }) { + const responseCache = this.getResponseCache(req); + const cacheEntry = await responseCache.get(cacheKey, responseGenerator, { + routeKind, + isFallback, + isRoutePPREnabled, + isOnDemandRevalidate, + // A Next.js Segment Cache prefetch uses the `Next-Router-Prefetch` + // header (surfaced as the `isPrefetchRSCRequest` request meta), not the + // standard browser `purpose: prefetch` header. Recognize both so the + // response cache treats segment prefetches as prefetches — most + // importantly, so a prefetch that misses serves a fallback shell rather + // than joining an in-flight background (concrete) revalidation. + isPrefetch: req.headers.purpose === 'prefetch' || getRequestMeta(req, 'isPrefetchRSCRequest') === true, + // Use x-invocation-id header to scope the in-memory cache to a single + // revalidation request in minimal mode. + invocationID: req.headers['x-invocation-id'], + incrementalCache: await this.getIncrementalCache(req, nextConfig, previewProps, prerenderManifest, isMinimalMode), + waitUntil + }); + if (!cacheEntry) { + if (cacheKey && // revalidate only generated can bail even if cacheKey is provided + !(isOnDemandRevalidate && revalidateOnlyGenerated)) { + // A cache entry might not be generated if a response is written + // in `getInitialProps` or `getServerSideProps`, but those shouldn't + // have a cache key. If we do have a cache key but we don't end up + // with a cache entry, then either Next.js or the application has a + // bug that needs fixing. + throw new Error('invariant: cache entry required but not generated'); + } + } + return cacheEntry; + } +} + +//# sourceMappingURL=route-module.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/route-modules/route-module.js.map b/e-commerce/node_modules/next/dist/esm/server/route-modules/route-module.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ab48ad68ac6630a9c837395d4d96e16be5f340a0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/route-modules/route-module.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/route-modules/route-module.ts"],"sourcesContent":["import '../../build/adapter/setup-node-env.external'\nimport type { IncomingMessage, ServerResponse } from 'node:http'\nimport type {\n InstrumentationOnRequestError,\n RequestErrorContext,\n} from '../instrumentation/types'\nimport type { ParsedUrlQuery } from 'node:querystring'\nimport type { UrlWithParsedQuery } from 'node:url'\nimport type {\n PrerenderManifest,\n PreviewPropsManifest,\n RequiredServerFilesManifest,\n} from '../../build'\nimport type { DevRoutesManifest } from '../lib/router-utils/setup-dev-bundler'\nimport type { RouteDefinition } from '../route-definitions/route-definition'\nimport type { DeepReadonly } from '../../shared/lib/deep-readonly'\nimport {\n BUILD_ID_FILE,\n BUILD_MANIFEST,\n CLIENT_REFERENCE_MANIFEST,\n DYNAMIC_CSS_MANIFEST,\n NEXT_FONT_MANIFEST,\n PREFETCH_HINTS,\n PRERENDER_MANIFEST,\n PREVIEW_PROPS_MANIFEST,\n REACT_LOADABLE_MANIFEST,\n ROUTES_MANIFEST,\n SERVER_FILES_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n SUBRESOURCE_INTEGRITY_MANIFEST,\n} from '../../shared/lib/constants'\nimport { parseReqUrl } from '../../lib/url'\nimport {\n normalizeLocalePath,\n type PathLocale,\n} from '../../shared/lib/i18n/normalize-locale-path'\nimport { isDynamicRoute } from '../../shared/lib/router/utils'\nimport { removePathPrefix } from '../../shared/lib/router/utils/remove-path-prefix'\nimport { getServerUtils } from '../server-utils'\nimport { detectDomainLocale } from '../../shared/lib/i18n/detect-domain-locale'\nimport { getHostname } from '../../shared/lib/get-hostname'\nimport { checkIsOnDemandRevalidate, type __ApiPreviewProps } from '../api-utils'\nimport type { PreviewData } from '../../types'\nimport type { BuildManifest } from '../get-page-files'\nimport type { ReactLoadableManifest } from '../load-components'\nimport type { NextFontManifest } from '../../build/webpack/plugins/next-font-manifest-plugin'\nimport { normalizeDataPath } from '../../shared/lib/page-path/normalize-data-path'\nimport { pathHasPrefix } from '../../shared/lib/router/utils/path-has-prefix'\nimport {\n addRequestMeta,\n getRequestMeta,\n type NextIncomingMessage,\n} from '../request-meta'\nimport { patchSetHeaderWithCookieSupport } from '../lib/patch-set-header'\nimport { normalizePagePath } from '../../shared/lib/page-path/normalize-page-path'\nimport { isStaticMetadataRoute } from '../../lib/metadata/is-metadata-route'\nimport { IncrementalCache } from '../lib/incremental-cache'\nimport {\n initializeCacheHandlers,\n registerCustomCacheHandlers,\n setCacheHandler,\n} from '../use-cache/handlers'\nimport { interopDefault } from '../app-render/interop-default'\nimport { RouteKind } from '../route-kind'\nimport {\n getResponseCacheOwner,\n type ResponseCacheOwner,\n} from '../lib/route-cache-key'\nimport type { BaseNextRequest } from '../base-http'\nimport type { I18NConfig, NextConfigRuntime } from '../config-shared'\nimport ResponseCache, { type ResponseGenerator } from '../response-cache'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport {\n RouterServerContextSymbol,\n routerServerGlobal,\n type RouterServerContext,\n} from '../lib/router-utils/router-server-context'\nimport { decodePathParams } from '../lib/router-utils/decode-path-params'\nimport { removeTrailingSlash } from '../../shared/lib/router/utils/remove-trailing-slash'\nimport { isInterceptionRouteRewrite } from '../../lib/is-interception-route-rewrite'\nimport { getTracer } from '../lib/trace/tracer'\nimport { RouteModuleSpan } from '../lib/trace/constants'\n\n/**\n * RouteModuleOptions is the options that are passed to the route module, other\n * route modules should extend this class to add specific options for their\n * route.\n */\nexport interface RouteModuleOptions<\n D extends RouteDefinition = RouteDefinition,\n U = unknown,\n> {\n readonly definition: Readonly\n readonly userland: Readonly\n readonly distDir: string\n readonly relativeProjectDir: string\n}\n\n/**\n * RouteHandlerContext is the base context for a route handler.\n */\nexport interface RouteModuleHandleContext {\n /**\n * Any matched parameters for the request. This is only defined for dynamic\n * routes.\n */\n params: Record | undefined\n}\n\nconst dynamicImportEsmDefault = (id: string) =>\n import(/* webpackIgnore: true */ /* turbopackIgnore: true */ id).then(\n (mod) => mod.default || mod\n )\n\n/**\n * RouteModule is the base class for all route modules. This class should be\n * extended by all route modules.\n */\nexport abstract class RouteModule<\n D extends RouteDefinition = RouteDefinition,\n U = unknown,\n> {\n /**\n * The userland module. This is the module that is exported from the user's\n * code. Exposed as a getter so subclasses can override with lazy loading.\n */\n protected _userland: Readonly\n\n get userland(): Readonly {\n return this._userland\n }\n\n /**\n * The definition of the route.\n */\n public readonly definition: Readonly\n\n /** The canonical source identity shared by cache reads, writes, and metadata. */\n public readonly cacheOwner: ResponseCacheOwner\n\n /**\n * The shared modules that are exposed and required for the route module.\n */\n public static readonly sharedModules: any\n\n public isDev: boolean\n public distDir: string\n public relativeProjectDir: string\n public incrementCache?: IncrementalCache\n public responseCache?: ResponseCache\n\n constructor({\n userland,\n definition,\n distDir,\n relativeProjectDir,\n }: RouteModuleOptions) {\n this._userland = userland\n this.definition = definition\n this.cacheOwner = getResponseCacheOwner(definition)\n this.isDev = !!process.env.__NEXT_DEV_SERVER\n this.distDir = distDir\n this.relativeProjectDir = relativeProjectDir\n }\n\n private getRouterServerContext(\n req: NextIncomingMessage\n ): RouterServerContext[string] | undefined {\n const hostname = getRequestMeta(req, 'hostname')\n const revalidate = getRequestMeta(req, 'revalidate')\n const render404 = getRequestMeta(req, 'render404')\n const relativeProjectDir =\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n const routerServerContext =\n routerServerGlobal[RouterServerContextSymbol]?.[relativeProjectDir]\n\n return {\n ...routerServerContext,\n ...(hostname !== undefined ? { hostname } : {}),\n ...(revalidate !== undefined ? { revalidate } : {}),\n ...(render404 !== undefined ? { render404 } : {}),\n }\n }\n\n public getAssetPrefixForRender(\n routerServerContext: RouterServerContext[string] | undefined,\n configuredAssetPrefix: string\n ): string {\n // A running NextServer owns overrides from app.setAssetPrefix().\n if (routerServerContext && routerServerContext.getAssetPrefix) {\n return routerServerContext.getAssetPrefix()\n }\n // Direct route invocations use the configured prefix.\n return configuredAssetPrefix\n }\n\n public normalizeUrl(\n _req: IncomingMessage | BaseNextRequest,\n _parsedUrl: UrlWithParsedQuery\n ) {}\n\n public async instrumentationOnRequestError(\n req: IncomingMessage | BaseNextRequest,\n ...args: Parameters\n ) {\n if (process.env.NEXT_RUNTIME === 'edge') {\n const { getEdgeInstrumentationModule } = await import('../web/globals')\n const instrumentation = await getEdgeInstrumentationModule()\n\n if (instrumentation) {\n await instrumentation.onRequestError?.(...args)\n }\n } else {\n const { join } = require('node:path') as typeof import('node:path')\n const absoluteProjectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n const { instrumentationOnRequestError } = await import(\n '../lib/router-utils/instrumentation-globals.external.js'\n )\n\n return instrumentationOnRequestError(\n absoluteProjectDir,\n this.distDir,\n ...args\n )\n }\n }\n\n private loadManifests(\n srcPage: string,\n projectDir?: string\n ): {\n buildId: string\n buildManifest: BuildManifest\n fallbackBuildManifest: BuildManifest\n routesManifest: DeepReadonly\n nextFontManifest: DeepReadonly\n prerenderManifest: DeepReadonly\n serverFilesManifest: DeepReadonly | undefined\n reactLoadableManifest: DeepReadonly\n subresourceIntegrityManifest: any\n clientReferenceManifest: any\n serverActionsManifest: any\n dynamicCssManifest: any\n prefetchHintsManifest: Record | undefined\n interceptionRoutePatterns: RegExp[]\n previewProps: __ApiPreviewProps\n } {\n let result\n if (process.env.NEXT_RUNTIME === 'edge') {\n const { getEdgePreviewProps } =\n require('../web/get-edge-preview-props') as typeof import('../web/get-edge-preview-props')\n\n const maybeJSONParse = (str?: string) =>\n str ? JSON.parse(str) : undefined\n\n result = {\n buildId: process.env.__NEXT_BUILD_ID || '',\n buildManifest: self.__BUILD_MANIFEST as any,\n fallbackBuildManifest: {} as any,\n reactLoadableManifest: maybeJSONParse(self.__REACT_LOADABLE_MANIFEST),\n nextFontManifest: maybeJSONParse(self.__NEXT_FONT_MANIFEST),\n prerenderManifest: {\n routes: {},\n dynamicRoutes: {},\n notFoundRoutes: [],\n version: 4,\n preview: getEdgePreviewProps(),\n } as const,\n previewProps: getEdgePreviewProps(),\n routesManifest: {\n version: 4,\n caseSensitive: Boolean(process.env.__NEXT_CASE_SENSITIVE_ROUTES),\n basePath: process.env.__NEXT_BASE_PATH || '',\n rewrites: (process.env.__NEXT_REWRITES as any) || {\n beforeFiles: [],\n afterFiles: [],\n fallback: [],\n },\n redirects: [],\n headers: [],\n onMatchHeaders: [],\n i18n:\n (process.env.__NEXT_I18N_CONFIG as any as I18NConfig) || undefined,\n skipProxyUrlNormalize: Boolean(\n process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE\n ),\n },\n serverFilesManifest: self.__SERVER_FILES_MANIFEST,\n clientReferenceManifest: self.__RSC_MANIFEST?.[srcPage],\n serverActionsManifest: maybeJSONParse(self.__RSC_SERVER_MANIFEST),\n subresourceIntegrityManifest: maybeJSONParse(\n self.__SUBRESOURCE_INTEGRITY_MANIFEST\n ),\n dynamicCssManifest: maybeJSONParse(self.__DYNAMIC_CSS_MANIFEST),\n // Edge pages are always dynamic so prefetch inlining hints\n // don't apply. The runtime handles missing hints gracefully.\n prefetchHintsManifest: undefined,\n interceptionRoutePatterns: (\n maybeJSONParse(self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST) ?? []\n ).map((rewrite: any) => new RegExp(rewrite.regex)),\n }\n } else {\n if (!projectDir) {\n throw new Error('Invariant: projectDir is required for node runtime')\n }\n const { loadManifestFromRelativePath, evalManifestFromRelativePath } =\n require('../load-manifest.external') as typeof import('../load-manifest.external')\n const normalizedPagePath = normalizePagePath(srcPage)\n\n const router =\n this.definition.kind === RouteKind.PAGES ||\n this.definition.kind === RouteKind.PAGES_API\n ? 'pages'\n : 'app'\n\n const [\n routesManifest,\n prerenderManifest,\n previewProps,\n buildManifest,\n fallbackBuildManifest,\n reactLoadableManifest,\n nextFontManifest,\n clientReferenceManifest,\n serverActionsManifest,\n subresourceIntegrityManifest,\n serverFilesManifest,\n buildId,\n dynamicCssManifest,\n prefetchHintsManifest,\n ] = [\n loadManifestFromRelativePath({\n projectDir,\n distDir: this.distDir,\n manifest: ROUTES_MANIFEST,\n shouldCache: !this.isDev,\n }),\n loadManifestFromRelativePath({\n projectDir,\n distDir: this.distDir,\n manifest: PRERENDER_MANIFEST,\n shouldCache: !this.isDev,\n }),\n loadManifestFromRelativePath({\n projectDir,\n distDir: this.distDir,\n manifest: `server/${PREVIEW_PROPS_MANIFEST}`,\n shouldCache: !this.isDev,\n }),\n loadManifestFromRelativePath({\n projectDir,\n distDir: this.distDir,\n manifest: BUILD_MANIFEST,\n shouldCache: !this.isDev,\n }),\n srcPage === '/_error'\n ? (loadManifestFromRelativePath({\n projectDir,\n distDir: this.distDir,\n manifest: `fallback-${BUILD_MANIFEST}`,\n shouldCache: !this.isDev,\n handleMissing: true,\n // TODO this cast is unsafe\n }) ?? ({} as BuildManifest))\n : // TODO this cast is unsafe\n ({} as BuildManifest),\n loadManifestFromRelativePath({\n projectDir,\n distDir: this.distDir,\n manifest: process.env.TURBOPACK\n ? `server/${router === 'app' ? 'app' : 'pages'}${normalizedPagePath}/${REACT_LOADABLE_MANIFEST}`\n : REACT_LOADABLE_MANIFEST,\n handleMissing: true,\n shouldCache: !this.isDev,\n }) ?? ({} satisfies ReactLoadableManifest),\n loadManifestFromRelativePath({\n projectDir,\n distDir: this.distDir,\n manifest: `server/${NEXT_FONT_MANIFEST}.json`,\n shouldCache: !this.isDev,\n }),\n router === 'app' && !isStaticMetadataRoute(srcPage)\n ? evalManifestFromRelativePath({\n distDir: this.distDir,\n projectDir,\n handleMissing: true,\n manifest: `server/app${srcPage.replace(/%5F/g, '_') + '_' + CLIENT_REFERENCE_MANIFEST}.js`,\n shouldCache: !this.isDev,\n })\n : undefined,\n router === 'app'\n ? loadManifestFromRelativePath({\n distDir: this.distDir,\n projectDir,\n manifest: `server/${SERVER_REFERENCE_MANIFEST}.json`,\n handleMissing: true,\n shouldCache: !this.isDev,\n })\n : {},\n loadManifestFromRelativePath>({\n projectDir,\n distDir: this.distDir,\n manifest: `server/${SUBRESOURCE_INTEGRITY_MANIFEST}.json`,\n handleMissing: true,\n shouldCache: !this.isDev,\n }),\n this.isDev\n ? undefined\n : loadManifestFromRelativePath({\n projectDir,\n distDir: this.distDir,\n shouldCache: true,\n manifest: `${SERVER_FILES_MANIFEST}.json`,\n }),\n this.isDev\n ? 'development'\n : loadManifestFromRelativePath({\n projectDir,\n distDir: this.distDir,\n manifest: BUILD_ID_FILE,\n skipParse: true,\n shouldCache: true,\n }),\n loadManifestFromRelativePath({\n projectDir,\n distDir: this.distDir,\n manifest: DYNAMIC_CSS_MANIFEST,\n shouldCache: !this.isDev,\n handleMissing: true,\n }),\n router === 'app'\n ? loadManifestFromRelativePath>({\n projectDir,\n distDir: this.distDir,\n manifest: `server/${PREFETCH_HINTS}`,\n shouldCache: !this.isDev,\n handleMissing: true,\n })\n : undefined,\n ]\n\n result = {\n buildId,\n buildManifest,\n fallbackBuildManifest,\n routesManifest,\n nextFontManifest,\n prerenderManifest,\n previewProps,\n serverFilesManifest,\n reactLoadableManifest,\n clientReferenceManifest: (clientReferenceManifest as any)\n ?.__RSC_MANIFEST?.[srcPage.replace(/%5F/g, '_')],\n serverActionsManifest,\n subresourceIntegrityManifest,\n dynamicCssManifest,\n prefetchHintsManifest,\n interceptionRoutePatterns: routesManifest.rewrites.beforeFiles\n .filter(isInterceptionRouteRewrite)\n .map((rewrite) => new RegExp(rewrite.regex)),\n }\n }\n\n return result\n }\n\n public async loadCustomCacheHandlers(\n req: IncomingMessage | BaseNextRequest,\n nextConfig: NextConfigRuntime\n ) {\n if (process.env.NEXT_RUNTIME !== 'edge') {\n const { cacheMaxMemorySize, cacheHandlers } = nextConfig\n if (!cacheHandlers) return\n\n initializeCacheHandlers(cacheMaxMemorySize)\n await registerCustomCacheHandlers(async () => {\n for (const [kind, handler] of Object.entries(cacheHandlers)) {\n if (!handler) continue\n\n const { formatDynamicImportPath } =\n require('../../lib/format-dynamic-import-path') as typeof import('../../lib/format-dynamic-import-path')\n\n const { join } = require('node:path') as typeof import('node:path')\n const absoluteProjectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n setCacheHandler(\n kind,\n interopDefault(\n await dynamicImportEsmDefault(\n formatDynamicImportPath(\n `${absoluteProjectDir}/${this.distDir}`,\n handler\n )\n )\n )\n )\n }\n })\n }\n }\n\n public async getIncrementalCache(\n req: IncomingMessage | BaseNextRequest,\n nextConfig: NextConfigRuntime,\n previewProps: DeepReadonly<__ApiPreviewProps>,\n prerenderManifest: DeepReadonly,\n isMinimalMode: boolean\n ): Promise {\n if (process.env.NEXT_RUNTIME === 'edge') {\n return (globalThis as any).__incrementalCache\n } else {\n let CacheHandler: any\n const { cacheHandler } = nextConfig\n\n if (cacheHandler) {\n const { formatDynamicImportPath } =\n require('../../lib/format-dynamic-import-path') as typeof import('../../lib/format-dynamic-import-path')\n\n CacheHandler = interopDefault(\n await dynamicImportEsmDefault(\n formatDynamicImportPath(this.distDir, cacheHandler)\n )\n )\n }\n const { join } = require('node:path') as typeof import('node:path')\n const projectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n await this.loadCustomCacheHandlers(req, nextConfig)\n\n // incremental-cache is request specific\n // although can have shared caches in module scope\n // per-cache handler\n const incrementalCache = new IncrementalCache({\n fs: (\n require('../lib/node-fs-methods') as typeof import('../lib/node-fs-methods')\n ).nodeFs,\n dev: this.isDev,\n requestHeaders: req.headers,\n allowedRevalidateHeaderKeys:\n nextConfig.experimental.allowedRevalidateHeaderKeys,\n minimalMode: isMinimalMode,\n serverDistDir: `${projectDir}/${this.distDir}/server`,\n fetchCacheKeyPrefix: nextConfig.experimental.fetchCacheKeyPrefix,\n maxMemoryCacheSize: nextConfig.cacheMaxMemorySize,\n flushToDisk: !isMinimalMode && nextConfig.experimental.isrFlushToDisk,\n previewProps,\n prerenderManifest,\n CurCacheHandler: CacheHandler,\n locales: nextConfig.i18n?.locales,\n })\n\n // we need to expose this on globalThis as the app-render\n // workStore grabs the incrementalCache from there\n ;(globalThis as any).__incrementalCache = incrementalCache\n return incrementalCache\n }\n }\n\n public async onRequestError(\n req: IncomingMessage | BaseNextRequest,\n err: unknown,\n errorContext: RequestErrorContext,\n silenceLog: boolean,\n routerServerContext?: RouterServerContext[string]\n ) {\n if (!silenceLog) {\n if (routerServerContext?.logErrorWithOriginalStack) {\n routerServerContext.logErrorWithOriginalStack(err, 'app-dir')\n } else {\n console.error(err)\n }\n }\n await this.instrumentationOnRequestError(\n req,\n err,\n {\n path: req.url || '/',\n headers: req.headers,\n method: req.method || 'GET',\n },\n errorContext\n )\n }\n\n /** A more lightweight version of `prepare()` for only retrieving the config on edge */\n public getNextConfigEdge(req: NextIncomingMessage): {\n nextConfig: NextConfigRuntime\n deploymentId: string\n } {\n if (process.env.NEXT_RUNTIME !== 'edge') {\n throw new Error(\n 'Invariant: getNextConfigEdge must only be called in edge runtime'\n )\n }\n\n let serverFilesManifest = self.__SERVER_FILES_MANIFEST as any as\n | RequiredServerFilesManifest\n | undefined\n const routerServerContext = this.getRouterServerContext(req)\n const nextConfig =\n routerServerContext?.nextConfig || serverFilesManifest?.config\n\n if (!nextConfig) {\n throw new Error(\"Invariant: nextConfig couldn't be loaded\")\n }\n\n let deploymentId\n if (nextConfig.experimental?.runtimeServerDeploymentId) {\n if (!process.env.NEXT_DEPLOYMENT_ID) {\n throw new Error(\n 'process.env.NEXT_DEPLOYMENT_ID is missing but runtimeServerDeploymentId is enabled'\n )\n }\n deploymentId = process.env.NEXT_DEPLOYMENT_ID\n } else {\n deploymentId = nextConfig.deploymentId || ''\n }\n\n return { nextConfig, deploymentId }\n }\n\n public prepare(\n req: IncomingMessage | BaseNextRequest,\n res: ServerResponse | null,\n options: {\n srcPage: string\n multiZoneDraftMode?: boolean\n }\n ) {\n return getTracer().trace(\n RouteModuleSpan.prepare,\n { spanName: 'prepare route module' },\n () => this.prepareImpl(req, res, options)\n )\n }\n\n private async prepareImpl(\n req: IncomingMessage | BaseNextRequest,\n res: ServerResponse | null,\n {\n srcPage,\n multiZoneDraftMode,\n }: {\n srcPage: string\n multiZoneDraftMode?: boolean\n }\n ): Promise<\n | {\n buildId: string\n deploymentId: string\n clientAssetToken: string\n locale?: string\n locales?: readonly string[]\n defaultLocale?: string\n query: ParsedUrlQuery\n originalQuery: ParsedUrlQuery\n originalPathname: string\n params?: ParsedUrlQuery\n parsedUrl: UrlWithParsedQuery\n previewData: PreviewData\n pageIsDynamic: boolean\n isDraftMode: boolean\n resolvedPathname: string\n encodedResolvedPathname: string\n isNextDataRequest: boolean\n buildManifest: DeepReadonly\n fallbackBuildManifest: DeepReadonly\n nextFontManifest: DeepReadonly\n serverFilesManifest:\n | DeepReadonly\n | undefined\n reactLoadableManifest: DeepReadonly\n routesManifest: DeepReadonly\n prerenderManifest: DeepReadonly\n // we can't pull in the client reference type or it causes issues with\n // our pre-compiled types\n clientReferenceManifest?: any\n serverActionsManifest?: any\n dynamicCssManifest?: any\n prefetchHintsManifest?: Record\n subresourceIntegrityManifest?: DeepReadonly>\n isOnDemandRevalidate: boolean\n revalidateOnlyGenerated: boolean\n nextConfig: NextConfigRuntime\n routerServerContext?: RouterServerContext[string]\n interceptionRoutePatterns?: any\n previewProps: __ApiPreviewProps\n }\n | undefined\n > {\n let absoluteProjectDir: string | undefined\n\n // edge runtime handles loading instrumentation at the edge adapter level\n if (process.env.NEXT_RUNTIME !== 'edge') {\n if (res) {\n patchSetHeaderWithCookieSupport(req, res)\n }\n\n const { join, relative } =\n require('node:path') as typeof import('node:path')\n\n absoluteProjectDir = join(\n /* turbopackIgnore: true */\n process.cwd(),\n getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir\n )\n\n const absoluteDistDir = getRequestMeta(req, 'distDir')\n\n if (absoluteDistDir) {\n this.distDir = relative(absoluteProjectDir, absoluteDistDir)\n }\n const { ensureInstrumentationRegistered } = await import(\n '../lib/router-utils/instrumentation-globals.external.js'\n )\n // ensure instrumentation is registered and pass\n // onRequestError below. Awaited so any caller of `RouteModule.prepare`\n // that bypasses `BaseServer.handleRequest` (where this is also awaited\n // via `prepareImpl`) still observes the instrumentation hook completing\n // before the userland route handler runs.\n await ensureInstrumentationRegistered(absoluteProjectDir, this.distDir)\n }\n const manifests = getTracer().trace(\n RouteModuleSpan.loadManifests,\n { spanName: 'load route manifests' },\n () => this.loadManifests(srcPage, absoluteProjectDir)\n )\n const { routesManifest, previewProps, serverFilesManifest } = manifests\n\n const { basePath, i18n, rewrites } = routesManifest\n\n const routerServerContext = this.getRouterServerContext(req)\n const nextConfig =\n routerServerContext?.nextConfig || serverFilesManifest?.config\n\n // Injected in base-server.ts\n const protocol = req.headers['x-forwarded-proto']?.includes('https')\n ? 'https'\n : 'http'\n\n // When there are hostname and port we build an absolute URL\n if (!getRequestMeta(req, 'initURL')) {\n const initUrl = serverFilesManifest?.config.experimental.trustHostHeader\n ? `${protocol}://${req.headers.host || 'localhost'}${req.url}`\n : `${protocol}://${routerServerContext?.hostname || 'localhost'}${req.url}`\n\n addRequestMeta(req, 'initURL', initUrl)\n addRequestMeta(req, 'initProtocol', protocol)\n }\n\n if (basePath) {\n req.url = removePathPrefix(req.url || '/', basePath)\n }\n\n const parsedUrl = parseReqUrl(req.url || '/')\n addRequestMeta(req, 'initQuery', { ...parsedUrl?.query })\n // if we couldn't parse the URL we can't continue\n if (!parsedUrl) {\n return\n }\n let isNextDataRequest = false\n\n if (pathHasPrefix(parsedUrl.pathname || '/', '/_next/data')) {\n isNextDataRequest = true\n parsedUrl.pathname = normalizeDataPath(parsedUrl.pathname || '/')\n }\n this.normalizeUrl(req, parsedUrl)\n let originalPathname = parsedUrl.pathname || '/'\n const originalQuery = { ...parsedUrl.query }\n const pageIsDynamic = isDynamicRoute(srcPage)\n\n let localeResult: PathLocale | undefined\n let detectedLocale: string | undefined\n\n if (i18n) {\n localeResult = normalizeLocalePath(\n parsedUrl.pathname || '/',\n i18n.locales\n )\n\n if (localeResult.detectedLocale) {\n req.url = `${localeResult.pathname}${parsedUrl.search}`\n originalPathname = localeResult.pathname\n\n if (!detectedLocale) {\n detectedLocale = localeResult.detectedLocale\n }\n }\n }\n\n // Normalize the page path for route matching. The srcPage contains the\n // internal page path (e.g., /app/[slug]/page), but route matchers expect\n // the pathname format (e.g., /app/[slug]).\n const normalizedSrcPage = normalizeAppPath(srcPage)\n\n const serverUtils = getServerUtils({\n page: normalizedSrcPage,\n i18n,\n basePath,\n rewrites,\n pageIsDynamic,\n trailingSlash: process.env.__NEXT_TRAILING_SLASH as any as boolean,\n caseSensitive: Boolean(routesManifest.caseSensitive),\n })\n\n const domainLocale = detectDomainLocale(\n i18n?.domains,\n getHostname(parsedUrl, req.headers),\n detectedLocale\n )\n\n if (Boolean(domainLocale)) {\n addRequestMeta(req, 'isLocaleDomain', Boolean(domainLocale))\n }\n\n const defaultLocale =\n getRequestMeta(req, 'defaultLocale') ||\n domainLocale?.defaultLocale ||\n i18n?.defaultLocale\n\n // Ensure parsedUrl.pathname includes locale before processing\n // rewrites or they won't match correctly.\n if (defaultLocale && !detectedLocale) {\n parsedUrl.pathname = `/${defaultLocale}${parsedUrl.pathname === '/' ? '' : parsedUrl.pathname}`\n }\n const locale =\n getRequestMeta(req, 'locale') || detectedLocale || defaultLocale\n\n // we apply rewrites against cloned URL so that we don't\n // modify the original with the rewrite destination\n const { rewriteParams, rewrittenParsedUrl } = serverUtils.handleRewrites(\n req,\n parsedUrl\n )\n const rewriteParamKeys = Object.keys(rewriteParams)\n Object.assign(parsedUrl.query, rewrittenParsedUrl.query)\n\n // after processing rewrites we want to remove locale\n // from parsedUrl pathname\n if (i18n) {\n parsedUrl.pathname = normalizeLocalePath(\n parsedUrl.pathname || '/',\n i18n.locales\n ).pathname\n\n rewrittenParsedUrl.pathname = normalizeLocalePath(\n rewrittenParsedUrl.pathname || '/',\n i18n.locales\n ).pathname\n }\n\n let params: Record | undefined =\n getRequestMeta(req, 'params')\n\n // attempt parsing from pathname\n if (!params && serverUtils.dynamicRouteMatcher) {\n const paramsMatch = serverUtils.dynamicRouteMatcher(\n normalizeDataPath(\n rewrittenParsedUrl?.pathname || parsedUrl.pathname || '/'\n )\n )\n const paramsResult = serverUtils.normalizeDynamicRouteParams(\n paramsMatch || {},\n true\n )\n\n if (paramsResult.hasValidParams) {\n params = paramsResult.params\n }\n }\n\n // Local \"next start\" expects the routing parsed query values\n // to not be present in the URL although when deployed proxies\n // will add query values from resolving the routes to pass to function.\n\n // TODO: do we want to change expectations for \"next start\"\n // to include these query values in the URL which affects asPath\n // but would match deployed behavior, e.g. a rewrite from middleware\n // that adds a query param would be in asPath as query but locally\n // it won't be in the asPath but still available in the query object\n const query = getRequestMeta(req, 'query') || {\n ...parsedUrl.query,\n }\n\n const routeParamKeys = new Set()\n const combinedParamKeys = []\n\n // We don't include rewriteParamKeys in the combinedParamKeys\n // for app router since the searchParams is populated from the\n // URL so we don't want to strip the rewrite params from the URL\n // so that searchParams can include them.\n if (\n this.definition.kind === RouteKind.PAGES ||\n this.definition.kind === RouteKind.PAGES_API\n ) {\n for (const key of [\n ...rewriteParamKeys,\n ...Object.keys(serverUtils.defaultRouteMatches || {}),\n ]) {\n // We only want to filter rewrite param keys from the URL\n // if they are matches from the URL e.g. the key/value matches\n // before and after applying the rewrites /:path for /hello and\n // { path: 'hello' } but not for { path: 'another' } and /hello\n // TODO: we should prefix rewrite param keys the same as we do\n // for dynamic routes so we can identify them properly\n const originalValue = Array.isArray(originalQuery[key])\n ? originalQuery[key].join('')\n : originalQuery[key]\n\n const queryValue = Array.isArray(query[key])\n ? query[key].join('')\n : query[key]\n\n if (!(key in originalQuery) || originalValue === queryValue) {\n combinedParamKeys.push(key)\n }\n }\n }\n\n serverUtils.normalizeCdnUrl(req, combinedParamKeys)\n // When Next is not hosted in a single process, upstream proxies will add query values for route params that were used to match the route.\n // Outside of that environment, there is no reason to do any normalization to honor those query values.\n if (!routerServerContext?.isWrappedByNextServer) {\n serverUtils.normalizeQueryParams(query, routeParamKeys)\n } else {\n serverUtils.filterInternalQuery(query, [])\n }\n serverUtils.filterInternalQuery(originalQuery, combinedParamKeys)\n\n if (pageIsDynamic) {\n const queryResult = serverUtils.normalizeDynamicRouteParams(query, true)\n\n const paramsResult = serverUtils.normalizeDynamicRouteParams(\n params || {},\n true\n )\n\n let paramsToInterpolate: ParsedUrlQuery\n\n if (\n // if both query and params are valid but one\n // provided more information and the query params\n // were nxtP prefixed rely on that one\n query &&\n params &&\n paramsResult.hasValidParams &&\n queryResult.hasValidParams &&\n routeParamKeys.size > 0 &&\n Object.keys(paramsResult.params).length <=\n Object.keys(queryResult.params).length\n ) {\n paramsToInterpolate = queryResult.params\n params = Object.assign(queryResult.params)\n } else {\n paramsToInterpolate =\n paramsResult.hasValidParams && params\n ? params\n : queryResult.hasValidParams\n ? query\n : {}\n }\n\n req.url = serverUtils.interpolateDynamicPath(\n req.url || '/',\n paramsToInterpolate\n )\n parsedUrl.pathname = serverUtils.interpolateDynamicPath(\n parsedUrl.pathname || '/',\n paramsToInterpolate\n )\n originalPathname = serverUtils.interpolateDynamicPath(\n originalPathname,\n paramsToInterpolate\n )\n\n // try pulling from query if valid\n if (!params) {\n if (queryResult.hasValidParams) {\n params = Object.assign({}, queryResult.params)\n\n // If we pulled from query remove it so it's\n // only in params\n for (const key in serverUtils.defaultRouteMatches) {\n delete query[key]\n }\n } else {\n // use final params from URL matching\n const paramsMatch = serverUtils.dynamicRouteMatcher?.(\n normalizeDataPath(\n localeResult?.pathname || parsedUrl.pathname || '/'\n )\n )\n // we don't normalize these as they are allowed to be\n // the literal slug matches here e.g. /blog/[slug]\n // actually being requested\n if (paramsMatch) {\n params = Object.assign({}, paramsMatch)\n }\n }\n }\n\n // When partial nxtP* params are provided (e.g. background\n // revalidation for intermediate PPR shells), both\n // normalizeDynamicRouteParams calls above fail because not all\n // route params are present. Merge the normalized query params\n // (from nxtP*) into the current params to override placeholders\n // with concrete values.\n if (\n params &&\n routeParamKeys.size > 0 &&\n !paramsResult.hasValidParams &&\n !queryResult.hasValidParams\n ) {\n for (const key of routeParamKeys) {\n if (query[key] !== undefined) {\n params[key] = query[key]\n }\n }\n addRequestMeta(req, 'resolvedRouteParamKeys', routeParamKeys)\n }\n }\n\n // Remove any normalized params from the query if they\n // weren't present as non-prefixed query key e.g.\n // ?search=1&nxtPsearch=hello we don't delete search\n for (const key of routeParamKeys) {\n if (!(key in originalQuery)) {\n delete query[key]\n // handle the case where there's collision and we\n // normalized nxtPid=123 -> id=123 but user also\n // sends id=456 as separate key\n } else if (\n originalQuery[key] &&\n query[key] &&\n originalQuery[key] !== query[key]\n ) {\n query[key] = originalQuery[key]\n }\n }\n\n const { isOnDemandRevalidate, revalidateOnlyGenerated } =\n checkIsOnDemandRevalidate(req.headers, previewProps)\n\n let isDraftMode = false\n let previewData: PreviewData\n\n // preview data relies on non-edge utils\n if (process.env.NEXT_RUNTIME !== 'edge' && res) {\n const { tryGetPreviewData } =\n require('../api-utils/node/try-get-preview-data') as typeof import('../api-utils/node/try-get-preview-data')\n\n previewData = tryGetPreviewData(\n req,\n res,\n previewProps,\n Boolean(multiZoneDraftMode)\n )\n isDraftMode = previewData !== false\n }\n\n if (!nextConfig) {\n throw new Error(\"Invariant: nextConfig couldn't be loaded\")\n }\n\n if (process.env.NEXT_RUNTIME !== 'edge') {\n const { installProcessErrorHandlers } =\n require('../node-environment-extensions/process-error-handlers') as typeof import('../node-environment-extensions/process-error-handlers')\n\n installProcessErrorHandlers(\n Boolean(\n nextConfig.experimental.removeUncaughtErrorAndRejectionListeners\n )\n )\n }\n\n let resolvedPathname = normalizedSrcPage\n if (isDynamicRoute(resolvedPathname) && params) {\n resolvedPathname = serverUtils.interpolateDynamicPath(\n resolvedPathname,\n params\n )\n }\n\n if (resolvedPathname === '/index') {\n resolvedPathname = '/'\n }\n\n if (\n res &&\n Boolean(req.headers['x-nextjs-data']) &&\n (!res.statusCode || res.statusCode === 200)\n ) {\n res.setHeader(\n 'x-nextjs-matched-path',\n removeTrailingSlash(`${locale ? `/${locale}` : ''}${normalizedSrcPage}`)\n )\n }\n const encodedResolvedPathname = resolvedPathname\n\n // we decode for cache key/manifest usage encoded is\n // for URL building\n try {\n resolvedPathname = decodePathParams(resolvedPathname)\n } catch (_) {}\n\n resolvedPathname = removeTrailingSlash(resolvedPathname)\n\n let deploymentId\n if (nextConfig.experimental?.runtimeServerDeploymentId) {\n if (!process.env.NEXT_DEPLOYMENT_ID) {\n throw new Error(\n 'process.env.NEXT_DEPLOYMENT_ID is missing but runtimeServerDeploymentId is enabled'\n )\n }\n deploymentId = process.env.NEXT_DEPLOYMENT_ID\n } else {\n deploymentId = nextConfig.deploymentId || ''\n }\n\n return {\n query,\n originalQuery,\n originalPathname,\n params,\n parsedUrl,\n locale,\n isNextDataRequest,\n locales: i18n?.locales,\n defaultLocale,\n isDraftMode,\n previewData,\n pageIsDynamic,\n resolvedPathname,\n encodedResolvedPathname,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n ...manifests,\n // loadManifest returns a readonly object, but we don't want to propagate that throughout the\n // whole codebase (for now)\n nextConfig:\n nextConfig satisfies DeepReadonly as NextConfigRuntime,\n routerServerContext,\n deploymentId,\n clientAssetToken: nextConfig.supportsImmutableAssets ? '' : deploymentId,\n }\n }\n\n public getResponseCache(req: IncomingMessage | BaseNextRequest) {\n if (!this.responseCache) {\n const minimalMode = getRequestMeta(req, 'minimalMode') ?? false\n this.responseCache = new ResponseCache({\n minimalMode,\n route: this.cacheOwner,\n })\n }\n return this.responseCache\n }\n\n public async handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind,\n isFallback,\n previewProps,\n prerenderManifest,\n isRoutePPREnabled,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil,\n isMinimalMode,\n }: {\n req: IncomingMessage | BaseNextRequest\n nextConfig: NextConfigRuntime\n cacheKey: string | null\n routeKind: RouteKind\n isFallback?: boolean\n previewProps: DeepReadonly<__ApiPreviewProps>\n prerenderManifest: DeepReadonly\n isRoutePPREnabled?: boolean\n isOnDemandRevalidate?: boolean\n revalidateOnlyGenerated?: boolean\n responseGenerator: ResponseGenerator\n waitUntil?: (prom: Promise) => void\n isMinimalMode: boolean\n }) {\n const responseCache = this.getResponseCache(req)\n const cacheEntry = await responseCache.get(cacheKey, responseGenerator, {\n routeKind,\n isFallback,\n isRoutePPREnabled,\n isOnDemandRevalidate,\n // A Next.js Segment Cache prefetch uses the `Next-Router-Prefetch`\n // header (surfaced as the `isPrefetchRSCRequest` request meta), not the\n // standard browser `purpose: prefetch` header. Recognize both so the\n // response cache treats segment prefetches as prefetches — most\n // importantly, so a prefetch that misses serves a fallback shell rather\n // than joining an in-flight background (concrete) revalidation.\n isPrefetch:\n req.headers.purpose === 'prefetch' ||\n getRequestMeta(req, 'isPrefetchRSCRequest') === true,\n // Use x-invocation-id header to scope the in-memory cache to a single\n // revalidation request in minimal mode.\n invocationID: req.headers['x-invocation-id'] as string | undefined,\n incrementalCache: await this.getIncrementalCache(\n req,\n nextConfig,\n previewProps,\n prerenderManifest,\n isMinimalMode\n ),\n waitUntil,\n })\n\n if (!cacheEntry) {\n if (\n cacheKey &&\n // revalidate only generated can bail even if cacheKey is provided\n !(isOnDemandRevalidate && revalidateOnlyGenerated)\n ) {\n // A cache entry might not be generated if a response is written\n // in `getInitialProps` or `getServerSideProps`, but those shouldn't\n // have a cache key. If we do have a cache key but we don't end up\n // with a cache entry, then either Next.js or the application has a\n // bug that needs fixing.\n throw new Error('invariant: cache entry required but not generated')\n }\n }\n return cacheEntry\n }\n}\n"],"names":["BUILD_ID_FILE","BUILD_MANIFEST","CLIENT_REFERENCE_MANIFEST","DYNAMIC_CSS_MANIFEST","NEXT_FONT_MANIFEST","PREFETCH_HINTS","PRERENDER_MANIFEST","PREVIEW_PROPS_MANIFEST","REACT_LOADABLE_MANIFEST","ROUTES_MANIFEST","SERVER_FILES_MANIFEST","SERVER_REFERENCE_MANIFEST","SUBRESOURCE_INTEGRITY_MANIFEST","parseReqUrl","normalizeLocalePath","isDynamicRoute","removePathPrefix","getServerUtils","detectDomainLocale","getHostname","checkIsOnDemandRevalidate","normalizeDataPath","pathHasPrefix","addRequestMeta","getRequestMeta","patchSetHeaderWithCookieSupport","normalizePagePath","isStaticMetadataRoute","IncrementalCache","initializeCacheHandlers","registerCustomCacheHandlers","setCacheHandler","interopDefault","RouteKind","getResponseCacheOwner","ResponseCache","normalizeAppPath","RouterServerContextSymbol","routerServerGlobal","decodePathParams","removeTrailingSlash","isInterceptionRouteRewrite","getTracer","RouteModuleSpan","dynamicImportEsmDefault","id","then","mod","default","RouteModule","userland","_userland","constructor","definition","distDir","relativeProjectDir","cacheOwner","isDev","process","env","__NEXT_DEV_SERVER","getRouterServerContext","req","hostname","revalidate","render404","routerServerContext","undefined","getAssetPrefixForRender","configuredAssetPrefix","getAssetPrefix","normalizeUrl","_req","_parsedUrl","instrumentationOnRequestError","args","NEXT_RUNTIME","getEdgeInstrumentationModule","instrumentation","onRequestError","join","require","absoluteProjectDir","cwd","loadManifests","srcPage","projectDir","result","self","getEdgePreviewProps","maybeJSONParse","str","JSON","parse","buildId","__NEXT_BUILD_ID","buildManifest","__BUILD_MANIFEST","fallbackBuildManifest","reactLoadableManifest","__REACT_LOADABLE_MANIFEST","nextFontManifest","__NEXT_FONT_MANIFEST","prerenderManifest","routes","dynamicRoutes","notFoundRoutes","version","preview","previewProps","routesManifest","caseSensitive","Boolean","__NEXT_CASE_SENSITIVE_ROUTES","basePath","__NEXT_BASE_PATH","rewrites","__NEXT_REWRITES","beforeFiles","afterFiles","fallback","redirects","headers","onMatchHeaders","i18n","__NEXT_I18N_CONFIG","skipProxyUrlNormalize","__NEXT_NO_MIDDLEWARE_URL_NORMALIZE","serverFilesManifest","__SERVER_FILES_MANIFEST","clientReferenceManifest","__RSC_MANIFEST","serverActionsManifest","__RSC_SERVER_MANIFEST","subresourceIntegrityManifest","__SUBRESOURCE_INTEGRITY_MANIFEST","dynamicCssManifest","__DYNAMIC_CSS_MANIFEST","prefetchHintsManifest","interceptionRoutePatterns","__INTERCEPTION_ROUTE_REWRITE_MANIFEST","map","rewrite","RegExp","regex","Error","loadManifestFromRelativePath","evalManifestFromRelativePath","normalizedPagePath","router","kind","PAGES","PAGES_API","manifest","shouldCache","handleMissing","TURBOPACK","replace","skipParse","filter","loadCustomCacheHandlers","nextConfig","cacheMaxMemorySize","cacheHandlers","handler","Object","entries","formatDynamicImportPath","getIncrementalCache","isMinimalMode","globalThis","__incrementalCache","CacheHandler","cacheHandler","incrementalCache","fs","nodeFs","dev","requestHeaders","allowedRevalidateHeaderKeys","experimental","minimalMode","serverDistDir","fetchCacheKeyPrefix","maxMemoryCacheSize","flushToDisk","isrFlushToDisk","CurCacheHandler","locales","err","errorContext","silenceLog","logErrorWithOriginalStack","console","error","path","url","method","getNextConfigEdge","config","deploymentId","runtimeServerDeploymentId","NEXT_DEPLOYMENT_ID","prepare","res","options","trace","spanName","prepareImpl","multiZoneDraftMode","relative","absoluteDistDir","ensureInstrumentationRegistered","manifests","protocol","includes","initUrl","trustHostHeader","host","parsedUrl","query","isNextDataRequest","pathname","originalPathname","originalQuery","pageIsDynamic","localeResult","detectedLocale","search","normalizedSrcPage","serverUtils","page","trailingSlash","__NEXT_TRAILING_SLASH","domainLocale","domains","defaultLocale","locale","rewriteParams","rewrittenParsedUrl","handleRewrites","rewriteParamKeys","keys","assign","params","dynamicRouteMatcher","paramsMatch","paramsResult","normalizeDynamicRouteParams","hasValidParams","routeParamKeys","Set","combinedParamKeys","key","defaultRouteMatches","originalValue","Array","isArray","queryValue","push","normalizeCdnUrl","isWrappedByNextServer","normalizeQueryParams","filterInternalQuery","queryResult","paramsToInterpolate","size","length","interpolateDynamicPath","isOnDemandRevalidate","revalidateOnlyGenerated","isDraftMode","previewData","tryGetPreviewData","installProcessErrorHandlers","removeUncaughtErrorAndRejectionListeners","resolvedPathname","statusCode","setHeader","encodedResolvedPathname","_","clientAssetToken","supportsImmutableAssets","getResponseCache","responseCache","route","handleResponse","cacheKey","routeKind","isFallback","isRoutePPREnabled","responseGenerator","waitUntil","cacheEntry","get","isPrefetch","purpose","invocationID"],"mappings":"AAAA,OAAO,8CAA6C;AAgBpD,SACEA,aAAa,EACbC,cAAc,EACdC,yBAAyB,EACzBC,oBAAoB,EACpBC,kBAAkB,EAClBC,cAAc,EACdC,kBAAkB,EAClBC,sBAAsB,EACtBC,uBAAuB,EACvBC,eAAe,EACfC,qBAAqB,EACrBC,yBAAyB,EACzBC,8BAA8B,QACzB,6BAA4B;AACnC,SAASC,WAAW,QAAQ,gBAAe;AAC3C,SACEC,mBAAmB,QAEd,8CAA6C;AACpD,SAASC,cAAc,QAAQ,gCAA+B;AAC9D,SAASC,gBAAgB,QAAQ,mDAAkD;AACnF,SAASC,cAAc,QAAQ,kBAAiB;AAChD,SAASC,kBAAkB,QAAQ,6CAA4C;AAC/E,SAASC,WAAW,QAAQ,gCAA+B;AAC3D,SAASC,yBAAyB,QAAgC,eAAc;AAKhF,SAASC,iBAAiB,QAAQ,iDAAgD;A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AC5CoD,kBAAkB,MAAM,IAAI,CAACN,mBAAmB,CAC9C1G,KACAmG,YACApD,cACAN,mBACAkE;YAEF2H;QACF;QAEA,IAAI,CAACC,YAAY;YACf,IACEN,YACA,kEAAkE;YAClE,CAAElB,CAAAA,wBAAwBC,uBAAsB,GAChD;gBACA,gEAAgE;gBAChE,oEAAoE;gBACpE,kEAAkE;gBAClE,mEAAmE;gBACnE,yBAAyB;gBACzB,MAAM,IAAI7H,MAAM;YAClB;QACF;QACA,OAAOoJ;IACT;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/runtime-reacts.external.js b/e-commerce/node_modules/next/dist/esm/server/runtime-reacts.external.js new file mode 100644 index 0000000000000000000000000000000000000000..564a6aa0a91db6cbad4e23f2586d8a011e06b35c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/runtime-reacts.external.js @@ -0,0 +1,16 @@ +let ClientReact = null; +export function registerClientReact(react) { + ClientReact = react; +} +export function getClientReact() { + return ClientReact; +} +let ServerReact = null; +export function registerServerReact(react) { + ServerReact = react; +} +export function getServerReact() { + return ServerReact; +} + +//# sourceMappingURL=runtime-reacts.external.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/runtime-reacts.external.js.map b/e-commerce/node_modules/next/dist/esm/server/runtime-reacts.external.js.map new file mode 100644 index 0000000000000000000000000000000000000000..188974ff6d4dc18652c05095ef532d313b58982a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/runtime-reacts.external.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/server/runtime-reacts.external.ts"],"sourcesContent":["let ClientReact: typeof import('react') | null = null\nexport function registerClientReact(react: typeof import('react')) {\n ClientReact = react\n}\nexport function getClientReact() {\n return ClientReact\n}\n\nlet ServerReact: typeof import('react') | null = null\nexport function registerServerReact(react: typeof import('react')) {\n ServerReact = react\n}\nexport function getServerReact() {\n return ServerReact\n}\n"],"names":["ClientReact","registerClientReact","react","getClientReact","ServerReact","registerServerReact","getServerReact"],"mappings":"AAAA,IAAIA,cAA6C;AACjD,OAAO,SAASC,oBAAoBC,KAA6B;IAC/DF,cAAcE;AAChB;AACA,OAAO,SAASC;IACd,OAAOH;AACT;AAEA,IAAII,cAA6C;AACjD,OAAO,SAASC,oBAAoBH,KAA6B;IAC/DE,cAAcF;AAChB;AACA,OAAO,SAASI;IACd,OAAOF;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/send-payload.js b/e-commerce/node_modules/next/dist/esm/server/send-payload.js new file mode 100644 index 0000000000000000000000000000000000000000..864dab61e0a6890c54a6bf025e61e9647e60369e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/send-payload.js @@ -0,0 +1,61 @@ +import { isResSent } from '../shared/lib/utils'; +import { generateETag } from './lib/etag'; +import fresh from 'next/dist/compiled/fresh'; +import { getCacheControlHeader } from './lib/cache-control'; +import { HTML_CONTENT_TYPE_HEADER } from '../lib/constants'; +export function sendEtagResponse(req, res, etag) { + if (etag) { + /** + * The server generating a 304 response MUST generate any of the + * following header fields that would have been sent in a 200 (OK) + * response to the same request: Cache-Control, Content-Location, Date, + * ETag, Expires, and Vary. https://tools.ietf.org/html/rfc7232#section-4.1 + */ res.setHeader('ETag', etag); + } + if (fresh(req.headers, { + etag + })) { + res.statusCode = 304; + res.end(); + return true; + } + return false; +} +export async function sendRenderResult({ req, res, result, generateEtags, poweredByHeader, cacheControl }) { + if (isResSent(res)) { + return; + } + if (poweredByHeader && result.contentType === HTML_CONTENT_TYPE_HEADER) { + res.setHeader('X-Powered-By', 'Next.js'); + } + // If cache control is already set on the response we don't + // override it to allow users to customize it via next.config + if (cacheControl && !res.getHeader('Cache-Control')) { + res.setHeader('Cache-Control', getCacheControlHeader(cacheControl)); + } + const payload = result.isDynamic ? null : result.toUnchunkedString(); + if (generateEtags && payload !== null) { + const etag = generateETag(payload); + if (sendEtagResponse(req, res, etag)) { + return; + } + } + if (!res.getHeader('Content-Type') && result.contentType) { + res.setHeader('Content-Type', result.contentType); + } + if (payload) { + res.setHeader('Content-Length', Buffer.byteLength(payload)); + } + if (req.method === 'HEAD') { + res.end(null); + return; + } + if (payload !== null) { + res.end(payload); + return; + } + // Pipe the render result to the response after we get a writer for it. + await result.pipeToNodeResponse(res); +} + +//# sourceMappingURL=send-payload.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/send-payload.js.map b/e-commerce/node_modules/next/dist/esm/server/send-payload.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6bbef3e778fd7b5bea6819b387209c136342bc68 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/send-payload.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/server/send-payload.ts"],"sourcesContent":["import type { IncomingMessage, ServerResponse } from 'http'\nimport type RenderResult from './render-result'\nimport type { CacheControl } from './lib/cache-control'\n\nimport { isResSent } from '../shared/lib/utils'\nimport { generateETag } from './lib/etag'\nimport fresh from 'next/dist/compiled/fresh'\nimport { getCacheControlHeader } from './lib/cache-control'\nimport { HTML_CONTENT_TYPE_HEADER } from '../lib/constants'\n\nexport function sendEtagResponse(\n req: IncomingMessage,\n res: ServerResponse,\n etag: string | undefined\n): boolean {\n if (etag) {\n /**\n * The server generating a 304 response MUST generate any of the\n * following header fields that would have been sent in a 200 (OK)\n * response to the same request: Cache-Control, Content-Location, Date,\n * ETag, Expires, and Vary. https://tools.ietf.org/html/rfc7232#section-4.1\n */\n res.setHeader('ETag', etag)\n }\n\n if (fresh(req.headers, { etag })) {\n res.statusCode = 304\n res.end()\n return true\n }\n\n return false\n}\n\nexport async function sendRenderResult({\n req,\n res,\n result,\n generateEtags,\n poweredByHeader,\n cacheControl,\n}: {\n req: IncomingMessage\n res: ServerResponse\n result: RenderResult\n generateEtags: boolean\n poweredByHeader: boolean\n cacheControl: CacheControl | undefined\n}): Promise {\n if (isResSent(res)) {\n return\n }\n\n if (poweredByHeader && result.contentType === HTML_CONTENT_TYPE_HEADER) {\n res.setHeader('X-Powered-By', 'Next.js')\n }\n\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheControl && !res.getHeader('Cache-Control')) {\n res.setHeader('Cache-Control', getCacheControlHeader(cacheControl))\n }\n\n const payload = result.isDynamic ? null : result.toUnchunkedString()\n\n if (generateEtags && payload !== null) {\n const etag = generateETag(payload)\n if (sendEtagResponse(req, res, etag)) {\n return\n }\n }\n\n if (!res.getHeader('Content-Type') && result.contentType) {\n res.setHeader('Content-Type', result.contentType)\n }\n\n if (payload) {\n res.setHeader('Content-Length', Buffer.byteLength(payload))\n }\n\n if (req.method === 'HEAD') {\n res.end(null)\n return\n }\n\n if (payload !== null) {\n res.end(payload)\n return\n }\n\n // Pipe the render result to the response after we get a writer for it.\n await result.pipeToNodeResponse(res)\n}\n"],"names":["isResSent","generateETag","fresh","getCacheControlHeader","HTML_CONTENT_TYPE_HEADER","sendEtagResponse","req","res","etag","setHeader","headers","statusCode","end","sendRenderResult","result","generateEtags","poweredByHeader","cacheControl","contentType","getHeader","payload","isDynamic","toUnchunkedString","Buffer","byteLength","method","pipeToNodeResponse"],"mappings":"AAIA,SAASA,SAAS,QAAQ,sBAAqB;AAC/C,SAASC,YAAY,QAAQ,aAAY;AACzC,OAAOC,WAAW,2BAA0B;AAC5C,SAASC,qBAAqB,QAAQ,sBAAqB;AAC3D,SAASC,wBAAwB,QAAQ,mBAAkB;AAE3D,OAAO,SAASC,iBACdC,GAAoB,EACpBC,GAAmB,EACnBC,IAAwB;IAExB,IAAIA,MAAM;QACR;;;;;KAKC,GACDD,IAAIE,SAAS,CAAC,QAAQD;IACxB;IAEA,IAAIN,MAAMI,IAAII,OAAO,EAAE;QAAEF;IAAK,IAAI;QAChCD,IAAII,UAAU,GAAG;QACjBJ,IAAIK,GAAG;QACP,OAAO;IACT;IAEA,OAAO;AACT;AAEA,OAAO,eAAeC,iBAAiB,EACrCP,GAAG,EACHC,GAAG,EACHO,MAAM,EACNC,aAAa,EACbC,eAAe,EACfC,YAAY,EAQb;IACC,IAAIjB,UAAUO,MAAM;QAClB;IACF;IAEA,IAAIS,mBAAmBF,OAAOI,WAAW,KAAKd,0BAA0B;QACtEG,IAAIE,SAAS,CAAC,gBAAgB;IAChC;IAEA,2DAA2D;IAC3D,6DAA6D;IAC7D,IAAIQ,gBAAgB,CAACV,IAAIY,SAAS,CAAC,kBAAkB;QACnDZ,IAAIE,SAAS,CAAC,iBAAiBN,sBAAsBc;IACvD;IAEA,MAAMG,UAAUN,OAAOO,SAAS,GAAG,OAAOP,OAAOQ,iBAAiB;IAElE,IAAIP,iBAAiBK,YAAY,MAAM;QACrC,MAAMZ,OAAOP,aAAamB;QAC1B,IAAIf,iBAAiBC,KAAKC,KAAKC,OAAO;YACpC;QACF;IACF;IAEA,IAAI,CAACD,IAAIY,SAAS,CAAC,mBAAmBL,OAAOI,WAAW,EAAE;QACxDX,IAAIE,SAAS,CAAC,gBAAgBK,OAAOI,WAAW;IAClD;IAEA,IAAIE,SAAS;QACXb,IAAIE,SAAS,CAAC,kBAAkBc,OAAOC,UAAU,CAACJ;IACpD;IAEA,IAAId,IAAImB,MAAM,KAAK,QAAQ;QACzBlB,IAAIK,GAAG,CAAC;QACR;IACF;IAEA,IAAIQ,YAAY,MAAM;QACpBb,IAAIK,GAAG,CAACQ;QACR;IACF;IAEA,uEAAuE;IACvE,MAAMN,OAAOY,kBAAkB,CAACnB;AAClC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/send-response.js b/e-commerce/node_modules/next/dist/esm/server/send-response.js new file mode 100644 index 0000000000000000000000000000000000000000..50c9c0c3ecb6144c108f4c31d3c6ed6ac2e68188 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/send-response.js @@ -0,0 +1,66 @@ +import { isNodeNextResponse } from './base-http/helpers'; +import { pipeToNodeResponse } from './pipe-readable'; +import { splitCookiesString } from './web/utils'; +/** + * Sends the response on the underlying next response object. + * + * @param req the underlying request object + * @param res the underlying response object + * @param response the response to send + */ export async function sendResponse(req, res, response, waitUntil) { + if (// The type check here ensures that `req` is correctly typed, and the + // environment variable check provides dead code elimination. + process.env.NEXT_RUNTIME !== 'edge' && isNodeNextResponse(res)) { + var // Copy over the response headers. + _response_headers; + // Copy over the response status. + res.statusCode = response.status; + res.statusMessage = response.statusText; + // TODO: this is not spec-compliant behavior and we should not restrict + // headers that are allowed to appear many times. + // + // See: + // https://github.com/vercel/next.js/pull/70127 + const headersWithMultipleValuesAllowed = [ + // can add more headers to this list if needed + 'set-cookie', + 'www-authenticate', + 'proxy-authenticate', + 'vary' + ]; + (_response_headers = response.headers) == null ? void 0 : _response_headers.forEach((value, name)=>{ + // `x-middleware-set-cookie` is an internal header not needed for the response + if (name.toLowerCase() === 'x-middleware-set-cookie') { + return; + } + // The append handling is special cased for `set-cookie`. + if (name.toLowerCase() === 'set-cookie') { + // TODO: (wyattjoh) replace with native response iteration when we can upgrade undici + for (const cookie of splitCookiesString(value)){ + res.appendHeader(name, cookie); + } + } else { + // only append the header if it is either not present in the outbound response + // or if the header supports multiple values + const isHeaderPresent = typeof res.getHeader(name) !== 'undefined'; + if (headersWithMultipleValuesAllowed.includes(name.toLowerCase()) || !isHeaderPresent) { + res.appendHeader(name, value); + } + } + }); + /** + * The response can't be directly piped to the underlying response. The + * following is duplicated from the edge runtime handler. + * + * See packages/next/server/next-server.ts + */ const { originalResponse } = res; + // A response body must not be sent for HEAD requests. See https://httpwg.org/specs/rfc9110.html#HEAD + if (response.body && req.method !== 'HEAD') { + await pipeToNodeResponse(response.body, originalResponse, waitUntil); + } else { + originalResponse.end(); + } + } +} + +//# sourceMappingURL=send-response.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/send-response.js.map b/e-commerce/node_modules/next/dist/esm/server/send-response.js.map new file mode 100644 index 0000000000000000000000000000000000000000..489fdd44840d05d2953d012d0e0067463a38b7d9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/send-response.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/server/send-response.ts"],"sourcesContent":["import type { BaseNextRequest, BaseNextResponse } from './base-http'\nimport { isNodeNextResponse } from './base-http/helpers'\n\nimport { pipeToNodeResponse } from './pipe-readable'\nimport { splitCookiesString } from './web/utils'\n\n/**\n * Sends the response on the underlying next response object.\n *\n * @param req the underlying request object\n * @param res the underlying response object\n * @param response the response to send\n */\nexport async function sendResponse(\n req: BaseNextRequest,\n res: BaseNextResponse,\n response: Response,\n waitUntil?: Promise\n): Promise {\n if (\n // The type check here ensures that `req` is correctly typed, and the\n // environment variable check provides dead code elimination.\n process.env.NEXT_RUNTIME !== 'edge' &&\n isNodeNextResponse(res)\n ) {\n // Copy over the response status.\n res.statusCode = response.status\n res.statusMessage = response.statusText\n\n // TODO: this is not spec-compliant behavior and we should not restrict\n // headers that are allowed to appear many times.\n //\n // See:\n // https://github.com/vercel/next.js/pull/70127\n const headersWithMultipleValuesAllowed = [\n // can add more headers to this list if needed\n 'set-cookie',\n 'www-authenticate',\n 'proxy-authenticate',\n 'vary',\n ]\n\n // Copy over the response headers.\n response.headers?.forEach((value, name) => {\n // `x-middleware-set-cookie` is an internal header not needed for the response\n if (name.toLowerCase() === 'x-middleware-set-cookie') {\n return\n }\n\n // The append handling is special cased for `set-cookie`.\n if (name.toLowerCase() === 'set-cookie') {\n // TODO: (wyattjoh) replace with native response iteration when we can upgrade undici\n for (const cookie of splitCookiesString(value)) {\n res.appendHeader(name, cookie)\n }\n } else {\n // only append the header if it is either not present in the outbound response\n // or if the header supports multiple values\n const isHeaderPresent = typeof res.getHeader(name) !== 'undefined'\n if (\n headersWithMultipleValuesAllowed.includes(name.toLowerCase()) ||\n !isHeaderPresent\n ) {\n res.appendHeader(name, value)\n }\n }\n })\n\n /**\n * The response can't be directly piped to the underlying response. The\n * following is duplicated from the edge runtime handler.\n *\n * See packages/next/server/next-server.ts\n */\n\n const { originalResponse } = res\n\n // A response body must not be sent for HEAD requests. See https://httpwg.org/specs/rfc9110.html#HEAD\n if (response.body && req.method !== 'HEAD') {\n await pipeToNodeResponse(response.body, originalResponse, waitUntil)\n } else {\n originalResponse.end()\n }\n }\n}\n"],"names":["isNodeNextResponse","pipeToNodeResponse","splitCookiesString","sendResponse","req","res","response","waitUntil","process","env","NEXT_RUNTIME","statusCode","status","statusMessage","statusText","headersWithMultipleValuesAllowed","headers","forEach","value","name","toLowerCase","cookie","appendHeader","isHeaderPresent","getHeader","includes","originalResponse","body","method","end"],"mappings":"AACA,SAASA,kBAAkB,QAAQ,sBAAqB;AAExD,SAASC,kBAAkB,QAAQ,kBAAiB;AACpD,SAASC,kBAAkB,QAAQ,cAAa;AAEhD;;;;;;CAMC,GACD,OAAO,eAAeC,aACpBC,GAAoB,EACpBC,GAAqB,EACrBC,QAAkB,EAClBC,SAA4B;IAE5B,IACE,qEAAqE;IACrE,6DAA6D;IAC7DC,QAAQC,GAAG,CAACC,YAAY,KAAK,UAC7BV,mBAAmBK,MACnB;YAkBA,kCAAkC;QAClCC;QAlBA,iCAAiC;QACjCD,IAAIM,UAAU,GAAGL,SAASM,MAAM;QAChCP,IAAIQ,aAAa,GAAGP,SAASQ,UAAU;QAEvC,uEAAuE;QACvE,iDAAiD;QACjD,EAAE;QACF,OAAO;QACP,+CAA+C;QAC/C,MAAMC,mCAAmC;YACvC,8CAA8C;YAC9C;YACA;YACA;YACA;SACD;SAGDT,oBAAAA,SAASU,OAAO,qBAAhBV,kBAAkBW,OAAO,CAAC,CAACC,OAAOC;YAChC,8EAA8E;YAC9E,IAAIA,KAAKC,WAAW,OAAO,2BAA2B;gBACpD;YACF;YAEA,yDAAyD;YACzD,IAAID,KAAKC,WAAW,OAAO,cAAc;gBACvC,qFAAqF;gBACrF,KAAK,MAAMC,UAAUnB,mBAAmBgB,OAAQ;oBAC9Cb,IAAIiB,YAAY,CAACH,MAAME;gBACzB;YACF,OAAO;gBACL,8EAA8E;gBAC9E,4CAA4C;gBAC5C,MAAME,kBAAkB,OAAOlB,IAAImB,SAAS,CAACL,UAAU;gBACvD,IACEJ,iCAAiCU,QAAQ,CAACN,KAAKC,WAAW,OAC1D,CAACG,iBACD;oBACAlB,IAAIiB,YAAY,CAACH,MAAMD;gBACzB;YACF;QACF;QAEA;;;;;KAKC,GAED,MAAM,EAAEQ,gBAAgB,EAAE,GAAGrB;QAE7B,qGAAqG;QACrG,IAAIC,SAASqB,IAAI,IAAIvB,IAAIwB,MAAM,KAAK,QAAQ;YAC1C,MAAM3B,mBAAmBK,SAASqB,IAAI,EAAED,kBAAkBnB;QAC5D,OAAO;YACLmB,iBAAiBG,GAAG;QACtB;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/serve-static.js b/e-commerce/node_modules/next/dist/esm/server/serve-static.js new file mode 100644 index 0000000000000000000000000000000000000000..a4b340aeced2fdb68283ad39737cb950b3b94902 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/serve-static.js @@ -0,0 +1,31 @@ +import send from 'next/dist/compiled/send'; +// TODO: Remove this once "send" has updated the "mime", or next.js use custom version of "mime" +// Although "mime" has already add avif in version 2.4.7, "send" is still using mime@1.6.0 +send.mime.define({ + 'image/avif': [ + 'avif' + ], + 'image/x-icns': [ + 'icns' + ], + 'image/jxl': [ + 'jxl' + ], + 'image/heic': [ + 'heic' + ] +}); +export function serveStatic(req, res, path, opts) { + return new Promise((resolve, reject)=>{ + send(req, path, opts).on('directory', ()=>{ + // We don't allow directories to be read. + const err = new Error('No directory access'); + err.code = 'ENOENT'; + reject(err); + }).on('error', reject).pipe(res).on('finish', resolve); + }); +} +export const getContentType = 'getType' in send.mime ? (extWithoutDot)=>send.mime.getType(extWithoutDot) : (extWithoutDot)=>send.mime.lookup(extWithoutDot); +export const getExtension = 'getExtension' in send.mime ? (contentType)=>send.mime.getExtension(contentType) : (contentType)=>send.mime.extension(contentType); + +//# sourceMappingURL=serve-static.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/serve-static.js.map b/e-commerce/node_modules/next/dist/esm/server/serve-static.js.map new file mode 100644 index 0000000000000000000000000000000000000000..976e7dc5c8e82655fdc1f672593ba5bcdf78e913 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/serve-static.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/server/serve-static.ts"],"sourcesContent":["import type { IncomingMessage, ServerResponse } from 'http'\nimport send from 'next/dist/compiled/send'\n\n// TODO: Remove this once \"send\" has updated the \"mime\", or next.js use custom version of \"mime\"\n// Although \"mime\" has already add avif in version 2.4.7, \"send\" is still using mime@1.6.0\nsend.mime.define({\n 'image/avif': ['avif'],\n 'image/x-icns': ['icns'],\n 'image/jxl': ['jxl'],\n 'image/heic': ['heic'],\n})\n\nexport function serveStatic(\n req: IncomingMessage,\n res: ServerResponse,\n path: string,\n opts?: Parameters[2]\n): Promise {\n return new Promise((resolve, reject) => {\n send(req, path, opts)\n .on('directory', () => {\n // We don't allow directories to be read.\n const err: any = new Error('No directory access')\n err.code = 'ENOENT'\n reject(err)\n })\n .on('error', reject)\n .pipe(res)\n .on('finish', resolve)\n })\n}\n\nexport const getContentType: (extWithoutDot: string) => string | null =\n 'getType' in send.mime\n ? (extWithoutDot: string) => send.mime.getType(extWithoutDot)\n : (extWithoutDot: string) => (send.mime as any).lookup(extWithoutDot)\n\nexport const getExtension: (contentType: string) => string | null =\n 'getExtension' in send.mime\n ? (contentType: string) => send.mime.getExtension(contentType)\n : (contentType: string) => (send.mime as any).extension(contentType)\n"],"names":["send","mime","define","serveStatic","req","res","path","opts","Promise","resolve","reject","on","err","Error","code","pipe","getContentType","extWithoutDot","getType","lookup","getExtension","contentType","extension"],"mappings":"AACA,OAAOA,UAAU,0BAAyB;AAE1C,gGAAgG;AAChG,0FAA0F;AAC1FA,KAAKC,IAAI,CAACC,MAAM,CAAC;IACf,cAAc;QAAC;KAAO;IACtB,gBAAgB;QAAC;KAAO;IACxB,aAAa;QAAC;KAAM;IACpB,cAAc;QAAC;KAAO;AACxB;AAEA,OAAO,SAASC,YACdC,GAAoB,EACpBC,GAAmB,EACnBC,IAAY,EACZC,IAAiC;IAEjC,OAAO,IAAIC,QAAQ,CAACC,SAASC;QAC3BV,KAAKI,KAAKE,MAAMC,MACbI,EAAE,CAAC,aAAa;YACf,yCAAyC;YACzC,MAAMC,MAAW,IAAIC,MAAM;YAC3BD,IAAIE,IAAI,GAAG;YACXJ,OAAOE;QACT,GACCD,EAAE,CAAC,SAASD,QACZK,IAAI,CAACV,KACLM,EAAE,CAAC,UAAUF;IAClB;AACF;AAEA,OAAO,MAAMO,iBACX,aAAahB,KAAKC,IAAI,GAClB,CAACgB,gBAA0BjB,KAAKC,IAAI,CAACiB,OAAO,CAACD,iBAC7C,CAACA,gBAA0B,AAACjB,KAAKC,IAAI,CAASkB,MAAM,CAACF,eAAc;AAEzE,OAAO,MAAMG,eACX,kBAAkBpB,KAAKC,IAAI,GACvB,CAACoB,cAAwBrB,KAAKC,IAAI,CAACmB,YAAY,CAACC,eAChD,CAACA,cAAwB,AAACrB,KAAKC,IAAI,CAASqB,SAAS,CAACD,aAAY","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/server-route-utils.js b/e-commerce/node_modules/next/dist/esm/server/server-route-utils.js new file mode 100644 index 0000000000000000000000000000000000000000..18620c1dc74292a5afa1ac199a96b03b1d9fd57e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/server-route-utils.js @@ -0,0 +1,23 @@ +import { getRequestMeta } from './request-meta'; +import { stringify as stringifyQs } from 'querystring'; +// since initial query values are decoded by querystring.parse +// we need to re-encode them here but still allow passing through +// values from rewrites/redirects +export const stringifyQuery = (req, query)=>{ + const initialQuery = getRequestMeta(req, 'initQuery') || {}; + const initialQueryValues = Object.values(initialQuery); + return stringifyQs(query, undefined, undefined, { + encodeURIComponent (value) { + if (value in initialQuery || initialQueryValues.some((initialQueryVal)=>{ + // `value` always refers to a query value, even if it's nested in an array + return Array.isArray(initialQueryVal) ? initialQueryVal.includes(value) : initialQueryVal === value; + })) { + // Encode keys and values from initial query + return encodeURIComponent(value); + } + return value; + } + }); +}; + +//# sourceMappingURL=server-route-utils.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/server-route-utils.js.map b/e-commerce/node_modules/next/dist/esm/server/server-route-utils.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3fe161f6a746264e3a4a97d72de66c5dd0bab501 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/server-route-utils.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/server/server-route-utils.ts"],"sourcesContent":["import type { BaseNextRequest } from './base-http'\nimport type { ParsedUrlQuery } from 'querystring'\n\nimport { getRequestMeta } from './request-meta'\nimport { stringify as stringifyQs } from 'querystring'\n\n// since initial query values are decoded by querystring.parse\n// we need to re-encode them here but still allow passing through\n// values from rewrites/redirects\nexport const stringifyQuery = (req: BaseNextRequest, query: ParsedUrlQuery) => {\n const initialQuery = getRequestMeta(req, 'initQuery') || {}\n const initialQueryValues = Object.values(initialQuery)\n\n return stringifyQs(query, undefined, undefined, {\n encodeURIComponent(value) {\n if (\n value in initialQuery ||\n initialQueryValues.some((initialQueryVal) => {\n // `value` always refers to a query value, even if it's nested in an array\n return Array.isArray(initialQueryVal)\n ? initialQueryVal.includes(value)\n : initialQueryVal === value\n })\n ) {\n // Encode keys and values from initial query\n return encodeURIComponent(value)\n }\n\n return value\n },\n })\n}\n"],"names":["getRequestMeta","stringify","stringifyQs","stringifyQuery","req","query","initialQuery","initialQueryValues","Object","values","undefined","encodeURIComponent","value","some","initialQueryVal","Array","isArray","includes"],"mappings":"AAGA,SAASA,cAAc,QAAQ,iBAAgB;AAC/C,SAASC,aAAaC,WAAW,QAAQ,cAAa;AAEtD,8DAA8D;AAC9D,iEAAiE;AACjE,iCAAiC;AACjC,OAAO,MAAMC,iBAAiB,CAACC,KAAsBC;IACnD,MAAMC,eAAeN,eAAeI,KAAK,gBAAgB,CAAC;IAC1D,MAAMG,qBAAqBC,OAAOC,MAAM,CAACH;IAEzC,OAAOJ,YAAYG,OAAOK,WAAWA,WAAW;QAC9CC,oBAAmBC,KAAK;YACtB,IACEA,SAASN,gBACTC,mBAAmBM,IAAI,CAAC,CAACC;gBACvB,0EAA0E;gBAC1E,OAAOC,MAAMC,OAAO,CAACF,mBACjBA,gBAAgBG,QAAQ,CAACL,SACzBE,oBAAoBF;YAC1B,IACA;gBACA,4CAA4C;gBAC5C,OAAOD,mBAAmBC;YAC5B;YAEA,OAAOA;QACT;IACF;AACF,EAAC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/server-utils.js b/e-commerce/node_modules/next/dist/esm/server/server-utils.js new file mode 100644 index 0000000000000000000000000000000000000000..1d742846137ff8a965eb02fb989810f50880e810 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/server-utils.js @@ -0,0 +1,306 @@ +import { normalizeLocalePath } from '../shared/lib/i18n/normalize-locale-path'; +import { getPathMatch } from '../shared/lib/router/utils/path-match'; +import { getNamedRouteRegex } from '../shared/lib/router/utils/route-regex'; +import { getRouteMatcher } from '../shared/lib/router/utils/route-matcher'; +import { matchHas, prepareDestination } from '../shared/lib/router/utils/prepare-destination'; +import { removeTrailingSlash } from '../shared/lib/router/utils/remove-trailing-slash'; +import { normalizeRscURL } from '../shared/lib/router/utils/app-paths'; +import { NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER, NEXT_CACHE_REVALIDATED_TAGS_HEADER, NEXT_INTERCEPTION_MARKER_PREFIX, NEXT_QUERY_PARAM_PREFIX } from '../lib/constants'; +import { normalizeNextQueryParam } from './web/utils'; +import { decodeQueryPathParameter } from './lib/decode-query-path-parameter'; +import { parseReqUrl } from '../lib/url'; +import { formatUrl } from '../shared/lib/router/utils/format-url'; +function filterInternalQuery(query, paramKeys) { + // this is used to pass query information in rewrites + // but should not be exposed in final query + delete query['nextInternalLocale']; + for(const key in query){ + const isNextQueryPrefix = key !== NEXT_QUERY_PARAM_PREFIX && key.startsWith(NEXT_QUERY_PARAM_PREFIX); + const isNextInterceptionMarkerPrefix = key !== NEXT_INTERCEPTION_MARKER_PREFIX && key.startsWith(NEXT_INTERCEPTION_MARKER_PREFIX); + if (isNextQueryPrefix || isNextInterceptionMarkerPrefix || paramKeys.includes(key)) { + delete query[key]; + } + } +} +export function normalizeCdnUrl(req, paramKeys) { + // make sure to normalize req.url from CDNs to strip dynamic and rewrite + // params from the query which are added during routing + const _parsedUrl = parseReqUrl(req.url); + // we can't normalize if we can't parse + if (!_parsedUrl) { + return req.url; + } + delete _parsedUrl.search; + filterInternalQuery(_parsedUrl.query, paramKeys); + req.url = formatUrl(_parsedUrl); +} +export function interpolateDynamicPath(pathname, params, defaultRouteRegex) { + if (!defaultRouteRegex) return pathname; + for (const param of Object.keys(defaultRouteRegex.groups)){ + const { optional, repeat } = defaultRouteRegex.groups[param]; + let builtParam = `[${repeat ? '...' : ''}${param}]`; + if (optional) { + builtParam = `[${builtParam}]`; + } + let paramValue; + const value = params[param]; + if (Array.isArray(value)) { + paramValue = value.map((v)=>v && encodeURIComponent(v)).join('/'); + } else if (value) { + paramValue = encodeURIComponent(value); + } else { + paramValue = ''; + } + if (paramValue || optional) { + pathname = pathname.replaceAll(builtParam, paramValue); + } + } + return pathname; +} +export function normalizeDynamicRouteParams(query, defaultRouteRegex, defaultRouteMatches, ignoreMissingOptional) { + const isDefaultValueMatch = (candidateValue, defaultValue)=>{ + if (!candidateValue) { + return false; + } + let normalizedCandidateValue = normalizeRscURL(candidateValue); + for(let i = 0; i < 3; i++){ + if (normalizedCandidateValue === defaultValue) { + return true; + } + const decodedCandidateValue = decodeQueryPathParameter(normalizedCandidateValue); + if (decodedCandidateValue === normalizedCandidateValue) { + break; + } + normalizedCandidateValue = decodedCandidateValue; + } + return false; + }; + let hasValidParams = true; + let params = {}; + for (const key of Object.keys(defaultRouteRegex.groups)){ + let value = query[key]; + if (typeof value === 'string') { + value = normalizeRscURL(value); + } else if (Array.isArray(value)) { + value = value.map(normalizeRscURL); + } + // if the value matches the default value we can't rely + // on the parsed params, this is used to signal if we need + // to parse x-now-route-matches or not + const defaultValue = defaultRouteMatches[key]; + const isOptional = defaultRouteRegex.groups[key].optional; + const isDefaultValue = Array.isArray(defaultValue) ? defaultValue.some((defaultVal)=>{ + return Array.isArray(value) ? value.some((val)=>isDefaultValueMatch(val, defaultVal)) : isDefaultValueMatch(value, defaultVal); + }) : Array.isArray(value) ? value.some((val)=>isDefaultValueMatch(val, defaultValue)) : isDefaultValueMatch(value, defaultValue); + if (isDefaultValue || typeof value === 'undefined' && !(isOptional && ignoreMissingOptional)) { + return { + params: {}, + hasValidParams: false + }; + } + // non-provided optional values should be undefined so normalize + // them to undefined + if (isOptional && (!value || Array.isArray(value) && value.length === 1 && // fallback optional catch-all SSG pages have + // [[...paramName]] for the root path on Vercel + (value[0] === 'index' || value[0] === `[[...${key}]]`) || value === 'index' || value === `[[...${key}]]`)) { + value = undefined; + delete query[key]; + } + // query values from the proxy aren't already split into arrays + // so make sure to normalize catch-all values + if (value && typeof value === 'string' && defaultRouteRegex.groups[key].repeat) { + value = value.split('/'); + } + if (value) { + params[key] = value; + } + } + return { + params, + hasValidParams + }; +} +export function getServerUtils({ page, i18n, basePath, rewrites, pageIsDynamic, trailingSlash, caseSensitive }) { + let defaultRouteRegex; + let dynamicRouteMatcher; + let defaultRouteMatches; + if (pageIsDynamic) { + defaultRouteRegex = getNamedRouteRegex(page, { + prefixRouteKeys: false + }); + dynamicRouteMatcher = getRouteMatcher(defaultRouteRegex); + defaultRouteMatches = dynamicRouteMatcher(page); + } + function handleRewrites(req, parsedUrl) { + // Here we deep clone the parsedUrl to avoid mutating the original. We also + // cast this to a mutable type so we can mutate it within this scope. + const rewrittenParsedUrl = structuredClone(parsedUrl); + const rewriteParams = {}; + let fsPathname = rewrittenParsedUrl.pathname; + const matchesPage = ()=>{ + const fsPathnameNoSlash = removeTrailingSlash(fsPathname || ''); + return fsPathnameNoSlash === removeTrailingSlash(page) || (dynamicRouteMatcher == null ? void 0 : dynamicRouteMatcher(fsPathnameNoSlash)); + }; + const checkRewrite = (rewrite)=>{ + const matcher = getPathMatch(rewrite.source + (trailingSlash ? '(/)?' : ''), { + removeUnnamedParams: true, + strict: true, + sensitive: !!caseSensitive + }); + if (!rewrittenParsedUrl.pathname) return false; + let params = matcher(rewrittenParsedUrl.pathname); + if ((rewrite.has || rewrite.missing) && params) { + const hasParams = matchHas(req, rewrittenParsedUrl.query, rewrite.has, rewrite.missing); + if (hasParams) { + Object.assign(params, hasParams); + } else { + params = false; + } + } + if (params) { + const { parsedDestination, destQuery } = prepareDestination({ + appendParamsToQuery: true, + destination: rewrite.destination, + params: params, + query: rewrittenParsedUrl.query + }); + // if the rewrite destination is external break rewrite chain + if (parsedDestination.protocol) { + return true; + } + Object.assign(rewriteParams, destQuery, params); + Object.assign(rewrittenParsedUrl.query, parsedDestination.query); + delete parsedDestination.query; + Object.assign(rewrittenParsedUrl, parsedDestination); + fsPathname = rewrittenParsedUrl.pathname; + if (!fsPathname) return false; + if (basePath) { + fsPathname = fsPathname.replace(new RegExp(`^${basePath}`), '') || '/'; + } + if (i18n) { + const result = normalizeLocalePath(fsPathname, i18n.locales); + fsPathname = result.pathname; + rewrittenParsedUrl.query.nextInternalLocale = result.detectedLocale || params.nextInternalLocale; + } + if (fsPathname === page) { + return true; + } + if (pageIsDynamic && dynamicRouteMatcher) { + const dynamicParams = dynamicRouteMatcher(fsPathname); + if (dynamicParams) { + rewrittenParsedUrl.query = { + ...rewrittenParsedUrl.query, + ...dynamicParams + }; + return true; + } + } + } + return false; + }; + for (const rewrite of rewrites.beforeFiles || []){ + checkRewrite(rewrite); + } + if (fsPathname !== page) { + let finished = false; + for (const rewrite of rewrites.afterFiles || []){ + finished = checkRewrite(rewrite); + if (finished) break; + } + if (!finished && !matchesPage()) { + for (const rewrite of rewrites.fallback || []){ + finished = checkRewrite(rewrite); + if (finished) break; + } + } + } + return { + rewriteParams, + rewrittenParsedUrl + }; + } + function getParamsFromRouteMatches(routeMatchesHeader) { + // If we don't have a default route regex, we can't get params from route + // matches + if (!defaultRouteRegex) return null; + const { groups, routeKeys } = defaultRouteRegex; + const matcher = getRouteMatcher({ + re: { + // Simulate a RegExp match from the \`req.url\` input + exec: (str)=>{ + // Normalize all the prefixed query params. + const obj = Object.fromEntries(new URLSearchParams(str)); + for (const [key, value] of Object.entries(obj)){ + const normalizedKey = normalizeNextQueryParam(key); + if (!normalizedKey) continue; + obj[normalizedKey] = value; + delete obj[key]; + } + // Use all the named route keys. + const result = {}; + for (const keyName of Object.keys(routeKeys)){ + const paramName = routeKeys[keyName]; + // If this param name is not a valid parameter name, then skip it. + if (!paramName) continue; + const group = groups[paramName]; + const value = obj[keyName]; + // When we're missing a required param, we can't match the route. + if (!group.optional && !value) return null; + result[group.pos] = value; + } + return result; + } + }, + groups + }); + const routeMatches = matcher(routeMatchesHeader); + if (!routeMatches) return null; + return routeMatches; + } + function normalizeQueryParams(query, routeParamKeys) { + // this is used to pass query information in rewrites + // but should not be exposed in final query + delete query['nextInternalLocale']; + for (const [key, value] of Object.entries(query)){ + const normalizedKey = normalizeNextQueryParam(key); + if (!normalizedKey) continue; + // Remove the prefixed key from the query params because we want + // to consume it for the dynamic route matcher. + delete query[key]; + routeParamKeys.add(normalizedKey); + if (typeof value === 'undefined') continue; + query[normalizedKey] = Array.isArray(value) ? value.map((v)=>decodeQueryPathParameter(v)) : decodeQueryPathParameter(value); + } + } + return { + handleRewrites, + defaultRouteRegex, + dynamicRouteMatcher, + defaultRouteMatches, + normalizeQueryParams, + getParamsFromRouteMatches, + /** + * Normalize dynamic route params. + * + * @param query - The query params to normalize. + * @param ignoreMissingOptional - Whether to ignore missing optional params. + * @returns The normalized params and whether they are valid. + */ normalizeDynamicRouteParams: (query, ignoreMissingOptional)=>{ + if (!defaultRouteRegex || !defaultRouteMatches) { + return { + params: {}, + hasValidParams: false + }; + } + return normalizeDynamicRouteParams(query, defaultRouteRegex, defaultRouteMatches, ignoreMissingOptional); + }, + normalizeCdnUrl: (req, paramKeys)=>normalizeCdnUrl(req, paramKeys), + interpolateDynamicPath: (pathname, params)=>interpolateDynamicPath(pathname, params, defaultRouteRegex), + filterInternalQuery: (query, paramKeys)=>filterInternalQuery(query, paramKeys) + }; +} +export function getPreviouslyRevalidatedTags(headers, previewModeId) { + return typeof headers[NEXT_CACHE_REVALIDATED_TAGS_HEADER] === 'string' && headers[NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER] === previewModeId ? headers[NEXT_CACHE_REVALIDATED_TAGS_HEADER].split(',') : []; +} + +//# sourceMappingURL=server-utils.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/server-utils.js.map b/e-commerce/node_modules/next/dist/esm/server/server-utils.js.map new file mode 100644 index 0000000000000000000000000000000000000000..175de38911f695e8c17839b70bad028d92cbf73f --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/server-utils.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/server/server-utils.ts"],"sourcesContent":["import type { Rewrite } from '../lib/load-custom-routes'\nimport type { RouteMatchFn } from '../shared/lib/router/utils/route-matcher'\nimport type { NextConfig } from './config'\nimport type { BaseNextRequest } from './base-http'\nimport type { NextUrlWithParsedQuery } from './request-meta'\nimport type { ParsedUrlQuery } from 'querystring'\n\nimport { normalizeLocalePath } from '../shared/lib/i18n/normalize-locale-path'\nimport { getPathMatch } from '../shared/lib/router/utils/path-match'\nimport { getNamedRouteRegex } from '../shared/lib/router/utils/route-regex'\nimport { getRouteMatcher } from '../shared/lib/router/utils/route-matcher'\nimport {\n matchHas,\n prepareDestination,\n} from '../shared/lib/router/utils/prepare-destination'\nimport { removeTrailingSlash } from '../shared/lib/router/utils/remove-trailing-slash'\nimport { normalizeRscURL } from '../shared/lib/router/utils/app-paths'\nimport {\n NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER,\n NEXT_CACHE_REVALIDATED_TAGS_HEADER,\n NEXT_INTERCEPTION_MARKER_PREFIX,\n NEXT_QUERY_PARAM_PREFIX,\n} from '../lib/constants'\nimport { normalizeNextQueryParam } from './web/utils'\nimport type { IncomingHttpHeaders, IncomingMessage } from 'http'\nimport { decodeQueryPathParameter } from './lib/decode-query-path-parameter'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport { parseReqUrl } from '../lib/url'\nimport { formatUrl } from '../shared/lib/router/utils/format-url'\n\nfunction filterInternalQuery(\n query: Record,\n paramKeys: string[]\n) {\n // this is used to pass query information in rewrites\n // but should not be exposed in final query\n delete query['nextInternalLocale']\n\n for (const key in query) {\n const isNextQueryPrefix =\n key !== NEXT_QUERY_PARAM_PREFIX && key.startsWith(NEXT_QUERY_PARAM_PREFIX)\n\n const isNextInterceptionMarkerPrefix =\n key !== NEXT_INTERCEPTION_MARKER_PREFIX &&\n key.startsWith(NEXT_INTERCEPTION_MARKER_PREFIX)\n\n if (\n isNextQueryPrefix ||\n isNextInterceptionMarkerPrefix ||\n paramKeys.includes(key)\n ) {\n delete query[key]\n }\n }\n}\n\nexport function normalizeCdnUrl(\n req: BaseNextRequest | IncomingMessage,\n paramKeys: string[]\n) {\n // make sure to normalize req.url from CDNs to strip dynamic and rewrite\n // params from the query which are added during routing\n const _parsedUrl = parseReqUrl(req.url!)\n\n // we can't normalize if we can't parse\n if (!_parsedUrl) {\n return req.url\n }\n delete (_parsedUrl as any).search\n filterInternalQuery(_parsedUrl.query, paramKeys)\n\n req.url = formatUrl(_parsedUrl)\n}\n\nexport function interpolateDynamicPath(\n pathname: string,\n params: ParsedUrlQuery,\n defaultRouteRegex?: ReturnType | undefined\n) {\n if (!defaultRouteRegex) return pathname\n\n for (const param of Object.keys(defaultRouteRegex.groups)) {\n const { optional, repeat } = defaultRouteRegex.groups[param]\n let builtParam = `[${repeat ? '...' : ''}${param}]`\n\n if (optional) {\n builtParam = `[${builtParam}]`\n }\n\n let paramValue: string\n const value = params[param]\n\n if (Array.isArray(value)) {\n paramValue = value.map((v) => v && encodeURIComponent(v)).join('/')\n } else if (value) {\n paramValue = encodeURIComponent(value)\n } else {\n paramValue = ''\n }\n\n if (paramValue || optional) {\n pathname = pathname.replaceAll(builtParam, paramValue)\n }\n }\n\n return pathname\n}\n\nexport function normalizeDynamicRouteParams(\n query: ParsedUrlQuery,\n defaultRouteRegex: ReturnType,\n defaultRouteMatches: ParsedUrlQuery,\n ignoreMissingOptional: boolean\n) {\n const isDefaultValueMatch = (\n candidateValue: string | undefined,\n defaultValue: string\n ) => {\n if (!candidateValue) {\n return false\n }\n\n let normalizedCandidateValue = normalizeRscURL(candidateValue)\n for (let i = 0; i < 3; i++) {\n if (normalizedCandidateValue === defaultValue) {\n return true\n }\n\n const decodedCandidateValue = decodeQueryPathParameter(\n normalizedCandidateValue\n )\n\n if (decodedCandidateValue === normalizedCandidateValue) {\n break\n }\n\n normalizedCandidateValue = decodedCandidateValue\n }\n\n return false\n }\n\n let hasValidParams = true\n let params: ParsedUrlQuery = {}\n\n for (const key of Object.keys(defaultRouteRegex.groups)) {\n let value: string | string[] | undefined = query[key]\n\n if (typeof value === 'string') {\n value = normalizeRscURL(value)\n } else if (Array.isArray(value)) {\n value = value.map(normalizeRscURL)\n }\n\n // if the value matches the default value we can't rely\n // on the parsed params, this is used to signal if we need\n // to parse x-now-route-matches or not\n const defaultValue = defaultRouteMatches![key]\n const isOptional = defaultRouteRegex!.groups[key].optional\n\n const isDefaultValue = Array.isArray(defaultValue)\n ? defaultValue.some((defaultVal) => {\n return Array.isArray(value)\n ? value.some((val) => isDefaultValueMatch(val, defaultVal))\n : isDefaultValueMatch(value, defaultVal)\n })\n : Array.isArray(value)\n ? value.some((val) => isDefaultValueMatch(val, defaultValue as string))\n : isDefaultValueMatch(value, defaultValue as string)\n\n if (\n isDefaultValue ||\n (typeof value === 'undefined' && !(isOptional && ignoreMissingOptional))\n ) {\n return { params: {}, hasValidParams: false }\n }\n\n // non-provided optional values should be undefined so normalize\n // them to undefined\n if (\n isOptional &&\n (!value ||\n (Array.isArray(value) &&\n value.length === 1 &&\n // fallback optional catch-all SSG pages have\n // [[...paramName]] for the root path on Vercel\n (value[0] === 'index' || value[0] === `[[...${key}]]`)) ||\n value === 'index' ||\n value === `[[...${key}]]`)\n ) {\n value = undefined\n delete query[key]\n }\n\n // query values from the proxy aren't already split into arrays\n // so make sure to normalize catch-all values\n if (\n value &&\n typeof value === 'string' &&\n defaultRouteRegex!.groups[key].repeat\n ) {\n value = value.split('/')\n }\n\n if (value) {\n params[key] = value\n }\n }\n\n return {\n params,\n hasValidParams,\n }\n}\n\nexport function getServerUtils({\n page,\n i18n,\n basePath,\n rewrites,\n pageIsDynamic,\n trailingSlash,\n caseSensitive,\n}: {\n page: string\n i18n?: NextConfig['i18n']\n basePath: string\n rewrites: DeepReadonly<{\n fallback?: ReadonlyArray\n afterFiles?: ReadonlyArray\n beforeFiles?: ReadonlyArray\n }>\n pageIsDynamic: boolean\n trailingSlash?: boolean\n caseSensitive: boolean\n}) {\n let defaultRouteRegex: ReturnType | undefined\n let dynamicRouteMatcher: RouteMatchFn | undefined\n let defaultRouteMatches: ParsedUrlQuery | undefined\n\n if (pageIsDynamic) {\n defaultRouteRegex = getNamedRouteRegex(page, {\n prefixRouteKeys: false,\n })\n dynamicRouteMatcher = getRouteMatcher(defaultRouteRegex)\n defaultRouteMatches = dynamicRouteMatcher(page) as ParsedUrlQuery\n }\n\n function handleRewrites(\n req: BaseNextRequest | IncomingMessage,\n parsedUrl: DeepReadonly\n ) {\n // Here we deep clone the parsedUrl to avoid mutating the original. We also\n // cast this to a mutable type so we can mutate it within this scope.\n const rewrittenParsedUrl = structuredClone(\n parsedUrl\n ) as NextUrlWithParsedQuery\n const rewriteParams: Record = {}\n let fsPathname = rewrittenParsedUrl.pathname\n\n const matchesPage = () => {\n const fsPathnameNoSlash = removeTrailingSlash(fsPathname || '')\n return (\n fsPathnameNoSlash === removeTrailingSlash(page) ||\n dynamicRouteMatcher?.(fsPathnameNoSlash)\n )\n }\n\n const checkRewrite = (rewrite: DeepReadonly): boolean => {\n const matcher = getPathMatch(\n rewrite.source + (trailingSlash ? '(/)?' : ''),\n {\n removeUnnamedParams: true,\n strict: true,\n sensitive: !!caseSensitive,\n }\n )\n\n if (!rewrittenParsedUrl.pathname) return false\n\n let params = matcher(rewrittenParsedUrl.pathname)\n\n if ((rewrite.has || rewrite.missing) && params) {\n const hasParams = matchHas(\n req,\n rewrittenParsedUrl.query,\n rewrite.has as Rewrite['has'],\n rewrite.missing as Rewrite['missing']\n )\n\n if (hasParams) {\n Object.assign(params, hasParams)\n } else {\n params = false\n }\n }\n\n if (params) {\n const { parsedDestination, destQuery } = prepareDestination({\n appendParamsToQuery: true,\n destination: rewrite.destination,\n params: params,\n query: rewrittenParsedUrl.query,\n })\n\n // if the rewrite destination is external break rewrite chain\n if (parsedDestination.protocol) {\n return true\n }\n\n Object.assign(rewriteParams, destQuery, params)\n Object.assign(rewrittenParsedUrl.query, parsedDestination.query)\n delete (parsedDestination as any).query\n\n Object.assign(rewrittenParsedUrl, parsedDestination)\n\n fsPathname = rewrittenParsedUrl.pathname\n if (!fsPathname) return false\n\n if (basePath) {\n fsPathname = fsPathname.replace(new RegExp(`^${basePath}`), '') || '/'\n }\n\n if (i18n) {\n const result = normalizeLocalePath(fsPathname, i18n.locales)\n fsPathname = result.pathname\n rewrittenParsedUrl.query.nextInternalLocale =\n result.detectedLocale || params.nextInternalLocale\n }\n\n if (fsPathname === page) {\n return true\n }\n\n if (pageIsDynamic && dynamicRouteMatcher) {\n const dynamicParams = dynamicRouteMatcher(fsPathname)\n if (dynamicParams) {\n rewrittenParsedUrl.query = {\n ...rewrittenParsedUrl.query,\n ...dynamicParams,\n }\n return true\n }\n }\n }\n\n return false\n }\n\n for (const rewrite of rewrites.beforeFiles || []) {\n checkRewrite(rewrite)\n }\n\n if (fsPathname !== page) {\n let finished = false\n\n for (const rewrite of rewrites.afterFiles || []) {\n finished = checkRewrite(rewrite)\n if (finished) break\n }\n\n if (!finished && !matchesPage()) {\n for (const rewrite of rewrites.fallback || []) {\n finished = checkRewrite(rewrite)\n if (finished) break\n }\n }\n }\n\n return { rewriteParams, rewrittenParsedUrl }\n }\n\n function getParamsFromRouteMatches(routeMatchesHeader: string) {\n // If we don't have a default route regex, we can't get params from route\n // matches\n if (!defaultRouteRegex) return null\n\n const { groups, routeKeys } = defaultRouteRegex\n\n const matcher = getRouteMatcher({\n re: {\n // Simulate a RegExp match from the \\`req.url\\` input\n exec: (str: string) => {\n // Normalize all the prefixed query params.\n const obj: Record = Object.fromEntries(\n new URLSearchParams(str)\n )\n for (const [key, value] of Object.entries(obj)) {\n const normalizedKey = normalizeNextQueryParam(key)\n if (!normalizedKey) continue\n\n obj[normalizedKey] = value\n delete obj[key]\n }\n\n // Use all the named route keys.\n const result = {} as RegExpExecArray\n for (const keyName of Object.keys(routeKeys)) {\n const paramName = routeKeys[keyName]\n\n // If this param name is not a valid parameter name, then skip it.\n if (!paramName) continue\n\n const group = groups[paramName]\n const value = obj[keyName]\n\n // When we're missing a required param, we can't match the route.\n if (!group.optional && !value) return null\n\n result[group.pos] = value\n }\n\n return result\n },\n },\n groups,\n })\n\n const routeMatches = matcher(routeMatchesHeader)\n if (!routeMatches) return null\n\n return routeMatches\n }\n\n function normalizeQueryParams(\n query: Record,\n routeParamKeys: Set\n ) {\n // this is used to pass query information in rewrites\n // but should not be exposed in final query\n delete query['nextInternalLocale']\n\n for (const [key, value] of Object.entries(query)) {\n const normalizedKey = normalizeNextQueryParam(key)\n if (!normalizedKey) continue\n\n // Remove the prefixed key from the query params because we want\n // to consume it for the dynamic route matcher.\n delete query[key]\n routeParamKeys.add(normalizedKey)\n\n if (typeof value === 'undefined') continue\n\n query[normalizedKey] = Array.isArray(value)\n ? value.map((v) => decodeQueryPathParameter(v))\n : decodeQueryPathParameter(value)\n }\n }\n\n return {\n handleRewrites,\n defaultRouteRegex,\n dynamicRouteMatcher,\n defaultRouteMatches,\n normalizeQueryParams,\n getParamsFromRouteMatches,\n /**\n * Normalize dynamic route params.\n *\n * @param query - The query params to normalize.\n * @param ignoreMissingOptional - Whether to ignore missing optional params.\n * @returns The normalized params and whether they are valid.\n */\n normalizeDynamicRouteParams: (\n query: ParsedUrlQuery,\n ignoreMissingOptional: boolean\n ) => {\n if (!defaultRouteRegex || !defaultRouteMatches) {\n return { params: {}, hasValidParams: false }\n }\n\n return normalizeDynamicRouteParams(\n query,\n defaultRouteRegex,\n defaultRouteMatches,\n ignoreMissingOptional\n )\n },\n\n normalizeCdnUrl: (\n req: BaseNextRequest | IncomingMessage,\n paramKeys: string[]\n ) => normalizeCdnUrl(req, paramKeys),\n\n interpolateDynamicPath: (\n pathname: string,\n params: Record\n ) => interpolateDynamicPath(pathname, params, defaultRouteRegex),\n\n filterInternalQuery: (query: ParsedUrlQuery, paramKeys: string[]) =>\n filterInternalQuery(query, paramKeys),\n }\n}\n\nexport function getPreviouslyRevalidatedTags(\n headers: IncomingHttpHeaders,\n previewModeId: string | undefined\n): string[] {\n return typeof headers[NEXT_CACHE_REVALIDATED_TAGS_HEADER] === 'string' &&\n headers[NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER] === previewModeId\n ? headers[NEXT_CACHE_REVALIDATED_TAGS_HEADER].split(',')\n : []\n}\n"],"names":["normalizeLocalePath","getPathMatch","getNamedRouteRegex","getRouteMatcher","matchHas","prepareDestination","removeTrailingSlash","normalizeRscURL","NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER","NEXT_CACHE_REVALIDATED_TAGS_HEADER","NEXT_INTERCEPTION_MARKER_PREFIX","NEXT_QUERY_PARAM_PREFIX","normalizeNextQueryParam","decodeQueryPathParameter","parseReqUrl","formatUrl","filterInternalQuery","query","paramKeys","key","isNextQueryPrefix","startsWith","isNextInterceptionMarkerPrefix","includes","normalizeCdnUrl","req","_parsedUrl","url","search","interpolateDynamicPath","pathname","params","defaultRouteRegex","param","Object","keys","groups","optional","repeat","builtParam","paramValue","value","Array","isArray","map","v","encodeURIComponent","join","replaceAll","normalizeDynamicRouteParams","defaultRouteMatches","ignoreMissingOptional","isDefaultValueMatch","candidateValue","defaultValue","normalizedCandidateValue","i","decodedCandidateValue","hasValidParams","isOptional","isDefaultValue","some","defaultVal","val","length","undefined","split","getServerUtils","page","i18n","basePath","rewrites","pageIsDynamic","trailingSlash","caseSensitive","dynamicRouteMatcher","prefixRouteKeys","handleRewrites","parsedUrl","rewrittenParsedUrl","structuredClone","rewriteParams","fsPathname","matchesPage","fsPathnameNoSlash","checkRewrite","rewrite","matcher","source","removeUnnamedParams","strict","sensitive","has","missing","hasParams","assign","parsedDestination","destQuery","appendParamsToQuery","destination","protocol","replace","RegExp","result","locales","nextInternalLocale","detectedLocale","dynamicParams","beforeFiles","finished","afterFiles","fallback","getParamsFromRouteMatches","routeMatchesHeader","routeKeys","re","exec","str","obj","fromEntries","URLSearchParams","entries","normalizedKey","keyName","paramName","group","pos","routeMatches","normalizeQueryParams","routeParamKeys","add","getPreviouslyRevalidatedTags","headers","previewModeId"],"mappings":"AAOA,SAASA,mBAAmB,QAAQ,2CAA0C;AAC9E,SAASC,YAAY,QAAQ,wCAAuC;AACpE,SAASC,kBAAkB,QAAQ,yCAAwC;AAC3E,SAASC,eAAe,QAAQ,2CAA0C;AAC1E,SACEC,QAAQ,EACRC,kBAAkB,QACb,iDAAgD;AACvD,SAASC,mBAAmB,QAAQ,mDAAkD;AACtF,SAASC,eAAe,QAAQ,uCAAsC;AACtE,SACEC,sCAAsC,EACtCC,kCAAkC,EAClCC,+BAA+B,EAC/BC,uBAAuB,QAClB,mBAAkB;AACzB,SAASC,uBAAuB,QAAQ,cAAa;AAErD,SAASC,wBAAwB,QAAQ,oCAAmC;AAE5E,SAASC,WAAW,QAAQ,aAAY;AACxC,SAASC,SAAS,QAAQ,wCAAuC;AAEjE,SAASC,oBACPC,KAAoD,EACpDC,SAAmB;IAEnB,qDAAqD;IACrD,2CAA2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OAAOzG,KAAK,CAACE,IAAI;YACjB8G,eAAeC,GAAG,CAACR;YAEnB,IAAI,OAAOjF,UAAU,aAAa;YAElCxB,KAAK,CAACyG,cAAc,GAAGhF,MAAMC,OAAO,CAACF,SACjCA,MAAMG,GAAG,CAAC,CAACC,IAAMhC,yBAAyBgC,MAC1ChC,yBAAyB4B;QAC/B;IACF;IAEA,OAAO;QACLoC;QACA7C;QACA2C;QACAzB;QACA8E;QACAhB;QACA;;;;;;KAMC,GACD/D,6BAA6B,CAC3BhC,OACAkC;YAEA,IAAI,CAACnB,qBAAqB,CAACkB,qBAAqB;gBAC9C,OAAO;oBAAEnB,QAAQ,CAAC;oBAAG2B,gBAAgB;gBAAM;YAC7C;YAEA,OAAOT,4BACLhC,OACAe,mBACAkB,qBACAC;QAEJ;QAEA3B,iBAAiB,CACfC,KACAP,YACGM,gBAAgBC,KAAKP;QAE1BW,wBAAwB,CACtBC,UACAC,SACGF,uBAAuBC,UAAUC,QAAQC;QAE9ChB,qBAAqB,CAACC,OAAuBC,YAC3CF,oBAAoBC,OAAOC;IAC/B;AACF;AAEA,OAAO,SAASiH,6BACdC,OAA4B,EAC5BC,aAAiC;IAEjC,OAAO,OAAOD,OAAO,CAAC3H,mCAAmC,KAAK,YAC5D2H,OAAO,CAAC5H,uCAAuC,KAAK6H,gBAClDD,OAAO,CAAC3H,mCAAmC,CAACyD,KAAK,CAAC,OAClD,EAAE;AACR","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/setup-http-agent-env.js b/e-commerce/node_modules/next/dist/esm/server/setup-http-agent-env.js new file mode 100644 index 0000000000000000000000000000000000000000..90daaf2ee1ea33ba405f1c97f34259f16857f155 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/setup-http-agent-env.js @@ -0,0 +1,17 @@ +import { Agent as HttpAgent } from 'http'; +import { Agent as HttpsAgent } from 'https'; +export function setHttpClientAndAgentOptions(config) { + if (globalThis.__NEXT_HTTP_AGENT) { + // We only need to assign once because we want + // to reuse the same agent for all requests. + return; + } + if (!config) { + throw new Error('Expected config.httpAgentOptions to be an object'); + } + globalThis.__NEXT_HTTP_AGENT_OPTIONS = config.httpAgentOptions; + globalThis.__NEXT_HTTP_AGENT = new HttpAgent(config.httpAgentOptions); + globalThis.__NEXT_HTTPS_AGENT = new HttpsAgent(config.httpAgentOptions); +} + +//# sourceMappingURL=setup-http-agent-env.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/setup-http-agent-env.js.map b/e-commerce/node_modules/next/dist/esm/server/setup-http-agent-env.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ebf60237b091abe8bd094560a221c36c8767d4bd --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/setup-http-agent-env.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/server/setup-http-agent-env.ts"],"sourcesContent":["import type { NextConfig } from '../types'\nimport { Agent as HttpAgent } from 'http'\nimport { Agent as HttpsAgent } from 'https'\n\nexport function setHttpClientAndAgentOptions(config: {\n httpAgentOptions?: NextConfig['httpAgentOptions']\n}) {\n if (globalThis.__NEXT_HTTP_AGENT) {\n // We only need to assign once because we want\n // to reuse the same agent for all requests.\n return\n }\n\n if (!config) {\n throw new Error('Expected config.httpAgentOptions to be an object')\n }\n\n globalThis.__NEXT_HTTP_AGENT_OPTIONS = config.httpAgentOptions\n globalThis.__NEXT_HTTP_AGENT = new HttpAgent(config.httpAgentOptions)\n globalThis.__NEXT_HTTPS_AGENT = new HttpsAgent(config.httpAgentOptions)\n}\n"],"names":["Agent","HttpAgent","HttpsAgent","setHttpClientAndAgentOptions","config","globalThis","__NEXT_HTTP_AGENT","Error","__NEXT_HTTP_AGENT_OPTIONS","httpAgentOptions","__NEXT_HTTPS_AGENT"],"mappings":"AACA,SAASA,SAASC,SAAS,QAAQ,OAAM;AACzC,SAASD,SAASE,UAAU,QAAQ,QAAO;AAE3C,OAAO,SAASC,6BAA6BC,MAE5C;IACC,IAAIC,WAAWC,iBAAiB,EAAE;QAChC,8CAA8C;QAC9C,4CAA4C;QAC5C;IACF;IAEA,IAAI,CAACF,QAAQ;QACX,MAAM,IAAIG,MAAM;IAClB;IAEAF,WAAWG,yBAAyB,GAAGJ,OAAOK,gBAAgB;IAC9DJ,WAAWC,iBAAiB,GAAG,IAAIL,UAAUG,OAAOK,gBAAgB;IACpEJ,WAAWK,kBAAkB,GAAG,IAAIR,WAAWE,OAAOK,gBAAgB;AACxE","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/stream-utils/encoded-tags.js b/e-commerce/node_modules/next/dist/esm/server/stream-utils/encoded-tags.js new file mode 100644 index 0000000000000000000000000000000000000000..6ffd97a88c35413218a956eb984a6ca6d1378748 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/stream-utils/encoded-tags.js @@ -0,0 +1,112 @@ +export const ENCODED_TAGS = { + // opening tags do not have the closing `>` since they can contain other attributes such as `` + OPENING: { + // + HEAD: new Uint8Array([ + 60, + 47, + 104, + 101, + 97, + 100, + 62 + ]), + // + BODY: new Uint8Array([ + 60, + 47, + 98, + 111, + 100, + 121, + 62 + ]), + // + HTML: new Uint8Array([ + 60, + 47, + 104, + 116, + 109, + 108, + 62 + ]), + // + BODY_AND_HTML: new Uint8Array([ + 60, + 47, + 98, + 111, + 100, + 121, + 62, + 60, + 47, + 104, + 116, + 109, + 108, + 62 + ]) + }, + META: { + // Only the match the prefix cause the suffix can be different whether it's xml compatible or not ">" or "/>" + // ` since they can contain other attributes such as ``\n OPENING: {\n // \n HEAD: new Uint8Array([60, 47, 104, 101, 97, 100, 62]),\n // \n BODY: new Uint8Array([60, 47, 98, 111, 100, 121, 62]),\n // \n HTML: new Uint8Array([60, 47, 104, 116, 109, 108, 62]),\n // \n BODY_AND_HTML: new Uint8Array([\n 60, 47, 98, 111, 100, 121, 62, 60, 47, 104, 116, 109, 108, 62,\n ]),\n },\n META: {\n // Only the match the prefix cause the suffix can be different whether it's xml compatible or not \">\" or \"/>\"\n // = maxBufferByteLength) { + flushBuffered(this); + } else if (!flushScheduled) { + flushScheduled = true; + queueMicrotask(()=>{ + flushScheduled = false; + flushBuffered(this); + }); + } + callback(); + }, + flush (callback) { + flushBuffered(this); + callback(); + } + }); +} + +//# sourceMappingURL=node-buffered-transform-stream.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/stream-utils/node-buffered-transform-stream.js.map b/e-commerce/node_modules/next/dist/esm/server/stream-utils/node-buffered-transform-stream.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e4acc9f2dfdeb59cb9e5fabbeaba7f2158067cbc --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/stream-utils/node-buffered-transform-stream.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/stream-utils/node-buffered-transform-stream.ts"],"sourcesContent":["import { Transform } from 'node:stream'\n\n/**\n * Node.js `Transform` that coalesces chunks written in the same microtask into\n * a single `Uint8Array` before pushing downstream, flushing synchronously once\n * the buffer reaches `maxBufferByteLength` (default: never, i.e.\n * microtask-only).\n *\n * This lives in its own module, separate from `stream-ops.node`, so that\n * consumers outside the render layer (e.g. the dev server's React debug\n * channel) can batch Node streams without pulling in `stream-ops.node`'s\n * `react-dom/server` and `react-dom/static` imports. Those resolve to the\n * vendored React only inside aliased app bundles; loaded from the unaliased\n * dev-server runtime they resolve to the app's installed React, which on React\n * 18 has no `react-dom/static` export.\n */\nexport function createNodeBufferedTransformStream(\n maxBufferByteLength: number = Infinity\n): Transform {\n let bufferedChunks: Array = []\n let bufferByteLength = 0\n let flushScheduled = false\n\n function flushBuffered(stream: Transform): void {\n if (bufferedChunks.length === 0) return\n\n const merged = new Uint8Array(bufferByteLength)\n let copiedBytes = 0\n for (let i = 0; i < bufferedChunks.length; i++) {\n const bufferedChunk = bufferedChunks[i]\n merged.set(bufferedChunk, copiedBytes)\n copiedBytes += bufferedChunk.byteLength\n }\n bufferedChunks.length = 0\n bufferByteLength = 0\n stream.push(merged)\n }\n\n return new Transform({\n transform(chunk, _encoding, callback) {\n bufferedChunks.push(chunk)\n bufferByteLength += chunk.byteLength\n\n if (bufferByteLength >= maxBufferByteLength) {\n flushBuffered(this)\n } else if (!flushScheduled) {\n flushScheduled = true\n queueMicrotask(() => {\n flushScheduled = false\n flushBuffered(this)\n })\n }\n callback()\n },\n flush(callback) {\n flushBuffered(this)\n callback()\n },\n })\n}\n"],"names":["Transform","createNodeBufferedTransformStream","maxBufferByteLength","Infinity","bufferedChunks","bufferByteLength","flushScheduled","flushBuffered","stream","length","merged","Uint8Array","copiedBytes","i","bufferedChunk","set","byteLength","push","transform","chunk","_encoding","callback","queueMicrotask","flush"],"mappings":"AAAA,SAASA,SAAS,QAAQ,cAAa;AAEvC;;;;;;;;;;;;;CAaC,GACD,OAAO,SAASC,kCACdC,sBAA8BC,QAAQ;IAEtC,IAAIC,iBAAoC,EAAE;IAC1C,IAAIC,mBAAmB;IACvB,IAAIC,iBAAiB;IAErB,SAASC,cAAcC,MAAiB;QACtC,IAAIJ,eAAeK,MAAM,KAAK,GAAG;QAEjC,MAAMC,SAAS,IAAIC,WAAWN;QAC9B,IAAIO,cAAc;QAClB,IAAK,IAAIC,IAAI,GAAGA,IAAIT,eAAeK,MAAM,EAAEI,IAAK;YAC9C,MAAMC,gBAAgBV,cAAc,CAACS,EAAE;YACvCH,OAAOK,GAAG,CAACD,eAAeF;YAC1BA,eAAeE,cAAcE,UAAU;QACzC;QACAZ,eAAeK,MAAM,GAAG;QACxBJ,mBAAmB;QACnBG,OAAOS,IAAI,CAACP;IACd;IAEA,OAAO,IAAIV,UAAU;QACnBkB,WAAUC,KAAK,EAAEC,SAAS,EAAEC,QAAQ;YAClCjB,eAAea,IAAI,CAACE;YACpBd,oBAAoBc,MAAMH,UAAU;YAEpC,IAAIX,oBAAoBH,qBAAqB;gBAC3CK,cAAc,IAAI;YACpB,OAAO,IAAI,CAACD,gBAAgB;gBAC1BA,iBAAiB;gBACjBgB,eAAe;oBACbhB,iBAAiB;oBACjBC,cAAc,IAAI;gBACpB;YACF;YACAc;QACF;QACAE,OAAMF,QAAQ;YACZd,cAAc,IAAI;YAClBc;QACF;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/stream-utils/node-web-streams-helper.js b/e-commerce/node_modules/next/dist/esm/server/stream-utils/node-web-streams-helper.js new file mode 100644 index 0000000000000000000000000000000000000000..04cf0fbdfdfec7d4cf8cc3fb366a196f505249b5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/stream-utils/node-web-streams-helper.js @@ -0,0 +1,875 @@ +import { getTracer } from '../lib/trace/tracer'; +import { AppRenderSpan } from '../lib/trace/constants'; +import { createPromiseWithResolvers } from '../../shared/lib/promise-with-resolvers'; +import { scheduleImmediate, atLeastOneTask, waitAtLeastOneReactRenderTask } from '../../lib/scheduler'; +import { ENCODED_TAGS } from './encoded-tags'; +import { indexOfUint8Array, isEquivalentUint8Arrays, removeFromUint8Array } from './uint8array-helpers'; +import { MISSING_ROOT_TAGS_ERROR } from '../../shared/lib/errors/constants'; +import { RSC_HEADER, NEXT_ROUTER_PREFETCH_HEADER, NEXT_ROUTER_SEGMENT_PREFETCH_HEADER, NEXT_RSC_UNION_QUERY } from '../../client/components/app-router-headers'; +import { computeCacheBustingSearchParam } from '../../shared/lib/router/utils/cache-busting-search-param'; +function voidCatch() { +// this catcher is designed to be used with pipeTo where we expect the underlying +// pipe implementation to forward errors but we don't want the pipeTo promise to reject +// and be unhandled +} +// We can share the same encoder instance everywhere +// Notably we cannot do the same for TextDecoder because it is stateful +// when handling streaming data +const encoder = new TextEncoder(); +export function chainStreams(...streams) { + // If we have no streams, return an empty stream. This behavior is + // intentional as we're now providing the `RenderResult.EMPTY` value. + if (streams.length === 0) { + return new ReadableStream({ + start (controller) { + controller.close(); + } + }); + } + // If we only have 1 stream we fast path it by returning just this stream + if (streams.length === 1) { + return streams[0]; + } + const { readable, writable } = new TransformStream(); + // We always initiate pipeTo immediately. We know we have at least 2 streams + // so we need to avoid closing the writable when this one finishes. + let promise = streams[0].pipeTo(writable, { + preventClose: true + }); + let i = 1; + for(; i < streams.length - 1; i++){ + const nextStream = streams[i]; + promise = promise.then(()=>nextStream.pipeTo(writable, { + preventClose: true + })); + } + // We can omit the length check because we halted before the last stream and there + // is at least two streams so the lastStream here will always be defined + const lastStream = streams[i]; + promise = promise.then(()=>lastStream.pipeTo(writable)); + // Catch any errors from the streams and ignore them, they will be handled + // by whatever is consuming the readable stream. + promise.catch(voidCatch); + return readable; +} +export function streamFromString(str) { + return new ReadableStream({ + start (controller) { + controller.enqueue(encoder.encode(str)); + controller.close(); + } + }); +} +/** + * Creates a stream that delivers `chunk` and then closes. + * + * The stream is a default stream, and it has to stay one. A byte stream (`type: + * 'bytes'`) transfers the buffer of each chunk that it receives, which detaches + * `chunk`. A caller that keeps `chunk` to serve more than one read, such as an + * in-memory cache handler, loses the data on the first read. + * + * Every reader receives the same `chunk` instance. A reader that modifies it + * changes what later readers see. + */ export function streamFromBuffer(chunk) { + return new ReadableStream({ + start (controller) { + controller.enqueue(chunk); + controller.close(); + } + }); +} +async function streamToChunks(stream) { + const reader = stream.getReader(); + const chunks = []; + while(true){ + const { done, value } = await reader.read(); + if (done) { + break; + } + chunks.push(value); + } + return chunks; +} +function concatUint8Arrays(chunks) { + const totalLength = chunks.reduce((sum, chunk)=>sum + chunk.length, 0); + const result = new Uint8Array(totalLength); + let offset = 0; + for (const chunk of chunks){ + result.set(chunk, offset); + offset += chunk.length; + } + return result; +} +export async function webstreamToUint8Array(stream) { + return concatUint8Arrays(await streamToChunks(stream)); +} +function webToReadable(stream) { + if (process.env.NEXT_RUNTIME === 'edge') { + throw new Error('webToReadable cannot be used in the edge runtime'); + } else { + let Readable; + if (process.env.TURBOPACK) { + Readable = require('node:stream').Readable; + } else if (process.env.__NEXT_BUNDLER === 'Webpack' || process.env.__NEXT_BUNDLER === 'Rspack') { + Readable = __non_webpack_require__('node:stream').Readable; + } else { + Readable = require('node:stream').Readable; + } + if (stream instanceof Readable) { + return stream; + } + return Readable.fromWeb(stream); + } +} +export async function nodestreamToUint8Array(stream) { + const chunks = []; + for await (const chunk of webToReadable(stream)){ + chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk); + } + return Buffer.concat(chunks); +} +export async function streamToUint8Array(stream) { + if (process.env.NEXT_RUNTIME === 'edge') { + // Edge runtime always uses web streams + return webstreamToUint8Array(stream); + } else { + let Readable; + if (process.env.TURBOPACK) { + Readable = require('node:stream').Readable; + } else if (process.env.__NEXT_BUNDLER === 'Webpack' || process.env.__NEXT_BUNDLER === 'Rspack') { + Readable = __non_webpack_require__('node:stream').Readable; + } else { + Readable = require('node:stream').Readable; + } + if (stream instanceof Readable) { + return nodestreamToUint8Array(stream); + } + return webstreamToUint8Array(stream); + } +} +export async function streamToBuffer(stream) { + return Buffer.concat(await streamToChunks(stream)); +} +export async function streamToString(stream, signal) { + const decoder = new TextDecoder('utf-8', { + fatal: true + }); + let string = ''; + for await (const chunk of stream){ + if (signal == null ? void 0 : signal.aborted) { + return string; + } + string += decoder.decode(chunk, { + stream: true + }); + } + string += decoder.decode(); + return string; +} +export function createBufferedTransformStream(options = {}) { + const { maxBufferByteLength = Infinity } = options; + let bufferedChunks = []; + let bufferByteLength = 0; + let pending; + const flush = (controller)=>{ + try { + if (bufferedChunks.length === 0) { + return; + } + const chunk = new Uint8Array(bufferByteLength); + let copiedBytes = 0; + for(let i = 0; i < bufferedChunks.length; i++){ + const bufferedChunk = bufferedChunks[i]; + chunk.set(bufferedChunk, copiedBytes); + copiedBytes += bufferedChunk.byteLength; + } + // We just wrote all the buffered chunks so we need to reset the bufferedChunks array + // and our bufferByteLength to prepare for the next round of buffered chunks + bufferedChunks.length = 0; + bufferByteLength = 0; + controller.enqueue(chunk); + } catch { + // If an error occurs while enqueuing, it can't be due to this + // transformer. It's most likely caused by the controller having been + // errored (for example, if the stream was cancelled). + } + }; + const scheduleFlush = (controller)=>{ + if (pending) { + return; + } + const detached = createPromiseWithResolvers(); + pending = detached; + scheduleImmediate(()=>{ + try { + flush(controller); + } finally{ + pending = undefined; + detached.resolve(); + } + }); + }; + return new TransformStream({ + transform (chunk, controller) { + // Combine the previous buffer with the new chunk. + bufferedChunks.push(chunk); + bufferByteLength += chunk.byteLength; + if (bufferByteLength >= maxBufferByteLength) { + flush(controller); + } else { + scheduleFlush(controller); + } + }, + flush () { + return pending == null ? void 0 : pending.promise; + } + }); +} +// TODO this is currently unused but once we add proper output:export support, it needs to be +// revisited. See https://github.com/vercel/next.js/pull/89478 for more details +// +// function createPrefetchCommentStream( +// isBuildTimePrerendering: boolean, +// buildId: string +// ): TransformStream { +// // Insert an extra comment at the beginning of the HTML document. This must +// // come after the DOCTYPE, which is inserted by React. +// // +// // The first chunk sent by React will contain the doctype. After that, we can +// // pass through the rest of the chunks as-is. +// let didTransformFirstChunk = false +// return new TransformStream({ +// transform(chunk, controller) { +// if (isBuildTimePrerendering && !didTransformFirstChunk) { +// didTransformFirstChunk = true +// const decoder = new TextDecoder('utf-8', { fatal: true }) +// const chunkStr = decoder.decode(chunk, { +// stream: true, +// }) +// const updatedChunkStr = insertBuildIdComment(chunkStr, buildId) +// controller.enqueue(encoder.encode(updatedChunkStr)) +// return +// } +// controller.enqueue(chunk) +// }, +// }) +// } +export function renderToInitialFizzStream({ ReactDOMServer, element, streamOptions }) { + return getTracer().trace(AppRenderSpan.renderToReadableStream, async ()=>ReactDOMServer.renderToReadableStream(element, streamOptions)); +} +export function createMetadataTransformStream(insert) { + let chunkIndex = -1; + let isMarkRemoved = false; + return new TransformStream({ + async transform (chunk, controller) { + let iconMarkIndex = -1; + let closedHeadIndex = -1; + chunkIndex++; + if (isMarkRemoved) { + controller.enqueue(chunk); + return; + } + let iconMarkLength = 0; + // Only search for the closed head tag once + if (iconMarkIndex === -1) { + iconMarkIndex = indexOfUint8Array(chunk, ENCODED_TAGS.META.ICON_MARK); + if (iconMarkIndex === -1) { + controller.enqueue(chunk); + return; + } else { + // When we found the `` or `>`, checking the next char to ensure we cover both cases. + iconMarkLength = ENCODED_TAGS.META.ICON_MARK.length; + // Check if next char is /, this is for xml mode. + if (chunk[iconMarkIndex + iconMarkLength] === 47) { + iconMarkLength += 2; + } else { + // The last char is `>` + iconMarkLength++; + } + } + } + // Check if icon mark is inside tag in the first chunk. + if (chunkIndex === 0) { + closedHeadIndex = indexOfUint8Array(chunk, ENCODED_TAGS.CLOSED.HEAD); + if (iconMarkIndex !== -1) { + // The mark icon is located in the 1st chunk before the head tag. + // We do not need to insert the script tag in this case because it's in the head. + // Just remove the icon mark from the chunk. + if (iconMarkIndex < closedHeadIndex) { + const replaced = new Uint8Array(chunk.length - iconMarkLength); + // Remove the icon mark from the chunk. + replaced.set(chunk.subarray(0, iconMarkIndex)); + replaced.set(chunk.subarray(iconMarkIndex + iconMarkLength), iconMarkIndex); + chunk = replaced; + } else { + // The icon mark is after the head tag, replace and insert the script tag at that position. + const insertion = await insert(); + const encodedInsertion = encoder.encode(insertion); + const insertionLength = encodedInsertion.length; + const replaced = new Uint8Array(chunk.length - iconMarkLength + insertionLength); + replaced.set(chunk.subarray(0, iconMarkIndex)); + replaced.set(encodedInsertion, iconMarkIndex); + replaced.set(chunk.subarray(iconMarkIndex + iconMarkLength), iconMarkIndex + insertionLength); + chunk = replaced; + } + isMarkRemoved = true; + } + // If there's no icon mark located, it will be handled later when if present in the following chunks. + } else { + // When it's appeared in the following chunks, we'll need to + // remove the mark and then insert the script tag at that position. + const insertion = await insert(); + const encodedInsertion = encoder.encode(insertion); + const insertionLength = encodedInsertion.length; + // Replace the icon mark with the hoist script or empty string. + const replaced = new Uint8Array(chunk.length - iconMarkLength + insertionLength); + // Set the first part of the chunk, before the icon mark. + replaced.set(chunk.subarray(0, iconMarkIndex)); + // Set the insertion after the icon mark. + replaced.set(encodedInsertion, iconMarkIndex); + // Set the rest of the chunk after the icon mark. + replaced.set(chunk.subarray(iconMarkIndex + iconMarkLength), iconMarkIndex + insertionLength); + chunk = replaced; + isMarkRemoved = true; + } + controller.enqueue(chunk); + } + }); +} +export function createHeadInsertionTransformStream(insert) { + let inserted = false; + // We need to track if this transform saw any bytes because if it didn't + // we won't want to insert any server HTML at all + let hasBytes = false; + return new TransformStream({ + async transform (chunk, controller) { + hasBytes = true; + const insertion = await insert(); + if (inserted) { + if (insertion) { + const encodedInsertion = encoder.encode(insertion); + controller.enqueue(encodedInsertion); + } + controller.enqueue(chunk); + } else { + // TODO (@Ethan-Arrowood): Replace the generic `indexOfUint8Array` method with something finely tuned for the subset of things actually being checked for. + const index = indexOfUint8Array(chunk, ENCODED_TAGS.CLOSED.HEAD); + // In fully static rendering or non PPR rendering cases: + // `/head>` will always be found in the chunk in first chunk rendering. + if (index !== -1) { + if (insertion) { + const encodedInsertion = encoder.encode(insertion); + // Get the total count of the bytes in the chunk and the insertion + // e.g. + // chunk = + // insertion = + // output = [ ] + const insertedHeadContent = new Uint8Array(chunk.length + encodedInsertion.length); + // Append the first part of the chunk, before the head tag + insertedHeadContent.set(chunk.slice(0, index)); + // Append the server inserted content + insertedHeadContent.set(encodedInsertion, index); + // Append the rest of the chunk + insertedHeadContent.set(chunk.slice(index), index + encodedInsertion.length); + controller.enqueue(insertedHeadContent); + } else { + controller.enqueue(chunk); + } + inserted = true; + } else { + // This will happens in PPR rendering during next start, when the page is partially rendered. + // When the page resumes, the head tag will be found in the middle of the chunk. + // Where we just need to append the insertion and chunk to the current stream. + // e.g. + // PPR-static: ... [ resume content ] + // PPR-resume: [ insertion ] [ rest content ] + if (insertion) { + controller.enqueue(encoder.encode(insertion)); + } + controller.enqueue(chunk); + inserted = true; + } + } + }, + async flush (controller) { + // Check before closing if there's anything remaining to insert. + if (hasBytes) { + const insertion = await insert(); + if (insertion) { + controller.enqueue(encoder.encode(insertion)); + } + } + } + }); +} +async function createClientResumeScriptInsertionTransformStream() { + const segmentPath = '/_full'; + const cacheBustingHeader = await computeCacheBustingSearchParam('1', '/_full', undefined, undefined // headers[NEXT_URL] + ); + const searchStr = `${NEXT_RSC_UNION_QUERY}=${cacheBustingHeader}`; + const NEXT_CLIENT_RESUME_SCRIPT = ``; + let didAlreadyInsert = false; + return new TransformStream({ + transform (chunk, controller) { + if (didAlreadyInsert) { + // Already inserted the script into the head. Pass through. + controller.enqueue(chunk); + return; + } + // TODO (@Ethan-Arrowood): Replace the generic `indexOfUint8Array` method with something finely tuned for the subset of things actually being checked for. + const headClosingTagIndex = indexOfUint8Array(chunk, ENCODED_TAGS.CLOSED.HEAD); + if (headClosingTagIndex === -1) { + // In fully static rendering or non PPR rendering cases: + // `/head>` will always be found in the chunk in first chunk rendering. + controller.enqueue(chunk); + return; + } + const encodedInsertion = encoder.encode(NEXT_CLIENT_RESUME_SCRIPT); + // Get the total count of the bytes in the chunk and the insertion + // e.g. + // chunk = + // insertion = + // output = [ ] + const insertedHeadContent = new Uint8Array(chunk.length + encodedInsertion.length); + // Append the first part of the chunk, before the head tag + insertedHeadContent.set(chunk.slice(0, headClosingTagIndex)); + // Append the server inserted content + insertedHeadContent.set(encodedInsertion, headClosingTagIndex); + // Append the rest of the chunk + insertedHeadContent.set(chunk.slice(headClosingTagIndex), headClosingTagIndex + encodedInsertion.length); + controller.enqueue(insertedHeadContent); + didAlreadyInsert = true; + } + }); +} +// Suffix after main body content - scripts before , +// but wait for the major chunks to be enqueued. +export function createDeferredSuffixStream(suffix) { + let flushed = false; + let pending; + const flush = (controller)=>{ + const detached = createPromiseWithResolvers(); + pending = detached; + scheduleImmediate(()=>{ + try { + controller.enqueue(encoder.encode(suffix)); + } catch { + // If an error occurs while enqueuing it can't be due to this + // transformers fault. It's likely due to the controller being + // errored due to the stream being cancelled. + } finally{ + pending = undefined; + detached.resolve(); + } + }); + }; + return new TransformStream({ + transform (chunk, controller) { + controller.enqueue(chunk); + // If we've already flushed, we're done. + if (flushed) return; + // Schedule the flush to happen. + flushed = true; + flush(controller); + }, + flush (controller) { + if (pending) return pending.promise; + if (flushed) return; + // Flush now. + controller.enqueue(encoder.encode(suffix)); + } + }); +} +export function createFlightDataInjectionTransformStream(stream, delayDataUntilFirstHtmlChunk) { + let htmlStreamFinished = false; + let pull = null; + let donePulling = false; + function startOrContinuePulling(controller) { + if (!pull) { + pull = startPulling(controller); + } + return pull; + } + async function startPulling(controller) { + const reader = stream.getReader(); + if (delayDataUntilFirstHtmlChunk) { + // NOTE: streaming flush + // We are buffering here for the inlined data stream because the + // "shell" stream might be chunkenized again by the underlying stream + // implementation, e.g. with a specific high-water mark. To ensure it's + // the safe timing to pipe the data stream, this extra tick is + // necessary. + // We don't start reading until we've left the current Task to ensure + // that it's inserted after flushing the shell. Note that this implementation + // might get stale if impl details of Fizz change in the future. + await atLeastOneTask(); + } + try { + while(true){ + const { done, value } = await reader.read(); + if (done) { + donePulling = true; + return; + } + // We want to prioritize HTML over RSC data. + // The SSR render is based on the same RSC stream, so when we get a new RSC chunk, + // we're likely to produce an HTML chunk as well, so give it a chance to flush first. + if (!delayDataUntilFirstHtmlChunk && !htmlStreamFinished) { + await atLeastOneTask(); + } + controller.enqueue(value); + } + } catch (err) { + controller.error(err); + } + } + return new TransformStream({ + start (controller) { + if (!delayDataUntilFirstHtmlChunk) { + startOrContinuePulling(controller); + } + }, + transform (chunk, controller) { + controller.enqueue(chunk); + // Start the streaming if it hasn't already been started yet. + if (delayDataUntilFirstHtmlChunk) { + startOrContinuePulling(controller); + } + }, + flush (controller) { + htmlStreamFinished = true; + if (donePulling) { + return; + } + return startOrContinuePulling(controller); + } + }); +} +export const CLOSE_TAG = ''; +/** + * This transform stream moves the suffix to the end of the stream, so results + * like `` will be transformed to + * ``. + */ export function createMoveSuffixStream() { + let foundSuffix = false; + return new TransformStream({ + transform (chunk, controller) { + if (foundSuffix) { + return controller.enqueue(chunk); + } + const index = indexOfUint8Array(chunk, ENCODED_TAGS.CLOSED.BODY_AND_HTML); + if (index > -1) { + foundSuffix = true; + // If the whole chunk is the suffix, then don't write anything, it will + // be written in the flush. + if (chunk.length === ENCODED_TAGS.CLOSED.BODY_AND_HTML.length) { + return; + } + // Write out the part before the suffix. + const before = chunk.slice(0, index); + controller.enqueue(before); + // In the case where the suffix is in the middle of the chunk, we need + // to split the chunk into two parts. + if (chunk.length > ENCODED_TAGS.CLOSED.BODY_AND_HTML.length + index) { + // Write out the part after the suffix. + const after = chunk.slice(index + ENCODED_TAGS.CLOSED.BODY_AND_HTML.length); + controller.enqueue(after); + } + } else { + controller.enqueue(chunk); + } + }, + flush (controller) { + // Even if we didn't find the suffix, the HTML is not valid if we don't + // add it, so insert it at the end. + controller.enqueue(ENCODED_TAGS.CLOSED.BODY_AND_HTML); + } + }); +} +function createStripDocumentClosingTagsTransform() { + return new TransformStream({ + transform (chunk, controller) { + // We rely on the assumption that chunks will never break across a code unit. + // This is reasonable because we currently concat all of React's output from a single + // flush into one chunk before streaming it forward which means the chunk will represent + // a single coherent utf-8 string. This is not safe to use if we change our streaming to no + // longer do this large buffered chunk + if (isEquivalentUint8Arrays(chunk, ENCODED_TAGS.CLOSED.BODY_AND_HTML) || isEquivalentUint8Arrays(chunk, ENCODED_TAGS.CLOSED.BODY) || isEquivalentUint8Arrays(chunk, ENCODED_TAGS.CLOSED.HTML)) { + // the entire chunk is the closing tags; return without enqueueing anything. + return; + } + // We assume these tags will go at together at the end of the document and that + // they won't appear anywhere else in the document. This is not really a safe assumption + // but until we revamp our streaming infra this is a performant way to string the tags + chunk = removeFromUint8Array(chunk, ENCODED_TAGS.CLOSED.BODY); + chunk = removeFromUint8Array(chunk, ENCODED_TAGS.CLOSED.HTML); + controller.enqueue(chunk); + } + }); +} +export function createHtmlDataDplIdTransformStream(dplId) { + let didTransform = false; + return new TransformStream({ + transform (chunk, controller) { + if (didTransform) { + controller.enqueue(chunk); + return; + } + const htmlTagIndex = indexOfUint8Array(chunk, ENCODED_TAGS.OPENING.HTML); + if (htmlTagIndex === -1) { + controller.enqueue(chunk); + return; + } + // Insert the data-dpl-id attribute right after " -1) { + foundHtml = true; + } + if (!foundBody && indexOfUint8Array(chunk, ENCODED_TAGS.OPENING.BODY) > -1) { + foundBody = true; + } + controller.enqueue(chunk); + }, + flush (controller) { + const missingTags = []; + if (!foundHtml) missingTags.push('html'); + if (!foundBody) missingTags.push('body'); + if (!missingTags.length) return; + controller.enqueue(encoder.encode(` + + `)); + } + }); +} +export function chainTransformers(readable, transformers) { + let stream = readable; + for (const transformer of transformers){ + if (!transformer) continue; + stream = stream.pipeThrough(transformer); + } + return stream; +} +export async function continueFizzStream(renderStream, { suffix, inlinedDataStream, waitForAllReady, deploymentId, getServerInsertedHTML, getServerInsertedMetadata, validateRootLayout }) { + // Suffix itself might contain close tags at the end, so we need to split it. + const suffixUnclosed = suffix ? suffix.split(CLOSE_TAG, 1)[0] : null; + if (waitForAllReady) { + // Wait for all Suspense boundaries to resolve before continuing. + await renderStream.allReady; + } else { + // Otherwise, we want to make sure Fizz is done with all microtasky work + // before we start pulling the stream and cause a flush. + await waitAtLeastOneReactRenderTask(); + } + return chainTransformers(renderStream, [ + // Buffer everything to avoid flushing too frequently + createBufferedTransformStream(), + // Insert data-dpl-id attribute on the html tag + deploymentId ? createHtmlDataDplIdTransformStream(deploymentId) : null, + // Transform metadata + createMetadataTransformStream(getServerInsertedMetadata), + // Insert suffix content + suffixUnclosed != null && suffixUnclosed.length > 0 ? createDeferredSuffixStream(suffixUnclosed) : null, + // Insert the inlined data (Flight data, form state, etc.) stream into the HTML + inlinedDataStream ? createFlightDataInjectionTransformStream(inlinedDataStream, true) : null, + // Validate the root layout for missing html or body tags + validateRootLayout ? createRootLayoutValidatorStream() : null, + // Close tags should always be deferred to the end + createMoveSuffixStream(), + // Special head insertions + // TODO-APP: Insert server side html to end of head in app layout rendering, to avoid + // hydration errors. Remove this once it's ready to be handled by react itself. + createHeadInsertionTransformStream(getServerInsertedHTML) + ]); +} +export async function continueDynamicPrerender(prerenderStream, { getServerInsertedHTML, getServerInsertedMetadata, deploymentId }) { + return chainTransformers(prerenderStream, [ + // Buffer everything to avoid flushing too frequently + createBufferedTransformStream(), + createStripDocumentClosingTagsTransform(), + // Insert data-dpl-id attribute on the html tag + deploymentId ? createHtmlDataDplIdTransformStream(deploymentId) : null, + // Insert generated tags to head + createHeadInsertionTransformStream(getServerInsertedHTML), + // Transform metadata + createMetadataTransformStream(getServerInsertedMetadata) + ]); +} +export async function continueStaticPrerender(prerenderStream, { inlinedDataStream, getServerInsertedHTML, getServerInsertedMetadata, deploymentId }) { + return chainTransformers(prerenderStream, [ + // Buffer everything to avoid flushing too frequently + createBufferedTransformStream(), + // Add build id comment to start of the HTML document (in export mode) + // Insert data-dpl-id attribute on the html tag + deploymentId ? createHtmlDataDplIdTransformStream(deploymentId) : null, + // Insert generated tags to head + createHeadInsertionTransformStream(getServerInsertedHTML), + // Transform metadata + createMetadataTransformStream(getServerInsertedMetadata), + // Insert the inlined data (Flight data, form state, etc.) stream into the HTML + createFlightDataInjectionTransformStream(inlinedDataStream, true), + // Close tags should always be deferred to the end + createMoveSuffixStream() + ]); +} +export async function continueStaticFallbackPrerender(prerenderStream, { inlinedDataStream, getServerInsertedHTML, getServerInsertedMetadata, deploymentId }) { + // Same as `continueStaticPrerender`, but also inserts an additional script + // to instruct the client to start fetching the hydration data as early + // as possible. + return chainTransformers(prerenderStream, [ + // Buffer everything to avoid flushing too frequently + createBufferedTransformStream(), + // Insert data-dpl-id attribute on the html tag + deploymentId ? createHtmlDataDplIdTransformStream(deploymentId) : null, + // Insert generated tags to head + createHeadInsertionTransformStream(getServerInsertedHTML), + // Insert the client resume script into the head + await createClientResumeScriptInsertionTransformStream(), + // Transform metadata + createMetadataTransformStream(getServerInsertedMetadata), + // Insert the inlined data (Flight data, form state, etc.) stream into the HTML + createFlightDataInjectionTransformStream(inlinedDataStream, true), + // Close tags should always be deferred to the end + createMoveSuffixStream() + ]); +} +export async function continueDynamicHTMLResume(renderStream, { delayDataUntilFirstHtmlChunk, inlinedDataStream, getServerInsertedHTML, getServerInsertedMetadata, deploymentId }) { + return chainTransformers(renderStream, [ + // Buffer everything to avoid flushing too frequently + createBufferedTransformStream(), + // Insert data-dpl-id attribute on the html tag + deploymentId ? createHtmlDataDplIdTransformStream(deploymentId) : null, + // Insert generated tags to head + createHeadInsertionTransformStream(getServerInsertedHTML), + // Transform metadata + createMetadataTransformStream(getServerInsertedMetadata), + // Insert the inlined data (Flight data, form state, etc.) stream into the HTML + createFlightDataInjectionTransformStream(inlinedDataStream, delayDataUntilFirstHtmlChunk), + // Close tags should always be deferred to the end + createMoveSuffixStream() + ]); +} +export function createDocumentClosingStream() { + return streamFromString(CLOSE_TAG); +} +// --------------------------------------------------------------------------- +// Runtime prefetch transform (Web streams) +// --------------------------------------------------------------------------- +/** + * Web TransformStream that replaces the runtime prefetch sentinel in an RSC + * payload stream: `[]` -> `[,]`. + * + * This is the web equivalent of createRuntimePrefetchNodeTransform + * in node-stream-helpers.ts. + */ export function createRuntimePrefetchTransformStream(sentinel, isPartial, staleTime) { + const enc = new TextEncoder(); + // Search for: [] + // Replace with: [,] + const search = enc.encode(`[${sentinel}]`); + const first = search[0]; + const replace = enc.encode(`[${isPartial},${staleTime}]`); + const searchLen = search.length; + let currentChunk = null; + let found = false; + function processChunk(controller, nextChunk) { + if (found) { + if (nextChunk) { + controller.enqueue(nextChunk); + } + return; + } + if (currentChunk) { + // We can't search past the index that can contain a full match + let exclusiveUpperBound = currentChunk.length - (searchLen - 1); + if (nextChunk) { + // If we have any overflow bytes we can search up to the chunk's final byte + exclusiveUpperBound += Math.min(nextChunk.length, searchLen - 1); + } + if (exclusiveUpperBound < 1) { + // we can't match the current chunk. + controller.enqueue(currentChunk); + currentChunk = nextChunk // advance so we don't process this chunk again + ; + return; + } + let currentIndex = currentChunk.indexOf(first); + // check the current candidate match if it is within the bounds of our search space for the currentChunk + candidateLoop: while(-1 < currentIndex && currentIndex < exclusiveUpperBound){ + // We already know index 0 matches because we used indexOf to find the candidateIndex so we start at index 1 + let matchIndex = 1; + while(matchIndex < searchLen){ + const candidateIndex = currentIndex + matchIndex; + const candidateValue = candidateIndex < currentChunk.length ? currentChunk[candidateIndex] : nextChunk[candidateIndex - currentChunk.length]; + if (candidateValue !== search[matchIndex]) { + // No match, reset and continue the search from the next position + currentIndex = currentChunk.indexOf(first, currentIndex + 1); + continue candidateLoop; + } + matchIndex++; + } + // We found a complete match. currentIndex is our starting point to replace the value. + found = true; + // enqueue everything up to the match + controller.enqueue(currentChunk.subarray(0, currentIndex)); + // enqueue the replacement value + controller.enqueue(replace); + // If there are bytes in the currentChunk after the match enqueue them + if (currentIndex + searchLen < currentChunk.length) { + controller.enqueue(currentChunk.slice(currentIndex + searchLen)); + } + // If we have a next chunk we enqueue it now + if (nextChunk) { + // if replacement spills over to the next chunk we first exclude the replaced bytes + const overflowBytes = currentIndex + searchLen - currentChunk.length; + const truncatedChunk = overflowBytes > 0 ? nextChunk.subarray(overflowBytes) : nextChunk; + controller.enqueue(truncatedChunk); + } + // We are now in found mode and don't need to track currentChunk anymore + currentChunk = null; + return; + } + // No match found in this chunk, emit it and wait for the next one + controller.enqueue(currentChunk); + } + // Advance to the next chunk + currentChunk = nextChunk; + } + return new TransformStream({ + transform (chunk, controller) { + processChunk(controller, chunk); + }, + flush (controller) { + processChunk(controller, null); + } + }); +} + +//# sourceMappingURL=node-web-streams-helper.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/stream-utils/node-web-streams-helper.js.map b/e-commerce/node_modules/next/dist/esm/server/stream-utils/node-web-streams-helper.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d560885ab5a912fbf05aa74ca262baa3eef281fb --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/stream-utils/node-web-streams-helper.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/stream-utils/node-web-streams-helper.ts"],"sourcesContent":["import type { ReactDOMServerReadableStream } from 'react-dom/server'\nimport { getTracer } from '../lib/trace/tracer'\nimport { AppRenderSpan } from '../lib/trace/constants'\nimport { createPromiseWithResolvers } from '../../shared/lib/promise-with-resolvers'\nimport {\n scheduleImmediate,\n atLeastOneTask,\n waitAtLeastOneReactRenderTask,\n} from '../../lib/scheduler'\nimport { ENCODED_TAGS } from './encoded-tags'\nimport {\n indexOfUint8Array,\n isEquivalentUint8Arrays,\n removeFromUint8Array,\n} from './uint8array-helpers'\nimport { MISSING_ROOT_TAGS_ERROR } from '../../shared/lib/errors/constants'\nimport {\n RSC_HEADER,\n NEXT_ROUTER_PREFETCH_HEADER,\n NEXT_ROUTER_SEGMENT_PREFETCH_HEADER,\n NEXT_RSC_UNION_QUERY,\n} from '../../client/components/app-router-headers'\nimport { computeCacheBustingSearchParam } from '../../shared/lib/router/utils/cache-busting-search-param'\nimport type { AnyStream } from '../app-render/stream-ops'\n\nfunction voidCatch() {\n // this catcher is designed to be used with pipeTo where we expect the underlying\n // pipe implementation to forward errors but we don't want the pipeTo promise to reject\n // and be unhandled\n}\n\n// We can share the same encoder instance everywhere\n// Notably we cannot do the same for TextDecoder because it is stateful\n// when handling streaming data\nconst encoder = new TextEncoder()\n\nexport function chainStreams(\n ...streams: ReadableStream[]\n): ReadableStream {\n // If we have no streams, return an empty stream. This behavior is\n // intentional as we're now providing the `RenderResult.EMPTY` value.\n if (streams.length === 0) {\n return new ReadableStream({\n start(controller) {\n controller.close()\n },\n })\n }\n\n // If we only have 1 stream we fast path it by returning just this stream\n if (streams.length === 1) {\n return streams[0]\n }\n\n const { readable, writable } = new TransformStream()\n\n // We always initiate pipeTo immediately. We know we have at least 2 streams\n // so we need to avoid closing the writable when this one finishes.\n let promise = streams[0].pipeTo(writable, { preventClose: true })\n\n let i = 1\n for (; i < streams.length - 1; i++) {\n const nextStream = streams[i]\n promise = promise.then(() =>\n nextStream.pipeTo(writable, { preventClose: true })\n )\n }\n\n // We can omit the length check because we halted before the last stream and there\n // is at least two streams so the lastStream here will always be defined\n const lastStream = streams[i]\n promise = promise.then(() => lastStream.pipeTo(writable))\n\n // Catch any errors from the streams and ignore them, they will be handled\n // by whatever is consuming the readable stream.\n promise.catch(voidCatch)\n\n return readable\n}\n\nexport function streamFromString(str: string): ReadableStream {\n return new ReadableStream({\n start(controller) {\n controller.enqueue(encoder.encode(str))\n controller.close()\n },\n })\n}\n\n/**\n * Creates a stream that delivers `chunk` and then closes.\n *\n * The stream is a default stream, and it has to stay one. A byte stream (`type:\n * 'bytes'`) transfers the buffer of each chunk that it receives, which detaches\n * `chunk`. A caller that keeps `chunk` to serve more than one read, such as an\n * in-memory cache handler, loses the data on the first read.\n *\n * Every reader receives the same `chunk` instance. A reader that modifies it\n * changes what later readers see.\n */\nexport function streamFromBuffer(chunk: Buffer): ReadableStream {\n return new ReadableStream({\n start(controller) {\n controller.enqueue(chunk)\n controller.close()\n },\n })\n}\n\nasync function streamToChunks(\n stream: ReadableStream\n): Promise> {\n const reader = stream.getReader()\n const chunks: Array = []\n\n while (true) {\n const { done, value } = await reader.read()\n if (done) {\n break\n }\n\n chunks.push(value)\n }\n\n return chunks\n}\n\nfunction concatUint8Arrays(chunks: Array): Uint8Array {\n const totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0)\n const result = new Uint8Array(totalLength)\n let offset = 0\n for (const chunk of chunks) {\n result.set(chunk, offset)\n offset += chunk.length\n }\n return result\n}\n\nexport async function webstreamToUint8Array(\n stream: ReadableStream\n): Promise {\n return concatUint8Arrays(await streamToChunks(stream))\n}\n\nfunction webToReadable(\n stream: ReadableStream | import('node:stream').Readable\n): import('node:stream').Readable {\n if (process.env.NEXT_RUNTIME === 'edge') {\n throw new Error('webToReadable cannot be used in the edge runtime')\n } else {\n let Readable: typeof import('node:stream').Readable\n if (process.env.TURBOPACK) {\n Readable = (require('node:stream') as typeof import('node:stream'))\n .Readable\n } else if (\n process.env.__NEXT_BUNDLER === 'Webpack' ||\n process.env.__NEXT_BUNDLER === 'Rspack'\n ) {\n Readable = (\n __non_webpack_require__('node:stream') as typeof import('node:stream')\n ).Readable\n } else {\n Readable = (require('node:stream') as typeof import('node:stream'))\n .Readable\n }\n if (stream instanceof Readable) {\n return stream\n }\n return Readable.fromWeb(stream as import('stream/web').ReadableStream)\n }\n}\n\nexport async function nodestreamToUint8Array(\n stream: AnyStream\n): Promise {\n const chunks: Buffer[] = []\n for await (const chunk of webToReadable(stream)) {\n chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk)\n }\n return Buffer.concat(chunks)\n}\n\nexport async function streamToUint8Array(stream: AnyStream) {\n if (process.env.NEXT_RUNTIME === 'edge') {\n // Edge runtime always uses web streams\n return webstreamToUint8Array(stream as ReadableStream)\n } else {\n let Readable: typeof import('node:stream').Readable\n if (process.env.TURBOPACK) {\n Readable = (require('node:stream') as typeof import('node:stream'))\n .Readable\n } else if (\n process.env.__NEXT_BUNDLER === 'Webpack' ||\n process.env.__NEXT_BUNDLER === 'Rspack'\n ) {\n Readable = (\n __non_webpack_require__('node:stream') as typeof import('node:stream')\n ).Readable\n } else {\n Readable = (require('node:stream') as typeof import('node:stream'))\n .Readable\n }\n\n if (stream instanceof Readable) {\n return nodestreamToUint8Array(stream)\n }\n\n return webstreamToUint8Array(stream)\n }\n}\n\nexport async function streamToBuffer(\n stream: ReadableStream\n): Promise {\n return Buffer.concat(await streamToChunks(stream))\n}\n\nexport async function streamToString(\n stream: ReadableStream,\n signal?: AbortSignal\n): Promise {\n const decoder = new TextDecoder('utf-8', { fatal: true })\n let string = ''\n\n for await (const chunk of stream) {\n if (signal?.aborted) {\n return string\n }\n\n string += decoder.decode(chunk, { stream: true })\n }\n\n string += decoder.decode()\n\n return string\n}\n\nexport type BufferedTransformOptions = {\n /**\n * Flush synchronously once the buffer reaches this many bytes.\n */\n readonly maxBufferByteLength?: number\n}\n\nexport function createBufferedTransformStream(\n options: BufferedTransformOptions = {}\n): TransformStream {\n const { maxBufferByteLength = Infinity } = options\n\n let bufferedChunks: Array = []\n let bufferByteLength: number = 0\n let pending: PromiseWithResolvers | undefined\n\n const flush = (controller: TransformStreamDefaultController) => {\n try {\n if (bufferedChunks.length === 0) {\n return\n }\n\n const chunk = new Uint8Array(bufferByteLength)\n let copiedBytes = 0\n\n for (let i = 0; i < bufferedChunks.length; i++) {\n const bufferedChunk = bufferedChunks[i]\n chunk.set(bufferedChunk, copiedBytes)\n copiedBytes += bufferedChunk.byteLength\n }\n // We just wrote all the buffered chunks so we need to reset the bufferedChunks array\n // and our bufferByteLength to prepare for the next round of buffered chunks\n bufferedChunks.length = 0\n bufferByteLength = 0\n controller.enqueue(chunk)\n } catch {\n // If an error occurs while enqueuing, it can't be due to this\n // transformer. It's most likely caused by the controller having been\n // errored (for example, if the stream was cancelled).\n }\n }\n\n const scheduleFlush = (controller: TransformStreamDefaultController) => {\n if (pending) {\n return\n }\n\n const detached = createPromiseWithResolvers()\n pending = detached\n\n scheduleImmediate(() => {\n try {\n flush(controller)\n } finally {\n pending = undefined\n detached.resolve()\n }\n })\n }\n\n return new TransformStream({\n transform(chunk, controller) {\n // Combine the previous buffer with the new chunk.\n bufferedChunks.push(chunk)\n bufferByteLength += chunk.byteLength\n\n if (bufferByteLength >= maxBufferByteLength) {\n flush(controller)\n } else {\n scheduleFlush(controller)\n }\n },\n flush() {\n return pending?.promise\n },\n })\n}\n\n// TODO this is currently unused but once we add proper output:export support, it needs to be\n// revisited. See https://github.com/vercel/next.js/pull/89478 for more details\n//\n// function createPrefetchCommentStream(\n// isBuildTimePrerendering: boolean,\n// buildId: string\n// ): TransformStream {\n// // Insert an extra comment at the beginning of the HTML document. This must\n// // come after the DOCTYPE, which is inserted by React.\n// //\n// // The first chunk sent by React will contain the doctype. After that, we can\n// // pass through the rest of the chunks as-is.\n// let didTransformFirstChunk = false\n// return new TransformStream({\n// transform(chunk, controller) {\n// if (isBuildTimePrerendering && !didTransformFirstChunk) {\n// didTransformFirstChunk = true\n// const decoder = new TextDecoder('utf-8', { fatal: true })\n// const chunkStr = decoder.decode(chunk, {\n// stream: true,\n// })\n// const updatedChunkStr = insertBuildIdComment(chunkStr, buildId)\n// controller.enqueue(encoder.encode(updatedChunkStr))\n// return\n// }\n// controller.enqueue(chunk)\n// },\n// })\n// }\n\nexport function renderToInitialFizzStream({\n ReactDOMServer,\n element,\n streamOptions,\n}: {\n ReactDOMServer: {\n renderToReadableStream: typeof import('react-dom/server').renderToReadableStream\n }\n element: React.ReactElement\n streamOptions?: Parameters[1]\n}): Promise {\n return getTracer().trace(AppRenderSpan.renderToReadableStream, async () =>\n ReactDOMServer.renderToReadableStream(element, streamOptions)\n )\n}\n\nexport function createMetadataTransformStream(\n insert: () => Promise | string\n): TransformStream {\n let chunkIndex = -1\n let isMarkRemoved = false\n\n return new TransformStream({\n async transform(chunk, controller) {\n let iconMarkIndex = -1\n let closedHeadIndex = -1\n chunkIndex++\n\n if (isMarkRemoved) {\n controller.enqueue(chunk)\n return\n }\n let iconMarkLength = 0\n // Only search for the closed head tag once\n if (iconMarkIndex === -1) {\n iconMarkIndex = indexOfUint8Array(chunk, ENCODED_TAGS.META.ICON_MARK)\n if (iconMarkIndex === -1) {\n controller.enqueue(chunk)\n return\n } else {\n // When we found the `` or `>`, checking the next char to ensure we cover both cases.\n iconMarkLength = ENCODED_TAGS.META.ICON_MARK.length\n // Check if next char is /, this is for xml mode.\n if (chunk[iconMarkIndex + iconMarkLength] === 47) {\n iconMarkLength += 2\n } else {\n // The last char is `>`\n iconMarkLength++\n }\n }\n }\n\n // Check if icon mark is inside tag in the first chunk.\n if (chunkIndex === 0) {\n closedHeadIndex = indexOfUint8Array(chunk, ENCODED_TAGS.CLOSED.HEAD)\n if (iconMarkIndex !== -1) {\n // The mark icon is located in the 1st chunk before the head tag.\n // We do not need to insert the script tag in this case because it's in the head.\n // Just remove the icon mark from the chunk.\n if (iconMarkIndex < closedHeadIndex) {\n const replaced = new Uint8Array(chunk.length - iconMarkLength)\n\n // Remove the icon mark from the chunk.\n replaced.set(chunk.subarray(0, iconMarkIndex))\n replaced.set(\n chunk.subarray(iconMarkIndex + iconMarkLength),\n iconMarkIndex\n )\n chunk = replaced\n } else {\n // The icon mark is after the head tag, replace and insert the script tag at that position.\n const insertion = await insert()\n const encodedInsertion = encoder.encode(insertion)\n const insertionLength = encodedInsertion.length\n const replaced = new Uint8Array(\n chunk.length - iconMarkLength + insertionLength\n )\n replaced.set(chunk.subarray(0, iconMarkIndex))\n replaced.set(encodedInsertion, iconMarkIndex)\n replaced.set(\n chunk.subarray(iconMarkIndex + iconMarkLength),\n iconMarkIndex + insertionLength\n )\n chunk = replaced\n }\n isMarkRemoved = true\n }\n // If there's no icon mark located, it will be handled later when if present in the following chunks.\n } else {\n // When it's appeared in the following chunks, we'll need to\n // remove the mark and then insert the script tag at that position.\n const insertion = await insert()\n const encodedInsertion = encoder.encode(insertion)\n const insertionLength = encodedInsertion.length\n // Replace the icon mark with the hoist script or empty string.\n const replaced = new Uint8Array(\n chunk.length - iconMarkLength + insertionLength\n )\n // Set the first part of the chunk, before the icon mark.\n replaced.set(chunk.subarray(0, iconMarkIndex))\n // Set the insertion after the icon mark.\n replaced.set(encodedInsertion, iconMarkIndex)\n\n // Set the rest of the chunk after the icon mark.\n replaced.set(\n chunk.subarray(iconMarkIndex + iconMarkLength),\n iconMarkIndex + insertionLength\n )\n chunk = replaced\n isMarkRemoved = true\n }\n controller.enqueue(chunk)\n },\n })\n}\n\nexport function createHeadInsertionTransformStream(\n insert: () => Promise\n): TransformStream {\n let inserted = false\n\n // We need to track if this transform saw any bytes because if it didn't\n // we won't want to insert any server HTML at all\n let hasBytes = false\n\n return new TransformStream({\n async transform(chunk, controller) {\n hasBytes = true\n\n const insertion = await insert()\n if (inserted) {\n if (insertion) {\n const encodedInsertion = encoder.encode(insertion)\n controller.enqueue(encodedInsertion)\n }\n controller.enqueue(chunk)\n } else {\n // TODO (@Ethan-Arrowood): Replace the generic `indexOfUint8Array` method with something finely tuned for the subset of things actually being checked for.\n const index = indexOfUint8Array(chunk, ENCODED_TAGS.CLOSED.HEAD)\n // In fully static rendering or non PPR rendering cases:\n // `/head>` will always be found in the chunk in first chunk rendering.\n if (index !== -1) {\n if (insertion) {\n const encodedInsertion = encoder.encode(insertion)\n // Get the total count of the bytes in the chunk and the insertion\n // e.g.\n // chunk = \n // insertion = \n // output = [ ] \n const insertedHeadContent = new Uint8Array(\n chunk.length + encodedInsertion.length\n )\n // Append the first part of the chunk, before the head tag\n insertedHeadContent.set(chunk.slice(0, index))\n // Append the server inserted content\n insertedHeadContent.set(encodedInsertion, index)\n // Append the rest of the chunk\n insertedHeadContent.set(\n chunk.slice(index),\n index + encodedInsertion.length\n )\n controller.enqueue(insertedHeadContent)\n } else {\n controller.enqueue(chunk)\n }\n inserted = true\n } else {\n // This will happens in PPR rendering during next start, when the page is partially rendered.\n // When the page resumes, the head tag will be found in the middle of the chunk.\n // Where we just need to append the insertion and chunk to the current stream.\n // e.g.\n // PPR-static: ... [ resume content ] \n // PPR-resume: [ insertion ] [ rest content ]\n if (insertion) {\n controller.enqueue(encoder.encode(insertion))\n }\n controller.enqueue(chunk)\n inserted = true\n }\n }\n },\n async flush(controller) {\n // Check before closing if there's anything remaining to insert.\n if (hasBytes) {\n const insertion = await insert()\n if (insertion) {\n controller.enqueue(encoder.encode(insertion))\n }\n }\n },\n })\n}\n\nasync function createClientResumeScriptInsertionTransformStream(): Promise<\n TransformStream\n> {\n const segmentPath = '/_full'\n const cacheBustingHeader = await computeCacheBustingSearchParam(\n '1', // headers[NEXT_ROUTER_PREFETCH_HEADER]\n '/_full', // headers[NEXT_ROUTER_SEGMENT_PREFETCH_HEADER]\n undefined, // headers[NEXT_ROUTER_STATE_TREE_HEADER]\n undefined // headers[NEXT_URL]\n )\n const searchStr = `${NEXT_RSC_UNION_QUERY}=${cacheBustingHeader}`\n const NEXT_CLIENT_RESUME_SCRIPT = ``\n\n let didAlreadyInsert = false\n return new TransformStream({\n transform(chunk, controller) {\n if (didAlreadyInsert) {\n // Already inserted the script into the head. Pass through.\n controller.enqueue(chunk)\n return\n }\n // TODO (@Ethan-Arrowood): Replace the generic `indexOfUint8Array` method with something finely tuned for the subset of things actually being checked for.\n const headClosingTagIndex = indexOfUint8Array(\n chunk,\n ENCODED_TAGS.CLOSED.HEAD\n )\n\n if (headClosingTagIndex === -1) {\n // In fully static rendering or non PPR rendering cases:\n // `/head>` will always be found in the chunk in first chunk rendering.\n controller.enqueue(chunk)\n return\n }\n\n const encodedInsertion = encoder.encode(NEXT_CLIENT_RESUME_SCRIPT)\n // Get the total count of the bytes in the chunk and the insertion\n // e.g.\n // chunk = \n // insertion = \n // output = [ ] \n const insertedHeadContent = new Uint8Array(\n chunk.length + encodedInsertion.length\n )\n // Append the first part of the chunk, before the head tag\n insertedHeadContent.set(chunk.slice(0, headClosingTagIndex))\n // Append the server inserted content\n insertedHeadContent.set(encodedInsertion, headClosingTagIndex)\n // Append the rest of the chunk\n insertedHeadContent.set(\n chunk.slice(headClosingTagIndex),\n headClosingTagIndex + encodedInsertion.length\n )\n\n controller.enqueue(insertedHeadContent)\n didAlreadyInsert = true\n },\n })\n}\n\n// Suffix after main body content - scripts before ,\n// but wait for the major chunks to be enqueued.\nexport function createDeferredSuffixStream(\n suffix: string\n): TransformStream {\n let flushed = false\n let pending: PromiseWithResolvers | undefined\n\n const flush = (controller: TransformStreamDefaultController) => {\n const detached = createPromiseWithResolvers()\n pending = detached\n\n scheduleImmediate(() => {\n try {\n controller.enqueue(encoder.encode(suffix))\n } catch {\n // If an error occurs while enqueuing it can't be due to this\n // transformers fault. It's likely due to the controller being\n // errored due to the stream being cancelled.\n } finally {\n pending = undefined\n detached.resolve()\n }\n })\n }\n\n return new TransformStream({\n transform(chunk, controller) {\n controller.enqueue(chunk)\n\n // If we've already flushed, we're done.\n if (flushed) return\n\n // Schedule the flush to happen.\n flushed = true\n flush(controller)\n },\n flush(controller) {\n if (pending) return pending.promise\n if (flushed) return\n\n // Flush now.\n controller.enqueue(encoder.encode(suffix))\n },\n })\n}\n\nexport function createFlightDataInjectionTransformStream(\n stream: ReadableStream,\n delayDataUntilFirstHtmlChunk: boolean\n): TransformStream {\n let htmlStreamFinished = false\n\n let pull: Promise | null = null\n let donePulling = false\n\n function startOrContinuePulling(\n controller: TransformStreamDefaultController\n ) {\n if (!pull) {\n pull = startPulling(controller)\n }\n return pull\n }\n\n async function startPulling(controller: TransformStreamDefaultController) {\n const reader = stream.getReader()\n\n if (delayDataUntilFirstHtmlChunk) {\n // NOTE: streaming flush\n // We are buffering here for the inlined data stream because the\n // \"shell\" stream might be chunkenized again by the underlying stream\n // implementation, e.g. with a specific high-water mark. To ensure it's\n // the safe timing to pipe the data stream, this extra tick is\n // necessary.\n\n // We don't start reading until we've left the current Task to ensure\n // that it's inserted after flushing the shell. Note that this implementation\n // might get stale if impl details of Fizz change in the future.\n await atLeastOneTask()\n }\n\n try {\n while (true) {\n const { done, value } = await reader.read()\n if (done) {\n donePulling = true\n return\n }\n\n // We want to prioritize HTML over RSC data.\n // The SSR render is based on the same RSC stream, so when we get a new RSC chunk,\n // we're likely to produce an HTML chunk as well, so give it a chance to flush first.\n if (!delayDataUntilFirstHtmlChunk && !htmlStreamFinished) {\n await atLeastOneTask()\n }\n controller.enqueue(value)\n }\n } catch (err) {\n controller.error(err)\n }\n }\n\n return new TransformStream({\n start(controller) {\n if (!delayDataUntilFirstHtmlChunk) {\n startOrContinuePulling(controller)\n }\n },\n transform(chunk, controller) {\n controller.enqueue(chunk)\n\n // Start the streaming if it hasn't already been started yet.\n if (delayDataUntilFirstHtmlChunk) {\n startOrContinuePulling(controller)\n }\n },\n flush(controller) {\n htmlStreamFinished = true\n if (donePulling) {\n return\n }\n return startOrContinuePulling(controller)\n },\n })\n}\n\nexport const CLOSE_TAG = ''\n\n/**\n * This transform stream moves the suffix to the end of the stream, so results\n * like `` will be transformed to\n * ``.\n */\nexport function createMoveSuffixStream(): TransformStream<\n Uint8Array,\n Uint8Array\n> {\n let foundSuffix = false\n\n return new TransformStream({\n transform(chunk, controller) {\n if (foundSuffix) {\n return controller.enqueue(chunk)\n }\n\n const index = indexOfUint8Array(chunk, ENCODED_TAGS.CLOSED.BODY_AND_HTML)\n if (index > -1) {\n foundSuffix = true\n\n // If the whole chunk is the suffix, then don't write anything, it will\n // be written in the flush.\n if (chunk.length === ENCODED_TAGS.CLOSED.BODY_AND_HTML.length) {\n return\n }\n\n // Write out the part before the suffix.\n const before = chunk.slice(0, index)\n controller.enqueue(before)\n\n // In the case where the suffix is in the middle of the chunk, we need\n // to split the chunk into two parts.\n if (chunk.length > ENCODED_TAGS.CLOSED.BODY_AND_HTML.length + index) {\n // Write out the part after the suffix.\n const after = chunk.slice(\n index + ENCODED_TAGS.CLOSED.BODY_AND_HTML.length\n )\n controller.enqueue(after)\n }\n } else {\n controller.enqueue(chunk)\n }\n },\n flush(controller) {\n // Even if we didn't find the suffix, the HTML is not valid if we don't\n // add it, so insert it at the end.\n controller.enqueue(ENCODED_TAGS.CLOSED.BODY_AND_HTML)\n },\n })\n}\n\nfunction createStripDocumentClosingTagsTransform(): TransformStream<\n Uint8Array,\n Uint8Array\n> {\n return new TransformStream({\n transform(chunk, controller) {\n // We rely on the assumption that chunks will never break across a code unit.\n // This is reasonable because we currently concat all of React's output from a single\n // flush into one chunk before streaming it forward which means the chunk will represent\n // a single coherent utf-8 string. This is not safe to use if we change our streaming to no\n // longer do this large buffered chunk\n if (\n isEquivalentUint8Arrays(chunk, ENCODED_TAGS.CLOSED.BODY_AND_HTML) ||\n isEquivalentUint8Arrays(chunk, ENCODED_TAGS.CLOSED.BODY) ||\n isEquivalentUint8Arrays(chunk, ENCODED_TAGS.CLOSED.HTML)\n ) {\n // the entire chunk is the closing tags; return without enqueueing anything.\n return\n }\n\n // We assume these tags will go at together at the end of the document and that\n // they won't appear anywhere else in the document. This is not really a safe assumption\n // but until we revamp our streaming infra this is a performant way to string the tags\n chunk = removeFromUint8Array(chunk, ENCODED_TAGS.CLOSED.BODY)\n chunk = removeFromUint8Array(chunk, ENCODED_TAGS.CLOSED.HTML)\n\n controller.enqueue(chunk)\n },\n })\n}\n\nexport function createHtmlDataDplIdTransformStream(\n dplId: string\n): TransformStream {\n let didTransform = false\n\n return new TransformStream({\n transform(chunk, controller) {\n if (didTransform) {\n controller.enqueue(chunk)\n return\n }\n\n const htmlTagIndex = indexOfUint8Array(chunk, ENCODED_TAGS.OPENING.HTML)\n if (htmlTagIndex === -1) {\n controller.enqueue(chunk)\n return\n }\n\n // Insert the data-dpl-id attribute right after \" {\n let foundHtml = false\n let foundBody = false\n return new TransformStream({\n async transform(chunk, controller) {\n // Peek into the streamed chunk to see if the tags are present.\n if (\n !foundHtml &&\n indexOfUint8Array(chunk, ENCODED_TAGS.OPENING.HTML) > -1\n ) {\n foundHtml = true\n }\n\n if (\n !foundBody &&\n indexOfUint8Array(chunk, ENCODED_TAGS.OPENING.BODY) > -1\n ) {\n foundBody = true\n }\n\n controller.enqueue(chunk)\n },\n flush(controller) {\n const missingTags: ('html' | 'body')[] = []\n if (!foundHtml) missingTags.push('html')\n if (!foundBody) missingTags.push('body')\n\n if (!missingTags.length) return\n\n controller.enqueue(\n encoder.encode(\n `\n `<${c}>`)\n .join(\n missingTags.length > 1 ? ' and ' : ''\n )} tags in the root layout.\\nRead more at https://nextjs.org/docs/messages/missing-root-layout-tags\"\n data-next-error-digest=\"${MISSING_ROOT_TAGS_ERROR}\"\n data-next-error-stack=\"\"\n >\n `\n )\n )\n },\n })\n}\n\nexport function chainTransformers(\n readable: ReadableStream,\n transformers: ReadonlyArray | null>\n): ReadableStream {\n let stream = readable\n for (const transformer of transformers) {\n if (!transformer) continue\n\n stream = stream.pipeThrough(transformer)\n }\n return stream\n}\n\nexport type ContinueStreamOptions = {\n inlinedDataStream: ReadableStream | undefined\n waitForAllReady: boolean\n deploymentId: string | undefined\n getServerInsertedHTML: () => Promise\n getServerInsertedMetadata: () => Promise\n validateRootLayout?: boolean\n /**\n * Suffix to inject after the buffered data, but before the close tags.\n */\n suffix?: string | undefined\n}\n\nexport async function continueFizzStream(\n renderStream: ReactDOMServerReadableStream,\n {\n suffix,\n inlinedDataStream,\n waitForAllReady,\n deploymentId,\n getServerInsertedHTML,\n getServerInsertedMetadata,\n validateRootLayout,\n }: ContinueStreamOptions\n): Promise> {\n // Suffix itself might contain close tags at the end, so we need to split it.\n const suffixUnclosed = suffix ? suffix.split(CLOSE_TAG, 1)[0] : null\n\n if (waitForAllReady) {\n // Wait for all Suspense boundaries to resolve before continuing.\n await renderStream.allReady\n } else {\n // Otherwise, we want to make sure Fizz is done with all microtasky work\n // before we start pulling the stream and cause a flush.\n await waitAtLeastOneReactRenderTask()\n }\n\n return chainTransformers(renderStream, [\n // Buffer everything to avoid flushing too frequently\n createBufferedTransformStream(),\n\n // Insert data-dpl-id attribute on the html tag\n deploymentId ? createHtmlDataDplIdTransformStream(deploymentId) : null,\n\n // Transform metadata\n createMetadataTransformStream(getServerInsertedMetadata),\n\n // Insert suffix content\n suffixUnclosed != null && suffixUnclosed.length > 0\n ? createDeferredSuffixStream(suffixUnclosed)\n : null,\n\n // Insert the inlined data (Flight data, form state, etc.) stream into the HTML\n inlinedDataStream\n ? createFlightDataInjectionTransformStream(inlinedDataStream, true)\n : null,\n\n // Validate the root layout for missing html or body tags\n validateRootLayout ? createRootLayoutValidatorStream() : null,\n\n // Close tags should always be deferred to the end\n createMoveSuffixStream(),\n\n // Special head insertions\n // TODO-APP: Insert server side html to end of head in app layout rendering, to avoid\n // hydration errors. Remove this once it's ready to be handled by react itself.\n createHeadInsertionTransformStream(getServerInsertedHTML),\n ])\n}\n\ntype ContinueDynamicPrerenderOptions = {\n getServerInsertedHTML: () => Promise\n getServerInsertedMetadata: () => Promise\n deploymentId: string | undefined\n}\n\nexport async function continueDynamicPrerender(\n prerenderStream: ReadableStream,\n {\n getServerInsertedHTML,\n getServerInsertedMetadata,\n deploymentId,\n }: ContinueDynamicPrerenderOptions\n) {\n return chainTransformers(prerenderStream, [\n // Buffer everything to avoid flushing too frequently\n createBufferedTransformStream(),\n createStripDocumentClosingTagsTransform(),\n // Insert data-dpl-id attribute on the html tag\n deploymentId ? createHtmlDataDplIdTransformStream(deploymentId) : null,\n // Insert generated tags to head\n createHeadInsertionTransformStream(getServerInsertedHTML),\n // Transform metadata\n createMetadataTransformStream(getServerInsertedMetadata),\n ])\n}\n\ntype ContinueStaticPrerenderOptions = {\n inlinedDataStream: ReadableStream\n getServerInsertedHTML: () => Promise\n getServerInsertedMetadata: () => Promise\n deploymentId: string | undefined\n}\n\nexport async function continueStaticPrerender(\n prerenderStream: ReadableStream,\n {\n inlinedDataStream,\n getServerInsertedHTML,\n getServerInsertedMetadata,\n deploymentId,\n }: ContinueStaticPrerenderOptions\n) {\n return chainTransformers(prerenderStream, [\n // Buffer everything to avoid flushing too frequently\n createBufferedTransformStream(),\n // Add build id comment to start of the HTML document (in export mode)\n // Insert data-dpl-id attribute on the html tag\n deploymentId ? createHtmlDataDplIdTransformStream(deploymentId) : null,\n // Insert generated tags to head\n createHeadInsertionTransformStream(getServerInsertedHTML),\n // Transform metadata\n createMetadataTransformStream(getServerInsertedMetadata),\n // Insert the inlined data (Flight data, form state, etc.) stream into the HTML\n createFlightDataInjectionTransformStream(inlinedDataStream, true),\n // Close tags should always be deferred to the end\n createMoveSuffixStream(),\n ])\n}\n\nexport async function continueStaticFallbackPrerender(\n prerenderStream: ReadableStream,\n {\n inlinedDataStream,\n getServerInsertedHTML,\n getServerInsertedMetadata,\n deploymentId,\n }: ContinueStaticPrerenderOptions\n) {\n // Same as `continueStaticPrerender`, but also inserts an additional script\n // to instruct the client to start fetching the hydration data as early\n // as possible.\n return chainTransformers(prerenderStream, [\n // Buffer everything to avoid flushing too frequently\n createBufferedTransformStream(),\n // Insert data-dpl-id attribute on the html tag\n deploymentId ? createHtmlDataDplIdTransformStream(deploymentId) : null,\n // Insert generated tags to head\n createHeadInsertionTransformStream(getServerInsertedHTML),\n // Insert the client resume script into the head\n await createClientResumeScriptInsertionTransformStream(),\n // Transform metadata\n createMetadataTransformStream(getServerInsertedMetadata),\n // Insert the inlined data (Flight data, form state, etc.) stream into the HTML\n createFlightDataInjectionTransformStream(inlinedDataStream, true),\n // Close tags should always be deferred to the end\n createMoveSuffixStream(),\n ])\n}\n\ntype ContinueResumeOptions = {\n inlinedDataStream: ReadableStream\n getServerInsertedHTML: () => Promise\n getServerInsertedMetadata: () => Promise\n delayDataUntilFirstHtmlChunk: boolean\n deploymentId: string | undefined\n}\n\nexport async function continueDynamicHTMLResume(\n renderStream: ReadableStream,\n {\n delayDataUntilFirstHtmlChunk,\n inlinedDataStream,\n getServerInsertedHTML,\n getServerInsertedMetadata,\n deploymentId,\n }: ContinueResumeOptions\n) {\n return chainTransformers(renderStream, [\n // Buffer everything to avoid flushing too frequently\n createBufferedTransformStream(),\n // Insert data-dpl-id attribute on the html tag\n deploymentId ? createHtmlDataDplIdTransformStream(deploymentId) : null,\n // Insert generated tags to head\n createHeadInsertionTransformStream(getServerInsertedHTML),\n // Transform metadata\n createMetadataTransformStream(getServerInsertedMetadata),\n // Insert the inlined data (Flight data, form state, etc.) stream into the HTML\n createFlightDataInjectionTransformStream(\n inlinedDataStream,\n delayDataUntilFirstHtmlChunk\n ),\n // Close tags should always be deferred to the end\n createMoveSuffixStream(),\n ])\n}\n\nexport function createDocumentClosingStream(): ReadableStream {\n return streamFromString(CLOSE_TAG)\n}\n\n// ---------------------------------------------------------------------------\n// Runtime prefetch transform (Web streams)\n// ---------------------------------------------------------------------------\n\n/**\n * Web TransformStream that replaces the runtime prefetch sentinel in an RSC\n * payload stream: `[]` -> `[,]`.\n *\n * This is the web equivalent of createRuntimePrefetchNodeTransform\n * in node-stream-helpers.ts.\n */\nexport function createRuntimePrefetchTransformStream(\n sentinel: number,\n isPartial: boolean,\n staleTime: number\n): TransformStream {\n const enc = new TextEncoder()\n\n // Search for: []\n // Replace with: [,]\n const search = enc.encode(`[${sentinel}]`)\n const first = search[0]\n const replace = enc.encode(`[${isPartial},${staleTime}]`)\n const searchLen = search.length\n\n let currentChunk: Uint8Array | null = null\n let found = false\n\n function processChunk(\n controller: TransformStreamDefaultController,\n nextChunk: null | Uint8Array\n ) {\n if (found) {\n if (nextChunk) {\n controller.enqueue(nextChunk)\n }\n return\n }\n\n if (currentChunk) {\n // We can't search past the index that can contain a full match\n let exclusiveUpperBound = currentChunk.length - (searchLen - 1)\n if (nextChunk) {\n // If we have any overflow bytes we can search up to the chunk's final byte\n exclusiveUpperBound += Math.min(nextChunk.length, searchLen - 1)\n }\n if (exclusiveUpperBound < 1) {\n // we can't match the current chunk.\n controller.enqueue(currentChunk)\n currentChunk = nextChunk // advance so we don't process this chunk again\n return\n }\n\n let currentIndex = currentChunk.indexOf(first)\n\n // check the current candidate match if it is within the bounds of our search space for the currentChunk\n candidateLoop: while (\n -1 < currentIndex &&\n currentIndex < exclusiveUpperBound\n ) {\n // We already know index 0 matches because we used indexOf to find the candidateIndex so we start at index 1\n let matchIndex = 1\n while (matchIndex < searchLen) {\n const candidateIndex = currentIndex + matchIndex\n const candidateValue =\n candidateIndex < currentChunk.length\n ? currentChunk[candidateIndex]\n : // if we ever hit this condition it is because there is a nextChunk we can read from\n nextChunk![candidateIndex - currentChunk.length]\n if (candidateValue !== search[matchIndex]) {\n // No match, reset and continue the search from the next position\n currentIndex = currentChunk.indexOf(first, currentIndex + 1)\n continue candidateLoop\n }\n matchIndex++\n }\n // We found a complete match. currentIndex is our starting point to replace the value.\n found = true\n // enqueue everything up to the match\n controller.enqueue(currentChunk.subarray(0, currentIndex))\n // enqueue the replacement value\n controller.enqueue(replace)\n // If there are bytes in the currentChunk after the match enqueue them\n if (currentIndex + searchLen < currentChunk.length) {\n controller.enqueue(currentChunk.slice(currentIndex + searchLen))\n }\n // If we have a next chunk we enqueue it now\n if (nextChunk) {\n // if replacement spills over to the next chunk we first exclude the replaced bytes\n const overflowBytes = currentIndex + searchLen - currentChunk.length\n const truncatedChunk =\n overflowBytes > 0 ? nextChunk!.subarray(overflowBytes) : nextChunk\n controller.enqueue(truncatedChunk)\n }\n // We are now in found mode and don't need to track currentChunk anymore\n currentChunk = null\n return\n }\n // No match found in this chunk, emit it and wait for the next one\n controller.enqueue(currentChunk)\n }\n\n // Advance to the next chunk\n currentChunk = nextChunk\n }\n\n return new TransformStream({\n transform(chunk, controller) {\n processChunk(controller, chunk)\n },\n flush(controller) {\n processChunk(controller, null)\n },\n })\n}\n"],"names":["getTracer","AppRenderSpan","createPromiseWithResolvers","scheduleImmediate","atLeastOneTask","waitAtLeastOneReactRenderTask","ENCODED_TAGS","indexOfUint8Array","isEquivalentUint8Arrays","removeFromUint8Array","MISSING_ROOT_TAGS_ERROR","RSC_HEADER","NEXT_ROUTER_PREFETCH_HEADER","NEXT_ROUTER_SEGMENT_PREFETCH_HEADER","NEXT_RSC_UNION_QUERY","computeCacheBustingSearchParam","voidCatch","encoder","TextEncoder","chainStreams","streams","length","ReadableStream","start","controller","close","readable","writable","TransformStream","promise","pipeTo","preventClose","i","nextStream","then","lastStream","catch","streamFromString","str","enqueue","encode","streamFromBuffer","chunk","streamToChunks","stream","reader","getReader","chunks","done","value","read","push","concatUint8Arrays","totalLength","reduce","sum","result","Uint8Array","offset","set","webstreamToUint8Array","webToReadable","process","env","NEXT_RUNTIME","Error","Readable","TURBOPACK","require","__NEXT_BUNDLER","__non_webpack_require__","fromWeb","nodestreamToUint8Array","Buffer","from","concat","streamToUint8Array","streamToBuffer","streamToString","signal","decoder","TextDecoder","fatal","string","aborted","decode","createBufferedTransformStream","options","maxBufferByteLength","Infinity","bufferedChunks","bufferByteLength","pending","flush","copiedBytes","bufferedChunk","byteLength","scheduleFlush","detached","undefined","resolve","transform","renderToInitialFizzStream","ReactDOMServer","element","streamOptions","trace","renderToReadableStream","createMetadataTransformStream","insert","chunkIndex","isMarkRemoved","iconMarkIndex","closedHeadIndex","iconMarkLength","META","ICON_MARK","CLOSED","HEAD","replaced","subarray","insertion","encodedInsertion","insertionLength","createHeadInsertionTransformStream","inserted","hasBytes","index","insertedHeadContent","slice","createClientResumeScriptInsertionTransformStream","segmentPath","cacheBustingHeader","searchStr","NEXT_CLIENT_RESUME_SCRIPT","didAlreadyInsert","headClosingTagIndex","createDeferredSuffixStream","suffix","flushed","createFlightDataInjectionTransformStream","delayDataUntilFirstHtmlChunk","htmlStreamFinished","pull","donePulling","startOrContinuePulling","startPulling","err","error","CLOSE_TAG","createMoveSuffixStream","foundSuffix","BODY_AND_HTML","before","after","createStripDocumentClosingTagsTransform","BODY","HTML","createHtmlDataDplIdTransformStream","dplId","didTransform","htmlTagIndex","OPENING","insertionPoint","attribute","encodedAttribute","modifiedChunk","createRootLayoutValidatorStream","foundHtml","foundBody","missingTags","map","c","join","chainTransformers","transformers","transformer","pipeThrough","continueFizzStream","renderStream","inlinedDataStream","waitForAllReady","deploymentId","getServerInsertedHTML","getServerInsertedMetadata","validateRootLayout","suffixUnclosed","split","allReady","continueDynamicPrerender","prerenderStream","continueStaticPrerender","continueStaticFallbackPrerender","continueDynamicHTMLResume","createDocumentClosingStream","createRuntimePrefetchTransformStream","sentinel","isPartial","staleTime","enc","search","first","replace","searchLen","currentChunk","found","processChunk","nextChunk","exclusiveUpperBound","Math","min","currentIndex","indexOf","candidateLoop","matchIndex","candidateIndex","candidateValue","overflowBytes","truncatedChunk"],"mappings":"AACA,SAASA,SAAS,QAAQ,sBAAqB;AAC/C,SAASC,aAAa,QAAQ,yBAAwB;AACtD,SAASC,0BAA0B,QAAQ,0CAAyC;AACpF,SACEC,iBAAiB,EACjBC,cAAc,EACdC,6BAA6B,QACxB,sBAAqB;AAC5B,SAASC,YAAY,QAAQ,iBAAgB;AAC7C,SACEC,iBAAiB,EACjBC,uBAAuB,EACvBC,oBAAoB,QACf,uBAAsB;AAC7B,SAASC,uBAAuB,QAAQ,oCAAmC;AAC3E,SACEC,UAAU,EACVC,2BAA2B,EAC3BC,mCAAmC,EACnCC,oBAAoB,QACf,6CAA4C;AACnD,SAASC,8BAA8B,QAAQ,2DAA0D;AAGzG,SAASC;AACP,iFAAiF;AACjF,uFAAuF;AACvF,mBAAmB;AACrB;AAEA,oDAAoD;AACpD,uEAAuE;AACvE,+BAA+B;AAC/B,M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ACrB;gBACA,wEAAwE;gBACxEd,eAAe;gBACf;YACF;YACA,kEAAkE;YAClEpL,WAAWe,OAAO,CAACqK;QACrB;QAEA,4BAA4B;QAC5BA,eAAeG;IACjB;IAEA,OAAO,IAAInL,gBAAwC;QACjDyE,WAAU3D,KAAK,EAAElB,UAAU;YACzBsL,aAAatL,YAAYkB;QAC3B;QACAmD,OAAMrE,UAAU;YACdsL,aAAatL,YAAY;QAC3B;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/stream-utils/uint8array-helpers.js b/e-commerce/node_modules/next/dist/esm/server/stream-utils/uint8array-helpers.js new file mode 100644 index 0000000000000000000000000000000000000000..6951b7d97e9cb6abb587dc076f9df03644a833ad --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/stream-utils/uint8array-helpers.js @@ -0,0 +1,56 @@ +/** + * Find the starting index of Uint8Array `b` within Uint8Array `a`. + */ export function indexOfUint8Array(a, b) { + if (b.length === 0) return 0; + if (a.length === 0 || b.length > a.length) return -1; + // Use Node's native implementation when available. + if (typeof Buffer !== 'undefined') { + const haystack = Buffer.isBuffer(a) ? a : Buffer.from(a.buffer, a.byteOffset, a.byteLength); + return haystack.indexOf(b); + } + // start iterating through `a` + for(let i = 0; i <= a.length - b.length; i++){ + let completeMatch = true; + // from index `i`, iterate through `b` and check for mismatch + for(let j = 0; j < b.length; j++){ + // if the values do not match, then this isn't a complete match, exit `b` iteration early and iterate to next index of `a`. + if (a[i + j] !== b[j]) { + completeMatch = false; + break; + } + } + if (completeMatch) { + return i; + } + } + return -1; +} +/** + * Check if two Uint8Arrays are strictly equivalent. + */ export function isEquivalentUint8Arrays(a, b) { + if (a.length !== b.length) return false; + for(let i = 0; i < a.length; i++){ + if (a[i] !== b[i]) return false; + } + return true; +} +/** + * Remove Uint8Array `b` from Uint8Array `a`. + * + * If `b` is not in `a`, `a` is returned unchanged. + * + * Otherwise, the function returns a new Uint8Array instance with size `a.length - b.length` + */ export function removeFromUint8Array(a, b) { + const tagIndex = indexOfUint8Array(a, b); + if (tagIndex === 0) return a.subarray(b.length); + if (tagIndex > -1) { + const removed = new Uint8Array(a.length - b.length); + removed.set(a.subarray(0, tagIndex)); + removed.set(a.subarray(tagIndex + b.length), tagIndex); + return removed; + } else { + return a; + } +} + +//# sourceMappingURL=uint8array-helpers.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/stream-utils/uint8array-helpers.js.map b/e-commerce/node_modules/next/dist/esm/server/stream-utils/uint8array-helpers.js.map new file mode 100644 index 0000000000000000000000000000000000000000..09cecb8c1d7c4134887773dd99146042e0f7cbf7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/stream-utils/uint8array-helpers.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/stream-utils/uint8array-helpers.ts"],"sourcesContent":["/**\n * Find the starting index of Uint8Array `b` within Uint8Array `a`.\n */\nexport function indexOfUint8Array(a: Uint8Array, b: Uint8Array) {\n if (b.length === 0) return 0\n if (a.length === 0 || b.length > a.length) return -1\n\n // Use Node's native implementation when available.\n if (typeof Buffer !== 'undefined') {\n const haystack = Buffer.isBuffer(a)\n ? a\n : Buffer.from(a.buffer, a.byteOffset, a.byteLength)\n return haystack.indexOf(b)\n }\n\n // start iterating through `a`\n for (let i = 0; i <= a.length - b.length; i++) {\n let completeMatch = true\n // from index `i`, iterate through `b` and check for mismatch\n for (let j = 0; j < b.length; j++) {\n // if the values do not match, then this isn't a complete match, exit `b` iteration early and iterate to next index of `a`.\n if (a[i + j] !== b[j]) {\n completeMatch = false\n break\n }\n }\n\n if (completeMatch) {\n return i\n }\n }\n\n return -1\n}\n\n/**\n * Check if two Uint8Arrays are strictly equivalent.\n */\nexport function isEquivalentUint8Arrays(a: Uint8Array, b: Uint8Array) {\n if (a.length !== b.length) return false\n\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false\n }\n\n return true\n}\n\n/**\n * Remove Uint8Array `b` from Uint8Array `a`.\n *\n * If `b` is not in `a`, `a` is returned unchanged.\n *\n * Otherwise, the function returns a new Uint8Array instance with size `a.length - b.length`\n */\nexport function removeFromUint8Array(a: Uint8Array, b: Uint8Array) {\n const tagIndex = indexOfUint8Array(a, b)\n if (tagIndex === 0) return a.subarray(b.length)\n if (tagIndex > -1) {\n const removed = new Uint8Array(a.length - b.length)\n removed.set(a.subarray(0, tagIndex))\n removed.set(a.subarray(tagIndex + b.length), tagIndex)\n return removed\n } else {\n return a\n }\n}\n"],"names":["indexOfUint8Array","a","b","length","Buffer","haystack","isBuffer","from","buffer","byteOffset","byteLength","indexOf","i","completeMatch","j","isEquivalentUint8Arrays","removeFromUint8Array","tagIndex","subarray","removed","Uint8Array","set"],"mappings":"AAAA;;CAEC,GACD,OAAO,SAASA,kBAAkBC,CAAa,EAAEC,CAAa;IAC5D,IAAIA,EAAEC,MAAM,KAAK,GAAG,OAAO;IAC3B,IAAIF,EAAEE,MAAM,KAAK,KAAKD,EAAEC,MAAM,GAAGF,EAAEE,MAAM,EAAE,OAAO,CAAC;IAEnD,mDAAmD;IACnD,IAAI,OAAOC,WAAW,aAAa;QACjC,MAAMC,WAAWD,OAAOE,QAAQ,CAACL,KAC7BA,IACAG,OAAOG,IAAI,CAACN,EAAEO,MAAM,EAAEP,EAAEQ,UAAU,EAAER,EAAES,UAAU;QACpD,OAAOL,SAASM,OAAO,CAACT;IAC1B;IAEA,8BAA8B;IAC9B,IAAK,IAAIU,IAAI,GAAGA,KAAKX,EAAEE,MAAM,GAAGD,EAAEC,MAAM,EAAES,IAAK;QAC7C,IAAIC,gBAAgB;QACpB,6DAA6D;QAC7D,IAAK,IAAIC,IAAI,GAAGA,IAAIZ,EAAEC,MAAM,EAAEW,IAAK;YACjC,2HAA2H;YAC3H,IAAIb,CAAC,CAACW,IAAIE,EAAE,KAAKZ,CAAC,CAACY,EAAE,EAAE;gBACrBD,gBAAgB;gBAChB;YACF;QACF;QAEA,IAAIA,eAAe;YACjB,OAAOD;QACT;IACF;IAEA,OAAO,CAAC;AACV;AAEA;;CAEC,GACD,OAAO,SAASG,wBAAwBd,CAAa,EAAEC,CAAa;IAClE,IAAID,EAAEE,MAAM,KAAKD,EAAEC,MAAM,EAAE,OAAO;IAElC,IAAK,IAAIS,IAAI,GAAGA,IAAIX,EAAEE,MAAM,EAAES,IAAK;QACjC,IAAIX,CAAC,CAACW,EAAE,KAAKV,CAAC,CAACU,EAAE,EAAE,OAAO;IAC5B;IAEA,OAAO;AACT;AAEA;;;;;;CAMC,GACD,OAAO,SAASI,qBAAqBf,CAAa,EAAEC,CAAa;IAC/D,MAAMe,WAAWjB,kBAAkBC,GAAGC;IACtC,IAAIe,aAAa,GAAG,OAAOhB,EAAEiB,QAAQ,CAAChB,EAAEC,MAAM;IAC9C,IAAIc,WAAW,CAAC,GAAG;QACjB,MAAME,UAAU,IAAIC,WAAWnB,EAAEE,MAAM,GAAGD,EAAEC,MAAM;QAClDgB,QAAQE,GAAG,CAACpB,EAAEiB,QAAQ,CAAC,GAAGD;QAC1BE,QAAQE,GAAG,CAACpB,EAAEiB,QAAQ,CAACD,WAAWf,EAAEC,MAAM,GAAGc;QAC7C,OAAOE;IACT,OAAO;QACL,OAAOlB;IACT;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/constant.js b/e-commerce/node_modules/next/dist/esm/server/typescript/constant.js new file mode 100644 index 0000000000000000000000000000000000000000..7b0ffaed6a49c0ccc282da8a4d830725ec1269e5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/constant.js @@ -0,0 +1,58 @@ +export const NEXT_TS_ERRORS = { + INVALID_SERVER_API: 71001, + INVALID_ENTRY_EXPORT: 71002, + INVALID_OPTION_VALUE: 71003, + MISPLACED_ENTRY_DIRECTIVE: 71004, + INVALID_PAGE_PROP: 71005, + INVALID_CONFIG_OPTION: 71006, + INVALID_CLIENT_ENTRY_PROP: 71007, + INVALID_METADATA_EXPORT: 71008, + INVALID_ERROR_COMPONENT: 71009, + INVALID_ENTRY_DIRECTIVE: 71010, + INVALID_SERVER_ENTRY_RETURN: 71011 +}; +export const ALLOWED_EXPORTS = [ + 'config', + 'generateStaticParams', + 'unstable_paramMatching', + 'unstable_generateParamMatching', + 'metadata', + 'generateMetadata', + 'viewport', + 'generateViewport' +]; +export const LEGACY_CONFIG_EXPORT = 'config'; +export const DISALLOWED_SERVER_REACT_APIS = [ + 'useState', + 'useEffect', + 'useEffectEvent', + 'useLayoutEffect', + 'useDeferredValue', + 'useImperativeHandle', + 'useInsertionEffect', + 'useReducer', + 'useRef', + 'useSyncExternalStore', + 'useTransition', + 'Component', + 'PureComponent', + 'createContext', + 'createFactory', + 'experimental_useOptimistic', + 'useOptimistic', + 'useActionState' +]; +export const DISALLOWED_SERVER_REACT_DOM_APIS = [ + 'useFormStatus', + 'useFormState' +]; +export const ALLOWED_PAGE_PROPS = [ + 'params', + 'searchParams' +]; +export const ALLOWED_LAYOUT_PROPS = [ + 'params', + 'children' +]; + +//# sourceMappingURL=constant.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/constant.js.map b/e-commerce/node_modules/next/dist/esm/server/typescript/constant.js.map new file mode 100644 index 0000000000000000000000000000000000000000..bdeb1c1191279168f87602d66322da439445d575 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/constant.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/typescript/constant.ts"],"sourcesContent":["export const NEXT_TS_ERRORS = {\n INVALID_SERVER_API: 71001,\n INVALID_ENTRY_EXPORT: 71002,\n INVALID_OPTION_VALUE: 71003,\n MISPLACED_ENTRY_DIRECTIVE: 71004,\n INVALID_PAGE_PROP: 71005,\n INVALID_CONFIG_OPTION: 71006,\n INVALID_CLIENT_ENTRY_PROP: 71007,\n INVALID_METADATA_EXPORT: 71008,\n INVALID_ERROR_COMPONENT: 71009,\n INVALID_ENTRY_DIRECTIVE: 71010,\n INVALID_SERVER_ENTRY_RETURN: 71011,\n}\n\nexport const ALLOWED_EXPORTS = [\n 'config',\n 'generateStaticParams',\n 'unstable_paramMatching',\n 'unstable_generateParamMatching',\n 'metadata',\n 'generateMetadata',\n 'viewport',\n 'generateViewport',\n]\n\nexport const LEGACY_CONFIG_EXPORT = 'config'\n\nexport const DISALLOWED_SERVER_REACT_APIS: string[] = [\n 'useState',\n 'useEffect',\n 'useEffectEvent',\n 'useLayoutEffect',\n 'useDeferredValue',\n 'useImperativeHandle',\n 'useInsertionEffect',\n 'useReducer',\n 'useRef',\n 'useSyncExternalStore',\n 'useTransition',\n 'Component',\n 'PureComponent',\n 'createContext',\n 'createFactory',\n 'experimental_useOptimistic',\n 'useOptimistic',\n 'useActionState',\n]\n\nexport const DISALLOWED_SERVER_REACT_DOM_APIS: string[] = [\n 'useFormStatus',\n 'useFormState',\n]\n\nexport const ALLOWED_PAGE_PROPS = ['params', 'searchParams']\nexport const ALLOWED_LAYOUT_PROPS = ['params', 'children']\n"],"names":["NEXT_TS_ERRORS","INVALID_SERVER_API","INVALID_ENTRY_EXPORT","INVALID_OPTION_VALUE","MISPLACED_ENTRY_DIRECTIVE","INVALID_PAGE_PROP","INVALID_CONFIG_OPTION","INVALID_CLIENT_ENTRY_PROP","INVALID_METADATA_EXPORT","INVALID_ERROR_COMPONENT","INVALID_ENTRY_DIRECTIVE","INVALID_SERVER_ENTRY_RETURN","ALLOWED_EXPORTS","LEGACY_CONFIG_EXPORT","DISALLOWED_SERVER_REACT_APIS","DISALLOWED_SERVER_REACT_DOM_APIS","ALLOWED_PAGE_PROPS","ALLOWED_LAYOUT_PROPS"],"mappings":"AAAA,OAAO,MAAMA,iBAAiB;IAC5BC,oBAAoB;IACpBC,sBAAsB;IACtBC,sBAAsB;IACtBC,2BAA2B;IAC3BC,mBAAmB;IACnBC,uBAAuB;IACvBC,2BAA2B;IAC3BC,yBAAyB;IACzBC,yBAAyB;IACzBC,yBAAyB;IACzBC,6BAA6B;AAC/B,EAAC;AAED,OAAO,MAAMC,kBAAkB;IAC7B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED,OAAO,MAAMC,uBAAuB,SAAQ;AAE5C,OAAO,MAAMC,+BAAyC;IACpD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED,OAAO,MAAMC,mCAA6C;IACxD;IACA;CACD,CAAA;AAED,OAAO,MAAMC,qBAAqB;IAAC;IAAU;CAAe,CAAA;AAC5D,OAAO,MAAMC,uBAAuB;IAAC;IAAU;CAAW,CAAA","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/index.js b/e-commerce/node_modules/next/dist/esm/server/typescript/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3fd1a40bf2d91a64aa5fde81ae71312ed6167fd7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/index.js @@ -0,0 +1,184 @@ +/** + * This is a TypeScript language service plugin for Next.js app directory, + * it provides the following features: + * + * - Warns about disallowed React APIs in server components. + * - Warns about disallowed layout and page exports. + * - Autocompletion for entry configurations. + * - Hover hint and docs for entry configurations. + */ import { init, getEntryInfo, isAppEntryFile, isDefaultFunctionExport, isPositionInsideNode, getSource, isInsideApp } from './utils'; +import { NEXT_TS_ERRORS } from './constant'; +import entryConfig from './rules/config'; +import serverLayer from './rules/server'; +import entryDefault from './rules/entry'; +import clientBoundary from './rules/client-boundary'; +import serverBoundary from './rules/server-boundary'; +import metadata from './rules/metadata'; +import errorEntry from './rules/error'; +export const createTSPlugin = ({ typescript: ts })=>{ + function create(info) { + // Get plugin options + // config is the plugin options from the user's tsconfig.json + // e.g. { "plugins": [{ "name": "next", "enabled": true }] } + // config will be { "name": "next", "enabled": true } + // The default user config is { "name": "next" } + const isPluginEnabled = info.config.enabled ?? true; + if (!isPluginEnabled) { + return info.languageService; + } + init({ + ts, + info + }); + // Set up decorator object + const proxy = Object.create(null); + for (let k of Object.keys(info.languageService)){ + const x = info.languageService[k]; + // @ts-expect-error - JS runtime trickery which is tricky to type tersely + proxy[k] = (...args)=>x.apply(info.languageService, args); + } + // Auto completion + proxy.getCompletionsAtPosition = (fileName, position, options)=>{ + let prior = info.languageService.getCompletionsAtPosition(fileName, position, options) || { + isGlobalCompletion: false, + isMemberCompletion: false, + isNewIdentifierLocation: false, + entries: [] + }; + if (!isAppEntryFile(fileName)) return prior; + // If it's a server entry. + const entryInfo = getEntryInfo(fileName); + if (!entryInfo.client) { + // Remove specified entries from completion list + prior.entries = serverLayer.filterCompletionsAtPosition(prior.entries); + } + // Add auto completions for export configs. + entryConfig.addCompletionsAtPosition(fileName, position, prior); + const source = getSource(fileName); + if (!source) return prior; + ts.forEachChild(source, (node)=>{ + // Auto completion for default export function's props. + if (isPositionInsideNode(position, node) && isDefaultFunctionExport(node)) { + prior.entries.push(...entryDefault.getCompletionsAtPosition(fileName, node, position)); + } + }); + return prior; + }; + // Show auto completion details + proxy.getCompletionEntryDetails = (fileName, position, entryName, formatOptions, source, preferences, data)=>{ + const entryCompletionEntryDetails = entryConfig.getCompletionEntryDetails(entryName, data, fileName); + if (entryCompletionEntryDetails) return entryCompletionEntryDetails; + return info.languageService.getCompletionEntryDetails(fileName, position, entryName, formatOptions, source, preferences, data); + }; + // Quick info + proxy.getQuickInfoAtPosition = (fileName, position, ...args)=>{ + const prior = info.languageService.getQuickInfoAtPosition(fileName, position, ...args); + if (!isAppEntryFile(fileName)) return prior; + // Remove type suggestions for disallowed APIs in server components. + const entryInfo = getEntryInfo(fileName); + if (!entryInfo.client) { + const definitions = info.languageService.getDefinitionAtPosition(fileName, position); + if (definitions && serverLayer.hasDisallowedReactAPIDefinition(definitions)) { + return; + } + } + const overridden = entryConfig.getQuickInfoAtPosition(fileName, position, prior); + if (overridden) return overridden; + return prior; + }; + // Show errors for disallowed imports + proxy.getSemanticDiagnostics = (fileName)=>{ + const prior = info.languageService.getSemanticDiagnostics(fileName); + const source = getSource(fileName); + if (!source) return prior; + let isClientEntry = false; + let isServerEntry = false; + const isAppEntry = isAppEntryFile(fileName); + try { + const entryInfo = getEntryInfo(fileName, true); + isClientEntry = entryInfo.client; + isServerEntry = entryInfo.server; + } catch (e) { + prior.push({ + file: source, + category: ts.DiagnosticCategory.Error, + code: NEXT_TS_ERRORS.MISPLACED_ENTRY_DIRECTIVE, + ...e + }); + isClientEntry = false; + isServerEntry = false; + } + if (isInsideApp(fileName)) { + const errorDiagnostic = errorEntry.getSemanticDiagnostics(source, isClientEntry); + prior.push(...errorDiagnostic); + } + ts.forEachChild(source, (node)=>{ + var _node_modifiers, _node_modifiers1; + if (ts.isImportDeclaration(node)) { + // import ... + if (isAppEntry) { + if (!isClientEntry || isServerEntry) { + // Check if it has valid imports in the server layer + const diagnostics = serverLayer.getSemanticDiagnosticsForImportDeclaration(source, node); + prior.push(...diagnostics); + } + } + } else if (ts.isVariableStatement(node) && ((_node_modifiers = node.modifiers) == null ? void 0 : _node_modifiers.some((m)=>m.kind === ts.SyntaxKind.ExportKeyword))) { + // export const ... + if (isAppEntry) { + // Check if it has correct option exports + const diagnostics = entryConfig.getSemanticDiagnosticsForExportVariableStatement(source, node); + const metadataDiagnostics = isClientEntry ? metadata.client.getSemanticDiagnosticsForExportVariableStatement(fileName, node) : metadata.server.getSemanticDiagnosticsForExportVariableStatement(fileName, node); + prior.push(...diagnostics, ...metadataDiagnostics); + } + if (isClientEntry) { + prior.push(...clientBoundary.getSemanticDiagnosticsForExportVariableStatement(source, node)); + } + if (isServerEntry) { + prior.push(...serverBoundary.getSemanticDiagnosticsForExportVariableStatement(source, node)); + } + } else if (isDefaultFunctionExport(node)) { + // export default function ... + if (isAppEntry) { + const diagnostics = entryDefault.getSemanticDiagnostics(fileName, source, node); + prior.push(...diagnostics); + } + if (isClientEntry) { + prior.push(...clientBoundary.getSemanticDiagnosticsForFunctionExport(source, node)); + } + if (isServerEntry) { + prior.push(...serverBoundary.getSemanticDiagnosticsForFunctionExport(source, node)); + } + } else if (ts.isFunctionDeclaration(node) && ((_node_modifiers1 = node.modifiers) == null ? void 0 : _node_modifiers1.some((m)=>m.kind === ts.SyntaxKind.ExportKeyword))) { + // export function ... + if (isAppEntry) { + const metadataDiagnostics = isClientEntry ? metadata.client.getSemanticDiagnosticsForExportVariableStatement(fileName, node) : metadata.server.getSemanticDiagnosticsForExportVariableStatement(fileName, node); + prior.push(...metadataDiagnostics); + } + if (isClientEntry) { + prior.push(...clientBoundary.getSemanticDiagnosticsForFunctionExport(source, node)); + } + if (isServerEntry) { + prior.push(...serverBoundary.getSemanticDiagnosticsForFunctionExport(source, node)); + } + } else if (ts.isExportDeclaration(node)) { + // export { ... } + if (isAppEntry) { + const metadataDiagnostics = isClientEntry ? metadata.client.getSemanticDiagnosticsForExportDeclaration(fileName, node) : metadata.server.getSemanticDiagnosticsForExportDeclaration(fileName, node); + prior.push(...metadataDiagnostics); + } + if (isServerEntry) { + prior.push(...serverBoundary.getSemanticDiagnosticsForExportDeclaration(source, node)); + } + } + }); + return prior; + }; + return proxy; + } + return { + create + }; +}; + +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/index.js.map b/e-commerce/node_modules/next/dist/esm/server/typescript/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..225a4909e90bf91ab3c03c77c52de3b1e61560a3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/typescript/index.ts"],"sourcesContent":["/**\n * This is a TypeScript language service plugin for Next.js app directory,\n * it provides the following features:\n *\n * - Warns about disallowed React APIs in server components.\n * - Warns about disallowed layout and page exports.\n * - Autocompletion for entry configurations.\n * - Hover hint and docs for entry configurations.\n */\n\nimport {\n init,\n getEntryInfo,\n isAppEntryFile,\n isDefaultFunctionExport,\n isPositionInsideNode,\n getSource,\n isInsideApp,\n} from './utils'\nimport { NEXT_TS_ERRORS } from './constant'\n\nimport entryConfig from './rules/config'\nimport serverLayer from './rules/server'\nimport entryDefault from './rules/entry'\nimport clientBoundary from './rules/client-boundary'\nimport serverBoundary from './rules/server-boundary'\nimport metadata from './rules/metadata'\nimport errorEntry from './rules/error'\nimport type tsModule from 'typescript/lib/tsserverlibrary'\n\nexport const createTSPlugin: tsModule.server.PluginModuleFactory = ({\n typescript: ts,\n}) => {\n function create(info: tsModule.server.PluginCreateInfo) {\n // Get plugin options\n // config is the plugin options from the user's tsconfig.json\n // e.g. { \"plugins\": [{ \"name\": \"next\", \"enabled\": true }] }\n // config will be { \"name\": \"next\", \"enabled\": true }\n // The default user config is { \"name\": \"next\" }\n const isPluginEnabled = info.config.enabled ?? true\n\n if (!isPluginEnabled) {\n return info.languageService\n }\n\n init({\n ts,\n info,\n })\n\n // Set up decorator object\n const proxy: tsModule.LanguageService = Object.create(null)\n for (let k of Object.keys(info.languageService)) {\n const x = info.languageService[k as keyof tsModule.LanguageService]\n // @ts-expect-error - JS runtime trickery which is tricky to type tersely\n proxy[k] = (...args: Array<{}>) => x.apply(info.languageService, args)\n }\n\n // Auto completion\n proxy.getCompletionsAtPosition = (\n fileName: string,\n position: number,\n options: any\n ) => {\n let prior = info.languageService.getCompletionsAtPosition(\n fileName,\n position,\n options\n ) || {\n isGlobalCompletion: false,\n isMemberCompletion: false,\n isNewIdentifierLocation: false,\n entries: [],\n }\n if (!isAppEntryFile(fileName)) return prior\n\n // If it's a server entry.\n const entryInfo = getEntryInfo(fileName)\n if (!entryInfo.client) {\n // Remove specified entries from completion list\n prior.entries = serverLayer.filterCompletionsAtPosition(prior.entries)\n }\n\n // Add auto completions for export configs.\n entryConfig.addCompletionsAtPosition(fileName, position, prior)\n\n const source = getSource(fileName)\n if (!source) return prior\n\n ts.forEachChild(source!, (node) => {\n // Auto completion for default export function's props.\n if (\n isPositionInsideNode(position, node) &&\n isDefaultFunctionExport(node)\n ) {\n prior.entries.push(\n ...entryDefault.getCompletionsAtPosition(\n fileName,\n node as tsModule.FunctionDeclaration,\n position\n )\n )\n }\n })\n\n return prior\n }\n\n // Show auto completion details\n proxy.getCompletionEntryDetails = (\n fileName: string,\n position: number,\n entryName: string,\n formatOptions: tsModule.FormatCodeOptions,\n source: string,\n preferences: tsModule.UserPreferences,\n data: tsModule.CompletionEntryData\n ) => {\n const entryCompletionEntryDetails = entryConfig.getCompletionEntryDetails(\n entryName,\n data,\n fileName\n )\n if (entryCompletionEntryDetails) return entryCompletionEntryDetails\n\n return info.languageService.getCompletionEntryDetails(\n fileName,\n position,\n entryName,\n formatOptions,\n source,\n preferences,\n data\n )\n }\n\n // Quick info\n proxy.getQuickInfoAtPosition = (\n fileName: string,\n position: number,\n ...args: any[]\n ) => {\n const prior = (\n info.languageService.getQuickInfoAtPosition as (\n fileName: string,\n position: number,\n ...args: any[]\n ) => tsModule.QuickInfo | undefined\n )(fileName, position, ...args)\n if (!isAppEntryFile(fileName)) return prior\n\n // Remove type suggestions for disallowed APIs in server components.\n const entryInfo = getEntryInfo(fileName)\n if (!entryInfo.client) {\n const definitions = info.languageService.getDefinitionAtPosition(\n fileName,\n position\n )\n if (\n definitions &&\n serverLayer.hasDisallowedReactAPIDefinition(definitions)\n ) {\n return\n }\n }\n\n const overridden = entryConfig.getQuickInfoAtPosition(\n fileName,\n position,\n prior\n )\n if (overridden) return overridden\n\n return prior\n }\n\n // Show errors for disallowed imports\n proxy.getSemanticDiagnostics = (fileName: string) => {\n const prior = info.languageService.getSemanticDiagnostics(fileName)\n const source = getSource(fileName)\n if (!source) return prior\n\n let isClientEntry = false\n let isServerEntry = false\n const isAppEntry = isAppEntryFile(fileName)\n\n try {\n const entryInfo = getEntryInfo(fileName, true)\n isClientEntry = entryInfo.client\n isServerEntry = entryInfo.server\n } catch (e: any) {\n prior.push({\n file: source,\n category: ts.DiagnosticCategory.Error,\n code: NEXT_TS_ERRORS.MISPLACED_ENTRY_DIRECTIVE,\n ...e,\n })\n isClientEntry = false\n isServerEntry = false\n }\n\n if (isInsideApp(fileName)) {\n const errorDiagnostic = errorEntry.getSemanticDiagnostics(\n source!,\n isClientEntry\n )\n prior.push(...errorDiagnostic)\n }\n\n ts.forEachChild(source!, (node) => {\n if (ts.isImportDeclaration(node)) {\n // import ...\n if (isAppEntry) {\n if (!isClientEntry || isServerEntry) {\n // Check if it has valid imports in the server layer\n const diagnostics =\n serverLayer.getSemanticDiagnosticsForImportDeclaration(\n source,\n node\n )\n prior.push(...diagnostics)\n }\n }\n } else if (\n ts.isVariableStatement(node) &&\n node.modifiers?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword)\n ) {\n // export const ...\n if (isAppEntry) {\n // Check if it has correct option exports\n const diagnostics =\n entryConfig.getSemanticDiagnosticsForExportVariableStatement(\n source,\n node\n )\n const metadataDiagnostics = isClientEntry\n ? metadata.client.getSemanticDiagnosticsForExportVariableStatement(\n fileName,\n node\n )\n : metadata.server.getSemanticDiagnosticsForExportVariableStatement(\n fileName,\n node\n )\n prior.push(...diagnostics, ...metadataDiagnostics)\n }\n\n if (isClientEntry) {\n prior.push(\n ...clientBoundary.getSemanticDiagnosticsForExportVariableStatement(\n source,\n node\n )\n )\n }\n\n if (isServerEntry) {\n prior.push(\n ...serverBoundary.getSemanticDiagnosticsForExportVariableStatement(\n source,\n node\n )\n )\n }\n } else if (isDefaultFunctionExport(node)) {\n // export default function ...\n if (isAppEntry) {\n const diagnostics = entryDefault.getSemanticDiagnostics(\n fileName,\n source,\n node\n )\n prior.push(...diagnostics)\n }\n\n if (isClientEntry) {\n prior.push(\n ...clientBoundary.getSemanticDiagnosticsForFunctionExport(\n source,\n node\n )\n )\n }\n\n if (isServerEntry) {\n prior.push(\n ...serverBoundary.getSemanticDiagnosticsForFunctionExport(\n source,\n node\n )\n )\n }\n } else if (\n ts.isFunctionDeclaration(node) &&\n node.modifiers?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword)\n ) {\n // export function ...\n if (isAppEntry) {\n const metadataDiagnostics = isClientEntry\n ? metadata.client.getSemanticDiagnosticsForExportVariableStatement(\n fileName,\n node\n )\n : metadata.server.getSemanticDiagnosticsForExportVariableStatement(\n fileName,\n node\n )\n prior.push(...metadataDiagnostics)\n }\n\n if (isClientEntry) {\n prior.push(\n ...clientBoundary.getSemanticDiagnosticsForFunctionExport(\n source,\n node\n )\n )\n }\n\n if (isServerEntry) {\n prior.push(\n ...serverBoundary.getSemanticDiagnosticsForFunctionExport(\n source,\n node\n )\n )\n }\n } else if (ts.isExportDeclaration(node)) {\n // export { ... }\n if (isAppEntry) {\n const metadataDiagnostics = isClientEntry\n ? metadata.client.getSemanticDiagnosticsForExportDeclaration(\n fileName,\n node\n )\n : metadata.server.getSemanticDiagnosticsForExportDeclaration(\n fileName,\n node\n )\n prior.push(...metadataDiagnostics)\n }\n\n if (isServerEntry) {\n prior.push(\n ...serverBoundary.getSemanticDiagnosticsForExportDeclaration(\n source,\n node\n )\n )\n }\n }\n })\n\n return prior\n }\n\n return proxy\n }\n\n return { create }\n}\n"],"names":["init","getEntryInfo","isAppEntryFile","isDefaultFunctionExport","isPositionInsideNode","getSource","isInsideApp","NEXT_TS_ERRORS","entryConfig","serverLayer","entryDefault","clientBoundary","serverBoundary","metadata","errorEntry","createTSPlugin","typescript","ts","create","info","isPluginEnabled","config","enabled","languageService","proxy","Object","k","keys","x","args","apply","getCompletionsAtPosition","fileName","position","options","prior","isGlobalCompletion","isMemberCompletion","isNewIdentifierLocation","entries","entryInfo","client","filterCompletionsAtPosition","addCompletionsAtPosition","source","forEachChild","node","push","getCompletionEntryDetails","entryName","formatOptions","preferences","data","entryCompletionEntryDetails","getQuickInfoAtPosition","definitions","getDefinitionAtPosition","hasDisallowedReactAPIDefinition","overridden","getSemanticDiagnostics","isClientEntry","isServerEntry","isAppEntry","server","e","file","category","DiagnosticCategory","Error","code","MISPLACED_ENTRY_DIRECTIVE","errorDiagnostic","isImportDeclaration","diagnostics","getSemanticDiagnosticsForImportDeclaration","isVariableStatement","modifiers","some","m","kind","SyntaxKind","ExportKeyword","getSemanticDiagnosticsForExportVariableStatement","metadataDiagnostics","getSemanticDiagnosticsForFunctionExport","isFunctionDeclaration","isExportDeclaration","getSemanticDiagnosticsForExportDeclaration"],"mappings":"AAAA;;;;;;;;CAQC,GAED,SACEA,IAAI,EACJC,YAAY,EACZC,cAAc,EACdC,uBAAuB,EACvBC,oBAAoB,EACpBC,SAAS,EACTC,WAAW,QACN,UAAS;AAChB,SAASC,cAAc,QAAQ,aAAY;AAE3C,OAAOC,iBAAiB,iBAAgB;AACxC,OAAOC,iBAAiB,iBAAgB;AACxC,OAAOC,kBAAkB,gBAAe;AACxC,OAAOC,oBAAoB,0BAAyB;AACpD,OAAOC,oBAAoB,0BAAyB;AACpD,OAAOC,cAAc,mBAAkB;AACvC,OAAOC,gBAAgB,gBAAe;AAGtC,OAAO,MAAMC,iBAAsD,CAAC,EAClEC,YAAYC,EAAE,EACf;IACC,SAASC,OAAOC,IAAsC;QACpD,qBAAqB;QACrB,6DAA6D;QAC7D,4DAA4D;QAC5D,qDAAqD;QACrD,gDAAgD;QAChD,MAAMC,kBAAkBD,KAAKE,MAAM,CAACC,OAAO,IAAI;QAE/C,IAAI,CAACF,iBAAiB;YACpB,OAAOD,KAAKI,eAAe;QAC7B;QAEAvB,KAAK;YACHiB;YACAE;QACF;QAEA,0BAA0B;QAC1B,MAAMK,QAAkCC,OAAOP,MAAM,CAAC;QACtD,KAAK,IAAIQ,KAAKD,OAAOE,IAAI,CAACR,KAAKI,eAAe,EAAG;YAC/C,MAAMK,IAAIT,KAAKI,eAAe,CAACG,EAAoC;YACnE,yEAAyE;YACzEF,KAAK,CAACE,EAAE,GAAG,CAAC,GAAGG,OAAoBD,EAAEE,KAAK,CAACX,KAAKI,eAAe,EAAEM;QACnE;QAEA,kBAAkB;QAClBL,MAAMO,wBAAwB,GAAG,CAC/BC,UACAC,UACAC;YAEA,IAAIC,QAAQhB,KAAKI,eAAe,CAACQ,wBAAwB,CACvDC,UACAC,UAC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DAAgD,CAC9DlD,UACAc,QAEFjC,SAASkD,MAAM,CAACmB,gDAAgD,CAC9DlD,UACAc;wBAENX,MAAMY,IAAI,IAAIoC;oBAChB;oBAEA,IAAIvB,eAAe;wBACjBzB,MAAMY,IAAI,IACLpC,eAAeyE,uCAAuC,CACvDxC,QACAE;oBAGN;oBAEA,IAAIe,eAAe;wBACjB1B,MAAMY,IAAI,IACLnC,eAAewE,uCAAuC,CACvDxC,QACAE;oBAGN;gBACF,OAAO,IAAI7B,GAAGqE,mBAAmB,CAACxC,OAAO;oBACvC,iBAAiB;oBACjB,IAAIgB,YAAY;wBACd,MAAMqB,sBAAsBvB,gBACxB/C,SAAS4B,MAAM,CAAC8C,0CAA0C,CACxDvD,UACAc,QAEFjC,SAASkD,MAAM,CAACwB,0CAA0C,CACxDvD,UACAc;wBAENX,MAAMY,IAAI,IAAIoC;oBAChB;oBAEA,IAAItB,eAAe;wBACjB1B,MAAMY,IAAI,IACLnC,eAAe2E,0CAA0C,CAC1D3C,QACAE;oBAGN;gBACF;YACF;YAEA,OAAOX;QACT;QAEA,OAAOX;IACT;IAEA,OAAO;QAAEN;IAAO;AAClB,EAAC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/rules/client-boundary.js b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/client-boundary.js new file mode 100644 index 0000000000000000000000000000000000000000..e4533d4a9a266deb5c638f8c47e9499e91fde9b5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/client-boundary.js @@ -0,0 +1,90 @@ +// This module provides intellisense for all components that has the `"use client"` directive. +import { NEXT_TS_ERRORS } from '../constant'; +import { getTs, getTypeChecker } from '../utils'; +const clientBoundary = { + getSemanticDiagnosticsForExportVariableStatement (source, node) { + const ts = getTs(); + const diagnostics = []; + if (ts.isVariableDeclarationList(node.declarationList)) { + for (const declaration of node.declarationList.declarations){ + const initializer = declaration.initializer; + if (initializer && ts.isArrowFunction(initializer)) { + diagnostics.push(...clientBoundary.getSemanticDiagnosticsForFunctionExport(source, initializer)); + } + } + } + return diagnostics; + }, + getSemanticDiagnosticsForFunctionExport (source, node) { + var _node_parameters; + const ts = getTs(); + const typeChecker = getTypeChecker(); + if (!typeChecker) return []; + const diagnostics = []; + const isErrorFile = /[\\/]error\.tsx?$/.test(source.fileName); + const isGlobalErrorFile = /[\\/]global-error\.tsx?$/.test(source.fileName); + const props = (_node_parameters = node.parameters) == null ? void 0 : _node_parameters[0]; + if (props) { + var _propsType_symbol_getDeclarations, _propsType_symbol; + const propsType = typeChecker.getTypeAtLocation(props); + const typeNode = (_propsType_symbol = propsType.symbol) == null ? void 0 : (_propsType_symbol_getDeclarations = _propsType_symbol.getDeclarations()) == null ? void 0 : _propsType_symbol_getDeclarations[0]; + if (typeNode && ts.isTypeLiteralNode(typeNode)) { + for (const member of typeNode.members){ + if (ts.isPropertySignature(member)) { + const propName = member.name.getText(); + const propType = member.type; + if (propType) { + var _propTypeInfo_symbol_getDeclarations, _propTypeInfo_symbol; + const propTypeInfo = typeChecker.getTypeAtLocation(propType); + const typeDeclarationNode = (_propTypeInfo_symbol = propTypeInfo.symbol) == null ? void 0 : (_propTypeInfo_symbol_getDeclarations = _propTypeInfo_symbol.getDeclarations()) == null ? void 0 : _propTypeInfo_symbol_getDeclarations[0]; + if (typeDeclarationNode) { + if (ts.isFunctionTypeNode(typeDeclarationNode) || // someFunc(): void + ts.isMethodSignature(typeDeclarationNode)) { + // By convention, props named "action" can accept functions since we + // assume these are Server Actions. Structurally, there's no + // difference between a Server Action and a normal function until + // TypeScript exposes directives in the type of a function. This + // will miss accidentally passing normal functions but a false + // negative is better than a false positive given how frequent the + // false-positive would be. + const maybeServerAction = propName === 'action' || /.+Action$/.test(propName); + // There's a special case for error files where the + // framework-injected `reset` and `retry` props are + // allowed to be functions. Next.js provides these props, the + // user doesn't pass them, so they don't need to be + // serializable. + // https://github.com/vercel/next.js/issues/46573 + const isErrorBoundaryFunctionProp = (isErrorFile || isGlobalErrorFile) && (propName === 'reset' || propName === 'retry'); + if (!maybeServerAction && !isErrorBoundaryFunctionProp) { + diagnostics.push({ + file: source, + category: ts.DiagnosticCategory.Warning, + code: NEXT_TS_ERRORS.INVALID_CLIENT_ENTRY_PROP, + messageText: `Props must be serializable for components in the "use client" entry file. ` + `"${propName}" is a function that's not a Server Action. ` + `Rename "${propName}" either to "action" or have its name end with "Action" e.g. "${propName}Action" to indicate it is a Server Action.`, + start: propType.getStart(), + length: propType.getWidth() + }); + } + } else if (// Show warning for not serializable props. + ts.isConstructorTypeNode(typeDeclarationNode) || ts.isClassDeclaration(typeDeclarationNode)) { + diagnostics.push({ + file: source, + category: ts.DiagnosticCategory.Warning, + code: NEXT_TS_ERRORS.INVALID_CLIENT_ENTRY_PROP, + messageText: `Props must be serializable for components in the "use client" entry file, "${propName}" is invalid.`, + start: propType.getStart(), + length: propType.getWidth() + }); + } + } + } + } + } + } + } + return diagnostics; + } +}; +export default clientBoundary; + +//# sourceMappingURL=client-boundary.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/rules/client-boundary.js.map b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/client-boundary.js.map new file mode 100644 index 0000000000000000000000000000000000000000..392967b8286901bf00a725df8b1b0371794fe74e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/client-boundary.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/typescript/rules/client-boundary.ts"],"sourcesContent":["// This module provides intellisense for all components that has the `\"use client\"` directive.\n\nimport { NEXT_TS_ERRORS } from '../constant'\nimport { getTs, getTypeChecker } from '../utils'\nimport type tsModule from 'typescript/lib/tsserverlibrary'\n\nconst clientBoundary = {\n getSemanticDiagnosticsForExportVariableStatement(\n source: tsModule.SourceFile,\n node: tsModule.VariableStatement\n ) {\n const ts = getTs()\n\n const diagnostics: tsModule.Diagnostic[] = []\n\n if (ts.isVariableDeclarationList(node.declarationList)) {\n for (const declaration of node.declarationList.declarations) {\n const initializer = declaration.initializer\n if (initializer && ts.isArrowFunction(initializer)) {\n diagnostics.push(\n ...clientBoundary.getSemanticDiagnosticsForFunctionExport(\n source,\n initializer\n )\n )\n }\n }\n }\n\n return diagnostics\n },\n\n getSemanticDiagnosticsForFunctionExport(\n source: tsModule.SourceFile,\n node: tsModule.FunctionDeclaration | tsModule.ArrowFunction\n ) {\n const ts = getTs()\n const typeChecker = getTypeChecker()\n if (!typeChecker) return []\n\n const diagnostics: tsModule.Diagnostic[] = []\n\n const isErrorFile = /[\\\\/]error\\.tsx?$/.test(source.fileName)\n const isGlobalErrorFile = /[\\\\/]global-error\\.tsx?$/.test(source.fileName)\n\n const props = node.parameters?.[0]\n if (props) {\n const propsType = typeChecker.getTypeAtLocation(props)\n const typeNode = propsType.symbol?.getDeclarations()?.[0]\n\n if (typeNode && ts.isTypeLiteralNode(typeNode)) {\n for (const member of typeNode.members) {\n if (ts.isPropertySignature(member)) {\n const propName = member.name.getText()\n const propType = member.type\n\n if (propType) {\n const propTypeInfo = typeChecker.getTypeAtLocation(propType)\n const typeDeclarationNode =\n propTypeInfo.symbol?.getDeclarations()?.[0]\n\n if (typeDeclarationNode) {\n if (\n ts.isFunctionTypeNode(typeDeclarationNode) ||\n // someFunc(): void\n ts.isMethodSignature(typeDeclarationNode)\n ) {\n // By convention, props named \"action\" can accept functions since we\n // assume these are Server Actions. Structurally, there's no\n // difference between a Server Action and a normal function until\n // TypeScript exposes directives in the type of a function. This\n // will miss accidentally passing normal functions but a false\n // negative is better than a false positive given how frequent the\n // false-positive would be.\n const maybeServerAction =\n propName === 'action' || /.+Action$/.test(propName)\n\n // There's a special case for error files where the\n // framework-injected `reset` and `retry` props are\n // allowed to be functions. Next.js provides these props, the\n // user doesn't pass them, so they don't need to be\n // serializable.\n // https://github.com/vercel/next.js/issues/46573\n const isErrorBoundaryFunctionProp =\n (isErrorFile || isGlobalErrorFile) &&\n (propName === 'reset' || propName === 'retry')\n\n if (!maybeServerAction && !isErrorBoundaryFunctionProp) {\n diagnostics.push({\n file: source,\n category: ts.DiagnosticCategory.Warning,\n code: NEXT_TS_ERRORS.INVALID_CLIENT_ENTRY_PROP,\n messageText:\n `Props must be serializable for components in the \"use client\" entry file. ` +\n `\"${propName}\" is a function that's not a Server Action. ` +\n `Rename \"${propName}\" either to \"action\" or have its name end with \"Action\" e.g. \"${propName}Action\" to indicate it is a Server Action.`,\n start: propType.getStart(),\n length: propType.getWidth(),\n })\n }\n } else if (\n // Show warning for not serializable props.\n ts.isConstructorTypeNode(typeDeclarationNode) ||\n ts.isClassDeclaration(typeDeclarationNode)\n ) {\n diagnostics.push({\n file: source,\n category: ts.DiagnosticCategory.Warning,\n code: NEXT_TS_ERRORS.INVALID_CLIENT_ENTRY_PROP,\n messageText: `Props must be serializable for components in the \"use client\" entry file, \"${propName}\" is invalid.`,\n start: propType.getStart(),\n length: propType.getWidth(),\n })\n }\n }\n }\n }\n }\n }\n }\n\n return diagnostics\n },\n}\n\nexport default clientBoundary\n"],"names":["NEXT_TS_ERRORS","getTs","getTypeChecker","clientBoundary","getSemanticDiagnosticsForExportVariableStatement","source","node","ts","diagnostics","isVariableDeclarationList","declarationList","declaration","declarations","initializer","isArrowFunction","push","getSemanticDiagnosticsForFunctionExport","typeChecker","isErrorFile","test","fileName","isGlobalErrorFile","props","parameters","propsType","getTypeAtLocation","typeNode","symbol","getDeclarations","isTypeLiteralNode","member","members","isPropertySignature","propName","name","getText","propType","type","propTypeInfo","typeDeclarationNode","isFunctionTypeNode","isMethodSignature","maybeServerAction","isErrorBoundaryFunctionProp","file","category","DiagnosticCategory","Warning","code","INVALID_CLIENT_ENTRY_PROP","messageText","start","getStart","length","getWidth","isConstructorTypeNode","isClassDeclaration"],"mappings":"AAAA,8FAA8F;AAE9F,SAASA,cAAc,QAAQ,cAAa;AAC5C,SAASC,KAAK,EAAEC,cAAc,QAAQ,WAAU;AAGhD,MAAMC,iBAAiB;IACrBC,kDACEC,MAA2B,E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ASgB,QAAQ;wCACxBC,QAAQjB,SAASkB,QAAQ;oCAC3B;gCACF;4BACF;wBACF;oBACF;gBACF;YACF;QACF;QAEA,OAAO9C;IACT;AACF;AAEA,eAAeL,eAAc","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/rules/config.js b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/config.js new file mode 100644 index 0000000000000000000000000000000000000000..3ed923ebf1f87022dc48a11dc933ffcfd268c37a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/config.js @@ -0,0 +1,551 @@ +// This module provides intellisense for page and layout's exported configs. +import { getSource, isPositionInsideNode, getTs, removeStringQuotes, getTypeChecker } from '../utils'; +import { NEXT_TS_ERRORS, ALLOWED_EXPORTS } from '../constant'; +const API_DOCS = { + dynamic: { + description: 'The `dynamic` option provides a few ways to opt in or out of dynamic behavior.', + options: { + '"auto"': "Heuristic to cache as much as possible but doesn't prevent any component to opt-in to dynamic behavior.", + '"force-dynamic"': 'This disables all caching of fetches and always revalidates. (This is equivalent to `getServerSideProps`.)', + '"error"': 'This errors if any dynamic Hooks or fetches are used. (This is equivalent to `getStaticProps`.)', + '"force-static"': 'This forces caching of all fetches and returns empty values from `cookies`, `headers` and `useSearchParams`.' + }, + link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamic' + }, + fetchCache: { + description: "The `fetchCache` option controls how Next.js statically caches fetches. By default it statically caches fetches reachable before any dynamic Hooks are used, and it doesn't cache fetches that are discovered after that.", + options: { + '"force-no-store"': "This lets you intentionally opt-out of all caching of data. This option forces all fetches to be refetched every request even if the `cache: 'force-cache'` option is passed to `fetch()`.", + '"only-no-store"': "This lets you enforce that all data opts out of caching. This option makes `fetch()` reject with an error if `cache: 'force-cache'` is provided. It also changes the default to `no-store`.", + '"default-no-store"': "Allows any explicit `cache` option to be passed to `fetch()` but if `'default'`, or no option, is provided then it defaults to `'no-store'`. This means that even fetches before a dynamic Hook are considered dynamic.", + '"auto"': "This is the default option. It caches any fetches with the default `cache` option provided, that happened before a dynamic Hook is used and don't cache any such fetches if they're issued after a dynamic Hook.", + '"default-cache"': "Allows any explicit `cache` option to be passed to `fetch()` but if `'default'`, or no option, is provided then it defaults to `'force-cache'`. This means that even fetches before a dynamic Hook are considered dynamic.", + '"only-cache"': "This lets you enforce that all data opts into caching. This option makes `fetch()` reject with an error if `cache: 'force-cache'` is provided. It also changes the default to `force-cache`. This error can be discovered early during static builds - or dynamically during Edge rendering.", + '"force-cache"': "This lets you intentionally opt-in to all caching of data. This option forces all fetches to be cache even if the `cache: 'no-store'` option is passed to `fetch()`." + }, + link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#fetchcache' + }, + preferredRegion: { + description: '@deprecated\\n\\nThe `preferredRegion` route segment config is deprecated. Remove this export.', + options: { + '"auto"': '@deprecated\\n\\nNext.js will first deploy to the `"home"` region. Then if it doesn\'t detect any waterfall requests after a few requests, it can upgrade that route, to be deployed globally. If it detects any waterfall requests after that, it can eventually downgrade back to `"home`".', + '"global"': '@deprecated\\n\\nPrefer deploying globally.', + '"home"': '@deprecated\\n\\nPrefer deploying to the Home region.' + }, + link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#preferredregion', + isValid: (value)=>{ + try { + const parsed = JSON.parse(value); + return typeof parsed === 'string' || Array.isArray(parsed) && !parsed.some((v)=>typeof v !== 'string'); + } catch (err) { + return false; + } + }, + getHint: (value)=>{ + if (value === 'auto') return `Automatically chosen by Next.js.`; + if (value === 'global') return `Prefer deploying globally.`; + if (value === 'home') return `Prefer deploying to the Home region.`; + if (Array.isArray(value)) return `Deploy to regions: ${value.join(', ')}.`; + if (typeof value === 'string') return `Deploy to region: ${value}.`; + } + }, + revalidate: { + description: "The `revalidate` option sets the default revalidation time for that layout or page. Note that it doesn't override the value specify by each `fetch()`.", + type: 'mixed', + options: { + false: 'This is the default and changes the fetch cache to indefinitely cache anything that uses force-cache or is fetched before a dynamic Hook/fetch.', + 0: 'Specifying `0` implies that this layout or page should never be static.', + 30: 'Set the revalidation time to `30` seconds. The value can be `0` or any positive number.' + }, + link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#revalidate', + isValid: (value)=>{ + return value === 'false' || Number(value.replace(/_/g, '')) >= 0; + }, + getHint: (value)=>{ + return `Set the default revalidation time to \`${value}\` seconds.`; + } + }, + dynamicParams: { + description: '`dynamicParams` replaces the `fallback` option of `getStaticPaths`. It controls whether we allow `dynamicParams` beyond the generated static params from `generateStaticParams`.', + options: { + true: 'Allow rendering dynamic params that are not generated by `generateStaticParams`.', + false: 'Disallow rendering dynamic params that are not generated by `generateStaticParams`.' + }, + link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamicparams', + isValid: (value)=>{ + return value === 'true' || value === 'false'; + } + }, + runtime: { + description: 'The `runtime` option controls the preferred runtime to render this route.', + options: { + '"nodejs"': 'Prefer the Node.js runtime.', + '"edge"': `@deprecated\n\nThe Edge Runtime is deprecated. Use \`"nodejs"\` instead.`, + '"experimental-edge"': `@deprecated\n\nThis option is no longer experimental. Use \`edge\` instead.` + }, + link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#runtime' + }, + metadata: { + description: 'Next.js Metadata configurations', + link: 'https://nextjs.org/docs/app/building-your-application/optimizing/metadata', + insertText: 'metadata: Metadata = {};' + }, + generateMetadata: { + description: 'Next.js generateMetadata configurations', + link: 'https://nextjs.org/docs/app/api-reference/functions/generate-metadata', + insertText: 'generateMetadata = (): Metadata => { return {} };' + }, + maxDuration: { + description: '`maxDuration` allows you to set max default execution time for your function. If it is not specified, the default value is dependent on your deployment platform and plan.', + link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#maxduration' + }, + instant: { + description: `Enables instant navigation validation for this segment.`, + link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config/instant', + type: 'true | object | false', + // TODO: ideally, we'd validate the config object somehow, but this is difficult to do + // with the way this plugin is currently structured. + // For now, since we don't provide an `options` here, we won't do any validation in + // `getSemanticDiagnosticsForExportVariableStatement` below, and only provide hover a tooltip + autocomplete. + insertText: 'instant = true;' + }, + prefetch: { + description: `Controls prefetching behavior for this segment. Some options are experimental and may change.`, + link: '(docs coming soon)', + type: `"auto" | "partial" | "force-disabled"`, + options: { + auto: 'Default. Framework decides based on instant validation and segment configuration. You do not need to set this explicitly.', + partial: 'Enables Partial Prefetching for this segment. When a static prefetch is insufficient, Next.js may prefetch the segment with a runtime server request so it can access session data, such as cookies.', + 'force-disabled': 'Never prefetch this segment.' + }, + insertText: `prefetch = 'partial';` + }, + ensureStatic: { + description: `Controls which rendering phases require static output for this segment. This option is experimental and may change.`, + link: '(docs coming soon)', + type: `"auto" | "shell" | "prefetch" | "navigation" | false`, + options: { + '"auto"': 'Default. The shell, prefetch, or entire page will automatically be prerendered statically if possible.', + '"shell"': 'Force the shell for the route to be prerendered statically.', + '"prefetch"': 'Force both the shell and the prefetch (``) for the route to be prerendered statically.', + '"navigation"': 'Require the route to be fully static.', + false: 'Indicate that this segment must use the default behavior and should not have `ensureStatic = "shell" | "prefetch" | "navigation"` applied to it by another segment. Errors if another segment on the route uses `ensureStatic` with those values.' + }, + insertText: `ensureStatic = 'shell';`, + isValid: (value)=>{ + try { + const parsed = JSON.parse(value); + return VALID_ENSURE_STATIC_VALUES.includes(parsed); + } catch { + return false; + } + } + }, + unstable_dynamicStaleTime: { + description: `Controls how long the client-side router cache retains dynamic page data (in seconds). Pages only — not allowed in layouts. Cannot be combined with \`instant\`.`, + link: '(docs coming soon)', + type: 'number', + isValid: (value)=>{ + return Number(value.replace(/_/g, '')) >= 0; + }, + getHint: (value)=>{ + return `Set the dynamic stale time to \`${value}\` seconds.`; + } + } +}; +const VALID_ENSURE_STATIC_VALUES = [ + 'auto', + 'shell', + 'prefetch', + 'navigation', + false +]; +function visitEntryConfig(fileName, position, callback) { + const source = getSource(fileName); + if (source) { + const ts = getTs(); + ts.forEachChild(source, function visit(node) { + // Covered by this node + if (isPositionInsideNode(position, node)) { + var _node_modifiers; + // Export variable + if (ts.isVariableStatement(node) && ((_node_modifiers = node.modifiers) == null ? void 0 : _node_modifiers.some((m)=>m.kind === ts.SyntaxKind.ExportKeyword))) { + if (ts.isVariableDeclarationList(node.declarationList)) { + for (const declaration of node.declarationList.declarations){ + if (isPositionInsideNode(position, declaration)) { + // `export const ... = ...` + const text = declaration.name.getText(); + callback(text, declaration); + } + } + } + } + } + }); + } +} +function createAutoCompletionOptionName(sort, name) { + const ts = getTs(); + return { + name, + insertText: API_DOCS[name].insertText, + sortText: '!' + sort, + kind: ts.ScriptElementKind.constElement, + kindModifiers: ts.ScriptElementKindModifier.exportedModifier, + labelDetails: { + description: `Next.js ${name} option` + }, + data: { + exportName: name, + moduleSpecifier: 'next/typescript/entry_option_name' + } + }; +} +function createAutoCompletionOptionValue(sort, name, apiName) { + const ts = getTs(); + const isString = name.startsWith('"'); + return { + name, + insertText: removeStringQuotes(name), + sortText: '' + sort, + kind: isString ? ts.ScriptElementKind.string : ts.ScriptElementKind.unknown, + kindModifiers: ts.ScriptElementKindModifier.none, + labelDetails: { + description: `Next.js ${apiName} option` + }, + data: { + exportName: apiName, + moduleSpecifier: 'next/typescript/entry_option_value' + } + }; +} +function getAPIDescription(api) { + return API_DOCS[api].description + '\n\n' + Object.entries(API_DOCS[api].options || {}).map(([key, value])=>`- \`${key}\`: ${value}`).join('\n'); +} +const config = { + // Auto completion for entry exported configs. + addCompletionsAtPosition (fileName, position, prior) { + visitEntryConfig(fileName, position, (entryConfig, declaration)=>{ + if (!API_DOCS[entryConfig]) { + if (isPositionInsideNode(position, declaration.name)) { + prior.entries.push(...Object.keys(API_DOCS).map((name, index)=>{ + return createAutoCompletionOptionName(index, name); + })); + } + return; + } + prior.entries.push(...Object.keys(API_DOCS[entryConfig].options || {}).map((name, index)=>{ + return createAutoCompletionOptionValue(index, name, entryConfig); + })); + }); + }, + // Show docs when hovering on the exported configs. + getQuickInfoAtPosition (fileName, position, prior) { + const ts = getTs(); + let overridden; + visitEntryConfig(fileName, position, (entryConfig, declaration)=>{ + if (!API_DOCS[entryConfig]) return; + const name = declaration.name; + const value = declaration.initializer; + const docsLink = { + kind: 'text', + text: `\n\nRead more about the "${entryConfig}" option: ` + API_DOCS[entryConfig].link + }; + // When the value is a flexible type (like a function), also compute its + // inferred type so we can surface it alongside the docs. This is useful + // even when the value is considered invalid by the config validation, + // as long as it's not a direct literal export. + let displayParts = []; + const typeChecker = getTypeChecker(); + const isString = !!value && ts.isStringLiteral(value); + const isFunctionValue = !!value && !isString && (ts.isArrowFunction(value) || ts.isFunctionExpression(value) || ts.isFunctionDeclaration(value)); + if (typeChecker && value && isFunctionValue) { + try { + // If we're hovering the config identifier, ask for the type at the + // identifier; otherwise, ask at the value node. This makes sure + // highlighting `generateMetadata` itself also shows the inferred type. + const typeTarget = isPositionInsideNode(position, name) ? name : value; + const type = typeChecker.getTypeAtLocation(typeTarget); + if (type) { + const typeString = typeChecker.typeToString(type, typeTarget); + if (typeString) { + displayParts = [ + { + text: typeString, + kind: 'typeName' + } + ]; + } + } + } catch { + // If type checking fails, continue without type info. + } + } + // For non-function values (like literals), hovering the value should show + // option-specific docs. For function-valued configs (e.g. `generateMetadata`), + // we let TypeScript handle hover anywhere in the initializer except for the + // export identifier itself. + if (value && !isFunctionValue && isPositionInsideNode(position, value)) { + var _API_DOCS_entryConfig_isValid, _API_DOCS_entryConfig, _API_DOCS_entryConfig_options; + // Hovering the value of the config + const text = removeStringQuotes(value.getText()); + const key = isString ? `"${text}"` : text; + const isValid = API_DOCS[entryConfig].isValid ? (_API_DOCS_entryConfig_isValid = (_API_DOCS_entryConfig = API_DOCS[entryConfig]).isValid) == null ? void 0 : _API_DOCS_entryConfig_isValid.call(_API_DOCS_entryConfig, key) : !!((_API_DOCS_entryConfig_options = API_DOCS[entryConfig].options) == null ? void 0 : _API_DOCS_entryConfig_options[key]); + if (isValid) { + var _API_DOCS_entryConfig_options1, _API_DOCS_entryConfig_getHint, _API_DOCS_entryConfig1; + const documentation = [ + ...(prior == null ? void 0 : prior.documentation) || [], + { + kind: 'text', + text: ((_API_DOCS_entryConfig_options1 = API_DOCS[entryConfig].options) == null ? void 0 : _API_DOCS_entryConfig_options1[key]) || ((_API_DOCS_entryConfig_getHint = (_API_DOCS_entryConfig1 = API_DOCS[entryConfig]).getHint) == null ? void 0 : _API_DOCS_entryConfig_getHint.call(_API_DOCS_entryConfig1, key)) || '' + }, + docsLink + ]; + overridden = prior ? { + ...prior, + documentation + } : { + kind: ts.ScriptElementKind.enumElement, + kindModifiers: ts.ScriptElementKindModifier.none, + textSpan: { + start: value.getStart(), + length: value.getWidth() + }, + displayParts: [], + documentation + }; + } else { + // Wrong value: still show the docs link, and when available, the + // inferred type for non-literal (i.e. non-direct) exports. + overridden = { + kind: ts.ScriptElementKind.enumElement, + kindModifiers: ts.ScriptElementKindModifier.none, + textSpan: { + start: value.getStart(), + length: value.getWidth() + }, + displayParts, + documentation: [ + docsLink + ] + }; + } + } else { + // For function-valued configs, if we're hovering anywhere within the + // initializer (including `async`, parameters, or the body) but not on + // the export identifier itself, don't override TypeScript's default + // hover. We only want to override when hovering the config identifier + // (e.g. `generateMetadata`), not arbitrary tokens within the function. + if (isFunctionValue && isPositionInsideNode(position, value) && // hover is somewhere within the function initializer + !isPositionInsideNode(position, name) // ...but not on the export identifier itself + ) { + return; + } + // Hovers the name of the config + const documentation = [ + ...(prior == null ? void 0 : prior.documentation) || [], + { + kind: 'text', + text: getAPIDescription(entryConfig) + }, + docsLink + ]; + overridden = prior ? { + ...prior, + documentation + } : { + kind: ts.ScriptElementKind.enumElement, + kindModifiers: ts.ScriptElementKindModifier.none, + textSpan: { + start: name.getStart(), + length: name.getWidth() + }, + displayParts, + documentation + }; + } + }); + return overridden; + }, + // Show details on the side when auto completing. + getCompletionEntryDetails (entryName, data, fileName) { + const ts = getTs(); + if (data && data.moduleSpecifier && data.moduleSpecifier.startsWith('next/typescript')) { + let content = ''; + if (data.moduleSpecifier === 'next/typescript/entry_option_name') { + content = getAPIDescription(entryName); + } else { + const options = API_DOCS[data.exportName].options; + if (!options) return; + content = options[entryName]; + } + if (entryName === 'metadata' || entryName === 'generateMetadata') { + const sourceFile = getSource(fileName); + let start = 0; + let foundMetadataImport = false; + if (sourceFile) { + const visitor = (node)=>{ + // Check for top directive + if (ts.isExpressionStatement(node) && ts.isStringLiteral(node.expression) && node.expression.getStart() === 0) { + const text = node.expression.text; + if (text.startsWith('use ')) { + start = node.end + 1; + return node // Continue traversal + ; + } + } + // Check for Metadata import + if (ts.isImportDeclaration(node) && (node.moduleSpecifier.getText() === '"next"' || node.moduleSpecifier.getText() === "'next'")) { + var _node_importClause; + const namedImports = (_node_importClause = node.importClause) == null ? void 0 : _node_importClause.namedBindings; + if (namedImports && ts.isNamedImports(namedImports)) { + foundMetadataImport = namedImports.elements.some((element)=>{ + var _element_propertyName; + const name = element.name.getText(); + const propertyName = (_element_propertyName = element.propertyName) == null ? void 0 : _element_propertyName.getText(); + return name === 'Metadata' || propertyName === 'Metadata'; + }); + if (foundMetadataImport) { + return; // Stop traversal + } + } + } + return node; + }; + for (const statement of sourceFile.statements){ + if (foundMetadataImport) break; + ts.visitNode(statement, visitor); + } + } + return { + name: entryName, + kind: ts.ScriptElementKind.enumElement, + kindModifiers: ts.ScriptElementKindModifier.none, + displayParts: [], + codeActions: foundMetadataImport ? undefined : [ + { + description: `Import type 'Metadata' from module 'next'`, + changes: [ + { + fileName, + textChanges: [ + { + span: { + start, + length: 0 + }, + newText: `import type { Metadata } from 'next';\n` + } + ] + } + ] + } + ], + documentation: [ + { + kind: 'text', + text: content + } + ] + }; + } + return { + name: entryName, + kind: ts.ScriptElementKind.enumElement, + kindModifiers: ts.ScriptElementKindModifier.none, + displayParts: [], + documentation: [ + { + kind: 'text', + text: content + } + ] + }; + } + }, + // Show errors for invalid export fields. + getSemanticDiagnosticsForExportVariableStatement (source, node) { + const ts = getTs(); + const diagnostics = []; + // Check if it has correct option exports + if (ts.isVariableDeclarationList(node.declarationList)) { + for (const declaration of node.declarationList.declarations){ + const name = declaration.name; + if (ts.isIdentifier(name)) { + if (!ALLOWED_EXPORTS.includes(name.text) && !API_DOCS[name.text]) { + diagnostics.push({ + file: source, + category: ts.DiagnosticCategory.Error, + code: NEXT_TS_ERRORS.INVALID_ENTRY_EXPORT, + messageText: `"${name.text}" is not a valid Next.js entry export value.`, + start: name.getStart(), + length: name.getWidth() + }); + } else if (API_DOCS[name.text]) { + // Check if the value is valid + const value = declaration.initializer; + const options = API_DOCS[name.text].options; + if (value && options) { + let displayedValue = ''; + let errorMessage = ''; + let isInvalid = false; + if (ts.isStringLiteral(value) || ts.isNoSubstitutionTemplateLiteral(value)) { + var _API_DOCS_name_text_isValid, _API_DOCS_name_text; + const val = '"' + removeStringQuotes(value.getText()) + '"'; + const allowedValues = Object.keys(options).filter((v)=>/^['"]/.test(v)); + if (!allowedValues.includes(val) && !((_API_DOCS_name_text_isValid = (_API_DOCS_name_text = API_DOCS[name.text]).isValid) == null ? void 0 : _API_DOCS_name_text_isValid.call(_API_DOCS_name_text, val))) { + isInvalid = true; + displayedValue = val; + } + } else if (ts.isNumericLiteral(value) || ts.isPrefixUnaryExpression(value) && ts.isMinusToken(value.operator) && (ts.isNumericLiteral(value.operand.kind) || ts.isIdentifier(value.operand.kind) && value.operand.kind.getText() === 'Infinity') || ts.isIdentifier(value) && value.getText() === 'Infinity') { + var _API_DOCS_name_text_isValid1, _API_DOCS_name_text1; + const v = value.getText(); + if (!((_API_DOCS_name_text_isValid1 = (_API_DOCS_name_text1 = API_DOCS[name.text]).isValid) == null ? void 0 : _API_DOCS_name_text_isValid1.call(_API_DOCS_name_text1, v))) { + isInvalid = true; + displayedValue = v; + } + } else if (value.kind === ts.SyntaxKind.TrueKeyword || value.kind === ts.SyntaxKind.FalseKeyword) { + var _API_DOCS_name_text_isValid2, _API_DOCS_name_text2; + const v = value.getText(); + if (!((_API_DOCS_name_text_isValid2 = (_API_DOCS_name_text2 = API_DOCS[name.text]).isValid) == null ? void 0 : _API_DOCS_name_text_isValid2.call(_API_DOCS_name_text2, v))) { + isInvalid = true; + displayedValue = v; + } + } else if (ts.isArrayLiteralExpression(value)) { + var _API_DOCS_name_text_isValid3, _API_DOCS_name_text3; + const v = value.getText(); + if (!((_API_DOCS_name_text_isValid3 = (_API_DOCS_name_text3 = API_DOCS[name.text]).isValid) == null ? void 0 : _API_DOCS_name_text_isValid3.call(_API_DOCS_name_text3, JSON.stringify(value.elements.map((e)=>e.getText()))))) { + isInvalid = true; + displayedValue = v; + } + } else if (// Other literals + ts.isBigIntLiteral(value) || ts.isObjectLiteralExpression(value) || ts.isRegularExpressionLiteral(value) || ts.isPrefixUnaryExpression(value)) { + isInvalid = true; + displayedValue = value.getText(); + } else { + // Not a literal, error because it's not statically analyzable + isInvalid = true; + displayedValue = value.getText(); + errorMessage = `"${displayedValue}" is not a valid value for the "${name.text}" option. The configuration must be statically analyzable.`; + } + if (isInvalid) { + diagnostics.push({ + file: source, + category: ts.DiagnosticCategory.Error, + code: NEXT_TS_ERRORS.INVALID_OPTION_VALUE, + messageText: errorMessage || `"${displayedValue}" is not a valid value for the "${name.text}" option.`, + start: value.getStart(), + length: value.getWidth() + }); + } + } + } + } + } + } + return diagnostics; + } +}; +export default config; + +//# sourceMappingURL=config.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/rules/config.js.map b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/config.js.map new file mode 100644 index 0000000000000000000000000000000000000000..15c1ee5e529ca0528483ed490c6327b5c098ef19 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/config.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/typescript/rules/config.ts"],"sourcesContent":["// This module provides intellisense for page and layout's exported configs.\n\nimport {\n getSource,\n isPositionInsideNode,\n getTs,\n removeStringQuotes,\n getTypeChecker,\n} from '../utils'\nimport { NEXT_TS_ERRORS, ALLOWED_EXPORTS } from '../constant'\nimport type tsModule from 'typescript/lib/tsserverlibrary'\nimport type {\n AppSegmentConfig,\n EnsureStatic,\n} from '../../../build/segment-config/app/app-segment-config'\n\nconst API_DOCS: Record<\n string,\n {\n description: string\n options?: Record\n link?: string\n type?: string\n isValid?: (value: string) => boolean\n getHint?: (value: any) => string | undefined\n insertText?: string\n }\n> = {\n dynamic: {\n description:\n 'The `dynamic` option provides a few ways to opt in or out of dynamic behavior.',\n options: {\n '\"auto\"':\n \"Heuristic to cache as much as possible but doesn't prevent any component to opt-in to dynamic behavior.\",\n '\"force-dynamic\"':\n 'This disables all caching of fetches and always revalidates. (This is equivalent to `getServerSideProps`.)',\n '\"error\"':\n 'This errors if any dynamic Hooks or fetches are used. (This is equivalent to `getStaticProps`.)',\n '\"force-static\"':\n 'This forces caching of all fetches and returns empty values from `cookies`, `headers` and `useSearchParams`.',\n } satisfies DocsOptionsObject,\n link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamic',\n },\n fetchCache: {\n description:\n \"The `fetchCache` option controls how Next.js statically caches fetches. By default it statically caches fetches reachable before any dynamic Hooks are used, and it doesn't cache fetches that are discovered after that.\",\n options: {\n '\"force-no-store\"':\n \"This lets you intentionally opt-out of all caching of data. This option forces all fetches to be refetched every request even if the `cache: 'force-cache'` option is passed to `fetch()`.\",\n '\"only-no-store\"':\n \"This lets you enforce that all data opts out of caching. This option makes `fetch()` reject with an error if `cache: 'force-cache'` is provided. It also changes the default to `no-store`.\",\n '\"default-no-store\"':\n \"Allows any explicit `cache` option to be passed to `fetch()` but if `'default'`, or no option, is provided then it defaults to `'no-store'`. This means that even fetches before a dynamic Hook are considered dynamic.\",\n '\"auto\"':\n \"This is the default option. It caches any fetches with the default `cache` option provided, that happened before a dynamic Hook is used and don't cache any such fetches if they're issued after a dynamic Hook.\",\n '\"default-cache\"':\n \"Allows any explicit `cache` option to be passed to `fetch()` but if `'default'`, or no option, is provided then it defaults to `'force-cache'`. This means that even fetches before a dynamic Hook are considered dynamic.\",\n '\"only-cache\"':\n \"This lets you enforce that all data opts into caching. This option makes `fetch()` reject with an error if `cache: 'force-cache'` is provided. It also changes the default to `force-cache`. This error can be discovered early during static builds - or dynamically during Edge rendering.\",\n '\"force-cache\"':\n \"This lets you intentionally opt-in to all caching of data. This option forces all fetches to be cache even if the `cache: 'no-store'` option is passed to `fetch()`.\",\n } satisfies DocsOptionsObject,\n link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#fetchcache',\n },\n preferredRegion: {\n description:\n '@deprecated\\\\n\\\\nThe `preferredRegion` route segment config is deprecated. Remove this export.',\n options: {\n '\"auto\"':\n '@deprecated\\\\n\\\\nNext.js will first deploy to the `\"home\"` region. Then if it doesn\\'t detect any waterfall requests after a few requests, it can upgrade that route, to be deployed globally. If it detects any waterfall requests after that, it can eventually downgrade back to `\"home`\".',\n '\"global\"': '@deprecated\\\\n\\\\nPrefer deploying globally.',\n '\"home\"': '@deprecated\\\\n\\\\nPrefer deploying to the Home region.',\n },\n link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#preferredregion',\n isValid: (value: string) => {\n try {\n const parsed = JSON.parse(value)\n return (\n typeof parsed === 'string' ||\n (Array.isArray(parsed) && !parsed.some((v) => typeof v !== 'string'))\n )\n } catch (err) {\n return false\n }\n },\n getHint: (value: any) => {\n if (value === 'auto') return `Automatically chosen by Next.js.`\n if (value === 'global') return `Prefer deploying globally.`\n if (value === 'home') return `Prefer deploying to the Home region.`\n if (Array.isArray(value)) return `Deploy to regions: ${value.join(', ')}.`\n if (typeof value === 'string') return `Deploy to region: ${value}.`\n },\n },\n revalidate: {\n description:\n \"The `revalidate` option sets the default revalidation time for that layout or page. Note that it doesn't override the value specify by each `fetch()`.\",\n type: 'mixed',\n options: {\n false:\n 'This is the default and changes the fetch cache to indefinitely cache anything that uses force-cache or is fetched before a dynamic Hook/fetch.',\n 0: 'Specifying `0` implies that this layout or page should never be static.',\n 30: 'Set the revalidation time to `30` seconds. The value can be `0` or any positive number.',\n },\n link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#revalidate',\n isValid: (value: string) => {\n return value === 'false' || Number(value.replace(/_/g, '')) >= 0\n },\n getHint: (value: any) => {\n return `Set the default revalidation time to \\`${value}\\` seconds.`\n },\n },\n dynamicParams: {\n description:\n '`dynamicParams` replaces the `fallback` option of `getStaticPaths`. It controls whether we allow `dynamicParams` beyond the generated static params from `generateStaticParams`.',\n options: {\n true: 'Allow rendering dynamic params that are not generated by `generateStaticParams`.',\n false:\n 'Disallow rendering dynamic params that are not generated by `generateStaticParams`.',\n } satisfies DocsOptionsObject,\n link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamicparams',\n isValid: (value: string) => {\n return value === 'true' || value === 'false'\n },\n },\n runtime: {\n description:\n 'The `runtime` option controls the preferred runtime to render this route.',\n options: {\n '\"nodejs\"': 'Prefer the Node.js runtime.',\n '\"edge\"': `@deprecated\\n\\nThe Edge Runtime is deprecated. Use \\`\"nodejs\"\\` instead.`,\n '\"experimental-edge\"': `@deprecated\\n\\nThis option is no longer experimental. Use \\`edge\\` instead.`,\n } satisfies DocsOptionsObject<\n FullAppSegmentConfig['runtime'] | 'experimental-edge'\n >,\n link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#runtime',\n },\n metadata: {\n description: 'Next.js Metadata configurations',\n link: 'https://nextjs.org/docs/app/building-your-application/optimizing/metadata',\n insertText: 'metadata: Metadata = {};',\n },\n generateMetadata: {\n description: 'Next.js generateMetadata configurations',\n link: 'https://nextjs.org/docs/app/api-reference/functions/generate-metadata',\n insertText: 'generateMetadata = (): Metadata => { return {} };',\n },\n maxDuration: {\n description:\n '`maxDuration` allows you to set max default execution time for your function. If it is not specified, the default value is dependent on your deployment platform and plan.',\n link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#maxduration',\n },\n instant: {\n description: `Enables instant navigation validation for this segment.`,\n link: 'https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config/instant',\n type: 'true | object | false',\n // TODO: ideally, we'd validate the config object somehow, but this is difficult to do\n // with the way this plugin is currently structured.\n // For now, since we don't provide an `options` here, we won't do any validation in\n // `getSemanticDiagnosticsForExportVariableStatement` below, and only provide hover a tooltip + autocomplete.\n insertText: 'instant = true;',\n },\n prefetch: {\n description: `Controls prefetching behavior for this segment. Some options are experimental and may change.`,\n link: '(docs coming soon)',\n type: `\"auto\" | \"partial\" | \"force-disabled\"`,\n options: {\n auto: 'Default. Framework decides based on instant validation and segment configuration. You do not need to set this explicitly.',\n partial:\n 'Enables Partial Prefetching for this segment. When a static prefetch is insufficient, Next.js may prefetch the segment with a runtime server request so it can access session data, such as cookies.',\n 'force-disabled': 'Never prefetch this segment.',\n },\n insertText: `prefetch = 'partial';`,\n },\n ensureStatic: {\n description: `Controls which rendering phases require static output for this segment. This option is experimental and may change.`,\n link: '(docs coming soon)',\n type: `\"auto\" | \"shell\" | \"prefetch\" | \"navigation\" | false`,\n options: {\n '\"auto\"':\n 'Default. The shell, prefetch, or entire page will automatically be prerendered statically if possible.',\n '\"shell\"': 'Force the shell for the route to be prerendered statically.',\n '\"prefetch\"':\n 'Force both the shell and the prefetch (``) for the route to be prerendered statically.',\n '\"navigation\"': 'Require the route to be fully static.',\n false:\n 'Indicate that this segment must use the default behavior and should not have `ensureStatic = \"shell\" | \"prefetch\" | \"navigation\"` applied to it by another segment. Errors if another segment on the route uses `ensureStatic` with those values.',\n } satisfies DocsOptionsObject,\n insertText: `ensureStatic = 'shell';`,\n isValid: (value) => {\n try {\n const parsed: unknown = JSON.parse(value)\n return (VALID_ENSURE_STATIC_VALUES as unknown[]).includes(parsed)\n } catch {\n return false\n }\n },\n },\n unstable_dynamicStaleTime: {\n description: `Controls how long the client-side router cache retains dynamic page data (in seconds). Pages only — not allowed in layouts. Cannot be combined with \\`instant\\`.`,\n link: '(docs coming soon)',\n type: 'number',\n isValid: (value: string) => {\n return Number(value.replace(/_/g, '')) >= 0\n },\n getHint: (value: any) => {\n return `Set the dynamic stale time to \\`${value}\\` seconds.`\n },\n },\n}\n\nconst VALID_ENSURE_STATIC_VALUES: EnsureStatic[] = [\n 'auto',\n 'shell',\n 'prefetch',\n 'navigation',\n false,\n]\n\ntype FullAppSegmentConfig = Required\n\n/**\n * Maps a type for a config value to a docs object that lists all its values.\n * This ensures that all the valid options are listed.\n * Note that values that aren't primitives are skipped.\n *\n * ```\n * DocsOptionsObject<0 | false | \"yes\"> = { 0: string, false: string, '\"yes\"': string }\n * ```\n */\ntype DocsOptionsObject = {\n [Value in T as AsObjectKey]: string\n}\n\ntype AsObjectKey = Value extends string\n ? `\"${Value}\"`\n : Value extends number | boolean | null | undefined\n ? `${Value}`\n : never\n\nfunction visitEntryConfig(\n fileName: string,\n position: number,\n callback: (entryEonfig: string, value: tsModule.VariableDeclaration) => void\n) {\n const source = getSource(fileName)\n if (source) {\n const ts = getTs()\n ts.forEachChild(source, function visit(node) {\n // Covered by this node\n if (isPositionInsideNode(position, node)) {\n // Export variable\n if (\n ts.isVariableStatement(node) &&\n node.modifiers?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword)\n ) {\n if (ts.isVariableDeclarationList(node.declarationList)) {\n for (const declaration of node.declarationList.declarations) {\n if (isPositionInsideNode(position, declaration)) {\n // `export const ... = ...`\n const text = declaration.name.getText()\n callback(text, declaration)\n }\n }\n }\n }\n }\n })\n }\n}\n\nfunction createAutoCompletionOptionName(sort: number, name: string) {\n const ts = getTs()\n\n return {\n name,\n insertText: API_DOCS[name].insertText,\n sortText: '!' + sort,\n kind: ts.ScriptElementKind.constElement,\n kindModifiers: ts.ScriptElementKindModifier.exportedModifier,\n labelDetails: {\n description: `Next.js ${name} option`,\n },\n data: {\n exportName: name,\n moduleSpecifier: 'next/typescript/entry_option_name',\n },\n } as tsModule.CompletionEntry\n}\n\nfunction createAutoCompletionOptionValue(\n sort: number,\n name: string,\n apiName: string\n) {\n const ts = getTs()\n const isString = name.startsWith('\"')\n return {\n name,\n insertText: removeStringQuotes(name),\n sortText: '' + sort,\n kind: isString ? ts.ScriptElementKind.string : ts.ScriptElementKind.unknown,\n kindModifiers: ts.ScriptElementKindModifier.none,\n labelDetails: {\n description: `Next.js ${apiName} option`,\n },\n data: {\n exportName: apiName,\n moduleSpecifier: 'next/typescript/entry_option_value',\n },\n } as tsModule.CompletionEntry\n}\n\nfunction getAPIDescription(api: string): string {\n return (\n API_DOCS[api].description +\n '\\n\\n' +\n Object.entries(API_DOCS[api].options || {})\n .map(([key, value]) => `- \\`${key}\\`: ${value}`)\n .join('\\n')\n )\n}\n\nconst config = {\n // Auto completion for entry exported configs.\n addCompletionsAtPosition(\n fileName: string,\n position: number,\n prior: tsModule.WithMetadata\n ) {\n visitEntryConfig(fileName, position, (entryConfig, declaration) => {\n if (!API_DOCS[entryConfig]) {\n if (isPositionInsideNode(position, declaration.name)) {\n prior.entries.push(\n ...Object.keys(API_DOCS).map((name, index) => {\n return createAutoCompletionOptionName(index, name)\n })\n )\n }\n return\n }\n\n prior.entries.push(\n ...Object.keys(API_DOCS[entryConfig].options || {}).map(\n (name, index) => {\n return createAutoCompletionOptionValue(index, name, entryConfig)\n }\n )\n )\n })\n },\n\n // Show docs when hovering on the exported configs.\n getQuickInfoAtPosition(\n fileName: string,\n position: number,\n prior?: tsModule.QuickInfo\n ) {\n const ts = getTs()\n\n let overridden: tsModule.QuickInfo | undefined\n visitEntryConfig(fileName, position, (entryConfig, declaration) => {\n if (!API_DOCS[entryConfig]) return\n\n const name = declaration.name\n const value = declaration.initializer\n\n const docsLink = {\n kind: 'text',\n text:\n `\\n\\nRead more about the \"${entryConfig}\" option: ` +\n API_DOCS[entryConfig].link,\n }\n\n // When the value is a flexible type (like a function), also compute its\n // inferred type so we can surface it alongside the docs. This is useful\n // even when the value is considered invalid by the config validation,\n // as long as it's not a direct literal export.\n let displayParts: tsModule.SymbolDisplayPart[] = []\n const typeChecker = getTypeChecker()\n const isString = !!value && ts.isStringLiteral(value)\n const isFunctionValue =\n !!value &&\n !isString &&\n (ts.isArrowFunction(value) ||\n ts.isFunctionExpression(value) ||\n ts.isFunctionDeclaration(value))\n\n if (typeChecker && value && isFunctionValue) {\n try {\n // If we're hovering the config identifier, ask for the type at the\n // identifier; otherwise, ask at the value node. This makes sure\n // highlighting `generateMetadata` itself also shows the inferred type.\n const typeTarget = isPositionInsideNode(position, name) ? name : value\n const type = typeChecker.getTypeAtLocation(typeTarget)\n if (type) {\n const typeString = typeChecker.typeToString(type, typeTarget)\n if (typeString) {\n displayParts = [\n {\n text: typeString,\n kind: 'typeName',\n },\n ]\n }\n }\n } catch {\n // If type checking fails, continue without type info.\n }\n }\n\n // For non-function values (like literals), hovering the value should show\n // option-specific docs. For function-valued configs (e.g. `generateMetadata`),\n // we let TypeScript handle hover anywhere in the initializer except for the\n // export identifier itself.\n if (value && !isFunctionValue && isPositionInsideNode(position, value)) {\n // Hovering the value of the config\n const text = removeStringQuotes(value.getText())\n const key = isString ? `\"${text}\"` : text\n\n const isValid = API_DOCS[entryConfig].isValid\n ? API_DOCS[entryConfig].isValid?.(key)\n : !!API_DOCS[entryConfig].options?.[key]\n\n if (isValid) {\n const documentation: tsModule.SymbolDisplayPart[] = [\n ...(prior?.documentation || []),\n {\n kind: 'text',\n text:\n API_DOCS[entryConfig].options?.[key] ||\n API_DOCS[entryConfig].getHint?.(key) ||\n '',\n },\n docsLink,\n ]\n\n overridden = prior\n ? { ...prior, documentation }\n : {\n kind: ts.ScriptElementKind.enumElement,\n kindModifiers: ts.ScriptElementKindModifier.none,\n textSpan: {\n start: value.getStart(),\n length: value.getWidth(),\n },\n displayParts: [],\n documentation,\n }\n } else {\n // Wrong value: still show the docs link, and when available, the\n // inferred type for non-literal (i.e. non-direct) exports.\n overridden = {\n kind: ts.ScriptElementKind.enumElement,\n kindModifiers: ts.ScriptElementKindModifier.none,\n textSpan: {\n start: value.getStart(),\n length: value.getWidth(),\n },\n displayParts,\n documentation: [docsLink],\n }\n }\n } else {\n // For function-valued configs, if we're hovering anywhere within the\n // initializer (including `async`, parameters, or the body) but not on\n // the export identifier itself, don't override TypeScript's default\n // hover. We only want to override when hovering the config identifier\n // (e.g. `generateMetadata`), not arbitrary tokens within the function.\n if (\n isFunctionValue &&\n isPositionInsideNode(position, value) && // hover is somewhere within the function initializer\n !isPositionInsideNode(position, name) // ...but not on the export identifier itself\n ) {\n return\n }\n // Hovers the name of the config\n const documentation: tsModule.SymbolDisplayPart[] = [\n ...(prior?.documentation || []),\n {\n kind: 'text',\n text: getAPIDescription(entryConfig),\n },\n docsLink,\n ]\n\n overridden = prior\n ? { ...prior, documentation }\n : {\n kind: ts.ScriptElementKind.enumElement,\n kindModifiers: ts.ScriptElementKindModifier.none,\n textSpan: {\n start: name.getStart(),\n length: name.getWidth(),\n },\n displayParts,\n documentation,\n }\n }\n })\n return overridden\n },\n\n // Show details on the side when auto completing.\n getCompletionEntryDetails(\n entryName: string,\n data: tsModule.CompletionEntryData,\n fileName: string\n ): tsModule.CompletionEntryDetails | undefined {\n const ts = getTs()\n if (\n data &&\n data.moduleSpecifier &&\n data.moduleSpecifier.startsWith('next/typescript')\n ) {\n let content = ''\n if (data.moduleSpecifier === 'next/typescript/entry_option_name') {\n content = getAPIDescription(entryName)\n } else {\n const options = API_DOCS[data.exportName].options\n if (!options) return\n content = options[entryName]\n }\n\n if (entryName === 'metadata' || entryName === 'generateMetadata') {\n const sourceFile = getSource(fileName)\n let start = 0\n let foundMetadataImport = false\n\n if (sourceFile) {\n const visitor: tsModule.Visitor = (node) => {\n // Check for top directive\n if (\n ts.isExpressionStatement(node) &&\n ts.isStringLiteral(node.expression) &&\n node.expression.getStart() === 0\n ) {\n const text = node.expression.text\n if (text.startsWith('use ')) {\n start = node.end + 1\n return node // Continue traversal\n }\n }\n\n // Check for Metadata import\n if (\n ts.isImportDeclaration(node) &&\n (node.moduleSpecifier.getText() === '\"next\"' ||\n node.moduleSpecifier.getText() === \"'next'\")\n ) {\n const namedImports = node.importClause?.namedBindings\n if (namedImports && ts.isNamedImports(namedImports)) {\n foundMetadataImport = namedImports.elements.some((element) => {\n const name = element.name.getText()\n const propertyName = element.propertyName?.getText()\n return name === 'Metadata' || propertyName === 'Metadata'\n })\n if (foundMetadataImport) {\n return // Stop traversal\n }\n }\n }\n\n return node\n }\n\n for (const statement of sourceFile.statements) {\n if (foundMetadataImport) break\n ts.visitNode(statement, visitor)\n }\n }\n\n return {\n name: entryName,\n kind: ts.ScriptElementKind.enumElement,\n kindModifiers: ts.ScriptElementKindModifier.none,\n displayParts: [],\n codeActions: foundMetadataImport\n ? undefined\n : [\n {\n description: `Import type 'Metadata' from module 'next'`,\n changes: [\n {\n fileName,\n textChanges: [\n {\n span: { start, length: 0 },\n newText: `import type { Metadata } from 'next';\\n`,\n },\n ],\n },\n ],\n },\n ],\n documentation: [\n {\n kind: 'text',\n text: content,\n },\n ],\n }\n }\n\n return {\n name: entryName,\n kind: ts.ScriptElementKind.enumElement,\n kindModifiers: ts.ScriptElementKindModifier.none,\n displayParts: [],\n documentation: [\n {\n kind: 'text',\n text: content,\n },\n ],\n }\n }\n },\n\n // Show errors for invalid export fields.\n getSemanticDiagnosticsForExportVariableStatement(\n source: tsModule.SourceFile,\n node: tsModule.VariableStatement\n ) {\n const ts = getTs()\n\n const diagnostics: tsModule.Diagnostic[] = []\n\n // Check if it has correct option exports\n if (ts.isVariableDeclarationList(node.declarationList)) {\n for (const declaration of node.declarationList.declarations) {\n const name = declaration.name\n if (ts.isIdentifier(name)) {\n if (!ALLOWED_EXPORTS.includes(name.text) && !API_DOCS[name.text]) {\n diagnostics.push({\n file: source,\n category: ts.DiagnosticCategory.Error,\n code: NEXT_TS_ERRORS.INVALID_ENTRY_EXPORT,\n messageText: `\"${name.text}\" is not a valid Next.js entry export value.`,\n start: name.getStart(),\n length: name.getWidth(),\n })\n } else if (API_DOCS[name.text]) {\n // Check if the value is valid\n const value = declaration.initializer\n const options = API_DOCS[name.text].options\n\n if (value && options) {\n let displayedValue = ''\n let errorMessage = ''\n let isInvalid = false\n\n if (\n ts.isStringLiteral(value) ||\n ts.isNoSubstitutionTemplateLiteral(value)\n ) {\n const val = '\"' + removeStringQuotes(value.getText()) + '\"'\n const allowedValues = Object.keys(options).filter((v) =>\n /^['\"]/.test(v)\n )\n\n if (\n !allowedValues.includes(val) &&\n !API_DOCS[name.text].isValid?.(val)\n ) {\n isInvalid = true\n displayedValue = val\n }\n } else if (\n ts.isNumericLiteral(value) ||\n (ts.isPrefixUnaryExpression(value) &&\n ts.isMinusToken((value as any).operator) &&\n (ts.isNumericLiteral((value as any).operand.kind) ||\n (ts.isIdentifier((value as any).operand.kind) &&\n (value as any).operand.kind.getText() === 'Infinity'))) ||\n (ts.isIdentifier(value) && value.getText() === 'Infinity')\n ) {\n const v = value.getText()\n if (!API_DOCS[name.text].isValid?.(v)) {\n isInvalid = true\n displayedValue = v\n }\n } else if (\n value.kind === ts.SyntaxKind.TrueKeyword ||\n value.kind === ts.SyntaxKind.FalseKeyword\n ) {\n const v = value.getText()\n if (!API_DOCS[name.text].isValid?.(v)) {\n isInvalid = true\n displayedValue = v\n }\n } else if (ts.isArrayLiteralExpression(value)) {\n const v = value.getText()\n if (\n !API_DOCS[name.text].isValid?.(\n JSON.stringify(value.elements.map((e) => e.getText()))\n )\n ) {\n isInvalid = true\n displayedValue = v\n }\n } else if (\n // Other literals\n ts.isBigIntLiteral(value) ||\n ts.isObjectLiteralExpression(value) ||\n ts.isRegularExpressionLiteral(value) ||\n ts.isPrefixUnaryExpression(value)\n ) {\n isInvalid = true\n displayedValue = value.getText()\n } else {\n // Not a literal, error because it's not statically analyzable\n isInvalid = true\n displayedValue = value.getText()\n errorMessage = `\"${displayedValue}\" is not a valid value for the \"${name.text}\" option. The configuration must be statically analyzable.`\n }\n\n if (isInvalid) {\n diagnostics.push({\n file: source,\n category: ts.DiagnosticCategory.Error,\n code: NEXT_TS_ERRORS.INVALID_OPTION_VALUE,\n messageText:\n errorMessage ||\n `\"${displayedValue}\" is not a valid value for the \"${name.text}\" option.`,\n start: value.getStart(),\n length: value.getWidth(),\n })\n }\n }\n }\n }\n }\n }\n\n return diagnostics\n },\n}\n\nexport default config\n"],"names":["getSource","isPositionInsideNode","getTs","removeStringQuotes","getTypeChecker","NEXT_TS_ERRORS","ALLOWED_EXPORTS","API_DOCS","dynamic","description","options","link","fetchCache","preferredRegion","isValid","value","parsed","JSON","parse","Array","isArray","some","v","err","getHint","join","revalidate","type","false","Number","replace","dynamicParams","true","runtime","metadata","insertText","generateMetadata","maxDuration","instant","prefetch","auto","partial","ensureStatic","VALID_ENSURE_STATIC_VALUES","includes","unstable_dynamicStaleTime","visitEntryConfig","fileName","position","callback","source","ts","forEachChild","visit","node","isVariableStatement","modifiers","m","kind","SyntaxKind","ExportKeyword","isVariableDeclarationList","declarationList","declaration","declarations","text","name","getText","createAutoCompletionOptionName","sort","sortText","ScriptElementKind","constElement","kindModifiers","ScriptElementKindModifier","exportedModifier","labelDetails","data","exportName","moduleSpecifier","createAutoCompletionOptionValue","apiName","isString","startsWith","string","unknown","none","getAPIDescription","api","Object","entries","map","key","config","addCompletionsAtPosition","prior","entryConfig","push","keys","index","getQuickInfoAtPosition","overridden","initializer","docsLink","displayParts","typeChecker","isStringLiteral","isFunctionValue","isArrowFunction","isFunctionExpression","isFunctionDeclaration","typeTarget","getTypeAtLocation","typeString","typeToString","documentation","enumElement","textSpan","start","getStart","length","getWidth","getCompletionEntryDetails","entryName","content","sourceFile","foundMetadataImport","visitor","isExpressionStatement","expression","end","isImportDeclaration","namedImports","importClause","namedBindings","isNamedImports","elements","element","propertyName","statement","statements","visitNode","codeActions","undefined","changes","textChanges","span","newText","getSemanticDiagnosticsForExportVariableStatement","diagnostics","isIdentifier","file","category","DiagnosticCategory","Error","code","INVALID_ENTRY_EXPORT","messageText","displayedValue","errorMessage","isInvalid","isNoSubstitutionTemplateLiteral","val","allowedValues","filter","test","isNumericLiteral","isPrefixUnaryExpression","isMinusToken","operator","operand","TrueKeyword","FalseKeyword","isArrayLiteralExpression","stringify","e","isBigIntLiteral","isObjectLiteralExpression","isRegularExpressionLiteral","INVALID_OPTION_VALUE"],"mappings":"AAAA,4EAA4E;AAE5E,SACEA,SAAS,EACTC,oBAAoB,EACpBC,KAAK,EACLC,kBAAkB,EAClBC,cAAc,QACT,WAAU;AACjB,SAASC,cAAc,EAAEC,eAAe,QAAQ,cAAa;AAO7D,MAAMC,WAWF;IACFC,SAAS;QACPC,aACE;QACFC,SAAS;YACP,UACE;YACF,mBACE;YACF,WACE;YACF,kBACE;QACJ;QACAC,MAAM;IACR;IACAC,YAAY;QACVH,aACE;QACFC,SAAS;YACP,oBACE;YACF,mBACE;YACF,sBACE;YACF,UACE;YACF,mBACE;YACF,gBACE;YACF,iBACE;QACJ;QACAC,MAAM;IACR;IACAE,iBAAiB;QACfJ,aACE;QACFC,SAAS;YACP,UACE;YACF,YAAY;YACZ,UAAU;QACZ;QACAC,MAAM;QACNG,SAAS,CAACC;YACR,IAAI;gBACF,MAAMC,SAASC,KAAKC,KAAK,CAACH;gBAC1B,OACE,OAAOC,WAAW,YACjBG,MAAMC,OAAO,CAACJ,WAAW,CAACA,OAAOK,IAAI,CAAC,CAACC,IAAM,OAAOA,MAAM;YAE/D,EAAE,OAAOC,KAAK;gBACZ,OAAO;YACT;QACF;QACAC,SAAS,CAACT;YACR,IAAIA,UAAU,QAAQ,OAAO,CAAC,gCAAgC,CAAC;YAC/D,IAAIA,UAAU,UAAU,OAAO,CAAC,0BAA0B,CAAC;YAC3D,IAAIA,UAAU,QAAQ,OAAO,CAAC,oCAAoC,CAAC;YACnE,IAAII,MAAMC,OAAO,CAACL,QAAQ,OAAO,CAAC,mBAAmB,EAAEA,MAAMU,IAAI,CAAC,MAAM,CAAC,CAAC;YAC1E,IAAI,OAAOV,UAAU,UAAU,OAAO,CAAC,kBAAkB,EAAEA,MAAM,CAAC,CAAC;QACrE;IACF;IACAW,YAAY;QACVjB,aACE;QACFkB,MAAM;Q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BACCU,KAAK6J,SAAS,CAAC/J,MAAMyH,QAAQ,CAAC7C,GAAG,CAAC,CAACoF,IAAMA,EAAE5G,OAAO,QAEpD;oCACA6F,YAAY;oCACZF,iBAAiBxI;gCACnB;4BACF,OAAO,IACL,iBAAiB;4BACjB6B,GAAG6H,eAAe,CAACjK,UACnBoC,GAAG8H,yBAAyB,CAAClK,UAC7BoC,GAAG+H,0BAA0B,CAACnK,UAC9BoC,GAAGoH,uBAAuB,CAACxJ,QAC3B;gCACAiJ,YAAY;gCACZF,iBAAiB/I,MAAMoD,OAAO;4BAChC,OAAO;gCACL,8DAA8D;gCAC9D6F,YAAY;gCACZF,iBAAiB/I,MAAMoD,OAAO;gCAC9B4F,eAAe,CAAC,CAAC,EAAED,eAAe,gCAAgC,EAAE5F,KAAKD,IAAI,CAAC,0DAA0D,CAAC;4BAC3I;4BAEA,IAAI+F,WAAW;gCACbX,YAAYpD,IAAI,CAAC;oCACfsD,MAAMrG;oCACNsG,UAAUrG,GAAGsG,kBAAkB,CAACC,KAAK;oCACrCC,MAAMtJ,eAAe8K,oBAAoB;oCACzCtB,aACEE,gBACA,CAAC,CAAC,EAAED,eAAe,gCAAgC,EAAE5F,KAAKD,IAAI,CAAC,SAAS,CAAC;oCAC3EqD,OAAOvG,MAAMwG,QAAQ;oCACrBC,QAAQzG,MAAM0G,QAAQ;gCACxB;4BACF;wBACF;oBACF;gBACF;YACF;QACF;QAEA,OAAO4B;IACT;AACF;AAEA,eAAexD,OAAM","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/rules/entry.js b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/entry.js new file mode 100644 index 0000000000000000000000000000000000000000..958ff582957578434c9e453d58f4ed4b9e5153ae --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/entry.js @@ -0,0 +1,134 @@ +import path from 'path'; +import fs from 'fs'; +import { ALLOWED_LAYOUT_PROPS, ALLOWED_PAGE_PROPS, NEXT_TS_ERRORS } from '../constant'; +import { getTs, isPageFile, isPositionInsideNode } from '../utils'; +const entry = { + // Give auto completion for the component's props + getCompletionsAtPosition (fileName, node, position) { + var _node_parameters; + const ts = getTs(); + const entries = []; + // Default export function might not accept parameters + const paramNode = (_node_parameters = node.parameters) == null ? void 0 : _node_parameters[0]; + if (paramNode && isPositionInsideNode(position, paramNode)) { + const props = paramNode == null ? void 0 : paramNode.name; + if (props && ts.isObjectBindingPattern(props)) { + let validProps = []; + let validPropsWithType = []; + let type; + if (isPageFile(fileName)) { + // For page entries (page.js), it can only have `params` and `searchParams` + // as the prop names. + validProps = ALLOWED_PAGE_PROPS; + validPropsWithType = ALLOWED_PAGE_PROPS; + type = 'page'; + } else { + // For layout entires, check if it has any named slots. + const currentDir = path.dirname(fileName); + const items = fs.readdirSync(currentDir, { + withFileTypes: true + }); + const slots = []; + for (const item of items){ + if (item.isDirectory() && item.name.startsWith('@')) { + slots.push(item.name.slice(1)); + } + } + validProps = ALLOWED_LAYOUT_PROPS.concat(slots); + validPropsWithType = ALLOWED_LAYOUT_PROPS.concat(slots.map((s)=>`${s}: React.ReactNode`)); + type = 'layout'; + } + // Auto completion for props + for (const element of props.elements){ + if (isPositionInsideNode(position, element)) { + const nameNode = element.propertyName || element.name; + if (isPositionInsideNode(position, nameNode)) { + for (const name of validProps){ + entries.push({ + name, + insertText: name, + sortText: '_' + name, + kind: ts.ScriptElementKind.memberVariableElement, + kindModifiers: ts.ScriptElementKindModifier.none, + labelDetails: { + description: `Next.js ${type} prop` + } + }); + } + } + break; + } + } + // Auto completion for types + if (paramNode.type && ts.isTypeLiteralNode(paramNode.type)) { + for (const member of paramNode.type.members){ + if (isPositionInsideNode(position, member)) { + for (const name of validPropsWithType){ + entries.push({ + name, + insertText: name, + sortText: '_' + name, + kind: ts.ScriptElementKind.memberVariableElement, + kindModifiers: ts.ScriptElementKindModifier.none, + labelDetails: { + description: `Next.js ${type} prop type` + } + }); + } + break; + } + } + } + } + } + return entries; + }, + // Give error diagnostics for the component + getSemanticDiagnostics (fileName, source, node) { + var _node_parameters_, _node_parameters; + const ts = getTs(); + let validProps = []; + let type; + if (isPageFile(fileName)) { + // For page entries (page.js), it can only have `params` and `searchParams` + // as the prop names. + validProps = ALLOWED_PAGE_PROPS; + type = 'page'; + } else { + // For layout entires, check if it has any named slots. + const currentDir = path.dirname(fileName); + const items = fs.readdirSync(currentDir, { + withFileTypes: true + }); + const slots = []; + for (const item of items){ + if (item.isDirectory() && item.name.startsWith('@')) { + slots.push(item.name.slice(1)); + } + } + validProps = ALLOWED_LAYOUT_PROPS.concat(slots); + type = 'layout'; + } + const diagnostics = []; + const props = (_node_parameters = node.parameters) == null ? void 0 : (_node_parameters_ = _node_parameters[0]) == null ? void 0 : _node_parameters_.name; + if (props && ts.isObjectBindingPattern(props)) { + for (const prop of props.elements){ + const propName = (prop.propertyName || prop.name).getText(); + if (!validProps.includes(propName)) { + diagnostics.push({ + file: source, + category: ts.DiagnosticCategory.Error, + code: NEXT_TS_ERRORS.INVALID_PAGE_PROP, + messageText: `"${propName}" is not a valid ${type} prop.`, + start: prop.getStart(), + length: prop.getWidth() + }); + } + } + } + return diagnostics; + } +}; +export default entry; + +//# sourceMappingURL=entry.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/rules/entry.js.map b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/entry.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1730d3894f8f674f363489f141b482c163444e4b --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/entry.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/typescript/rules/entry.ts"],"sourcesContent":["import path from 'path'\nimport fs from 'fs'\n\nimport {\n ALLOWED_LAYOUT_PROPS,\n ALLOWED_PAGE_PROPS,\n NEXT_TS_ERRORS,\n} from '../constant'\nimport { getTs, isPageFile, isPositionInsideNode } from '../utils'\n\nimport type tsModule from 'typescript/lib/tsserverlibrary'\n\nconst entry = {\n // Give auto completion for the component's props\n getCompletionsAtPosition(\n fileName: string,\n node: tsModule.FunctionDeclaration,\n position: number\n ) {\n const ts = getTs()\n const entries: tsModule.CompletionEntry[] = []\n\n // Default export function might not accept parameters\n const paramNode = node.parameters?.[0] as\n | tsModule.ParameterDeclaration\n | undefined\n\n if (paramNode && isPositionInsideNode(position, paramNode)) {\n const props = paramNode?.name\n if (props && ts.isObjectBindingPattern(props)) {\n let validProps = []\n let validPropsWithType = []\n let type: string\n\n if (isPageFile(fileName)) {\n // For page entries (page.js), it can only have `params` and `searchParams`\n // as the prop names.\n validProps = ALLOWED_PAGE_PROPS\n validPropsWithType = ALLOWED_PAGE_PROPS\n type = 'page'\n } else {\n // For layout entires, check if it has any named slots.\n const currentDir = path.dirname(fileName)\n const items = fs.readdirSync(currentDir, {\n withFileTypes: true,\n })\n const slots = []\n for (const item of items) {\n if (item.isDirectory() && item.name.startsWith('@')) {\n slots.push(item.name.slice(1))\n }\n }\n validProps = ALLOWED_LAYOUT_PROPS.concat(slots)\n validPropsWithType = ALLOWED_LAYOUT_PROPS.concat(\n slots.map((s) => `${s}: React.ReactNode`)\n )\n type = 'layout'\n }\n\n // Auto completion for props\n for (const element of props.elements) {\n if (isPositionInsideNode(position, element)) {\n const nameNode = element.propertyName || element.name\n\n if (isPositionInsideNode(position, nameNode)) {\n for (const name of validProps) {\n entries.push({\n name,\n insertText: name,\n sortText: '_' + name,\n kind: ts.ScriptElementKind.memberVariableElement,\n kindModifiers: ts.ScriptElementKindModifier.none,\n labelDetails: {\n description: `Next.js ${type} prop`,\n },\n } as tsModule.CompletionEntry)\n }\n }\n\n break\n }\n }\n\n // Auto completion for types\n if (paramNode.type && ts.isTypeLiteralNode(paramNode.type)) {\n for (const member of paramNode.type.members) {\n if (isPositionInsideNode(position, member)) {\n for (const name of validPropsWithType) {\n entries.push({\n name,\n insertText: name,\n sortText: '_' + name,\n kind: ts.ScriptElementKind.memberVariableElement,\n kindModifiers: ts.ScriptElementKindModifier.none,\n labelDetails: {\n description: `Next.js ${type} prop type`,\n },\n } as tsModule.CompletionEntry)\n }\n\n break\n }\n }\n }\n }\n }\n\n return entries\n },\n\n // Give error diagnostics for the component\n getSemanticDiagnostics(\n fileName: string,\n source: tsModule.SourceFile,\n node: tsModule.FunctionDeclaration\n ) {\n const ts = getTs()\n\n let validProps = []\n let type: string\n\n if (isPageFile(fileName)) {\n // For page entries (page.js), it can only have `params` and `searchParams`\n // as the prop names.\n validProps = ALLOWED_PAGE_PROPS\n type = 'page'\n } else {\n // For layout entires, check if it has any named slots.\n const currentDir = path.dirname(fileName)\n const items = fs.readdirSync(currentDir, { withFileTypes: true })\n const slots = []\n for (const item of items) {\n if (item.isDirectory() && item.name.startsWith('@')) {\n slots.push(item.name.slice(1))\n }\n }\n validProps = ALLOWED_LAYOUT_PROPS.concat(slots)\n type = 'layout'\n }\n\n const diagnostics: tsModule.Diagnostic[] = []\n\n const props = node.parameters?.[0]?.name\n if (props && ts.isObjectBindingPattern(props)) {\n for (const prop of props.elements) {\n const propName = (prop.propertyName || prop.name).getText()\n if (!validProps.includes(propName)) {\n diagnostics.push({\n file: source,\n category: ts.DiagnosticCategory.Error,\n code: NEXT_TS_ERRORS.INVALID_PAGE_PROP,\n messageText: `\"${propName}\" is not a valid ${type} prop.`,\n start: prop.getStart(),\n length: prop.getWidth(),\n })\n }\n }\n }\n\n return diagnostics\n },\n}\n\nexport default entry\n"],"names":["path","fs","ALLOWED_LAYOUT_PROPS","ALLOWED_PAGE_PROPS","NEXT_TS_ERRORS","getTs","isPageFile","isPositionInsideNode","entry","getCompletionsAtPosition","fileName","node","position","ts","entries","paramNode","parameters","props","name","isObjectBindingPattern","validProps","validPropsWithType","type","currentDir","dirname","items","readdirSync","withFileTypes","slots","item","isDirectory","startsWith","push","slice","concat","map","s","element","elements","nameNode","propertyName","insertText","sortText","kind","ScriptElementKind","memberVariableElement","kindModifiers","ScriptElementKindModifier","none","labelDetails","description","isTypeLiteralNode","member","members","getSemanticDiagnostics","source","diagnostics","prop","propName","getText","includes","file","category","DiagnosticCategory","Error","code","INVALID_PAGE_PROP","messageText","start","getStart","length","getWidth"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AACvB,OAAOC,QAAQ,KAAI;AAEnB,SACEC,oBAAoB,EACpBC,kBAAkB,EAClBC,cAAc,QACT,cAAa;AACpB,SAASC,KAAK,EAAEC,UAAU,EAAEC,oBAAoB,QAAQ,WAAU;AAIlE,MAAMC,QAAQ;IACZ,iDAAiD;IACjDC,0BACEC,QAAgB,EAChBC,IAAkC,EAClCC,QAAgB;YAMED;QAJlB,MAAME,KAAKR;QACX,MAAMS,UAAsC,EAAE;QAE9C,sDAAsD;QACtD,MAAMC,aAAYJ,mBAAAA,KAAKK,UAAU,qBAAfL,gBAAiB,CAAC,EAAE;QAItC,IAAII,aAAaR,qBAAqBK,UAAUG,YAAY;YAC1D,MAAME,QAAQF,6BAAAA,UAAWG,IAAI;YAC7B,IAAID,SAASJ,GAAGM,sBAAsB,CAACF,QAAQ;gBAC7C,IAAIG,aAAa,EAAE;gBACnB,IAAIC,qBAAqB,EAAE;gBAC3B,IAAIC;gBAEJ,IAAIhB,WAAWI,WAAW;oBACxB,2EAA2E;oBAC3E,qBAAqB;oBACrBU,aAAajB;oBACbkB,qBAAqBlB;oBACrBmB,OAAO;gBACT,OAAO;oBACL,uDAAuD;oBACvD,MAAMC,aAAavB,KAAKwB,OAAO,CAACd;oBAChC,MAAMe,QAAQxB,GAAGyB,WAAW,CAACH,YAAY;wBACvCI,eAAe;oBACjB;oBACA,MAAMC,QAAQ,EAAE;oBAChB,KAAK,MAAMC,QAAQJ,MAAO;wBACxB,IAAII,KAAKC,WAAW,MAAMD,KAAKX,IAAI,CAACa,UAAU,CAAC,MAAM;4BACnDH,MAAMI,IAAI,CAACH,KAAKX,IAAI,CAACe,KAAK,CAAC;wBAC7B;oBACF;oBACAb,aAAalB,qBAAqBgC,MAAM,CAACN;oBACzCP,qBAAqBnB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A,OAAOf;IACT;AACF;AAEA,eAAehD,MAAK","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/rules/error.js b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/error.js new file mode 100644 index 0000000000000000000000000000000000000000..638a8610e23c36caa5441ae3f393b1f73c60187f --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/error.js @@ -0,0 +1,28 @@ +// This module provides intellisense for all components that has the `"use client"` directive. +import { NEXT_TS_ERRORS } from '../constant'; +import { getTs } from '../utils'; +const errorEntry = { + getSemanticDiagnostics (source, isClientEntry) { + const isErrorFile = /[\\/]error\.tsx?$/.test(source.fileName); + const isGlobalErrorFile = /[\\/]global-error\.tsx?$/.test(source.fileName); + if (!isErrorFile && !isGlobalErrorFile) return []; + const ts = getTs(); + if (!isClientEntry) { + // Error components must be Client Components + return [ + { + file: source, + category: ts.DiagnosticCategory.Error, + code: NEXT_TS_ERRORS.INVALID_ERROR_COMPONENT, + messageText: `Error Components must be Client Components, please add the "use client" directive: https://nextjs.org/docs/app/api-reference/file-conventions/error`, + start: 0, + length: source.text.length + } + ]; + } + return []; + } +}; +export default errorEntry; + +//# sourceMappingURL=error.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/rules/error.js.map b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..de36ea38d286a2a3f70f49a7ff9df7588629572a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/error.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/typescript/rules/error.ts"],"sourcesContent":["// This module provides intellisense for all components that has the `\"use client\"` directive.\n\nimport { NEXT_TS_ERRORS } from '../constant'\nimport { getTs } from '../utils'\nimport type tsModule from 'typescript/lib/tsserverlibrary'\n\nconst errorEntry = {\n getSemanticDiagnostics(\n source: tsModule.SourceFile,\n isClientEntry: boolean\n ): tsModule.Diagnostic[] {\n const isErrorFile = /[\\\\/]error\\.tsx?$/.test(source.fileName)\n const isGlobalErrorFile = /[\\\\/]global-error\\.tsx?$/.test(source.fileName)\n\n if (!isErrorFile && !isGlobalErrorFile) return []\n\n const ts = getTs()\n\n if (!isClientEntry) {\n // Error components must be Client Components\n return [\n {\n file: source,\n category: ts.DiagnosticCategory.Error,\n code: NEXT_TS_ERRORS.INVALID_ERROR_COMPONENT,\n messageText: `Error Components must be Client Components, please add the \"use client\" directive: https://nextjs.org/docs/app/api-reference/file-conventions/error`,\n start: 0,\n length: source.text.length,\n },\n ]\n }\n return []\n },\n}\n\nexport default errorEntry\n"],"names":["NEXT_TS_ERRORS","getTs","errorEntry","getSemanticDiagnostics","source","isClientEntry","isErrorFile","test","fileName","isGlobalErrorFile","ts","file","category","DiagnosticCategory","Error","code","INVALID_ERROR_COMPONENT","messageText","start","length","text"],"mappings":"AAAA,8FAA8F;AAE9F,SAASA,cAAc,QAAQ,cAAa;AAC5C,SAASC,KAAK,QAAQ,WAAU;AAGhC,MAAMC,aAAa;IACjBC,wBACEC,MAA2B,EAC3BC,aAAsB;QAEtB,MAAMC,cAAc,oBAAoBC,IAAI,CAACH,OAAOI,QAAQ;QAC5D,MAAMC,oBAAoB,2BAA2BF,IAAI,CAACH,OAAOI,QAAQ;QAEzE,IAAI,CAACF,eAAe,CAACG,mBAAmB,OAAO,EAAE;QAEjD,MAAMC,KAAKT;QAEX,IAAI,CAACI,eAAe;YAClB,6CAA6C;YAC7C,OAAO;gBACL;oBACEM,MAAMP;oBACNQ,UAAUF,GAAGG,kBAAkB,CAACC,KAAK;oBACrCC,MAAMf,eAAegB,uBAAuB;oBAC5CC,aAAa,CAAC,mJAAmJ,CAAC;oBAClKC,OAAO;oBACPC,QAAQf,OAAOgB,IAAI,CAACD,MAAM;gBAC5B;aACD;QACH;QACA,OAAO,EAAE;IACX;AACF;AAEA,eAAejB,WAAU","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/rules/metadata.js b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/metadata.js new file mode 100644 index 0000000000000000000000000000000000000000..d470c1b1d21d67a6036c41fcf793be195118c11b --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/metadata.js @@ -0,0 +1,224 @@ +import { NEXT_TS_ERRORS } from '../constant'; +import { getSource, getTs, getTypeChecker } from '../utils'; +const metadata = { + client: { + getSemanticDiagnosticsForExportVariableStatement (fileName, node) { + const source = getSource(fileName); + const ts = getTs(); + // It is not allowed to export `metadata` or `generateMetadata` in client entry + if (ts.isFunctionDeclaration(node)) { + var _node_name; + if (((_node_name = node.name) == null ? void 0 : _node_name.getText()) === 'generateMetadata') { + return [ + { + file: source, + category: ts.DiagnosticCategory.Error, + code: NEXT_TS_ERRORS.INVALID_METADATA_EXPORT, + messageText: `The Next.js 'generateMetadata' API is not allowed in a Client Component.`, + start: node.name.getStart(), + length: node.name.getWidth() + } + ]; + } + } else { + for (const declaration of node.declarationList.declarations){ + const name = declaration.name.getText(); + if (name === 'metadata') { + return [ + { + file: source, + category: ts.DiagnosticCategory.Error, + code: NEXT_TS_ERRORS.INVALID_METADATA_EXPORT, + messageText: `The Next.js 'metadata' API is not allowed in a Client Component.`, + start: declaration.name.getStart(), + length: declaration.name.getWidth() + } + ]; + } + } + } + return []; + }, + getSemanticDiagnosticsForExportDeclaration (fileName, node) { + const ts = getTs(); + const source = getSource(fileName); + const diagnostics = []; + const exportClause = node.exportClause; + if (exportClause && ts.isNamedExports(exportClause)) { + for (const e of exportClause.elements){ + if ([ + 'generateMetadata', + 'metadata' + ].includes(e.name.getText())) { + diagnostics.push({ + file: source, + category: ts.DiagnosticCategory.Error, + code: NEXT_TS_ERRORS.INVALID_METADATA_EXPORT, + messageText: `The Next.js '${e.name.getText()}' API is not allowed in a Client Component.`, + start: e.name.getStart(), + length: e.name.getWidth() + }); + } + } + } + return diagnostics; + } + }, + server: { + getSemanticDiagnosticsForExportVariableStatement (fileName, node) { + const source = getSource(fileName); + const ts = getTs(); + if (ts.isFunctionDeclaration(node)) { + var _node_name; + if (((_node_name = node.name) == null ? void 0 : _node_name.getText()) === 'generateMetadata') { + var _node_modifiers; + if (hasType(node)) { + return []; + } + const isAsync = (_node_modifiers = node.modifiers) == null ? void 0 : _node_modifiers.some((m)=>m.kind === ts.SyntaxKind.AsyncKeyword); + return [ + { + file: source, + category: ts.DiagnosticCategory.Warning, + code: NEXT_TS_ERRORS.INVALID_METADATA_EXPORT, + messageText: `The Next.js "generateMetadata" export should have a return type of ${isAsync ? '"Promise"' : '"Metadata"'} from "next".`, + start: node.name.getStart(), + length: node.name.getWidth() + } + ]; + } + } else { + for (const declaration of node.declarationList.declarations){ + if (hasType(declaration)) { + return []; + } + const name = declaration.name.getText(); + if (name === 'metadata') { + return [ + { + file: source, + category: ts.DiagnosticCategory.Warning, + code: NEXT_TS_ERRORS.INVALID_METADATA_EXPORT, + messageText: `The Next.js "metadata" export should be type of "Metadata" from "next".`, + start: declaration.name.getStart(), + length: declaration.name.getWidth() + } + ]; + } + if (name === 'generateMetadata') { + // Check if it's a function expression or arrow function + if (declaration.initializer && (ts.isFunctionExpression(declaration.initializer) || ts.isArrowFunction(declaration.initializer))) { + var _declaration_initializer_modifiers; + const isAsync = (_declaration_initializer_modifiers = declaration.initializer.modifiers) == null ? void 0 : _declaration_initializer_modifiers.some((m)=>m.kind === ts.SyntaxKind.AsyncKeyword); + return [ + { + file: source, + category: ts.DiagnosticCategory.Warning, + code: NEXT_TS_ERRORS.INVALID_METADATA_EXPORT, + messageText: `The Next.js "generateMetadata" export should have a return type of ${isAsync ? '"Promise"' : '"Metadata"'} from "next".`, + start: declaration.name.getStart(), + length: declaration.name.getWidth() + } + ]; + } + } + } + } + return []; + }, + getSemanticDiagnosticsForExportDeclaration (fileName, node) { + const typeChecker = getTypeChecker(); + if (!typeChecker) { + return []; + } + const ts = getTs(); + const source = getSource(fileName); + const diagnostics = []; + const exportClause = node.exportClause; + if (!node.isTypeOnly && exportClause && ts.isNamedExports(exportClause)) { + for (const e of exportClause.elements){ + if (e.isTypeOnly) { + continue; + } + const exportName = e.name.getText(); + if (exportName !== 'metadata' && exportName !== 'generateMetadata') { + continue; + } + const symbol = typeChecker.getSymbolAtLocation(e.name); + if (!symbol) { + continue; + } + const originalSymbol = typeChecker.getAliasedSymbol(symbol); + const declarations = originalSymbol.getDeclarations(); + if (!declarations) { + continue; + } + const declaration = declarations[0]; + if (hasType(declaration)) { + continue; + } + if (exportName === 'generateMetadata') { + let isAsync = false; + // async function() {} + if (ts.isFunctionDeclaration(declaration)) { + var _declaration_modifiers; + isAsync = ((_declaration_modifiers = declaration.modifiers) == null ? void 0 : _declaration_modifiers.some((m)=>m.kind === ts.SyntaxKind.AsyncKeyword)) ?? false; + } + // foo = async function() {} + // foo = async () => {} + if (ts.isVariableDeclaration(declaration) && declaration.initializer) { + const initializer = declaration.initializer; + const isFunction = ts.isArrowFunction(initializer) || ts.isFunctionExpression(initializer); + if (isFunction) { + var _initializer_modifiers; + isAsync = ((_initializer_modifiers = initializer.modifiers) == null ? void 0 : _initializer_modifiers.some((m)=>m.kind === ts.SyntaxKind.AsyncKeyword)) ?? false; + } + } + diagnostics.push({ + file: source, + category: ts.DiagnosticCategory.Warning, + code: NEXT_TS_ERRORS.INVALID_METADATA_EXPORT, + messageText: `The Next.js "generateMetadata" export should have a return type of ${isAsync ? '"Promise"' : '"Metadata"'} from "next".`, + start: e.name.getStart(), + length: e.name.getWidth() + }); + } else { + diagnostics.push({ + file: source, + category: ts.DiagnosticCategory.Warning, + code: NEXT_TS_ERRORS.INVALID_METADATA_EXPORT, + messageText: `The Next.js "metadata" export should be type of "Metadata" from "next".`, + start: e.name.getStart(), + length: e.name.getWidth() + }); + } + } + } + return diagnostics; + } + } +}; +function hasType(node) { + const ts = getTs(); + if (!ts.isVariableDeclaration(node) && !ts.isFunctionDeclaration(node) && !ts.isArrowFunction(node) && !ts.isFunctionExpression(node)) { + return false; + } + // For function declarations, expressions, and arrow functions, check if they have return type + if (ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) || ts.isArrowFunction(node)) { + return !!node.type; + } + // For variable declarations + if (!node.name) return false; + const name = node.name.getText(); + if (name === 'generateMetadata') { + // If it's a function expression or arrow function, check if it has return type + if (node.initializer && (ts.isFunctionExpression(node.initializer) || ts.isArrowFunction(node.initializer))) { + return !!node.initializer.type; + } + } + // For all other cases, check if the node has a type annotation + return !!node.type; +} +export default metadata; + +//# sourceMappingURL=metadata.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/rules/metadata.js.map b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/metadata.js.map new file mode 100644 index 0000000000000000000000000000000000000000..dcf58293a8b133c7a813dd0e7cd9ec3e4219063e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/metadata.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/typescript/rules/metadata.ts"],"sourcesContent":["import { NEXT_TS_ERRORS } from '../constant'\nimport { getSource, getTs, getTypeChecker } from '../utils'\n\nimport type tsModule from 'typescript/lib/tsserverlibrary'\n\nconst metadata = {\n client: {\n getSemanticDiagnosticsForExportVariableStatement(\n fileName: string,\n node: tsModule.VariableStatement | tsModule.FunctionDeclaration\n ): tsModule.Diagnostic[] {\n const source = getSource(fileName)\n const ts = getTs()\n\n // It is not allowed to export `metadata` or `generateMetadata` in client entry\n if (ts.isFunctionDeclaration(node)) {\n if (node.name?.getText() === 'generateMetadata') {\n return [\n {\n file: source,\n category: ts.DiagnosticCategory.Error,\n code: NEXT_TS_ERRORS.INVALID_METADATA_EXPORT,\n messageText: `The Next.js 'generateMetadata' API is not allowed in a Client Component.`,\n start: node.name.getStart(),\n length: node.name.getWidth(),\n },\n ]\n }\n } else {\n for (const declaration of node.declarationList.declarations) {\n const name = declaration.name.getText()\n if (name === 'metadata') {\n return [\n {\n file: source,\n category: ts.DiagnosticCategory.Error,\n code: NEXT_TS_ERRORS.INVALID_METADATA_EXPORT,\n messageText: `The Next.js 'metadata' API is not allowed in a Client Component.`,\n start: declaration.name.getStart(),\n length: declaration.name.getWidth(),\n },\n ]\n }\n }\n }\n return []\n },\n getSemanticDiagnosticsForExportDeclaration(\n fileName: string,\n node: tsModule.ExportDeclaration\n ): tsModule.Diagnostic[] {\n const ts = getTs()\n const source = getSource(fileName)\n const diagnostics: tsModule.Diagnostic[] = []\n\n const exportClause = node.exportClause\n if (exportClause && ts.isNamedExports(exportClause)) {\n for (const e of exportClause.elements) {\n if (['generateMetadata', 'metadata'].includes(e.name.getText())) {\n diagnostics.push({\n file: source,\n category: ts.DiagnosticCategory.Error,\n code: NEXT_TS_ERRORS.INVALID_METADATA_EXPORT,\n messageText: `The Next.js '${e.name.getText()}' API is not allowed in a Client Component.`,\n start: e.name.getStart(),\n length: e.name.getWidth(),\n })\n }\n }\n }\n\n return diagnostics\n },\n },\n server: {\n getSemanticDiagnosticsForExportVariableStatement(\n fileName: string,\n node: tsModule.VariableStatement | tsModule.FunctionDeclaration\n ): tsModule.Diagnostic[] {\n const source = getSource(fileName)\n const ts = getTs()\n\n if (ts.isFunctionDeclaration(node)) {\n if (node.name?.getText() === 'generateMetadata') {\n if (hasType(node)) {\n return []\n }\n\n const isAsync = node.modifiers?.some(\n (m) => m.kind === ts.SyntaxKind.AsyncKeyword\n )\n\n return [\n {\n file: source,\n category: ts.DiagnosticCategory.Warning,\n code: NEXT_TS_ERRORS.INVALID_METADATA_EXPORT,\n messageText: `The Next.js \"generateMetadata\" export should have a return type of ${isAsync ? '\"Promise\"' : '\"Metadata\"'} from \"next\".`,\n start: node.name.getStart(),\n length: node.name.getWidth(),\n },\n ]\n }\n } else {\n for (const declaration of node.declarationList.declarations) {\n if (hasType(declaration)) {\n return []\n }\n\n const name = declaration.name.getText()\n if (name === 'metadata') {\n return [\n {\n file: source,\n category: ts.DiagnosticCategory.Warning,\n code: NEXT_TS_ERRORS.INVALID_METADATA_EXPORT,\n messageText: `The Next.js \"metadata\" export should be type of \"Metadata\" from \"next\".`,\n start: declaration.name.getStart(),\n length: declaration.name.getWidth(),\n },\n ]\n }\n if (name === 'generateMetadata') {\n // Check if it's a function expression or arrow function\n if (\n declaration.initializer &&\n (ts.isFunctionExpression(declaration.initializer) ||\n ts.isArrowFunction(declaration.initializer))\n ) {\n const isAsync = declaration.initializer.modifiers?.some(\n (m) => m.kind === ts.SyntaxKind.AsyncKeyword\n )\n return [\n {\n file: source,\n category: ts.DiagnosticCategory.Warning,\n code: NEXT_TS_ERRORS.INVALID_METADATA_EXPORT,\n messageText: `The Next.js \"generateMetadata\" export should have a return type of ${isAsync ? '\"Promise\"' : '\"Metadata\"'} from \"next\".`,\n start: declaration.name.getStart(),\n length: declaration.name.getWidth(),\n },\n ]\n }\n }\n }\n }\n return []\n },\n getSemanticDiagnosticsForExportDeclaration(\n fileName: string,\n node: tsModule.ExportDeclaration\n ) {\n const typeChecker = getTypeChecker()\n if (!typeChecker) {\n return []\n }\n\n const ts = getTs()\n const source = getSource(fileName)\n const diagnostics: tsModule.Diagnostic[] = []\n\n const exportClause = node.exportClause\n if (!node.isTypeOnly && exportClause && ts.isNamedExports(exportClause)) {\n for (const e of exportClause.elements) {\n if (e.isTypeOnly) {\n continue\n }\n const exportName = e.name.getText()\n if (exportName !== 'metadata' && exportName !== 'generateMetadata') {\n continue\n }\n\n const symbol = typeChecker.getSymbolAtLocation(e.name)\n if (!symbol) {\n continue\n }\n\n const originalSymbol = typeChecker.getAliasedSymbol(symbol)\n const declarations = originalSymbol.getDeclarations()\n if (!declarations) {\n continue\n }\n\n const declaration = declarations[0]\n if (hasType(declaration)) {\n continue\n }\n\n if (exportName === 'generateMetadata') {\n let isAsync = false\n\n // async function() {}\n if (ts.isFunctionDeclaration(declaration)) {\n isAsync =\n declaration.modifiers?.some(\n (m) => m.kind === ts.SyntaxKind.AsyncKeyword\n ) ?? false\n }\n\n // foo = async function() {}\n // foo = async () => {}\n if (\n ts.isVariableDeclaration(declaration) &&\n declaration.initializer\n ) {\n const initializer = declaration.initializer\n const isFunction =\n ts.isArrowFunction(initializer) ||\n ts.isFunctionExpression(initializer)\n\n if (isFunction) {\n isAsync =\n initializer.modifiers?.some(\n (m) => m.kind === ts.SyntaxKind.AsyncKeyword\n ) ?? false\n }\n }\n\n diagnostics.push({\n file: source,\n category: ts.DiagnosticCategory.Warning,\n code: NEXT_TS_ERRORS.INVALID_METADATA_EXPORT,\n messageText: `The Next.js \"generateMetadata\" export should have a return type of ${isAsync ? '\"Promise\"' : '\"Metadata\"'} from \"next\".`,\n start: e.name.getStart(),\n length: e.name.getWidth(),\n })\n } else {\n diagnostics.push({\n file: source,\n category: ts.DiagnosticCategory.Warning,\n code: NEXT_TS_ERRORS.INVALID_METADATA_EXPORT,\n messageText: `The Next.js \"metadata\" export should be type of \"Metadata\" from \"next\".`,\n start: e.name.getStart(),\n length: e.name.getWidth(),\n })\n }\n }\n }\n return diagnostics\n },\n },\n}\n\nfunction hasType(node: tsModule.Declaration): boolean {\n const ts = getTs()\n\n if (\n !ts.isVariableDeclaration(node) &&\n !ts.isFunctionDeclaration(node) &&\n !ts.isArrowFunction(node) &&\n !ts.isFunctionExpression(node)\n ) {\n return false\n }\n\n // For function declarations, expressions, and arrow functions, check if they have return type\n if (\n ts.isFunctionDeclaration(node) ||\n ts.isFunctionExpression(node) ||\n ts.isArrowFunction(node)\n ) {\n return !!node.type\n }\n\n // For variable declarations\n if (!node.name) return false\n const name = node.name.getText()\n if (name === 'generateMetadata') {\n // If it's a function expression or arrow function, check if it has return type\n if (\n node.initializer &&\n (ts.isFunctionExpression(node.initializer) ||\n ts.isArrowFunction(node.initializer))\n ) {\n return !!node.initializer.type\n }\n }\n\n // For all other cases, check if the node has a type annotation\n return !!node.type\n}\n\nexport default metadata\n"],"names":["NEXT_TS_ERRORS","getSource","getTs","getTypeChecker","metadata","client","getSemanticDiagnosticsForExportVariableStatement","fileName","node","source","ts","isFunctionDeclaration","name","getText","file","category","DiagnosticCategory","Error","code","INVALID_METADATA_EXPORT","messageText","start","getStart","length","getWidth","declaration","declarationList","declarations","getSemanticDiagnosticsForExportDeclaration","diagnostics","exportClause","isNamedExports","e","elements","includes","push","server","hasType","isAsync","modifiers","some","m","kind","SyntaxKind","AsyncKeyword","Warning","initializer","isFunctionExpression","isArrowFunction","typeChecker","isTypeOnly","exportName","symbol","getSymbolAtLocation","originalSymbol","getAliasedSymbol","getDeclarations","isVariableDeclaration","isFunction","type"],"mappings":"AAAA,SAASA,cAAc,QAAQ,cAAa;AAC5C,SAASC,SAAS,EAAEC,KAAK,EAAEC,cAAc,QAAQ,WAAU;AAI3D,MAAMC,WAAW;IACfC,QAAQ;QACNC,kDACEC,QAAgB,EAChBC,IAA+D;YAE/D,MAAMC,SAASR,UAAUM;YACzB,MAAMG,KAAKR;YAEX,+EAA+E;YAC/E,IAAIQ,GAAGC,qBAAqB,CAACH,OAAO;oBAC9BA;gBAAJ,IAAIA,EAAAA,aAAAA,KAAKI,IAAI,qBAATJ,WAAWK,OAAO,QAAO,oBAAoB;oBAC/C,OAAO;wBACL;4BACEC,MAAML;4BACNM,UAAUL,GAAGM,kBAAkB,CAACC,KAAK;4BACrCC,MAAMlB,eAAemB,uBAAuB;4BAC5CC,aAAa,CAAC,wEAAwE,CAAC;4BACvFC,OAAOb,KAAKI,IAAI,CAACU,QAAQ;4BACzBC,QAAQf,KAAKI,IAAI,CAACY,QAAQ;wBAC5B;qBACD;gBACH;YACF,OAAO;gBACL,KAAK,MAAMC,eAAejB,KAAKkB,eAAe,CAACC,YAAY,CAAE;oBAC3D,MAAMf,OAAOa,YAAYb,IAAI,CAACC,OAAO;oBACrC,IAAID,SAAS,YAAY;wBACvB,OAAO;4BACL;gCACEE,MAAML;gCACNM,UAAUL,GAAGM,kBAAkB,CAACC,KAAK;gCACrCC,MAAMlB,eAAemB,uBAAuB;gCAC5CC,aAAa,CAAC,gEAAgE,CAAC;gCAC/EC,OAAOI,YAAYb,IAA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BAAqB,CAACH,SACzBE,GAAGqC,oBAAoB,CAACvC,SACxBE,GAAGsC,eAAe,CAACxC,OACnB;QACA,OAAO,CAAC,CAACA,KAAKmD,IAAI;IACpB;IAEA,4BAA4B;IAC5B,IAAI,CAACnD,KAAKI,IAAI,EAAE,OAAO;IACvB,MAAMA,OAAOJ,KAAKI,IAAI,CAACC,OAAO;IAC9B,IAAID,SAAS,oBAAoB;QAC/B,+EAA+E;QAC/E,IACEJ,KAAKsC,WAAW,IACfpC,CAAAA,GAAGqC,oBAAoB,CAACvC,KAAKsC,WAAW,KACvCpC,GAAGsC,eAAe,CAACxC,KAAKsC,WAAW,CAAA,GACrC;YACA,OAAO,CAAC,CAACtC,KAAKsC,WAAW,CAACa,IAAI;QAChC;IACF;IAEA,+DAA+D;IAC/D,OAAO,CAAC,CAACnD,KAAKmD,IAAI;AACpB;AAEA,eAAevD,SAAQ","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/rules/server-boundary.js b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/server-boundary.js new file mode 100644 index 0000000000000000000000000000000000000000..1ddd3fc599115bf84068cd84764a6ee1cb264a00 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/server-boundary.js @@ -0,0 +1,105 @@ +// This module provides intellisense for all exports from `"use server"` directive. +import { NEXT_TS_ERRORS } from '../constant'; +import { getTs, getTypeChecker } from '../utils'; +// Check if the type is `Promise`. +function isPromiseType(type, typeChecker) { + const typeReferenceType = type; + if (!typeReferenceType.target) return false; + // target should be Promise or Promise<...> + if (!/^Promise(<.+>)?$/.test(typeChecker.typeToString(typeReferenceType.target))) { + return false; + } + return true; +} +function isFunctionReturningPromise(node, typeChecker, ts) { + const type = typeChecker.getTypeAtLocation(node); + const signatures = typeChecker.getSignaturesOfType(type, ts.SignatureKind.Call); + let isPromise = true; + if (signatures.length) { + for (const signature of signatures){ + const returnType = signature.getReturnType(); + if (returnType.isUnion()) { + for (const t of returnType.types){ + if (!isPromiseType(t, typeChecker)) { + isPromise = false; + break; + } + } + } else { + isPromise = isPromiseType(returnType, typeChecker); + } + } + } else { + isPromise = false; + } + return isPromise; +} +const serverBoundary = { + getSemanticDiagnosticsForExportDeclaration (source, node) { + const ts = getTs(); + const typeChecker = getTypeChecker(); + if (!typeChecker) return []; + const diagnostics = []; + const exportClause = node.exportClause; + if (!node.isTypeOnly && exportClause && ts.isNamedExports(exportClause)) { + for (const e of exportClause.elements){ + if (e.isTypeOnly) { + continue; + } + if (!isFunctionReturningPromise(e, typeChecker, ts)) { + diagnostics.push({ + file: source, + category: ts.DiagnosticCategory.Error, + code: NEXT_TS_ERRORS.INVALID_SERVER_ENTRY_RETURN, + messageText: `The "use server" file can only export async functions.`, + start: e.getStart(), + length: e.getWidth() + }); + } + } + } + return diagnostics; + }, + getSemanticDiagnosticsForExportVariableStatement (source, node) { + const ts = getTs(); + const diagnostics = []; + if (ts.isVariableDeclarationList(node.declarationList)) { + for (const declaration of node.declarationList.declarations){ + const initializer = declaration.initializer; + if (initializer && (ts.isArrowFunction(initializer) || ts.isFunctionDeclaration(initializer) || ts.isFunctionExpression(initializer) || ts.isCallExpression(initializer) || ts.isIdentifier(initializer))) { + diagnostics.push(...serverBoundary.getSemanticDiagnosticsForFunctionExport(source, initializer)); + } else { + diagnostics.push({ + file: source, + category: ts.DiagnosticCategory.Error, + code: NEXT_TS_ERRORS.INVALID_SERVER_ENTRY_RETURN, + messageText: `The "use server" file can only export async functions.`, + start: declaration.getStart(), + length: declaration.getWidth() + }); + } + } + } + return diagnostics; + }, + getSemanticDiagnosticsForFunctionExport (source, node) { + const ts = getTs(); + const typeChecker = getTypeChecker(); + if (!typeChecker) return []; + const diagnostics = []; + if (!isFunctionReturningPromise(node, typeChecker, ts)) { + diagnostics.push({ + file: source, + category: ts.DiagnosticCategory.Error, + code: NEXT_TS_ERRORS.INVALID_SERVER_ENTRY_RETURN, + messageText: `The "use server" file can only export async functions. Add "async" to the function declaration or return a Promise.`, + start: node.getStart(), + length: node.getWidth() + }); + } + return diagnostics; + } +}; +export default serverBoundary; + +//# sourceMappingURL=server-boundary.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/rules/server-boundary.js.map b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/server-boundary.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6ddea76d24c79f2e0fef002efe3834348472b21a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/server-boundary.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/typescript/rules/server-boundary.ts"],"sourcesContent":["// This module provides intellisense for all exports from `\"use server\"` directive.\n\nimport { NEXT_TS_ERRORS } from '../constant'\nimport { getTs, getTypeChecker } from '../utils'\nimport type tsModule from 'typescript/lib/tsserverlibrary'\n\n// Check if the type is `Promise`.\nfunction isPromiseType(type: tsModule.Type, typeChecker: tsModule.TypeChecker) {\n const typeReferenceType = type as tsModule.TypeReference\n if (!typeReferenceType.target) return false\n\n // target should be Promise or Promise<...>\n if (\n !/^Promise(<.+>)?$/.test(typeChecker.typeToString(typeReferenceType.target))\n ) {\n return false\n }\n\n return true\n}\n\nfunction isFunctionReturningPromise(\n node: tsModule.Node,\n typeChecker: tsModule.TypeChecker,\n ts: typeof tsModule\n) {\n const type = typeChecker.getTypeAtLocation(node)\n const signatures = typeChecker.getSignaturesOfType(\n type,\n ts.SignatureKind.Call\n )\n\n let isPromise = true\n if (signatures.length) {\n for (const signature of signatures) {\n const returnType = signature.getReturnType()\n if (returnType.isUnion()) {\n for (const t of returnType.types) {\n if (!isPromiseType(t, typeChecker)) {\n isPromise = false\n break\n }\n }\n } else {\n isPromise = isPromiseType(returnType, typeChecker)\n }\n }\n } else {\n isPromise = false\n }\n\n return isPromise\n}\n\nconst serverBoundary = {\n getSemanticDiagnosticsForExportDeclaration(\n source: tsModule.SourceFile,\n node: tsModule.ExportDeclaration\n ) {\n const ts = getTs()\n const typeChecker = getTypeChecker()\n if (!typeChecker) return []\n\n const diagnostics: tsModule.Diagnostic[] = []\n\n const exportClause = node.exportClause\n if (!node.isTypeOnly && exportClause && ts.isNamedExports(exportClause)) {\n for (const e of exportClause.elements) {\n if (e.isTypeOnly) {\n continue\n }\n if (!isFunctionReturningPromise(e, typeChecker, ts)) {\n diagnostics.push({\n file: source,\n category: ts.DiagnosticCategory.Error,\n code: NEXT_TS_ERRORS.INVALID_SERVER_ENTRY_RETURN,\n messageText: `The \"use server\" file can only export async functions.`,\n start: e.getStart(),\n length: e.getWidth(),\n })\n }\n }\n }\n\n return diagnostics\n },\n\n getSemanticDiagnosticsForExportVariableStatement(\n source: tsModule.SourceFile,\n node: tsModule.VariableStatement\n ) {\n const ts = getTs()\n\n const diagnostics: tsModule.Diagnostic[] = []\n\n if (ts.isVariableDeclarationList(node.declarationList)) {\n for (const declaration of node.declarationList.declarations) {\n const initializer = declaration.initializer\n if (\n initializer &&\n (ts.isArrowFunction(initializer) ||\n ts.isFunctionDeclaration(initializer) ||\n ts.isFunctionExpression(initializer) ||\n ts.isCallExpression(initializer) ||\n ts.isIdentifier(initializer))\n ) {\n diagnostics.push(\n ...serverBoundary.getSemanticDiagnosticsForFunctionExport(\n source,\n initializer\n )\n )\n } else {\n diagnostics.push({\n file: source,\n category: ts.DiagnosticCategory.Error,\n code: NEXT_TS_ERRORS.INVALID_SERVER_ENTRY_RETURN,\n messageText: `The \"use server\" file can only export async functions.`,\n start: declaration.getStart(),\n length: declaration.getWidth(),\n })\n }\n }\n }\n\n return diagnostics\n },\n\n getSemanticDiagnosticsForFunctionExport(\n source: tsModule.SourceFile,\n node:\n | tsModule.FunctionDeclaration\n | tsModule.ArrowFunction\n | tsModule.FunctionExpression\n | tsModule.CallExpression\n | tsModule.Identifier\n ) {\n const ts = getTs()\n const typeChecker = getTypeChecker()\n if (!typeChecker) return []\n\n const diagnostics: tsModule.Diagnostic[] = []\n\n if (!isFunctionReturningPromise(node, typeChecker, ts)) {\n diagnostics.push({\n file: source,\n category: ts.DiagnosticCategory.Error,\n code: NEXT_TS_ERRORS.INVALID_SERVER_ENTRY_RETURN,\n messageText: `The \"use server\" file can only export async functions. Add \"async\" to the function declaration or return a Promise.`,\n start: node.getStart(),\n length: node.getWidth(),\n })\n }\n\n return diagnostics\n },\n}\n\nexport default serverBoundary\n"],"names":["NEXT_TS_ERRORS","getTs","getTypeChecker","isPromiseType","type","typeChecker","typeReferenceType","target","test","typeToString","isFunctionReturningPromise","node","ts","getTypeAtLocation","signatures","getSignaturesOfType","SignatureKind","Call","isPromise","length","signature","returnType","getReturnType","isUnion","t","types","serverBoundary","getSemanticDiagnosticsForExportDeclaration","source","diagnostics","exportClause","isTypeOnly","isNamedExports","e","elements","push","file","category","DiagnosticCategory","Error","code","INVALID_SERVER_ENTRY_RETURN","messageText","start","getStart","getWidth","getSemanticDiagnosticsForExportVariableStatement","isVariableDeclarationList","declarationList","declaration","declarations","initializer","isArrowFunction","isFunctionDeclaration","isFunctionExpression","isCallExpression","isIdentifier","getSemanticDiagnosticsForFunctionExport"],"mappings":"AAAA,mFAAmF;AAEnF,SAASA,cAAc,QAAQ,cAAa;AAC5C,SAASC,KAAK,EAAEC,cAAc,QAAQ,WAAU;AAGhD,qCAAqC;AACrC,SAASC,cAAcC,IAAmB,EAAEC,WAAiC;IAC3E,MAAMC,oBAAoBF;IAC1B,IAAI,CAACE,kBAAkBC,MAAM,EAAE,OAAO;IAEtC,2CAA2C;IAC3C,IACE,CAAC,mBAAmBC,IAAI,CAACH,YAAYI,YAAY,CAACH,kBAAkBC,MAAM,IAC1E;QACA,OAAO;IACT;IAEA,OAAO;AACT;AAEA,SAASG,2BACPC,IAAmB,EACnBN,WAAiC,EACjCO,EAAmB;IAEnB,MAAMR,OAAOC,YAAYQ,iBAAiB,CAACF;IAC3C,MAAMG,aAAaT,YAAYU,mBAAmB,CAChDX,MACAQ,GAAGI,aAAa,CAACC,IAAI;IAGvB,IAAIC,YAAY;IAChB,IAAIJ,W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BAC3D,MAAMC,cAAcF,YAAYE,WAAW;gBAC3C,IACEA,eACCvC,CAAAA,GAAGwC,eAAe,CAACD,gBAClBvC,GAAGyC,qBAAqB,CAACF,gBACzBvC,GAAG0C,oBAAoB,CAACH,gBACxBvC,GAAG2C,gBAAgB,CAACJ,gBACpBvC,GAAG4C,YAAY,CAACL,YAAW,GAC7B;oBACAtB,YAAYM,IAAI,IACXT,eAAe+B,uCAAuC,CACvD7B,QACAuB;gBAGN,OAAO;oBACLtB,YAAYM,IAAI,CAAC;wBACfC,MAAMR;wBACNS,UAAUzB,GAAG0B,kBAAkB,CAACC,KAAK;wBACrCC,MAAMxC,eAAeyC,2BAA2B;wBAChDC,aAAa,CAAC,sDAAsD,CAAC;wBACrEC,OAAOM,YAAYL,QAAQ;wBAC3BzB,QAAQ8B,YAAYJ,QAAQ;oBAC9B;gBACF;YACF;QACF;QAEA,OAAOhB;IACT;IAEA4B,yCACE7B,MAA2B,EAC3BjB,IAKuB;QAEvB,MAAMC,KAAKX;QACX,MAAMI,cAAcH;QACpB,IAAI,CAACG,aAAa,OAAO,EAAE;QAE3B,MAAMwB,cAAqC,EAAE;QAE7C,IAAI,CAACnB,2BAA2BC,MAAMN,aAAaO,KAAK;YACtDiB,YAAYM,IAAI,CAAC;gBACfC,MAAMR;gBACNS,UAAUzB,GAAG0B,kBAAkB,CAACC,KAAK;gBACrCC,MAAMxC,eAAeyC,2BAA2B;gBAChDC,aAAa,CAAC,mHAAmH,CAAC;gBAClIC,OAAOhC,KAAKiC,QAAQ;gBACpBzB,QAAQR,KAAKkC,QAAQ;YACvB;QACF;QAEA,OAAOhB;IACT;AACF;AAEA,eAAeH,eAAc","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/rules/server.js b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/server.js new file mode 100644 index 0000000000000000000000000000000000000000..e699e798e73cef3cc7ab54cda1561e477957709f --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/server.js @@ -0,0 +1,69 @@ +import { DISALLOWED_SERVER_REACT_APIS, DISALLOWED_SERVER_REACT_DOM_APIS, NEXT_TS_ERRORS } from '../constant'; +import { getTs } from '../utils'; +const serverLayer = { + // On the server layer we need to filter out some invalid completion results. + filterCompletionsAtPosition (entries) { + return entries.filter((e)=>{ + // Remove disallowed React APIs. + if (DISALLOWED_SERVER_REACT_APIS.includes(e.name) && e.source === 'react') { + return false; + } + return true; + }); + }, + // Filter out quick info for some React APIs. + hasDisallowedReactAPIDefinition (definitions) { + return definitions == null ? void 0 : definitions.some((d)=>DISALLOWED_SERVER_REACT_APIS.includes(d.name) && d.containerName === 'React'); + }, + // Give errors about disallowed imports such as `useState`. + getSemanticDiagnosticsForImportDeclaration (source, node) { + const ts = getTs(); + const diagnostics = []; + const importPath = node.moduleSpecifier.getText(source); + const importClause = node.importClause; + const namedBindings = importClause == null ? void 0 : importClause.namedBindings; + if (importClause) { + if (/^['"]react['"]$/.test(importPath)) { + // Check if it imports "useState" + if (namedBindings && ts.isNamedImports(namedBindings)) { + const elements = namedBindings.elements; + for (const element of elements){ + const name = element.name.getText(source); + if (DISALLOWED_SERVER_REACT_APIS.includes(name)) { + diagnostics.push({ + file: source, + category: ts.DiagnosticCategory.Error, + code: NEXT_TS_ERRORS.INVALID_SERVER_API, + messageText: `"${name}" is not allowed in Server Components.`, + start: element.name.getStart(), + length: element.name.getWidth() + }); + } + } + } + } else if (/^['"]react-dom['"]$/.test(importPath)) { + // Check if it imports "useFormState" + if (namedBindings && ts.isNamedImports(namedBindings)) { + const elements = namedBindings.elements; + for (const element of elements){ + const name = element.name.getText(source); + if (DISALLOWED_SERVER_REACT_DOM_APIS.includes(name)) { + diagnostics.push({ + file: source, + category: ts.DiagnosticCategory.Error, + code: NEXT_TS_ERRORS.INVALID_SERVER_API, + messageText: `"${name}" is not allowed in Server Components.`, + start: element.name.getStart(), + length: element.name.getWidth() + }); + } + } + } + } + } + return diagnostics; + } +}; +export default serverLayer; + +//# sourceMappingURL=server.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/rules/server.js.map b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/server.js.map new file mode 100644 index 0000000000000000000000000000000000000000..40121d5da3694481ff24ecfd14919a17634be68c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/rules/server.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/typescript/rules/server.ts"],"sourcesContent":["import {\n DISALLOWED_SERVER_REACT_APIS,\n DISALLOWED_SERVER_REACT_DOM_APIS,\n NEXT_TS_ERRORS,\n} from '../constant'\nimport { getTs } from '../utils'\nimport type tsModule from 'typescript/lib/tsserverlibrary'\n\nconst serverLayer = {\n // On the server layer we need to filter out some invalid completion results.\n filterCompletionsAtPosition(entries: tsModule.CompletionEntry[]) {\n return entries.filter((e: tsModule.CompletionEntry) => {\n // Remove disallowed React APIs.\n if (\n DISALLOWED_SERVER_REACT_APIS.includes(e.name) &&\n e.source === 'react'\n ) {\n return false\n }\n return true\n })\n },\n\n // Filter out quick info for some React APIs.\n hasDisallowedReactAPIDefinition(\n definitions: readonly tsModule.DefinitionInfo[]\n ) {\n return definitions?.some(\n (d) =>\n DISALLOWED_SERVER_REACT_APIS.includes(d.name) &&\n d.containerName === 'React'\n )\n },\n\n // Give errors about disallowed imports such as `useState`.\n getSemanticDiagnosticsForImportDeclaration(\n source: tsModule.SourceFile,\n node: tsModule.ImportDeclaration\n ) {\n const ts = getTs()\n\n const diagnostics: tsModule.Diagnostic[] = []\n\n const importPath = node.moduleSpecifier.getText(source!)\n const importClause = node.importClause\n const namedBindings = importClause?.namedBindings\n\n if (importClause) {\n if (/^['\"]react['\"]$/.test(importPath)) {\n // Check if it imports \"useState\"\n if (namedBindings && ts.isNamedImports(namedBindings)) {\n const elements = namedBindings.elements\n for (const element of elements) {\n const name = element.name.getText(source!)\n if (DISALLOWED_SERVER_REACT_APIS.includes(name)) {\n diagnostics.push({\n file: source,\n category: ts.DiagnosticCategory.Error,\n code: NEXT_TS_ERRORS.INVALID_SERVER_API,\n messageText: `\"${name}\" is not allowed in Server Components.`,\n start: element.name.getStart(),\n length: element.name.getWidth(),\n })\n }\n }\n }\n } else if (/^['\"]react-dom['\"]$/.test(importPath)) {\n // Check if it imports \"useFormState\"\n if (namedBindings && ts.isNamedImports(namedBindings)) {\n const elements = namedBindings.elements\n for (const element of elements) {\n const name = element.name.getText(source!)\n if (DISALLOWED_SERVER_REACT_DOM_APIS.includes(name)) {\n diagnostics.push({\n file: source,\n category: ts.DiagnosticCategory.Error,\n code: NEXT_TS_ERRORS.INVALID_SERVER_API,\n messageText: `\"${name}\" is not allowed in Server Components.`,\n start: element.name.getStart(),\n length: element.name.getWidth(),\n })\n }\n }\n }\n }\n }\n\n return diagnostics\n },\n}\n\nexport default serverLayer\n"],"names":["DISALLOWED_SERVER_REACT_APIS","DISALLOWED_SERVER_REACT_DOM_APIS","NEXT_TS_ERRORS","getTs","serverLayer","filterCompletionsAtPosition","entries","filter","e","includes","name","source","hasDisallowedReactAPIDefinition","definitions","some","d","containerName","getSemanticDiagnosticsForImportDeclaration","node","ts","diagnostics","importPath","moduleSpecifier","getText","importClause","namedBindings","test","isNamedImports","elements","element","push","file","category","DiagnosticCategory","Error","code","INVALID_SERVER_API","messageText","start","getStart","length","getWidth"],"mappings":"AAAA,SACEA,4BAA4B,EAC5BC,gCAAgC,EAChCC,cAAc,QACT,cAAa;AACpB,SAASC,KAAK,QAAQ,WAAU;AAGhC,MAAMC,cAAc;IAClB,6EAA6E;IAC7EC,6BAA4BC,OAAmC;QAC7D,OAAOA,QAAQC,MAAM,CAAC,CAACC;YACrB,gCAAgC;YAChC,IACER,6BAA6BS,QAAQ,CAACD,EAAEE,IAAI,KAC5CF,EAAEG,MAAM,KAAK,SACb;gBACA,OAAO;YACT;YACA,OAAO;QACT;IACF;IAEA,6CAA6C;IAC7CC,iCACEC,WAA+C;QAE/C,OAAOA,+B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,YAAYU,IAAI,CAAC;gCACfC,MAAMpB;gCACNqB,UAAUb,GAAGc,kBAAkB,CAACC,KAAK;gCACrCC,MAAMjC,eAAekC,kBAAkB;gCACvCC,aAAa,CAAC,CAAC,EAAE3B,KAAK,sCAAsC,CAAC;gCAC7D4B,OAAOT,QAAQnB,IAAI,CAAC6B,QAAQ;gCAC5BC,QAAQX,QAAQnB,IAAI,CAAC+B,QAAQ;4BAC/B;wBACF;oBACF;gBACF;YACF;QACF;QAEA,OAAOrB;IACT;AACF;AAEA,eAAehB,YAAW","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/utils.js b/e-commerce/node_modules/next/dist/esm/server/typescript/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..3c9efcc7a652e890b2c2ab75698df65367c861e7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/utils.js @@ -0,0 +1,143 @@ +import path from 'path'; +let ts; +let info; +let appDirRegExp; +export function log(message) { + info.project.projectService.logger.info('[next] ' + message); +} +// This function has to be called initially. +export function init(opts) { + const projectDir = opts.info.project.getCurrentDirectory(); + ts = opts.ts; + info = opts.info; + appDirRegExp = new RegExp('^' + (projectDir + '(/src)?/app').replace(/[\\/]/g, '[\\/]')); + log('Initialized Next.js TypeScript plugin: ' + projectDir); +} +export function getTs() { + return ts; +} +export function getInfo() { + return info; +} +export function getTypeChecker() { + const program = info.languageService.getProgram(); + if (!program) { + log('Failed to get program while while running getTypeChecker.'); + return; + } + const typeChecker = program.getTypeChecker(); + if (!typeChecker) { + log('Failed to get type checker while running getTypeChecker.'); + return; + } + return typeChecker; +} +export function getSource(fileName) { + const program = info.languageService.getProgram(); + if (!program) { + log('Failed to get program while running getSource for: ' + fileName); + return; + } + const sourceFile = program.getSourceFile(fileName); + if (!sourceFile) { + log('Failed to get source file while running getSource for: ' + fileName); + return; + } + return sourceFile; +} +export function removeStringQuotes(str) { + return str.replace(/^['"`]|['"`]$/g, ''); +} +export const isPositionInsideNode = (position, node)=>{ + const start = node.getFullStart(); + return start <= position && position <= node.getFullWidth() + start; +}; +export const isDefaultFunctionExport = (node)=>{ + if (ts.isFunctionDeclaration(node)) { + let hasExportKeyword = false; + let hasDefaultKeyword = false; + if (node.modifiers) { + for (const modifier of node.modifiers){ + if (modifier.kind === ts.SyntaxKind.ExportKeyword) { + hasExportKeyword = true; + } else if (modifier.kind === ts.SyntaxKind.DefaultKeyword) { + hasDefaultKeyword = true; + } + } + } + // `export default function` + if (hasExportKeyword && hasDefaultKeyword) { + return true; + } + } + return false; +}; +export const isInsideApp = (filePath)=>{ + return appDirRegExp.test(filePath); +}; +export const isAppEntryFile = (filePath)=>{ + return appDirRegExp.test(filePath) && /^(page|layout)\.(mjs|js|jsx|ts|tsx)$/.test(path.basename(filePath)); +}; +export const isPageFile = (filePath)=>{ + return appDirRegExp.test(filePath) && /^page\.(mjs|js|jsx|ts|tsx)$/.test(path.basename(filePath)); +}; +// Check if a module is a client entry. +export function getEntryInfo(fileName, throwOnInvalidDirective) { + const source = getSource(fileName); + if (source) { + let isDirective = true; + let isClientEntry = false; + let isServerEntry = false; + ts.forEachChild(source, (node)=>{ + if (ts.isExpressionStatement(node) && ts.isStringLiteral(node.expression)) { + if (node.expression.text === 'use client') { + if (isDirective) { + isClientEntry = true; + } else { + if (throwOnInvalidDirective) { + const e = { + messageText: 'The `"use client"` directive must be put at the top of the file.', + start: node.expression.getStart(), + length: node.expression.getWidth() + }; + throw e; + } + } + } else if (node.expression.text === 'use server') { + if (isDirective) { + isServerEntry = true; + } else { + if (throwOnInvalidDirective) { + const e = { + messageText: 'The `"use server"` directive must be put at the top of the file.', + start: node.expression.getStart(), + length: node.expression.getWidth() + }; + throw e; + } + } + } + if (isClientEntry && isServerEntry) { + const e = { + messageText: 'Cannot use both "use client" and "use server" directives in the same file.', + start: node.expression.getStart(), + length: node.expression.getWidth() + }; + throw e; + } + } else { + isDirective = false; + } + }); + return { + client: isClientEntry, + server: isServerEntry + }; + } + return { + client: false, + server: false + }; +} + +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/typescript/utils.js.map b/e-commerce/node_modules/next/dist/esm/server/typescript/utils.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7ebf9e3737e61fe8ea45c20ce070bcd097e03324 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/typescript/utils.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/typescript/utils.ts"],"sourcesContent":["import path from 'path'\n\nimport type tsModule from 'typescript/lib/tsserverlibrary'\ntype TypeScript = typeof import('typescript/lib/tsserverlibrary')\n\nlet ts: TypeScript\nlet info: tsModule.server.PluginCreateInfo\nlet appDirRegExp: RegExp\n\nexport function log(message: string) {\n info.project.projectService.logger.info('[next] ' + message)\n}\n\n// This function has to be called initially.\nexport function init(opts: {\n ts: TypeScript\n info: tsModule.server.PluginCreateInfo\n}) {\n const projectDir = opts.info.project.getCurrentDirectory()\n ts = opts.ts\n info = opts.info\n appDirRegExp = new RegExp(\n '^' + (projectDir + '(/src)?/app').replace(/[\\\\/]/g, '[\\\\/]')\n )\n\n log('Initialized Next.js TypeScript plugin: ' + projectDir)\n}\n\nexport function getTs() {\n return ts\n}\n\nexport function getInfo() {\n return info\n}\n\nexport function getTypeChecker() {\n const program = info.languageService.getProgram()\n if (!program) {\n log('Failed to get program while while running getTypeChecker.')\n return\n }\n const typeChecker = program.getTypeChecker()\n if (!typeChecker) {\n log('Failed to get type checker while running getTypeChecker.')\n return\n }\n return typeChecker\n}\n\nexport function getSource(fileName: string) {\n const program = info.languageService.getProgram()\n if (!program) {\n log('Failed to get program while running getSource for: ' + fileName)\n return\n }\n\n const sourceFile = program.getSourceFile(fileName)\n if (!sourceFile) {\n log('Failed to get source file while running getSource for: ' + fileName)\n return\n }\n\n return sourceFile\n}\n\nexport function removeStringQuotes(str: string): string {\n return str.replace(/^['\"`]|['\"`]$/g, '')\n}\n\nexport const isPositionInsideNode = (position: number, node: tsModule.Node) => {\n const start = node.getFullStart()\n return start <= position && position <= node.getFullWidth() + start\n}\n\nexport const isDefaultFunctionExport = (\n node: tsModule.Node\n): node is tsModule.FunctionDeclaration => {\n if (ts.isFunctionDeclaration(node)) {\n let hasExportKeyword = false\n let hasDefaultKeyword = false\n\n if (node.modifiers) {\n for (const modifier of node.modifiers) {\n if (modifier.kind === ts.SyntaxKind.ExportKeyword) {\n hasExportKeyword = true\n } else if (modifier.kind === ts.SyntaxKind.DefaultKeyword) {\n hasDefaultKeyword = true\n }\n }\n }\n\n // `export default function`\n if (hasExportKeyword && hasDefaultKeyword) {\n return true\n }\n }\n return false\n}\n\nexport const isInsideApp = (filePath: string) => {\n return appDirRegExp.test(filePath)\n}\nexport const isAppEntryFile = (filePath: string) => {\n return (\n appDirRegExp.test(filePath) &&\n /^(page|layout)\\.(mjs|js|jsx|ts|tsx)$/.test(path.basename(filePath))\n )\n}\nexport const isPageFile = (filePath: string) => {\n return (\n appDirRegExp.test(filePath) &&\n /^page\\.(mjs|js|jsx|ts|tsx)$/.test(path.basename(filePath))\n )\n}\n\n// Check if a module is a client entry.\nexport function getEntryInfo(\n fileName: string,\n throwOnInvalidDirective?: boolean\n) {\n const source = getSource(fileName)\n if (source) {\n let isDirective = true\n let isClientEntry = false\n let isServerEntry = false\n\n ts.forEachChild(source!, (node) => {\n if (\n ts.isExpressionStatement(node) &&\n ts.isStringLiteral(node.expression)\n ) {\n if (node.expression.text === 'use client') {\n if (isDirective) {\n isClientEntry = true\n } else {\n if (throwOnInvalidDirective) {\n const e = {\n messageText:\n 'The `\"use client\"` directive must be put at the top of the file.',\n start: node.expression.getStart(),\n length: node.expression.getWidth(),\n }\n throw e\n }\n }\n } else if (node.expression.text === 'use server') {\n if (isDirective) {\n isServerEntry = true\n } else {\n if (throwOnInvalidDirective) {\n const e = {\n messageText:\n 'The `\"use server\"` directive must be put at the top of the file.',\n start: node.expression.getStart(),\n length: node.expression.getWidth(),\n }\n throw e\n }\n }\n }\n\n if (isClientEntry && isServerEntry) {\n const e = {\n messageText:\n 'Cannot use both \"use client\" and \"use server\" directives in the same file.',\n start: node.expression.getStart(),\n length: node.expression.getWidth(),\n }\n throw e\n }\n } else {\n isDirective = false\n }\n })\n\n return { client: isClientEntry, server: isServerEntry }\n }\n\n return { client: false, server: false }\n}\n"],"names":["path","ts","info","appDirRegExp","log","message","project","projectService","logger","init","opts","projectDir","getCurrentDirectory","RegExp","replace","getTs","getInfo","getTypeChecker","program","languageService","getProgram","typeChecker","getSource","fileName","sourceFile","getSourceFile","removeStringQuotes","str","isPositionInsideNode","position","node","start","getFullStart","getFullWidth","isDefaultFunctionExport","isFunctionDeclaration","hasExportKeyword","hasDefaultKeyword","modifiers","modifier","kind","SyntaxKind","ExportKeyword","DefaultKeyword","isInsideApp","filePath","test","isAppEntryFile","basename","isPageFile","getEntryInfo","throwOnInvalidDirective","source","isDirective","isClientEntry","isServerEntry","forEachChild","isExpressionStatement","isStringLiteral","expression","text","e","messageText","getStart","length","getWidth","client","server"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AAKvB,IAAIC;AACJ,IAAIC;AACJ,IAAIC;AAEJ,OAAO,SAASC,IAAIC,OAAe;IACjCH,KAAKI,OAAO,CAACC,cAAc,CAACC,MAAM,CAACN,IAAI,CAAC,YAAYG;AACtD;AAEA,4CAA4C;AAC5C,OAAO,SAASI,KAAKC,IAGpB;IACC,MAAMC,aAAaD,KAAKR,IAAI,CAACI,OAAO,CAACM,mBAAmB;IACxDX,KAAKS,KAAKT,EAAE;IACZC,OAAOQ,KAAKR,IAAI;IAChBC,eAAe,IAAIU,OACjB,MAAM,AAACF,CAAAA,aAAa,aAAY,EAAGG,OAAO,CAAC,UAAU;IAGvDV,IAAI,4CAA4CO;AAClD;AAEA,OAAO,SAASI;IACd,OAAOd;AACT;AAEA,OAAO,SAASe;IACd,OAAOd;AACT;AAEA,OAAO,SAASe;IACd,MAAMC,UAAUhB,KAAKiB,eAAe,CAACC,UA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,KAAK6B,UAAU,CAACM,QAAQ;oBAClC;oBACA,MAAMJ;gBACR;YACF,OAAO;gBACLR,cAAc;YAChB;QACF;QAEA,OAAO;YAAEa,QAAQZ;YAAea,QAAQZ;QAAc;IACxD;IAEA,OAAO;QAAEW,QAAQ;QAAOC,QAAQ;IAAM;AACxC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/cache-life-profile.js b/e-commerce/node_modules/next/dist/esm/server/use-cache/cache-life-profile.js new file mode 100644 index 0000000000000000000000000000000000000000..a2bbb2d1b5dc95c83a9c13050eed185bab72cad4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/cache-life-profile.js @@ -0,0 +1,50 @@ +import { INFINITE_CACHE } from '../../lib/constants'; +function normalizeCacheLifeValue(key, value, context) { + if (value === undefined) { + return undefined; + } + if (value === false) { + if (key === 'stale') { + throw new Error('Pass `Infinity` instead of `false` if you want to cache on the client forever ' + 'without checking with the server.'); + } else if (key === 'revalidate') { + throw new Error('Pass `Infinity` instead of `false` if you do not want to revalidate by time.'); + } else { + throw new Error('Pass `Infinity` instead of `false` if you want to cache on the server forever ' + 'without checking with the origin.'); + } + } + if (typeof value !== 'number') { + throw new Error(`The ${key} option must be a number of seconds.`); + } + if (value === Infinity) { + // Infinity means "never", but turns into null when serialized as JSON + // (e.g. for build workers or cache handlers), unlike INFINITE_CACHE. + return INFINITE_CACHE; + } + if (!Number.isFinite(value)) { + throw new Error(context.kind === 'config' ? `Invalid "cacheLife.${context.profileName}.${key}" provided, expected a finite number of seconds or Infinity, received ${value}` : `Invalid \`cacheLife()\` option "${key}" provided, expected a finite number of seconds or Infinity, received ${value}.`); + } + return value; +} +export function validateAndNormalizeCacheLifeProfile(profile, context) { + // Don't mutate the profile; it may be shared, e.g. as part of the user's + // config object. + const normalizedProfile = { + ...profile + }; + for (const key of [ + 'stale', + 'revalidate', + 'expire' + ]){ + const value = normalizeCacheLifeValue(key, profile[key], context); + if (value !== undefined) { + normalizedProfile[key] = value; + } + } + if (normalizedProfile.revalidate !== undefined && normalizedProfile.expire !== undefined && normalizedProfile.revalidate > normalizedProfile.expire) { + throw new Error('If providing both the revalidate and expire options, ' + 'the expire option must be greater than the revalidate option. ' + 'The expire option indicates how many seconds from the start ' + 'until it can no longer be used.'); + } + return normalizedProfile; +} + +//# sourceMappingURL=cache-life-profile.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/cache-life-profile.js.map b/e-commerce/node_modules/next/dist/esm/server/use-cache/cache-life-profile.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1e8c5064d7d57485f2b9bc491be5a9d976557288 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/cache-life-profile.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/use-cache/cache-life-profile.ts"],"sourcesContent":["import { INFINITE_CACHE } from '../../lib/constants'\n\nexport type CacheLife = {\n // How long the client can cache a value without checking with the server.\n stale?: number\n // How frequently you want the cache to refresh on the server.\n // Stale values may be served while revalidating.\n revalidate?: number\n // In the worst case scenario, where you haven't had traffic in a while,\n // how stale can a value be until you prefer deopting to dynamic.\n // Must be longer than revalidate.\n expire?: number\n}\n\ntype CacheLifeProfileContext =\n | { kind: 'inline' }\n | { kind: 'config'; profileName: string }\n\nfunction normalizeCacheLifeValue(\n key: keyof CacheLife,\n value: unknown,\n context: CacheLifeProfileContext\n): number | undefined {\n if (value === undefined) {\n return undefined\n }\n\n if (value === false) {\n if (key === 'stale') {\n throw new Error(\n 'Pass `Infinity` instead of `false` if you want to cache on the client forever ' +\n 'without checking with the server.'\n )\n } else if (key === 'revalidate') {\n throw new Error(\n 'Pass `Infinity` instead of `false` if you do not want to revalidate by time.'\n )\n } else {\n throw new Error(\n 'Pass `Infinity` instead of `false` if you want to cache on the server forever ' +\n 'without checking with the origin.'\n )\n }\n }\n\n if (typeof value !== 'number') {\n throw new Error(`The ${key} option must be a number of seconds.`)\n }\n\n if (value === Infinity) {\n // Infinity means \"never\", but turns into null when serialized as JSON\n // (e.g. for build workers or cache handlers), unlike INFINITE_CACHE.\n return INFINITE_CACHE\n }\n\n if (!Number.isFinite(value)) {\n throw new Error(\n context.kind === 'config'\n ? `Invalid \"cacheLife.${context.profileName}.${key}\" provided, expected a finite number of seconds or Infinity, received ${value}`\n : `Invalid \\`cacheLife()\\` option \"${key}\" provided, expected a finite number of seconds or Infinity, received ${value}.`\n )\n }\n\n return value\n}\n\nexport function validateAndNormalizeCacheLifeProfile(\n profile: CacheLife,\n context: CacheLifeProfileContext\n): CacheLife {\n // Don't mutate the profile; it may be shared, e.g. as part of the user's\n // config object.\n const normalizedProfile = { ...profile }\n\n for (const key of ['stale', 'revalidate', 'expire'] as const) {\n const value = normalizeCacheLifeValue(key, profile[key], context)\n if (value !== undefined) {\n normalizedProfile[key] = value\n }\n }\n\n if (\n normalizedProfile.revalidate !== undefined &&\n normalizedProfile.expire !== undefined &&\n normalizedProfile.revalidate > normalizedProfile.expire\n ) {\n throw new Error(\n 'If providing both the revalidate and expire options, ' +\n 'the expire option must be greater than the revalidate option. ' +\n 'The expire option indicates how many seconds from the start ' +\n 'until it can no longer be used.'\n )\n }\n\n return normalizedProfile\n}\n"],"names":["INFINITE_CACHE","normalizeCacheLifeValue","key","value","context","undefined","Error","Infinity","Number","isFinite","kind","profileName","validateAndNormalizeCacheLifeProfile","profile","normalizedProfile","revalidate","expire"],"mappings":"AAAA,SAASA,cAAc,QAAQ,sBAAqB;AAkBpD,SAASC,wBACPC,GAAoB,EACpBC,KAAc,EACdC,OAAgC;IAEhC,IAAID,UAAUE,WAAW;QACvB,OAAOA;IACT;IAEA,IAAIF,UAAU,OAAO;QACnB,IAAID,QAAQ,SAAS;YACnB,MAAM,IAAII,MACR,mFACE;QAEN,OAAO,IAAIJ,QAAQ,cAAc;YAC/B,MAAM,IAAII,MACR;QAEJ,OAAO;YACL,MAAM,IAAIA,MACR,mFACE;QAEN;IACF;IAEA,IAAI,OAAOH,UAAU,UAAU;QAC7B,MAAM,IAAIG,MAAM,CAAC,IAAI,EAAEJ,IAAI,oCAAoC,CAAC;IAClE;IAEA,IAAIC,UAAUI,UAAU;QACtB,sEAAsE;QACtE,qEAAqE;QACrE,OAAOP;IACT;IAEA,IAAI,CAACQ,OAAOC,QAAQ,CAACN,QAAQ;QAC3B,MAAM,IAAIG,MACRF,QAAQM,IAAI,KAAK,WACb,CAAC,mBAAmB,EAAEN,QAAQO,WAAW,CAAC,CAAC,EAAET,IAAI,sEAAsE,EAAEC,OAAO,GAChI,CAAC,gCAAgC,EAAED,IAAI,sEAAsE,EAAEC,MAAM,CAAC,CAAC;IAE/H;IAEA,OAAOA;AACT;AAEA,OAAO,SAASS,qCACdC,OAAkB,EAClBT,OAAgC;IAEhC,yEAAyE;IACzE,iBAAiB;IACjB,MAAMU,oBAAoB;QAAE,GAAGD,OAAO;IAAC;IAEvC,KAAK,MAAMX,OAAO;QAAC;QAAS;QAAc;KAAS,CAAW;QAC5D,MAAMC,QAAQF,wBAAwBC,KAAKW,OAAO,CAACX,IAAI,EAAEE;QACzD,IAAID,UAAUE,WAAW;YACvBS,iBAAiB,CAACZ,IAAI,GAAGC;QAC3B;IACF;IAEA,IACEW,kBAAkBC,UAAU,KAAKV,aACjCS,kBAAkBE,MAAM,KAAKX,aAC7BS,kBAAkBC,UAAU,GAAGD,kBAAkBE,MAAM,EACvD;QACA,MAAM,IAAIV,MACR,0DACE,mEACA,iEACA;IAEN;IAEA,OAAOQ;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/cache-life.js b/e-commerce/node_modules/next/dist/esm/server/use-cache/cache-life.js new file mode 100644 index 0000000000000000000000000000000000000000..19d1b5bd30a54a2f36b3895e2e1c12dd8730092b --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/cache-life.js @@ -0,0 +1,69 @@ +import { workAsyncStorage } from '../app-render/work-async-storage.external'; +import { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'; +import { createCacheLifeOutsideUseCacheError } from './use-cache-messages'; +import { validateAndNormalizeCacheLifeProfile } from './cache-life-profile'; +export function cacheLife(profile) { + if (!process.env.__NEXT_USE_CACHE) { + throw new Error('`cacheLife()` is only available with the `cacheComponents` config.'); + } + const workUnitStore = workUnitAsyncStorage.getStore(); + switch(workUnitStore == null ? void 0 : workUnitStore.type){ + case 'prerender': + case 'prerender-client': + case 'validation-client': + case 'prerender-runtime': + case 'prerender-legacy': + case 'request': + case 'unstable-cache': + case 'build-time-generator': + case undefined: + var _workAsyncStorage_getStore; + throw createCacheLifeOutsideUseCacheError((_workAsyncStorage_getStore = workAsyncStorage.getStore()) == null ? void 0 : _workAsyncStorage_getStore.route); + case 'cache': + case 'private-cache': + break; + default: + workUnitStore; + } + if (typeof profile === 'string') { + const workStore = workAsyncStorage.getStore(); + if (!workStore) { + throw new Error('`cacheLife()` can only be called during App Router rendering at the moment.'); + } + // TODO: This should be globally available and not require an AsyncLocalStorage. + const configuredProfile = workStore.cacheLifeProfiles[profile]; + if (configuredProfile === undefined) { + if (workStore.cacheLifeProfiles[profile.trim()]) { + throw new Error(`Unknown \`cacheLife()\` profile "${profile}" is not configured in next.config.js\n` + `Did you mean "${profile.trim()}" without the spaces?`); + } + throw new Error(`Unknown \`cacheLife()\` profile "${profile}" is not configured in next.config.js\n` + 'module.exports = {\n' + ' cacheLife: {\n' + ` "${profile}": ...\n` + ' }\n' + '}'); + } + profile = configuredProfile; + } else if (typeof profile !== 'object' || profile === null || Array.isArray(profile)) { + throw new Error('Invalid `cacheLife()` option. Either pass a profile name or object.'); + } else { + profile = validateAndNormalizeCacheLifeProfile(profile, { + kind: 'inline' + }); + } + if (profile.revalidate !== undefined) { + // Track the explicit revalidate time. + if (workUnitStore.explicitRevalidate === undefined || workUnitStore.explicitRevalidate > profile.revalidate) { + workUnitStore.explicitRevalidate = profile.revalidate; + } + } + if (profile.expire !== undefined) { + // Track the explicit expire time. + if (workUnitStore.explicitExpire === undefined || workUnitStore.explicitExpire > profile.expire) { + workUnitStore.explicitExpire = profile.expire; + } + } + if (profile.stale !== undefined) { + // Track the explicit stale time. + if (workUnitStore.explicitStale === undefined || workUnitStore.explicitStale > profile.stale) { + workUnitStore.explicitStale = profile.stale; + } + } +} + +//# sourceMappingURL=cache-life.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/cache-life.js.map b/e-commerce/node_modules/next/dist/esm/server/use-cache/cache-life.js.map new file mode 100644 index 0000000000000000000000000000000000000000..dafc656790f7d7880514486aa9b247386ab9b7c3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/cache-life.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/use-cache/cache-life.ts"],"sourcesContent":["import { workAsyncStorage } from '../app-render/work-async-storage.external'\nimport { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'\nimport { createCacheLifeOutsideUseCacheError } from './use-cache-messages'\nimport { validateAndNormalizeCacheLifeProfile } from './cache-life-profile'\nimport type { CacheLife } from './cache-life-profile'\n\nexport type { CacheLife }\n\n// The equivalent header is kind of like:\n// Cache-Control: max-age=[stale],s-max-age=[revalidate],stale-while-revalidate=[expire-revalidate],stale-if-error=[expire-revalidate]\n// Except that stale-while-revalidate/stale-if-error only applies to shared caches - not private caches.\n\n// The default revalidates relatively frequently but doesn't expire to ensure it's always\n// able to serve fast results but by default doesn't hang.\n\n// This gets overridden by the next-types-plugin\ntype CacheLifeProfiles =\n | 'default'\n | 'seconds'\n | 'minutes'\n | 'hours'\n | 'days'\n | 'weeks'\n | 'max'\n | (string & {})\n\nexport function cacheLife(profile: CacheLifeProfiles | CacheLife): void {\n if (!process.env.__NEXT_USE_CACHE) {\n throw new Error(\n '`cacheLife()` is only available with the `cacheComponents` config.'\n )\n }\n\n const workUnitStore = workUnitAsyncStorage.getStore()\n\n switch (workUnitStore?.type) {\n case 'prerender':\n case 'prerender-client':\n case 'validation-client':\n case 'prerender-runtime':\n case 'prerender-legacy':\n case 'request':\n case 'unstable-cache':\n case 'build-time-generator':\n case undefined:\n throw createCacheLifeOutsideUseCacheError(\n workAsyncStorage.getStore()?.route\n )\n case 'cache':\n case 'private-cache':\n break\n default:\n workUnitStore satisfies never\n }\n\n if (typeof profile === 'string') {\n const workStore = workAsyncStorage.getStore()\n if (!workStore) {\n throw new Error(\n '`cacheLife()` can only be called during App Router rendering at the moment.'\n )\n }\n\n // TODO: This should be globally available and not require an AsyncLocalStorage.\n const configuredProfile = workStore.cacheLifeProfiles[profile]\n if (configuredProfile === undefined) {\n if (workStore.cacheLifeProfiles[profile.trim()]) {\n throw new Error(\n `Unknown \\`cacheLife()\\` profile \"${profile}\" is not configured in next.config.js\\n` +\n `Did you mean \"${profile.trim()}\" without the spaces?`\n )\n }\n throw new Error(\n `Unknown \\`cacheLife()\\` profile \"${profile}\" is not configured in next.config.js\\n` +\n 'module.exports = {\\n' +\n ' cacheLife: {\\n' +\n ` \"${profile}\": ...\\n` +\n ' }\\n' +\n '}'\n )\n }\n profile = configuredProfile\n } else if (\n typeof profile !== 'object' ||\n profile === null ||\n Array.isArray(profile)\n ) {\n throw new Error(\n 'Invalid `cacheLife()` option. Either pass a profile name or object.'\n )\n } else {\n profile = validateAndNormalizeCacheLifeProfile(profile, { kind: 'inline' })\n }\n\n if (profile.revalidate !== undefined) {\n // Track the explicit revalidate time.\n if (\n workUnitStore.explicitRevalidate === undefined ||\n workUnitStore.explicitRevalidate > profile.revalidate\n ) {\n workUnitStore.explicitRevalidate = profile.revalidate\n }\n }\n if (profile.expire !== undefined) {\n // Track the explicit expire time.\n if (\n workUnitStore.explicitExpire === undefined ||\n workUnitStore.explicitExpire > profile.expire\n ) {\n workUnitStore.explicitExpire = profile.expire\n }\n }\n if (profile.stale !== undefined) {\n // Track the explicit stale time.\n if (\n workUnitStore.explicitStale === undefined ||\n workUnitStore.explicitStale > profile.stale\n ) {\n workUnitStore.explicitStale = profile.stale\n }\n }\n}\n"],"names":["workAsyncStorage","workUnitAsyncStorage","createCacheLifeOutsideUseCacheError","validateAndNormalizeCacheLifeProfile","cacheLife","profile","process","env","__NEXT_USE_CACHE","Error","workUnitStore","getStore","type","undefined","route","workStore","configuredProfile","cacheLifeProfiles","trim","Array","isArray","kind","revalidate","explicitRevalidate","expire","explicitExpire","stale","explicitStale"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,4CAA2C;AAC5E,SAASC,oBAAoB,QAAQ,iDAAgD;AACrF,SAASC,mCAAmC,QAAQ,uBAAsB;AAC1E,SAASC,oCAAoC,QAAQ,uBAAsB;AAuB3E,OAAO,SAASC,UAAUC,OAAsC;IAC9D,IAAI,CAACC,QAAQC,GAAG,CAACC,gBAAgB,EAAE;QACjC,MAAM,IAAIC,MACR;IAEJ;IAEA,MAAMC,gBAAgBT,qBAAqBU,QAAQ;IAEnD,OAAQD,iCAAAA,cAAeE,IAAI;QACzB,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAKC;gBAEDb;YADF,MAAME,qCACJF,6BAAAA,iBAAiBW,QAAQ,uBAAzBX,2BAA6Bc,KAAK;QAEtC,KAAK;QACL,KAAK;YACH;QACF;YACEJ;IACJ;IAEA,IAAI,OAAOL,YAAY,UAAU;QAC/B,MAAMU,YAAYf,iBAAiBW,QAAQ;QAC3C,IAAI,CAACI,WAAW;YACd,MAAM,IAAIN,MACR;QAEJ;QAEA,gFAAgF;QAChF,MAAMO,oBAAoBD,UAAUE,iBAAiB,CAACZ,QAAQ;QAC9D,IAAIW,sBAAsBH,WAAW;YACnC,IAAIE,UAAUE,iBAAiB,CAACZ,QAAQa,IAAI,GAAG,EAAE;gBAC/C,MAAM,IAAIT,MACR,CAAC,iCAAiC,EAAEJ,QAAQ,uCAAuC,CAAC,GAClF,CAAC,cAAc,EAAEA,QAAQa,IAAI,GAAG,qBAAqB,CAAC;YAE5D;YACA,MAAM,IAAIT,MACR,CAAC,iCAAiC,EAAEJ,QAAQ,uCAAuC,CAAC,GAClF,yBACA,qBACA,CAAC,KAAK,EAAEA,QAAQ,QAAQ,CAAC,GACzB,UACA;QAEN;QACAA,UAAUW;IACZ,OAAO,IACL,OAAOX,YAAY,YACnBA,YAAY,QACZc,MAAMC,OAAO,CAACf,UACd;QACA,MAAM,IAAII,MACR;IAEJ,OAAO;QACLJ,UAAUF,qCAAqCE,SAAS;YAAEgB,MAAM;QAAS;IAC3E;IAEA,IAAIhB,QAAQiB,UAAU,KAAKT,WAAW;QACpC,sCAAsC;QACtC,IACEH,cAAca,kBAAkB,KAAKV,aACrCH,cAAca,kBAAkB,GAAGlB,QAAQiB,UAAU,EACrD;YACAZ,cAAca,kBAAkB,GAAGlB,QAAQiB,UAAU;QACvD;IACF;IACA,IAAIjB,QAAQmB,MAAM,KAAKX,WAAW;QAChC,kCAAkC;QAClC,IACEH,cAAce,cAAc,KAAKZ,aACjCH,cAAce,cAAc,GAAGpB,QAAQmB,MAAM,EAC7C;YACAd,cAAce,cAAc,GAAGpB,QAAQmB,MAAM;QAC/C;IACF;IACA,IAAInB,QAAQqB,KAAK,KAAKb,WAAW;QAC/B,iCAAiC;QACjC,IACEH,cAAciB,aAAa,KAAKd,aAChCH,cAAciB,aAAa,GAAGtB,QAAQqB,KAAK,EAC3C;YACAhB,cAAciB,aAAa,GAAGtB,QAAQqB,KAAK;QAC7C;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/cache-tag.js b/e-commerce/node_modules/next/dist/esm/server/use-cache/cache-tag.js new file mode 100644 index 0000000000000000000000000000000000000000..008858efcb2904083e0531bbeb654d1d618f38f5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/cache-tag.js @@ -0,0 +1,36 @@ +import { workAsyncStorage } from '../app-render/work-async-storage.external'; +import { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'; +import { validateTags } from '../lib/patch-fetch'; +import { createCacheTagOutsideUseCacheError } from './use-cache-messages'; +export function cacheTag(...tags) { + if (!process.env.__NEXT_USE_CACHE) { + throw new Error('`cacheTag()` is only available with the `cacheComponents` config.'); + } + const workUnitStore = workUnitAsyncStorage.getStore(); + switch(workUnitStore == null ? void 0 : workUnitStore.type){ + case 'prerender': + case 'prerender-client': + case 'validation-client': + case 'prerender-runtime': + case 'prerender-legacy': + case 'request': + case 'unstable-cache': + case 'build-time-generator': + case undefined: + var _workAsyncStorage_getStore; + throw createCacheTagOutsideUseCacheError((_workAsyncStorage_getStore = workAsyncStorage.getStore()) == null ? void 0 : _workAsyncStorage_getStore.route); + case 'cache': + case 'private-cache': + break; + default: + workUnitStore; + } + const validTags = validateTags(tags, '`cacheTag()`'); + if (!workUnitStore.tags) { + workUnitStore.tags = validTags; + } else { + workUnitStore.tags.push(...validTags); + } +} + +//# sourceMappingURL=cache-tag.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/cache-tag.js.map b/e-commerce/node_modules/next/dist/esm/server/use-cache/cache-tag.js.map new file mode 100644 index 0000000000000000000000000000000000000000..414b4a32b0a96b49a24b55ce2c9eea73add75c05 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/cache-tag.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/use-cache/cache-tag.ts"],"sourcesContent":["import { workAsyncStorage } from '../app-render/work-async-storage.external'\nimport { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'\nimport { validateTags } from '../lib/patch-fetch'\nimport { createCacheTagOutsideUseCacheError } from './use-cache-messages'\n\nexport function cacheTag(...tags: string[]): void {\n if (!process.env.__NEXT_USE_CACHE) {\n throw new Error(\n '`cacheTag()` is only available with the `cacheComponents` config.'\n )\n }\n\n const workUnitStore = workUnitAsyncStorage.getStore()\n\n switch (workUnitStore?.type) {\n case 'prerender':\n case 'prerender-client':\n case 'validation-client':\n case 'prerender-runtime':\n case 'prerender-legacy':\n case 'request':\n case 'unstable-cache':\n case 'build-time-generator':\n case undefined:\n throw createCacheTagOutsideUseCacheError(\n workAsyncStorage.getStore()?.route\n )\n case 'cache':\n case 'private-cache':\n break\n default:\n workUnitStore satisfies never\n }\n\n const validTags = validateTags(tags, '`cacheTag()`')\n\n if (!workUnitStore.tags) {\n workUnitStore.tags = validTags\n } else {\n workUnitStore.tags.push(...validTags)\n }\n}\n"],"names":["workAsyncStorage","workUnitAsyncStorage","validateTags","createCacheTagOutsideUseCacheError","cacheTag","tags","process","env","__NEXT_USE_CACHE","Error","workUnitStore","getStore","type","undefined","route","validTags","push"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,4CAA2C;AAC5E,SAASC,oBAAoB,QAAQ,iDAAgD;AACrF,SAASC,YAAY,QAAQ,qBAAoB;AACjD,SAASC,kCAAkC,QAAQ,uBAAsB;AAEzE,OAAO,SAASC,SAAS,GAAGC,IAAc;IACxC,IAAI,CAACC,QAAQC,GAAG,CAACC,gBAAgB,EAAE;QACjC,MAAM,IAAIC,MACR;IAEJ;IAEA,MAAMC,gBAAgBT,qBAAqBU,QAAQ;IAEnD,OAAQD,iCAAAA,cAAeE,IAAI;QACzB,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAKC;gBAEDb;YADF,MAAMG,oCACJH,6BAAAA,iBAAiBW,QAAQ,uBAAzBX,2BAA6Bc,KAAK;QAEtC,KAAK;QACL,KAAK;YACH;QACF;YACEJ;IACJ;IAEA,MAAMK,YAAYb,aAAaG,MAAM;IAErC,IAAI,CAACK,cAAcL,IAAI,EAAE;QACvBK,cAAcL,IAAI,GAAGU;IACvB,OAAO;QACLL,cAAcL,IAAI,CAACW,IAAI,IAAID;IAC7B;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/clone-cache-entry.js b/e-commerce/node_modules/next/dist/esm/server/use-cache/clone-cache-entry.js new file mode 100644 index 0000000000000000000000000000000000000000..e3a72b71ce90b2faed4e06d9f25d931c7cc7ca6b --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/clone-cache-entry.js @@ -0,0 +1,22 @@ +/** + * Tees a cache entry's single-use value stream into two independent entries. + * The original entry is mutated to hold one branch of the tee, and a clone is + * returned holding the other, so both can be consumed independently. + */ export function cloneCacheEntry(entry) { + const [streamA, streamB] = entry.value.tee(); + entry.value = streamA; + const clonedEntry = { + value: streamB, + timestamp: entry.timestamp, + revalidate: entry.revalidate, + expire: entry.expire, + stale: entry.stale, + tags: entry.tags + }; + return [ + entry, + clonedEntry + ]; +} + +//# sourceMappingURL=clone-cache-entry.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/clone-cache-entry.js.map b/e-commerce/node_modules/next/dist/esm/server/use-cache/clone-cache-entry.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e2e25dfe4001e6b51886261b3e0cbbb74ab473ec --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/clone-cache-entry.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/use-cache/clone-cache-entry.ts"],"sourcesContent":["import type { CacheEntry } from '../lib/cache-handlers/types'\n\n/**\n * Tees a cache entry's single-use value stream into two independent entries.\n * The original entry is mutated to hold one branch of the tee, and a clone is\n * returned holding the other, so both can be consumed independently.\n */\nexport function cloneCacheEntry(entry: CacheEntry): [CacheEntry, CacheEntry] {\n const [streamA, streamB] = entry.value.tee()\n entry.value = streamA\n const clonedEntry: CacheEntry = {\n value: streamB,\n timestamp: entry.timestamp,\n revalidate: entry.revalidate,\n expire: entry.expire,\n stale: entry.stale,\n tags: entry.tags,\n }\n return [entry, clonedEntry]\n}\n"],"names":["cloneCacheEntry","entry","streamA","streamB","value","tee","clonedEntry","timestamp","revalidate","expire","stale","tags"],"mappings":"AAEA;;;;CAIC,GACD,OAAO,SAASA,gBAAgBC,KAAiB;IAC/C,MAAM,CAACC,SAASC,QAAQ,GAAGF,MAAMG,KAAK,CAACC,GAAG;IAC1CJ,MAAMG,KAAK,GAAGF;IACd,MAAMI,cAA0B;QAC9BF,OAAOD;QACPI,WAAWN,MAAMM,SAAS;QAC1BC,YAAYP,MAAMO,UAAU;QAC5BC,QAAQR,MAAMQ,MAAM;QACpBC,OAAOT,MAAMS,KAAK;QAClBC,MAAMV,MAAMU,IAAI;IAClB;IACA,OAAO;QAACV;QAAOK;KAAY;AAC7B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/constants.js b/e-commerce/node_modules/next/dist/esm/server/use-cache/constants.js new file mode 100644 index 0000000000000000000000000000000000000000..b489425dfa21f0d0246b931d5c53d5272a8f63ba --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/constants.js @@ -0,0 +1,14 @@ +import { InvariantError } from '../../shared/lib/invariant-error'; +export const MIN_PRERENDERABLE_EXPIRE = 300 // 5 minutes +; +export const MIN_PREFETCHABLE_STALE = 30 // 30 seconds +; +export const MIN_SHELL_STALE = 300 // 5 minutes +; +if (process.env.NODE_ENV !== 'production') { + if (MIN_PREFETCHABLE_STALE > MIN_SHELL_STALE) { + throw new InvariantError('MIN_PREFETCHABLE_STALE must not exceed MIN_SHELL_STALE.'); + } +} + +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/constants.js.map b/e-commerce/node_modules/next/dist/esm/server/use-cache/constants.js.map new file mode 100644 index 0000000000000000000000000000000000000000..663a3343e31f4f92e27a902a0797ac05a2c5744f --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/constants.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/use-cache/constants.ts"],"sourcesContent":["import { InvariantError } from '../../shared/lib/invariant-error'\n\nexport const MIN_PRERENDERABLE_EXPIRE = 300 // 5 minutes\nexport const MIN_PREFETCHABLE_STALE = 30 // 30 seconds\nexport const MIN_SHELL_STALE = 300 // 5 minutes\n\nif (process.env.NODE_ENV !== 'production') {\n if (MIN_PREFETCHABLE_STALE > MIN_SHELL_STALE) {\n throw new InvariantError(\n 'MIN_PREFETCHABLE_STALE must not exceed MIN_SHELL_STALE.'\n )\n }\n}\n"],"names":["InvariantError","MIN_PRERENDERABLE_EXPIRE","MIN_PREFETCHABLE_STALE","MIN_SHELL_STALE","process","env","NODE_ENV"],"mappings":"AAAA,SAASA,cAAc,QAAQ,mCAAkC;AAEjE,OAAO,MAAMC,2BAA2B,IAAI,YAAY;CAAb;AAC3C,OAAO,MAAMC,yBAAyB,GAAG,aAAa;CAAd;AACxC,OAAO,MAAMC,kBAAkB,IAAI,YAAY;CAAb;AAElC,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzC,IAAIJ,yBAAyBC,iBAAiB;QAC5C,MAAM,IAAIH,eACR;IAEJ;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/handlers.js b/e-commerce/node_modules/next/dist/esm/server/use-cache/handlers.js new file mode 100644 index 0000000000000000000000000000000000000000..48d27958994b43a876b998540a4f77c17a0f4ef1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/handlers.js @@ -0,0 +1,264 @@ +import { createDefaultCacheHandler } from '../lib/cache-handlers/default'; +import { createTieredCacheHandler } from './tiered-cache-handler'; +const debug = process.env.NEXT_PRIVATE_DEBUG_CACHE ? (message, ...args)=>{ + console.log(`use-cache: ${message}`, ...args); +} : undefined; +const handlersSymbol = Symbol.for('@next/cache-handlers'); +const handlersMapSymbol = Symbol.for('@next/cache-handlers-map'); +const handlersSetSymbol = Symbol.for('@next/cache-handlers-set'); +const customCacheHandlersRegistrationSymbol = Symbol.for('@next/custom-cache-handlers-registration'); +const privateHandlerSymbol = Symbol.for('@next/cache-handlers-private'); +const builtInHandlersSymbol = Symbol.for('@next/cache-handlers-built-in'); +const devFrontHandlersSymbol = Symbol.for('@next/cache-handlers-dev-fronts'); +const devTieredHandlersSymbol = Symbol.for('@next/cache-handlers-dev-tiered'); +const memoryCacheDisabledSymbol = Symbol.for('@next/cache-handlers-memory-disabled'); +/** + * The in-memory size used for the dev-only built-in handlers (the private + * handler, the size-0 replacement, and the per-kind front handlers for custom + * kinds). Mirrors the framework default so `cacheMaxMemorySize: 0` does not + * disable caching in development. + */ const DEV_MEMORY_CACHE_SIZE = 50 * 1024 * 1024; +/** + * The reference to the cache handlers. We store the cache handlers on the + * global object so that we can access the same instance across different + * boundaries (such as different copies of the same module). + */ const reference = globalThis; +/** + * Initialize the cache handlers. + * @param cacheMaxMemorySize - The maximum memory size of the cache in bytes, if + * not provided, the default memory size will be used. + */ export function initializeCacheHandlers(cacheMaxMemorySize) { + // If the cache handlers have already been initialized, don't do it again. + if (reference[handlersMapSymbol]) { + debug == null ? void 0 : debug('cache handlers already initialized'); + return; + } + debug == null ? void 0 : debug('initializing cache handlers'); + const handlersMap = new Map(); + reference[handlersMapSymbol] = handlersMap; + const builtInHandlers = new Set(); + reference[builtInHandlersSymbol] = builtInHandlers; + // In development, `cacheMaxMemorySize: 0` would make the built-in default + // handler a no-op, so every reload would miss. Use a real in-memory size + // instead so dev stays fast; the "use cache" wrapper forces a dynamic cache + // life for this case so it still behaves close to "no cache" (serve stale, + // regenerate in the background). Production keeps the no-op handler. + const builtInSize = process.env.__NEXT_DEV_SERVER && cacheMaxMemorySize === 0 ? DEV_MEMORY_CACHE_SIZE : cacheMaxMemorySize; + // Initialize the cache from the symbol contents first. + if (reference[handlersSymbol]) { + let fallback; + if (reference[handlersSymbol].DefaultCache) { + debug == null ? void 0 : debug('setting "default" cache handler from symbol'); + fallback = reference[handlersSymbol].DefaultCache; + } else { + debug == null ? void 0 : debug('setting "default" cache handler from default'); + fallback = createDefaultCacheHandler(builtInSize); + builtInHandlers.add(fallback); + } + handlersMap.set('default', fallback); + if (reference[handlersSymbol].RemoteCache) { + debug == null ? void 0 : debug('setting "remote" cache handler from symbol'); + handlersMap.set('remote', reference[handlersSymbol].RemoteCache); + } else { + debug == null ? void 0 : debug('setting "remote" cache handler from default'); + handlersMap.set('remote', fallback); + } + } else { + const handler = createDefaultCacheHandler(builtInSize); + builtInHandlers.add(handler); + debug == null ? void 0 : debug('setting "default" cache handler from default'); + handlersMap.set('default', handler); + debug == null ? void 0 : debug('setting "remote" cache handler from default'); + handlersMap.set('remote', handler); + } + // Create a set of the cache handlers. + reference[handlersSetSymbol] = new Set(handlersMap.values()); + // In development we add dedicated built-in in-memory handlers so that reloads + // are fast. These are always built-in handlers, never a user-configured one, + // and are gated on the dev server so production behaves exactly as + // configured. + if (process.env.__NEXT_DEV_SERVER) { + reference[memoryCacheDisabledSymbol] = cacheMaxMemorySize === 0; + // Private caches are persisted here so reloads are fast. Private entries + // can hold data specific to the incoming request (for example, derived from + // its cookies or headers), so this is never the user-configured `default` + // alias. Sized so it still caches under `cacheMaxMemorySize: 0` (otherwise + // it would become the no-op stub and private reloads would miss). + reference[privateHandlerSymbol] = createDefaultCacheHandler(DEV_MEMORY_CACHE_SIZE); + // Built-in front handlers, one per custom kind, and the tiered handlers + // that place a front in front of a (possibly slow or remote) backing + // handler so cache hits resolve in a microtask, are both created per kind + // in `setCacheHandler`. + reference[devFrontHandlersSymbol] = new Map(); + reference[devTieredHandlersSymbol] = new Map(); + } +} +export function registerCustomCacheHandlers(register) { + let pendingPromise = reference[customCacheHandlersRegistrationSymbol]; + if (!pendingPromise) { + pendingPromise = register(); + reference[customCacheHandlersRegistrationSymbol] = pendingPromise; + } + return pendingPromise; +} +/** + * Get a cache handler by kind. + * @param kind - The kind of cache handler to get. + * @returns The cache handler, or `undefined` if it does not exist. + * @throws If the cache handlers are not initialized. + */ export function getCacheHandler(kind) { + // This should never be called before initializeCacheHandlers. + if (!reference[handlersMapSymbol]) { + throw new Error('Cache handlers not initialized'); + } + return reference[handlersMapSymbol].get(kind); +} +/** + * Get the dedicated in-memory cache handler that persists private caches in + * development. Returns `undefined` outside the dev server, where private caches + * must not be persisted. This is intentionally not part of the kind-keyed + * handlers map so that it can never be replaced by a user-configured handler. + */ export function getPrivateCacheHandler() { + // This should never be called before initializeCacheHandlers. + if (!reference[handlersMapSymbol]) { + throw new Error('Cache handlers not initialized'); + } + return reference[privateHandlerSymbol]; +} +/** + * Whether the in-memory cache is disabled (`cacheMaxMemorySize: 0`). Dev-only + * signal used to force a dynamic cache life so that the size-0 case still + * serves stale and regenerates in the background. Always `false` in production. + */ export function isMemoryCacheDisabled() { + return reference[memoryCacheDisabledSymbol] ?? false; +} +/** + * Whether `kind` is backed by a real user-configured handler rather than the + * built-in in-memory default. Such a handler may be slow or remote, so in + * development a built-in front handler is placed in front of it (see + * `getDevTieredCacheHandler`) to keep cache hits microtask-fast. The presence + * of a dev front handler is the signal, since front handlers are created + * exactly for user-registered kinds. Always `false` in production. + */ export function isCustomCacheHandler(kind) { + var _reference_devFrontHandlersSymbol; + if (!process.env.__NEXT_DEV_SERVER) { + return false; + } + return ((_reference_devFrontHandlersSymbol = reference[devFrontHandlersSymbol]) == null ? void 0 : _reference_devFrontHandlersSymbol.has(kind)) ?? false; +} +/** + * Whether `kind` resolves to one of the in-memory handlers that + * `initializeCacheHandlers` constructs itself, rather than one supplied by the + * platform through the `@next/cache-handlers` global or by `cacheHandlers` + * config. Reads from a built-in handler are map lookups, so repeating one + * within a request costs nothing; reads from a supplied handler may be a + * network round trip. Unlike `isCustomCacheHandler`, this holds in production. + * + * Tracking the instances rather than the kinds is what keeps aliasing correct: + * self-hosted, `remote` resolves to the same handler as `default` and so + * reports as built-in, while a platform-supplied `remote` does not. + */ export function isBuiltInCacheHandler(kind) { + var _reference_handlersMapSymbol, _reference_builtInHandlersSymbol; + const handler = (_reference_handlersMapSymbol = reference[handlersMapSymbol]) == null ? void 0 : _reference_handlersMapSymbol.get(kind); + return handler !== undefined && Boolean((_reference_builtInHandlersSymbol = reference[builtInHandlersSymbol]) == null ? void 0 : _reference_builtInHandlersSymbol.has(handler)); +} +/** + * Get the dev-only tiered cache handler for a custom `kind`: a fast built-in + * in-memory front handler in front of the user-configured backing handler, so + * cache hits resolve in a microtask. Returns `undefined` if there is none (a + * built-in kind, or production). + */ export function getDevTieredCacheHandler(kind) { + var _reference_devTieredHandlersSymbol; + if (!process.env.__NEXT_DEV_SERVER) { + return undefined; + } + return (_reference_devTieredHandlersSymbol = reference[devTieredHandlersSymbol]) == null ? void 0 : _reference_devTieredHandlersSymbol.get(kind); +} +/** + * Get the cache handlers. In dev, this also includes the built-in handlers (the + * private handler and the per-kind front handlers). The built-in handlers are + * not part of the registered set, but tag operations must still reach them: + * their `updateTags` writes the shared tags manifest that their `get` consults, + * so `revalidateTag` can invalidate their entries. + * @returns The cache handlers, or `undefined` if they are not initialized. + */ export function getCacheHandlers() { + const handlersSet = reference[handlersSetSymbol]; + if (!handlersSet) { + return undefined; + } + const handlers = Array.from(handlersSet); + if (process.env.__NEXT_DEV_SERVER) { + const privateHandler = reference[privateHandlerSymbol]; + if (privateHandler) { + handlers.push(privateHandler); + } + const devFrontHandlers = reference[devFrontHandlersSymbol]; + if (devFrontHandlers) { + handlers.push(...devFrontHandlers.values()); + } + } + return handlers; +} +/** + * Get a map iterator over the cache handlers (keyed by kind). + * @returns An iterator over the cache handler entries, or `undefined` if they + * are not initialized. + * @throws If the cache handlers are not initialized. + */ export function getCacheHandlerEntries() { + const handlersMap = reference[handlersMapSymbol]; + if (!handlersMap) { + return undefined; + } + if (process.env.__NEXT_DEV_SERVER) { + return iterateCacheHandlerEntriesWithDevBuiltIns(handlersMap); + } + return handlersMap.entries(); +} +/** + * Yields the registered entries plus the dev-only private handler under its + * kind, so that per-kind tag operations (`refreshTags` / `getExpiration` for + * implicit tags) apply to private entries. Custom-kind front handlers are + * intentionally omitted: the backing handler (already in the map) is + * authoritative for that kind's `getExpiration`, and a front entry is discarded + * via that same value. + */ function* iterateCacheHandlerEntriesWithDevBuiltIns(handlersMap) { + yield* handlersMap.entries(); + const privateHandler = reference[privateHandlerSymbol]; + if (privateHandler) { + const privateEntry = [ + 'private', + privateHandler + ]; + yield privateEntry; + } +} +/** + * Set a cache handler by kind. + * @param kind - The kind of cache handler to set. + * @param cacheHandler - The cache handler to set. + */ export function setCacheHandler(kind, cacheHandler) { + // This should never be called before initializeCacheHandlers. + if (!reference[handlersMapSymbol] || !reference[handlersSetSymbol]) { + throw new Error('Cache handlers not initialized'); + } + debug == null ? void 0 : debug('setting cache handler for "%s"', kind); + reference[handlersMapSymbol].set(kind, cacheHandler); + reference[handlersSetSymbol].add(cacheHandler); + // A user-configured handler may be slow or remote. In development, give it a + // dedicated built-in in-memory front handler so cache hits resolve in a + // microtask, and pair the two into a tiered handler the wrapper reads + // through. Both are created alongside registration so their lifecycle matches + // the backing handler's, and the front handler's presence is the signal that + // this kind is backed by a real handler (see `isCustomCacheHandler`). Being a + // built-in default handler, the front inherits the dev minimum retention, so + // a short-`expire` value still hits the front instead of falling through to + // the slow backing on every read. + if (process.env.__NEXT_DEV_SERVER) { + var _reference_devFrontHandlersSymbol, _reference_devTieredHandlersSymbol; + const frontHandler = createDefaultCacheHandler(DEV_MEMORY_CACHE_SIZE); + (_reference_devFrontHandlersSymbol = reference[devFrontHandlersSymbol]) == null ? void 0 : _reference_devFrontHandlersSymbol.set(kind, frontHandler); + (_reference_devTieredHandlersSymbol = reference[devTieredHandlersSymbol]) == null ? void 0 : _reference_devTieredHandlersSymbol.set(kind, createTieredCacheHandler(frontHandler, cacheHandler)); + } +} + +//# sourceMappingURL=handlers.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/handlers.js.map b/e-commerce/node_modules/next/dist/esm/server/use-cache/handlers.js.map new file mode 100644 index 0000000000000000000000000000000000000000..34da04514d3c7995786588440891a3d428ebc5af --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/handlers.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/use-cache/handlers.ts"],"sourcesContent":["import { createDefaultCacheHandler } from '../lib/cache-handlers/default'\nimport type { CacheHandler } from '../lib/cache-handlers/types'\nimport {\n createTieredCacheHandler,\n type CacheReadWriteHandler,\n} from './tiered-cache-handler'\n\nconst debug = process.env.NEXT_PRIVATE_DEBUG_CACHE\n ? (message: string, ...args: any[]) => {\n console.log(`use-cache: ${message}`, ...args)\n }\n : undefined\n\nconst handlersSymbol = Symbol.for('@next/cache-handlers')\nconst handlersMapSymbol = Symbol.for('@next/cache-handlers-map')\nconst handlersSetSymbol = Symbol.for('@next/cache-handlers-set')\nconst customCacheHandlersRegistrationSymbol = Symbol.for(\n '@next/custom-cache-handlers-registration'\n)\nconst privateHandlerSymbol = Symbol.for('@next/cache-handlers-private')\nconst builtInHandlersSymbol = Symbol.for('@next/cache-handlers-built-in')\nconst devFrontHandlersSymbol = Symbol.for('@next/cache-handlers-dev-fronts')\nconst devTieredHandlersSymbol = Symbol.for('@next/cache-handlers-dev-tiered')\nconst memoryCacheDisabledSymbol = Symbol.for(\n '@next/cache-handlers-memory-disabled'\n)\n\n/**\n * The in-memory size used for the dev-only built-in handlers (the private\n * handler, the size-0 replacement, and the per-kind front handlers for custom\n * kinds). Mirrors the framework default so `cacheMaxMemorySize: 0` does not\n * disable caching in development.\n */\nconst DEV_MEMORY_CACHE_SIZE = 50 * 1024 * 1024\n\n/**\n * The reference to the cache handlers. We store the cache handlers on the\n * global object so that we can access the same instance across different\n * boundaries (such as different copies of the same module).\n */\nconst reference: typeof globalThis & {\n [handlersSymbol]?: {\n RemoteCache?: CacheHandler\n DefaultCache?: CacheHandler\n }\n [handlersMapSymbol]?: Map\n [handlersSetSymbol]?: Set\n [customCacheHandlersRegistrationSymbol]?: Promise\n [builtInHandlersSymbol]?: Set\n // DEV-only\n [privateHandlerSymbol]?: CacheHandler\n [devFrontHandlersSymbol]?: Map\n [devTieredHandlersSymbol]?: Map\n [memoryCacheDisabledSymbol]?: boolean\n} = globalThis\n\n/**\n * Initialize the cache handlers.\n * @param cacheMaxMemorySize - The maximum memory size of the cache in bytes, if\n * not provided, the default memory size will be used.\n */\nexport function initializeCacheHandlers(cacheMaxMemorySize: number): void {\n // If the cache handlers have already been initialized, don't do it again.\n if (reference[handlersMapSymbol]) {\n debug?.('cache handlers already initialized')\n return\n }\n\n debug?.('initializing cache handlers')\n const handlersMap = new Map()\n reference[handlersMapSymbol] = handlersMap\n const builtInHandlers = new Set()\n reference[builtInHandlersSymbol] = builtInHandlers\n\n // In development, `cacheMaxMemorySize: 0` would make the built-in default\n // handler a no-op, so every reload would miss. Use a real in-memory size\n // instead so dev stays fast; the \"use cache\" wrapper forces a dynamic cache\n // life for this case so it still behaves close to \"no cache\" (serve stale,\n // regenerate in the background). Production keeps the no-op handler.\n const builtInSize =\n process.env.__NEXT_DEV_SERVER && cacheMaxMemorySize === 0\n ? DEV_MEMORY_CACHE_SIZE\n : cacheMaxMemorySize\n\n // Initialize the cache from the symbol contents first.\n if (reference[handlersSymbol]) {\n let fallback: CacheHandler\n if (reference[handlersSymbol].DefaultCache) {\n debug?.('setting \"default\" cache handler from symbol')\n fallback = reference[handlersSymbol].DefaultCache\n } else {\n debug?.('setting \"default\" cache handler from default')\n fallback = createDefaultCacheHandler(builtInSize)\n builtInHandlers.add(fallback)\n }\n\n handlersMap.set('default', fallback)\n\n if (reference[handlersSymbol].RemoteCache) {\n debug?.('setting \"remote\" cache handler from symbol')\n handlersMap.set('remote', reference[handlersSymbol].RemoteCache)\n } else {\n debug?.('setting \"remote\" cache handler from default')\n handlersMap.set('remote', fallback)\n }\n } else {\n const handler = createDefaultCacheHandler(builtInSize)\n builtInHandlers.add(handler)\n\n debug?.('setting \"default\" cache handler from default')\n handlersMap.set('default', handler)\n debug?.('setting \"remote\" cache handler from default')\n handlersMap.set('remote', handler)\n }\n\n // Create a set of the cache handlers.\n reference[handlersSetSymbol] = new Set(handlersMap.values())\n\n // In development we add dedicated built-in in-memory handlers so that reloads\n // are fast. These are always built-in handlers, never a user-configured one,\n // and are gated on the dev server so production behaves exactly as\n // configured.\n if (process.env.__NEXT_DEV_SERVER) {\n reference[memoryCacheDisabledSymbol] = cacheMaxMemorySize === 0\n\n // Private caches are persisted here so reloads are fast. Private entries\n // can hold data specific to the incoming request (for example, derived from\n // its cookies or headers), so this is never the user-configured `default`\n // alias. Sized so it still caches under `cacheMaxMemorySize: 0` (otherwise\n // it would become the no-op stub and private reloads would miss).\n reference[privateHandlerSymbol] = createDefaultCacheHandler(\n DEV_MEMORY_CACHE_SIZE\n )\n\n // Built-in front handlers, one per custom kind, and the tiered handlers\n // that place a front in front of a (possibly slow or remote) backing\n // handler so cache hits resolve in a microtask, are both created per kind\n // in `setCacheHandler`.\n reference[devFrontHandlersSymbol] = new Map()\n reference[devTieredHandlersSymbol] = new Map()\n }\n}\n\nexport function registerCustomCacheHandlers(\n register: () => Promise\n): Promise {\n let pendingPromise = reference[customCacheHandlersRegistrationSymbol]\n if (!pendingPromise) {\n pendingPromise = register()\n reference[customCacheHandlersRegistrationSymbol] = pendingPromise\n }\n\n return pendingPromise\n}\n\n/**\n * Get a cache handler by kind.\n * @param kind - The kind of cache handler to get.\n * @returns The cache handler, or `undefined` if it does not exist.\n * @throws If the cache handlers are not initialized.\n */\nexport function getCacheHandler(kind: string): CacheHandler | undefined {\n // This should never be called before initializeCacheHandlers.\n if (!reference[handlersMapSymbol]) {\n throw new Error('Cache handlers not initialized')\n }\n\n return reference[handlersMapSymbol].get(kind)\n}\n\n/**\n * Get the dedicated in-memory cache handler that persists private caches in\n * development. Returns `undefined` outside the dev server, where private caches\n * must not be persisted. This is intentionally not part of the kind-keyed\n * handlers map so that it can never be replaced by a user-configured handler.\n */\nexport function getPrivateCacheHandler(): CacheHandler | undefined {\n // This should never be called before initializeCacheHandlers.\n if (!reference[handlersMapSymbol]) {\n throw new Error('Cache handlers not initialized')\n }\n\n return reference[privateHandlerSymbol]\n}\n\n/**\n * Whether the in-memory cache is disabled (`cacheMaxMemorySize: 0`). Dev-only\n * signal used to force a dynamic cache life so that the size-0 case still\n * serves stale and regenerates in the background. Always `false` in production.\n */\nexport function isMemoryCacheDisabled(): boolean {\n return reference[memoryCacheDisabledSymbol] ?? false\n}\n\n/**\n * Whether `kind` is backed by a real user-configured handler rather than the\n * built-in in-memory default. Such a handler may be slow or remote, so in\n * development a built-in front handler is placed in front of it (see\n * `getDevTieredCacheHandler`) to keep cache hits microtask-fast. The presence\n * of a dev front handler is the signal, since front handlers are created\n * exactly for user-registered kinds. Always `false` in production.\n */\nexport function isCustomCacheHandler(kind: string): boolean {\n if (!process.env.__NEXT_DEV_SERVER) {\n return false\n }\n\n return reference[devFrontHandlersSymbol]?.has(kind) ?? false\n}\n\n/**\n * Whether `kind` resolves to one of the in-memory handlers that\n * `initializeCacheHandlers` constructs itself, rather than one supplied by the\n * platform through the `@next/cache-handlers` global or by `cacheHandlers`\n * config. Reads from a built-in handler are map lookups, so repeating one\n * within a request costs nothing; reads from a supplied handler may be a\n * network round trip. Unlike `isCustomCacheHandler`, this holds in production.\n *\n * Tracking the instances rather than the kinds is what keeps aliasing correct:\n * self-hosted, `remote` resolves to the same handler as `default` and so\n * reports as built-in, while a platform-supplied `remote` does not.\n */\nexport function isBuiltInCacheHandler(kind: string): boolean {\n const handler = reference[handlersMapSymbol]?.get(kind)\n\n return (\n handler !== undefined &&\n Boolean(reference[builtInHandlersSymbol]?.has(handler))\n )\n}\n\n/**\n * Get the dev-only tiered cache handler for a custom `kind`: a fast built-in\n * in-memory front handler in front of the user-configured backing handler, so\n * cache hits resolve in a microtask. Returns `undefined` if there is none (a\n * built-in kind, or production).\n */\nexport function getDevTieredCacheHandler(\n kind: string\n): CacheReadWriteHandler | undefined {\n if (!process.env.__NEXT_DEV_SERVER) {\n return undefined\n }\n\n return reference[devTieredHandlersSymbol]?.get(kind)\n}\n\n/**\n * Get the cache handlers. In dev, this also includes the built-in handlers (the\n * private handler and the per-kind front handlers). The built-in handlers are\n * not part of the registered set, but tag operations must still reach them:\n * their `updateTags` writes the shared tags manifest that their `get` consults,\n * so `revalidateTag` can invalidate their entries.\n * @returns The cache handlers, or `undefined` if they are not initialized.\n */\nexport function getCacheHandlers(): CacheHandler[] | undefined {\n const handlersSet = reference[handlersSetSymbol]\n if (!handlersSet) {\n return undefined\n }\n\n const handlers = Array.from(handlersSet)\n\n if (process.env.__NEXT_DEV_SERVER) {\n const privateHandler = reference[privateHandlerSymbol]\n if (privateHandler) {\n handlers.push(privateHandler)\n }\n\n const devFrontHandlers = reference[devFrontHandlersSymbol]\n if (devFrontHandlers) {\n handlers.push(...devFrontHandlers.values())\n }\n }\n\n return handlers\n}\n\n/**\n * Get a map iterator over the cache handlers (keyed by kind).\n * @returns An iterator over the cache handler entries, or `undefined` if they\n * are not initialized.\n * @throws If the cache handlers are not initialized.\n */\nexport function getCacheHandlerEntries():\n | IterableIterator<[string, CacheHandler]>\n | undefined {\n const handlersMap = reference[handlersMapSymbol]\n if (!handlersMap) {\n return undefined\n }\n\n if (process.env.__NEXT_DEV_SERVER) {\n return iterateCacheHandlerEntriesWithDevBuiltIns(handlersMap)\n }\n\n return handlersMap.entries()\n}\n\n/**\n * Yields the registered entries plus the dev-only private handler under its\n * kind, so that per-kind tag operations (`refreshTags` / `getExpiration` for\n * implicit tags) apply to private entries. Custom-kind front handlers are\n * intentionally omitted: the backing handler (already in the map) is\n * authoritative for that kind's `getExpiration`, and a front entry is discarded\n * via that same value.\n */\nfunction* iterateCacheHandlerEntriesWithDevBuiltIns(\n handlersMap: Map\n): IterableIterator<[string, CacheHandler]> {\n yield* handlersMap.entries()\n\n const privateHandler = reference[privateHandlerSymbol]\n if (privateHandler) {\n const privateEntry: [string, CacheHandler] = ['private', privateHandler]\n yield privateEntry\n }\n}\n\n/**\n * Set a cache handler by kind.\n * @param kind - The kind of cache handler to set.\n * @param cacheHandler - The cache handler to set.\n */\nexport function setCacheHandler(\n kind: string,\n cacheHandler: CacheHandler\n): void {\n // This should never be called before initializeCacheHandlers.\n if (!reference[handlersMapSymbol] || !reference[handlersSetSymbol]) {\n throw new Error('Cache handlers not initialized')\n }\n\n debug?.('setting cache handler for \"%s\"', kind)\n reference[handlersMapSymbol].set(kind, cacheHandler)\n reference[handlersSetSymbol].add(cacheHandler)\n\n // A user-configured handler may be slow or remote. In development, give it a\n // dedicated built-in in-memory front handler so cache hits resolve in a\n // microtask, and pair the two into a tiered handler the wrapper reads\n // through. Both are created alongside registration so their lifecycle matches\n // the backing handler's, and the front handler's presence is the signal that\n // this kind is backed by a real handler (see `isCustomCacheHandler`). Being a\n // built-in default handler, the front inherits the dev minimum retention, so\n // a short-`expire` value still hits the front instead of falling through to\n // the slow backing on every read.\n if (process.env.__NEXT_DEV_SERVER) {\n const frontHandler = createDefaultCacheHandler(DEV_MEMORY_CACHE_SIZE)\n reference[devFrontHandlersSymbol]?.set(kind, frontHandler)\n reference[devTieredHandlersSymbol]?.set(\n kind,\n createTieredCacheHandler(frontHandler, cacheHandler)\n )\n }\n}\n"],"names":["createDefaultCacheHandler","createTieredCacheHandler","debug","process","env","NEXT_PRIVATE_DEBUG_CACHE","message","args","console","log","undefined","handlersSymbol","Symbol","for","handlersMapSymbol","handlersSetSymbol","customCacheHandlersRegistrationSymbol","privateHandlerSymbol","builtInHandlersSymbol","devFrontHandlersSymbol","devTieredHandlersSymbol","memoryCacheDisabledSymbol","DEV_MEMORY_CACHE_SIZE","reference","globalThis","initializeCacheHandlers","cacheMaxMemorySize","handlersMap","Map","builtInHandlers","Set","builtInSize","__NEXT_DEV_SERVER","fallback","DefaultCache","add","set","RemoteCache","handler","values","registerCustomCacheHandlers","register","pendingPromise","getCacheHandler","kind","Error","get","getPrivateCacheHandler","isMemoryCacheDisabled","isCustomCacheHandler","has","isBuiltInCacheHandler","Boolean","getDevTieredCacheHandler","getCacheHandlers","handlersSet","handlers","Array","from","privateHandler","push","devFrontHandlers","getCacheHandlerEntries","iterateCacheHandlerEntriesWithDevBuiltIns","entries","privateEntry","setCacheHandler","cacheHandler","frontHandler"],"mappings":"AA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,kBAAkB,CAACoB,GAAG,CAACgC;IAEjC,6EAA6E;IAC7E,wEAAwE;IACxE,sEAAsE;IACtE,8EAA8E;IAC9E,6EAA6E;IAC7E,8EAA8E;IAC9E,6EAA6E;IAC7E,4EAA4E;IAC5E,kCAAkC;IAClC,IAAIhE,QAAQC,GAAG,CAAC4B,iBAAiB,EAAE;YAEjCT,mCACAA;QAFA,MAAM6C,eAAepE,0BAA0BsB;SAC/CC,oCAAAA,SAAS,CAACJ,uBAAuB,qBAAjCI,kCAAmCa,GAAG,CAACQ,MAAMwB;SAC7C7C,qCAAAA,SAAS,CAACH,wBAAwB,qBAAlCG,mCAAoCa,GAAG,CACrCQ,MACA3C,yBAAyBmE,cAAcD;IAE3C;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/tiered-cache-handler.js b/e-commerce/node_modules/next/dist/esm/server/use-cache/tiered-cache-handler.js new file mode 100644 index 0000000000000000000000000000000000000000..d41737d247904c74ba11e3a3c670a6baacefc857 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/tiered-cache-handler.js @@ -0,0 +1,151 @@ +import { workAsyncStorage } from '../app-render/work-async-storage.external'; +import { cloneCacheEntry } from './clone-cache-entry'; +/** + * Development-only. Puts a fast built-in in-memory `front` handler in front of + * a slower or persistent user-configured `backing` handler. Its only job is to + * guarantee that cache hits resolve in a microtask (so they aren't counted as + * cache misses at a staged-render boundary, which would otherwise surface a + * cold cache indicator), while keeping the front in sync with the backing. + * + * It implements only `get` and `set` because that is all the wrapper calls on + * its handler. Regeneration is never done here; this only reads, mirrors, and + * writes through. + * + * The handler is a per-kind singleton (the front and backing are both shared), + * so its in-flight map can serialize background front syncs for a key across + * concurrent reads, running them one at a time instead of in parallel. + */ export function createTieredCacheHandler(front, backing) { + // Holds the in-flight (or chained) background sync per key, so a sync for a + // key runs after any earlier one for that key rather than in parallel. + const inFlightSyncs = new Map(); + function scheduleBackgroundSync(cacheKey, sync) { + // Serialize syncs per key: chain this one after any in-flight sync rather + // than running a second in parallel. The trailing sync still re-reads the + // backing, so the front converges to the latest state; a later read is + // never dropped in favor of an earlier, possibly stale, in-flight read. + const previous = inFlightSyncs.get(cacheKey); + let pending; + if (previous) { + pending = previous.then(sync); + } else { + pending = sync(); + } + pending = pending.finally(()=>{ + if (inFlightSyncs.get(cacheKey) === pending) { + inFlightSyncs.delete(cacheKey); + } + }); + inFlightSyncs.set(cacheKey, pending); + // Register the sync on the current request's revalidation writes so it is + // awaited rather than left untracked. Reading the work store here (rather + // than capturing it at construction) is what lets the handler be a shared + // singleton; `get` always runs within the request's async context, so the + // store is present. + const workStore = workAsyncStorage.getStore(); + if (workStore) { + workStore.pendingRevalidateWrites ??= []; + workStore.pendingRevalidateWrites.push(pending); + } + } + return { + async get (cacheKey, softTags) { + const frontEntry = await front.get(cacheKey, softTags); + if (frontEntry) { + // Cache hit: serve immediately (in a microtask). A background reconcile + // keeps the front in sync with the backing for the next read; + // reconciles for the same key are serialized, so concurrent cache hits + // don't hit the backing in parallel. + scheduleBackgroundSync(cacheKey, ()=>reconcileFrontFromBacking(front, backing, cacheKey, softTags, frontEntry)); + return frontEntry; + } + // Cold or evicted front entry: we pay the backing latency here (this is a + // read that may legitimately surface a cold cache indicator). A miss + // returns undefined and the "use cache" wrapper generates the entry and + // writes it through both tiers via `set`. + const backingEntry = await backing.get(cacheKey, softTags); + if (!backingEntry) { + return undefined; + } + // Mirror this freshly read backing entry into the front so the next read + // hits it. The mirror is serialized per key: if a sync is already + // running, this chains after it, so the front converges to this read even + // if the backing changed since that sync started. + const [servedEntry, mirroredEntry] = cloneCacheEntry(backingEntry); + scheduleBackgroundSync(cacheKey, ()=>mirrorIntoFront(front, cacheKey, mirroredEntry)); + return servedEntry; + }, + async set (cacheKey, pendingEntry) { + // Write through to both tiers. The entry's value stream is single-use, so + // tee it into one entry per tier. + const entry = await pendingEntry; + const [frontEntry, backingEntry] = cloneCacheEntry(entry); + await Promise.all([ + front.set(cacheKey, Promise.resolve(frontEntry)), + backing.set(cacheKey, Promise.resolve(backingEntry)) + ]); + } + }; +} +/** + * After serving a cache hit from the front, consult the backing and mirror a + * newer entry into the front for the next read. Runs in the background; + * failures are non-fatal. + */ async function reconcileFrontFromBacking(front, backing, cacheKey, softTags, frontEntry) { + try { + const backingEntry = await backing.get(cacheKey, softTags); + if (!backingEntry) { + // The backing no longer has this entry (it was purged out-of-band). The + // cache-handler interface has no per-key delete, so evict the front entry + // by overwriting it with an already-expired copy: the next read sees a + // front miss, falls through to the (also empty) backing, and the wrapper + // regenerates. The entry we just served was the last stale read. + await front.set(cacheKey, Promise.resolve(toExpiredEntry(frontEntry))); + return; + } + if (backingEntry.timestamp > frontEntry.timestamp) { + await front.set(cacheKey, Promise.resolve(backingEntry)); + } else { + // The front is already up to date, so the backing entry goes unused. This + // code releases its stream and does not await the result. The backing + // handler is user-configured, and it can return one branch of a teed + // stream. `cancel()` on such a branch settles only after the sibling + // branch is cancelled too, and the handler retains that sibling, so an + // await here would hang the reconcile. + void backingEntry.value.cancel(); + } + } catch { + // Background warming; failures are non-fatal. + } +} +/** + * Mirror a backing entry into the front. + */ async function mirrorIntoFront(front, cacheKey, entry) { + try { + await front.set(cacheKey, Promise.resolve(entry)); + } catch { + // Background warming; failures are non-fatal. + } +} +/** + * Build an already-expired copy of an entry, used to evict it from the front + * handler (which has no per-key delete) once the backing no longer has it. The + * default handler treats a negative `expire` as an eviction sentinel and + * reports the entry as missing on the next read. A negative `expire` is used + * rather than `0` because the dev front handler enforces a minimum retention, + * so a `0` `expire` would be kept alive by that minimum instead of evicted. The + * value is never read once the entry is evicted, but it must carry at least one + * byte because the built-in LRU cache refuses to store size-0 entries. + */ function toExpiredEntry(entry) { + return { + ...entry, + expire: -1, + value: new ReadableStream({ + start (controller) { + controller.enqueue(new Uint8Array(1)); + controller.close(); + } + }) + }; +} + +//# sourceMappingURL=tiered-cache-handler.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/tiered-cache-handler.js.map b/e-commerce/node_modules/next/dist/esm/server/use-cache/tiered-cache-handler.js.map new file mode 100644 index 0000000000000000000000000000000000000000..fec3144703658c5bf19c85df86d06f496bd67d6b --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/tiered-cache-handler.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/use-cache/tiered-cache-handler.ts"],"sourcesContent":["import type { CacheEntry, CacheHandler } from '../lib/cache-handlers/types'\nimport { workAsyncStorage } from '../app-render/work-async-storage.external'\nimport { cloneCacheEntry } from './clone-cache-entry'\n\n/**\n * The subset of the cache-handler interface used on the per-invocation\n * read/write path in the \"use cache\" wrapper. Tag operations are intentionally\n * excluded: they are applied to the front and backing handlers individually by\n * the registry accessors (`getCacheHandlers` / `getCacheHandlerEntries`), never\n * through this composite, so the composite is never registered.\n */\nexport type CacheReadWriteHandler = Pick\n\n/**\n * Development-only. Puts a fast built-in in-memory `front` handler in front of\n * a slower or persistent user-configured `backing` handler. Its only job is to\n * guarantee that cache hits resolve in a microtask (so they aren't counted as\n * cache misses at a staged-render boundary, which would otherwise surface a\n * cold cache indicator), while keeping the front in sync with the backing.\n *\n * It implements only `get` and `set` because that is all the wrapper calls on\n * its handler. Regeneration is never done here; this only reads, mirrors, and\n * writes through.\n *\n * The handler is a per-kind singleton (the front and backing are both shared),\n * so its in-flight map can serialize background front syncs for a key across\n * concurrent reads, running them one at a time instead of in parallel.\n */\nexport function createTieredCacheHandler(\n front: CacheHandler,\n backing: CacheHandler\n): CacheReadWriteHandler {\n // Holds the in-flight (or chained) background sync per key, so a sync for a\n // key runs after any earlier one for that key rather than in parallel.\n const inFlightSyncs = new Map>()\n\n function scheduleBackgroundSync(\n cacheKey: string,\n sync: () => Promise\n ): void {\n // Serialize syncs per key: chain this one after any in-flight sync rather\n // than running a second in parallel. The trailing sync still re-reads the\n // backing, so the front converges to the latest state; a later read is\n // never dropped in favor of an earlier, possibly stale, in-flight read.\n const previous = inFlightSyncs.get(cacheKey)\n\n let pending: Promise\n if (previous) {\n pending = previous.then(sync)\n } else {\n pending = sync()\n }\n\n pending = pending.finally(() => {\n if (inFlightSyncs.get(cacheKey) === pending) {\n inFlightSyncs.delete(cacheKey)\n }\n })\n\n inFlightSyncs.set(cacheKey, pending)\n\n // Register the sync on the current request's revalidation writes so it is\n // awaited rather than left untracked. Reading the work store here (rather\n // than capturing it at construction) is what lets the handler be a shared\n // singleton; `get` always runs within the request's async context, so the\n // store is present.\n const workStore = workAsyncStorage.getStore()\n if (workStore) {\n workStore.pendingRevalidateWrites ??= []\n workStore.pendingRevalidateWrites.push(pending)\n }\n }\n\n return {\n async get(cacheKey, softTags) {\n const frontEntry = await front.get(cacheKey, softTags)\n\n if (frontEntry) {\n // Cache hit: serve immediately (in a microtask). A background reconcile\n // keeps the front in sync with the backing for the next read;\n // reconciles for the same key are serialized, so concurrent cache hits\n // don't hit the backing in parallel.\n scheduleBackgroundSync(cacheKey, () =>\n reconcileFrontFromBacking(\n front,\n backing,\n cacheKey,\n softTags,\n frontEntry\n )\n )\n\n return frontEntry\n }\n\n // Cold or evicted front entry: we pay the backing latency here (this is a\n // read that may legitimately surface a cold cache indicator). A miss\n // returns undefined and the \"use cache\" wrapper generates the entry and\n // writes it through both tiers via `set`.\n const backingEntry = await backing.get(cacheKey, softTags)\n\n if (!backingEntry) {\n return undefined\n }\n\n // Mirror this freshly read backing entry into the front so the next read\n // hits it. The mirror is serialized per key: if a sync is already\n // running, this chains after it, so the front converges to this read even\n // if the backing changed since that sync started.\n const [servedEntry, mirroredEntry] = cloneCacheEntry(backingEntry)\n scheduleBackgroundSync(cacheKey, () =>\n mirrorIntoFront(front, cacheKey, mirroredEntry)\n )\n\n return servedEntry\n },\n\n async set(cacheKey, pendingEntry) {\n // Write through to both tiers. The entry's value stream is single-use, so\n // tee it into one entry per tier.\n const entry = await pendingEntry\n const [frontEntry, backingEntry] = cloneCacheEntry(entry)\n\n await Promise.all([\n front.set(cacheKey, Promise.resolve(frontEntry)),\n backing.set(cacheKey, Promise.resolve(backingEntry)),\n ])\n },\n }\n}\n\n/**\n * After serving a cache hit from the front, consult the backing and mirror a\n * newer entry into the front for the next read. Runs in the background;\n * failures are non-fatal.\n */\nasync function reconcileFrontFromBacking(\n front: CacheHandler,\n backing: CacheHandler,\n cacheKey: string,\n softTags: string[],\n frontEntry: CacheEntry\n): Promise {\n try {\n const backingEntry = await backing.get(cacheKey, softTags)\n\n if (!backingEntry) {\n // The backing no longer has this entry (it was purged out-of-band). The\n // cache-handler interface has no per-key delete, so evict the front entry\n // by overwriting it with an already-expired copy: the next read sees a\n // front miss, falls through to the (also empty) backing, and the wrapper\n // regenerates. The entry we just served was the last stale read.\n await front.set(cacheKey, Promise.resolve(toExpiredEntry(frontEntry)))\n\n return\n }\n\n if (backingEntry.timestamp > frontEntry.timestamp) {\n await front.set(cacheKey, Promise.resolve(backingEntry))\n } else {\n // The front is already up to date, so the backing entry goes unused. This\n // code releases its stream and does not await the result. The backing\n // handler is user-configured, and it can return one branch of a teed\n // stream. `cancel()` on such a branch settles only after the sibling\n // branch is cancelled too, and the handler retains that sibling, so an\n // await here would hang the reconcile.\n void backingEntry.value.cancel()\n }\n } catch {\n // Background warming; failures are non-fatal.\n }\n}\n\n/**\n * Mirror a backing entry into the front.\n */\nasync function mirrorIntoFront(\n front: CacheHandler,\n cacheKey: string,\n entry: CacheEntry\n): Promise {\n try {\n await front.set(cacheKey, Promise.resolve(entry))\n } catch {\n // Background warming; failures are non-fatal.\n }\n}\n\n/**\n * Build an already-expired copy of an entry, used to evict it from the front\n * handler (which has no per-key delete) once the backing no longer has it. The\n * default handler treats a negative `expire` as an eviction sentinel and\n * reports the entry as missing on the next read. A negative `expire` is used\n * rather than `0` because the dev front handler enforces a minimum retention,\n * so a `0` `expire` would be kept alive by that minimum instead of evicted. The\n * value is never read once the entry is evicted, but it must carry at least one\n * byte because the built-in LRU cache refuses to store size-0 entries.\n */\nfunction toExpiredEntry(entry: CacheEntry): CacheEntry {\n return {\n ...entry,\n expire: -1,\n value: new ReadableStream({\n start(controller) {\n controller.enqueue(new Uint8Array(1))\n controller.close()\n },\n }),\n }\n}\n"],"names":["workAsyncStorage","cloneCacheEntry","createTieredCacheHandler","front","backing","inFlightSyncs","Map","scheduleBackgroundSync","cacheKey","sync","previous","get","pending","then","finally","delete","set","workStore","getStore","pendingRevalidateWrites","push","softTags","frontEntry","reconcileFrontFromBacking","backingEntry","undefined","servedEntry","mirroredEntry","mirrorIntoFront","pendingEntry","entry","Promise","all","resolve","toExpiredEntry","timestamp","value","cancel","expire","ReadableStream","start","controller","enqueue","Uint8Array","close"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,4CAA2C;AAC5E,SAASC,eAAe,QAAQ,sBAAqB;AAWrD;;;;;;;;;;;;;;CAcC,GACD,OAAO,SAASC,yBACdC,KAAmB,EACnBC,OAAqB;IAErB,4EAA4E;IAC5E,uEAAuE;IACvE,MAAMC,gBAAgB,IAAIC;IAE1B,SAASC,uBACPC,QAAgB,EAChBC,IAAyB;QAEzB,0EAA0E;QAC1E,0EAA0E;QAC1E,uEAAuE;QACvE,wEAAwE;QACxE,MAAMC,WAAWL,cAAcM,GAAG,CAACH;QAEnC,IAAII;QACJ,IAAIF,UAAU;YACZE,UAAUF,SAASG,IAAI,CAACJ;QAC1B,OAAO;YACLG,UAAUH;QACZ;QAEAG,UAAUA,QAAQE,OAAO,CAAC;YACxB,IAAIT,cAAcM,GAAG,CAACH,cAAcI,SAAS;gBAC3CP,cAAcU,MAAM,CAACP;YACvB;QACF;QAEAH,cAAcW,GAAG,CAACR,UAAUI;QAE5B,0EAA0E;QAC1E,0EAA0E;QAC1E,0EAA0E;QAC1E,0EAA0E;QAC1E,oBAAoB;QACpB,MAAMK,YAAYjB,iBAAiBkB,QAAQ;QAC3C,IAAID,WAAW;YACbA,UAAUE,uBAAuB,KAAK,EAAE;YACxCF,UAAUE,uBAAuB,CAACC,IAAI,CAACR;QACzC;I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GAAG,CAACR,UAAUuB,QAAQE,OAAO,CAACC,eAAeZ;YAEzD;QACF;QAEA,IAAIE,aAAaW,SAAS,GAAGb,WAAWa,SAAS,EAAE;YACjD,MAAMhC,MAAMa,GAAG,CAACR,UAAUuB,QAAQE,OAAO,CAACT;QAC5C,OAAO;YACL,0EAA0E;YAC1E,sEAAsE;YACtE,qEAAqE;YACrE,qEAAqE;YACrE,uEAAuE;YACvE,uCAAuC;YACvC,KAAKA,aAAaY,KAAK,CAACC,MAAM;QAChC;IACF,EAAE,OAAM;IACN,8CAA8C;IAChD;AACF;AAEA;;CAEC,GACD,eAAeT,gBACbzB,KAAmB,EACnBK,QAAgB,EAChBsB,KAAiB;IAEjB,IAAI;QACF,MAAM3B,MAAMa,GAAG,CAACR,UAAUuB,QAAQE,OAAO,CAACH;IAC5C,EAAE,OAAM;IACN,8CAA8C;IAChD;AACF;AAEA;;;;;;;;;CASC,GACD,SAASI,eAAeJ,KAAiB;IACvC,OAAO;QACL,GAAGA,KAAK;QACRQ,QAAQ,CAAC;QACTF,OAAO,IAAIG,eAAe;YACxBC,OAAMC,UAAU;gBACdA,WAAWC,OAAO,CAAC,IAAIC,WAAW;gBAClCF,WAAWG,KAAK;YAClB;QACF;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-errors.js b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-errors.js new file mode 100644 index 0000000000000000000000000000000000000000..ba4a5ca80ddb72ef500fac4dd62dfbb467fdbd57 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-errors.js @@ -0,0 +1,29 @@ +export class UseCacheTimeoutError extends Error { + constructor(route){ + super(`Route "${route}": ` + `A \`"use cache"\` function took too long during prerendering. The most common cause is passing unresolved request-specific arguments, such as \`params\` or \`searchParams\`, into the cached function. Resolve the data before calling the function and pass only the values you need.\nLearn more: https://nextjs.org/docs/messages/next-request-in-use-cache`); + } +} +export class UseCacheDeadlockError extends Error { + constructor(route){ + super(`Route "${route}": ` + `A \`"use cache"\` function is awaiting a promise created outside it. The same call completed when run in isolation, so a module-scoped value (often a top-level \`Map\` used to dedupe fetches) is most likely blocking it. \`"use cache"\` already dedupes calls with the same arguments. Remove the surrounding dedupe layer.\nLearn more: https://nextjs.org/docs/messages/next-request-in-use-cache`); + } +} +/** + * Used purely as `cause` for the nested-dynamic cache error: its captured stack + * points at the inner `"use cache"` invocation that propagated a dynamic cache + * life up to the outer cache. Constructed eagerly in `cache()` while the caller + * is still on the synchronous stack — see use-cache-wrapper.ts. + */ export class NestedDynamicUseCacheError extends Error { + constructor(){ + super('This "use cache" has a dynamic cache life that was propagated to its parent.'); + this.name = 'Nested dynamic "use cache"'; + } +} +/** Exported separately because tests assert on it */ export const UNEXPECTED_CACHE_MISS_MESSAGE = `Unexpected cache miss after cache warming phase during prerendering. This is likely caused by non-deterministic arguments that differ between the cache warming phase and the final prerender phase (e.g. unstable array order). Ensure that arguments passed to cached functions are deterministic.`; +export class UnexpectedCacheMissError extends Error { + constructor(route){ + super(`Route "${route}": ` + UNEXPECTED_CACHE_MISS_MESSAGE); + } +} + +//# sourceMappingURL=use-cache-errors.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-errors.js.map b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-errors.js.map new file mode 100644 index 0000000000000000000000000000000000000000..8d1ca0b07456dca4d35af3330a21ad8cba3b8314 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-errors.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/use-cache/use-cache-errors.ts"],"sourcesContent":["export class UseCacheTimeoutError extends Error {\n constructor(route: string) {\n super(\n `Route \"${route}\": ` +\n `A \\`\"use cache\"\\` function took too long during prerendering. The most common cause is passing unresolved request-specific arguments, such as \\`params\\` or \\`searchParams\\`, into the cached function. Resolve the data before calling the function and pass only the values you need.\\nLearn more: https://nextjs.org/docs/messages/next-request-in-use-cache`\n )\n }\n}\n\nexport class UseCacheDeadlockError extends Error {\n constructor(route: string) {\n super(\n `Route \"${route}\": ` +\n `A \\`\"use cache\"\\` function is awaiting a promise created outside it. The same call completed when run in isolation, so a module-scoped value (often a top-level \\`Map\\` used to dedupe fetches) is most likely blocking it. \\`\"use cache\"\\` already dedupes calls with the same arguments. Remove the surrounding dedupe layer.\\nLearn more: https://nextjs.org/docs/messages/next-request-in-use-cache`\n )\n }\n}\n\n/**\n * Used purely as `cause` for the nested-dynamic cache error: its captured stack\n * points at the inner `\"use cache\"` invocation that propagated a dynamic cache\n * life up to the outer cache. Constructed eagerly in `cache()` while the caller\n * is still on the synchronous stack — see use-cache-wrapper.ts.\n */\nexport class NestedDynamicUseCacheError extends Error {\n constructor() {\n super(\n 'This \"use cache\" has a dynamic cache life that was propagated to its parent.'\n )\n this.name = 'Nested dynamic \"use cache\"'\n }\n}\n\n/** Exported separately because tests assert on it */\nexport const UNEXPECTED_CACHE_MISS_MESSAGE = `Unexpected cache miss after cache warming phase during prerendering. This is likely caused by non-deterministic arguments that differ between the cache warming phase and the final prerender phase (e.g. unstable array order). Ensure that arguments passed to cached functions are deterministic.`\n\nexport class UnexpectedCacheMissError extends Error {\n constructor(route: string) {\n super(`Route \"${route}\": ` + UNEXPECTED_CACHE_MISS_MESSAGE)\n }\n}\n"],"names":["UseCacheTimeoutError","Error","constructor","route","UseCacheDeadlockError","NestedDynamicUseCacheError","name","UNEXPECTED_CACHE_MISS_MESSAGE","UnexpectedCacheMissError"],"mappings":"AAAA,OAAO,MAAMA,6BAA6BC;IACxCC,YAAYC,KAAa,CAAE;QACzB,KAAK,CACH,CAAC,OAAO,EAAEA,MAAM,GAAG,CAAC,GAClB,CAAC,+VAA+V,CAAC;IAEvW;AACF;AAEA,OAAO,MAAMC,8BAA8BH;IACzCC,YAAYC,KAAa,CAAE;QACzB,KAAK,CACH,CAAC,OAAO,EAAEA,MAAM,GAAG,CAAC,GAClB,CAAC,uYAAuY,CAAC;IAE/Y;AACF;AAEA;;;;;CAKC,GACD,OAAO,MAAME,mCAAmCJ;IAC9CC,aAAc;QACZ,KAAK,CACH;QAEF,IAAI,CAACI,IAAI,GAAG;IACd;AACF;AAEA,mDAAmD,GACnD,OAAO,MAAMC,gCAAgC,CAAC,oSAAoS,CAAC,CAAA;AAEnV,OAAO,MAAMC,iCAAiCP;IAC5CC,YAAYC,KAAa,CAAE;QACzB,KAAK,CAAC,CAAC,OAAO,EAAEA,MAAM,GAAG,CAAC,GAAGI;IAC/B;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-messages.js b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-messages.js new file mode 100644 index 0000000000000000000000000000000000000000..07e7c6c446dc4d6335bb661f0d92a1c84f11298c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-messages.js @@ -0,0 +1,95 @@ +/** + * Centralized error factories for cached function and revalidation misuse. + * State the scope and constraint, explain non-obvious boundaries, give the + * immediate fix, then link to the relevant docs. + */ const NEXT_REQUEST_IN_USE_CACHE = 'https://nextjs.org/docs/messages/next-request-in-use-cache'; +const UNSTABLE_CACHE_API_DOCS = 'https://nextjs.org/docs/app/api-reference/functions/unstable_cache'; +const USE_CACHE_PRIVATE_API_DOCS = 'https://nextjs.org/docs/app/api-reference/directives/use-cache-private'; +const CACHE_TAG_OUTSIDE_USE_CACHE = 'https://nextjs.org/docs/messages/cache-tag-outside-use-cache'; +const CACHE_LIFE_OUTSIDE_USE_CACHE = 'https://nextjs.org/docs/messages/cache-life-outside-use-cache'; +const USE_CACHE_PRIVATE_COMPOSITION = 'https://nextjs.org/docs/messages/use-cache-private-composition'; +const REVALIDATE_IN_USE_CACHE = 'https://nextjs.org/docs/messages/revalidate-in-use-cache'; +const NESTED_USE_CACHE_NO_EXPLICIT_CACHELIFE = 'https://nextjs.org/docs/messages/nested-use-cache-no-explicit-cachelife'; +// Request data accessed in caches +export function createCookiesInUseCacheError(route) { + return new Error(`Route "${route}": \`cookies()\` can't be read inside \`"use cache"\`. Read it outside the cached function and pass what you need as an argument.\nLearn more: ${NEXT_REQUEST_IN_USE_CACHE}`); +} +export function createCookiesInUnstableCacheError(route) { + return new Error(`Route "${route}": \`cookies()\` can't be read inside \`unstable_cache()\`. Read it outside the cached function and pass what you need as an argument.\nLearn more: ${UNSTABLE_CACHE_API_DOCS}`); +} +export function createHeadersInUseCacheError(route) { + return new Error(`Route "${route}": \`headers()\` can't be read inside \`"use cache"\`. Read it outside the cached function and pass what you need as an argument.\nLearn more: ${NEXT_REQUEST_IN_USE_CACHE}`); +} +export function createHeadersInUnstableCacheError(route) { + return new Error(`Route "${route}": \`headers()\` can't be read inside \`unstable_cache()\`. Read it outside the cached function and pass what you need as an argument.\nLearn more: ${UNSTABLE_CACHE_API_DOCS}`); +} +export function createSearchParamsInUseCacheError(route) { + return new Error(`Route "${route}": \`searchParams\` can't be read inside \`"use cache"\`. Await it outside the cached function and pass what you need as an argument.\nLearn more: ${NEXT_REQUEST_IN_USE_CACHE}`); +} +export function createConnectionInPublicUseCacheError(route) { + return new Error(`Route "${route}": \`connection()\` can't be called inside \`"use cache"\` because cached functions may run during prerendering, without an incoming request. Call it outside the cached function.\nLearn more: ${NEXT_REQUEST_IN_USE_CACHE}`); +} +export function createConnectionInPrivateUseCacheError(route) { + return new Error(`Route "${route}": \`connection()\` can't be called inside \`"use cache: private"\` because private cached functions may run during prefetching, without a navigation request. Call it outside the cached function.\nLearn more: ${USE_CACHE_PRIVATE_API_DOCS}`); +} +export function createConnectionInUnstableCacheError(route) { + return new Error(`Route "${route}": \`connection()\` can't be called inside \`unstable_cache()\` because cached functions may run during prerendering, without an incoming request. Call it outside the cached function.\nLearn more: ${UNSTABLE_CACHE_API_DOCS}`); +} +export function createRouteHandlerRequestInUseCacheError(route, expression) { + return new Error(`Route "${route}": \`${expression}\` can't be read inside \`"use cache"\`. Read it outside the cached function and pass what you need as an argument.\nLearn more: ${NEXT_REQUEST_IN_USE_CACHE}`); +} +export function createRouteHandlerRequestInUnstableCacheError(route, expression) { + return new Error(`Route "${route}": \`${expression}\` can't be read inside \`unstable_cache()\`. Read it outside the cached function and pass what you need as an argument.\nLearn more: ${UNSTABLE_CACHE_API_DOCS}`); +} +// Mutations inside caches and render +/** + * Used when `draftMode().enable()` or `.disable()` is called inside + * `"use cache"` or `"use cache: private"`. Reading `draftMode()` is fine + * inside a cached function, but toggling it is not. + */ export function createDraftModeMutationInUseCacheError(route, expression) { + return new Error(`Route "${route}": \`${expression}\` can't be called inside \`"use cache"\`. Draft mode can be read inside a cached function, but enabling or disabling it must happen outside.\nLearn more: ${NEXT_REQUEST_IN_USE_CACHE}`); +} +export function createDraftModeMutationInUnstableCacheError(route, expression) { + return new Error(`Route "${route}": \`${expression}\` can't be called inside \`unstable_cache()\`. Draft mode can be read inside a cached function, but enabling or disabling it must happen outside.\nLearn more: ${UNSTABLE_CACHE_API_DOCS}`); +} +export function createRevalidateDuringRenderError(route, expression) { + return new Error(`Route "${route}": \`${expression}\` can't be called during render. Call it from a Server Action or Route Handler instead.\nLearn more: ${REVALIDATE_IN_USE_CACHE}`); +} +export function createRevalidateInCachedFunctionError(route, expression) { + return new Error(`Route "${route}": \`${expression}\` can't be called inside a cached function. Call it from a Server Action or Route Handler instead.\nLearn more: ${REVALIDATE_IN_USE_CACHE}`); +} +export function createRevalidateInBuildTimeGeneratorError(route, expression, generatorName) { + return new Error(`Route "${route}": \`${expression}\` can't be called inside \`${generatorName}\`. Call it from a Server Action or Route Handler instead.\nLearn more: ${REVALIDATE_IN_USE_CACHE}`); +} +// Cache configuration and nesting +function routePrefix(route) { + return route === undefined ? '' : `Route "${route}": `; +} +export function createCacheTagOutsideUseCacheError(route) { + return new Error(`${routePrefix(route)}\`cacheTag()\` can only be called inside a \`"use cache"\` or \`"use cache: private"\` function.\nLearn more: ${CACHE_TAG_OUTSIDE_USE_CACHE}`); +} +export function createCacheLifeOutsideUseCacheError(route) { + return new Error(`${routePrefix(route)}\`cacheLife()\` can only be called inside a \`"use cache"\` or \`"use cache: private"\` function.\nLearn more: ${CACHE_LIFE_OUTSIDE_USE_CACHE}`); +} +export function createNestedCacheZeroRevalidateError(route, cause) { + return new Error(`Route "${route}": A nested \`"use cache"\` with \`revalidate: 0\` is inside an outer \`"use cache"\` that has no \`cacheLife()\`. Add \`cacheLife()\` to the outer one to choose whether to prerender it with a non-zero \`revalidate\` or keep it dynamic with \`revalidate: 0\`.\nLearn more: ${NESTED_USE_CACHE_NO_EXPLICIT_CACHELIFE}`, { + cause + }); +} +export function createNestedCacheShortExpireError(route, cause) { + return new Error(`Route "${route}": A nested \`"use cache"\` with a short \`expire\` (under 5 minutes) is inside an outer \`"use cache"\` that has no \`cacheLife()\`. Add \`cacheLife()\` to the outer one to choose whether to prerender it with a longer \`expire\` or keep it dynamic with a short \`expire\`.\nLearn more: ${NESTED_USE_CACHE_NO_EXPLICIT_CACHELIFE}`, { + cause + }); +} +// Private cache composition and request context +export function createUseCachePrivateInsidePublicUseCacheError(route) { + return new Error(`Route "${route}": \`"use cache: private"\` can't be nested inside \`"use cache"\` because a shared cached function can't depend on private request data. Nest it only inside another \`"use cache: private"\`.\nLearn more: ${USE_CACHE_PRIVATE_COMPOSITION}`); +} +export function createUseCachePrivateInsideUnstableCacheError(route) { + return new Error(`Route "${route}": \`"use cache: private"\` can't be used inside \`unstable_cache()\` because \`unstable_cache()\` uses a shared cache that can't contain private request data. Call the private cached function outside \`unstable_cache()\`.\nLearn more: ${USE_CACHE_PRIVATE_COMPOSITION}`); +} +export function createUseCachePrivateOutsideRequestContextError(route, functionName) { + return new Error(`Route "${route}": \`"use cache: private"\` needs an active request, so it can't be used during \`${functionName}\` or other build-time contexts. Move it to a request-time component or function.\nLearn more: ${USE_CACHE_PRIVATE_COMPOSITION}`); +} + +//# sourceMappingURL=use-cache-messages.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-messages.js.map b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-messages.js.map new file mode 100644 index 0000000000000000000000000000000000000000..53301469232106b423039d0b81c0e9ce31cd16b5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-messages.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/use-cache/use-cache-messages.ts"],"sourcesContent":["/**\n * Centralized error factories for cached function and revalidation misuse.\n * State the scope and constraint, explain non-obvious boundaries, give the\n * immediate fix, then link to the relevant docs.\n */\n\nimport type { BuildTimeGeneratorName } from '../app-render/work-unit-async-storage.external'\n\nconst NEXT_REQUEST_IN_USE_CACHE =\n 'https://nextjs.org/docs/messages/next-request-in-use-cache'\n\nconst UNSTABLE_CACHE_API_DOCS =\n 'https://nextjs.org/docs/app/api-reference/functions/unstable_cache'\n\nconst USE_CACHE_PRIVATE_API_DOCS =\n 'https://nextjs.org/docs/app/api-reference/directives/use-cache-private'\n\nconst CACHE_TAG_OUTSIDE_USE_CACHE =\n 'https://nextjs.org/docs/messages/cache-tag-outside-use-cache'\n\nconst CACHE_LIFE_OUTSIDE_USE_CACHE =\n 'https://nextjs.org/docs/messages/cache-life-outside-use-cache'\n\nconst USE_CACHE_PRIVATE_COMPOSITION =\n 'https://nextjs.org/docs/messages/use-cache-private-composition'\n\nconst REVALIDATE_IN_USE_CACHE =\n 'https://nextjs.org/docs/messages/revalidate-in-use-cache'\n\nconst NESTED_USE_CACHE_NO_EXPLICIT_CACHELIFE =\n 'https://nextjs.org/docs/messages/nested-use-cache-no-explicit-cachelife'\n\n// Request data accessed in caches\n\nexport function createCookiesInUseCacheError(route: string): Error {\n return new Error(\n `Route \"${route}\": \\`cookies()\\` can't be read inside \\`\"use cache\"\\`. Read it outside the cached function and pass what you need as an argument.\\nLearn more: ${NEXT_REQUEST_IN_USE_CACHE}`\n )\n}\n\nexport function createCookiesInUnstableCacheError(route: string): Error {\n return new Error(\n `Route \"${route}\": \\`cookies()\\` can't be read inside \\`unstable_cache()\\`. Read it outside the cached function and pass what you need as an argument.\\nLearn more: ${UNSTABLE_CACHE_API_DOCS}`\n )\n}\n\nexport function createHeadersInUseCacheError(route: string): Error {\n return new Error(\n `Route \"${route}\": \\`headers()\\` can't be read inside \\`\"use cache\"\\`. Read it outside the cached function and pass what you need as an argument.\\nLearn more: ${NEXT_REQUEST_IN_USE_CACHE}`\n )\n}\n\nexport function createHeadersInUnstableCacheError(route: string): Error {\n return new Error(\n `Route \"${route}\": \\`headers()\\` can't be read inside \\`unstable_cache()\\`. Read it outside the cached function and pass what you need as an argument.\\nLearn more: ${UNSTABLE_CACHE_API_DOCS}`\n )\n}\n\nexport function createSearchParamsInUseCacheError(route: string): Error {\n return new Error(\n `Route \"${route}\": \\`searchParams\\` can't be read inside \\`\"use cache\"\\`. Await it outside the cached function and pass what you need as an argument.\\nLearn more: ${NEXT_REQUEST_IN_USE_CACHE}`\n )\n}\n\nexport function createConnectionInPublicUseCacheError(route: string): Error {\n return new Error(\n `Route \"${route}\": \\`connection()\\` can't be called inside \\`\"use cache\"\\` because cached functions may run during prerendering, without an incoming request. Call it outside the cached function.\\nLearn more: ${NEXT_REQUEST_IN_USE_CACHE}`\n )\n}\n\nexport function createConnectionInPrivateUseCacheError(route: string): Error {\n return new Error(\n `Route \"${route}\": \\`connection()\\` can't be called inside \\`\"use cache: private\"\\` because private cached functions may run during prefetching, without a navigation request. Call it outside the cached function.\\nLearn more: ${USE_CACHE_PRIVATE_API_DOCS}`\n )\n}\n\nexport function createConnectionInUnstableCacheError(route: string): Error {\n return new Error(\n `Route \"${route}\": \\`connection()\\` can't be called inside \\`unstable_cache()\\` because cached functions may run during prerendering, without an incoming request. Call it outside the cached function.\\nLearn more: ${UNSTABLE_CACHE_API_DOCS}`\n )\n}\n\nexport function createRouteHandlerRequestInUseCacheError(\n route: string,\n expression: string\n): Error {\n return new Error(\n `Route \"${route}\": \\`${expression}\\` can't be read inside \\`\"use cache\"\\`. Read it outside the cached function and pass what you need as an argument.\\nLearn more: ${NEXT_REQUEST_IN_USE_CACHE}`\n )\n}\n\nexport function createRouteHandlerRequestInUnstableCacheError(\n route: string,\n expression: string\n): Error {\n return new Error(\n `Route \"${route}\": \\`${expression}\\` can't be read inside \\`unstable_cache()\\`. Read it outside the cached function and pass what you need as an argument.\\nLearn more: ${UNSTABLE_CACHE_API_DOCS}`\n )\n}\n\n// Mutations inside caches and render\n\n/**\n * Used when `draftMode().enable()` or `.disable()` is called inside\n * `\"use cache\"` or `\"use cache: private\"`. Reading `draftMode()` is fine\n * inside a cached function, but toggling it is not.\n */\nexport function createDraftModeMutationInUseCacheError(\n route: string,\n expression: string\n): Error {\n return new Error(\n `Route \"${route}\": \\`${expression}\\` can't be called inside \\`\"use cache\"\\`. Draft mode can be read inside a cached function, but enabling or disabling it must happen outside.\\nLearn more: ${NEXT_REQUEST_IN_USE_CACHE}`\n )\n}\n\nexport function createDraftModeMutationInUnstableCacheError(\n route: string,\n expression: string\n): Error {\n return new Error(\n `Route \"${route}\": \\`${expression}\\` can't be called inside \\`unstable_cache()\\`. Draft mode can be read inside a cached function, but enabling or disabling it must happen outside.\\nLearn more: ${UNSTABLE_CACHE_API_DOCS}`\n )\n}\n\nexport function createRevalidateDuringRenderError(\n route: string,\n expression: string\n): Error {\n return new Error(\n `Route \"${route}\": \\`${expression}\\` can't be called during render. Call it from a Server Action or Route Handler instead.\\nLearn more: ${REVALIDATE_IN_USE_CACHE}`\n )\n}\n\nexport function createRevalidateInCachedFunctionError(\n route: string,\n expression: string\n): Error {\n return new Error(\n `Route \"${route}\": \\`${expression}\\` can't be called inside a cached function. Call it from a Server Action or Route Handler instead.\\nLearn more: ${REVALIDATE_IN_USE_CACHE}`\n )\n}\n\nexport function createRevalidateInBuildTimeGeneratorError(\n route: string,\n expression: string,\n generatorName: BuildTimeGeneratorName\n): Error {\n return new Error(\n `Route \"${route}\": \\`${expression}\\` can't be called inside \\`${generatorName}\\`. Call it from a Server Action or Route Handler instead.\\nLearn more: ${REVALIDATE_IN_USE_CACHE}`\n )\n}\n\n// Cache configuration and nesting\n\nfunction routePrefix(route: string | undefined): string {\n return route === undefined ? '' : `Route \"${route}\": `\n}\n\nexport function createCacheTagOutsideUseCacheError(\n route: string | undefined\n): Error {\n return new Error(\n `${routePrefix(route)}\\`cacheTag()\\` can only be called inside a \\`\"use cache\"\\` or \\`\"use cache: private\"\\` function.\\nLearn more: ${CACHE_TAG_OUTSIDE_USE_CACHE}`\n )\n}\n\nexport function createCacheLifeOutsideUseCacheError(\n route: string | undefined\n): Error {\n return new Error(\n `${routePrefix(route)}\\`cacheLife()\\` can only be called inside a \\`\"use cache\"\\` or \\`\"use cache: private\"\\` function.\\nLearn more: ${CACHE_LIFE_OUTSIDE_USE_CACHE}`\n )\n}\n\nexport function createNestedCacheZeroRevalidateError(\n route: string,\n cause: Error | undefined\n): Error {\n return new Error(\n `Route \"${route}\": A nested \\`\"use cache\"\\` with \\`revalidate: 0\\` is inside an outer \\`\"use cache\"\\` that has no \\`cacheLife()\\`. Add \\`cacheLife()\\` to the outer one to choose whether to prerender it with a non-zero \\`revalidate\\` or keep it dynamic with \\`revalidate: 0\\`.\\nLearn more: ${NESTED_USE_CACHE_NO_EXPLICIT_CACHELIFE}`,\n { cause }\n )\n}\n\nexport function createNestedCacheShortExpireError(\n route: string,\n cause: Error | undefined\n): Error {\n return new Error(\n `Route \"${route}\": A nested \\`\"use cache\"\\` with a short \\`expire\\` (under 5 minutes) is inside an outer \\`\"use cache\"\\` that has no \\`cacheLife()\\`. Add \\`cacheLife()\\` to the outer one to choose whether to prerender it with a longer \\`expire\\` or keep it dynamic with a short \\`expire\\`.\\nLearn more: ${NESTED_USE_CACHE_NO_EXPLICIT_CACHELIFE}`,\n { cause }\n )\n}\n\n// Private cache composition and request context\n\nexport function createUseCachePrivateInsidePublicUseCacheError(\n route: string\n): Error {\n return new Error(\n `Route \"${route}\": \\`\"use cache: private\"\\` can't be nested inside \\`\"use cache\"\\` because a shared cached function can't depend on private request data. Nest it only inside another \\`\"use cache: private\"\\`.\\nLearn more: ${USE_CACHE_PRIVATE_COMPOSITION}`\n )\n}\n\nexport function createUseCachePrivateInsideUnstableCacheError(\n route: string\n): Error {\n return new Error(\n `Route \"${route}\": \\`\"use cache: private\"\\` can't be used inside \\`unstable_cache()\\` because \\`unstable_cache()\\` uses a shared cache that can't contain private request data. Call the private cached function outside \\`unstable_cache()\\`.\\nLearn more: ${USE_CACHE_PRIVATE_COMPOSITION}`\n )\n}\n\nexport function createUseCachePrivateOutsideRequestContextError(\n route: string,\n functionName: string\n): Error {\n return new Error(\n `Route \"${route}\": \\`\"use cache: private\"\\` needs an active request, so it can't be used during \\`${functionName}\\` or other build-time contexts. Move it to a request-time component or function.\\nLearn more: ${USE_CACHE_PRIVATE_COMPOSITION}`\n )\n}\n"],"names":["NEXT_REQUEST_IN_USE_CACHE","UNSTABLE_CACHE_API_DOCS","USE_CACHE_PRIVATE_API_DOCS","CACHE_TAG_OUTSIDE_USE_CACHE","CACHE_LIFE_OUTSIDE_USE_CACHE","USE_CACHE_PRIVATE_COMPOSITION","REVALIDATE_IN_USE_CACHE","NESTED_USE_CACHE_NO_EXPLICIT_CACHELIFE","createCookiesInUseCacheError","route","Error","createCookiesInUnstableCacheError","createHeadersInUseCacheError","createHeadersInUnstableCacheError","createSearchParamsInUseCacheError","createConnectionInPublicUseCacheError","createConnectionInPrivateUseCacheError","createConnectionInUnstableCacheError","createRouteHandlerRequestInUseCacheError","expression","createRouteHandlerRequestInUnstableCacheError","createDraftModeMutationInUseCacheError","createDraftModeMutationInUnstableCacheError","createRevalidateDuringRenderError","createRevalidateInCachedFunctionError","createRevalidateInBuildTimeGeneratorError","generatorName","routePrefix","undefined","createCacheTagOutsideUseCacheError","createCacheLifeOutsideUseCacheError","createNestedCacheZeroRevalidateError","cause","createNestedCacheShortExpireError","createUseCachePrivateInsidePublicUseCacheError","createUseCachePrivateInsideUnstableCacheError","createUseCachePr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B,oCACdrB,KAAyB;IAEzB,OAAO,IAAIC,MACT,GAAGiB,YAAYlB,OAAO,+GAA+G,EAAEL,8BAA8B;AAEzK;AAEA,OAAO,SAAS2B,qCACdtB,KAAa,EACbuB,KAAwB;IAExB,OAAO,IAAItB,MACT,CAAC,OAAO,EAAED,MAAM,iRAAiR,EAAEF,wCAAwC,EAC3U;QAAEyB;IAAM;AAEZ;AAEA,OAAO,SAASC,kCACdxB,KAAa,EACbuB,KAAwB;IAExB,OAAO,IAAItB,MACT,CAAC,OAAO,EAAED,MAAM,+RAA+R,EAAEF,wCAAwC,EACzV;QAAEyB;IAAM;AAEZ;AAEA,gDAAgD;AAEhD,OAAO,SAASE,+CACdzB,KAAa;IAEb,OAAO,IAAIC,MACT,CAAC,OAAO,EAAED,MAAM,6MAA6M,EAAEJ,+BAA+B;AAElQ;AAEA,OAAO,SAAS8B,8CACd1B,KAAa;IAEb,OAAO,IAAIC,MACT,CAAC,OAAO,EAAED,MAAM,4OAA4O,EAAEJ,+BAA+B;AAEjS;AAEA,OAAO,SAAS+B,gDACd3B,KAAa,EACb4B,YAAoB;IAEpB,OAAO,IAAI3B,MACT,CAAC,OAAO,EAAED,MAAM,kFAAkF,EAAE4B,aAAa,+FAA+F,EAAEhC,+BAA+B;AAErP","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-probe-globals.js b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-probe-globals.js new file mode 100644 index 0000000000000000000000000000000000000000..8bf7a6b771d0e6a984ba964bb66a58437378709b --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-probe-globals.js @@ -0,0 +1,17 @@ +// Cross-module handoff for the `'use cache'` hang-detection probe. A symbol on +// `globalThis` decouples the dev-server entry point (which installs the +// jest-worker pool) from the read site inside `use-cache-wrapper.ts` — avoiding +// a direct import of dev-only code from the use-cache module. In any process +// where the symbol is not set (prod, edge, unit tests, the probe worker itself) +// `getUseCacheProbe()` returns undefined, which doubles as the recursion guard +// against a probe spawning another probe. +const SYMBOL = Symbol.for('next.dev.useCacheProbe'); +export function setUseCacheProbe(fn) { + ; + globalThis[SYMBOL] = fn; +} +export function getUseCacheProbe() { + return globalThis[SYMBOL]; +} + +//# sourceMappingURL=use-cache-probe-globals.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-probe-globals.js.map b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-probe-globals.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f08beed23ab374f92290e32f5f3e641effe65d25 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-probe-globals.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/use-cache/use-cache-probe-globals.ts"],"sourcesContent":["import type { Params } from '../request/params'\n\n// Cross-module handoff for the `'use cache'` hang-detection probe. A symbol on\n// `globalThis` decouples the dev-server entry point (which installs the\n// jest-worker pool) from the read site inside `use-cache-wrapper.ts` — avoiding\n// a direct import of dev-only code from the use-cache module. In any process\n// where the symbol is not set (prod, edge, unit tests, the probe worker itself)\n// `getUseCacheProbe()` returns undefined, which doubles as the recursion guard\n// against a probe spawning another probe.\nconst SYMBOL: unique symbol = Symbol.for('next.dev.useCacheProbe')\n\n/**\n * Serializable view of the outer `RequestStore` forwarded to the probe\n * worker. The worker rebuilds a real `RequestStore` from this so cache\n * bodies that read `cookies()`, `headers()`, or `draftMode()` behave the\n * same as in a real fill — without it, those reads would diverge from\n * production behaviour and could mask the actual deadlock.\n */\nexport type UseCacheProbeRequestSnapshot = {\n headers: [string, string][]\n cookieHeader: string | undefined\n urlPathname: string\n urlSearch: string\n rootParams: Params\n isDraftMode: boolean\n isHmrRefresh: boolean\n hmrRefreshHash: string | undefined\n requestStartTime: number\n}\n\n/**\n * Probe hook installed by the dev server. Resolves to `true` if the cache\n * function ran to completion in isolation — the strong signal that shared\n * outer-scope state is deadlocking the main fill. Resolves to `false` for\n * any other outcome (probe timeout, decode failure, missing module, etc.).\n */\nexport type UseCacheProbe = (args: {\n /**\n * Page key as it appears in the build manifest, e.g. `/static/page` for\n * `app/static/page.tsx`. The trailing `/page` (or `/route`) suffix is\n * load-bearing — the worker passes this directly to `loadComponents()`.\n */\n page: string\n /** Route pathname; used to populate the worker's `WorkStore.route`. */\n route: string\n id: string\n kind: string\n encodedArguments: string | FormData\n request: UseCacheProbeRequestSnapshot\n timeoutMs: number\n}) => Promise\n\ninterface ProbeHolder {\n [SYMBOL]?: UseCacheProbe\n}\n\nexport function setUseCacheProbe(fn: UseCacheProbe | undefined): void {\n ;(globalThis as ProbeHolder)[SYMBOL] = fn\n}\n\nexport function getUseCacheProbe(): UseCacheProbe | undefined {\n return (globalThis as ProbeHolder)[SYMBOL]\n}\n"],"names":["SYMBOL","Symbol","for","setUseCacheProbe","fn","globalThis","getUseCacheProbe"],"mappings":"AAEA,+EAA+E;AAC/E,wEAAwE;AACxE,gFAAgF;AAChF,6EAA6E;AAC7E,gFAAgF;AAChF,+EAA+E;AAC/E,0CAA0C;AAC1C,MAAMA,SAAwBC,OAAOC,GAAG,CAAC;AA+CzC,OAAO,SAASC,iBAAiBC,EAA6B;;IAC1DC,UAA0B,CAACL,OAAO,GAAGI;AACzC;AAEA,OAAO,SAASE;IACd,OAAO,AAACD,UAA0B,CAACL,OAAO;AAC5C","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-probe-scheduler.js b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-probe-scheduler.js new file mode 100644 index 0000000000000000000000000000000000000000..ceda92df605057778478ff12775a93af26b2670f --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-probe-scheduler.js @@ -0,0 +1,120 @@ +import { getUseCacheProbe } from './use-cache-probe-globals'; +const PROBE_THRESHOLD_MS = 10000; +const MIN_PROBE_BUDGET_MS = 3000; +/** + * Schedule an idle-deadline probe over a cache fill stream (dev-only). + * + * Fires the probe when the stream has been idle for `PROBE_THRESHOLD_MS`. The + * probe re-runs the cache function in a fresh V8 isolate so module-scoped state + * from the outer render — e.g. a top-level `Map` deduping + * fetches — can't poison the body. If the function completes in isolation, the + * hang is attributable to that shared state and the caller surfaces a specific + * error instead of waiting out the generic timeout. + * + * Returns the input stream unchanged when the scheduler should be skipped: no + * probe hook installed, or the remaining time until `fillDeadlineAt` is too + * short to leave room for both the idle threshold and a minimum probe budget. + */ export function setupProbeScheduler(opts) { + const { workStore, outerRequestStore, cacheContext, encodedArguments, fillDeadlineAt, stream, abortSignal, onProbeCompleted } = opts; + if (fillDeadlineAt - performance.now() < PROBE_THRESHOLD_MS + MIN_PROBE_BUDGET_MS) { + return stream; + } + const probe = getUseCacheProbe(); + if (!probe) { + return stream; + } + let lastChunkAt = performance.now(); + let idleTimer; + const startProbe = ()=>{ + if (abortSignal.aborted) { + return; + } + const probeStartedAtChunk = lastChunkAt; + // Computed when the probe is about to run so it gets the actual remaining + // budget, not a stale value baked in at scheduler setup. Reserves a 1s + // buffer so the probe's internal timeout fires before the outer render + // timeout. + const probeInternalTimeoutMs = fillDeadlineAt - performance.now() - 1000; + probe({ + page: workStore.page, + route: workStore.route, + id: cacheContext.functionId, + kind: cacheContext.handlerKind, + encodedArguments, + // Built lazily because most fills complete before the idle timer fires; + // only worth assembling once we know the probe is running. + request: { + headers: Array.from(outerRequestStore.headers.entries()), + cookieHeader: outerRequestStore.headers.get('cookie') ?? undefined, + urlPathname: outerRequestStore.url.pathname, + urlSearch: outerRequestStore.url.search, + rootParams: outerRequestStore.rootParams ?? {}, + isDraftMode: workStore.isDraftMode ?? false, + isHmrRefresh: outerRequestStore.isHmrRefresh ?? false, + hmrRefreshHash: outerRequestStore.hmrRefreshHash, + requestStartTime: workStore.requestStartTime + }, + timeoutMs: probeInternalTimeoutMs + }).then((completed)=>{ + // Mid-probe recovery: chunks arrived while the probe was running, so + // the main stream is making progress. Discard the probe's result rather + // than reporting a deadlock that no longer holds. + if (lastChunkAt > probeStartedAtChunk) { + return; + } + if (completed && !abortSignal.aborted) { + onProbeCompleted(); + } + }, ()=>{ + // Probe failures are inconclusive; fall back to the regular cache-fill + // timeout. + }); + }; + const scheduleAfterIdle = ()=>{ + if (idleTimer !== undefined || abortSignal.aborted) { + return; + } + const now = performance.now(); + const idleFor = now - lastChunkAt; + const wait = Math.max(0, PROBE_THRESHOLD_MS - idleFor); + // Skip scheduling if the outer fill timeout will fire before the probe + // could even start running with at least a minimum useful budget. Without + // this check, a chunk arriving late in the fill could reschedule a probe + // that the outer timeout would then abort — wasted worker spawn for a probe + // that can't meaningfully complete. + if (fillDeadlineAt - now < wait + MIN_PROBE_BUDGET_MS) { + return; + } + idleTimer = setTimeout(()=>{ + idleTimer = undefined; + if (abortSignal.aborted) { + return; + } + const idleNow = performance.now() - lastChunkAt; + if (idleNow < PROBE_THRESHOLD_MS) { + // A chunk arrived since we set this timer; reschedule. + scheduleAfterIdle(); + return; + } + startProbe(); + }, wait); + }; + abortSignal.addEventListener('abort', ()=>{ + if (idleTimer !== undefined) { + clearTimeout(idleTimer); + idleTimer = undefined; + } + }, { + once: true + }); + scheduleAfterIdle(); + return stream.pipeThrough(new TransformStream({ + transform (chunk, controller) { + lastChunkAt = performance.now(); + scheduleAfterIdle(); + controller.enqueue(chunk); + } + })); +} + +//# sourceMappingURL=use-cache-probe-scheduler.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-probe-scheduler.js.map b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-probe-scheduler.js.map new file mode 100644 index 0000000000000000000000000000000000000000..112bb378f4d1d3361bed26744d4b9823ab00800b --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-probe-scheduler.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/use-cache/use-cache-probe-scheduler.ts"],"sourcesContent":["import type { WorkStore } from '../app-render/work-async-storage.external'\nimport type { RequestStore } from '../app-render/work-unit-async-storage.external'\n\nimport { getUseCacheProbe } from './use-cache-probe-globals'\n\nconst PROBE_THRESHOLD_MS = 10_000\nconst MIN_PROBE_BUDGET_MS = 3_000\n\ninterface CacheContextWithProbeFields {\n readonly functionId: string\n readonly handlerKind: string\n}\n\ninterface SetupOptions {\n workStore: WorkStore\n outerRequestStore: RequestStore\n cacheContext: CacheContextWithProbeFields\n encodedArguments: string | FormData\n /**\n * Absolute monotonic deadline (in `performance.now()` units) at which the\n * outer cache fill will be aborted by the dev render-timeout timer. The\n * scheduler derives the up-front budget check, every reschedule budget check,\n * and each probe's internal timeout from this single value.\n */\n fillDeadlineAt: number\n /**\n * Cache stream to track. Each chunk that flows through resets the idle timer;\n * the returned stream is the same data, transparently observed.\n */\n stream: ReadableStream\n /**\n * Aborts when the probe should stop watching: the cache fill bailed (timeout,\n * upstream cancel, deadlock detection), or it settled normally.\n */\n abortSignal: AbortSignal\n /**\n * Called once if the probe ran the cache function to completion in isolation\n * while the main fill was still pending. Strong signal that shared state from\n * the outer scope is preventing the body from progressing — the caller\n * decides what to do with that (typically abort the fill and surface a\n * deadlock error).\n */\n onProbeCompleted: () => void\n}\n\n/**\n * Schedule an idle-deadline probe over a cache fill stream (dev-only).\n *\n * Fires the probe when the stream has been idle for `PROBE_THRESHOLD_MS`. The\n * probe re-runs the cache function in a fresh V8 isolate so module-scoped state\n * from the outer render — e.g. a top-level `Map` deduping\n * fetches — can't poison the body. If the function completes in isolation, the\n * hang is attributable to that shared state and the caller surfaces a specific\n * error instead of waiting out the generic timeout.\n *\n * Returns the input stream unchanged when the scheduler should be skipped: no\n * probe hook installed, or the remaining time until `fillDeadlineAt` is too\n * short to leave room for both the idle threshold and a minimum probe budget.\n */\nexport function setupProbeScheduler(\n opts: SetupOptions\n): ReadableStream {\n const {\n workStore,\n outerRequestStore,\n cacheContext,\n encodedArguments,\n fillDeadlineAt,\n stream,\n abortSignal,\n onProbeCompleted,\n } = opts\n\n if (\n fillDeadlineAt - performance.now() <\n PROBE_THRESHOLD_MS + MIN_PROBE_BUDGET_MS\n ) {\n return stream\n }\n\n const probe = getUseCacheProbe()\n if (!probe) {\n return stream\n }\n\n let lastChunkAt = performance.now()\n let idleTimer: ReturnType | undefined\n\n const startProbe = () => {\n if (abortSignal.aborted) {\n return\n }\n\n const probeStartedAtChunk = lastChunkAt\n\n // Computed when the probe is about to run so it gets the actual remaining\n // budget, not a stale value baked in at scheduler setup. Reserves a 1s\n // buffer so the probe's internal timeout fires before the outer render\n // timeout.\n const probeInternalTimeoutMs = fillDeadlineAt - performance.now() - 1_000\n\n probe({\n page: workStore.page,\n route: workStore.route,\n id: cacheContext.functionId,\n kind: cacheContext.handlerKind,\n encodedArguments,\n // Built lazily because most fills complete before the idle timer fires;\n // only worth assembling once we know the probe is running.\n request: {\n headers: Array.from(outerRequestStore.headers.entries()),\n cookieHeader: outerRequestStore.headers.get('cookie') ?? undefined,\n urlPathname: outerRequestStore.url.pathname,\n urlSearch: outerRequestStore.url.search,\n rootParams: outerRequestStore.rootParams ?? {},\n isDraftMode: workStore.isDraftMode ?? false,\n isHmrRefresh: outerRequestStore.isHmrRefresh ?? false,\n hmrRefreshHash: outerRequestStore.hmrRefreshHash,\n requestStartTime: workStore.requestStartTime,\n },\n timeoutMs: probeInternalTimeoutMs,\n }).then(\n (completed) => {\n // Mid-probe recovery: chunks arrived while the probe was running, so\n // the main stream is making progress. Discard the probe's result rather\n // than reporting a deadlock that no longer holds.\n if (lastChunkAt > probeStartedAtChunk) {\n return\n }\n if (completed && !abortSignal.aborted) {\n onProbeCompleted()\n }\n },\n () => {\n // Probe failures are inconclusive; fall back to the regular cache-fill\n // timeout.\n }\n )\n }\n\n const scheduleAfterIdle = () => {\n if (idleTimer !== undefined || abortSignal.aborted) {\n return\n }\n const now = performance.now()\n const idleFor = now - lastChunkAt\n const wait = Math.max(0, PROBE_THRESHOLD_MS - idleFor)\n\n // Skip scheduling if the outer fill timeout will fire before the probe\n // could even start running with at least a minimum useful budget. Without\n // this check, a chunk arriving late in the fill could reschedule a probe\n // that the outer timeout would then abort — wasted worker spawn for a probe\n // that can't meaningfully complete.\n if (fillDeadlineAt - now < wait + MIN_PROBE_BUDGET_MS) {\n return\n }\n\n idleTimer = setTimeout(() => {\n idleTimer = undefined\n if (abortSignal.aborted) {\n return\n }\n const idleNow = performance.now() - lastChunkAt\n if (idleNow < PROBE_THRESHOLD_MS) {\n // A chunk arrived since we set this timer; reschedule.\n scheduleAfterIdle()\n return\n }\n startProbe()\n }, wait)\n }\n\n abortSignal.addEventListener(\n 'abort',\n () => {\n if (idleTimer !== undefined) {\n clearTimeout(idleTimer)\n idleTimer = undefined\n }\n },\n { once: true }\n )\n\n scheduleAfterIdle()\n\n return stream.pipeThrough(\n new TransformStream({\n transform(chunk, controller) {\n lastChunkAt = performance.now()\n scheduleAfterIdle()\n controller.enqueue(chunk)\n },\n })\n )\n}\n"],"names":["getUseCacheProbe","PROBE_THRESHOLD_MS","MIN_PROBE_BUDGET_MS","setupProbeScheduler","opts","workStore","outerRequestStore","cacheContext","encodedArguments","fillDeadlineAt","stream","abortSignal","onProbeCompleted","performance","now","probe","lastChunkAt","idleTimer","startProbe","aborted","probeStartedAtChunk","probeInternalTimeoutMs","page","route","id","functionId","kind","handlerKind","request","headers","Array","from","entries","cookieHeader","get","undefined","urlPathname","url","pathname","urlSearch","search","rootParams","isDraftMode","isHmrRefresh","hmrRefreshHash","requestStartTime","timeoutMs","then","completed","scheduleAfterIdle","idleFor","wait","Math","max","setTimeout","idleNow","addEventListener","clearTimeout","once","pipeThrough","TransformStream","transform","chunk","controller","enqueue"],"mappings":"AAGA,SAASA,gBAAgB,QAAQ,4BAA2B;AAE5D,MAAMC,qBAAqB;AAC3B,MAAMC,sBAAsB;AAuC5B;;;;;;;;;;;;;CAaC,GACD,OAAO,SAASC,oBACdC,IAAkB;IAElB,MAAM,EACJC,SAAS,EACTC,iBAAiB,EACjBC,YAAY,EACZC,gBAAgB,E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CP;YACF;QACF,GACA;QACE,uEAAuE;QACvE,WAAW;QACb;IAEJ;IAEA,MAAMqC,oBAAoB;QACxB,IAAIhC,cAAckB,aAAaxB,YAAYQ,OAAO,EAAE;YAClD;QACF;QACA,MAAML,MAAMD,YAAYC,GAAG;QAC3B,MAAMoC,UAAUpC,MAAME;QACtB,MAAMmC,OAAOC,KAAKC,GAAG,CAAC,GAAGpD,qBAAqBiD;QAE9C,uEAAuE;QACvE,0EAA0E;QAC1E,yEAAyE;QACzE,4EAA4E;QAC5E,oCAAoC;QACpC,IAAIzC,iBAAiBK,MAAMqC,OAAOjD,qBAAqB;YACrD;QACF;QAEAe,YAAYqC,WAAW;YACrBrC,YAAYkB;YACZ,IAAIxB,YAAYQ,OAAO,EAAE;gBACvB;YACF;YACA,MAAMoC,UAAU1C,YAAYC,GAAG,KAAKE;YACpC,IAAIuC,UAAUtD,oBAAoB;gBAChC,uDAAuD;gBACvDgD;gBACA;YACF;YACA/B;QACF,GAAGiC;IACL;IAEAxC,YAAY6C,gBAAgB,CAC1B,SACA;QACE,IAAIvC,cAAckB,WAAW;YAC3BsB,aAAaxC;YACbA,YAAYkB;QACd;IACF,GACA;QAAEuB,MAAM;IAAK;IAGfT;IAEA,OAAOvC,OAAOiD,WAAW,CACvB,IAAIC,gBAAwC;QAC1CC,WAAUC,KAAK,EAAEC,UAAU;YACzB/C,cAAcH,YAAYC,GAAG;YAC7BmC;YACAc,WAAWC,OAAO,CAACF;QACrB;IACF;AAEJ","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-wrapper.js b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-wrapper.js new file mode 100644 index 0000000000000000000000000000000000000000..7837534f252dcb92ca6d1b131018cbe329c5cdff --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-wrapper.js @@ -0,0 +1,2633 @@ +/* eslint-disable import/no-extraneous-dependencies */ import { renderToReadableStream, decodeReply, decodeReplyFromAsyncIterable, createTemporaryReferenceSet as createServerTemporaryReferenceSet } from 'react-server-dom-webpack/server'; +import { createFromReadableStream, encodeReply, createTemporaryReferenceSet as createClientTemporaryReferenceSet } from 'react-server-dom-webpack/client'; +import { prerender } from 'react-server-dom-webpack/static'; +import { workAsyncStorage } from '../app-render/work-async-storage.external'; +import { getHmrRefreshHash, getResumeDataCache, getVaryParamsAccumulator, workUnitAsyncStorage, getDraftModeProviderForCacheScope, getCacheSignal, isHmrRefresh, getServerComponentsHmrCache, willConsumerServerCache } from '../app-render/work-unit-async-storage.external'; +import { accumulateVaryParam } from '../app-render/vary-params'; +import { applyOwnerStack, makeDevtoolsIOAwarePromise, makeDynamicHangingPromise, makeFallbackParamsHangingPromise, makeUntrackedHangingPromise, makeSessionDataHangingPromise, makeURLDataHangingPromise, makePrefetchHangingPromise, makeUnknownRuntimeDataHangingPromise, RENDER_STAGES_BY_DATA_KIND, trackFallbackParamsAccessed, trackURLDataAccessed, trackIncompatibleShellContent, trackPromiseUsed } from '../dynamic-rendering-utils'; +import { getClientReferenceManifest, getRscModuleMappingForUseCache, getServerActionsManifest, getServerModuleMap, normalizeWorkerPageName } from '../app-render/manifests-singleton'; +import { decryptActionBoundArgs } from '../app-render/encryption'; +import { InvariantError } from '../../shared/lib/invariant-error'; +import { createReactServerErrorHandler } from '../app-render/create-error-handler'; +import stringHash from 'next/dist/compiled/string-hash'; +import { MIN_PRERENDERABLE_EXPIRE, MIN_PREFETCHABLE_STALE, MIN_SHELL_STALE } from './constants'; +import { NEXT_CACHE_ROOT_PARAM_TAG_ID } from '../../lib/constants'; +import { getCacheHandler, getDevTieredCacheHandler, getPrivateCacheHandler, isBuiltInCacheHandler, isCustomCacheHandler, isMemoryCacheDisabled } from './handlers'; +import { cloneCacheEntry } from './clone-cache-entry'; +import { NEXT_INSTANT_TEST_COOKIE } from '../../client/components/app-router-headers'; +import { RequestCookiesAdapter } from '../web/spec-extension/adapters/request-cookies'; +import { HeadersAdapter } from '../web/spec-extension/adapters/headers'; +import { NestedDynamicUseCacheError, UnexpectedCacheMissError, UseCacheDeadlockError, UseCacheTimeoutError } from './use-cache-errors'; +import { createNestedCacheShortExpireError, createNestedCacheZeroRevalidateError, createUseCachePrivateInsidePublicUseCacheError, createUseCachePrivateInsideUnstableCacheError, createUseCachePrivateOutsideRequestContextError } from './use-cache-messages'; +import { createHangingInputAbortSignal, throwToInterruptStaticGeneration } from '../app-render/dynamic-rendering'; +import { makeErroringSearchParamsForUseCache } from '../request/search-params'; +import { FALLBACK_PARAMS, RUNTIME_DATA, SESSION_DATA } from '../resume-data-cache/cache-store'; +import { createLazyResult, isResolvedLazyResult } from '../lib/lazy-result'; +import { abortOnDynamicAccess, dynamicAccessAsyncStorage } from '../app-render/dynamic-access-async-storage.external'; +import { RenderStage } from '../app-render/staged-rendering'; +import * as Log from '../../build/output/log'; +import { getServerReact, getClientReact } from '../runtime-reacts.external'; +import { createPromiseWithResolvers } from '../../shared/lib/promise-with-resolvers'; +const nextVersion = "16.4.0"; +/** + * Encapsulates a pending cache invocation for deduping. Manages lazy stream + * tee-ing (via fork()) and metadata access for both intra-request and + * cross-request joiners. + */ class SharedCacheEntry { + constructor(stream, pendingMetadata, pendingWrite){ + this.stream = stream; + this.pendingMetadata = pendingMetadata; + this.pendingCompletion = pendingWrite === undefined ? pendingMetadata : pendingWrite.then(()=>pendingMetadata, ()=>pendingMetadata); + } + /** + * Tee the stream: returns a copy for the caller, replaces the internal stream + * with the remaining branch for future callers. Both the leader and joiners + * call this — everyone gets a fork. + */ fork() { + const [forked, remaining] = this.stream.tee(); + this.stream = remaining; + return forked; + } +} +function ignoreReject() {} +/** + * Manages the deferred promise for a shared cache result, tracks which maps + * it's registered in, and drives cleanup from resolve/reject. + * + * Cached results stay in the maps until collection finishes and handler writes + * settle. Later invocations can join while either remains pending. For + * 'prerender-dynamic' and errors, cleanup is immediate. + */ class ResolvableSharedCacheResult { + registerIn(map, key, retentionMap) { + map.set(key, this.deferred.promise); + this.registrations.push({ + map, + key, + retentionMap + }); + } + resolve(result) { + this.deferred.resolve(result); + if (result.type === 'cached') { + // Retain only an entry that collected successfully. A failed collection + // leaves metadata a later invocation cannot read, so it is dropped like + // any other failure and the next invocation regenerates. + result.entry.pendingCompletion.then(()=>this.cleanupAndRetain(), ()=>this.cleanup()); + } else { + this.cleanup(); + } + } + reject(error) { + // The promise stored in the dedup maps has no consumer unless a concurrent + // invocation joined it, so we attach a noop catch handler to prevent the + // rejection from being reported as unhandled. The leader rethrows the + // error into the render, which is where it's surfaced. + this.deferred.promise.catch(ignoreReject); + this.deferred.reject(error); + this.cleanup(); + } + /** + * Drops the pending registrations, leaving nothing for a later invocation to + * join. Used when the invocation produced no entry that a later one could + * serve: an error has no value, and a 'prerender-dynamic' result is a hanging + * promise bound to the leader's render signal. + */ cleanup() { + for (const { map, key } of this.registrations){ + map.delete(key); + } + } + /** + * Drops the pending registrations and moves the entry into the retention map + * where one was given, so a later invocation in the same request can reuse it + * instead of repeating the lookup and, on a miss, the work. + */ cleanupAndRetain() { + for (const { map, key, retentionMap } of this.registrations){ + map.delete(key); + retentionMap == null ? void 0 : retentionMap.set(key, this.deferred.promise); + } + } + constructor(){ + this.deferred = createPromiseWithResolvers(); + this.registrations = []; + } +} +/** + * Module-scope map for cross-request deduplication. Keyed by `cacheHandlerKey` + * (specific key on warm path, coarse key on cold path). Entries live only for + * the duration of the leader's invocation. + */ const crossRequestPendingCacheInvocations = new Map(); +// Prevent duplicate background revalidations for the same key until generation +// and cache writes finish. +const backgroundRevalidations = new Map(); +// The first argument at each call site is the full directive that produced +// the invocation, e.g. "'use cache'" or "'use cache: remote'". +const debug = process.env.NEXT_PRIVATE_DEBUG_CACHE ? console.debug.bind(console) : undefined; +const filterStackFrame = process.env.NODE_ENV !== 'production' ? require('../lib/source-maps').filterStackFrameDEV : undefined; +const findSourceMapURL = process.env.NODE_ENV !== 'production' ? require('../lib/source-maps').findSourceMapURLDEV : undefined; +// Tracks which root params each cache function has historically read. Used to +// compute the specific cache key upfront on subsequent invocations. In-memory +// only — after server restart, the coarse-key redirect entry in the cache +// handler provides fallback. +const knownRootParamsByFunctionId = new Map(); +function addKnownRootParamNames(id, names) { + const existing = knownRootParamsByFunctionId.get(id); + if (existing) { + for (const name of names){ + existing.add(name); + } + return existing; + } + const created = new Set(names); + knownRootParamsByFunctionId.set(id, created); + return created; +} +function computeRootParamsCacheKeySuffix(rootParams, paramNames) { + if (paramNames.size === 0) { + return ''; + } + return JSON.stringify([ + ...paramNames + ].sort().map((paramName)=>[ + paramName, + rootParams[paramName] + ])); +} +// Next-internal cookies that must not vary the private cache key, since they're +// not part of the application's own cookie state. The instant-navigation cookie +// toggles while a navigation lock is held, so including it would force spurious +// misses. +const COOKIES_EXCLUDED_FROM_PRIVATE_CACHE_KEY = new Set([ + NEXT_INSTANT_TEST_COOKIE +]); +// Request and transport headers that must not vary the private cache key. They +// either differ between otherwise-equivalent requests, which would cause +// spurious misses (a browser reload adds `cache-control`/`pragma` that an +// initial navigation doesn't, and `accept`/`sec-fetch-*` differ between an HTML +// navigation and an RSC or prefetch request for the same page), or are +// connection- and proxy-level rather than application data. The `cookie` header +// is excluded because cookies are keyed separately below (via the dedicated +// cookie path, which applies `COOKIES_EXCLUDED_FROM_PRIVATE_CACHE_KEY`); +// including the raw header would duplicate them and reintroduce the cookies +// that path excludes. Header names are lowercased by `HeadersAdapter`, so every +// entry here is lowercase. +const HEADERS_EXCLUDED_FROM_PRIVATE_CACHE_KEY = new Set([ + 'accept', + 'accept-encoding', + 'cache-control', + 'connection', + 'cookie', + 'if-match', + 'if-modified-since', + 'if-none-match', + 'if-range', + 'if-unmodified-since', + 'keep-alive', + 'pragma', + 'priority', + 'purpose', + 'range', + 'sec-fetch-dest', + 'sec-fetch-mode', + 'sec-fetch-site', + 'sec-fetch-user', + 'sec-purpose', + 'te', + 'upgrade', + 'upgrade-insecure-requests', + 'x-forwarded-for', + 'x-forwarded-host', + 'x-forwarded-port', + 'x-forwarded-proto' +]); +// TODO: This varies the dev private cache key by the request's cookies and +// headers (minus the transport and content-negotiation headers excluded above). +// It's a heuristic: it still over-keys (a cache that reads only one cookie or +// header varies by all of them) and the header denylist is necessarily +// incomplete. Follow up by tracking which cookies and headers a cache function +// actually reads (the same mechanism root params use via `readRootParamNames`) +// and keying by only those. Note that Next-internal flight headers such as +// `rsc` and `next-router-state-tree` are already stripped upstream in +// `getHeaders`, so they never appear here. +function computePrivateCacheKeyRequestSuffix(cookies, headers) { + const relevantCookies = cookies.getAll().filter((cookie)=>!COOKIES_EXCLUDED_FROM_PRIVATE_CACHE_KEY.has(cookie.name)).map((cookie)=>[ + cookie.name, + cookie.value + ]).sort(([nameA], [nameB])=>nameA < nameB ? -1 : nameA > nameB ? 1 : 0); + const relevantHeaders = [ + ...headers.entries() + ].filter(([name])=>!HEADERS_EXCLUDED_FROM_PRIVATE_CACHE_KEY.has(name)).sort(([nameA], [nameB])=>nameA < nameB ? -1 : nameA > nameB ? 1 : 0); + if (relevantCookies.length === 0 && relevantHeaders.length === 0) { + return ''; + } + return JSON.stringify({ + cookies: relevantCookies, + headers: relevantHeaders + }); +} +function saveToResumeDataCache(resumeDataCache, serializedCacheKey, pendingCacheResult, logPrefix) { + if (!(resumeDataCache == null ? void 0 : resumeDataCache.mutable)) { + return pendingCacheResult; + } + const split = clonePendingCacheResult(pendingCacheResult); + const savedCacheResult = getNthCacheResult(split, 0); + const rdcResult = getNthCacheResult(split, 1); + // The RDC is per-page and root params are fixed within a page, so we always + // use the coarse key (without root param suffix). Unlike the cache handler, + // the RDC doesn't need root-param-specific keys for isolation. + resumeDataCache.cache.set(serializedCacheKey, rdcResult); + debug == null ? void 0 : debug(logPrefix, 'Resume Data Cache entry saved', serializedCacheKey); + return savedCacheResult; +} +/** + * A joiner's RDC context may differ from the leader's: + * + * - Intra-request: the leader was nested inside another cache (no accessible + * RDC) while this joiner is top-level and has one. + * - Cross-request: the leader belongs to a different request entirely — this + * request's RDC has never seen the entry. + * + * In both cases the joiner must save to its own RDC so its final prerender can + * resume from the entry. Constructs a `CollectedCacheResult` from a forked + * stream branch of the shared entry and the awaited metadata. + * + * An existing entry avoids redundant saves when the intra-request leader + * already saved to the same RDC. A marker, however, can be replaced by a + * successful fill. + */ function saveSharedCacheEntryToResumeDataCache(serializedCacheKey, sharedCacheEntry, resumeDataCache, logPrefix) { + if (!(resumeDataCache == null ? void 0 : resumeDataCache.mutable)) { + return; + } + const existingEntry = resumeDataCache.cache.get(serializedCacheKey); + if (existingEntry !== undefined && existingEntry !== FALLBACK_PARAMS && existingEntry !== RUNTIME_DATA && existingEntry !== SESSION_DATA) { + return; + } + const rdcResult = sharedCacheEntry.pendingMetadata.then((metadata)=>({ + entry: { + value: sharedCacheEntry.fork(), + tags: metadata.tags, + revalidate: metadata.revalidate, + expire: metadata.expire, + stale: metadata.stale, + timestamp: metadata.timestamp + }, + readRootParamNames: metadata.readRootParamNames, + hasExplicitRevalidate: metadata.hasExplicitRevalidate, + hasExplicitExpire: metadata.hasExplicitExpire, + dynamicNestedCacheError: metadata.dynamicNestedCacheError + })); + resumeDataCache.cache.set(serializedCacheKey, rdcResult); + debug == null ? void 0 : debug(logPrefix, 'Resume Data Cache entry saved by joiner', serializedCacheKey); +} +/** + * Completes a join onto another invocation's entry, whether that invocation is + * still filling or has already finished: forks the stream, saves to this + * invocation's RDC if the leader had none, and balances the cache signal read + * once the entry is fully collected. + */ function serveJoinedCacheEntry(sharedCacheEntry, serializedCacheKey, resumeDataCache, cacheContext, cacheSignal, logPrefix) { + const stream = sharedCacheEntry.fork(); + // If the leader was nested inside another cache (no accessible RDC), it + // couldn't save to the RDC. This joiner may be top-level with an RDC, in + // which case it must save here; otherwise the RDC lookup during the final + // prerender will miss. + saveSharedCacheEntryToResumeDataCache(serializedCacheKey, sharedCacheEntry, resumeDataCache, logPrefix); + // End the cache read after collection and metadata propagation, not when the + // value stream becomes available. This does not wait for handler persistence. + // A failed collection or propagation must still end the read so it cannot + // stall prerendering. The catch prevents an unhandled rejection after the + // stream has been returned. + sharedCacheEntry.pendingMetadata.then((metadata)=>{ + maybePropagateCacheEntryMetadata(cacheContext, metadata); + }).finally(()=>{ + cacheSignal == null ? void 0 : cacheSignal.endRead(); + }).catch(ignoreReject); + return stream; +} +function saveToCacheHandler(cacheHandler, id, cacheHandlerKeyBase, savedCacheResult, rootParams) { + // Write the entry to the cache handler. With root params, this is a redirect + // entry at the coarse key plus the actual entry at the specific key; + // otherwise just the entry at the coarse key. Both set calls are fired + // together and awaited in parallel. + return savedCacheResult.then(async (collectedResult)=>{ + const { entry: fullEntry, readRootParamNames } = collectedResult; + // Use the combined set (union of all historically observed reads) for both + // the specific key and the redirect entry's tags. The read path computes + // cacheHandlerKey from this same union (knownRootParamsByFunctionId), so + // the write path must use the identical set to land on the same specific + // key. If we used only the current invocation's reads, a function that + // conditionally reads different root params across invocations would + // scatter entries across different specific keys, making previous entries + // unreachable from the read path's union-based lookup. + const rootParamNames = readRootParamNames ? addKnownRootParamNames(id, readRootParamNames) : knownRootParamsByFunctionId.get(id); + const setPromises = []; + let coarseEntry = fullEntry; + if (rootParamNames && rootParamNames.size > 0 && rootParams) { + const specificKey = cacheHandlerKeyBase + computeRootParamsCacheKeySuffix(rootParams, rootParamNames); + setPromises.push(// Capture synchronous `set()` throws as rejected write promises. + new Promise((resolve)=>{ + resolve(cacheHandler.set(specificKey, Promise.resolve(fullEntry))); + })); + // The coarse key gets a redirect entry instead. On a cold server (empty + // knownRootParamsByFunctionId), its tags tell a reader which root params + // to include in the specific-key lookup. + const rootParamTags = [ + ...rootParamNames + ].map((paramName)=>NEXT_CACHE_ROOT_PARAM_TAG_ID + paramName); + coarseEntry = { + value: new ReadableStream({ + start (controller) { + // Single byte so the entry has non-zero size in LRU caches. + controller.enqueue(new Uint8Array([ + 0 + ])); + controller.close(); + } + }), + tags: [ + ...fullEntry.tags, + ...rootParamTags + ], + stale: fullEntry.stale, + timestamp: fullEntry.timestamp, + expire: fullEntry.expire, + revalidate: fullEntry.revalidate + }; + } + setPromises.push(// Capture synchronous `set()` throws as rejected write promises. + new Promise((resolve)=>{ + resolve(cacheHandler.set(cacheHandlerKeyBase, Promise.resolve(coarseEntry))); + })); + // A failed write must not finish the operation while another write is + // pending. + for (const result of (await Promise.allSettled(setPromises))){ + if (result.status === 'rejected') { + throw result.reason; + } + } + }); +} +function generateCacheEntry(workStore, cacheContext, clientReferenceManifest, encodedArguments, fn, timeoutError, deadlockError) { + // We need to run this inside a clean AsyncLocalStorage snapshot so that the cache + // generation cannot read anything from the context we're currently executing which + // might include request specific things like cookies() inside a React.cache(). + // Note: It is important that we await at least once before this because it lets us + // pop out of any stack specific contexts as well - aka "Sync" Local Storage. + return workStore.runInCleanSnapshot(generateCacheEntryWithRestoredWorkStore, workStore, cacheContext, clientReferenceManifest, encodedArguments, fn, timeoutError, deadlockError); +} +function generateCacheEntryWithRestoredWorkStore(workStore, cacheContext, clientReferenceManifest, encodedArguments, fn, timeoutError, deadlockError) { + // Since we cleared the AsyncLocalStorage we need to restore the workStore. + // Note: We explicitly don't restore the RequestStore nor the PrerenderStore. + // We don't want any request specific information leaking an we don't want to create a + // bloated fake request mock for every cache call. So any feature that currently lives + // in RequestStore but should be available to Caches need to move to WorkStore. + // PrerenderStore is not needed inside the cache scope because the outer most one will + // be the one to report its result to the outer Prerender. + return workAsyncStorage.run(workStore, generateCacheEntryWithCacheContext, workStore, cacheContext, clientReferenceManifest, encodedArguments, fn, timeoutError, deadlockError); +} +function createUseCacheStore(workStore, cacheContext, defaultCacheLife) { + if (cacheContext.kind === 'private') { + const outerWorkUnitStore = cacheContext.outerWorkUnitStore; + return { + type: 'private-cache', + phase: 'render', + consumerWillServerCache: true, + implicitTags: outerWorkUnitStore == null ? void 0 : outerWorkUnitStore.implicitTags, + revalidate: defaultCacheLife.revalidate, + expire: defaultCacheLife.expire, + stale: defaultCacheLife.stale, + explicitRevalidate: undefined, + explicitExpire: undefined, + explicitStale: undefined, + tags: null, + hmrRefreshHash: getHmrRefreshHash(outerWorkUnitStore), + isHmrRefresh: isHmrRefresh(outerWorkUnitStore), + serverComponentsHmrCache: getServerComponentsHmrCache(outerWorkUnitStore), + forceRevalidate: shouldForceRevalidate(workStore, outerWorkUnitStore), + draftMode: getDraftModeProviderForCacheScope(workStore, outerWorkUnitStore), + rootParams: outerWorkUnitStore.rootParams, + readRootParamNames: new Set(), + // Every private cache scope is its own work unit. Any cache keyed on + // headers() or cookies() needs to be invalidated. Otherwise some + // Next.js API semantics leak across render passes. + headers: HeadersAdapter.fresh(outerWorkUnitStore.headers), + cookies: RequestCookiesAdapter.fresh(outerWorkUnitStore.cookies), + outerOwnerStack: cacheContext.outerOwnerStack + }; + } else { + let useCacheOrRequestStore; + const outerWorkUnitStore = cacheContext.outerWorkUnitStore; + switch(outerWorkUnitStore.type){ + case 'cache': + case 'private-cache': + case 'request': + useCacheOrRequestStore = outerWorkUnitStore; + break; + case 'prerender-runtime': + case 'prerender': + case 'prerender-legacy': + case 'unstable-cache': + case 'build-time-generator': + break; + default: + outerWorkUnitStore; + } + let fallbackRootParamsPrerender = null; + if (outerWorkUnitStore.type === 'cache') { + fallbackRootParamsPrerender = outerWorkUnitStore.fallbackRootParamsPrerender; + } else if (outerWorkUnitStore.type === 'prerender') { + const { fallbackRouteParams } = outerWorkUnitStore; + if (fallbackRouteParams !== null && Object.keys(outerWorkUnitStore.rootParams).some((name)=>fallbackRouteParams.has(name))) { + fallbackRootParamsPrerender = outerWorkUnitStore; + } + } + return { + type: 'cache', + phase: 'render', + fallbackRootParamsPrerender, + consumerWillServerCache: true, + implicitTags: outerWorkUnitStore.implicitTags, + revalidate: defaultCacheLife.revalidate, + expire: defaultCacheLife.expire, + stale: defaultCacheLife.stale, + explicitRevalidate: undefined, + explicitExpire: undefined, + explicitStale: undefined, + tags: null, + hmrRefreshHash: getHmrRefreshHash(outerWorkUnitStore), + isHmrRefresh: (useCacheOrRequestStore == null ? void 0 : useCacheOrRequestStore.isHmrRefresh) ?? false, + serverComponentsHmrCache: useCacheOrRequestStore == null ? void 0 : useCacheOrRequestStore.serverComponentsHmrCache, + forceRevalidate: shouldForceRevalidate(workStore, outerWorkUnitStore), + draftMode: getDraftModeProviderForCacheScope(workStore, outerWorkUnitStore), + rootParams: outerWorkUnitStore.rootParams, + readRootParamNames: new Set(), + outerOwnerStack: cacheContext.outerOwnerStack, + dynamicNestedCacheError: undefined + }; + } +} +/** + * Captures the owner stack from the outer component tree before entering a + * cache boundary. When nested inside another cache scope, the parent's + * outerOwnerStack is concatenated so that the full component tree is preserved + * across multiple cache boundaries. + */ function captureOuterOwnerStack(workUnitStore) { + var _getClientReact_captureOwnerStack, _getClientReact, _getServerReact_captureOwnerStack, _getServerReact; + const capturedOwnerStack = (((_getClientReact = getClientReact()) == null ? void 0 : (_getClientReact_captureOwnerStack = _getClientReact.captureOwnerStack) == null ? void 0 : _getClientReact_captureOwnerStack.call(_getClientReact)) ?? ((_getServerReact = getServerReact()) == null ? void 0 : (_getServerReact_captureOwnerStack = _getServerReact.captureOwnerStack) == null ? void 0 : _getServerReact_captureOwnerStack.call(_getServerReact))) || ''; + let parentOuterOwnerStack; + switch(workUnitStore.type){ + case 'cache': + case 'private-cache': + parentOuterOwnerStack = workUnitStore.outerOwnerStack; + break; + case 'unstable-cache': + case 'request': + case 'prerender': + case 'prerender-legacy': + case 'prerender-runtime': + case 'prerender-client': + case 'validation-client': + case 'build-time-generator': + break; + default: + workUnitStore; + } + return capturedOwnerStack + (parentOuterOwnerStack || '') || undefined; +} +// The maximum time we allow a `'use cache'` entry to fill. After this, we +// assume the fill is stalled — either on hanging input to the cached function, +// or on hanging I/O inside of it — and de-opt with an error. +// +// For prerender, the effective value is clamped to 90% of the configured +// `staticPageGenerationTimeout` so the cache-fill error surfaces before the +// build worker kills the page. In dev (`request`), the configured +// `experimental.useCacheTimeout` is used straight. +function getUseCacheFillTimeoutMs(workStore, workUnitStoreType) { + const { useCacheTimeout, staticPageGenerationTimeout } = workStore; + const effectiveTimeout = workUnitStoreType === 'request' ? useCacheTimeout : Math.min(useCacheTimeout, staticPageGenerationTimeout * 0.9); + return effectiveTimeout * 1000; +} +function generateCacheEntryWithCacheContext(workStore, cacheContext, clientReferenceManifest, encodedArguments, fn, timeoutError, deadlockError) { + const defaultCacheLife = workStore.cacheLifeProfiles.default; + // Initialize the Store for this Cache entry. + const cacheStore = createUseCacheStore(workStore, cacheContext, defaultCacheLife); + return workUnitAsyncStorage.run(cacheStore, ()=>dynamicAccessAsyncStorage.run({ + abortController: new AbortController(), + reason: null + }, generateCacheEntryImpl, workStore, cacheContext, cacheStore, clientReferenceManifest, encodedArguments, fn, timeoutError, deadlockError)); +} +function propagateCacheLifeAndTagsToRevalidateStore(revalidateStore, metadata) { + const outerTags = revalidateStore.tags ??= []; + for (const tag of metadata.tags){ + if (!outerTags.includes(tag)) { + outerTags.push(tag); + } + } + if (revalidateStore.stale > metadata.stale) { + revalidateStore.stale = metadata.stale; + } + if (revalidateStore.revalidate > metadata.revalidate) { + revalidateStore.revalidate = metadata.revalidate; + } + if (revalidateStore.expire > metadata.expire) { + revalidateStore.expire = metadata.expire; + } +} +function propagateCacheStaleTimeToRequestStore(requestStore, metadata) { + if (requestStore.stale !== undefined && requestStore.stale > metadata.stale) { + requestStore.stale = metadata.stale; + } +} +function propagateCacheEntryMetadata(cacheContext, metadata) { + if (cacheContext.kind === 'private') { + switch(cacheContext.outerWorkUnitStore.type){ + case 'private-cache': + if (metadata.readRootParamNames) { + for (const paramName of metadata.readRootParamNames){ + cacheContext.outerWorkUnitStore.readRootParamNames.add(paramName); + } + } + // fallthrough + case 'prerender-runtime': + propagateCacheLifeAndTagsToRevalidateStore(cacheContext.outerWorkUnitStore, metadata); + break; + case 'request': + propagateCacheStaleTimeToRequestStore(cacheContext.outerWorkUnitStore, metadata); + break; + case undefined: + break; + default: + cacheContext.outerWorkUnitStore; + } + } else { + switch(cacheContext.outerWorkUnitStore.type){ + case 'cache': + // If this entry's cache life is dynamic, record this invocation as the + // origin to use as `cause` when the outer cache surfaces the + // nested-dynamic cache error. `??=` keeps the first occurrence so the + // cause points at the immediate dynamic child. + if (cacheContext.dynamicNestedCacheError !== undefined && (metadata.revalidate === 0 || metadata.expire < MIN_PRERENDERABLE_EXPIRE)) { + cacheContext.outerWorkUnitStore.dynamicNestedCacheError ??= cacheContext.dynamicNestedCacheError; + } + // fallthrough + case 'private-cache': + if (metadata.readRootParamNames) { + for (const paramName of metadata.readRootParamNames){ + cacheContext.outerWorkUnitStore.readRootParamNames.add(paramName); + } + } + // fallthrough + case 'prerender': + case 'prerender-runtime': + case 'prerender-legacy': + propagateCacheLifeAndTagsToRevalidateStore(cacheContext.outerWorkUnitStore, metadata); + break; + case 'request': + propagateCacheStaleTimeToRequestStore(cacheContext.outerWorkUnitStore, metadata); + break; + case 'unstable-cache': + case 'build-time-generator': + break; + default: + cacheContext.outerWorkUnitStore; + } + } + if (metadata.readRootParamNames) { + const varyParamsAccumulator = getVaryParamsAccumulator(cacheContext.outerWorkUnitStore); + if (varyParamsAccumulator) { + for (const paramName of metadata.readRootParamNames){ + accumulateVaryParam(varyParamsAccumulator.rootParams, paramName); + } + } + } +} +/** + * Conditionally propagates cache life, tags, and root param names to the outer + * context. During prerenders (`prerender` / `prerender-runtime`) and dev + * cache-filling requests, propagation is deferred because the entry might be + * omitted from the final prerender due to short expire/stale times. If omitted, + * it should not affect the prerender. The final decision happens when the entry + * is read from the resume data cache in the final render phase — at that point + * `propagateCacheEntryMetadata` is called unconditionally (after the omission + * checks have already filtered out short-lived entries). + * + * Nested caches propagate root param names into the enclosing cache's + * `readRootParamNames` set. This propagation is never deferred. Prerender + * contexts also register known root param names when they read the resume + * data cache. A response accumulator records the consumed entry's root vary + * params to prevent segment reuse across different values. + */ function maybePropagateCacheEntryMetadata(cacheContext, metadata) { + const outerWorkUnitStore = cacheContext.outerWorkUnitStore; + switch(outerWorkUnitStore.type){ + case 'prerender': + case 'prerender-runtime': + { + break; + } + case 'request': + { + if (isValidationRender(outerWorkUnitStore) && outerWorkUnitStore.cacheSignal) { + break; + } + // fallthrough + } + case 'private-cache': + case 'cache': + case 'unstable-cache': + case 'prerender-legacy': + { + propagateCacheEntryMetadata(cacheContext, metadata); + break; + } + case 'build-time-generator': + break; + default: + { + outerWorkUnitStore; + } + } +} +async function collectResult(savedStream, workStore, cacheContext, innerCacheStore, startTime, errors) { + // We create a buffered stream that collects all chunks until the end to + // ensure that RSC has finished rendering and therefore we have collected + // all tags. In the future the RSC API might allow for the equivalent of + // the allReady Promise that exists on SSR streams. + // + // If something errored or rejected anywhere in the render, we close + // the stream as errored. This lets a CacheHandler choose to save the + // partial result up until that point for future hits for a while to avoid + // unnecessary retries or not to retry. We use the end of the stream for + // this to avoid another complicated side-channel. A receiver has to consider + // that the stream might also error for other reasons anyway such as losing + // connection. + const buffer = []; + const reader = savedStream.getReader(); + try { + for(let entry; !(entry = await reader.read()).done;){ + buffer.push(entry.value); + } + } catch (error) { + errors.push(error); + } + let idx = 0; + const bufferStream = new ReadableStream({ + pull (controller) { + if (workStore.invalidDynamicUsageError) { + controller.error(workStore.invalidDynamicUsageError); + } else if (idx < buffer.length) { + controller.enqueue(buffer[idx++]); + } else if (errors.length > 0) { + // TODO: Should we use AggregateError here? + controller.error(errors[0]); + } else { + controller.close(); + } + } + }); + const collectedTags = innerCacheStore.tags; + const isPrivateCacheInDev = Boolean(process.env.__NEXT_DEV_SERVER && cacheContext.kind === 'private'); + // In development, force a dynamic cache life (`revalidate: 0`, `expire: + // MIN_PRERENDERABLE_EXPIRE`) for private caches, which have no real backing + // handler. The zero revalidate makes every read serve stale-while-revalidate + // (regenerating a fresh entry in the background), and + // `MIN_PRERENDERABLE_EXPIRE` (5 minutes) caps how long an entry lingers in + // the dedicated in-memory private handler. It is the shortest `expire` that + // isn't treated as dynamic; a smaller `expire` would exclude the entry from + // prerenders. Two other cases deliberately do NOT force this and keep their + // resolved cache life, relying instead on the dev handler's minimum retention + // and a dev revalidation (see the cache-hit path below) to keep reloads fast + // and fresh. The size-0 case (`cacheMaxMemorySize: 0`) keeps its life so the + // entry can be considered prerenderable instead of being misread as a dynamic + // hole. An explicit short-`expire` public cache (e.g. `cacheLife({ expire: 0 + // })`) keeps its life so it stays correctly excluded from static prerenders + // via its real `expire` while a reload still hits the cache; forcing + // `revalidate: 0` here would instead corrupt the cache life propagated to an + // enclosing cache and trigger the nested-dynamic error. A cache backed by a + // custom handler keeps its real cache life too, since that handler owns it. + const forceDynamicCacheLifeInDev = isPrivateCacheInDev; + // If cacheLife() was used to set an explicit revalidate/expire/stale time we + // use that. Otherwise, we use the lowest of all inner fetch(), + // unstable_cache() or nested "use cache", if they're lower than our default. + const collectedRevalidate = forceDynamicCacheLifeInDev ? 0 : innerCacheStore.explicitRevalidate !== undefined ? innerCacheStore.explicitRevalidate : innerCacheStore.revalidate; + const collectedExpire = forceDynamicCacheLifeInDev ? MIN_PRERENDERABLE_EXPIRE : innerCacheStore.explicitExpire !== undefined ? innerCacheStore.explicitExpire : innerCacheStore.expire; + const collectedStale = innerCacheStore.explicitStale !== undefined ? innerCacheStore.explicitStale : innerCacheStore.stale; + const entry = { + value: bufferStream, + timestamp: startTime, + revalidate: collectedRevalidate, + expire: collectedExpire, + stale: collectedStale, + tags: collectedTags === null ? [] : collectedTags + }; + const collected = { + entry, + hasExplicitRevalidate: innerCacheStore.explicitRevalidate !== undefined, + hasExplicitExpire: innerCacheStore.explicitExpire !== undefined, + readRootParamNames: innerCacheStore.readRootParamNames, + // The store accumulates this from nested public caches that propagated a + // dynamic life into us. + dynamicNestedCacheError: innerCacheStore.type === 'cache' ? innerCacheStore.dynamicNestedCacheError : undefined + }; + if (!cacheContext.skipPropagation) { + maybePropagateCacheEntryMetadata(cacheContext, { + tags: collected.entry.tags, + revalidate: collected.entry.revalidate, + expire: collected.entry.expire, + stale: collected.entry.stale, + timestamp: collected.entry.timestamp, + hasExplicitRevalidate: collected.hasExplicitRevalidate, + hasExplicitExpire: collected.hasExplicitExpire, + readRootParamNames: collected.readRootParamNames, + dynamicNestedCacheError: collected.dynamicNestedCacheError + }); + const cacheSignal = getCacheSignal(cacheContext.outerWorkUnitStore); + if (cacheSignal) { + cacheSignal.endRead(); + } + } + return collected; +} +async function generateCacheEntryImpl(workStore, cacheContext, innerCacheStore, clientReferenceManifest, encodedArguments, fn, timeoutError, deadlockError) { + const temporaryReferences = createServerTemporaryReferenceSet(); + const outerWorkUnitStore = cacheContext.outerWorkUnitStore; + const [, args] = typeof encodedArguments === 'string' ? await decodeReply(encodedArguments, getServerModuleMap(), { + temporaryReferences + }) : await decodeReplyFromAsyncIterable({ + async *[Symbol.asyncIterator] () { + for (const entry of encodedArguments){ + yield entry; + } + switch(outerWorkUnitStore.type){ + case 'prerender-runtime': + case 'prerender': + // The encoded arguments might contain hanging promises. In + // this case we don't want to reject with "Error: Connection + // closed.", so we intentionally keep the iterable alive. This + // is similar to the halting trick that we do while rendering. + await new Promise((resolve)=>{ + if (outerWorkUnitStore.renderSignal.aborted) { + resolve(); + } else { + outerWorkUnitStore.renderSignal.addEventListener('abort', ()=>resolve(), { + once: true + }); + } + }); + break; + case 'prerender-legacy': + case 'request': + case 'cache': + case 'private-cache': + case 'unstable-cache': + case 'build-time-generator': + break; + default: + outerWorkUnitStore; + } + } + }, getServerModuleMap(), { + temporaryReferences + }); + // Track the timestamp when we started computing the result. + const startTime = performance.timeOrigin + performance.now(); + // Invoke the inner function to load a new result. We delay the invocation + // though, until React awaits the promise so that React's request store (ALS) + // is available when the function is invoked. This allows us, for example, to + // capture logs so that we can later replay them. + const resultPromise = createLazyResult(fn.bind(null, ...args)); + const errors = []; + // In the "Cache" environment, we only need to make sure that the error + // digests are handled correctly. Error formatting and reporting is not + // necessary here; the errors are encoded in the stream, and will be reported + // in the "Server" environment. + const handleError = createReactServerErrorHandler(process.env.NODE_ENV === 'development', workStore.isBuildTimePrerendering ?? false, workStore.reactServerErrorsByDigest, (error)=>{ + // In production, we log the original error here. It gets a digest that + // can be used to associate the error with the obfuscated error that might + // be logged if the error is caught. In development, we prefer logging the + // transported error in the server environment. It's not obfuscated and + // also includes the (dev-only) environment name. + if (process.env.NODE_ENV === 'production') { + Log.error(error); + } + errors.push(error); + }); + let stream; + let devTimeoutAbortController; + switch(outerWorkUnitStore.type){ + case 'cache': + case 'prerender-runtime': + case 'prerender': + { + const prerenderStore = outerWorkUnitStore.type === 'cache' ? outerWorkUnitStore.fallbackRootParamsPrerender : outerWorkUnitStore; + if (prerenderStore === null) { + stream = renderToReadableStream(resultPromise, clientReferenceManifest.clientModules, { + environmentName: 'Cache', + filterStackFrame, + temporaryReferences, + onError: handleError + }); + break; + } + const timeoutAbortController = new AbortController(); + const timer = setTimeout(()=>{ + workStore.invalidDynamicUsageError = timeoutError; + timeoutAbortController.abort(timeoutError); + }, getUseCacheFillTimeoutMs(workStore, prerenderStore.type)); + const dynamicAccessStore = dynamicAccessAsyncStorage.getStore(); + const dynamicAccessAbortSignal = dynamicAccessStore == null ? void 0 : dynamicAccessStore.abortController.signal; + const abortSignal = dynamicAccessAbortSignal ? AbortSignal.any([ + dynamicAccessAbortSignal, + timeoutAbortController.signal + ]) : timeoutAbortController.signal; + const { prelude } = await prerender(resultPromise, clientReferenceManifest.clientModules, { + environmentName: 'Cache', + filterStackFrame, + signal: abortSignal, + temporaryReferences, + onError (error) { + if (abortSignal.aborted && abortSignal.reason === error) { + return undefined; + } + return handleError(error); + } + }); + clearTimeout(timer); + const didTimeout = timeoutAbortController.signal.aborted; + if (dynamicAccessAbortSignal) { + // Release React's listener from the composite signal. + timeoutAbortController.abort(); + } + if (didTimeout) { + // When the timeout is reached we always error the stream. Even for + // fallback shell prerenders we don't want to return a hanging promise, + // which would allow the function to become a dynamic hole. Because that + // would mean that a non-empty shell could be generated which would be + // subject to revalidation, and we don't want to create long + // revalidation times. + stream = new ReadableStream({ + start (controller) { + controller.error(timeoutAbortController.signal.reason); + } + }); + } else if (dynamicAccessAbortSignal == null ? void 0 : dynamicAccessAbortSignal.aborted) { + var _getCacheSignal; + const reason = (dynamicAccessStore == null ? void 0 : dynamicAccessStore.reason) ?? 'runtime'; + const makeHangingPromise = reason === 'fallback-params' ? makeFallbackParamsHangingPromise : makeURLDataHangingPromise; + if (innerCacheStore.type === 'cache' && innerCacheStore.fallbackRootParamsPrerender !== null) { + var _getCacheSignal1; + // No entry is collected for an aborted fill. Still remember the + // roots actually read so a concrete request won't join this result + // under the coarse key. Propagate them through aborted parents too. + addKnownRootParamNames(cacheContext.functionId, innerCacheStore.readRootParamNames); + const hangingPromise = trackPromiseUsed(makeHangingPromise(prerenderStore.renderSignal, workStore.route, 'dynamic "use cache"', // The single wrapper below tracks access when consumed. + null), ()=>{ + if (reason === 'fallback-params') { + trackFallbackParamsAccessed(prerenderStore, 'dynamic "use cache"'); + } else { + trackURLDataAccessed(prerenderStore, 'dynamic "use cache"'); + } + // The result may also be consumed by a deduped invocation, so + // record dependencies against the cache consuming it now. + const consumer = workUnitAsyncStorage.getStore(); + if (consumer !== undefined && consumer.type === 'cache') { + for (const name of innerCacheStore.readRootParamNames){ + consumer.readRootParamNames.add(name); + } + } + // Only a cache consuming this result must suspend. Do not share + // cancellation with independent sibling cache fills. + abortOnDynamicAccess(reason, dynamicAccessAbortSignal.reason); + }); + (_getCacheSignal1 = getCacheSignal(outerWorkUnitStore)) == null ? void 0 : _getCacheSignal1.endRead(); + return { + type: 'prerender-dynamic', + reason: reason === 'fallback-params' ? FALLBACK_PARAMS : RUNTIME_DATA, + hangingPromise + }; + } + // If the prerender is aborted because of dynamic access (e.g. reading + // fallback params), we return a hanging promise. This essentially makes + // the "use cache" function dynamic. + const hangingPromise = makeHangingPromise(prerenderStore.renderSignal, workStore.route, 'dynamic "use cache"', outerWorkUnitStore); + (_getCacheSignal = getCacheSignal(outerWorkUnitStore)) == null ? void 0 : _getCacheSignal.endRead(); + return { + type: 'prerender-dynamic', + reason: reason === 'fallback-params' ? FALLBACK_PARAMS : RUNTIME_DATA, + hangingPromise + }; + } else { + stream = prelude; + } + break; + } + case 'request': + // TODO: We should just check if the render is abandonable. This is + // relevant in restart-on-cache-miss in general, so when we implement that + // for cached navs, it'll also be needed in prod + if (process.env.__NEXT_DEV_SERVER && outerWorkUnitStore.cacheSignal) { + const stagedRendering = outerWorkUnitStore.stagedRendering; + // Capture the render stage at the start of this cache read, before the + // yield below. A streamed staged render advances its controller on its + // own schedule, independently of this read, so by the time the yield + // resolves the controller may have raced ahead to the Dynamic stage even + // though the read began in an earlier (prerender) stage. + const stageAtReadStart = stagedRendering == null ? void 0 : stagedRendering.currentStage; + // If we're filling caches for a staged render, make sure that it takes + // at least a task, so we'll always notice a cache miss between stages. + // + // TODO(restart-on-cache-miss): This is suboptimal. Ideally microtasky + // caches wouldn't register as a miss, but short-lived caches are only + // omitted correctly when read back in a separate render (now the + // background validation render, not a restart of the streamed + // response), so forcing the miss is the best we can do until that's + // refactored. + await new Promise((resolve)=>setTimeout(resolve)); + // Start a cache-fill timeout so a hanging `'use cache'` entry surfaces + // the same error in dev as during prerender. Cleared when + // pendingCacheResult settles. + // + // Skip the timeout only when the read began in the Dynamic stage, which + // mirrors prerender: a cache guarded by e.g. `await connection()` is a + // legitimate dynamic hole and isn't executed there. We use the stage + // captured at read start, not the current one, because the staged render + // may have advanced past it during the yield above. + if (stageAtReadStart !== RenderStage.Dynamic) { + const devRenderAbortController = new AbortController(); + const fillTimeoutMs = getUseCacheFillTimeoutMs(workStore, outerWorkUnitStore.type); + const fillDeadlineAt = performance.now() + fillTimeoutMs; + const devRenderTimeoutTimer = setTimeout(()=>{ + workStore.invalidDynamicUsageError = timeoutError; + devRenderAbortController.abort(timeoutError); + }, fillTimeoutMs); + devTimeoutAbortController = new AbortController(); + devTimeoutAbortController.signal.addEventListener('abort', ()=>{ + clearTimeout(devRenderTimeoutTimer); + }, { + once: true + }); + stream = renderToReadableStream(resultPromise, clientReferenceManifest.clientModules, { + environmentName: 'Cache', + filterStackFrame, + signal: devRenderAbortController.signal, + temporaryReferences, + onError (error) { + if (devRenderAbortController.signal.aborted && devRenderAbortController.signal.reason === error && error instanceof Error) { + // The abort reason is the same error stored as + // `workStore.invalidDynamicUsageError` (a fill timeout or + // deadlock). Register it under a digest and return that + // digest, so the error that surfaces on the consumer side of + // this Flight boundary carries it and the outer render's + // handler can recover *this* object via + // `reactServerErrorsByDigest`. + // + // We deliberately do not set `error.digest` here: whether the + // error actually surfaces (vs. being caught in userland) is + // the consumer's decision, so the "surfaced" mark is left to + // the outer handler. + const digest = stringHash(error.message + (error.stack || '')).toString(); + workStore.reactServerErrorsByDigest.set(digest, error); + return digest; + } + return handleError(error); + } + }); + // `require` (rather than a top-level import) so the bundler can + // tree-shake the probe scheduler out of the production runtime, where + // this whole dev-server-gated branch is dead code. + const { setupProbeScheduler } = require('./use-cache-probe-scheduler'); + stream = setupProbeScheduler({ + workStore, + outerRequestStore: outerWorkUnitStore, + cacheContext, + encodedArguments, + fillDeadlineAt, + stream, + abortSignal: AbortSignal.any([ + devRenderAbortController.signal, + devTimeoutAbortController.signal + ]), + onProbeCompleted () { + const error = deadlockError ?? new InvariantError('`deadlockError` should be constructed inside `cache()` before reaching the probe scheduler.'); + workStore.invalidDynamicUsageError = error; + devRenderAbortController.abort(error); + } + }); + break; + } + } + // fallthrough + case 'prerender-legacy': + case 'private-cache': + case 'unstable-cache': + case 'build-time-generator': + stream = renderToReadableStream(resultPromise, clientReferenceManifest.clientModules, { + environmentName: 'Cache', + filterStackFrame, + temporaryReferences, + onError: handleError + }); + break; + default: + return outerWorkUnitStore; + } + const [returnStream, savedStream] = stream.tee(); + const pendingCacheResult = collectResult(savedStream, workStore, cacheContext, innerCacheStore, startTime, errors).finally(()=>{ + devTimeoutAbortController == null ? void 0 : devTimeoutAbortController.abort(); + }); + if (process.env.NODE_ENV === 'development') { + // Name the stream for React DevTools. + // @ts-expect-error + returnStream.name = 'use cache'; + } + return { + type: 'cached', + // Return the stream as we're creating it. This means that if it ends up + // erroring we cannot return a stale-if-error version but it allows + // streaming back the result earlier. + stream: returnStream, + pendingCacheResult + }; +} +function cloneCacheResult(result) { + const [entryA, entryB] = cloneCacheEntry(result.entry); + return [ + { + entry: entryA, + hasExplicitRevalidate: result.hasExplicitRevalidate, + hasExplicitExpire: result.hasExplicitExpire, + readRootParamNames: result.readRootParamNames, + dynamicNestedCacheError: result.dynamicNestedCacheError + }, + { + entry: entryB, + hasExplicitRevalidate: result.hasExplicitRevalidate, + hasExplicitExpire: result.hasExplicitExpire, + readRootParamNames: result.readRootParamNames, + dynamicNestedCacheError: result.dynamicNestedCacheError + } + ]; +} +async function clonePendingCacheResult(pendingCacheResult) { + const result = await pendingCacheResult; + return cloneCacheResult(result); +} +async function getNthCacheResult(split, i) { + return (await split)[i]; +} +async function encodeFormData(formData) { + let result = ''; + for (let [key, value] of formData){ + // We don't need this key to be serializable but from a security perspective it should not be + // possible to generate a string that looks the same from a different structure. To ensure this + // we need a delimeter between fields but just using a delimeter is not enough since a string + // might contain that delimeter. We use the length of each field as the delimeter to avoid + // escaping the values. + result += key.length.toString(16) + ':' + key; + let stringValue; + if (typeof value === 'string') { + stringValue = value; + } else { + // The FormData might contain binary data that is not valid UTF-8 so this cache + // key may generate a UCS-2 string. Passing this to another service needs to be + // aware that the key might not be compatible. + const arrayBuffer = await value.arrayBuffer(); + if (arrayBuffer.byteLength % 2 === 0) { + stringValue = String.fromCodePoint(...new Uint16Array(arrayBuffer)); + } else { + stringValue = String.fromCodePoint(...new Uint16Array(arrayBuffer, 0, (arrayBuffer.byteLength - 1) / 2)) + String.fromCodePoint(new Uint8Array(arrayBuffer, arrayBuffer.byteLength - 1, 1)[0]); + } + } + result += stringValue.length.toString(16) + ':' + stringValue; + } + return result; +} +function createTrackedReadableStream(stream, cacheSignal) { + const reader = stream.getReader(); + return new ReadableStream({ + async pull (controller) { + const { done, value } = await reader.read(); + if (done) { + controller.close(); + cacheSignal.endRead(); + } else { + controller.enqueue(value); + } + } + }); +} +export async function cache(kind, id, boundArgsLength, originalFn, args) { + var _workUnitStore_implicitTags; + const isPrivate = kind === 'private'; + // The default handler kind corresponds to the bare 'use cache' directive. + const logPrefix = kind === 'default' ? `'use cache'` : `'use cache: ${kind}'`; + const workStore = workAsyncStorage.getStore(); + if (workStore === undefined) { + throw new Error('"use cache" cannot be used outside of App Router. Expected a WorkStore.'); + } + const workUnitStore = workUnitAsyncStorage.getStore(); + if (workUnitStore === undefined) { + throw new InvariantError('"use cache" cannot be used outside of App Router. Expected a WorkUnitStore.'); + } + // In a prerender, tasky IO may result in cache reads that start + // after the prerender has already been aborted: + // + // await setTimeout(100) // we can't abort this uncached IO... + // await cachedData() // ...so we'll still get here even though the prerender aborted + // + // The prerender is over, so we should just return an erroring promise. + // (NOTE: we also shouldn't fill this cache, because it's behind uncached IO, + // so semantically it is not part of the prerender) + switch(workUnitStore.type){ + case 'prerender': + case 'prerender-runtime': + { + if (workUnitStore.renderSignal.aborted) { + // We don't know if the cache itself is dynamic or runtime data, + // but the prerender is over, so it doesn't need to participate + // in runtime data tracking at all. + return makeUntrackedHangingPromise(workUnitStore.renderSignal, workStore.route, '"use cache" called after prerender ended'); + } + break; + } + case 'prerender-legacy': + case 'prerender-client': + case 'validation-client': + case 'request': + case 'cache': + case 'private-cache': + case 'unstable-cache': + case 'build-time-generator': + break; + default: + workUnitStore; + } + // Probe re-executions (the dev-server's hang-detection worker) short-circuit + // further down before any handler is consulted, so we skip handler selection + // entirely and the worker can boot without registering handlers at all. + let cacheHandler; + if (workStore.useCacheProbeMode === undefined) { + if (isPrivate) { + // Private caches normally go to the Resume Data Cache (RDC), not a cache + // handler. In development we additionally persist them in a dedicated + // built-in in-memory handler so that reloads are fast. + if (process.env.__NEXT_DEV_SERVER) { + cacheHandler = getPrivateCacheHandler(); + } + } else { + const handler = getCacheHandler(kind); + if (!handler) { + throw new Error('Unknown cache handler: ' + kind); + } + // In development, a user-configured (custom) handler may be slow or + // remote, so we read through a tiered handler that puts a built-in + // in-memory front in front of it to keep cache hits microtask-fast. + // Built-in handlers (the default handler, and its size-0 replacement) are + // already in-memory and used directly. + if (process.env.__NEXT_DEV_SERVER && isCustomCacheHandler(kind)) { + // A custom kind always has a dev tiered handler: it is created in the + // same `setCacheHandler` call that makes `isCustomCacheHandler` true. + const tieredCacheHandler = getDevTieredCacheHandler(kind); + if (!tieredCacheHandler) { + throw new InvariantError(`Expected a dev tiered cache handler for kind "${kind}".`); + } + cacheHandler = tieredCacheHandler; + } else { + cacheHandler = handler; + } + } + } + const timeoutError = new UseCacheTimeoutError(workStore.route); + Error.captureStackTrace(timeoutError, cache); + applyOwnerStack(timeoutError); + // Only ever thrown by the dev-server's hang-detection probe. + // `Error.captureStackTrace` has to run while `cache()` is still on the + // synchronous stack, otherwise the user's `'use cache'` invocation frames + // would already be gone — that's why the construction sits up here rather + // than next to the trigger that actually consumes it. The `__NEXT_DEV_SERVER` + // gate lets the error class drop out of the production runtime bundle. + let deadlockError; + if (process.env.__NEXT_DEV_SERVER) { + deadlockError = new UseCacheDeadlockError(workStore.route); + Error.captureStackTrace(deadlockError, cache); + applyOwnerStack(deadlockError); + } + const wrapAsInvalidDynamicUsageError = (error)=>{ + Error.captureStackTrace(error, cache); + workStore.invalidDynamicUsageError ??= error; + return error; + }; + const outerOwnerStack = process.env.NODE_ENV !== 'production' ? captureOuterOwnerStack(workUnitStore) : undefined; + const name = originalFn.name; + let fn = originalFn; + let cacheContext; + if (isPrivate) { + const expression = '"use cache: private"'; + switch(workUnitStore.type){ + // "use cache: private" is dynamic in prerendering contexts. + case 'prerender': + // Private caches can read request data. At this point we don't know + // Whether it's going to use session data or URL data. + // TODO(app-shells): This could be narrowed (and thus optimized) if we checked whether URL data + // is included in the cache key, because it can only be passed in as arguments. + return makeUnknownRuntimeDataHangingPromise(workUnitStore.renderSignal, workStore.route, expression, workUnitStore); + case 'prerender-legacy': + return throwToInterruptStaticGeneration(expression, workStore, workUnitStore); + case 'prerender-client': + case 'validation-client': + throw new InvariantError(`${expression} must not be used within a client component. Next.js should be preventing ${expression} from being allowed in client components statically, but did not in this case.`); + case 'unstable-cache': + { + throw wrapAsInvalidDynamicUsageError(createUseCachePrivateInsideUnstableCacheError(workStore.route)); + } + case 'cache': + { + throw wrapAsInvalidDynamicUsageError(createUseCachePrivateInsidePublicUseCacheError(workStore.route)); + } + case 'request': + case 'prerender-runtime': + case 'private-cache': + cacheContext = { + kind: 'private', + outerWorkUnitStore: workUnitStore, + skipPropagation: false, + outerOwnerStack, + functionId: id, + handlerKind: kind + }; + break; + case 'build-time-generator': + throw wrapAsInvalidDynamicUsageError(createUseCachePrivateOutsideRequestContextError(workStore.route, workUnitStore.functionName)); + default: + workUnitStore; + // This is dead code, but without throwing an error here, TypeScript + // will assume that cacheContext is used before being assigned. + throw new InvariantError(`Unexpected work unit store.`); + } + } else { + switch(workUnitStore.type){ + case 'prerender-client': + case 'validation-client': + const expression = '"use cache"'; + throw new InvariantError(`${expression} must not be used within a client component. Next.js should be preventing ${expression} from being allowed in client components statically, but did not in this case.`); + case 'cache': + { + // Eagerly capture this invocation's call site while still synchronous + // in `cache()`. Used as `cause` of the nested-dynamic cache error + // when the outer cache (whose body never re-runs during the final + // prerender) throws. Only constructed when the parent is itself a + // public `'use cache'` — otherwise this entry can never propagate + // dynamism into that error and the allocation would be wasted. Private + // parents are intentionally excluded: `'use cache: private'` is + // dynamic-by-definition in prerendering and deferred to the runtime + // stage in dev requests, so a public cache nested inside one never + // triggers the throw upstream. + const dynamicNestedCacheError = new NestedDynamicUseCacheError(); + Error.captureStackTrace(dynamicNestedCacheError, cache); + applyOwnerStack(dynamicNestedCacheError); + cacheContext = { + kind: 'public', + outerWorkUnitStore: workUnitStore, + skipPropagation: false, + outerOwnerStack, + functionId: id, + handlerKind: kind, + dynamicNestedCacheError + }; + break; + } + case 'prerender': + case 'prerender-runtime': + case 'prerender-legacy': + case 'request': + case 'private-cache': + // TODO: We should probably forbid nesting "use cache" inside + // unstable_cache. (fallthrough) + case 'unstable-cache': + case 'build-time-generator': + cacheContext = { + kind: 'public', + outerWorkUnitStore: workUnitStore, + skipPropagation: false, + outerOwnerStack, + functionId: id, + handlerKind: kind, + dynamicNestedCacheError: undefined + }; + break; + default: + workUnitStore; + // This is dead code, but without throwing an error here, TypeScript + // will assume that cacheContext is used before being assigned. + throw new InvariantError(`Unexpected work unit store.`); + } + } + // Get the clientReferenceManifest while we're still in the outer Context. + // In case getClientReferenceManifestSingleton is implemented using AsyncLocalStorage. + const clientReferenceManifest = getClientReferenceManifest(); + const hangingInputAbortSignal = createHangingInputAbortSignal(workUnitStore); + if (cacheContext.kind === 'private') { + const { outerWorkUnitStore } = cacheContext; + switch(outerWorkUnitStore.type){ + case 'prerender-runtime': + { + // In a runtime prerender, we have to make sure that APIs that would hang during a static prerender + // are resolved with a delay, in the appropriate runtime stage. + const stagedRendering = outerWorkUnitStore.stagedRendering; + if (stagedRendering) { + await stagedRendering.waitForStage(RENDER_STAGES_BY_DATA_KIND.sessionData); + } + break; + } + case 'request': + { + if (isValidationRender(outerWorkUnitStore)) { + // Similar to runtime prerenders, private caches should not resolve in the static stage + // of a validation request, so we delay them. + await makeDevtoolsIOAwarePromise(undefined, outerWorkUnitStore, RENDER_STAGES_BY_DATA_KIND.sessionData); + } + break; + } + case 'private-cache': + break; + default: + { + outerWorkUnitStore; + } + } + } + let isPageOrLayoutSegmentFunction = false; + // For page and layout segment functions (i.e. the page/layout component, + // or generateMetadata/generateViewport), the cache function is + // overwritten, which allows us to apply special handling for params and + // searchParams. For pages and layouts we're using the outer params prop, + // and not the inner one that was serialized/deserialized. While it's not + // generally true for "use cache" args, in the case of `params` the inner + // and outer object are essentially equivalent, so this is safe to do + // (including fallback params that are hanging promises). It allows us to + // avoid waiting for the timeout, when prerendering a fallback shell of a + // cached page or layout that awaits params. + if (isPageSegmentFunction(args)) { + isPageOrLayoutSegmentFunction = true; + const [{ params: outerParams, searchParams: outerSearchParams }, ...otherOuterArgs] = args; + const props = { + params: outerParams + }; + if (isPrivate) { + // Private caches allow accessing search params. We need to include + // them in the serialized args and when generating the cache key. + props.searchParams = outerSearchParams; + } + args = [ + props, + ...otherOuterArgs + ]; + fn = ({ + [name]: async (_, ...otherInnerArgs)=>originalFn.apply(null, [ + { + params: props.params, + searchParams: // Preserve the original search params, if this cache can access them. + // Notably, in a runtime shell private caches can resolve, but search params + // will be hanging, and we need to preserve the original proxied promise object + // to trigger `dynamicAccessAbortSignal` when they're accessed. + props.searchParams ?? // For public caches, search params are omitted from the cache + // key (and the serialized args) to avoid mismatches between + // prerendering and resuming a cached page that does not + // access search params. This is also the reason why we're not + // using a hanging promise for search params. For cached pages + // that do access them, which is an invalid dynamic usage, we + // need to ensure that an error is shown. + makeErroringSearchParamsForUseCache() + }, + ...otherInnerArgs + ]) + })[name]; + } else if (isLayoutSegmentFunction(args)) { + isPageOrLayoutSegmentFunction = true; + const [{ params: outerParams, $$isLayout, ...outerSlots }, ...otherOuterArgs] = args; + // Overwrite the props to omit $$isLayout. Note that slots are only + // passed to the layout component (if any are defined), and not to + // generateMetadata nor generateViewport. For those functions, + // outerSlots/innerSlots is an empty object, which is fine because we're + // just spreading it into the props. + args = [ + { + params: outerParams, + ...outerSlots + }, + ...otherOuterArgs + ]; + fn = ({ + [name]: async ({ params: _innerParams, ...innerSlots }, ...otherInnerArgs)=>originalFn.apply(null, [ + { + params: outerParams, + ...innerSlots + }, + ...otherInnerArgs + ]) + })[name]; + } + if (boundArgsLength > 0) { + if (args.length === 0) { + throw new InvariantError(`Expected the "use cache" function ${JSON.stringify(fn.name)} to receive its encrypted bound arguments as the first argument.`); + } + const encryptedBoundArgs = args.shift(); + const boundArgs = await decryptActionBoundArgs(id, encryptedBoundArgs); + if (!Array.isArray(boundArgs)) { + throw new InvariantError(`Expected the bound arguments of "use cache" function ${JSON.stringify(fn.name)} to deserialize into an array, got ${typeof boundArgs} instead.`); + } + if (boundArgsLength !== boundArgs.length) { + throw new InvariantError(`Expected the "use cache" function ${JSON.stringify(fn.name)} to receive ${boundArgsLength} bound arguments, got ${boundArgs.length} instead.`); + } + args.unshift(boundArgs); + } + const temporaryReferences = createClientTemporaryReferenceSet(); + // The base serialized cache key doesn't include runtime env var state or the + // cookies and headers that private caches are allowed to read. Env var state + // only scopes the cache handler because the RDC must reuse entries across + // rendering phases. In production private cache entries aren't stored in a + // cache handler, only in the Resume Data Cache (RDC): private caches are only + // used during dynamic requests and runtime prefetches; for dynamic requests + // the RDC is immutable and excludes private caches, and for runtime prefetches + // it's mutable but lives only as long as the request. In development private + // caches are persisted across requests, so `cacheHandlerKeyBase` (below) + // additionally scopes the handler key by the request's cookies and headers. + const { implementationPart, runtimeEnvVarStateHash } = await computeCacheKeyImplementationPart(workStore, workUnitStore, id); + const cacheKeyParts = [ + id, + args, + implementationPart + ]; + const encodeCacheKeyParts = ()=>encodeReply(cacheKeyParts, { + temporaryReferences, + signal: hangingInputAbortSignal + }); + let encodedCacheKeyParts; + switch(workUnitStore.type){ + case 'prerender-runtime': + // A runtime prerender may be a runtime shell, which does not have access to + // params/searchParams, so we want to apply the same dynamic access logic + // as we do in static prerenders. + // fallthrough + case 'prerender': + if (!isPageOrLayoutSegmentFunction) { + // If the "use cache" function is not a page or layout segment + // function, we need to track dynamic access already when encoding + // the arguments. If params are passed explicitly into a "use cache" + // function (as opposed to receiving them automatically in a page or + // layout), we assume that the params are also accessed. This allows + // us to abort early, and treat the function as dynamic, instead of + // waiting for the timeout to be reached. + const dynamicAccessStore = { + abortController: new AbortController(), + reason: null + }; + encodedCacheKeyParts = await dynamicAccessAsyncStorage.run(dynamicAccessStore, encodeCacheKeyParts); + if (dynamicAccessStore.abortController.signal.aborted) { + const makeHangingPromise = dynamicAccessStore.reason === 'fallback-params' ? makeFallbackParamsHangingPromise : makeURLDataHangingPromise; + return makeHangingPromise(workUnitStore.renderSignal, workStore.route, 'dynamic "use cache"', workUnitStore); + } + break; + } + // fallthrough + case 'prerender-legacy': + case 'request': + // TODO(restart-on-cache-miss): We need to handle params/searchParams on page components. + // the promises will be tasky, so `encodeCacheKeyParts` will not resolve in the static stage. + // We have not started a cache read at this point, so we might just miss the cache completely. + // fallthrough + case 'cache': + case 'private-cache': + case 'unstable-cache': + case 'build-time-generator': + case undefined: + encodedCacheKeyParts = await encodeCacheKeyParts(); + break; + default: + return workUnitStore; + } + // Probe path: we're running inside a pooled worker spawned by the dev + // server to check whether a stalled cache fill would complete in an + // isolated module scope. Skip the RDC / cache-handler / leader-election + // machinery, call `generateCacheEntry` (same as a real cold fill), drain + // the returned stream via `pendingCacheResult`, and apply the probe's own + // timeout. The caller only cares whether the fill resolves; the result + // value is discarded. + // + // Gated on `__NEXT_DEV_SERVER` so the entire branch — including its + // `generateCacheEntry` call site and the threading of + // `deadlockError` — drops out of the production runtime + // bundle. + if (process.env.__NEXT_DEV_SERVER && workStore.useCacheProbeMode) { + // Both public and private caches probe via the same path. The worker + // reconstructs real `headers` / `cookies` / `draftMode` from the + // forwarded request snapshot, so private caches that legitimately read + // those work in the probe just like in the real fill. + const probeTimeoutMs = workStore.useCacheProbeMode.timeoutMs; + // The deadlock error never gets thrown from inside the worker: the + // worker's outer store has `cacheSignal: undefined`, so + // `generateCacheEntryImpl` skips the dev-request branch and the idle + // probe is never set up. + const result = await generateCacheEntry(workStore, cacheContext, clientReferenceManifest, encodedCacheKeyParts, fn, timeoutError, undefined); + if (result.type === 'prerender-dynamic') { + // Unreachable in the probe: outer store is `'request'`-typed, which + // never produces this variant. + throw new InvariantError('Unexpected `prerender-dynamic` result in `use cache` probe mode.'); + } + // We don't consume the returned stream — `pendingCacheResult` is what + // completes when `collectResult` has drained `savedStream`. Cancel the + // unused copy so it doesn't buffer forever. + result.stream.cancel().catch(()=>{}); + let probeTimeoutTimer; + try { + await Promise.race([ + result.pendingCacheResult, + new Promise((_, reject)=>{ + probeTimeoutTimer = setTimeout(()=>reject(timeoutError), probeTimeoutMs); + }) + ]); + } finally{ + if (probeTimeoutTimer !== undefined) { + clearTimeout(probeTimeoutTimer); + } + } + return; + } + const serializedCacheKey = typeof encodedCacheKeyParts === 'string' ? // Convert it to an ArrayBuffer if it wants to. + encodedCacheKeyParts : await encodeFormData(encodedCacheKeyParts); + const rootParams = workUnitStore.rootParams; + const knownRootParamNames = knownRootParamsByFunctionId.get(id); + // The coarse cache-handler key. With no root params read, it locates the + // entry directly; otherwise it locates a redirect entry from which the + // specific key (this key + root params, computed below) is derived. It's + // scoped by runtime env var state and, for private caches in development + // (persisted in the built-in in-memory handler), the request's cookies and + // headers. Keys derived from it inherit that scoping. + const cacheHandlerKeyBase = serializedCacheKey + (runtimeEnvVarStateHash ?? '') + (process.env.__NEXT_DEV_SERVER && cacheContext.kind === 'private' ? computePrivateCacheKeyRequestSuffix(cacheContext.outerWorkUnitStore.cookies, cacheContext.outerWorkUnitStore.headers) : ''); + // If we already know which root params this function reads, include them in + // the cache handler key for a direct hit (skipping the redirect entry). + // rootParams is undefined when nested inside unstable_cache. + let cacheHandlerKey = knownRootParamNames && rootParams ? cacheHandlerKeyBase + computeRootParamsCacheKeySuffix(rootParams, knownRootParamNames) : cacheHandlerKeyBase; + let stream = undefined; + // Set when a short-lived cache hit ends its cache read up front (dev only) so + // the static-shell boundary doesn't count it as a phantom miss. Once set, the + // cache signal read is balanced, so serving must use a plain stream and skip + // any trailing cacheSignal.endRead() call. + let cacheSignalReadEnded = false; + const resumeDataCache = getResumeDataCache(workUnitStore); + const implicitTags = ((_workUnitStore_implicitTags = workUnitStore.implicitTags) == null ? void 0 : _workUnitStore_implicitTags.tags) ?? []; + if (resumeDataCache) { + // If this cache key was already determined to be dynamic during the + // prospective prerender (e.g. because it accessed fallback params), we + // return a hanging promise early to avoid trying to regenerate the entry, + // which would be aborted anyway. + let rdcEntry = resumeDataCache.cache.get(serializedCacheKey); + if (rdcEntry === FALLBACK_PARAMS || rdcEntry === RUNTIME_DATA || rdcEntry === SESSION_DATA) { + switch(workUnitStore.type){ + case 'prerender': + case 'prerender-runtime': + { + let makeHangingPromise; + if (rdcEntry === FALLBACK_PARAMS) { + makeHangingPromise = makeFallbackParamsHangingPromise; + } else if (rdcEntry === SESSION_DATA) { + makeHangingPromise = makeSessionDataHangingPromise; + } else { + makeHangingPromise = makeURLDataHangingPromise; + } + return makeHangingPromise(workUnitStore.renderSignal, workStore.route, 'dynamic "use cache"', workUnitStore); + } + case 'prerender-legacy': + case 'request': + case 'cache': + case 'private-cache': + case 'unstable-cache': + case 'build-time-generator': + break; + default: + workUnitStore; + } + // Requests may receive the in-memory cache too. Unlike a prerender, they + // can resolve these holes, so treat a marker as an ordinary cache miss. + rdcEntry = undefined; + } + const cacheSignal = getCacheSignal(workUnitStore); + if (cacheSignal) { + cacheSignal.beginRead(); + } + if (rdcEntry !== undefined) { + let rdcResult = await rdcEntry; + // Check if the RDC entry should be discarded due to recently revalidated + // tags. When a server action calls updateTag(), the re-render should see + // fresh data instead of stale RDC data. + if (rdcResult !== undefined) { + const { timestamp } = rdcResult.entry; + if (rdcResult.entry.tags.some((tag)=>isRevalidatedAfter(tag, timestamp, workStore, logPrefix)) || implicitTags.some((tag)=>isRevalidatedAfter(tag, timestamp, workStore, logPrefix))) { + debug == null ? void 0 : debug(logPrefix, 'discarding RDC entry due to recently revalidated tags', serializedCacheKey); + rdcResult = undefined; + } + } + if (rdcResult !== undefined) { + if (rdcResult.entry.revalidate === 0 || rdcResult.entry.expire < MIN_PRERENDERABLE_EXPIRE) { + // The nested-cache error only makes sense when a dynamic nested cache + // actually shortened an outer cache that has no explicit `cacheLife` + // (`dynamicNestedCacheError` is set), and only when the app's default + // profile is itself prerenderable. If the default profile is already + // dynamic (`revalidate: 0` or an `expire` under the prerenderable + // minimum), every cache is omitted from prerenders by default, so + // there is no silent degradation to warn about. A short life from the + // default profile, or from a dev private cache's self-imposed + // `revalidate: 0` (which never carries a nested error), therefore + // stays a dynamic hole rather than erroring. + const defaultCacheLife = workStore.cacheLifeProfiles.default; + const shouldReportNestedCacheError = rdcResult.dynamicNestedCacheError !== undefined && defaultCacheLife.revalidate !== 0 && defaultCacheLife.expire >= MIN_PRERENDERABLE_EXPIRE; + switch(workUnitStore.type){ + case 'prerender': + // In a Dynamic I/O prerender, if the cache entry has + // revalidate: 0 or if the expire time is under 5 minutes, + // then we consider this cache entry dynamic as it's not worth + // generating static pages for such data. It's better to leave + // a dynamic hole that can be filled in during the resume with + // a potentially cached entry. + if (rdcResult.entry.revalidate === 0) { + if (rdcResult.hasExplicitRevalidate === false && shouldReportNestedCacheError) { + throw wrapAsInvalidDynamicUsageError(createNestedCacheZeroRevalidateError(workStore.route, rdcResult.dynamicNestedCacheError)); + } + debug == null ? void 0 : debug(logPrefix, 'omitting entry', serializedCacheKey, 'from static shell due to revalidate: 0'); + } else { + if (rdcResult.hasExplicitExpire === false && shouldReportNestedCacheError) { + throw wrapAsInvalidDynamicUsageError(createNestedCacheShortExpireError(workStore.route, rdcResult.dynamicNestedCacheError)); + } + debug == null ? void 0 : debug(logPrefix, 'omitting entry', serializedCacheKey, 'from static shell due to short expire value:', rdcResult.entry.expire); + } + if (cacheSignal) { + cacheSignal.endRead(); + } + // The entry is only excluded from *static* prerenders — the + // 'prerender-runtime' case below serves it. + // TODO(app-shells): Does this handle the MIN_SHELL_STALE case below correctly? + return makeSessionDataHangingPromise(workUnitStore.renderSignal, workStore.route, 'dynamic "use cache"', workUnitStore); + case 'prerender-runtime': + { + // In the final phase of a runtime prerender, we have to make + // sure that APIs that would hang during a static prerender + // are resolved with a delay, in the appropriate runtime stage. + const stagedRendering = workUnitStore.stagedRendering; + if (stagedRendering) { + await stagedRendering.waitForStage(RENDER_STAGES_BY_DATA_KIND.sessionData); + } + break; + } + case 'request': + { + if (isValidationRender(workUnitStore)) { + // These throws force an explicit cache life decision on an + // outer cache that a nested cache would otherwise silently + // shorten (see `shouldReportNestedCacheError` above). Otherwise + // the short-lived entry is deferred as a dynamic hole below. + if (rdcResult.entry.revalidate === 0 && rdcResult.hasExplicitRevalidate === false && shouldReportNestedCacheError) { + throw wrapAsInvalidDynamicUsageError(createNestedCacheZeroRevalidateError(workStore.route, rdcResult.dynamicNestedCacheError)); + } + if (rdcResult.entry.expire < MIN_PRERENDERABLE_EXPIRE && rdcResult.hasExplicitExpire === false && shouldReportNestedCacheError) { + throw wrapAsInvalidDynamicUsageError(createNestedCacheShortExpireError(workStore.route, rdcResult.dynamicNestedCacheError)); + } + // A short-lived entry is a dynamic hole, excluded from the + // static shell, so we end the cache signal read here (the + // prerender case does the same) to avoid this cache hit being + // considered a cache miss when checking for pending cache reads + // at staged rendering task boundaries. The value is deferred to + // the runtime stage. + if (cacheSignal && !cacheSignalReadEnded) { + cacheSignal.endRead(); + cacheSignalReadEnded = true; + } + await makeDevtoolsIOAwarePromise(undefined, workUnitStore, RENDER_STAGES_BY_DATA_KIND.sessionData); + } + break; + } + case 'prerender-legacy': + case 'cache': + case 'private-cache': + case 'unstable-cache': + case 'build-time-generator': + break; + default: + workUnitStore; + } + } + if (rdcResult.entry.stale < MIN_SHELL_STALE) { + // The entry's stale time is short enough that it's excluded from + // shells. If it's below `MIN_PREFETCHABLE_STALE`, it's not worth + // prefetching at all and is excluded from prerenders entirely, + // leaving a dynamic hole that can be filled during the navigation. + // Otherwise, it's still included in prerenders and cached + // navigations, but it must not be part of an App Shell, which may + // be reused on the client for longer than the entry's stale time. + // We delay the entry to resolve in the post-shell (link data) + // stage, which excludes both its content and its stale time from + // the shell. + const isPrefetchable = rdcResult.entry.stale >= MIN_PREFETCHABLE_STALE; + switch(workUnitStore.type){ + case 'prerender': + case 'prerender-runtime': + { + const prerenderStore = workUnitStore; + if (!isPrefetchable) { + debug == null ? void 0 : debug(logPrefix, 'omitting entry', serializedCacheKey, 'from shell due to short stale value:', rdcResult.entry.stale); + if (cacheSignal) { + cacheSignal.endRead(); + } + // An unprefetchable entry (stale < MIN_PREFETCHABLE_STALE) is + // excluded from all prerenders. + return makeDynamicHangingPromise(prerenderStore.renderSignal, workStore.route, 'dynamic "use cache"'); + } else { + // This entry is prefetchable, but exluded from shells. + const stagedRendering = prerenderStore.stagedRendering; + if (stagedRendering === null) { + // Prospective prerender (no staging): do not delay, because if we didn't + // have this entry in the RDC already, we wouldn't delay it either. + } else { + // Final prerender (with staging). + // This entry cannot be part of the shell, so we delay it to the prefetch. + let prefetchStage; + if (prerenderStore.type === 'prerender') { + prefetchStage = RENDER_STAGES_BY_DATA_KIND.staticUrlData.static; + } else { + prefetchStage = RENDER_STAGES_BY_DATA_KIND.runtimeUrlData; + } + if (// If the prerender ends before the prefetch stage (because + // render that only produces an App Shell), this cache + // should be omitted entirely. + stagedRendering.finalStage !== null && stagedRendering.finalStage < prefetchStage) { + debug == null ? void 0 : debug(logPrefix, 'omitting entry', serializedCacheKey, 'from shell due to short stale value:', rdcResult.entry.stale); + if (cacheSignal) { + cacheSignal.endRead(); + } + // The entry was omitted only because this prerender ends + // before the prefetch stage. Neither static nor runtime + // app shells include it, so it does not count as a runtime + // data access. + return makePrefetchHangingPromise(prerenderStore.renderSignal, workStore.route, 'dynamic "use cache"'); + } else { + debug == null ? void 0 : debug(logPrefix, 'delaying entry', serializedCacheKey, 'until the prefetch stage due to short stale value:', rdcResult.entry.stale); + await stagedRendering.waitForStage(prefetchStage); + } + } + } + break; + } + case 'request': + { + if (isValidationRender(workUnitStore)) { + // End the cache signal read (once, in case an earlier block + // already did) so the delayed value isn't counted as a pending + // read at a staged rendering boundary. + if (cacheSignal && !cacheSignalReadEnded) { + cacheSignal.endRead(); + cacheSignalReadEnded = true; + } + let stage; + if (!isPrefetchable) { + // An unprefetchable entry is excluded from prerenders, so it + // resolves in the dynamic stage. + stage = RenderStage.Dynamic; + } else { + // If the entry would be be excluded from the shell, treat it as + // if it were static URL data. + // (Note that this is still correct without PPF or in static shell validation, + // where we don't use runtime shells and include static URL data) + trackIncompatibleShellContent(workUnitStore, '"use cache" excluded from app shells due to a short staletime'); + stage = RENDER_STAGES_BY_DATA_KIND.staticUrlData[workUnitStore.needsRuntimeShell ? 'runtime' : 'static']; + } + debug == null ? void 0 : debug(logPrefix, 'delaying entry', serializedCacheKey, `until after the ${RenderStage[stage]} stage due to short stale value:`, rdcResult.entry.stale); + await makeDevtoolsIOAwarePromise(undefined, workUnitStore, stage); + } + break; + } + case 'prerender-legacy': + case 'cache': + case 'private-cache': + case 'unstable-cache': + case 'build-time-generator': + break; + default: + workUnitStore; + } + } + } + if (rdcResult !== undefined) { + debug == null ? void 0 : debug(logPrefix, 'Resume Data Cache entry found', serializedCacheKey); + if (rdcResult.readRootParamNames && rdcResult.readRootParamNames.size > 0) { + addKnownRootParamNames(id, rdcResult.readRootParamNames); + } + // We want to make sure we only propagate cache life & tags if the + // entry was *not* omitted from the prerender. So we only do this + // after the above early returns. + propagateCacheEntryMetadata(cacheContext, { + tags: rdcResult.entry.tags, + revalidate: rdcResult.entry.revalidate, + expire: rdcResult.entry.expire, + stale: rdcResult.entry.stale, + timestamp: rdcResult.entry.timestamp, + hasExplicitRevalidate: rdcResult.hasExplicitRevalidate, + hasExplicitExpire: rdcResult.hasExplicitExpire, + readRootParamNames: rdcResult.readRootParamNames, + dynamicNestedCacheError: rdcResult.dynamicNestedCacheError + }); + const [streamA, streamB] = rdcResult.entry.value.tee(); + rdcResult.entry.value = streamB; + if (cacheSignal && !cacheSignalReadEnded) { + // When we have a cacheSignal we need to block on reading the cache + // entry before ending the read. + stream = createTrackedReadableStream(streamA, cacheSignal); + } else { + // The cache signal read was already ended for a short-lived deferral + // (or there is no cacheSignal), so serve a plain stream. + stream = streamA; + } + } else { + // Entry was discarded (e.g. due to recently revalidated tags) + debug == null ? void 0 : debug(logPrefix, 'Resume Data Cache entry discarded', serializedCacheKey); + if (cacheSignal) { + cacheSignal.endRead(); + } + } + } else { + debug == null ? void 0 : debug(logPrefix, 'Resume Data Cache entry not found', serializedCacheKey, `(${resumeDataCache.cache.size} entries)`); + if (cacheSignal) { + cacheSignal.endRead(); + } + switch(workUnitStore.type){ + case 'prerender': + if ((resumeDataCache == null ? void 0 : resumeDataCache.mutable) === false) { + // We're prerendering a fallback shell whose Resume Data Cache is + // the prefilled, read-only seed from a phase-1 prerender of a more- + // specific sibling route. A miss here means the cache key depends + // on a fallback param. We short-circuit to a dynamic hole (which + // may produce an empty shell if there's no parent Suspense + // boundary). Currently this also catches layouts and pages that + // don't read params, which will be improved when we implement + // NAR-136. Compared to the instrumentation-based params bailout we + // also do here, this covers the case where params are transformed + // with an async function before being passed into the "use cache" + // function, which escapes the instrumentation. + // The cache key depends on fallback params, which are URL data. + return makeURLDataHangingPromise(workUnitStore.renderSignal, workStore.route, 'dynamic "use cache"', workUnitStore); + } + // fallthrough + case 'prerender-runtime': + if (!cacheSignal) { + // This is the final prerender (cacheSignal is null), which means + // all caches should have been warmed during the prospective + // prerender. A cache miss here indicates that the cache key is + // non-deterministic (e.g. due to unstable array order in the + // arguments). Known dynamic keys (e.g. from fallback params) are + // already handled by the early return above. We return a hanging + // promise so this becomes a dynamic hole rather than generating a + // broken cache entry that gets aborted. + console.warn(new UnexpectedCacheMissError(workStore.route)); + // This is an anomaly (non-deterministic cache key), so we can't + // know whether a runtime prerender would resolve it. + return makeUnknownRuntimeDataHangingPromise(workUnitStore.renderSignal, workStore.route, 'dynamic "use cache"', workUnitStore); + } + break; + case 'prerender-legacy': + case 'request': + case 'cache': + case 'private-cache': + case 'unstable-cache': + case 'build-time-generator': + break; + default: + workUnitStore; + } + } + } + // Intra-request deduplication: Within a single request, root params are + // fixed, so the coarse key (serializedCacheKey) is sufficient. If another + // invocation in this request is already handling the same cache entry + // (including the cache handler lookup and generation), we join it instead of + // doing redundant work. This also saves cache handler `get` calls which may + // be HTTP round-trips for remote handlers. + if (stream === undefined) { + var _workStore_pendingCacheInvocations, _workStore_completedCacheInvocations; + const pendingInvocation = (_workStore_pendingCacheInvocations = workStore.pendingCacheInvocations) == null ? void 0 : _workStore_pendingCacheInvocations.get(serializedCacheKey); + // A pending invocation is joined unconditionally: its fill is shared, so + // every joiner receives whatever that fill produces. A completed one is a + // stored entry instead, so it is only reused when the caller hasn't asked + // to bypass caches, and only if nothing has invalidated it since. + const completedInvocation = pendingInvocation === undefined && !shouldForceRevalidate(workStore, workUnitStore) ? (_workStore_completedCacheInvocations = workStore.completedCacheInvocations) == null ? void 0 : _workStore_completedCacheInvocations.get(serializedCacheKey) : undefined; + const joinedInvocation = pendingInvocation ?? completedInvocation; + if (joinedInvocation) { + const cacheSignal = getCacheSignal(workUnitStore); + cacheSignal == null ? void 0 : cacheSignal.beginRead(); + debug == null ? void 0 : debug(logPrefix, 'joining intra-request invocation', serializedCacheKey); + const sharedCacheResult = await joinedInvocation; + if (sharedCacheResult.type === 'prerender-dynamic') { + debug == null ? void 0 : debug(logPrefix, 'joined invocation is prerender-dynamic', serializedCacheKey); + if (resumeDataCache == null ? void 0 : resumeDataCache.mutable) { + // A nested-cache leader has no RDC. This consumer must carry the + // omission reason into the final prerender instead of leaving an + // unexplained miss that loses the fallback's prefetch hint. + resumeDataCache.cache.set(serializedCacheKey, sharedCacheResult.reason); + } + cacheSignal == null ? void 0 : cacheSignal.endRead(); + return sharedCacheResult.hangingPromise; + } + // A completed entry may have been invalidated since it was produced, by + // an `updateTag()` in a server action earlier in this request. The + // implicit tags expiration is passed as 0 because it cannot apply to a + // retained entry: it is memoized for the request, so re-checking it + // against an unchanged entry timestamp only repeats the answer the leader + // already got. + const metadata = completedInvocation === undefined ? undefined : await sharedCacheResult.entry.pendingMetadata; + if (metadata !== undefined && shouldDiscardCacheEntry(metadata, workStore, workUnitStore, implicitTags, 0, logPrefix)) { + var _workStore_completedCacheInvocations1; + debug == null ? void 0 : debug(logPrefix, 'discarding completed invocation', serializedCacheKey); + (_workStore_completedCacheInvocations1 = workStore.completedCacheInvocations) == null ? void 0 : _workStore_completedCacheInvocations1.delete(serializedCacheKey); + // This can take the signal's count to zero. The leader path below opens + // a read again synchronously, before it awaits anything, which is what + // stops a prerender from concluding that every cache read has settled + // while a fill is still about to start. + cacheSignal == null ? void 0 : cacheSignal.endRead(); + } else { + debug == null ? void 0 : debug(logPrefix, 'joined invocation resolved with cached entry', serializedCacheKey); + stream = serveJoinedCacheEntry(sharedCacheResult.entry, serializedCacheKey, resumeDataCache, cacheContext, cacheSignal, logPrefix); + } + } + } + // Leader path: no pending intra-request invocation found. Check for a + // cross-request pending invocation, or become the leader for both. + if (stream === undefined) { + const resolvableSharedCacheResult = new ResolvableSharedCacheResult(); + debug == null ? void 0 : debug(logPrefix, 'registering as intra-request invocation leader', serializedCacheKey); + const intraRequestPendingCacheInvocations = workStore.pendingCacheInvocations ??= new Map(); + // Retain the completed entry for the rest of the request where a later + // invocation would otherwise repeat real work: private caches have no cache + // handler to fall back on in production, and a platform- or config-supplied + // handler may be remote, so a second `get` can be a round trip. A built-in + // handler read is a map lookup, so retaining its entries would hold a + // forked stream buffer for nothing. + const completedCacheInvocations = isPrivate || !isBuiltInCacheHandler(kind) ? workStore.completedCacheInvocations ??= new Map() : undefined; + resolvableSharedCacheResult.registerIn(intraRequestPendingCacheInvocations, serializedCacheKey, completedCacheInvocations); + // Cross-request deduplication lets concurrent requests for the same key + // share a single fill. Private caches are skipped in production, where they + // hold request-specific data that must not be shared across requests. In + // development they're persisted and keyed by the request's cookies and + // headers, so concurrent requests with identical request data should share + // a fill too; that request-scoped `cacheHandlerKey` keeps requests with + // different cookies or headers in separate entries. + // + // Draft mode requests are skipped as well, in both directions. A fill that + // runs with draft mode enabled can contain unpublished content, so it must + // not be registered for other requests to join. And a draft mode request + // must not join a pending public fill, because it would be served the + // published content instead of the draft. + const skipCrossRequestDedupe = isPrivate && !process.env.__NEXT_DEV_SERVER || workStore.isDraftMode; + try { + // The loop handles cross-request root param mismatches: when a + // cross-request joiner discovers that the leader's root params differ + // from its own, it retries with a recomputed cacheHandlerKey. The loop + // exits when stream is assigned (cross-request joiner match or leader + // path) or via early return (prerender-dynamic). + while(stream === undefined){ + const crossRequestPendingCacheInvocation = skipCrossRequestDedupe ? undefined : crossRequestPendingCacheInvocations.get(cacheHandlerKey); + if (crossRequestPendingCacheInvocation) { + const cacheSignal = getCacheSignal(workUnitStore); + cacheSignal == null ? void 0 : cacheSignal.beginRead(); + debug == null ? void 0 : debug(logPrefix, 'joining pending cross-request invocation', cacheHandlerKey); + const sharedCacheResult = await crossRequestPendingCacheInvocation; + if (sharedCacheResult.type === 'cached') { + // Verify root params before forking the stream. The shared + // invocation must complete first, including collection and write + // settlement. A changed key retries the handler lookup, which must + // not run before the write settles. + const metadata = await sharedCacheResult.entry.pendingCompletion; + // Ensure known root param names are up-to-date before verifying the + // key, since the leader's save path may not have updated them yet + // at this point. + if (metadata.readRootParamNames) { + addKnownRootParamNames(id, metadata.readRootParamNames); + } + const updatedRootParamNames = knownRootParamsByFunctionId.get(id); + if (updatedRootParamNames && rootParams) { + const newCacheHandlerKey = cacheHandlerKeyBase + computeRootParamsCacheKeySuffix(rootParams, updatedRootParamNames); + if (newCacheHandlerKey !== cacheHandlerKey) { + debug == null ? void 0 : debug(logPrefix, 'cross-request root param mismatch, retrying', cacheHandlerKey, '→', newCacheHandlerKey); + cacheSignal == null ? void 0 : cacheSignal.endRead(); + cacheHandlerKey = newCacheHandlerKey; + continue; // stream is not used → retry with new key + } + } + // Key matches — safe to fork. + debug == null ? void 0 : debug(logPrefix, 'cross-request invocation matched, forking result', cacheHandlerKey); + cacheSignal == null ? void 0 : cacheSignal.endRead(); + stream = sharedCacheResult.entry.fork(); + maybePropagateCacheEntryMetadata(cacheContext, metadata); + // The cross-request leader belongs to a different request with its + // own RDC. Save to this request's RDC so its final prerender can + // resume from the entry. + saveSharedCacheEntryToResumeDataCache(serializedCacheKey, sharedCacheResult.entry, resumeDataCache, logPrefix); + // Resolve for intra-request joiners in this request. They get + // a fork from the same SharedCacheEntry. + resolvableSharedCacheResult.resolve(sharedCacheResult); + break; + } else { + // prerender-dynamic — same root param check before hanging + const updatedRootParamNames = knownRootParamsByFunctionId.get(id); + if (updatedRootParamNames && rootParams) { + const newCacheHandlerKey = cacheHandlerKeyBase + computeRootParamsCacheKeySuffix(rootParams, updatedRootParamNames); + if (newCacheHandlerKey !== cacheHandlerKey) { + debug == null ? void 0 : debug(logPrefix, 'cross-request root param mismatch, retrying', cacheHandlerKey, '→', newCacheHandlerKey); + cacheSignal == null ? void 0 : cacheSignal.endRead(); + cacheHandlerKey = newCacheHandlerKey; + continue; + } + } + debug == null ? void 0 : debug(logPrefix, 'cross-request invocation is prerender-dynamic', cacheHandlerKey); + if (resumeDataCache == null ? void 0 : resumeDataCache.mutable) { + resumeDataCache.cache.set(serializedCacheKey, sharedCacheResult.reason); + } + cacheSignal == null ? void 0 : cacheSignal.endRead(); + resolvableSharedCacheResult.resolve(sharedCacheResult); + return sharedCacheResult.hangingPromise; + } + } + // No pending cross-request invocation — become the leader. + if (!skipCrossRequestDedupe) { + debug == null ? void 0 : debug(logPrefix, 'registering as cross-request invocation leader', cacheHandlerKey); + resolvableSharedCacheResult.registerIn(crossRequestPendingCacheInvocations, cacheHandlerKey); + } + const cacheSignal = getCacheSignal(workUnitStore); + if (cacheSignal) { + // Either the cache handler or the generation can be using I/O at this + // point. We need to track when they start and when they complete. + cacheSignal.beginRead(); + } + const lazyRefreshTags = workStore.refreshTagsByCacheKind.get(kind); + if (lazyRefreshTags && !isResolvedLazyResult(lazyRefreshTags)) { + await lazyRefreshTags; + } + let entry; + let observedRevalidation; + // We ignore existing cache entries when force revalidating. + if (cacheHandler && !shouldForceRevalidate(workStore, workUnitStore)) { + // Record an existing revalidation before `get()` so a stale result + // does not start another revalidation. The existing revalidation may + // finish and remove its map entry before the lookup returns. + observedRevalidation = backgroundRevalidations.get(cacheHandlerKey); + entry = await cacheHandler.get(cacheHandlerKey, implicitTags); + // Check if this is a redirect entry (coarse key → specific key). + // Redirect entries have private tags encoding the root param names + // (one tag per param name, prefixed with _N_RP_). + if (entry && rootParams) { + const paramNames = new Set(); + for (const tag of entry.tags){ + if (tag.startsWith(NEXT_CACHE_ROOT_PARAM_TAG_ID)) { + paramNames.add(tag.slice(NEXT_CACHE_ROOT_PARAM_TAG_ID.length)); + } + } + if (paramNames.size > 0) { + addKnownRootParamNames(id, paramNames); + cacheHandlerKey = cacheHandlerKeyBase + computeRootParamsCacheKeySuffix(rootParams, paramNames); + observedRevalidation = backgroundRevalidations.get(cacheHandlerKey); + entry = await cacheHandler.get(cacheHandlerKey, implicitTags); + } + } + } + if (entry) { + let implicitTagsExpiration = 0; + if (workUnitStore.implicitTags) { + const lazyExpiration = workUnitStore.implicitTags.expirationsByCacheKind.get(kind); + if (lazyExpiration) { + const expiration = isResolvedLazyResult(lazyExpiration) ? lazyExpiration.value : await lazyExpiration; + // If a cache handler returns an expiration time of Infinity, it + // signals to Next.js that it handles checking cache entries for + // staleness based on the expiration of the implicit tags passed + // into the `get` method. In this case, we keep the default of 0, + // which means that the implicit tags are not considered expired. + if (expiration < Infinity) { + implicitTagsExpiration = expiration; + } + } + } + if (shouldDiscardCacheEntry(entry, workStore, workUnitStore, implicitTags, implicitTagsExpiration, logPrefix)) { + debug == null ? void 0 : debug(logPrefix, 'discarding expired entry', cacheHandlerKey); + entry = undefined; + } + } + const currentTime = performance.timeOrigin + performance.now(); + if (entry !== undefined && (entry.revalidate === 0 || entry.expire < MIN_PRERENDERABLE_EXPIRE)) { + switch(workUnitStore.type){ + case 'prerender': + // In a Dynamic I/O prerender, if the cache entry has revalidate: + // 0 or if the expire time is under 5 minutes, then we consider + // this cache entry dynamic as it's not worth generating static + // pages for such data. It's better to leave a dynamic hole that + // can be filled in during the resume with a potentially cached + // entry. + if (entry.revalidate === 0) { + debug == null ? void 0 : debug(logPrefix, 'omitting entry', cacheHandlerKey, 'from static shell due to revalidate: 0'); + } else { + debug == null ? void 0 : debug(logPrefix, 'omitting entry', cacheHandlerKey, 'from static shell due to short expire value:', entry.expire); + } + if (cacheSignal) { + cacheSignal.endRead(); + } + // The entry is only excluded from *static* prerenders. A runtime + // shell or prefetch would include this content. + // TODO(app-shells): Does this handle the MIN_SHELL_STALE case below correctly? + const hangingPromise = makeSessionDataHangingPromise(workUnitStore.renderSignal, workStore.route, 'dynamic "use cache"', workUnitStore); + debug == null ? void 0 : debug(logPrefix, 'leader resolved as prerender-dynamic', cacheHandlerKey); + resolvableSharedCacheResult.resolve({ + type: 'prerender-dynamic', + reason: SESSION_DATA, + hangingPromise + }); + return hangingPromise; + case 'request': + { + if (isValidationRender(workUnitStore)) { + // A short-lived entry is a dynamic hole, excluded from the + // static shell, so we end the cache signal read here (the + // prerender case does the same) to avoid this cache hit being + // considered a cache miss when checking for pending cache reads + // at staged rendering task boundaries. The value is deferred to + // the runtime stage. + if (cacheSignal && !cacheSignalReadEnded) { + cacheSignal.endRead(); + cacheSignalReadEnded = true; + } + const stage = RENDER_STAGES_BY_DATA_KIND.sessionData; + debug == null ? void 0 : debug(logPrefix, 'delaying entry', serializedCacheKey, `until after the ${RenderStage[stage]} stage due to short expire value:`, entry.expire); + await makeDevtoolsIOAwarePromise(undefined, workUnitStore, RENDER_STAGES_BY_DATA_KIND.sessionData); + } + break; + } + case 'prerender-runtime': + case 'prerender-legacy': + case 'cache': + case 'private-cache': + case 'unstable-cache': + case 'build-time-generator': + break; + default: + workUnitStore; + } + } + if (entry !== undefined && entry.stale < MIN_SHELL_STALE) { + const isPrefetchable = entry.stale >= MIN_PREFETCHABLE_STALE; + switch(workUnitStore.type){ + case 'request': + { + // Same as the resume data cache read path: the entry's stale + // time is short enough that it's excluded from shells, or, if + // it's below `MIN_PREFETCHABLE_STALE`, from prerenders + // entirely. + if (isValidationRender(workUnitStore)) { + // End the cache signal read (once, in case the expire block + // above already did) so the delayed value isn't counted as a + // pending read at a staged rendering boundary. + if (cacheSignal && !cacheSignalReadEnded) { + cacheSignal.endRead(); + cacheSignalReadEnded = true; + } + let stage; + if (!isPrefetchable) { + // An unprefetchable entry is excluded from prerenders, so it + // resolves in the dynamic stage. + stage = RenderStage.Dynamic; + } else { + // If the entry would be be excluded from the shell, treat it as + // if it were static URL data. + // (Note that this is still correct without PPF or in static shell validation, + // where we don't use runtime shells and include static URL data) + trackIncompatibleShellContent(workUnitStore, '"use cache" excluded from app shells due to a short staletime'); + stage = RENDER_STAGES_BY_DATA_KIND.staticUrlData[workUnitStore.needsRuntimeShell ? 'runtime' : 'static']; + } + debug == null ? void 0 : debug(logPrefix, 'delaying entry', serializedCacheKey, `until after the ${RenderStage[stage]} stage due to short stale value:`, entry.stale); + await makeDevtoolsIOAwarePromise(undefined, workUnitStore, stage); + } + break; + } + case 'prerender': + case 'prerender-runtime': + case 'prerender-legacy': + case 'cache': + case 'private-cache': + case 'unstable-cache': + case 'build-time-generator': + break; + default: + workUnitStore; + } + } + if (entry === undefined || // In dev, the built-in default handler retains a short-`expire` entry + // for at least `MIN_PRERENDERABLE_EXPIRE`, both when used directly + // and when fronting a custom cache handler. Apply that same minimum + // here so the retained entry is served and re-warmed in the + // background (below), rather than blocking to regenerate it on every + // read. The entry's real `expire` is untouched, so staging still + // treats it as dynamic. + currentTime > entry.timestamp + (process.env.__NEXT_DEV_SERVER ? Math.max(entry.expire, MIN_PRERENDERABLE_EXPIRE) : entry.expire) * 1000 || willConsumerServerCache(workUnitStore) && currentTime > entry.timestamp + entry.revalidate * 1000) { + // Miss. Generate a new result. + // If the cache entry is stale and its consumer will persist the + // result in a server cache, don't persist the stale entry into a new + // cache. We're not time constrained here, so regenerate it now. + // We need to run this inside a clean AsyncLocalStorage snapshot so + // that the cache generation cannot read anything from the context + // we're currently executing which might include request specific + // things like cookies() inside a React.cache(). + // Note: It is important that we await at least once before this + // because it lets us pop out of any stack specific contexts as well - + // aka "Sync" Local Storage. + if (entry) { + if (currentTime > entry.timestamp + entry.expire * 1000) { + debug == null ? void 0 : debug(logPrefix, 'entry is expired', cacheHandlerKey); + } + if (willConsumerServerCache(workUnitStore) && currentTime > entry.timestamp + entry.revalidate * 1000) { + debug == null ? void 0 : debug(logPrefix, 'foreground revalidation, entry is stale', cacheHandlerKey); + } + } + if (cacheSignal && cacheSignalReadEnded) { + // A short-lived deferral above (a `revalidate` of zero or a short + // expire, or a short stale time) already ended this read. We're now + // regenerating the entry rather than serving it, and the generation + // ends the read again once its entry is collected. Re-begin the + // read here so the trailing `endRead` stays balanced instead of + // over-decrementing the cache signal. + cacheSignal.beginRead(); + cacheSignalReadEnded = false; + } + const result = await generateCacheEntry(workStore, cacheContext, clientReferenceManifest, encodedCacheKeyParts, fn, timeoutError, deadlockError); + if (result.type === 'prerender-dynamic') { + debug == null ? void 0 : debug(logPrefix, 'leader resolved as prerender-dynamic (generation)', cacheHandlerKey); + if (resumeDataCache == null ? void 0 : resumeDataCache.mutable) { + resumeDataCache.cache.set(serializedCacheKey, result.reason); + } + resolvableSharedCacheResult.resolve(result); + return result.hangingPromise; + } + const { stream: newStream, pendingCacheResult } = result; + let pendingWrite; + // When draft mode is enabled, we must not save the cache entry. + if (!workStore.isDraftMode) { + const savedCacheResult = saveToResumeDataCache(resumeDataCache, serializedCacheKey, pendingCacheResult, logPrefix); + if (cacheHandler) { + pendingWrite = saveToCacheHandler(cacheHandler, id, cacheHandlerKeyBase, savedCacheResult, rootParams); + workStore.pendingRevalidateWrites ??= []; + workStore.pendingRevalidateWrites.push(pendingWrite); + } + } + debug == null ? void 0 : debug(logPrefix, 'leader resolved with generated entry', cacheHandlerKey); + const pendingMetadata = pendingCacheResult.then((collected)=>({ + tags: collected.entry.tags, + revalidate: collected.entry.revalidate, + expire: collected.entry.expire, + stale: collected.entry.stale, + timestamp: collected.entry.timestamp, + hasExplicitRevalidate: collected.hasExplicitRevalidate, + hasExplicitExpire: collected.hasExplicitExpire, + readRootParamNames: collected.readRootParamNames, + dynamicNestedCacheError: collected.dynamicNestedCacheError + })); + const sharedCacheEntry = new SharedCacheEntry(newStream, pendingMetadata, pendingWrite); + stream = sharedCacheEntry.fork(); + resolvableSharedCacheResult.resolve({ + type: 'cached', + entry: sharedCacheEntry + }); + } else { + const entryMetadata = { + tags: entry.tags, + revalidate: entry.revalidate, + expire: entry.expire, + stale: entry.stale, + timestamp: entry.timestamp, + readRootParamNames: knownRootParamsByFunctionId.get(id), + // For pre-existing entries from cache handlers we don't know + // whether they had explicit cache life values or not. But we only + // need this information during prerendering when we produce new + // entries, where the cache life of an inner cache may be propagated + // to the outer one. In that case we use the RDC. So it's safe to + // set this to undefined here. + hasExplicitRevalidate: undefined, + hasExplicitExpire: undefined, + // The same applies to the dynamic nested cache error. + dynamicNestedCacheError: undefined + }; + maybePropagateCacheEntryMetadata(cacheContext, entryMetadata); + // We want to return this stream, even if it's stale. + stream = entry.value; + // If we have a mutable resume data cache, we need to clone the entry + // and add it to the resume data cache. + if (resumeDataCache == null ? void 0 : resumeDataCache.mutable) { + const [entryLeft, entryRight] = cloneCacheEntry(entry); + if (cacheSignal && !cacheSignalReadEnded) { + stream = createTrackedReadableStream(entryLeft.value, cacheSignal); + } else { + // The read was already ended for a short-lived deferral (or there + // is no cacheSignal), so serve a plain stream. + stream = entryLeft.value; + } + // The RDC is per-page and root params are fixed within a page, so + // we always use the coarse key (without root param suffix). + resumeDataCache.cache.set(serializedCacheKey, Promise.resolve({ + entry: entryRight, + hasExplicitRevalidate: entryMetadata.hasExplicitRevalidate, + hasExplicitExpire: entryMetadata.hasExplicitExpire, + readRootParamNames: entryMetadata.readRootParamNames, + dynamicNestedCacheError: entryMetadata.dynamicNestedCacheError + })); + } else if (!cacheSignalReadEnded) { + // If we're not regenerating we need to signal that we've finished + // putting the entry into the cache scope at this point. Otherwise + // we do that inside generateCacheEntry. (Skipped when the read was + // already ended for a short-lived deferral.) + cacheSignal == null ? void 0 : cacheSignal.endRead(); + } + debug == null ? void 0 : debug(logPrefix, 'leader resolved with cache handler hit', cacheHandlerKey); + const sharedCacheEntry = new SharedCacheEntry(stream, Promise.resolve(entryMetadata), undefined); + stream = sharedCacheEntry.fork(); + resolvableSharedCacheResult.resolve({ + type: 'cached', + entry: sharedCacheEntry + }); + // Trigger a background revalidation when the entry is stale (past its + // `revalidate`), so the next read gets a fresh value without blocking + // this one. Development additionally re-warms on every dynamic + // request render in two cases where the dev in-memory entry would + // otherwise read back as fresh, so a subsequent reload still shows a + // fresh value. The first is with the in-memory cache disabled + // (`cacheMaxMemorySize: 0`), where built-in entries keep their + // resolved (potentially non-dynamic) cache life. The second is a + // short-`expire` entry (an explicit dynamic or client-only cache, + // e.g. `cacheLife({ expire: 0 })`), which is retained for at least + // `MIN_PRERENDERABLE_EXPIRE` so it is served from the cache; this + // also covers custom handlers, re-executing and writing through to + // the backing. + let shouldTriggerBackgroundRevalidation = currentTime > entry.timestamp + entry.revalidate * 1000; + if (!shouldTriggerBackgroundRevalidation && process.env.__NEXT_DEV_SERVER && (entry.expire < MIN_PRERENDERABLE_EXPIRE || isMemoryCacheDisabled() && !isCustomCacheHandler(kind))) { + switch(workUnitStore.type){ + case 'request': + shouldTriggerBackgroundRevalidation = true; + break; + case 'cache': + case 'private-cache': + case 'prerender': + case 'prerender-runtime': + case 'prerender-legacy': + case 'unstable-cache': + case 'build-time-generator': + break; + default: + workUnitStore; + } + } + if (shouldTriggerBackgroundRevalidation && // The revalidation observed before the lookup may have finished. + observedRevalidation === undefined && // A new revalidation may have started since the lookup began. + !backgroundRevalidations.has(cacheHandlerKey)) { + const revalidateCacheHandlerKey = cacheHandlerKey; + // Defer the call so synchronous setup errors reject the background + // task instead of failing the stale response. This also lets us + // register the task before generation starts. + const revalidatePromise = Promise.resolve().then(()=>generateCacheEntry(workStore, // The background revalidation preserves the outer store for + // reading (e.g. implicitTags) but skips propagation of cache + // life and tags back to the outer scope. + { + ...cacheContext, + skipPropagation: true + }, clientReferenceManifest, encodedCacheKeyParts, fn, timeoutError, deadlockError)).then(async (result)=>{ + if (result.type === 'cached') { + const { stream: ignoredStream, pendingCacheResult } = result; + const savedCacheResult = saveToResumeDataCache(resumeDataCache, serializedCacheKey, pendingCacheResult, logPrefix); + const pendingWrite = cacheHandler ? saveToCacheHandler(cacheHandler, id, cacheHandlerKeyBase, savedCacheResult, rootParams) : savedCacheResult.then(()=>{}); + for (const completion of (await Promise.allSettled([ + ignoredStream.cancel(), + pendingWrite + ]))){ + if (completion.status === 'rejected') { + throw completion.reason; + } + } + } + }).finally(()=>{ + if (backgroundRevalidations.get(revalidateCacheHandlerKey) === revalidatePromise) { + backgroundRevalidations.delete(revalidateCacheHandlerKey); + } + }); + backgroundRevalidations.set(revalidateCacheHandlerKey, revalidatePromise); + revalidatePromise.catch((error)=>{ + debug == null ? void 0 : debug(logPrefix, 'background cache revalidation failed for', revalidateCacheHandlerKey, error); + }); + workStore.pendingRevalidateWrites ??= []; + workStore.pendingRevalidateWrites.push(revalidatePromise); + } + } + } + } catch (error) { + resolvableSharedCacheResult.reject(error); + throw error; + } + } + // Logs are replayed even if it's a hit - to ensure we see them on the client eventually. + // If we didn't then the client wouldn't see the logs if it was seeded from a prewarm that + // never made it to the client. However, this also means that you see logs even when the + // cached function isn't actually re-executed. We should instead ensure prewarms always + // make it to the client. Another issue is that this will cause double logging in the + // server terminal. Once while generating the cache entry and once when replaying it on + // the server, which is required to pick it up for replaying again on the client. + const replayConsoleLogs = true; + const serverConsumerManifest = { + // moduleLoading must be null because we don't want to trigger preloads of ClientReferences + // to be added to the consumer. Instead, we'll wait for any ClientReference to be emitted + // which themselves will handle the preloading. + moduleLoading: null, + moduleMap: getRscModuleMappingForUseCache(), + serverModuleMap: getServerModuleMap() + }; + return createFromReadableStream(stream, { + findSourceMapURL, + serverConsumerManifest, + temporaryReferences, + replayConsoleLogs, + environmentName: 'Cache' + }); +} +/** + * This returns cache key parts that cover everything that can affect the result of the cached + * function (apart from the arguments). The implementation part is used by both the RDC and cache + * handler, while the runtime env var state hash is only used by the cache handler. The RDC is + * per-page and must reuse entries across rendering phases even if an env var changes between them. + * + * The parts cover: + * - codeHash: the code itself that generates the return value + * - Notably, this excludes the following modules. Those are included via the Next.js version anyway: + * - react, react-dom, private-next-rsc-server-reference, private-next-rsc-cache-wrapper + * - runtimeEnvVarsRead: the keys and values of runtime environment variables that the code reads + * - runtimeEnvVarExistence: the unset/falsy/truthy state of runtime environment variables used in boolean contexts + * - the version of Next.js (to account for RSC wire format changes, or use-cache-wrapper.ts changes) + * + * In case that granular information isn't available, fall back to + * buildId/deploymentId/hmrRefreshHash, which is a correct hash but over-invalidates way too often. + */ async function computeCacheKeyImplementationPart(workStore, workUnitStore, id) { + var _getServerActionsManifest_node_id_workers_normalizeWorkerPageName, _getServerActionsManifest_node_id_workers; + let durability = workStore.durableUseCacheEntries ? (_getServerActionsManifest_node_id_workers = getServerActionsManifest().node[id].workers) == null ? void 0 : (_getServerActionsManifest_node_id_workers_normalizeWorkerPageName = _getServerActionsManifest_node_id_workers[normalizeWorkerPageName(workStore.page)]) == null ? void 0 : _getServerActionsManifest_node_id_workers_normalizeWorkerPageName.durability : undefined; + if (durability) { + // use cache is only supported in Node.js runtime. So we can use the Node.js crypto module here. + const crypto = require('crypto'); + let runtimeEnvVarStateHash = crypto// Hash the env var values, to not leak secrets into the cache key. + .createHash('sha256').update([ + ...durability.runtimeEnvVarsRead.map((k)=>{ + // Make sure not to stringify `undefined` and `"undefined"` to the same value. + return process.env[k] != null ? `${k}==${process.env[k]}` : k; + }), + ...durability.runtimeEnvVarsExistence.map((k)=>{ + const value = process.env[k]; + const state = value == null ? 'unset' : value ? 'truthy' : 'falsy'; + return `${k}~=${state}`; + }) + ].join('\0') ?? '').digest('hex'); + // The env var state is added to the cache handler key separately so it + // doesn't affect RDC lookups between rendering phases. + return { + implementationPart: [ + durability.codeHash, + nextVersion + ], + runtimeEnvVarStateHash + }; + } else { + // Because the Action ID is not yet unique per implementation of that Action we can't + // safely reuse the results across builds yet. In the meantime we add the buildId to the + // arguments as a seed to ensure they're not reused. Remove this once Action IDs hash + // the implementation. + const buildId = workStore.deploymentId || workStore.buildId; + // In dev mode, when the HMR refresh hash is set, we include it in the + // cache key. This ensures that cache entries are not reused when server + // components have been edited. This is a very coarse approach. But it's + // also only a temporary solution until Action IDs are unique per + // implementation. Remove this once Action IDs hash the implementation. + const hmrRefreshHash = getHmrRefreshHash(workUnitStore); + // otherwise fall back to buildId and/or the HMR hash. + return { + implementationPart: hmrRefreshHash ? [ + buildId, + hmrRefreshHash + ] : [ + buildId + ], + runtimeEnvVarStateHash: undefined + }; + } +} +/** + * A request store in `next start` never delays caches. + * We only apply delays when the render will be used for + * validation purposes. + */ function isValidationRender(requestStore) { + return !!(process.env.__NEXT_CACHE_COMPONENTS && // In dev we're always running validation. + (process.env.__NEXT_DEV_SERVER || // Build-time instant validation also uses a 'request' store. + requestStore.validationSamples)); +} +/** + * Returns `true` if the `'use cache'` function is the page component itself, + * or `generateMetadata`/`generateViewport` in a page file. + */ function isPageSegmentFunction(args) { + const [maybeProps] = args; + return maybeProps !== null && typeof maybeProps === 'object' && maybeProps.$$isPage === true; +} +/** + * Returns `true` if the `'use cache'` function is the layout component itself, + * or `generateMetadata`/`generateViewport` in a layout file. + */ function isLayoutSegmentFunction(args) { + const [maybeProps] = args; + return maybeProps !== null && typeof maybeProps === 'object' && maybeProps.$$isLayout === true; +} +function shouldForceRevalidate(workStore, workUnitStore) { + if (workStore.isOnDemandRevalidate || workStore.isDraftMode) { + return true; + } + if (process.env.__NEXT_DEV_SERVER) { + switch(workUnitStore.type){ + case 'request': + return workUnitStore.headers.get('cache-control') === 'no-cache'; + case 'cache': + case 'private-cache': + return workUnitStore.forceRevalidate; + case 'prerender-runtime': + case 'prerender': + case 'prerender-client': + case 'validation-client': + case 'prerender-legacy': + case 'unstable-cache': + case 'build-time-generator': + break; + default: + workUnitStore; + } + } + return false; +} +function shouldDiscardCacheEntry(entry, workStore, workUnitStore, implicitTags, implicitTagsExpiration, logPrefix) { + // If the cache entry was created before any of the implicit tags were + // revalidated last, we need to discard it. + if (entry.timestamp <= implicitTagsExpiration) { + debug == null ? void 0 : debug(logPrefix, 'entry was created at', entry.timestamp, 'before implicit tags were revalidated at', implicitTagsExpiration); + return true; + } + // During prerendering, we ignore recently revalidated tags. In dev mode, we + // can assume that the dynamic dev rendering will have discarded and recreated + // the affected cache entries, and we don't want to discard those again during + // the prerender validation. During build-time prerendering, there will never + // be any pending revalidated tags. + switch(workUnitStore.type){ + case 'prerender': + return false; + case 'prerender-runtime': + case 'prerender-client': + case 'validation-client': + case 'prerender-legacy': + case 'request': + case 'cache': + case 'private-cache': + case 'unstable-cache': + case 'build-time-generator': + break; + default: + workUnitStore; + } + // If the cache entry contains revalidated tags that the cache handler might + // not know about yet, we need to discard it. + if (entry.tags.some((tag)=>isRevalidatedAfter(tag, entry.timestamp, workStore, logPrefix))) { + return true; + } + // Finally, if any of the implicit tags have been revalidated recently, we + // also need to discard the cache entry. + if (implicitTags.some((tag)=>isRevalidatedAfter(tag, entry.timestamp, workStore, logPrefix))) { + return true; + } + return false; +} +/** + * Whether `tag` was revalidated after an entry created at `entryTimestamp`, + * which makes that entry stale. An entry produced after the revalidation + * already reflects it and is still usable. + */ function isRevalidatedAfter(tag, entryTimestamp, workStore, logPrefix) { + const { previouslyRevalidatedTags, pendingRevalidatedTags, requestStartTime } = workStore; + // Was the tag previously revalidated (e.g. by a redirecting server action)? + // That happened in an earlier request and carries no timestamp of its own, so + // it counts as having happened when this request started. + if (entryTimestamp <= requestStartTime && previouslyRevalidatedTags.includes(tag)) { + debug == null ? void 0 : debug(logPrefix, 'tag', tag, 'was previously revalidated'); + return true; + } + // It could also have been revalidated by the currently running server action. + // In this case the revalidation might not have been fully propagated by a + // remote cache handler yet, so we read it from the pending tags in the work + // store. + if (pendingRevalidatedTags == null ? void 0 : pendingRevalidatedTags.some((item)=>item.tag === tag && item.revalidatedAt > entryTimestamp)) { + debug == null ? void 0 : debug(logPrefix, 'tag', tag, 'was just revalidated'); + return true; + } + return false; +} + +//# sourceMappingURL=use-cache-wrapper.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-wrapper.js.map b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-wrapper.js.map new file mode 100644 index 0000000000000000000000000000000000000000..396e85261ae5eff158a9a154112389d6c0300219 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/use-cache/use-cache-wrapper.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/use-cache/use-cache-wrapper.ts"],"sourcesContent":["import type { DeepReadonly } from '../../shared/lib/deep-readonly'\n/* eslint-disable import/no-extraneous-dependencies */\nimport {\n renderToReadableStream,\n decodeReply,\n decodeReplyFromAsyncIterable,\n createTemporaryReferenceSet as createServerTemporaryReferenceSet,\n} from 'react-server-dom-webpack/server'\nimport {\n createFromReadableStream,\n encodeReply,\n createTemporaryReferenceSet as createClientTemporaryReferenceSet,\n} from 'react-server-dom-webpack/client'\nimport { prerender } from 'react-server-dom-webpack/static'\n\nimport type { WorkStore } from '../app-render/work-async-storage.external'\nimport { workAsyncStorage } from '../app-render/work-async-storage.external'\nimport type {\n PrerenderStoreModernClient,\n PrerenderStoreModernRuntime,\n PrerenderStoreModernServer,\n PrivateUseCacheStore,\n RequestStore,\n RevalidateStore,\n UseCacheStore,\n ValidationStoreClient,\n WorkUnitStore,\n} from '../app-render/work-unit-async-storage.external'\nimport {\n getHmrRefreshHash,\n getResumeDataCache,\n getVaryParamsAccumulator,\n workUnitAsyncStorage,\n getDraftModeProviderForCacheScope,\n getCacheSignal,\n isHmrRefresh,\n getServerComponentsHmrCache,\n willConsumerServerCache,\n} from '../app-render/work-unit-async-storage.external'\nimport { accumulateVaryParam } from '../app-render/vary-params'\n\nimport {\n applyOwnerStack,\n makeDevtoolsIOAwarePromise,\n makeDynamicHangingPromise,\n makeFallbackParamsHangingPromise,\n makeUntrackedHangingPromise,\n makeSessionDataHangingPromise,\n makeURLDataHangingPromise,\n makePrefetchHangingPromise,\n makeUnknownRuntimeDataHangingPromise,\n RENDER_STAGES_BY_DATA_KIND,\n trackFallbackParamsAccessed,\n trackURLDataAccessed,\n trackIncompatibleShellContent,\n trackPromiseUsed,\n} from '../dynamic-rendering-utils'\n\nimport type { ClientReferenceManifest } from '../../build/webpack/plugins/flight-manifest-plugin'\n\nimport {\n getClientReferenceManifest,\n getRscModuleMappingForUseCache,\n getServerActionsManifest,\n getServerModuleMap,\n normalizeWorkerPageName,\n} from '../app-render/manifests-singleton'\nimport type { CacheEntry } from '../lib/cache-handlers/types'\nimport type { CacheSignal } from '../app-render/cache-signal'\nimport { decryptActionBoundArgs } from '../app-render/encryption'\nimport { InvariantError } from '../../shared/lib/invariant-error'\nimport {\n createReactServerErrorHandler,\n type DigestedError,\n} from '../app-render/create-error-handler'\nimport stringHash from 'next/dist/compiled/string-hash'\nimport {\n MIN_PRERENDERABLE_EXPIRE,\n MIN_PREFETCHABLE_STALE,\n MIN_SHELL_STALE,\n} from './constants'\nimport { NEXT_CACHE_ROOT_PARAM_TAG_ID } from '../../lib/constants'\nimport {\n getCacheHandler,\n getDevTieredCacheHandler,\n getPrivateCacheHandler,\n isBuiltInCacheHandler,\n isCustomCacheHandler,\n isMemoryCacheDisabled,\n} from './handlers'\nimport type { CacheReadWriteHandler } from './tiered-cache-handler'\nimport { cloneCacheEntry } from './clone-cache-entry'\nimport { NEXT_INSTANT_TEST_COOKIE } from '../../client/components/app-router-headers'\nimport {\n RequestCookiesAdapter,\n type ReadonlyRequestCookies,\n} from '../web/spec-extension/adapters/request-cookies'\nimport {\n HeadersAdapter,\n type ReadonlyHeaders,\n} from '../web/spec-extension/adapters/headers'\nimport {\n NestedDynamicUseCacheError,\n UnexpectedCacheMissError,\n UseCacheDeadlockError,\n UseCacheTimeoutError,\n} from './use-cache-errors'\nimport {\n createNestedCacheShortExpireError,\n createNestedCacheZeroRevalidateError,\n createUseCachePrivateInsidePublicUseCacheError,\n createUseCachePrivateInsideUnstableCacheError,\n createUseCachePrivateOutsideRequestContextError,\n} from './use-cache-messages'\nimport {\n createHangingInputAbortSignal,\n throwToInterruptStaticGeneration,\n} from '../app-render/dynamic-rendering'\nimport {\n makeErroringSearchParamsForUseCache,\n type SearchParams,\n} from '../request/search-params'\nimport type { Params } from '../request/params'\nimport type { ResumeDataCache } from '../resume-data-cache/resume-data-cache'\nimport {\n FALLBACK_PARAMS,\n RUNTIME_DATA,\n SESSION_DATA,\n} from '../resume-data-cache/cache-store'\nimport { createLazyResult, isResolvedLazyResult } from '../lib/lazy-result'\nimport {\n abortOnDynamicAccess,\n dynamicAccessAsyncStorage,\n type DynamicAccessAsyncStore,\n} from '../app-render/dynamic-access-async-storage.external'\nimport type { CacheLife } from './cache-life'\nimport {\n RenderStage,\n type AdvanceableRenderStage,\n} from '../app-render/staged-rendering'\nimport * as Log from '../../build/output/log'\nimport { getServerReact, getClientReact } from '../runtime-reacts.external'\nimport { createPromiseWithResolvers } from '../../shared/lib/promise-with-resolvers'\n\ninterface PrivateCacheContext {\n readonly kind: 'private'\n readonly outerWorkUnitStore:\n | RequestStore\n | PrivateUseCacheStore\n | PrerenderStoreModernRuntime\n readonly skipPropagation: boolean\n readonly outerOwnerStack: string | undefined\n /** The `'use cache'` function's server reference id (second arg of `cache()`). */\n readonly functionId: string\n /** The cache handler kind (first arg of `cache()`, e.g. 'default'). */\n readonly handlerKind: string\n}\n\ninterface PublicCacheContext {\n readonly kind: 'public'\n // TODO: We should probably forbid nesting \"use cache\" inside unstable_cache.\n readonly outerWorkUnitStore: Exclude<\n WorkUnitStore,\n PrerenderStoreModernClient | ValidationStoreClient\n >\n readonly skipPropagation: boolean\n readonly outerOwnerStack: string | undefined\n /** The `'use cache'` function's server reference id (second arg of `cache()`). */\n readonly functionId: string\n /** The cache handler kind (first arg of `cache()`, e.g. 'default'). */\n readonly handlerKind: string\n /**\n * Eagerly captured at `cache()` entry, pointing at this invocation's call\n * site. Only set when the outer is itself a public `'use cache'` (i.e. when\n * this entry could become the propagated origin of a nested-dynamic cache\n * error in the parent). When this cache resolves dynamic, this is copied into\n * `outerWorkUnitStore.dynamicNestedCacheError` so the parent's error can use\n * it as `cause`.\n */\n readonly dynamicNestedCacheError: Error | undefined\n}\n\ntype CacheContext = PrivateCacheContext | PublicCacheContext\n\nconst nextVersion = process.env.__NEXT_VERSION as string\n\nexport type CacheKeyParts = [\n id: string,\n args: unknown[],\n implementationHash: unknown,\n]\n\ninterface UseCachePageInnerProps {\n params: Promise\n searchParams?: Promise\n}\n\nexport interface UseCachePageProps {\n params: Promise\n searchParams: Promise\n $$isPage: true\n}\n\nexport type UseCacheLayoutProps = {\n params: Promise\n $$isLayout: true\n} & {\n // The value type should be React.ReactNode. But such an index signature would\n // be incompatible with the other two props.\n [slot: string]: any\n}\n\n/**\n * Cache entry metadata for propagation. Separated from the stream to make\n * ownership clear: metadata is freely shareable, streams must be explicitly\n * tee'd for each consumer.\n */\ninterface CacheResultMetadata {\n readonly tags: string[]\n readonly revalidate: number\n readonly expire: number\n readonly stale: number\n readonly timestamp: number\n readonly readRootParamNames: ReadonlySet | undefined\n readonly hasExplicitRevalidate: boolean | undefined\n readonly hasExplicitExpire: boolean | undefined\n readonly dynamicNestedCacheError: Error | undefined\n}\n\n/**\n * Encapsulates a pending cache invocation for deduping. Manages lazy stream\n * tee-ing (via fork()) and metadata access for both intra-request and\n * cross-request joiners.\n */\nclass SharedCacheEntry {\n private stream: ReadableStream\n\n /**\n * Resolves when collection finishes, without waiting for handler writes.\n */\n public readonly pendingMetadata: Promise\n\n /**\n * Resolves with collected metadata after any handler writes settle. Write\n * failures do not discard the metadata. Collection failures still reject this\n * promise.\n */\n public readonly pendingCompletion: Promise\n\n constructor(\n stream: ReadableStream,\n pendingMetadata: Promise,\n pendingWrite: Promise | undefined\n ) {\n this.stream = stream\n this.pendingMetadata = pendingMetadata\n this.pendingCompletion =\n pendingWrite === undefined\n ? pendingMetadata\n : pendingWrite.then(\n () => pendingMetadata,\n () => pendingMetadata\n )\n }\n\n /**\n * Tee the stream: returns a copy for the caller, replaces the internal stream\n * with the remaining branch for future callers. Both the leader and joiners\n * call this — everyone gets a fork.\n */\n fork(): ReadableStream {\n const [forked, remaining] = this.stream.tee()\n this.stream = remaining\n return forked\n }\n}\n\nexport type SharedCacheResult =\n | {\n readonly type: 'cached'\n readonly entry: SharedCacheEntry\n }\n | {\n readonly type: 'prerender-dynamic'\n readonly reason:\n | typeof FALLBACK_PARAMS\n | typeof RUNTIME_DATA\n | typeof SESSION_DATA\n readonly hangingPromise: Promise\n }\n\nfunction ignoreReject() {}\n\n/**\n * Manages the deferred promise for a shared cache result, tracks which maps\n * it's registered in, and drives cleanup from resolve/reject.\n *\n * Cached results stay in the maps until collection finishes and handler writes\n * settle. Later invocations can join while either remains pending. For\n * 'prerender-dynamic' and errors, cleanup is immediate.\n */\nclass ResolvableSharedCacheResult {\n private readonly deferred = createPromiseWithResolvers()\n\n private readonly registrations: Array<{\n map: Map>\n key: string\n /**\n * Where to move the entry once the invocation completes, instead of\n * dropping it. Only set for the request-scoped map, and only for kinds\n * whose entries are worth retaining; the module-scope cross-request map\n * must never retain, since its entries would outlive the request that\n * produced them.\n */\n retentionMap?: Map>\n }> = []\n\n registerIn(\n map: Map>,\n key: string,\n retentionMap?: Map>\n ): void {\n map.set(key, this.deferred.promise)\n this.registrations.push({ map, key, retentionMap })\n }\n\n resolve(result: SharedCacheResult): void {\n this.deferred.resolve(result)\n if (result.type === 'cached') {\n // Retain only an entry that collected successfully. A failed collection\n // leaves metadata a later invocation cannot read, so it is dropped like\n // any other failure and the next invocation regenerates.\n result.entry.pendingCompletion.then(\n () => this.cleanupAndRetain(),\n () => this.cleanup()\n )\n } else {\n this.cleanup()\n }\n }\n\n reject(error: unknown): void {\n // The promise stored in the dedup maps has no consumer unless a concurrent\n // invocation joined it, so we attach a noop catch handler to prevent the\n // rejection from being reported as unhandled. The leader rethrows the\n // error into the render, which is where it's surfaced.\n this.deferred.promise.catch(ignoreReject)\n this.deferred.reject(error)\n this.cleanup()\n }\n\n /**\n * Drops the pending registrations, leaving nothing for a later invocation to\n * join. Used when the invocation produced no entry that a later one could\n * serve: an error has no value, and a 'prerender-dynamic' result is a hanging\n * promise bound to the leader's render signal.\n */\n private cleanup(): void {\n for (const { map, key } of this.registrations) {\n map.delete(key)\n }\n }\n\n /**\n * Drops the pending registrations and moves the entry into the retention map\n * where one was given, so a later invocation in the same request can reuse it\n * instead of repeating the lookup and, on a miss, the work.\n */\n private cleanupAndRetain(): void {\n for (const { map, key, retentionMap } of this.registrations) {\n map.delete(key)\n retentionMap?.set(key, this.deferred.promise)\n }\n }\n}\n\n/**\n * Module-scope map for cross-request deduplication. Keyed by `cacheHandlerKey`\n * (specific key on warm path, coarse key on cold path). Entries live only for\n * the duration of the leader's invocation.\n */\nconst crossRequestPendingCacheInvocations = new Map<\n string,\n Promise\n>()\n\n// Prevent duplicate background revalidations for the same key until generation\n// and cache writes finish.\nconst backgroundRevalidations = new Map>()\n\n// The first argument at each call site is the full directive that produced\n// the invocation, e.g. \"'use cache'\" or \"'use cache: remote'\".\nconst debug = process.env.NEXT_PRIVATE_DEBUG_CACHE\n ? console.debug.bind(console)\n : undefined\n\nconst filterStackFrame =\n process.env.NODE_ENV !== 'production'\n ? (require('../lib/source-maps') as typeof import('../lib/source-maps'))\n .filterStackFrameDEV\n : undefined\nconst findSourceMapURL =\n process.env.NODE_ENV !== 'production'\n ? (require('../lib/source-maps') as typeof import('../lib/source-maps'))\n .findSourceMapURLDEV\n : undefined\n\n// Tracks which root params each cache function has historically read. Used to\n// compute the specific cache key upfront on subsequent invocations. In-memory\n// only — after server restart, the coarse-key redirect entry in the cache\n// handler provides fallback.\nconst knownRootParamsByFunctionId = new Map>()\n\nfunction addKnownRootParamNames(\n id: string,\n names: ReadonlySet\n): Set {\n const existing = knownRootParamsByFunctionId.get(id)\n if (existing) {\n for (const name of names) {\n existing.add(name)\n }\n return existing\n }\n const created = new Set(names)\n knownRootParamsByFunctionId.set(id, created)\n return created\n}\n\nfunction computeRootParamsCacheKeySuffix(\n rootParams: Params,\n paramNames: ReadonlySet\n): string {\n if (paramNames.size === 0) {\n return ''\n }\n\n return JSON.stringify(\n [...paramNames]\n .sort()\n .map((paramName) => [paramName, rootParams[paramName]])\n )\n}\n\n// Next-internal cookies that must not vary the private cache key, since they're\n// not part of the application's own cookie state. The instant-navigation cookie\n// toggles while a navigation lock is held, so including it would force spurious\n// misses.\nconst COOKIES_EXCLUDED_FROM_PRIVATE_CACHE_KEY = new Set([\n NEXT_INSTANT_TEST_COOKIE,\n])\n\n// Request and transport headers that must not vary the private cache key. They\n// either differ between otherwise-equivalent requests, which would cause\n// spurious misses (a browser reload adds `cache-control`/`pragma` that an\n// initial navigation doesn't, and `accept`/`sec-fetch-*` differ between an HTML\n// navigation and an RSC or prefetch request for the same page), or are\n// connection- and proxy-level rather than application data. The `cookie` header\n// is excluded because cookies are keyed separately below (via the dedicated\n// cookie path, which applies `COOKIES_EXCLUDED_FROM_PRIVATE_CACHE_KEY`);\n// including the raw header would duplicate them and reintroduce the cookies\n// that path excludes. Header names are lowercased by `HeadersAdapter`, so every\n// entry here is lowercase.\nconst HEADERS_EXCLUDED_FROM_PRIVATE_CACHE_KEY = new Set([\n 'accept',\n 'accept-encoding',\n 'cache-control',\n 'connection',\n 'cookie',\n 'if-match',\n 'if-modified-since',\n 'if-none-match',\n 'if-range',\n 'if-unmodified-since',\n 'keep-alive',\n 'pragma',\n 'priority',\n 'purpose',\n 'range',\n 'sec-fetch-dest',\n 'sec-fetch-mode',\n 'sec-fetch-site',\n 'sec-fetch-user',\n 'sec-purpose',\n 'te',\n 'upgrade',\n 'upgrade-insecure-requests',\n 'x-forwarded-for',\n 'x-forwarded-host',\n 'x-forwarded-port',\n 'x-forwarded-proto',\n])\n\n// TODO: This varies the dev private cache key by the request's cookies and\n// headers (minus the transport and content-negotiation headers excluded above).\n// It's a heuristic: it still over-keys (a cache that reads only one cookie or\n// header varies by all of them) and the header denylist is necessarily\n// incomplete. Follow up by tracking which cookies and headers a cache function\n// actually reads (the same mechanism root params use via `readRootParamNames`)\n// and keying by only those. Note that Next-internal flight headers such as\n// `rsc` and `next-router-state-tree` are already stripped upstream in\n// `getHeaders`, so they never appear here.\nfunction computePrivateCacheKeyRequestSuffix(\n cookies: ReadonlyRequestCookies,\n headers: ReadonlyHeaders\n): string {\n const relevantCookies = cookies\n .getAll()\n .filter(\n (cookie) => !COOKIES_EXCLUDED_FROM_PRIVATE_CACHE_KEY.has(cookie.name)\n )\n .map((cookie): [string, string] => [cookie.name, cookie.value])\n .sort(([nameA], [nameB]) => (nameA < nameB ? -1 : nameA > nameB ? 1 : 0))\n\n const relevantHeaders = [...headers.entries()]\n .filter(([name]) => !HEADERS_EXCLUDED_FROM_PRIVATE_CACHE_KEY.has(name))\n .sort(([nameA], [nameB]) => (nameA < nameB ? -1 : nameA > nameB ? 1 : 0))\n\n if (relevantCookies.length === 0 && relevantHeaders.length === 0) {\n return ''\n }\n\n return JSON.stringify({ cookies: relevantCookies, headers: relevantHeaders })\n}\n\nfunction saveToResumeDataCache(\n resumeDataCache: ResumeDataCache | null,\n serializedCacheKey: string,\n pendingCacheResult: Promise,\n logPrefix: string\n): Promise {\n if (!resumeDataCache?.mutable) {\n return pendingCacheResult\n }\n\n const split = clonePendingCacheResult(pendingCacheResult)\n const savedCacheResult = getNthCacheResult(split, 0)\n const rdcResult = getNthCacheResult(split, 1)\n\n // The RDC is per-page and root params are fixed within a page, so we always\n // use the coarse key (without root param suffix). Unlike the cache handler,\n // the RDC doesn't need root-param-specific keys for isolation.\n resumeDataCache.cache.set(serializedCacheKey, rdcResult)\n debug?.(logPrefix, 'Resume Data Cache entry saved', serializedCacheKey)\n\n return savedCacheResult\n}\n\n/**\n * A joiner's RDC context may differ from the leader's:\n *\n * - Intra-request: the leader was nested inside another cache (no accessible\n * RDC) while this joiner is top-level and has one.\n * - Cross-request: the leader belongs to a different request entirely — this\n * request's RDC has never seen the entry.\n *\n * In both cases the joiner must save to its own RDC so its final prerender can\n * resume from the entry. Constructs a `CollectedCacheResult` from a forked\n * stream branch of the shared entry and the awaited metadata.\n *\n * An existing entry avoids redundant saves when the intra-request leader\n * already saved to the same RDC. A marker, however, can be replaced by a\n * successful fill.\n */\nfunction saveSharedCacheEntryToResumeDataCache(\n serializedCacheKey: string,\n sharedCacheEntry: SharedCacheEntry,\n resumeDataCache: ResumeDataCache | null,\n logPrefix: string\n): void {\n if (!resumeDataCache?.mutable) {\n return\n }\n\n const existingEntry = resumeDataCache.cache.get(serializedCacheKey)\n if (\n existingEntry !== undefined &&\n existingEntry !== FALLBACK_PARAMS &&\n existingEntry !== RUNTIME_DATA &&\n existingEntry !== SESSION_DATA\n ) {\n return\n }\n\n const rdcResult: Promise =\n sharedCacheEntry.pendingMetadata.then((metadata) => ({\n entry: {\n value: sharedCacheEntry.fork(),\n tags: metadata.tags,\n revalidate: metadata.revalidate,\n expire: metadata.expire,\n stale: metadata.stale,\n timestamp: metadata.timestamp,\n },\n readRootParamNames: metadata.readRootParamNames,\n hasExplicitRevalidate: metadata.hasExplicitRevalidate,\n hasExplicitExpire: metadata.hasExplicitExpire,\n dynamicNestedCacheError: metadata.dynamicNestedCacheError,\n }))\n\n resumeDataCache.cache.set(serializedCacheKey, rdcResult)\n debug?.(\n logPrefix,\n 'Resume Data Cache entry saved by joiner',\n serializedCacheKey\n )\n}\n\n/**\n * Completes a join onto another invocation's entry, whether that invocation is\n * still filling or has already finished: forks the stream, saves to this\n * invocation's RDC if the leader had none, and balances the cache signal read\n * once the entry is fully collected.\n */\nfunction serveJoinedCacheEntry(\n sharedCacheEntry: SharedCacheEntry,\n serializedCacheKey: string,\n resumeDataCache: ResumeDataCache | null,\n cacheContext: CacheContext,\n cacheSignal: CacheSignal | null,\n logPrefix: string\n): ReadableStream {\n const stream = sharedCacheEntry.fork()\n\n // If the leader was nested inside another cache (no accessible RDC), it\n // couldn't save to the RDC. This joiner may be top-level with an RDC, in\n // which case it must save here; otherwise the RDC lookup during the final\n // prerender will miss.\n saveSharedCacheEntryToResumeDataCache(\n serializedCacheKey,\n sharedCacheEntry,\n resumeDataCache,\n logPrefix\n )\n\n // End the cache read after collection and metadata propagation, not when the\n // value stream becomes available. This does not wait for handler persistence.\n // A failed collection or propagation must still end the read so it cannot\n // stall prerendering. The catch prevents an unhandled rejection after the\n // stream has been returned.\n sharedCacheEntry.pendingMetadata\n .then((metadata) => {\n maybePropagateCacheEntryMetadata(cacheContext, metadata)\n })\n .finally(() => {\n cacheSignal?.endRead()\n })\n .catch(ignoreReject)\n\n return stream\n}\n\nfunction saveToCacheHandler(\n cacheHandler: CacheReadWriteHandler,\n id: string,\n cacheHandlerKeyBase: string,\n savedCacheResult: Promise,\n rootParams: Params | undefined\n): Promise {\n // Write the entry to the cache handler. With root params, this is a redirect\n // entry at the coarse key plus the actual entry at the specific key;\n // otherwise just the entry at the coarse key. Both set calls are fired\n // together and awaited in parallel.\n return savedCacheResult.then(async (collectedResult) => {\n const { entry: fullEntry, readRootParamNames } = collectedResult\n\n // Use the combined set (union of all historically observed reads) for both\n // the specific key and the redirect entry's tags. The read path computes\n // cacheHandlerKey from this same union (knownRootParamsByFunctionId), so\n // the write path must use the identical set to land on the same specific\n // key. If we used only the current invocation's reads, a function that\n // conditionally reads different root params across invocations would\n // scatter entries across different specific keys, making previous entries\n // unreachable from the read path's union-based lookup.\n const rootParamNames = readRootParamNames\n ? addKnownRootParamNames(id, readRootParamNames)\n : knownRootParamsByFunctionId.get(id)\n\n const setPromises: Promise[] = []\n let coarseEntry: CacheEntry = fullEntry\n\n if (rootParamNames && rootParamNames.size > 0 && rootParams) {\n const specificKey =\n cacheHandlerKeyBase +\n computeRootParamsCacheKeySuffix(rootParams, rootParamNames)\n\n setPromises.push(\n // Capture synchronous `set()` throws as rejected write promises.\n new Promise((resolve) => {\n resolve(cacheHandler.set(specificKey, Promise.resolve(fullEntry)))\n })\n )\n\n // The coarse key gets a redirect entry instead. On a cold server (empty\n // knownRootParamsByFunctionId), its tags tell a reader which root params\n // to include in the specific-key lookup.\n const rootParamTags = [...rootParamNames].map(\n (paramName) => NEXT_CACHE_ROOT_PARAM_TAG_ID + paramName\n )\n\n coarseEntry = {\n value: new ReadableStream({\n start(controller) {\n // Single byte so the entry has non-zero size in LRU caches.\n controller.enqueue(new Uint8Array([0]))\n controller.close()\n },\n }),\n tags: [...fullEntry.tags, ...rootParamTags],\n stale: fullEntry.stale,\n timestamp: fullEntry.timestamp,\n expire: fullEntry.expire,\n revalidate: fullEntry.revalidate,\n } satisfies CacheEntry\n }\n\n setPromises.push(\n // Capture synchronous `set()` throws as rejected write promises.\n new Promise((resolve) => {\n resolve(\n cacheHandler.set(cacheHandlerKeyBase, Promise.resolve(coarseEntry))\n )\n })\n )\n\n // A failed write must not finish the operation while another write is\n // pending.\n for (const result of await Promise.allSettled(setPromises)) {\n if (result.status === 'rejected') {\n throw result.reason\n }\n }\n })\n}\n\nfunction generateCacheEntry(\n workStore: WorkStore,\n cacheContext: CacheContext,\n clientReferenceManifest: DeepReadonly,\n encodedArguments: FormData | string,\n fn: (...args: unknown[]) => Promise,\n timeoutError: UseCacheTimeoutError,\n deadlockError: UseCacheDeadlockError | undefined\n) {\n // We need to run this inside a clean AsyncLocalStorage snapshot so that the cache\n // generation cannot read anything from the context we're currently executing which\n // might include request specific things like cookies() inside a React.cache().\n // Note: It is important that we await at least once before this because it lets us\n // pop out of any stack specific contexts as well - aka \"Sync\" Local Storage.\n return workStore.runInCleanSnapshot(\n generateCacheEntryWithRestoredWorkStore,\n workStore,\n cacheContext,\n clientReferenceManifest,\n encodedArguments,\n fn,\n timeoutError,\n deadlockError\n )\n}\n\nfunction generateCacheEntryWithRestoredWorkStore(\n workStore: WorkStore,\n cacheContext: CacheContext,\n clientReferenceManifest: DeepReadonly,\n encodedArguments: FormData | string,\n fn: (...args: unknown[]) => Promise,\n timeoutError: UseCacheTimeoutError,\n deadlockError: UseCacheDeadlockError | undefined\n) {\n // Since we cleared the AsyncLocalStorage we need to restore the workStore.\n // Note: We explicitly don't restore the RequestStore nor the PrerenderStore.\n // We don't want any request specific information leaking an we don't want to create a\n // bloated fake request mock for every cache call. So any feature that currently lives\n // in RequestStore but should be available to Caches need to move to WorkStore.\n // PrerenderStore is not needed inside the cache scope because the outer most one will\n // be the one to report its result to the outer Prerender.\n return workAsyncStorage.run(\n workStore,\n generateCacheEntryWithCacheContext,\n workStore,\n cacheContext,\n clientReferenceManifest,\n encodedArguments,\n fn,\n timeoutError,\n deadlockError\n )\n}\n\nfunction createUseCacheStore(\n workStore: WorkStore,\n cacheContext: CacheContext,\n defaultCacheLife: Required\n): UseCacheStore {\n if (cacheContext.kind === 'private') {\n const outerWorkUnitStore = cacheContext.outerWorkUnitStore\n\n return {\n type: 'private-cache',\n phase: 'render',\n consumerWillServerCache: true,\n implicitTags: outerWorkUnitStore?.implicitTags,\n revalidate: defaultCacheLife.revalidate,\n expire: defaultCacheLife.expire,\n stale: defaultCacheLife.stale,\n explicitRevalidate: undefined,\n explicitExpire: undefined,\n explicitStale: undefined,\n tags: null,\n hmrRefreshHash: getHmrRefreshHash(outerWorkUnitStore),\n isHmrRefresh: isHmrRefresh(outerWorkUnitStore),\n serverComponentsHmrCache: getServerComponentsHmrCache(outerWorkUnitStore),\n forceRevalidate: shouldForceRevalidate(workStore, outerWorkUnitStore),\n draftMode: getDraftModeProviderForCacheScope(\n workStore,\n outerWorkUnitStore\n ),\n rootParams: outerWorkUnitStore.rootParams,\n readRootParamNames: new Set(),\n // Every private cache scope is its own work unit. Any cache keyed on\n // headers() or cookies() needs to be invalidated. Otherwise some\n // Next.js API semantics leak across render passes.\n headers: HeadersAdapter.fresh(outerWorkUnitStore.headers),\n cookies: RequestCookiesAdapter.fresh(outerWorkUnitStore.cookies),\n outerOwnerStack: cacheContext.outerOwnerStack,\n }\n } else {\n let useCacheOrRequestStore: RequestStore | UseCacheStore | undefined\n const outerWorkUnitStore = cacheContext.outerWorkUnitStore\n\n switch (outerWorkUnitStore.type) {\n case 'cache':\n case 'private-cache':\n case 'request':\n useCacheOrRequestStore = outerWorkUnitStore\n break\n case 'prerender-runtime':\n case 'prerender':\n case 'prerender-legacy':\n case 'unstable-cache':\n case 'build-time-generator':\n break\n default:\n outerWorkUnitStore satisfies never\n }\n\n let fallbackRootParamsPrerender: PrerenderStoreModernServer | null = null\n if (outerWorkUnitStore.type === 'cache') {\n fallbackRootParamsPrerender =\n outerWorkUnitStore.fallbackRootParamsPrerender\n } else if (outerWorkUnitStore.type === 'prerender') {\n const { fallbackRouteParams } = outerWorkUnitStore\n if (\n fallbackRouteParams !== null &&\n Object.keys(outerWorkUnitStore.rootParams).some((name) =>\n fallbackRouteParams.has(name)\n )\n ) {\n fallbackRootParamsPrerender = outerWorkUnitStore\n }\n }\n\n return {\n type: 'cache',\n phase: 'render',\n fallbackRootParamsPrerender,\n consumerWillServerCache: true,\n implicitTags: outerWorkUnitStore.implicitTags,\n revalidate: defaultCacheLife.revalidate,\n expire: defaultCacheLife.expire,\n stale: defaultCacheLife.stale,\n explicitRevalidate: undefined,\n explicitExpire: undefined,\n explicitStale: undefined,\n tags: null,\n hmrRefreshHash: getHmrRefreshHash(outerWorkUnitStore),\n isHmrRefresh: useCacheOrRequestStore?.isHmrRefresh ?? false,\n serverComponentsHmrCache:\n useCacheOrRequestStore?.serverComponentsHmrCache,\n forceRevalidate: shouldForceRevalidate(workStore, outerWorkUnitStore),\n draftMode: getDraftModeProviderForCacheScope(\n workStore,\n outerWorkUnitStore\n ),\n rootParams: outerWorkUnitStore.rootParams,\n readRootParamNames: new Set(),\n outerOwnerStack: cacheContext.outerOwnerStack,\n dynamicNestedCacheError: undefined,\n }\n }\n}\n\n/**\n * Captures the owner stack from the outer component tree before entering a\n * cache boundary. When nested inside another cache scope, the parent's\n * outerOwnerStack is concatenated so that the full component tree is preserved\n * across multiple cache boundaries.\n */\nfunction captureOuterOwnerStack(\n workUnitStore: WorkUnitStore\n): string | undefined {\n const capturedOwnerStack =\n (getClientReact()?.captureOwnerStack?.() ??\n getServerReact()?.captureOwnerStack?.()) ||\n ''\n\n let parentOuterOwnerStack: string | undefined\n switch (workUnitStore.type) {\n case 'cache':\n case 'private-cache':\n parentOuterOwnerStack = workUnitStore.outerOwnerStack\n break\n case 'unstable-cache':\n case 'request':\n case 'prerender':\n case 'prerender-legacy':\n case 'prerender-runtime':\n case 'prerender-client':\n case 'validation-client':\n case 'build-time-generator':\n break\n default:\n workUnitStore satisfies never\n }\n\n return capturedOwnerStack + (parentOuterOwnerStack || '') || undefined\n}\n\n// The maximum time we allow a `'use cache'` entry to fill. After this, we\n// assume the fill is stalled — either on hanging input to the cached function,\n// or on hanging I/O inside of it — and de-opt with an error.\n//\n// For prerender, the effective value is clamped to 90% of the configured\n// `staticPageGenerationTimeout` so the cache-fill error surfaces before the\n// build worker kills the page. In dev (`request`), the configured\n// `experimental.useCacheTimeout` is used straight.\nfunction getUseCacheFillTimeoutMs(\n workStore: WorkStore,\n workUnitStoreType: 'prerender' | 'prerender-runtime' | 'request'\n): number {\n const { useCacheTimeout, staticPageGenerationTimeout } = workStore\n\n const effectiveTimeout =\n workUnitStoreType === 'request'\n ? useCacheTimeout\n : Math.min(useCacheTimeout, staticPageGenerationTimeout * 0.9)\n\n return effectiveTimeout * 1000\n}\n\nfunction generateCacheEntryWithCacheContext(\n workStore: WorkStore,\n cacheContext: CacheContext,\n clientReferenceManifest: DeepReadonly,\n encodedArguments: FormData | string,\n fn: (...args: unknown[]) => Promise,\n timeoutError: UseCacheTimeoutError,\n deadlockError: UseCacheDeadlockError | undefined\n) {\n const defaultCacheLife = workStore.cacheLifeProfiles.default\n\n // Initialize the Store for this Cache entry.\n const cacheStore = createUseCacheStore(\n workStore,\n cacheContext,\n defaultCacheLife\n )\n\n return workUnitAsyncStorage.run(cacheStore, () =>\n dynamicAccessAsyncStorage.run(\n { abortController: new AbortController(), reason: null },\n generateCacheEntryImpl,\n workStore,\n cacheContext,\n cacheStore,\n clientReferenceManifest,\n encodedArguments,\n fn,\n timeoutError,\n deadlockError\n )\n )\n}\n\nfunction propagateCacheLifeAndTagsToRevalidateStore(\n revalidateStore: RevalidateStore,\n metadata: CacheResultMetadata\n): void {\n const outerTags = (revalidateStore.tags ??= [])\n\n for (const tag of metadata.tags) {\n if (!outerTags.includes(tag)) {\n outerTags.push(tag)\n }\n }\n\n if (revalidateStore.stale > metadata.stale) {\n revalidateStore.stale = metadata.stale\n }\n\n if (revalidateStore.revalidate > metadata.revalidate) {\n revalidateStore.revalidate = metadata.revalidate\n }\n\n if (revalidateStore.expire > metadata.expire) {\n revalidateStore.expire = metadata.expire\n }\n}\n\nfunction propagateCacheStaleTimeToRequestStore(\n requestStore: RequestStore,\n metadata: CacheResultMetadata\n): void {\n if (requestStore.stale !== undefined && requestStore.stale > metadata.stale) {\n requestStore.stale = metadata.stale\n }\n}\n\nfunction propagateCacheEntryMetadata(\n cacheContext: CacheContext,\n metadata: CacheResultMetadata\n): void {\n if (cacheContext.kind === 'private') {\n switch (cacheContext.outerWorkUnitStore.type) {\n case 'private-cache':\n if (metadata.readRootParamNames) {\n for (const paramName of metadata.readRootParamNames) {\n cacheContext.outerWorkUnitStore.readRootParamNames.add(paramName)\n }\n }\n // fallthrough\n case 'prerender-runtime':\n propagateCacheLifeAndTagsToRevalidateStore(\n cacheContext.outerWorkUnitStore,\n metadata\n )\n break\n case 'request':\n propagateCacheStaleTimeToRequestStore(\n cacheContext.outerWorkUnitStore,\n metadata\n )\n break\n case undefined:\n break\n default:\n cacheContext.outerWorkUnitStore satisfies never\n }\n } else {\n switch (cacheContext.outerWorkUnitStore.type) {\n case 'cache':\n // If this entry's cache life is dynamic, record this invocation as the\n // origin to use as `cause` when the outer cache surfaces the\n // nested-dynamic cache error. `??=` keeps the first occurrence so the\n // cause points at the immediate dynamic child.\n if (\n cacheContext.dynamicNestedCacheError !== undefined &&\n (metadata.revalidate === 0 ||\n metadata.expire < MIN_PRERENDERABLE_EXPIRE)\n ) {\n cacheContext.outerWorkUnitStore.dynamicNestedCacheError ??=\n cacheContext.dynamicNestedCacheError\n }\n // fallthrough\n case 'private-cache':\n if (metadata.readRootParamNames) {\n for (const paramName of metadata.readRootParamNames) {\n cacheContext.outerWorkUnitStore.readRootParamNames.add(paramName)\n }\n }\n // fallthrough\n case 'prerender':\n case 'prerender-runtime':\n case 'prerender-legacy':\n propagateCacheLifeAndTagsToRevalidateStore(\n cacheContext.outerWorkUnitStore,\n metadata\n )\n break\n case 'request':\n propagateCacheStaleTimeToRequestStore(\n cacheContext.outerWorkUnitStore,\n metadata\n )\n break\n case 'unstable-cache':\n case 'build-time-generator':\n break\n default:\n cacheContext.outerWorkUnitStore satisfies never\n }\n }\n\n if (metadata.readRootParamNames) {\n const varyParamsAccumulator = getVaryParamsAccumulator(\n cacheContext.outerWorkUnitStore\n )\n if (varyParamsAccumulator) {\n for (const paramName of metadata.readRootParamNames) {\n accumulateVaryParam(varyParamsAccumulator.rootParams, paramName)\n }\n }\n }\n}\n\n/**\n * Conditionally propagates cache life, tags, and root param names to the outer\n * context. During prerenders (`prerender` / `prerender-runtime`) and dev\n * cache-filling requests, propagation is deferred because the entry might be\n * omitted from the final prerender due to short expire/stale times. If omitted,\n * it should not affect the prerender. The final decision happens when the entry\n * is read from the resume data cache in the final render phase — at that point\n * `propagateCacheEntryMetadata` is called unconditionally (after the omission\n * checks have already filtered out short-lived entries).\n *\n * Nested caches propagate root param names into the enclosing cache's\n * `readRootParamNames` set. This propagation is never deferred. Prerender\n * contexts also register known root param names when they read the resume\n * data cache. A response accumulator records the consumed entry's root vary\n * params to prevent segment reuse across different values.\n */\nfunction maybePropagateCacheEntryMetadata(\n cacheContext: CacheContext,\n metadata: CacheResultMetadata\n): void {\n const outerWorkUnitStore = cacheContext.outerWorkUnitStore\n\n switch (outerWorkUnitStore.type) {\n case 'prerender':\n case 'prerender-runtime': {\n // Don't propagate yet — the entry might be omitted from the final\n // prerender due to short expire/stale times. Propagation will happen when\n // the entry is read from the resume data cache.\n break\n }\n case 'request': {\n if (\n isValidationRender(outerWorkUnitStore) &&\n outerWorkUnitStore.cacheSignal\n ) {\n // If we're filling caches for a dev request, apply the same logic as\n // prerenders do above.\n break\n }\n // fallthrough\n }\n case 'private-cache':\n case 'cache':\n case 'unstable-cache':\n case 'prerender-legacy': {\n propagateCacheEntryMetadata(cacheContext, metadata)\n break\n }\n case 'build-time-generator':\n break\n default: {\n outerWorkUnitStore satisfies never\n }\n }\n}\n\nexport interface CollectedCacheResult {\n entry: CacheEntry\n /**\n * Whether the revalidate value was explicitly set via `cacheLife()`.\n * - `true`: explicitly set\n * - `false`: implicit (propagated from a nested cache or implicitly using the\n * default profile)\n * - `undefined`: unknown (e.g. pre-existing entry from a cache handler)\n */\n hasExplicitRevalidate: boolean | undefined\n /**\n * Whether the expire value was explicitly set via `cacheLife()`.\n * - `true`: explicitly set\n * - `false`: implicit (propagated from a nested cache or implicitly using the\n * default profile)\n * - `undefined`: unknown (e.g. pre-existing entry from a cache handler)\n */\n hasExplicitExpire: boolean | undefined\n /**\n * The root param names that were read during cache entry generation.\n * Used to compute the specific cache key after generation completes.\n * `undefined` for pre-existing entries from cache handlers where we\n * don't have this information.\n */\n readRootParamNames: ReadonlySet | undefined\n /**\n * The `Error` carried up from the first nested public `'use cache'`\n * invocation that propagated a dynamic cache life into this entry, captured\n * eagerly at that inner invocation's `cache()` entry. Used as `cause` for the\n * nested-dynamic cache error so the redbox can point at the inner invocation\n * site, not just the outer one. Lives in-memory only — intentionally dropped\n * from the serialized RDC because dynamic entries aren't serialized either.\n */\n dynamicNestedCacheError: Error | undefined\n}\n\nasync function collectResult(\n savedStream: ReadableStream,\n workStore: WorkStore,\n cacheContext: CacheContext,\n innerCacheStore: UseCacheStore,\n startTime: number,\n errors: Array // This is a live array that gets pushed into.\n): Promise {\n // We create a buffered stream that collects all chunks until the end to\n // ensure that RSC has finished rendering and therefore we have collected\n // all tags. In the future the RSC API might allow for the equivalent of\n // the allReady Promise that exists on SSR streams.\n //\n // If something errored or rejected anywhere in the render, we close\n // the stream as errored. This lets a CacheHandler choose to save the\n // partial result up until that point for future hits for a while to avoid\n // unnecessary retries or not to retry. We use the end of the stream for\n // this to avoid another complicated side-channel. A receiver has to consider\n // that the stream might also error for other reasons anyway such as losing\n // connection.\n\n const buffer: Uint8Array[] = []\n const reader = savedStream.getReader()\n\n try {\n for (let entry; !(entry = await reader.read()).done; ) {\n buffer.push(entry.value)\n }\n } catch (error) {\n errors.push(error)\n }\n\n let idx = 0\n const bufferStream = new ReadableStream({\n pull(controller) {\n if (workStore.invalidDynamicUsageError) {\n controller.error(workStore.invalidDynamicUsageError)\n } else if (idx < buffer.length) {\n controller.enqueue(buffer[idx++])\n } else if (errors.length > 0) {\n // TODO: Should we use AggregateError here?\n controller.error(errors[0])\n } else {\n controller.close()\n }\n },\n })\n\n const collectedTags = innerCacheStore.tags\n\n const isPrivateCacheInDev = Boolean(\n process.env.__NEXT_DEV_SERVER && cacheContext.kind === 'private'\n )\n\n // In development, force a dynamic cache life (`revalidate: 0`, `expire:\n // MIN_PRERENDERABLE_EXPIRE`) for private caches, which have no real backing\n // handler. The zero revalidate makes every read serve stale-while-revalidate\n // (regenerating a fresh entry in the background), and\n // `MIN_PRERENDERABLE_EXPIRE` (5 minutes) caps how long an entry lingers in\n // the dedicated in-memory private handler. It is the shortest `expire` that\n // isn't treated as dynamic; a smaller `expire` would exclude the entry from\n // prerenders. Two other cases deliberately do NOT force this and keep their\n // resolved cache life, relying instead on the dev handler's minimum retention\n // and a dev revalidation (see the cache-hit path below) to keep reloads fast\n // and fresh. The size-0 case (`cacheMaxMemorySize: 0`) keeps its life so the\n // entry can be considered prerenderable instead of being misread as a dynamic\n // hole. An explicit short-`expire` public cache (e.g. `cacheLife({ expire: 0\n // })`) keeps its life so it stays correctly excluded from static prerenders\n // via its real `expire` while a reload still hits the cache; forcing\n // `revalidate: 0` here would instead corrupt the cache life propagated to an\n // enclosing cache and trigger the nested-dynamic error. A cache backed by a\n // custom handler keeps its real cache life too, since that handler owns it.\n const forceDynamicCacheLifeInDev = isPrivateCacheInDev\n\n // If cacheLife() was used to set an explicit revalidate/expire/stale time we\n // use that. Otherwise, we use the lowest of all inner fetch(),\n // unstable_cache() or nested \"use cache\", if they're lower than our default.\n const collectedRevalidate = forceDynamicCacheLifeInDev\n ? 0\n : innerCacheStore.explicitRevalidate !== undefined\n ? innerCacheStore.explicitRevalidate\n : innerCacheStore.revalidate\n const collectedExpire = forceDynamicCacheLifeInDev\n ? MIN_PRERENDERABLE_EXPIRE\n : innerCacheStore.explicitExpire !== undefined\n ? innerCacheStore.explicitExpire\n : innerCacheStore.expire\n const collectedStale =\n innerCacheStore.explicitStale !== undefined\n ? innerCacheStore.explicitStale\n : innerCacheStore.stale\n\n const entry: CacheEntry = {\n value: bufferStream,\n timestamp: startTime,\n revalidate: collectedRevalidate,\n expire: collectedExpire,\n stale: collectedStale,\n tags: collectedTags === null ? [] : collectedTags,\n }\n\n const collected: CollectedCacheResult = {\n entry,\n hasExplicitRevalidate: innerCacheStore.explicitRevalidate !== undefined,\n hasExplicitExpire: innerCacheStore.explicitExpire !== undefined,\n readRootParamNames: innerCacheStore.readRootParamNames,\n // The store accumulates this from nested public caches that propagated a\n // dynamic life into us.\n dynamicNestedCacheError:\n innerCacheStore.type === 'cache'\n ? innerCacheStore.dynamicNestedCacheError\n : undefined,\n }\n\n if (!cacheContext.skipPropagation) {\n maybePropagateCacheEntryMetadata(cacheContext, {\n tags: collected.entry.tags,\n revalidate: collected.entry.revalidate,\n expire: collected.entry.expire,\n stale: collected.entry.stale,\n timestamp: collected.entry.timestamp,\n hasExplicitRevalidate: collected.hasExplicitRevalidate,\n hasExplicitExpire: collected.hasExplicitExpire,\n readRootParamNames: collected.readRootParamNames,\n dynamicNestedCacheError: collected.dynamicNestedCacheError,\n })\n\n const cacheSignal = getCacheSignal(cacheContext.outerWorkUnitStore)\n if (cacheSignal) {\n cacheSignal.endRead()\n }\n }\n\n return collected\n}\n\ntype GenerateCacheEntryResult =\n | {\n readonly type: 'cached'\n readonly stream: ReadableStream\n readonly pendingCacheResult: Promise\n }\n | {\n readonly type: 'prerender-dynamic'\n readonly reason: typeof FALLBACK_PARAMS | typeof RUNTIME_DATA\n readonly hangingPromise: Promise\n }\n\nasync function generateCacheEntryImpl(\n workStore: WorkStore,\n cacheContext: CacheContext,\n innerCacheStore: UseCacheStore,\n clientReferenceManifest: DeepReadonly,\n encodedArguments: FormData | string,\n fn: (...args: unknown[]) => Promise,\n timeoutError: UseCacheTimeoutError,\n deadlockError: UseCacheDeadlockError | undefined\n): Promise {\n const temporaryReferences = createServerTemporaryReferenceSet()\n const outerWorkUnitStore = cacheContext.outerWorkUnitStore\n\n const [, args] =\n typeof encodedArguments === 'string'\n ? await decodeReply(\n encodedArguments,\n getServerModuleMap(),\n { temporaryReferences }\n )\n : await decodeReplyFromAsyncIterable(\n {\n async *[Symbol.asyncIterator]() {\n for (const entry of encodedArguments) {\n yield entry\n }\n\n switch (outerWorkUnitStore.type) {\n case 'prerender-runtime':\n case 'prerender':\n // The encoded arguments might contain hanging promises. In\n // this case we don't want to reject with \"Error: Connection\n // closed.\", so we intentionally keep the iterable alive. This\n // is similar to the halting trick that we do while rendering.\n await new Promise((resolve) => {\n if (outerWorkUnitStore.renderSignal.aborted) {\n resolve()\n } else {\n outerWorkUnitStore.renderSignal.addEventListener(\n 'abort',\n () => resolve(),\n { once: true }\n )\n }\n })\n break\n case 'prerender-legacy':\n case 'request':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'build-time-generator':\n break\n default:\n outerWorkUnitStore satisfies never\n }\n },\n },\n getServerModuleMap(),\n { temporaryReferences }\n )\n\n // Track the timestamp when we started computing the result.\n const startTime = performance.timeOrigin + performance.now()\n\n // Invoke the inner function to load a new result. We delay the invocation\n // though, until React awaits the promise so that React's request store (ALS)\n // is available when the function is invoked. This allows us, for example, to\n // capture logs so that we can later replay them.\n const resultPromise = createLazyResult(fn.bind(null, ...args))\n\n const errors: Array = []\n\n // In the \"Cache\" environment, we only need to make sure that the error\n // digests are handled correctly. Error formatting and reporting is not\n // necessary here; the errors are encoded in the stream, and will be reported\n // in the \"Server\" environment.\n const handleError = createReactServerErrorHandler(\n process.env.NODE_ENV === 'development',\n workStore.isBuildTimePrerendering ?? false,\n workStore.reactServerErrorsByDigest,\n (error) => {\n // In production, we log the original error here. It gets a digest that\n // can be used to associate the error with the obfuscated error that might\n // be logged if the error is caught. In development, we prefer logging the\n // transported error in the server environment. It's not obfuscated and\n // also includes the (dev-only) environment name.\n if (process.env.NODE_ENV === 'production') {\n Log.error(error)\n }\n\n errors.push(error)\n }\n )\n\n let stream: ReadableStream\n let devTimeoutAbortController: AbortController | undefined\n\n switch (outerWorkUnitStore.type) {\n case 'cache':\n case 'prerender-runtime':\n case 'prerender': {\n const prerenderStore =\n outerWorkUnitStore.type === 'cache'\n ? outerWorkUnitStore.fallbackRootParamsPrerender\n : outerWorkUnitStore\n\n if (prerenderStore === null) {\n stream = renderToReadableStream(\n resultPromise,\n clientReferenceManifest.clientModules,\n {\n environmentName: 'Cache',\n filterStackFrame,\n temporaryReferences,\n onError: handleError,\n }\n )\n break\n }\n\n const timeoutAbortController = new AbortController()\n const timer = setTimeout(\n () => {\n workStore.invalidDynamicUsageError = timeoutError\n timeoutAbortController.abort(timeoutError)\n },\n getUseCacheFillTimeoutMs(workStore, prerenderStore.type)\n )\n\n const dynamicAccessStore = dynamicAccessAsyncStorage.getStore()\n const dynamicAccessAbortSignal =\n dynamicAccessStore?.abortController.signal\n\n const abortSignal = dynamicAccessAbortSignal\n ? AbortSignal.any([\n dynamicAccessAbortSignal,\n timeoutAbortController.signal,\n ])\n : timeoutAbortController.signal\n\n const { prelude } = await prerender(\n resultPromise,\n clientReferenceManifest.clientModules,\n {\n environmentName: 'Cache',\n filterStackFrame,\n signal: abortSignal,\n temporaryReferences,\n onError(error) {\n if (abortSignal.aborted && abortSignal.reason === error) {\n return undefined\n }\n\n return handleError(error)\n },\n }\n )\n\n clearTimeout(timer)\n const didTimeout = timeoutAbortController.signal.aborted\n if (dynamicAccessAbortSignal) {\n // Release React's listener from the composite signal.\n timeoutAbortController.abort()\n }\n\n if (didTimeout) {\n // When the timeout is reached we always error the stream. Even for\n // fallback shell prerenders we don't want to return a hanging promise,\n // which would allow the function to become a dynamic hole. Because that\n // would mean that a non-empty shell could be generated which would be\n // subject to revalidation, and we don't want to create long\n // revalidation times.\n stream = new ReadableStream({\n start(controller) {\n controller.error(timeoutAbortController.signal.reason)\n },\n })\n } else if (dynamicAccessAbortSignal?.aborted) {\n const reason = dynamicAccessStore?.reason ?? 'runtime'\n const makeHangingPromise =\n reason === 'fallback-params'\n ? makeFallbackParamsHangingPromise\n : makeURLDataHangingPromise\n if (\n innerCacheStore.type === 'cache' &&\n innerCacheStore.fallbackRootParamsPrerender !== null\n ) {\n // No entry is collected for an aborted fill. Still remember the\n // roots actually read so a concrete request won't join this result\n // under the coarse key. Propagate them through aborted parents too.\n addKnownRootParamNames(\n cacheContext.functionId,\n innerCacheStore.readRootParamNames\n )\n const hangingPromise = trackPromiseUsed(\n makeHangingPromise(\n prerenderStore.renderSignal,\n workStore.route,\n 'dynamic \"use cache\"',\n // The single wrapper below tracks access when consumed.\n null\n ),\n () => {\n if (reason === 'fallback-params') {\n trackFallbackParamsAccessed(\n prerenderStore,\n 'dynamic \"use cache\"'\n )\n } else {\n trackURLDataAccessed(prerenderStore, 'dynamic \"use cache\"')\n }\n // The result may also be consumed by a deduped invocation, so\n // record dependencies against the cache consuming it now.\n const consumer = workUnitAsyncStorage.getStore()\n if (consumer !== undefined && consumer.type === 'cache') {\n for (const name of innerCacheStore.readRootParamNames) {\n consumer.readRootParamNames.add(name)\n }\n }\n // Only a cache consuming this result must suspend. Do not share\n // cancellation with independent sibling cache fills.\n abortOnDynamicAccess(reason, dynamicAccessAbortSignal.reason)\n }\n )\n getCacheSignal(outerWorkUnitStore)?.endRead()\n return {\n type: 'prerender-dynamic',\n reason:\n reason === 'fallback-params' ? FALLBACK_PARAMS : RUNTIME_DATA,\n hangingPromise,\n }\n }\n\n // If the prerender is aborted because of dynamic access (e.g. reading\n // fallback params), we return a hanging promise. This essentially makes\n // the \"use cache\" function dynamic.\n const hangingPromise = makeHangingPromise(\n prerenderStore.renderSignal,\n workStore.route,\n 'dynamic \"use cache\"',\n outerWorkUnitStore\n )\n\n getCacheSignal(outerWorkUnitStore)?.endRead()\n\n return {\n type: 'prerender-dynamic',\n reason: reason === 'fallback-params' ? FALLBACK_PARAMS : RUNTIME_DATA,\n hangingPromise,\n }\n } else {\n stream = prelude\n }\n break\n }\n case 'request':\n // TODO: We should just check if the render is abandonable. This is\n // relevant in restart-on-cache-miss in general, so when we implement that\n // for cached navs, it'll also be needed in prod\n if (process.env.__NEXT_DEV_SERVER && outerWorkUnitStore.cacheSignal) {\n const stagedRendering = outerWorkUnitStore.stagedRendering\n\n // Capture the render stage at the start of this cache read, before the\n // yield below. A streamed staged render advances its controller on its\n // own schedule, independently of this read, so by the time the yield\n // resolves the controller may have raced ahead to the Dynamic stage even\n // though the read began in an earlier (prerender) stage.\n const stageAtReadStart = stagedRendering?.currentStage\n\n // If we're filling caches for a staged render, make sure that it takes\n // at least a task, so we'll always notice a cache miss between stages.\n //\n // TODO(restart-on-cache-miss): This is suboptimal. Ideally microtasky\n // caches wouldn't register as a miss, but short-lived caches are only\n // omitted correctly when read back in a separate render (now the\n // background validation render, not a restart of the streamed\n // response), so forcing the miss is the best we can do until that's\n // refactored.\n await new Promise((resolve) => setTimeout(resolve))\n\n // Start a cache-fill timeout so a hanging `'use cache'` entry surfaces\n // the same error in dev as during prerender. Cleared when\n // pendingCacheResult settles.\n //\n // Skip the timeout only when the read began in the Dynamic stage, which\n // mirrors prerender: a cache guarded by e.g. `await connection()` is a\n // legitimate dynamic hole and isn't executed there. We use the stage\n // captured at read start, not the current one, because the staged render\n // may have advanced past it during the yield above.\n if (stageAtReadStart !== RenderStage.Dynamic) {\n const devRenderAbortController = new AbortController()\n const fillTimeoutMs = getUseCacheFillTimeoutMs(\n workStore,\n outerWorkUnitStore.type\n )\n const fillDeadlineAt = performance.now() + fillTimeoutMs\n const devRenderTimeoutTimer = setTimeout(() => {\n workStore.invalidDynamicUsageError = timeoutError\n devRenderAbortController.abort(timeoutError)\n }, fillTimeoutMs)\n\n devTimeoutAbortController = new AbortController()\n devTimeoutAbortController.signal.addEventListener(\n 'abort',\n () => {\n clearTimeout(devRenderTimeoutTimer)\n },\n { once: true }\n )\n\n stream = renderToReadableStream(\n resultPromise,\n clientReferenceManifest.clientModules,\n {\n environmentName: 'Cache',\n filterStackFrame,\n signal: devRenderAbortController.signal,\n temporaryReferences,\n onError(error) {\n if (\n devRenderAbortController.signal.aborted &&\n devRenderAbortController.signal.reason === error &&\n error instanceof Error\n ) {\n // The abort reason is the same error stored as\n // `workStore.invalidDynamicUsageError` (a fill timeout or\n // deadlock). Register it under a digest and return that\n // digest, so the error that surfaces on the consumer side of\n // this Flight boundary carries it and the outer render's\n // handler can recover *this* object via\n // `reactServerErrorsByDigest`.\n //\n // We deliberately do not set `error.digest` here: whether the\n // error actually surfaces (vs. being caught in userland) is\n // the consumer's decision, so the \"surfaced\" mark is left to\n // the outer handler.\n const digest = stringHash(\n error.message + (error.stack || '')\n ).toString()\n\n workStore.reactServerErrorsByDigest.set(\n digest,\n error as DigestedError\n )\n\n return digest\n }\n\n return handleError(error)\n },\n }\n )\n\n // `require` (rather than a top-level import) so the bundler can\n // tree-shake the probe scheduler out of the production runtime, where\n // this whole dev-server-gated branch is dead code.\n const { setupProbeScheduler } =\n require('./use-cache-probe-scheduler') as typeof import('./use-cache-probe-scheduler')\n stream = setupProbeScheduler({\n workStore,\n outerRequestStore: outerWorkUnitStore,\n cacheContext,\n encodedArguments,\n fillDeadlineAt,\n stream,\n abortSignal: AbortSignal.any([\n devRenderAbortController.signal,\n devTimeoutAbortController.signal,\n ]),\n onProbeCompleted() {\n const error =\n deadlockError ??\n new InvariantError(\n '`deadlockError` should be constructed inside `cache()` before reaching the probe scheduler.'\n )\n workStore.invalidDynamicUsageError = error\n devRenderAbortController.abort(error)\n },\n })\n break\n }\n }\n // fallthrough\n case 'prerender-legacy':\n case 'private-cache':\n case 'unstable-cache':\n case 'build-time-generator':\n stream = renderToReadableStream(\n resultPromise,\n clientReferenceManifest.clientModules,\n {\n environmentName: 'Cache',\n filterStackFrame,\n temporaryReferences,\n onError: handleError,\n }\n )\n break\n default:\n return outerWorkUnitStore satisfies never\n }\n\n const [returnStream, savedStream] = stream.tee()\n\n const pendingCacheResult = collectResult(\n savedStream,\n workStore,\n cacheContext,\n innerCacheStore,\n startTime,\n errors\n ).finally(() => {\n devTimeoutAbortController?.abort()\n })\n\n if (process.env.NODE_ENV === 'development') {\n // Name the stream for React DevTools.\n // @ts-expect-error\n returnStream.name = 'use cache'\n }\n\n return {\n type: 'cached',\n // Return the stream as we're creating it. This means that if it ends up\n // erroring we cannot return a stale-if-error version but it allows\n // streaming back the result earlier.\n stream: returnStream,\n pendingCacheResult,\n }\n}\n\nfunction cloneCacheResult(\n result: CollectedCacheResult\n): [CollectedCacheResult, CollectedCacheResult] {\n const [entryA, entryB] = cloneCacheEntry(result.entry)\n return [\n {\n entry: entryA,\n hasExplicitRevalidate: result.hasExplicitRevalidate,\n hasExplicitExpire: result.hasExplicitExpire,\n readRootParamNames: result.readRootParamNames,\n dynamicNestedCacheError: result.dynamicNestedCacheError,\n },\n {\n entry: entryB,\n hasExplicitRevalidate: result.hasExplicitRevalidate,\n hasExplicitExpire: result.hasExplicitExpire,\n readRootParamNames: result.readRootParamNames,\n dynamicNestedCacheError: result.dynamicNestedCacheError,\n },\n ]\n}\n\nasync function clonePendingCacheResult(\n pendingCacheResult: Promise\n): Promise<[CollectedCacheResult, CollectedCacheResult]> {\n const result = await pendingCacheResult\n return cloneCacheResult(result)\n}\n\nasync function getNthCacheResult(\n split: Promise<[CollectedCacheResult, CollectedCacheResult]>,\n i: number\n): Promise {\n return (await split)[i]\n}\n\nasync function encodeFormData(formData: FormData): Promise {\n let result = ''\n for (let [key, value] of formData) {\n // We don't need this key to be serializable but from a security perspective it should not be\n // possible to generate a string that looks the same from a different structure. To ensure this\n // we need a delimeter between fields but just using a delimeter is not enough since a string\n // might contain that delimeter. We use the length of each field as the delimeter to avoid\n // escaping the values.\n result += key.length.toString(16) + ':' + key\n let stringValue\n if (typeof value === 'string') {\n stringValue = value\n } else {\n // The FormData might contain binary data that is not valid UTF-8 so this cache\n // key may generate a UCS-2 string. Passing this to another service needs to be\n // aware that the key might not be compatible.\n const arrayBuffer = await value.arrayBuffer()\n if (arrayBuffer.byteLength % 2 === 0) {\n stringValue = String.fromCodePoint(...new Uint16Array(arrayBuffer))\n } else {\n stringValue =\n String.fromCodePoint(\n ...new Uint16Array(arrayBuffer, 0, (arrayBuffer.byteLength - 1) / 2)\n ) +\n String.fromCodePoint(\n new Uint8Array(arrayBuffer, arrayBuffer.byteLength - 1, 1)[0]\n )\n }\n }\n result += stringValue.length.toString(16) + ':' + stringValue\n }\n return result\n}\n\nfunction createTrackedReadableStream(\n stream: ReadableStream,\n cacheSignal: CacheSignal\n) {\n const reader = stream.getReader()\n return new ReadableStream({\n async pull(controller) {\n const { done, value } = await reader.read()\n if (done) {\n controller.close()\n cacheSignal.endRead()\n } else {\n controller.enqueue(value)\n }\n },\n })\n}\n\nexport async function cache(\n kind: string,\n id: string,\n boundArgsLength: number,\n originalFn: (...args: unknown[]) => Promise,\n args: unknown[]\n) {\n const isPrivate = kind === 'private'\n\n // The default handler kind corresponds to the bare 'use cache' directive.\n const logPrefix = kind === 'default' ? `'use cache'` : `'use cache: ${kind}'`\n\n const workStore = workAsyncStorage.getStore()\n if (workStore === undefined) {\n throw new Error(\n '\"use cache\" cannot be used outside of App Router. Expected a WorkStore.'\n )\n }\n\n const workUnitStore = workUnitAsyncStorage.getStore()\n if (workUnitStore === undefined) {\n throw new InvariantError(\n '\"use cache\" cannot be used outside of App Router. Expected a WorkUnitStore.'\n )\n }\n\n // In a prerender, tasky IO may result in cache reads that start\n // after the prerender has already been aborted:\n //\n // await setTimeout(100) // we can't abort this uncached IO...\n // await cachedData() // ...so we'll still get here even though the prerender aborted\n //\n // The prerender is over, so we should just return an erroring promise.\n // (NOTE: we also shouldn't fill this cache, because it's behind uncached IO,\n // so semantically it is not part of the prerender)\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-runtime': {\n if (workUnitStore.renderSignal.aborted) {\n // We don't know if the cache itself is dynamic or runtime data,\n // but the prerender is over, so it doesn't need to participate\n // in runtime data tracking at all.\n return makeUntrackedHangingPromise(\n workUnitStore.renderSignal,\n workStore.route,\n '\"use cache\" called after prerender ended'\n )\n }\n break\n }\n case 'prerender-legacy':\n case 'prerender-client':\n case 'validation-client':\n case 'request':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'build-time-generator':\n break\n default:\n workUnitStore satisfies never\n }\n\n // Probe re-executions (the dev-server's hang-detection worker) short-circuit\n // further down before any handler is consulted, so we skip handler selection\n // entirely and the worker can boot without registering handlers at all.\n let cacheHandler: CacheReadWriteHandler | undefined\n if (workStore.useCacheProbeMode === undefined) {\n if (isPrivate) {\n // Private caches normally go to the Resume Data Cache (RDC), not a cache\n // handler. In development we additionally persist them in a dedicated\n // built-in in-memory handler so that reloads are fast.\n if (process.env.__NEXT_DEV_SERVER) {\n cacheHandler = getPrivateCacheHandler()\n }\n } else {\n const handler = getCacheHandler(kind)\n if (!handler) {\n throw new Error('Unknown cache handler: ' + kind)\n }\n\n // In development, a user-configured (custom) handler may be slow or\n // remote, so we read through a tiered handler that puts a built-in\n // in-memory front in front of it to keep cache hits microtask-fast.\n // Built-in handlers (the default handler, and its size-0 replacement) are\n // already in-memory and used directly.\n if (process.env.__NEXT_DEV_SERVER && isCustomCacheHandler(kind)) {\n // A custom kind always has a dev tiered handler: it is created in the\n // same `setCacheHandler` call that makes `isCustomCacheHandler` true.\n const tieredCacheHandler = getDevTieredCacheHandler(kind)\n\n if (!tieredCacheHandler) {\n throw new InvariantError(\n `Expected a dev tiered cache handler for kind \"${kind}\".`\n )\n }\n\n cacheHandler = tieredCacheHandler\n } else {\n cacheHandler = handler\n }\n }\n }\n\n const timeoutError = new UseCacheTimeoutError(workStore.route)\n Error.captureStackTrace(timeoutError, cache)\n applyOwnerStack(timeoutError)\n\n // Only ever thrown by the dev-server's hang-detection probe.\n // `Error.captureStackTrace` has to run while `cache()` is still on the\n // synchronous stack, otherwise the user's `'use cache'` invocation frames\n // would already be gone — that's why the construction sits up here rather\n // than next to the trigger that actually consumes it. The `__NEXT_DEV_SERVER`\n // gate lets the error class drop out of the production runtime bundle.\n let deadlockError: UseCacheDeadlockError | undefined\n if (process.env.__NEXT_DEV_SERVER) {\n deadlockError = new UseCacheDeadlockError(workStore.route)\n Error.captureStackTrace(deadlockError, cache)\n applyOwnerStack(deadlockError)\n }\n\n const wrapAsInvalidDynamicUsageError = (error: Error) => {\n Error.captureStackTrace(error, cache)\n workStore.invalidDynamicUsageError ??= error\n\n return error\n }\n\n const outerOwnerStack =\n process.env.NODE_ENV !== 'production'\n ? captureOuterOwnerStack(workUnitStore)\n : undefined\n\n const name = originalFn.name\n let fn = originalFn\n let cacheContext: CacheContext\n\n if (isPrivate) {\n const expression = '\"use cache: private\"'\n\n switch (workUnitStore.type) {\n // \"use cache: private\" is dynamic in prerendering contexts.\n case 'prerender':\n // Private caches can read request data. At this point we don't know\n // Whether it's going to use session data or URL data.\n // TODO(app-shells): This could be narrowed (and thus optimized) if we checked whether URL data\n // is included in the cache key, because it can only be passed in as arguments.\n return makeUnknownRuntimeDataHangingPromise(\n workUnitStore.renderSignal,\n workStore.route,\n expression,\n workUnitStore\n )\n case 'prerender-legacy':\n return throwToInterruptStaticGeneration(\n expression,\n workStore,\n workUnitStore\n )\n case 'prerender-client':\n case 'validation-client':\n throw new InvariantError(\n `${expression} must not be used within a client component. Next.js should be preventing ${expression} from being allowed in client components statically, but did not in this case.`\n )\n case 'unstable-cache': {\n throw wrapAsInvalidDynamicUsageError(\n createUseCachePrivateInsideUnstableCacheError(workStore.route)\n )\n }\n case 'cache': {\n throw wrapAsInvalidDynamicUsageError(\n createUseCachePrivateInsidePublicUseCacheError(workStore.route)\n )\n }\n case 'request':\n case 'prerender-runtime':\n case 'private-cache':\n cacheContext = {\n kind: 'private',\n outerWorkUnitStore: workUnitStore,\n skipPropagation: false,\n outerOwnerStack,\n functionId: id,\n handlerKind: kind,\n }\n break\n case 'build-time-generator':\n throw wrapAsInvalidDynamicUsageError(\n createUseCachePrivateOutsideRequestContextError(\n workStore.route,\n workUnitStore.functionName\n )\n )\n default:\n workUnitStore satisfies never\n // This is dead code, but without throwing an error here, TypeScript\n // will assume that cacheContext is used before being assigned.\n throw new InvariantError(`Unexpected work unit store.`)\n }\n } else {\n switch (workUnitStore.type) {\n case 'prerender-client':\n case 'validation-client':\n const expression = '\"use cache\"'\n throw new InvariantError(\n `${expression} must not be used within a client component. Next.js should be preventing ${expression} from being allowed in client components statically, but did not in this case.`\n )\n case 'cache': {\n // Eagerly capture this invocation's call site while still synchronous\n // in `cache()`. Used as `cause` of the nested-dynamic cache error\n // when the outer cache (whose body never re-runs during the final\n // prerender) throws. Only constructed when the parent is itself a\n // public `'use cache'` — otherwise this entry can never propagate\n // dynamism into that error and the allocation would be wasted. Private\n // parents are intentionally excluded: `'use cache: private'` is\n // dynamic-by-definition in prerendering and deferred to the runtime\n // stage in dev requests, so a public cache nested inside one never\n // triggers the throw upstream.\n const dynamicNestedCacheError = new NestedDynamicUseCacheError()\n Error.captureStackTrace(dynamicNestedCacheError, cache)\n applyOwnerStack(dynamicNestedCacheError)\n cacheContext = {\n kind: 'public',\n outerWorkUnitStore: workUnitStore,\n skipPropagation: false,\n outerOwnerStack,\n functionId: id,\n handlerKind: kind,\n dynamicNestedCacheError,\n }\n break\n }\n case 'prerender':\n case 'prerender-runtime':\n case 'prerender-legacy':\n case 'request':\n case 'private-cache':\n // TODO: We should probably forbid nesting \"use cache\" inside\n // unstable_cache. (fallthrough)\n case 'unstable-cache':\n case 'build-time-generator':\n cacheContext = {\n kind: 'public',\n outerWorkUnitStore: workUnitStore,\n skipPropagation: false,\n outerOwnerStack,\n functionId: id,\n handlerKind: kind,\n dynamicNestedCacheError: undefined,\n }\n break\n default:\n workUnitStore satisfies never\n // This is dead code, but without throwing an error here, TypeScript\n // will assume that cacheContext is used before being assigned.\n throw new InvariantError(`Unexpected work unit store.`)\n }\n }\n\n // Get the clientReferenceManifest while we're still in the outer Context.\n // In case getClientReferenceManifestSingleton is implemented using AsyncLocalStorage.\n const clientReferenceManifest = getClientReferenceManifest()\n\n const hangingInputAbortSignal = createHangingInputAbortSignal(workUnitStore)\n\n if (cacheContext.kind === 'private') {\n const { outerWorkUnitStore } = cacheContext\n switch (outerWorkUnitStore.type) {\n case 'prerender-runtime': {\n // In a runtime prerender, we have to make sure that APIs that would hang during a static prerender\n // are resolved with a delay, in the appropriate runtime stage.\n const stagedRendering = outerWorkUnitStore.stagedRendering\n if (stagedRendering) {\n await stagedRendering.waitForStage(\n RENDER_STAGES_BY_DATA_KIND.sessionData\n )\n }\n break\n }\n case 'request': {\n if (isValidationRender(outerWorkUnitStore)) {\n // Similar to runtime prerenders, private caches should not resolve in the static stage\n // of a validation request, so we delay them.\n await makeDevtoolsIOAwarePromise(\n undefined,\n outerWorkUnitStore,\n RENDER_STAGES_BY_DATA_KIND.sessionData\n )\n }\n break\n }\n case 'private-cache':\n break\n default: {\n outerWorkUnitStore satisfies never\n }\n }\n }\n\n let isPageOrLayoutSegmentFunction = false\n\n // For page and layout segment functions (i.e. the page/layout component,\n // or generateMetadata/generateViewport), the cache function is\n // overwritten, which allows us to apply special handling for params and\n // searchParams. For pages and layouts we're using the outer params prop,\n // and not the inner one that was serialized/deserialized. While it's not\n // generally true for \"use cache\" args, in the case of `params` the inner\n // and outer object are essentially equivalent, so this is safe to do\n // (including fallback params that are hanging promises). It allows us to\n // avoid waiting for the timeout, when prerendering a fallback shell of a\n // cached page or layout that awaits params.\n if (isPageSegmentFunction(args)) {\n isPageOrLayoutSegmentFunction = true\n\n const [\n { params: outerParams, searchParams: outerSearchParams },\n ...otherOuterArgs\n ] = args\n\n const props: UseCachePageInnerProps = {\n params: outerParams,\n // Omit searchParams and $$isPage.\n }\n\n if (isPrivate) {\n // Private caches allow accessing search params. We need to include\n // them in the serialized args and when generating the cache key.\n props.searchParams = outerSearchParams\n }\n\n args = [props, ...otherOuterArgs]\n\n fn = {\n [name]: async (_: UseCachePageInnerProps, ...otherInnerArgs: unknown[]) =>\n originalFn.apply(null, [\n {\n params: props.params,\n searchParams:\n // Preserve the original search params, if this cache can access them.\n // Notably, in a runtime shell private caches can resolve, but search params\n // will be hanging, and we need to preserve the original proxied promise object\n // to trigger `dynamicAccessAbortSignal` when they're accessed.\n props.searchParams ??\n // For public caches, search params are omitted from the cache\n // key (and the serialized args) to avoid mismatches between\n // prerendering and resuming a cached page that does not\n // access search params. This is also the reason why we're not\n // using a hanging promise for search params. For cached pages\n // that do access them, which is an invalid dynamic usage, we\n // need to ensure that an error is shown.\n makeErroringSearchParamsForUseCache(),\n },\n ...otherInnerArgs,\n ]),\n }[name] as (...args: unknown[]) => Promise\n } else if (isLayoutSegmentFunction(args)) {\n isPageOrLayoutSegmentFunction = true\n\n const [\n { params: outerParams, $$isLayout, ...outerSlots },\n ...otherOuterArgs\n ] = args\n\n // Overwrite the props to omit $$isLayout. Note that slots are only\n // passed to the layout component (if any are defined), and not to\n // generateMetadata nor generateViewport. For those functions,\n // outerSlots/innerSlots is an empty object, which is fine because we're\n // just spreading it into the props.\n args = [{ params: outerParams, ...outerSlots }, ...otherOuterArgs]\n\n fn = {\n [name]: async (\n {\n params: _innerParams,\n ...innerSlots\n }: Omit,\n ...otherInnerArgs: unknown[]\n ) =>\n originalFn.apply(null, [\n { params: outerParams, ...innerSlots },\n ...otherInnerArgs,\n ]),\n }[name] as (...args: unknown[]) => Promise\n }\n\n if (boundArgsLength > 0) {\n if (args.length === 0) {\n throw new InvariantError(\n `Expected the \"use cache\" function ${JSON.stringify(fn.name)} to receive its encrypted bound arguments as the first argument.`\n )\n }\n\n const encryptedBoundArgs = args.shift() as Promise\n const boundArgs = await decryptActionBoundArgs(id, encryptedBoundArgs)\n\n if (!Array.isArray(boundArgs)) {\n throw new InvariantError(\n `Expected the bound arguments of \"use cache\" function ${JSON.stringify(fn.name)} to deserialize into an array, got ${typeof boundArgs} instead.`\n )\n }\n\n if (boundArgsLength !== boundArgs.length) {\n throw new InvariantError(\n `Expected the \"use cache\" function ${JSON.stringify(fn.name)} to receive ${boundArgsLength} bound arguments, got ${boundArgs.length} instead.`\n )\n }\n\n args.unshift(boundArgs)\n }\n\n const temporaryReferences = createClientTemporaryReferenceSet()\n\n // The base serialized cache key doesn't include runtime env var state or the\n // cookies and headers that private caches are allowed to read. Env var state\n // only scopes the cache handler because the RDC must reuse entries across\n // rendering phases. In production private cache entries aren't stored in a\n // cache handler, only in the Resume Data Cache (RDC): private caches are only\n // used during dynamic requests and runtime prefetches; for dynamic requests\n // the RDC is immutable and excludes private caches, and for runtime prefetches\n // it's mutable but lives only as long as the request. In development private\n // caches are persisted across requests, so `cacheHandlerKeyBase` (below)\n // additionally scopes the handler key by the request's cookies and headers.\n const { implementationPart, runtimeEnvVarStateHash } =\n await computeCacheKeyImplementationPart(workStore, workUnitStore, id)\n const cacheKeyParts: CacheKeyParts = [id, args, implementationPart]\n\n const encodeCacheKeyParts = () =>\n encodeReply(cacheKeyParts, {\n temporaryReferences,\n signal: hangingInputAbortSignal,\n })\n\n let encodedCacheKeyParts: FormData | string\n\n switch (workUnitStore.type) {\n case 'prerender-runtime':\n // A runtime prerender may be a runtime shell, which does not have access to\n // params/searchParams, so we want to apply the same dynamic access logic\n // as we do in static prerenders.\n // fallthrough\n case 'prerender':\n if (!isPageOrLayoutSegmentFunction) {\n // If the \"use cache\" function is not a page or layout segment\n // function, we need to track dynamic access already when encoding\n // the arguments. If params are passed explicitly into a \"use cache\"\n // function (as opposed to receiving them automatically in a page or\n // layout), we assume that the params are also accessed. This allows\n // us to abort early, and treat the function as dynamic, instead of\n // waiting for the timeout to be reached.\n const dynamicAccessStore: DynamicAccessAsyncStore = {\n abortController: new AbortController(),\n reason: null,\n }\n\n encodedCacheKeyParts = await dynamicAccessAsyncStorage.run(\n dynamicAccessStore,\n encodeCacheKeyParts\n )\n\n if (dynamicAccessStore.abortController.signal.aborted) {\n const makeHangingPromise =\n dynamicAccessStore.reason === 'fallback-params'\n ? makeFallbackParamsHangingPromise\n : makeURLDataHangingPromise\n return makeHangingPromise(\n workUnitStore.renderSignal,\n workStore.route,\n 'dynamic \"use cache\"',\n workUnitStore\n )\n }\n break\n }\n // fallthrough\n case 'prerender-legacy':\n case 'request':\n // TODO(restart-on-cache-miss): We need to handle params/searchParams on page components.\n // the promises will be tasky, so `encodeCacheKeyParts` will not resolve in the static stage.\n // We have not started a cache read at this point, so we might just miss the cache completely.\n // fallthrough\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'build-time-generator':\n case undefined:\n encodedCacheKeyParts = await encodeCacheKeyParts()\n break\n default:\n return workUnitStore satisfies never\n }\n\n // Probe path: we're running inside a pooled worker spawned by the dev\n // server to check whether a stalled cache fill would complete in an\n // isolated module scope. Skip the RDC / cache-handler / leader-election\n // machinery, call `generateCacheEntry` (same as a real cold fill), drain\n // the returned stream via `pendingCacheResult`, and apply the probe's own\n // timeout. The caller only cares whether the fill resolves; the result\n // value is discarded.\n //\n // Gated on `__NEXT_DEV_SERVER` so the entire branch — including its\n // `generateCacheEntry` call site and the threading of\n // `deadlockError` — drops out of the production runtime\n // bundle.\n if (process.env.__NEXT_DEV_SERVER && workStore.useCacheProbeMode) {\n // Both public and private caches probe via the same path. The worker\n // reconstructs real `headers` / `cookies` / `draftMode` from the\n // forwarded request snapshot, so private caches that legitimately read\n // those work in the probe just like in the real fill.\n const probeTimeoutMs = workStore.useCacheProbeMode.timeoutMs\n // The deadlock error never gets thrown from inside the worker: the\n // worker's outer store has `cacheSignal: undefined`, so\n // `generateCacheEntryImpl` skips the dev-request branch and the idle\n // probe is never set up.\n const result = await generateCacheEntry(\n workStore,\n cacheContext,\n clientReferenceManifest,\n encodedCacheKeyParts,\n fn,\n timeoutError,\n undefined\n )\n if (result.type === 'prerender-dynamic') {\n // Unreachable in the probe: outer store is `'request'`-typed, which\n // never produces this variant.\n throw new InvariantError(\n 'Unexpected `prerender-dynamic` result in `use cache` probe mode.'\n )\n }\n // We don't consume the returned stream — `pendingCacheResult` is what\n // completes when `collectResult` has drained `savedStream`. Cancel the\n // unused copy so it doesn't buffer forever.\n result.stream.cancel().catch(() => {})\n let probeTimeoutTimer: ReturnType | undefined\n try {\n await Promise.race([\n result.pendingCacheResult,\n new Promise((_, reject) => {\n probeTimeoutTimer = setTimeout(\n () => reject(timeoutError),\n probeTimeoutMs\n )\n }),\n ])\n } finally {\n if (probeTimeoutTimer !== undefined) {\n clearTimeout(probeTimeoutTimer)\n }\n }\n return\n }\n\n const serializedCacheKey =\n typeof encodedCacheKeyParts === 'string'\n ? // Fast path for the simple case for simple inputs. We let the CacheHandler\n // Convert it to an ArrayBuffer if it wants to.\n encodedCacheKeyParts\n : await encodeFormData(encodedCacheKeyParts)\n\n const rootParams = workUnitStore.rootParams\n const knownRootParamNames = knownRootParamsByFunctionId.get(id)\n\n // The coarse cache-handler key. With no root params read, it locates the\n // entry directly; otherwise it locates a redirect entry from which the\n // specific key (this key + root params, computed below) is derived. It's\n // scoped by runtime env var state and, for private caches in development\n // (persisted in the built-in in-memory handler), the request's cookies and\n // headers. Keys derived from it inherit that scoping.\n const cacheHandlerKeyBase =\n serializedCacheKey +\n (runtimeEnvVarStateHash ?? '') +\n (process.env.__NEXT_DEV_SERVER && cacheContext.kind === 'private'\n ? computePrivateCacheKeyRequestSuffix(\n cacheContext.outerWorkUnitStore.cookies,\n cacheContext.outerWorkUnitStore.headers\n )\n : '')\n // If we already know which root params this function reads, include them in\n // the cache handler key for a direct hit (skipping the redirect entry).\n // rootParams is undefined when nested inside unstable_cache.\n let cacheHandlerKey =\n knownRootParamNames && rootParams\n ? cacheHandlerKeyBase +\n computeRootParamsCacheKeySuffix(rootParams, knownRootParamNames)\n : cacheHandlerKeyBase\n\n let stream: undefined | ReadableStream = undefined\n\n // Set when a short-lived cache hit ends its cache read up front (dev only) so\n // the static-shell boundary doesn't count it as a phantom miss. Once set, the\n // cache signal read is balanced, so serving must use a plain stream and skip\n // any trailing cacheSignal.endRead() call.\n let cacheSignalReadEnded = false\n\n const resumeDataCache = getResumeDataCache(workUnitStore)\n\n const implicitTags = workUnitStore.implicitTags?.tags ?? []\n\n if (resumeDataCache) {\n // If this cache key was already determined to be dynamic during the\n // prospective prerender (e.g. because it accessed fallback params), we\n // return a hanging promise early to avoid trying to regenerate the entry,\n // which would be aborted anyway.\n let rdcEntry = resumeDataCache.cache.get(serializedCacheKey)\n if (\n rdcEntry === FALLBACK_PARAMS ||\n rdcEntry === RUNTIME_DATA ||\n rdcEntry === SESSION_DATA\n ) {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-runtime': {\n let makeHangingPromise\n if (rdcEntry === FALLBACK_PARAMS) {\n makeHangingPromise = makeFallbackParamsHangingPromise\n } else if (rdcEntry === SESSION_DATA) {\n makeHangingPromise = makeSessionDataHangingPromise\n } else {\n makeHangingPromise = makeURLDataHangingPromise\n }\n return makeHangingPromise(\n workUnitStore.renderSignal,\n workStore.route,\n 'dynamic \"use cache\"',\n workUnitStore\n )\n }\n case 'prerender-legacy':\n case 'request':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'build-time-generator':\n break\n default:\n workUnitStore satisfies never\n }\n // Requests may receive the in-memory cache too. Unlike a prerender, they\n // can resolve these holes, so treat a marker as an ordinary cache miss.\n rdcEntry = undefined\n }\n\n const cacheSignal = getCacheSignal(workUnitStore)\n\n if (cacheSignal) {\n cacheSignal.beginRead()\n }\n if (rdcEntry !== undefined) {\n let rdcResult: CollectedCacheResult | undefined = await rdcEntry\n\n // Check if the RDC entry should be discarded due to recently revalidated\n // tags. When a server action calls updateTag(), the re-render should see\n // fresh data instead of stale RDC data.\n if (rdcResult !== undefined) {\n const { timestamp } = rdcResult.entry\n\n if (\n rdcResult.entry.tags.some((tag) =>\n isRevalidatedAfter(tag, timestamp, workStore, logPrefix)\n ) ||\n implicitTags.some((tag) =>\n isRevalidatedAfter(tag, timestamp, workStore, logPrefix)\n )\n ) {\n debug?.(\n logPrefix,\n 'discarding RDC entry due to recently revalidated tags',\n serializedCacheKey\n )\n rdcResult = undefined\n }\n }\n\n if (rdcResult !== undefined) {\n if (\n rdcResult.entry.revalidate === 0 ||\n rdcResult.entry.expire < MIN_PRERENDERABLE_EXPIRE\n ) {\n // The nested-cache error only makes sense when a dynamic nested cache\n // actually shortened an outer cache that has no explicit `cacheLife`\n // (`dynamicNestedCacheError` is set), and only when the app's default\n // profile is itself prerenderable. If the default profile is already\n // dynamic (`revalidate: 0` or an `expire` under the prerenderable\n // minimum), every cache is omitted from prerenders by default, so\n // there is no silent degradation to warn about. A short life from the\n // default profile, or from a dev private cache's self-imposed\n // `revalidate: 0` (which never carries a nested error), therefore\n // stays a dynamic hole rather than erroring.\n const defaultCacheLife = workStore.cacheLifeProfiles.default\n const shouldReportNestedCacheError =\n rdcResult.dynamicNestedCacheError !== undefined &&\n defaultCacheLife.revalidate !== 0 &&\n defaultCacheLife.expire >= MIN_PRERENDERABLE_EXPIRE\n\n switch (workUnitStore.type) {\n case 'prerender':\n // In a Dynamic I/O prerender, if the cache entry has\n // revalidate: 0 or if the expire time is under 5 minutes,\n // then we consider this cache entry dynamic as it's not worth\n // generating static pages for such data. It's better to leave\n // a dynamic hole that can be filled in during the resume with\n // a potentially cached entry.\n if (rdcResult.entry.revalidate === 0) {\n if (\n rdcResult.hasExplicitRevalidate === false &&\n shouldReportNestedCacheError\n ) {\n throw wrapAsInvalidDynamicUsageError(\n createNestedCacheZeroRevalidateError(\n workStore.route,\n rdcResult.dynamicNestedCacheError\n )\n )\n }\n debug?.(\n logPrefix,\n 'omitting entry',\n serializedCacheKey,\n 'from static shell due to revalidate: 0'\n )\n } else {\n if (\n rdcResult.hasExplicitExpire === false &&\n shouldReportNestedCacheError\n ) {\n throw wrapAsInvalidDynamicUsageError(\n createNestedCacheShortExpireError(\n workStore.route,\n rdcResult.dynamicNestedCacheError\n )\n )\n }\n debug?.(\n logPrefix,\n 'omitting entry',\n serializedCacheKey,\n 'from static shell due to short expire value:',\n rdcResult.entry.expire\n )\n }\n if (cacheSignal) {\n cacheSignal.endRead()\n }\n // The entry is only excluded from *static* prerenders — the\n // 'prerender-runtime' case below serves it.\n // TODO(app-shells): Does this handle the MIN_SHELL_STALE case below correctly?\n return makeSessionDataHangingPromise(\n workUnitStore.renderSignal,\n workStore.route,\n 'dynamic \"use cache\"',\n workUnitStore\n )\n case 'prerender-runtime': {\n // In the final phase of a runtime prerender, we have to make\n // sure that APIs that would hang during a static prerender\n // are resolved with a delay, in the appropriate runtime stage.\n const stagedRendering = workUnitStore.stagedRendering\n if (stagedRendering) {\n await stagedRendering.waitForStage(\n RENDER_STAGES_BY_DATA_KIND.sessionData\n )\n }\n break\n }\n case 'request': {\n if (isValidationRender(workUnitStore)) {\n // These throws force an explicit cache life decision on an\n // outer cache that a nested cache would otherwise silently\n // shorten (see `shouldReportNestedCacheError` above). Otherwise\n // the short-lived entry is deferred as a dynamic hole below.\n if (\n rdcResult.entry.revalidate === 0 &&\n rdcResult.hasExplicitRevalidate === false &&\n shouldReportNestedCacheError\n ) {\n throw wrapAsInvalidDynamicUsageError(\n createNestedCacheZeroRevalidateError(\n workStore.route,\n rdcResult.dynamicNestedCacheError\n )\n )\n }\n if (\n rdcResult.entry.expire < MIN_PRERENDERABLE_EXPIRE &&\n rdcResult.hasExplicitExpire === false &&\n shouldReportNestedCacheError\n ) {\n throw wrapAsInvalidDynamicUsageError(\n createNestedCacheShortExpireError(\n workStore.route,\n rdcResult.dynamicNestedCacheError\n )\n )\n }\n // A short-lived entry is a dynamic hole, excluded from the\n // static shell, so we end the cache signal read here (the\n // prerender case does the same) to avoid this cache hit being\n // considered a cache miss when checking for pending cache reads\n // at staged rendering task boundaries. The value is deferred to\n // the runtime stage.\n if (cacheSignal && !cacheSignalReadEnded) {\n cacheSignal.endRead()\n cacheSignalReadEnded = true\n }\n\n await makeDevtoolsIOAwarePromise(\n undefined,\n workUnitStore,\n RENDER_STAGES_BY_DATA_KIND.sessionData\n )\n }\n break\n }\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'build-time-generator':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n if (rdcResult.entry.stale < MIN_SHELL_STALE) {\n // The entry's stale time is short enough that it's excluded from\n // shells. If it's below `MIN_PREFETCHABLE_STALE`, it's not worth\n // prefetching at all and is excluded from prerenders entirely,\n // leaving a dynamic hole that can be filled during the navigation.\n // Otherwise, it's still included in prerenders and cached\n // navigations, but it must not be part of an App Shell, which may\n // be reused on the client for longer than the entry's stale time.\n // We delay the entry to resolve in the post-shell (link data)\n // stage, which excludes both its content and its stale time from\n // the shell.\n const isPrefetchable = rdcResult.entry.stale >= MIN_PREFETCHABLE_STALE\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-runtime': {\n const prerenderStore = workUnitStore\n if (!isPrefetchable) {\n debug?.(\n logPrefix,\n 'omitting entry',\n serializedCacheKey,\n 'from shell due to short stale value:',\n rdcResult.entry.stale\n )\n if (cacheSignal) {\n cacheSignal.endRead()\n }\n // An unprefetchable entry (stale < MIN_PREFETCHABLE_STALE) is\n // excluded from all prerenders.\n return makeDynamicHangingPromise(\n prerenderStore.renderSignal,\n workStore.route,\n 'dynamic \"use cache\"'\n )\n } else {\n // This entry is prefetchable, but exluded from shells.\n\n const stagedRendering = prerenderStore.stagedRendering\n if (stagedRendering === null) {\n // Prospective prerender (no staging): do not delay, because if we didn't\n // have this entry in the RDC already, we wouldn't delay it either.\n } else {\n // Final prerender (with staging).\n // This entry cannot be part of the shell, so we delay it to the prefetch.\n let prefetchStage: AdvanceableRenderStage\n if (prerenderStore.type === 'prerender') {\n prefetchStage =\n RENDER_STAGES_BY_DATA_KIND.staticUrlData.static\n } else {\n prefetchStage = RENDER_STAGES_BY_DATA_KIND.runtimeUrlData\n }\n if (\n // If the prerender ends before the prefetch stage (because\n // render that only produces an App Shell), this cache\n // should be omitted entirely.\n stagedRendering.finalStage !== null &&\n stagedRendering.finalStage < prefetchStage\n ) {\n debug?.(\n logPrefix,\n 'omitting entry',\n serializedCacheKey,\n 'from shell due to short stale value:',\n rdcResult.entry.stale\n )\n if (cacheSignal) {\n cacheSignal.endRead()\n }\n // The entry was omitted only because this prerender ends\n // before the prefetch stage. Neither static nor runtime\n // app shells include it, so it does not count as a runtime\n // data access.\n return makePrefetchHangingPromise(\n prerenderStore.renderSignal,\n workStore.route,\n 'dynamic \"use cache\"'\n )\n } else {\n debug?.(\n logPrefix,\n 'delaying entry',\n serializedCacheKey,\n 'until the prefetch stage due to short stale value:',\n rdcResult.entry.stale\n )\n await stagedRendering.waitForStage(prefetchStage)\n }\n }\n }\n\n break\n }\n case 'request': {\n if (isValidationRender(workUnitStore)) {\n // End the cache signal read (once, in case an earlier block\n // already did) so the delayed value isn't counted as a pending\n // read at a staged rendering boundary.\n if (cacheSignal && !cacheSignalReadEnded) {\n cacheSignal.endRead()\n cacheSignalReadEnded = true\n }\n let stage: AdvanceableRenderStage\n if (!isPrefetchable) {\n // An unprefetchable entry is excluded from prerenders, so it\n // resolves in the dynamic stage.\n stage = RenderStage.Dynamic\n } else {\n // If the entry would be be excluded from the shell, treat it as\n // if it were static URL data.\n // (Note that this is still correct without PPF or in static shell validation,\n // where we don't use runtime shells and include static URL data)\n trackIncompatibleShellContent(\n workUnitStore,\n '\"use cache\" excluded from app shells due to a short staletime'\n )\n stage =\n RENDER_STAGES_BY_DATA_KIND.staticUrlData[\n workUnitStore.needsRuntimeShell ? 'runtime' : 'static'\n ]\n }\n debug?.(\n logPrefix,\n 'delaying entry',\n serializedCacheKey,\n `until after the ${RenderStage[stage]} stage due to short stale value:`,\n rdcResult.entry.stale\n )\n await makeDevtoolsIOAwarePromise(\n undefined,\n workUnitStore,\n stage\n )\n }\n break\n }\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'build-time-generator':\n break\n default:\n workUnitStore satisfies never\n }\n }\n }\n\n if (rdcResult !== undefined) {\n debug?.(logPrefix, 'Resume Data Cache entry found', serializedCacheKey)\n\n if (\n rdcResult.readRootParamNames &&\n rdcResult.readRootParamNames.size > 0\n ) {\n addKnownRootParamNames(id, rdcResult.readRootParamNames)\n }\n\n // We want to make sure we only propagate cache life & tags if the\n // entry was *not* omitted from the prerender. So we only do this\n // after the above early returns.\n propagateCacheEntryMetadata(cacheContext, {\n tags: rdcResult.entry.tags,\n revalidate: rdcResult.entry.revalidate,\n expire: rdcResult.entry.expire,\n stale: rdcResult.entry.stale,\n timestamp: rdcResult.entry.timestamp,\n hasExplicitRevalidate: rdcResult.hasExplicitRevalidate,\n hasExplicitExpire: rdcResult.hasExplicitExpire,\n readRootParamNames: rdcResult.readRootParamNames,\n dynamicNestedCacheError: rdcResult.dynamicNestedCacheError,\n })\n\n const [streamA, streamB] = rdcResult.entry.value.tee()\n rdcResult.entry.value = streamB\n\n if (cacheSignal && !cacheSignalReadEnded) {\n // When we have a cacheSignal we need to block on reading the cache\n // entry before ending the read.\n stream = createTrackedReadableStream(streamA, cacheSignal)\n } else {\n // The cache signal read was already ended for a short-lived deferral\n // (or there is no cacheSignal), so serve a plain stream.\n stream = streamA\n }\n } else {\n // Entry was discarded (e.g. due to recently revalidated tags)\n debug?.(\n logPrefix,\n 'Resume Data Cache entry discarded',\n serializedCacheKey\n )\n\n if (cacheSignal) {\n cacheSignal.endRead()\n }\n }\n } else {\n debug?.(\n logPrefix,\n 'Resume Data Cache entry not found',\n serializedCacheKey,\n `(${resumeDataCache.cache.size} entries)`\n )\n\n if (cacheSignal) {\n cacheSignal.endRead()\n }\n\n switch (workUnitStore.type) {\n case 'prerender':\n if (resumeDataCache?.mutable === false) {\n // We're prerendering a fallback shell whose Resume Data Cache is\n // the prefilled, read-only seed from a phase-1 prerender of a more-\n // specific sibling route. A miss here means the cache key depends\n // on a fallback param. We short-circuit to a dynamic hole (which\n // may produce an empty shell if there's no parent Suspense\n // boundary). Currently this also catches layouts and pages that\n // don't read params, which will be improved when we implement\n // NAR-136. Compared to the instrumentation-based params bailout we\n // also do here, this covers the case where params are transformed\n // with an async function before being passed into the \"use cache\"\n // function, which escapes the instrumentation.\n // The cache key depends on fallback params, which are URL data.\n return makeURLDataHangingPromise(\n workUnitStore.renderSignal,\n workStore.route,\n 'dynamic \"use cache\"',\n workUnitStore\n )\n }\n // fallthrough\n case 'prerender-runtime':\n if (!cacheSignal) {\n // This is the final prerender (cacheSignal is null), which means\n // all caches should have been warmed during the prospective\n // prerender. A cache miss here indicates that the cache key is\n // non-deterministic (e.g. due to unstable array order in the\n // arguments). Known dynamic keys (e.g. from fallback params) are\n // already handled by the early return above. We return a hanging\n // promise so this becomes a dynamic hole rather than generating a\n // broken cache entry that gets aborted.\n console.warn(new UnexpectedCacheMissError(workStore.route))\n // This is an anomaly (non-deterministic cache key), so we can't\n // know whether a runtime prerender would resolve it.\n return makeUnknownRuntimeDataHangingPromise(\n workUnitStore.renderSignal,\n workStore.route,\n 'dynamic \"use cache\"',\n workUnitStore\n )\n }\n break\n case 'prerender-legacy':\n case 'request':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'build-time-generator':\n break\n default:\n workUnitStore satisfies never\n }\n }\n }\n\n // Intra-request deduplication: Within a single request, root params are\n // fixed, so the coarse key (serializedCacheKey) is sufficient. If another\n // invocation in this request is already handling the same cache entry\n // (including the cache handler lookup and generation), we join it instead of\n // doing redundant work. This also saves cache handler `get` calls which may\n // be HTTP round-trips for remote handlers.\n if (stream === undefined) {\n const pendingInvocation =\n workStore.pendingCacheInvocations?.get(serializedCacheKey)\n\n // A pending invocation is joined unconditionally: its fill is shared, so\n // every joiner receives whatever that fill produces. A completed one is a\n // stored entry instead, so it is only reused when the caller hasn't asked\n // to bypass caches, and only if nothing has invalidated it since.\n const completedInvocation =\n pendingInvocation === undefined &&\n !shouldForceRevalidate(workStore, workUnitStore)\n ? workStore.completedCacheInvocations?.get(serializedCacheKey)\n : undefined\n\n const joinedInvocation = pendingInvocation ?? completedInvocation\n\n if (joinedInvocation) {\n const cacheSignal = getCacheSignal(workUnitStore)\n cacheSignal?.beginRead()\n\n debug?.(logPrefix, 'joining intra-request invocation', serializedCacheKey)\n const sharedCacheResult = await joinedInvocation\n\n if (sharedCacheResult.type === 'prerender-dynamic') {\n debug?.(\n logPrefix,\n 'joined invocation is prerender-dynamic',\n serializedCacheKey\n )\n if (resumeDataCache?.mutable) {\n // A nested-cache leader has no RDC. This consumer must carry the\n // omission reason into the final prerender instead of leaving an\n // unexplained miss that loses the fallback's prefetch hint.\n resumeDataCache.cache.set(\n serializedCacheKey,\n sharedCacheResult.reason\n )\n }\n cacheSignal?.endRead()\n return sharedCacheResult.hangingPromise\n }\n\n // A completed entry may have been invalidated since it was produced, by\n // an `updateTag()` in a server action earlier in this request. The\n // implicit tags expiration is passed as 0 because it cannot apply to a\n // retained entry: it is memoized for the request, so re-checking it\n // against an unchanged entry timestamp only repeats the answer the leader\n // already got.\n const metadata =\n completedInvocation === undefined\n ? undefined\n : await sharedCacheResult.entry.pendingMetadata\n\n if (\n metadata !== undefined &&\n shouldDiscardCacheEntry(\n metadata,\n workStore,\n workUnitStore,\n implicitTags,\n 0,\n logPrefix\n )\n ) {\n debug?.(\n logPrefix,\n 'discarding completed invocation',\n serializedCacheKey\n )\n workStore.completedCacheInvocations?.delete(serializedCacheKey)\n\n // This can take the signal's count to zero. The leader path below opens\n // a read again synchronously, before it awaits anything, which is what\n // stops a prerender from concluding that every cache read has settled\n // while a fill is still about to start.\n cacheSignal?.endRead()\n } else {\n debug?.(\n logPrefix,\n 'joined invocation resolved with cached entry',\n serializedCacheKey\n )\n\n stream = serveJoinedCacheEntry(\n sharedCacheResult.entry,\n serializedCacheKey,\n resumeDataCache,\n cacheContext,\n cacheSignal,\n logPrefix\n )\n }\n }\n }\n\n // Leader path: no pending intra-request invocation found. Check for a\n // cross-request pending invocation, or become the leader for both.\n if (stream === undefined) {\n const resolvableSharedCacheResult = new ResolvableSharedCacheResult()\n\n debug?.(\n logPrefix,\n 'registering as intra-request invocation leader',\n serializedCacheKey\n )\n const intraRequestPendingCacheInvocations =\n (workStore.pendingCacheInvocations ??= new Map<\n string,\n Promise\n >())\n\n // Retain the completed entry for the rest of the request where a later\n // invocation would otherwise repeat real work: private caches have no cache\n // handler to fall back on in production, and a platform- or config-supplied\n // handler may be remote, so a second `get` can be a round trip. A built-in\n // handler read is a map lookup, so retaining its entries would hold a\n // forked stream buffer for nothing.\n const completedCacheInvocations =\n isPrivate || !isBuiltInCacheHandler(kind)\n ? (workStore.completedCacheInvocations ??= new Map<\n string,\n Promise\n >())\n : undefined\n\n resolvableSharedCacheResult.registerIn(\n intraRequestPendingCacheInvocations,\n serializedCacheKey,\n completedCacheInvocations\n )\n\n // Cross-request deduplication lets concurrent requests for the same key\n // share a single fill. Private caches are skipped in production, where they\n // hold request-specific data that must not be shared across requests. In\n // development they're persisted and keyed by the request's cookies and\n // headers, so concurrent requests with identical request data should share\n // a fill too; that request-scoped `cacheHandlerKey` keeps requests with\n // different cookies or headers in separate entries.\n //\n // Draft mode requests are skipped as well, in both directions. A fill that\n // runs with draft mode enabled can contain unpublished content, so it must\n // not be registered for other requests to join. And a draft mode request\n // must not join a pending public fill, because it would be served the\n // published content instead of the draft.\n const skipCrossRequestDedupe =\n (isPrivate && !process.env.__NEXT_DEV_SERVER) || workStore.isDraftMode\n\n try {\n // The loop handles cross-request root param mismatches: when a\n // cross-request joiner discovers that the leader's root params differ\n // from its own, it retries with a recomputed cacheHandlerKey. The loop\n // exits when stream is assigned (cross-request joiner match or leader\n // path) or via early return (prerender-dynamic).\n while (stream === undefined) {\n const crossRequestPendingCacheInvocation = skipCrossRequestDedupe\n ? undefined\n : crossRequestPendingCacheInvocations.get(cacheHandlerKey)\n\n if (crossRequestPendingCacheInvocation) {\n const cacheSignal = getCacheSignal(workUnitStore)\n cacheSignal?.beginRead()\n\n debug?.(\n logPrefix,\n 'joining pending cross-request invocation',\n cacheHandlerKey\n )\n const sharedCacheResult = await crossRequestPendingCacheInvocation\n\n if (sharedCacheResult.type === 'cached') {\n // Verify root params before forking the stream. The shared\n // invocation must complete first, including collection and write\n // settlement. A changed key retries the handler lookup, which must\n // not run before the write settles.\n const metadata = await sharedCacheResult.entry.pendingCompletion\n\n // Ensure known root param names are up-to-date before verifying the\n // key, since the leader's save path may not have updated them yet\n // at this point.\n if (metadata.readRootParamNames) {\n addKnownRootParamNames(id, metadata.readRootParamNames)\n }\n\n const updatedRootParamNames = knownRootParamsByFunctionId.get(id)\n if (updatedRootParamNames && rootParams) {\n const newCacheHandlerKey =\n cacheHandlerKeyBase +\n computeRootParamsCacheKeySuffix(\n rootParams,\n updatedRootParamNames\n )\n\n if (newCacheHandlerKey !== cacheHandlerKey) {\n debug?.(\n logPrefix,\n 'cross-request root param mismatch, retrying',\n cacheHandlerKey,\n '→',\n newCacheHandlerKey\n )\n cacheSignal?.endRead()\n cacheHandlerKey = newCacheHandlerKey\n continue // stream is not used → retry with new key\n }\n }\n\n // Key matches — safe to fork.\n debug?.(\n logPrefix,\n 'cross-request invocation matched, forking result',\n cacheHandlerKey\n )\n cacheSignal?.endRead()\n stream = sharedCacheResult.entry.fork()\n maybePropagateCacheEntryMetadata(cacheContext, metadata)\n\n // The cross-request leader belongs to a different request with its\n // own RDC. Save to this request's RDC so its final prerender can\n // resume from the entry.\n saveSharedCacheEntryToResumeDataCache(\n serializedCacheKey,\n sharedCacheResult.entry,\n resumeDataCache,\n logPrefix\n )\n\n // Resolve for intra-request joiners in this request. They get\n // a fork from the same SharedCacheEntry.\n resolvableSharedCacheResult.resolve(sharedCacheResult)\n break\n } else {\n // prerender-dynamic — same root param check before hanging\n const updatedRootParamNames = knownRootParamsByFunctionId.get(id)\n if (updatedRootParamNames && rootParams) {\n const newCacheHandlerKey =\n cacheHandlerKeyBase +\n computeRootParamsCacheKeySuffix(\n rootParams,\n updatedRootParamNames\n )\n\n if (newCacheHandlerKey !== cacheHandlerKey) {\n debug?.(\n logPrefix,\n 'cross-request root param mismatch, retrying',\n cacheHandlerKey,\n '→',\n newCacheHandlerKey\n )\n cacheSignal?.endRead()\n cacheHandlerKey = newCacheHandlerKey\n continue\n }\n }\n\n debug?.(\n logPrefix,\n 'cross-request invocation is prerender-dynamic',\n cacheHandlerKey\n )\n if (resumeDataCache?.mutable) {\n resumeDataCache.cache.set(\n serializedCacheKey,\n sharedCacheResult.reason\n )\n }\n cacheSignal?.endRead()\n resolvableSharedCacheResult.resolve(sharedCacheResult)\n return sharedCacheResult.hangingPromise\n }\n }\n\n // No pending cross-request invocation — become the leader.\n if (!skipCrossRequestDedupe) {\n debug?.(\n logPrefix,\n 'registering as cross-request invocation leader',\n cacheHandlerKey\n )\n resolvableSharedCacheResult.registerIn(\n crossRequestPendingCacheInvocations,\n cacheHandlerKey\n )\n }\n\n const cacheSignal = getCacheSignal(workUnitStore)\n if (cacheSignal) {\n // Either the cache handler or the generation can be using I/O at this\n // point. We need to track when they start and when they complete.\n cacheSignal.beginRead()\n }\n\n const lazyRefreshTags = workStore.refreshTagsByCacheKind.get(kind)\n\n if (lazyRefreshTags && !isResolvedLazyResult(lazyRefreshTags)) {\n await lazyRefreshTags\n }\n\n let entry: CacheEntry | undefined\n let observedRevalidation: Promise | undefined\n\n // We ignore existing cache entries when force revalidating.\n if (cacheHandler && !shouldForceRevalidate(workStore, workUnitStore)) {\n // Record an existing revalidation before `get()` so a stale result\n // does not start another revalidation. The existing revalidation may\n // finish and remove its map entry before the lookup returns.\n observedRevalidation = backgroundRevalidations.get(cacheHandlerKey)\n entry = await cacheHandler.get(cacheHandlerKey, implicitTags)\n\n // Check if this is a redirect entry (coarse key → specific key).\n // Redirect entries have private tags encoding the root param names\n // (one tag per param name, prefixed with _N_RP_).\n if (entry && rootParams) {\n const paramNames = new Set()\n for (const tag of entry.tags) {\n if (tag.startsWith(NEXT_CACHE_ROOT_PARAM_TAG_ID)) {\n paramNames.add(tag.slice(NEXT_CACHE_ROOT_PARAM_TAG_ID.length))\n }\n }\n if (paramNames.size > 0) {\n addKnownRootParamNames(id, paramNames)\n cacheHandlerKey =\n cacheHandlerKeyBase +\n computeRootParamsCacheKeySuffix(rootParams, paramNames)\n observedRevalidation =\n backgroundRevalidations.get(cacheHandlerKey)\n entry = await cacheHandler.get(cacheHandlerKey, implicitTags)\n }\n }\n }\n\n if (entry) {\n let implicitTagsExpiration = 0\n\n if (workUnitStore.implicitTags) {\n const lazyExpiration =\n workUnitStore.implicitTags.expirationsByCacheKind.get(kind)\n\n if (lazyExpiration) {\n const expiration = isResolvedLazyResult(lazyExpiration)\n ? lazyExpiration.value\n : await lazyExpiration\n\n // If a cache handler returns an expiration time of Infinity, it\n // signals to Next.js that it handles checking cache entries for\n // staleness based on the expiration of the implicit tags passed\n // into the `get` method. In this case, we keep the default of 0,\n // which means that the implicit tags are not considered expired.\n if (expiration < Infinity) {\n implicitTagsExpiration = expiration\n }\n }\n }\n\n if (\n shouldDiscardCacheEntry(\n entry,\n workStore,\n workUnitStore,\n implicitTags,\n implicitTagsExpiration,\n logPrefix\n )\n ) {\n debug?.(logPrefix, 'discarding expired entry', cacheHandlerKey)\n entry = undefined\n }\n }\n\n const currentTime = performance.timeOrigin + performance.now()\n if (\n entry !== undefined &&\n (entry.revalidate === 0 || entry.expire < MIN_PRERENDERABLE_EXPIRE)\n ) {\n switch (workUnitStore.type) {\n case 'prerender':\n // In a Dynamic I/O prerender, if the cache entry has revalidate:\n // 0 or if the expire time is under 5 minutes, then we consider\n // this cache entry dynamic as it's not worth generating static\n // pages for such data. It's better to leave a dynamic hole that\n // can be filled in during the resume with a potentially cached\n // entry.\n if (entry.revalidate === 0) {\n debug?.(\n logPrefix,\n 'omitting entry',\n cacheHandlerKey,\n 'from static shell due to revalidate: 0'\n )\n } else {\n debug?.(\n logPrefix,\n 'omitting entry',\n cacheHandlerKey,\n 'from static shell due to short expire value:',\n entry.expire\n )\n }\n if (cacheSignal) {\n cacheSignal.endRead()\n }\n\n // The entry is only excluded from *static* prerenders. A runtime\n // shell or prefetch would include this content.\n // TODO(app-shells): Does this handle the MIN_SHELL_STALE case below correctly?\n const hangingPromise = makeSessionDataHangingPromise(\n workUnitStore.renderSignal,\n workStore.route,\n 'dynamic \"use cache\"',\n workUnitStore\n )\n debug?.(\n logPrefix,\n 'leader resolved as prerender-dynamic',\n cacheHandlerKey\n )\n resolvableSharedCacheResult.resolve({\n type: 'prerender-dynamic',\n reason: SESSION_DATA,\n hangingPromise,\n })\n return hangingPromise\n case 'request': {\n if (isValidationRender(workUnitStore)) {\n // A short-lived entry is a dynamic hole, excluded from the\n // static shell, so we end the cache signal read here (the\n // prerender case does the same) to avoid this cache hit being\n // considered a cache miss when checking for pending cache reads\n // at staged rendering task boundaries. The value is deferred to\n // the runtime stage.\n if (cacheSignal && !cacheSignalReadEnded) {\n cacheSignal.endRead()\n cacheSignalReadEnded = true\n }\n const stage = RENDER_STAGES_BY_DATA_KIND.sessionData\n debug?.(\n logPrefix,\n 'delaying entry',\n serializedCacheKey,\n `until after the ${RenderStage[stage]} stage due to short expire value:`,\n entry.expire\n )\n await makeDevtoolsIOAwarePromise(\n undefined,\n workUnitStore,\n RENDER_STAGES_BY_DATA_KIND.sessionData\n )\n }\n break\n }\n case 'prerender-runtime':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'build-time-generator':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n if (entry !== undefined && entry.stale < MIN_SHELL_STALE) {\n const isPrefetchable = entry.stale >= MIN_PREFETCHABLE_STALE\n switch (workUnitStore.type) {\n case 'request': {\n // Same as the resume data cache read path: the entry's stale\n // time is short enough that it's excluded from shells, or, if\n // it's below `MIN_PREFETCHABLE_STALE`, from prerenders\n // entirely.\n if (isValidationRender(workUnitStore)) {\n // End the cache signal read (once, in case the expire block\n // above already did) so the delayed value isn't counted as a\n // pending read at a staged rendering boundary.\n if (cacheSignal && !cacheSignalReadEnded) {\n cacheSignal.endRead()\n cacheSignalReadEnded = true\n }\n let stage: AdvanceableRenderStage\n if (!isPrefetchable) {\n // An unprefetchable entry is excluded from prerenders, so it\n // resolves in the dynamic stage.\n stage = RenderStage.Dynamic\n } else {\n // If the entry would be be excluded from the shell, treat it as\n // if it were static URL data.\n // (Note that this is still correct without PPF or in static shell validation,\n // where we don't use runtime shells and include static URL data)\n trackIncompatibleShellContent(\n workUnitStore,\n '\"use cache\" excluded from app shells due to a short staletime'\n )\n stage =\n RENDER_STAGES_BY_DATA_KIND.staticUrlData[\n workUnitStore.needsRuntimeShell ? 'runtime' : 'static'\n ]\n }\n debug?.(\n logPrefix,\n 'delaying entry',\n serializedCacheKey,\n `until after the ${RenderStage[stage]} stage due to short stale value:`,\n entry.stale\n )\n await makeDevtoolsIOAwarePromise(\n undefined,\n workUnitStore,\n stage\n )\n }\n break\n }\n case 'prerender':\n case 'prerender-runtime':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'build-time-generator':\n // A handler read in a prerender context is a cache-filling read.\n // The stale exclusions for those are applied when the RDC is\n // read in the final prerender, so there's nothing to do here.\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n if (\n entry === undefined ||\n // In dev, the built-in default handler retains a short-`expire` entry\n // for at least `MIN_PRERENDERABLE_EXPIRE`, both when used directly\n // and when fronting a custom cache handler. Apply that same minimum\n // here so the retained entry is served and re-warmed in the\n // background (below), rather than blocking to regenerate it on every\n // read. The entry's real `expire` is untouched, so staging still\n // treats it as dynamic.\n currentTime >\n entry.timestamp +\n (process.env.__NEXT_DEV_SERVER\n ? Math.max(entry.expire, MIN_PRERENDERABLE_EXPIRE)\n : entry.expire) *\n 1000 ||\n (willConsumerServerCache(workUnitStore) &&\n currentTime > entry.timestamp + entry.revalidate * 1000)\n ) {\n // Miss. Generate a new result.\n\n // If the cache entry is stale and its consumer will persist the\n // result in a server cache, don't persist the stale entry into a new\n // cache. We're not time constrained here, so regenerate it now.\n\n // We need to run this inside a clean AsyncLocalStorage snapshot so\n // that the cache generation cannot read anything from the context\n // we're currently executing which might include request specific\n // things like cookies() inside a React.cache().\n // Note: It is important that we await at least once before this\n // because it lets us pop out of any stack specific contexts as well -\n // aka \"Sync\" Local Storage.\n\n if (entry) {\n if (currentTime > entry.timestamp + entry.expire * 1000) {\n debug?.(logPrefix, 'entry is expired', cacheHandlerKey)\n }\n\n if (\n willConsumerServerCache(workUnitStore) &&\n currentTime > entry.timestamp + entry.revalidate * 1000\n ) {\n debug?.(\n logPrefix,\n 'foreground revalidation, entry is stale',\n cacheHandlerKey\n )\n }\n }\n\n if (cacheSignal && cacheSignalReadEnded) {\n // A short-lived deferral above (a `revalidate` of zero or a short\n // expire, or a short stale time) already ended this read. We're now\n // regenerating the entry rather than serving it, and the generation\n // ends the read again once its entry is collected. Re-begin the\n // read here so the trailing `endRead` stays balanced instead of\n // over-decrementing the cache signal.\n cacheSignal.beginRead()\n cacheSignalReadEnded = false\n }\n\n const result = await generateCacheEntry(\n workStore,\n cacheContext,\n clientReferenceManifest,\n encodedCacheKeyParts,\n fn,\n timeoutError,\n deadlockError\n )\n\n if (result.type === 'prerender-dynamic') {\n debug?.(\n logPrefix,\n 'leader resolved as prerender-dynamic (generation)',\n cacheHandlerKey\n )\n if (resumeDataCache?.mutable) {\n resumeDataCache.cache.set(serializedCacheKey, result.reason)\n }\n resolvableSharedCacheResult.resolve(result)\n return result.hangingPromise\n }\n\n const { stream: newStream, pendingCacheResult } = result\n\n let pendingWrite: Promise | undefined\n\n // When draft mode is enabled, we must not save the cache entry.\n if (!workStore.isDraftMode) {\n const savedCacheResult = saveToResumeDataCache(\n resumeDataCache,\n serializedCacheKey,\n pendingCacheResult,\n logPrefix\n )\n\n if (cacheHandler) {\n pendingWrite = saveToCacheHandler(\n cacheHandler,\n id,\n cacheHandlerKeyBase,\n savedCacheResult,\n rootParams\n )\n workStore.pendingRevalidateWrites ??= []\n workStore.pendingRevalidateWrites.push(pendingWrite)\n }\n }\n\n debug?.(\n logPrefix,\n 'leader resolved with generated entry',\n cacheHandlerKey\n )\n\n const pendingMetadata: Promise =\n pendingCacheResult.then((collected) => ({\n tags: collected.entry.tags,\n revalidate: collected.entry.revalidate,\n expire: collected.entry.expire,\n stale: collected.entry.stale,\n timestamp: collected.entry.timestamp,\n hasExplicitRevalidate: collected.hasExplicitRevalidate,\n hasExplicitExpire: collected.hasExplicitExpire,\n readRootParamNames: collected.readRootParamNames,\n dynamicNestedCacheError: collected.dynamicNestedCacheError,\n }))\n\n const sharedCacheEntry = new SharedCacheEntry(\n newStream,\n pendingMetadata,\n pendingWrite\n )\n stream = sharedCacheEntry.fork()\n resolvableSharedCacheResult.resolve({\n type: 'cached',\n entry: sharedCacheEntry,\n })\n } else {\n const entryMetadata: CacheResultMetadata = {\n tags: entry.tags,\n revalidate: entry.revalidate,\n expire: entry.expire,\n stale: entry.stale,\n timestamp: entry.timestamp,\n readRootParamNames: knownRootParamsByFunctionId.get(id),\n // For pre-existing entries from cache handlers we don't know\n // whether they had explicit cache life values or not. But we only\n // need this information during prerendering when we produce new\n // entries, where the cache life of an inner cache may be propagated\n // to the outer one. In that case we use the RDC. So it's safe to\n // set this to undefined here.\n hasExplicitRevalidate: undefined,\n hasExplicitExpire: undefined,\n // The same applies to the dynamic nested cache error.\n dynamicNestedCacheError: undefined,\n }\n\n maybePropagateCacheEntryMetadata(cacheContext, entryMetadata)\n\n // We want to return this stream, even if it's stale.\n stream = entry.value\n\n // If we have a mutable resume data cache, we need to clone the entry\n // and add it to the resume data cache.\n if (resumeDataCache?.mutable) {\n const [entryLeft, entryRight] = cloneCacheEntry(entry)\n if (cacheSignal && !cacheSignalReadEnded) {\n stream = createTrackedReadableStream(entryLeft.value, cacheSignal)\n } else {\n // The read was already ended for a short-lived deferral (or there\n // is no cacheSignal), so serve a plain stream.\n stream = entryLeft.value\n }\n\n // The RDC is per-page and root params are fixed within a page, so\n // we always use the coarse key (without root param suffix).\n resumeDataCache.cache.set(\n serializedCacheKey,\n Promise.resolve({\n entry: entryRight,\n hasExplicitRevalidate: entryMetadata.hasExplicitRevalidate,\n hasExplicitExpire: entryMetadata.hasExplicitExpire,\n readRootParamNames: entryMetadata.readRootParamNames,\n dynamicNestedCacheError: entryMetadata.dynamicNestedCacheError,\n })\n )\n } else if (!cacheSignalReadEnded) {\n // If we're not regenerating we need to signal that we've finished\n // putting the entry into the cache scope at this point. Otherwise\n // we do that inside generateCacheEntry. (Skipped when the read was\n // already ended for a short-lived deferral.)\n cacheSignal?.endRead()\n }\n\n debug?.(\n logPrefix,\n 'leader resolved with cache handler hit',\n cacheHandlerKey\n )\n\n const sharedCacheEntry = new SharedCacheEntry(\n stream,\n Promise.resolve(entryMetadata),\n undefined\n )\n stream = sharedCacheEntry.fork()\n resolvableSharedCacheResult.resolve({\n type: 'cached',\n entry: sharedCacheEntry,\n })\n\n // Trigger a background revalidation when the entry is stale (past its\n // `revalidate`), so the next read gets a fresh value without blocking\n // this one. Development additionally re-warms on every dynamic\n // request render in two cases where the dev in-memory entry would\n // otherwise read back as fresh, so a subsequent reload still shows a\n // fresh value. The first is with the in-memory cache disabled\n // (`cacheMaxMemorySize: 0`), where built-in entries keep their\n // resolved (potentially non-dynamic) cache life. The second is a\n // short-`expire` entry (an explicit dynamic or client-only cache,\n // e.g. `cacheLife({ expire: 0 })`), which is retained for at least\n // `MIN_PRERENDERABLE_EXPIRE` so it is served from the cache; this\n // also covers custom handlers, re-executing and writing through to\n // the backing.\n let shouldTriggerBackgroundRevalidation =\n currentTime > entry.timestamp + entry.revalidate * 1000\n if (\n !shouldTriggerBackgroundRevalidation &&\n process.env.__NEXT_DEV_SERVER &&\n (entry.expire < MIN_PRERENDERABLE_EXPIRE ||\n (isMemoryCacheDisabled() && !isCustomCacheHandler(kind)))\n ) {\n switch (workUnitStore.type) {\n case 'request':\n shouldTriggerBackgroundRevalidation = true\n break\n case 'cache':\n case 'private-cache':\n case 'prerender':\n case 'prerender-runtime':\n case 'prerender-legacy':\n case 'unstable-cache':\n case 'build-time-generator':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n if (\n shouldTriggerBackgroundRevalidation &&\n // The revalidation observed before the lookup may have finished.\n observedRevalidation === undefined &&\n // A new revalidation may have started since the lookup began.\n !backgroundRevalidations.has(cacheHandlerKey)\n ) {\n const revalidateCacheHandlerKey = cacheHandlerKey\n // Defer the call so synchronous setup errors reject the background\n // task instead of failing the stale response. This also lets us\n // register the task before generation starts.\n const revalidatePromise = Promise.resolve()\n .then(() =>\n generateCacheEntry(\n workStore,\n // The background revalidation preserves the outer store for\n // reading (e.g. implicitTags) but skips propagation of cache\n // life and tags back to the outer scope.\n { ...cacheContext, skipPropagation: true },\n clientReferenceManifest,\n encodedCacheKeyParts,\n fn,\n timeoutError,\n deadlockError\n )\n )\n .then(async (result) => {\n if (result.type === 'cached') {\n const { stream: ignoredStream, pendingCacheResult } = result\n\n const savedCacheResult = saveToResumeDataCache(\n resumeDataCache,\n serializedCacheKey,\n pendingCacheResult,\n logPrefix\n )\n\n const pendingWrite = cacheHandler\n ? saveToCacheHandler(\n cacheHandler,\n id,\n cacheHandlerKeyBase,\n savedCacheResult,\n rootParams\n )\n : savedCacheResult.then(() => {})\n\n for (const completion of await Promise.allSettled([\n ignoredStream.cancel(),\n pendingWrite,\n ])) {\n if (completion.status === 'rejected') {\n throw completion.reason\n }\n }\n }\n })\n .finally(() => {\n if (\n backgroundRevalidations.get(revalidateCacheHandlerKey) ===\n revalidatePromise\n ) {\n backgroundRevalidations.delete(revalidateCacheHandlerKey)\n }\n })\n backgroundRevalidations.set(\n revalidateCacheHandlerKey,\n revalidatePromise\n )\n revalidatePromise.catch((error) => {\n debug?.(\n logPrefix,\n 'background cache revalidation failed for',\n revalidateCacheHandlerKey,\n error\n )\n })\n workStore.pendingRevalidateWrites ??= []\n workStore.pendingRevalidateWrites.push(revalidatePromise)\n }\n }\n }\n } catch (error) {\n resolvableSharedCacheResult.reject(error)\n throw error\n }\n }\n\n // Logs are replayed even if it's a hit - to ensure we see them on the client eventually.\n // If we didn't then the client wouldn't see the logs if it was seeded from a prewarm that\n // never made it to the client. However, this also means that you see logs even when the\n // cached function isn't actually re-executed. We should instead ensure prewarms always\n // make it to the client. Another issue is that this will cause double logging in the\n // server terminal. Once while generating the cache entry and once when replaying it on\n // the server, which is required to pick it up for replaying again on the client.\n const replayConsoleLogs = true\n\n const serverConsumerManifest = {\n // moduleLoading must be null because we don't want to trigger preloads of ClientReferences\n // to be added to the consumer. Instead, we'll wait for any ClientReference to be emitted\n // which themselves will handle the preloading.\n moduleLoading: null,\n moduleMap: getRscModuleMappingForUseCache(),\n serverModuleMap: getServerModuleMap(),\n }\n\n return createFromReadableStream(stream, {\n findSourceMapURL,\n serverConsumerManifest,\n temporaryReferences,\n replayConsoleLogs,\n environmentName: 'Cache',\n })\n}\n\n/**\n * This returns cache key parts that cover everything that can affect the result of the cached\n * function (apart from the arguments). The implementation part is used by both the RDC and cache\n * handler, while the runtime env var state hash is only used by the cache handler. The RDC is\n * per-page and must reuse entries across rendering phases even if an env var changes between them.\n *\n * The parts cover:\n * - codeHash: the code itself that generates the return value\n * - Notably, this excludes the following modules. Those are included via the Next.js version anyway:\n * - react, react-dom, private-next-rsc-server-reference, private-next-rsc-cache-wrapper\n * - runtimeEnvVarsRead: the keys and values of runtime environment variables that the code reads\n * - runtimeEnvVarExistence: the unset/falsy/truthy state of runtime environment variables used in boolean contexts\n * - the version of Next.js (to account for RSC wire format changes, or use-cache-wrapper.ts changes)\n *\n * In case that granular information isn't available, fall back to\n * buildId/deploymentId/hmrRefreshHash, which is a correct hash but over-invalidates way too often.\n */\nasync function computeCacheKeyImplementationPart(\n workStore: WorkStore,\n workUnitStore: WorkUnitStore,\n id: string\n): Promise<{\n implementationPart: unknown\n runtimeEnvVarStateHash: string | undefined\n}> {\n let durability = workStore.durableUseCacheEntries\n ? getServerActionsManifest().node[id].workers?.[\n normalizeWorkerPageName(workStore.page)\n ]?.durability\n : undefined\n if (durability) {\n // use cache is only supported in Node.js runtime. So we can use the Node.js crypto module here.\n const crypto = require('crypto') as typeof import('crypto')\n let runtimeEnvVarStateHash = crypto\n // Hash the env var values, to not leak secrets into the cache key.\n .createHash('sha256')\n .update(\n [\n ...durability.runtimeEnvVarsRead.map((k) => {\n // Make sure not to stringify `undefined` and `\"undefined\"` to the same value.\n return process.env[k] != null ? `${k}==${process.env[k]}` : k\n }),\n ...durability.runtimeEnvVarsExistence.map((k) => {\n const value = process.env[k]\n const state = value == null ? 'unset' : value ? 'truthy' : 'falsy'\n return `${k}~=${state}`\n }),\n ].join('\\0') ?? ''\n )\n .digest('hex')\n\n // The env var state is added to the cache handler key separately so it\n // doesn't affect RDC lookups between rendering phases.\n return {\n implementationPart: [durability.codeHash, nextVersion],\n runtimeEnvVarStateHash,\n }\n } else {\n // Because the Action ID is not yet unique per implementation of that Action we can't\n // safely reuse the results across builds yet. In the meantime we add the buildId to the\n // arguments as a seed to ensure they're not reused. Remove this once Action IDs hash\n // the implementation.\n const buildId = workStore.deploymentId || workStore.buildId\n\n // In dev mode, when the HMR refresh hash is set, we include it in the\n // cache key. This ensures that cache entries are not reused when server\n // components have been edited. This is a very coarse approach. But it's\n // also only a temporary solution until Action IDs are unique per\n // implementation. Remove this once Action IDs hash the implementation.\n const hmrRefreshHash = getHmrRefreshHash(workUnitStore)\n\n // otherwise fall back to buildId and/or the HMR hash.\n return {\n implementationPart: hmrRefreshHash\n ? [buildId, hmrRefreshHash]\n : [buildId],\n runtimeEnvVarStateHash: undefined,\n }\n }\n}\n\n/**\n * A request store in `next start` never delays caches.\n * We only apply delays when the render will be used for\n * validation purposes.\n */\nfunction isValidationRender(requestStore: RequestStore): boolean {\n return !!(\n process.env.__NEXT_CACHE_COMPONENTS &&\n // In dev we're always running validation.\n (process.env.__NEXT_DEV_SERVER ||\n // Build-time instant validation also uses a 'request' store.\n requestStore.validationSamples)\n )\n}\n\n/**\n * Returns `true` if the `'use cache'` function is the page component itself,\n * or `generateMetadata`/`generateViewport` in a page file.\n */\nfunction isPageSegmentFunction(\n args: any[]\n): args is [UseCachePageProps, ...unknown[]] {\n const [maybeProps] = args\n\n return (\n maybeProps !== null &&\n typeof maybeProps === 'object' &&\n (maybeProps as UseCachePageProps).$$isPage === true\n )\n}\n\n/**\n * Returns `true` if the `'use cache'` function is the layout component itself,\n * or `generateMetadata`/`generateViewport` in a layout file.\n */\nfunction isLayoutSegmentFunction(\n args: any[]\n): args is [UseCacheLayoutProps, ...unknown[]] {\n const [maybeProps] = args\n\n return (\n maybeProps !== null &&\n typeof maybeProps === 'object' &&\n (maybeProps as UseCacheLayoutProps).$$isLayout === true\n )\n}\n\nfunction shouldForceRevalidate(\n workStore: WorkStore,\n workUnitStore: WorkUnitStore\n): boolean {\n if (workStore.isOnDemandRevalidate || workStore.isDraftMode) {\n return true\n }\n\n if (process.env.__NEXT_DEV_SERVER) {\n switch (workUnitStore.type) {\n case 'request':\n return workUnitStore.headers.get('cache-control') === 'no-cache'\n case 'cache':\n case 'private-cache':\n return workUnitStore.forceRevalidate\n case 'prerender-runtime':\n case 'prerender':\n case 'prerender-client':\n case 'validation-client':\n case 'prerender-legacy':\n case 'unstable-cache':\n case 'build-time-generator':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n return false\n}\n\nfunction shouldDiscardCacheEntry(\n entry: Pick,\n workStore: WorkStore,\n workUnitStore: WorkUnitStore,\n implicitTags: string[],\n implicitTagsExpiration: number,\n logPrefix: string\n): boolean {\n // If the cache entry was created before any of the implicit tags were\n // revalidated last, we need to discard it.\n if (entry.timestamp <= implicitTagsExpiration) {\n debug?.(\n logPrefix,\n 'entry was created at',\n entry.timestamp,\n 'before implicit tags were revalidated at',\n implicitTagsExpiration\n )\n\n return true\n }\n\n // During prerendering, we ignore recently revalidated tags. In dev mode, we\n // can assume that the dynamic dev rendering will have discarded and recreated\n // the affected cache entries, and we don't want to discard those again during\n // the prerender validation. During build-time prerendering, there will never\n // be any pending revalidated tags.\n switch (workUnitStore.type) {\n case 'prerender':\n return false\n case 'prerender-runtime':\n case 'prerender-client':\n case 'validation-client':\n case 'prerender-legacy':\n case 'request':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'build-time-generator':\n break\n default:\n workUnitStore satisfies never\n }\n\n // If the cache entry contains revalidated tags that the cache handler might\n // not know about yet, we need to discard it.\n if (\n entry.tags.some((tag) =>\n isRevalidatedAfter(tag, entry.timestamp, workStore, logPrefix)\n )\n ) {\n return true\n }\n\n // Finally, if any of the implicit tags have been revalidated recently, we\n // also need to discard the cache entry.\n if (\n implicitTags.some((tag) =>\n isRevalidatedAfter(tag, entry.timestamp, workStore, logPrefix)\n )\n ) {\n return true\n }\n\n return false\n}\n\n/**\n * Whether `tag` was revalidated after an entry created at `entryTimestamp`,\n * which makes that entry stale. An entry produced after the revalidation\n * already reflects it and is still usable.\n */\nfunction isRevalidatedAfter(\n tag: string,\n entryTimestamp: number,\n workStore: WorkStore,\n logPrefix: string\n): boolean {\n const {\n previouslyRevalidatedTags,\n pendingRevalidatedTags,\n requestStartTime,\n } = workStore\n\n // Was the tag previously revalidated (e.g. by a redirecting server action)?\n // That happened in an earlier request and carries no timestamp of its own, so\n // it counts as having happened when this request started.\n if (\n entryTimestamp <= requestStartTime &&\n previouslyRevalidatedTags.includes(tag)\n ) {\n debug?.(logPrefix, 'tag', tag, 'was previously revalidated')\n\n return true\n }\n\n // It could also have been revalidated by the currently running server action.\n // In this case the revalidation might not have been fully propagated by a\n // remote cache handler yet, so we read it from the pending tags in the work\n // store.\n if (\n pendingRevalidatedTags?.some(\n (item) => item.tag === tag && item.revalidatedAt > entryTimestamp\n )\n ) {\n debug?.(logPrefix, 'tag', tag, 'was just revalidated')\n\n return true\n }\n\n return false\n}\n"],"names":["renderToReadableStream","decodeReply","decodeReplyFromAsyncIterable","createTemporaryReferenceSet","createServerTemporaryReferenceSet","createFromReadableStream","encodeReply","createClientTemporaryReferenceSet","prerender","workAsyncStorage","getHmrRefreshHash","getResumeDataCache","getVaryParamsAccumulator","workUnitAsyncStorage","getDraftModeProviderForCacheScope","getCacheSignal","isHmrRefresh","getServerComponentsHmrCache","willConsumerServerCache","accumulateVaryParam","applyOwnerStack","makeDevtoolsIOAwarePromise","makeDynamicHangingPromise","makeFallbackParamsHangingPromise","makeUntrackedHangingPromise","makeSessionDataHangingPromise","makeURLDataHangingPromise","makePrefetchHangingPromise","makeUnknownRuntimeDataHangingPromise","RENDER_STAGES_BY_DATA_KIND","trackFallbackParamsAccessed","trackURLDataAccessed","trackIncompatibleShellContent","trackPromiseUsed","getClientReferenceManifest","getRscModuleMappingForUseCache","getServerActionsManifest","getServerModuleMap","normalizeWorkerPageName","decryptActionBoundArgs","InvariantError","createReactServerErrorHandler","stringHash","MIN_PRERENDERABLE_EXPIRE","MIN_PREFETCHABLE_STALE","MIN_SHELL_STALE","NEXT_CACHE_ROOT_PARAM_TAG_ID","getCacheHandler","getDevTieredCacheHandler","getPrivateCacheHandler","isBuiltInCacheHandler","isCustomCacheHandler","isMemoryCacheDisabled","cloneCacheEntry","NEXT_INSTANT_TEST_COOKIE","RequestCookiesAdapter","HeadersAdapter","NestedDynamicUseCacheError","UnexpectedCacheMissError","UseCacheDeadlockError","UseCacheTimeoutError","createNestedCacheShortExpireError","createNestedCacheZeroRevalidateError","createUseCachePrivateInsidePublicUseCacheError","createUseCachePrivateInsideUnstableCacheError","createUseCachePrivateOutsideRequestContextError","createHangingInputAbortSignal","throwToInterruptStaticGeneration","makeErroringSearchParamsForUseCache","FALLBACK_PARAMS","RUNTIME_DATA","SESSION_DATA","createLazyResult","isResolvedLazyResult","abortOnDynamicAccess","dynamicAccessAsyncStorage","RenderStage","Log","getServerReact","getClientReact","createPromiseWithResolvers","nextVersion","process","env","__NEXT_VERSION","SharedCacheEntry","constructor","stream","pendingMetadata","pendingWrite","pendingCompletion","undefined","then","fork","forked","remaining","tee","ignoreReject","ResolvableSharedCacheResult","registerIn","map","key","retentionMap","set","deferred","promise","registrations","push","resolve","result","type","entry","cleanupAndRetain","cleanup","reject","error","catch","delete","crossRequestPendingCacheInvocations","Map","backgroundRevalidations","debug","NEXT_PRIVATE_DEBUG_CACHE","console","bind","filterStackFrame","NODE_ENV","require","filterStackFrameDEV","findSourceMapURL","findSourceMapURLDEV","knownRootParamsByFunctionId","addKnownRootParamNames","id","names","existing","get","name","add","created","Set","computeRootParamsCacheKeySuffix","rootParams","paramNames","size","JSON","stringify","sort","paramName","COOKIES_EXCLUDED_FROM_PRIVATE_CACHE_KEY","HEADERS_EXCLUDED_FROM_PRIVATE_CACHE_KEY","computePrivateCacheKeyRequestSuffix","cookies","headers","relevantCookies","getAll","filter","cookie","has","value","nameA","nameB","relevantHeaders","entries","length","saveToResumeDataCache","resumeDataCache","serializedCacheKey","pendingCacheResult","logPrefix","mutable","split","clonePendingCacheResult","savedCacheResult","getNthCacheResult","rdcResult","cache","saveSharedCacheEntryToResumeDataCache","sharedCacheEntry","existingEntry","metadata","tags","revalidate","expire","stale","timestamp","readRootParamNames","hasExplicitRevalidate","hasExplicitExpire","dynamicNestedCacheError","serveJoinedCacheEntry","cacheContext","cacheSignal","maybePropagateCacheEntryMetadata","finally","endRead","saveToCacheHandler","cacheHandler","cacheHandlerKeyBase","collectedResult","fullEntry","rootParamNames","setPromises","coarseEntry","specificKey","Promise","rootParamTags","ReadableStream","start","controller","enqueue","Uint8Array","close","allSettled","status","reason","generateCacheEntry","workStore","clientReferenceManifest","encodedArguments","fn","timeoutError","deadlockError","runInCleanSnapshot","generateCacheEntryWithRestoredWorkStore","run","generateCacheEntryWithCacheContext","createUseCacheStore","defaultCacheLife","kind","outerWorkUnitStore","phase","consumerWillServerCache","implicitTags","explicitRevalidate","explicitExpire","explicitStale","hmrRefreshHash","serverComponentsHmrCache","forceRevalidate","shouldForceRevalidate","draftMode","fresh","outerOwnerStack","useCacheOrRequestStore","fallbackRootParamsPrerender","fallbackRouteParams","Object","keys","some","captureOuterOwnerStack","workUnitStore","capturedOwnerStack","captureOwnerStack","parentOuterOwnerStack","getUseCacheFillTimeoutMs","workUnitStoreType","useCacheTimeout","staticPageGenerationTimeout","effectiveTimeout","Math","min","cacheLifeProfiles","default","cacheStore","abortController","AbortController","generateCacheEntryImpl","propagateCacheLifeAndTagsToRevalidateStore","revalidateStore","outerTags","tag","includes","propagateCacheStaleTimeToRequestStore","requestStore","propagateCacheEntryMetadata","varyParamsAccumulator","isValidationRender","collectResult","savedStream","innerCacheStore","startTime","errors","buffer","reader","getReader","read","done","idx","bufferStream","pull","invalidDynamicUsageError","collectedTags","isPrivateCacheInDev","Boolean","__NEXT_DEV_SERVER","forceDynamicCacheLifeInDev","collectedRevalidate","collectedExpire","collectedStale","collected","skipPropagation","temporaryReferences","args","Symbol","asyncIterator","renderSignal","aborted","addEventListener","once","performance","timeOrigin","now","resultPromise","handleError","isBuildTimePrerendering","reactServerErrorsByDigest","devTimeoutAbortController","prerenderStore","clientModules","environmentName","onError","timeoutAbortController","timer","setTimeout","abort","dynamicAccessStore","getStore","dynamicAccessAbortSignal","signal","abortSignal","AbortSignal","any","prelude","clearTimeout","didTimeout","makeHangingPromise","functionId","hangingPromise","route","consumer","stagedRendering","stageAtReadStart","currentStage","Dynamic","devRenderAbortController","fillTimeoutMs","fillDeadlineAt","devRenderTimeoutTimer","Error","digest","message","stack","toString","setupProbeScheduler","outerRequestStore","onProbeCompleted","returnStream","cloneCacheResult","entryA","entryB","i","encodeFormData","formData","stringValue","arrayBuffer","byteLength","String","fromCodePoint","Uint16Array","createTrackedReadableStream","boundArgsLength","originalFn","isPrivate","useCacheProbeMode","handler","tieredCacheHandler","captureStackTrace","wrapAsInvalidDynamicUsageError","expression","handlerKind","functionName","hangingInputAbortSignal","waitForStage","sessionData","isPageOrLayoutSegmentFunction","isPageSegmentFunction","params","outerParams","searchParams","outerSearchParams","otherOuterArgs","props","_","otherInnerArgs","apply","isLayoutSegmentFunction","$$isLayout","outerSlots","_innerParams","innerSlots","encryptedBoundArgs","shift","boundArgs","Array","isArray","unshift","implementationPart","runtimeEnvVarStateHash","computeCacheKeyImplementationPart","cacheKeyParts","encodeCacheKeyParts","encodedCacheKeyParts","probeTimeoutMs","timeoutMs","cancel","probeTimeoutTimer","race","knownRootParamNames","cacheHandlerKey","cacheSignalReadEnded","rdcEntry","beginRead","isRevalidatedAfter","shouldReportNestedCacheError","isPrefetchable","prefetchStage","staticUrlData","static","runtimeUrlData","finalStage","stage","needsRuntimeShell","streamA","streamB","warn","pendingInvocation","pendingCacheInvocations","completedInvocation","completedCacheInvocations","joinedInvocation","sharedCacheResult","shouldDiscardCacheEntry","resolvableSharedCacheResult","intraRequestPendingCacheInvocations","skipCrossRequestDedupe","isDraftMode","crossRequestPendingCacheInvocation","updatedRootParamNames","newCacheHandlerKey","lazyRefreshTags","refreshTagsByCacheKind","observedRevalidation","startsWith","slice","implicitTagsExpiration","lazyExpiration","expirationsByCacheKind","expiration","Infinity","currentTime","max","newStream","pendingRevalidateWrites","entryMetadata","entryLeft","entryRight","shouldTriggerBackgroundRevalidation","revalidateCacheHandlerKey","revalidatePromise","ignoredStream","completion","replayConsoleLogs","serverConsumerManifest","moduleLoading","moduleMap","serverModuleMap","durability","durableUseCacheEntries","node","workers","page","crypto","createHash","update","runtimeEnvVarsRead","k","runtimeEnvVarsExistence","state","join","codeHash","buildId","deploymentId","__NEXT_CACHE_COMPONENTS","validationSamples","maybeProps","$$isPage","isOnDemandRevalidate","entryTimestamp","previouslyRevalidatedTags","pendingRevalidatedTags","requestStartTime","item","revalidatedAt"],"mappings":"AACA,oDAAoD,GACpD,SACEA,sBAAsB,EACtBC,WAAW,EACXC,4BAA4B,EAC5BC,+BAA+BC,iCAAiC,QAC3D,kCAAiC;AACxC,SACEC,wBAAwB,EACxBC,WAAW,EACXH,+BAA+BI,iCAAiC,QAC3D,kCAAiC;AACxC,SAASC,SAAS,QAAQ,kCAAiC;AAG3D,SAASC,gBAAgB,QAAQ,4CAA2C;AAY5E,SACEC,iBAAiB,EACjBC,kBAAkB,EAClBC,wBAAwB,EACxBC,oBAAoB,EACpBC,iCAAiC,EACjCC,cAAc,EACdC,YAAY,EACZC,2BAA2B,EAC3BC,uBAAuB,QAClB,iDAAgD;AACvD,SAASC,mBAAmB,QAAQ,4BAA2B;AAE/D,SACEC,eAAe,EACfC,0BAA0B,EAC1BC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AAO;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/utils.js b/e-commerce/node_modules/next/dist/esm/server/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..acc77cbd3869dd39cae8f0356b9a8ffebe400937 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/utils.js @@ -0,0 +1,51 @@ +import { BLOCKED_PAGES } from '../shared/lib/constants'; +export function isBlockedPage(page) { + return BLOCKED_PAGES.includes(page); +} +export function debounce(fn, ms, maxWait = Infinity) { + let timeoutId; + // The time the debouncing function was first called during this debounce queue. + let startTime = 0; + // The time the debouncing function was last called. + let lastCall = 0; + // The arguments and this context of the last call to the debouncing function. + let args, context; + // A helper used to that either invokes the debounced function, or + // reschedules the timer if a more recent call was made. + function run() { + const now = Date.now(); + const diff = lastCall + ms - now; + // If the diff is non-positive, then we've waited at least `ms` + // milliseconds since the last call. Or if we've waited for longer than the + // max wait time, we must call the debounced function. + if (diff <= 0 || startTime + maxWait >= now) { + // It's important to clear the timeout id before invoking the debounced + // function, in case the function calls the debouncing function again. + timeoutId = undefined; + fn.apply(context, args); + } else { + // Else, a new call was made after the original timer was scheduled. We + // didn't clear the timeout (doing so is very slow), so now we need to + // reschedule the timer for the time difference. + timeoutId = setTimeout(run, diff); + } + } + return function(...passedArgs) { + // The arguments and this context of the most recent call are saved so the + // debounced function can be invoked with them later. + args = passedArgs; + context = this; + // Instead of constantly clearing and scheduling a timer, we record the + // time of the last call. If a second call comes in before the timer fires, + // then we'll reschedule in the run function. Doing this is considerably + // faster. + lastCall = Date.now(); + // Only schedule a new timer if we're not currently waiting. + if (timeoutId === undefined) { + startTime = lastCall; + timeoutId = setTimeout(run, ms); + } + }; +} + +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/utils.js.map b/e-commerce/node_modules/next/dist/esm/server/utils.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e90ce64fe25765fd1ba0c1498446da9eae0303d6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/utils.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/server/utils.ts"],"sourcesContent":["import { BLOCKED_PAGES } from '../shared/lib/constants'\n\nexport function isBlockedPage(page: string): boolean {\n return BLOCKED_PAGES.includes(page)\n}\n\ntype AnyFunc = (this: T, ...args: any) => any\nexport function debounce>(\n fn: F,\n ms: number,\n maxWait = Infinity\n) {\n let timeoutId: undefined | NodeJS.Timeout\n\n // The time the debouncing function was first called during this debounce queue.\n let startTime = 0\n // The time the debouncing function was last called.\n let lastCall = 0\n\n // The arguments and this context of the last call to the debouncing function.\n let args: Parameters, context: T\n\n // A helper used to that either invokes the debounced function, or\n // reschedules the timer if a more recent call was made.\n function run() {\n const now = Date.now()\n const diff = lastCall + ms - now\n\n // If the diff is non-positive, then we've waited at least `ms`\n // milliseconds since the last call. Or if we've waited for longer than the\n // max wait time, we must call the debounced function.\n if (diff <= 0 || startTime + maxWait >= now) {\n // It's important to clear the timeout id before invoking the debounced\n // function, in case the function calls the debouncing function again.\n timeoutId = undefined\n fn.apply(context, args)\n } else {\n // Else, a new call was made after the original timer was scheduled. We\n // didn't clear the timeout (doing so is very slow), so now we need to\n // reschedule the timer for the time difference.\n timeoutId = setTimeout(run, diff)\n }\n }\n\n return function (this: T, ...passedArgs: Parameters) {\n // The arguments and this context of the most recent call are saved so the\n // debounced function can be invoked with them later.\n args = passedArgs\n context = this\n\n // Instead of constantly clearing and scheduling a timer, we record the\n // time of the last call. If a second call comes in before the timer fires,\n // then we'll reschedule in the run function. Doing this is considerably\n // faster.\n lastCall = Date.now()\n\n // Only schedule a new timer if we're not currently waiting.\n if (timeoutId === undefined) {\n startTime = lastCall\n timeoutId = setTimeout(run, ms)\n }\n }\n}\n"],"names":["BLOCKED_PAGES","isBlockedPage","page","includes","debounce","fn","ms","maxWait","Infinity","timeoutId","startTime","lastCall","args","context","run","now","Date","diff","undefined","apply","setTimeout","passedArgs"],"mappings":"AAAA,SAASA,aAAa,QAAQ,0BAAyB;AAEvD,OAAO,SAASC,cAAcC,IAAY;IACxC,OAAOF,cAAcG,QAAQ,CAACD;AAChC;AAGA,OAAO,SAASE,SACdC,EAAK,EACLC,EAAU,EACVC,UAAUC,QAAQ;IAElB,IAAIC;IAEJ,gFAAgF;IAChF,IAAIC,YAAY;IAChB,oDAAoD;IACpD,IAAIC,WAAW;IAEf,8EAA8E;IAC9E,IAAIC,MAAqBC;IAEzB,kEAAkE;IAClE,wDAAwD;IACxD,SAASC;QACP,MAAMC,MAAMC,KAAKD,GAAG;QACpB,MAAME,OAAON,WAAWL,KAAKS;QAE7B,+DAA+D;QAC/D,2EAA2E;QAC3E,sDAAsD;QACtD,IAAIE,QAAQ,KAAKP,YAAYH,WAAWQ,KAAK;YAC3C,uEAAuE;YACvE,sEAAsE;YACtEN,YAAYS;YACZb,GAAGc,KAAK,CAACN,SAASD;QACpB,OAAO;YACL,uEAAuE;YACvE,sEAAsE;YACtE,gDAAgD;YAChDH,YAAYW,WAAWN,KAAKG;QAC9B;IACF;IAEA,OAAO,SAAmB,GAAGI,UAAyB;QACpD,0EAA0E;QAC1E,qDAAqD;QACrDT,OAAOS;QACPR,UAAU,IAAI;QAEd,uEAAuE;QACvE,2EAA2E;QAC3E,wEAAwE;QACxE,UAAU;QACVF,WAAWK,KAAKD,GAAG;QAEnB,4DAA4D;QAC5D,IAAIN,cAAcS,WAAW;YAC3BR,YAAYC;YACZF,YAAYW,WAAWN,KAAKR;QAC9B;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/adapter.js b/e-commerce/node_modules/next/dist/esm/server/web/adapter.js new file mode 100644 index 0000000000000000000000000000000000000000..fec03766a79b86b492f706ab463d610bba8f99cb --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/adapter.js @@ -0,0 +1,386 @@ +import { PageSignatureError } from './error'; +import { fromNodeOutgoingHttpHeaders, normalizeNextQueryParam } from './utils'; +import { NextFetchEvent, getWaitUntilPromiseFromEvent } from './spec-extension/fetch-event'; +import { NextRequest } from './spec-extension/request'; +import { NextResponse } from './spec-extension/response'; +import { parseRelativeURL, getRelativeURL } from '../../shared/lib/router/utils/relativize-url'; +import { NextURL } from './next-url'; +import { stripInternalSearchParams } from '../internal-utils'; +import { normalizeRscURL } from '../../shared/lib/router/utils/app-paths'; +import { FLIGHT_HEADERS, NEXT_REWRITTEN_PATH_HEADER, NEXT_REWRITTEN_QUERY_HEADER, NEXT_RSC_UNION_QUERY, RSC_HEADER } from '../../client/components/app-router-headers'; +import { ensureInstrumentationRegistered } from './globals'; +import { createRequestStoreForAPI } from '../async-storage/request-store'; +import { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'; +import { createWorkStore } from '../async-storage/work-store'; +import { workAsyncStorage } from '../app-render/work-async-storage.external'; +import { InvariantError } from '../../shared/lib/invariant-error'; +import { NEXT_ROUTER_PREFETCH_HEADER } from '../../client/components/app-router-headers'; +import { getTracer } from '../lib/trace/tracer'; +import { MiddlewareSpan } from '../lib/trace/constants'; +import { CloseController } from './web-on-close'; +import { getEdgePreviewProps } from './get-edge-preview-props'; +import { getBuiltinRequestContext } from '../after/builtin-request-context'; +import { getImplicitTags } from '../lib/implicit-tags'; +import { isRSCRequestHeader } from '../lib/is-rsc-request'; +import { setRequestMeta } from '../request-meta'; +// The proxy (middleware) does not support `'use cache'`, so this work store +// never reaches the code that reads `cacheLife` (and `'use cache'` is +// disallowed on the edge runtime anyway). This sentinel satisfies the +// non-optional type while throwing if `default` is ever read, matching the +// "never read" sentinels used for the proxy's other unused renderOpts fields +// (`staticPageGenerationTimeout: 0`, `useCacheTimeout: 0`). It surfaces loudly +// rather than silently serving a misleading profile. +const proxyCacheLifeProfiles = { + get default () { + throw new InvariantError('Proxy does not support `use cache`, so reading its `default` cacheLife profile is unexpected.'); + } +}; +export class NextRequestHint extends NextRequest { + constructor(params){ + super(params.input, params.init); + this.sourcePage = params.page; + } + get request() { + throw new PageSignatureError({ + page: this.sourcePage + }); + } + respondWith() { + throw new PageSignatureError({ + page: this.sourcePage + }); + } + waitUntil() { + throw new PageSignatureError({ + page: this.sourcePage + }); + } +} +const headersGetter = { + keys: (headers)=>Array.from(headers.keys()), + get: (headers, key)=>headers.get(key) ?? undefined +}; +let propagator = (request, fn)=>{ + const tracer = getTracer(); + return tracer.withPropagatedContext(request.headers, fn, headersGetter); +}; +let testApisIntercepted = false; +function ensureTestApisIntercepted() { + if (!testApisIntercepted) { + testApisIntercepted = true; + if (process.env.NEXT_PRIVATE_TEST_PROXY === 'true') { + const { interceptTestApis, wrapRequestHandler } = // eslint-disable-next-line @next/internal/typechecked-require -- experimental/testmode is not built ins next/dist/esm + require('next/dist/experimental/testmode/server-edge'); + interceptTestApis(); + propagator = wrapRequestHandler(propagator); + } + } +} +export async function adapter(params) { + var _getBuiltinRequestContext; + ensureTestApisIntercepted(); + await ensureInstrumentationRegistered(); + // TODO-APP: use explicit marker for this + const isEdgeRendering = typeof globalThis.__BUILD_MANIFEST !== 'undefined'; + params.request.url = normalizeRscURL(params.request.url); + const requestURL = params.bypassNextUrl ? new URL(params.request.url) : new NextURL(params.request.url, { + headers: params.request.headers, + nextConfig: params.request.nextConfig + }); + // Iterator uses an index to keep track of the current iteration. Because of deleting and appending below we can't just use the iterator. + // Instead we use the keys before iteration. + const keys = [ + ...requestURL.searchParams.keys() + ]; + for (const key of keys){ + const value = requestURL.searchParams.getAll(key); + const normalizedKey = normalizeNextQueryParam(key); + if (normalizedKey) { + requestURL.searchParams.delete(normalizedKey); + for (const val of value){ + requestURL.searchParams.append(normalizedKey, val); + } + requestURL.searchParams.delete(key); + } + } + // Ensure users only see page requests, never data requests. + let buildId = process.env.__NEXT_BUILD_ID || ''; + if ('buildId' in requestURL) { + buildId = requestURL.buildId || ''; + requestURL.buildId = ''; + } + let deploymentId = process.env.NEXT_DEPLOYMENT_ID; + const requestHeaders = fromNodeOutgoingHttpHeaders(params.request.headers); + const isNextDataRequest = requestHeaders.has('x-nextjs-data'); + const isRSCRequest = isRSCRequestHeader(requestHeaders.get(RSC_HEADER)); + if (isNextDataRequest && requestURL.pathname === '/index') { + requestURL.pathname = '/'; + } + const flightHeaders = new Map(); + // Headers should only be stripped for middleware + if (!isEdgeRendering && !process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE) { + for (const header of FLIGHT_HEADERS){ + const value = requestHeaders.get(header); + if (value !== null) { + flightHeaders.set(header, value); + requestHeaders.delete(header); + } + } + } + const normalizeURL = process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE ? new URL(params.request.url) : requestURL; + const rscHash = normalizeURL.searchParams.get(NEXT_RSC_UNION_QUERY); + const request = new NextRequestHint({ + page: params.page, + // Strip internal query parameters off the request. + input: process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE ? normalizeURL.toString() : stripInternalSearchParams(normalizeURL).toString(), + init: { + body: params.request.body, + headers: requestHeaders, + method: params.request.method, + nextConfig: params.request.nextConfig, + signal: params.request.signal + } + }); + if (params.request.requestMeta) { + setRequestMeta(request, params.request.requestMeta); + } + /** + * This allows to identify the request as a data request. The user doesn't + * need to know about this property neither use it. We add it for testing + * purposes. + */ if (isNextDataRequest) { + Object.defineProperty(request, '__isData', { + enumerable: false, + value: true + }); + } + if (// If we are inside of the next start sandbox + // leverage the shared instance if not we need + // to create a fresh cache instance each time + !globalThis.__incrementalCacheShared && params.IncrementalCache) { + ; + globalThis.__incrementalCache = new params.IncrementalCache({ + CurCacheHandler: params.incrementalCacheHandler, + minimalMode: process.env.NODE_ENV !== 'development', + fetchCacheKeyPrefix: process.env.__NEXT_FETCH_CACHE_KEY_PREFIX, + dev: process.env.NODE_ENV === 'development', + requestHeaders: params.request.headers, + previewProps: getEdgePreviewProps(), + prerenderManifest: { + version: -1, + routes: {}, + dynamicRoutes: {}, + notFoundRoutes: [], + preview: getEdgePreviewProps() + } + }); + } + // if we're in an edge runtime sandbox, we should use the waitUntil + // that we receive from the enclosing NextServer + const outerWaitUntil = params.request.waitUntil ?? ((_getBuiltinRequestContext = getBuiltinRequestContext()) == null ? void 0 : _getBuiltinRequestContext.waitUntil); + const event = new NextFetchEvent({ + request, + page: params.page, + context: outerWaitUntil ? { + waitUntil: outerWaitUntil + } : undefined + }); + let response; + let cookiesFromResponse; + response = await propagator(request, ()=>{ + // we only care to make async storage available for middleware + const isMiddleware = params.page === '/middleware' || params.page === '/src/middleware' || params.page === '/proxy' || params.page === '/src/proxy'; + if (isMiddleware) { + // if we're in an edge function, we only get a subset of `nextConfig` (no `experimental`), + // so we have to inject it via DefinePlugin. + // in `next start` this will be passed normally (see `NextNodeServer.runMiddleware`). + const waitUntil = event.waitUntil.bind(event); + const closeController = new CloseController(); + return getTracer().trace(MiddlewareSpan.execute, { + spanName: `middleware ${request.method}`, + attributes: { + 'http.target': request.nextUrl.pathname, + 'http.method': request.method + } + }, async ()=>{ + try { + var _params_request_nextConfig_experimental, _params_request_nextConfig; + const onUpdateCookies = (cookies)=>{ + cookiesFromResponse = cookies; + }; + const previewProps = getEdgePreviewProps(); + const page = '/' // Fake Work + ; + const fallbackRouteParams = null; + const implicitTags = await getImplicitTags(page, request.nextUrl.pathname, fallbackRouteParams); + const requestStore = createRequestStoreForAPI(request, request.nextUrl, implicitTags, onUpdateCookies, previewProps, // Edge route handlers can't use `"use cache"`, so there's no HMR + // refresh hash to thread through here. + undefined); + const workStore = createWorkStore({ + page, + renderOpts: { + cacheLifeProfiles: proxyCacheLifeProfiles, + // Proxy doesn't do static generation, so this value does not + // apply here. 0 is a sentinel: if something ever reads it, + // it'll surface loudly instead of silently using a misleading + // default. + staticPageGenerationTimeout: 0, + cacheComponents: false, + // Proxy doesn't run instant validation; the level value is + // irrelevant here. + // TODO: remove validationLevel and other global config from renderOpts + validationLevel: 'warning', + experimental: { + isRoutePPREnabled: false, + authInterrupts: !!((_params_request_nextConfig = params.request.nextConfig) == null ? void 0 : (_params_request_nextConfig_experimental = _params_request_nextConfig.experimental) == null ? void 0 : _params_request_nextConfig_experimental.authInterrupts), + // Proxy doesn't fill Cache Components entries, so this value + // is never read. 0 is a sentinel: if something ever reads it, + // the cache fill will time out immediately and surface the + // bug. + useCacheTimeout: 0, + durableUseCacheEntries: false + }, + waitUntil, + onClose: closeController.onClose.bind(closeController), + onAfterTaskError: undefined + }, + isPrefetchRequest: request.headers.get(NEXT_ROUTER_PREFETCH_HEADER) === '1', + buildId: buildId ?? '', + deploymentId: deploymentId ?? '', + previouslyRevalidatedTags: [] + }); + return await workAsyncStorage.run(workStore, ()=>workUnitAsyncStorage.run(requestStore, params.handler, request, event)); + } finally{ + // middleware cannot stream, so we can consider the response closed + // as soon as the handler returns. + // we can delay running it until a bit later -- + // if it's needed, we'll have a `waitUntil` lock anyway. + setTimeout(()=>{ + closeController.dispatchClose(); + }, 0); + } + }); + } + return params.handler(request, event); + }); + // check if response is a Response object + if (response && !(response instanceof Response)) { + throw new TypeError('Expected an instance of Response to be returned'); + } + if (response && cookiesFromResponse) { + response.headers.set('set-cookie', cookiesFromResponse); + } + /** + * For rewrites we must always include the locale in the final pathname + * so we re-create the NextURL forcing it to include it when the it is + * an internal rewrite. Also we make sure the outgoing rewrite URL is + * a data URL if the request was a data request. + */ const rewrite = response == null ? void 0 : response.headers.get('x-middleware-rewrite'); + if (response && rewrite && (isRSCRequest || !isEdgeRendering)) { + var _params_request_nextConfig_experimental_clientParamParsingOrigins, _params_request_nextConfig_experimental, _params_request_nextConfig; + const destination = new NextURL(rewrite, { + forceLocale: true, + headers: params.request.headers, + nextConfig: params.request.nextConfig + }); + if (!process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE && !isEdgeRendering) { + if (destination.host === request.nextUrl.host) { + destination.buildId = buildId || destination.buildId; + response.headers.set('x-middleware-rewrite', String(destination)); + } + } + /** + * When the request is a data request we must show if there was a rewrite + * with an internal header so the client knows which component to load + * from the data request. + */ const { url: relativeDestination, isRelative } = parseRelativeURL(destination.toString(), requestURL.toString()); + if (!isEdgeRendering && isNextDataRequest && // if the rewrite is external and external rewrite + // resolving config is enabled don't add this header + // so the upstream app can set it instead + !(process.env.__NEXT_EXTERNAL_MIDDLEWARE_REWRITE_RESOLVE && relativeDestination.match(/http(s)?:\/\//))) { + response.headers.set('x-nextjs-rewrite', relativeDestination); + } + // Check to see if this is a non-relative rewrite. If it is, we need + // to check to see if it's an allowed origin to receive the rewritten + // headers. + const isAllowedOrigin = !isRelative ? (_params_request_nextConfig = params.request.nextConfig) == null ? void 0 : (_params_request_nextConfig_experimental = _params_request_nextConfig.experimental) == null ? void 0 : (_params_request_nextConfig_experimental_clientParamParsingOrigins = _params_request_nextConfig_experimental.clientParamParsingOrigins) == null ? void 0 : _params_request_nextConfig_experimental_clientParamParsingOrigins.some((origin)=>new RegExp(origin).test(destination.origin)) : false; + // If this is an RSC request, and the pathname or search has changed, and + // this isn't an external rewrite, we need to set the rewritten pathname and + // query headers. + if (isRSCRequest && (isRelative || isAllowedOrigin)) { + if (requestURL.pathname !== destination.pathname) { + response.headers.set(NEXT_REWRITTEN_PATH_HEADER, destination.pathname); + } + if (requestURL.search !== destination.search) { + response.headers.set(NEXT_REWRITTEN_QUERY_HEADER, // remove the leading ? from the search string + destination.search.slice(1)); + } + } + } + /** + * Always forward the `_rsc` search parameter to the rewritten URL for RSC requests, + * unless it's already present. This is necessary to ensure that RSC hash validation + * works correctly after a rewrite. For internal rewrites, the server can validate the + * RSC hash using the original URL, so forwarding the `_rsc` parameter is less critical. + * However, for external rewrites (where the request is proxied to another Next.js server), + * the external server does not have access to the original URL or its search parameters. + * In these cases, forwarding the `_rsc` parameter is essential so that the external server + * can perform the correct RSC hash validation. + */ if (response && rewrite && isRSCRequest && rscHash) { + const rewriteURL = new URL(rewrite); + if (!rewriteURL.searchParams.has(NEXT_RSC_UNION_QUERY)) { + rewriteURL.searchParams.set(NEXT_RSC_UNION_QUERY, rscHash); + response.headers.set('x-middleware-rewrite', rewriteURL.toString()); + } + } + /** + * For redirects we will not include the locale in case when it is the + * default and we must also make sure the outgoing URL is a data one if + * the incoming request was a data request. + */ const redirect = response == null ? void 0 : response.headers.get('Location'); + if (response && redirect && !isEdgeRendering) { + const redirectURL = new NextURL(redirect, { + forceLocale: false, + headers: params.request.headers, + nextConfig: params.request.nextConfig + }); + /** + * Responses created from redirects have immutable headers so we have + * to clone the response to be able to modify it. + */ response = new Response(response.body, response); + if (!process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE) { + if (redirectURL.host === requestURL.host) { + redirectURL.buildId = buildId || redirectURL.buildId; + response.headers.set('Location', getRelativeURL(redirectURL, requestURL)); + } + } + /** + * When the request is a data request we can't use the location header as + * it may end up with CORS error. Instead we map to an internal header so + * the client knows the destination. + */ if (isNextDataRequest) { + response.headers.delete('Location'); + response.headers.set('x-nextjs-redirect', getRelativeURL(redirectURL.toString(), requestURL.toString())); + } + } + const finalResponse = response ? response : NextResponse.next(); + // Flight headers are not overridable / removable so they are applied at the end. + const middlewareOverrideHeaders = finalResponse.headers.get('x-middleware-override-headers'); + const overwrittenHeaders = []; + if (middlewareOverrideHeaders) { + for (const [key, value] of flightHeaders){ + finalResponse.headers.set(`x-middleware-request-${key}`, value); + overwrittenHeaders.push(key); + } + if (overwrittenHeaders.length > 0) { + finalResponse.headers.set('x-middleware-override-headers', middlewareOverrideHeaders + ',' + overwrittenHeaders.join(',')); + } + } + return { + response: finalResponse, + waitUntil: getWaitUntilPromiseFromEvent(event) ?? Promise.resolve(), + fetchMetrics: request.fetchMetrics + }; +} + +//# sourceMappingURL=adapter.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/adapter.js.map b/e-commerce/node_modules/next/dist/esm/server/web/adapter.js.map new file mode 100644 index 0000000000000000000000000000000000000000..5c48e6cfb385a7bcd6e00ed1b1ce8458675f6f42 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/adapter.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/web/adapter.ts"],"sourcesContent":["import type { RequestData, FetchEventResult } from './types'\nimport type { RequestInit } from './spec-extension/request'\nimport { PageSignatureError } from './error'\nimport { fromNodeOutgoingHttpHeaders, normalizeNextQueryParam } from './utils'\nimport {\n NextFetchEvent,\n getWaitUntilPromiseFromEvent,\n} from './spec-extension/fetch-event'\nimport { NextRequest } from './spec-extension/request'\nimport { NextResponse } from './spec-extension/response'\nimport {\n parseRelativeURL,\n getRelativeURL,\n} from '../../shared/lib/router/utils/relativize-url'\nimport { NextURL } from './next-url'\nimport { stripInternalSearchParams } from '../internal-utils'\nimport { normalizeRscURL } from '../../shared/lib/router/utils/app-paths'\nimport {\n FLIGHT_HEADERS,\n NEXT_REWRITTEN_PATH_HEADER,\n NEXT_REWRITTEN_QUERY_HEADER,\n NEXT_RSC_UNION_QUERY,\n RSC_HEADER,\n} from '../../client/components/app-router-headers'\nimport { ensureInstrumentationRegistered } from './globals'\nimport { createRequestStoreForAPI } from '../async-storage/request-store'\nimport { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'\nimport { createWorkStore } from '../async-storage/work-store'\nimport { workAsyncStorage } from '../app-render/work-async-storage.external'\nimport { InvariantError } from '../../shared/lib/invariant-error'\nimport type { ResolvedCacheLifeProfiles } from '../config-shared'\nimport { NEXT_ROUTER_PREFETCH_HEADER } from '../../client/components/app-router-headers'\nimport { getTracer } from '../lib/trace/tracer'\nimport type { TextMapGetter } from 'next/dist/compiled/@opentelemetry/api'\nimport { MiddlewareSpan } from '../lib/trace/constants'\nimport { CloseController } from './web-on-close'\nimport { getEdgePreviewProps } from './get-edge-preview-props'\nimport { getBuiltinRequestContext } from '../after/builtin-request-context'\nimport { getImplicitTags } from '../lib/implicit-tags'\nimport { isRSCRequestHeader } from '../lib/is-rsc-request'\nimport { setRequestMeta } from '../request-meta'\n\n// The proxy (middleware) does not support `'use cache'`, so this work store\n// never reaches the code that reads `cacheLife` (and `'use cache'` is\n// disallowed on the edge runtime anyway). This sentinel satisfies the\n// non-optional type while throwing if `default` is ever read, matching the\n// \"never read\" sentinels used for the proxy's other unused renderOpts fields\n// (`staticPageGenerationTimeout: 0`, `useCacheTimeout: 0`). It surfaces loudly\n// rather than silently serving a misleading profile.\nconst proxyCacheLifeProfiles: ResolvedCacheLifeProfiles = {\n get default(): never {\n throw new InvariantError(\n 'Proxy does not support `use cache`, so reading its `default` cacheLife profile is unexpected.'\n )\n },\n}\n\nexport class NextRequestHint extends NextRequest {\n sourcePage: string\n fetchMetrics: FetchEventResult['fetchMetrics'] | undefined\n\n constructor(params: {\n init: RequestInit\n input: Request | string\n page: string\n }) {\n super(params.input, params.init)\n this.sourcePage = params.page\n }\n\n get request() {\n throw new PageSignatureError({ page: this.sourcePage })\n }\n\n respondWith() {\n throw new PageSignatureError({ page: this.sourcePage })\n }\n\n waitUntil() {\n throw new PageSignatureError({ page: this.sourcePage })\n }\n}\n\nconst headersGetter: TextMapGetter = {\n keys: (headers) => Array.from(headers.keys()),\n get: (headers, key) => headers.get(key) ?? undefined,\n}\n\nexport type AdapterOptions = {\n handler: (req: NextRequestHint, event: NextFetchEvent) => Promise\n page: string\n request: RequestData\n IncrementalCache?: typeof import('../lib/incremental-cache').IncrementalCache\n incrementalCacheHandler?: typeof import('../lib/incremental-cache').CacheHandler\n bypassNextUrl?: boolean\n}\n\n// This has to be compatible with what the Vercel builder does as well:\n// https://github.com/vercel/vercel/blob/0e0a6eb9f12216202ae2f5ee37e4ada1796361fd/packages/next/src/edge-function-source/get-edge-function.ts#L112-L136\nexport type EdgeHandler = (opts: {\n request: AdapterOptions['request']\n}) => Promise\n\nlet propagator: (request: NextRequestHint, fn: () => T) => T = (\n request,\n fn\n) => {\n const tracer = getTracer()\n return tracer.withPropagatedContext(request.headers, fn, headersGetter)\n}\n\nlet testApisIntercepted = false\n\nfunction ensureTestApisIntercepted() {\n if (!testApisIntercepted) {\n testApisIntercepted = true\n if (process.env.NEXT_PRIVATE_TEST_PROXY === 'true') {\n const { interceptTestApis, wrapRequestHandler } =\n // eslint-disable-next-line @next/internal/typechecked-require -- experimental/testmode is not built ins next/dist/esm\n require('next/dist/experimental/testmode/server-edge') as typeof import('../../experimental/testmode/server-edge')\n interceptTestApis()\n propagator = wrapRequestHandler(propagator)\n }\n }\n}\n\nexport async function adapter(\n params: AdapterOptions\n): Promise {\n ensureTestApisIntercepted()\n await ensureInstrumentationRegistered()\n\n // TODO-APP: use explicit marker for this\n const isEdgeRendering =\n typeof (globalThis as any).__BUILD_MANIFEST !== 'undefined'\n\n params.request.url = normalizeRscURL(params.request.url)\n\n const requestURL = params.bypassNextUrl\n ? new URL(params.request.url)\n : new NextURL(params.request.url, {\n headers: params.request.headers,\n nextConfig: params.request.nextConfig,\n })\n\n // Iterator uses an index to keep track of the current iteration. Because of deleting and appending below we can't just use the iterator.\n // Instead we use the keys before iteration.\n const keys = [...requestURL.searchParams.keys()]\n for (const key of keys) {\n const value = requestURL.searchParams.getAll(key)\n\n const normalizedKey = normalizeNextQueryParam(key)\n if (normalizedKey) {\n requestURL.searchParams.delete(normalizedKey)\n for (const val of value) {\n requestURL.searchParams.append(normalizedKey, val)\n }\n requestURL.searchParams.delete(key)\n }\n }\n\n // Ensure users only see page requests, never data requests.\n let buildId = process.env.__NEXT_BUILD_ID || ''\n if ('buildId' in requestURL) {\n buildId = (requestURL as NextURL).buildId || ''\n requestURL.buildId = ''\n }\n let deploymentId = process.env.NEXT_DEPLOYMENT_ID\n\n const requestHeaders = fromNodeOutgoingHttpHeaders(params.request.headers)\n const isNextDataRequest = requestHeaders.has('x-nextjs-data')\n const isRSCRequest = isRSCRequestHeader(requestHeaders.get(RSC_HEADER))\n\n if (isNextDataRequest && requestURL.pathname === '/index') {\n requestURL.pathname = '/'\n }\n\n const flightHeaders = new Map()\n\n // Headers should only be stripped for middleware\n if (!isEdgeRendering && !process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE) {\n for (const header of FLIGHT_HEADERS) {\n const value = requestHeaders.get(header)\n if (value !== null) {\n flightHeaders.set(header, value)\n requestHeaders.delete(header)\n }\n }\n }\n\n const normalizeURL = process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE\n ? new URL(params.request.url)\n : requestURL\n\n const rscHash = normalizeURL.searchParams.get(NEXT_RSC_UNION_QUERY)\n\n const request = new NextRequestHint({\n page: params.page,\n // Strip internal query parameters off the request.\n input: process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE\n ? normalizeURL.toString()\n : stripInternalSearchParams(normalizeURL).toString(),\n init: {\n body: params.request.body,\n headers: requestHeaders,\n method: params.request.method,\n nextConfig: params.request.nextConfig,\n signal: params.request.signal,\n },\n })\n\n if (params.request.requestMeta) {\n setRequestMeta(request, params.request.requestMeta)\n }\n\n /**\n * This allows to identify the request as a data request. The user doesn't\n * need to know about this property neither use it. We add it for testing\n * purposes.\n */\n if (isNextDataRequest) {\n Object.defineProperty(request, '__isData', {\n enumerable: false,\n value: true,\n })\n }\n\n if (\n // If we are inside of the next start sandbox\n // leverage the shared instance if not we need\n // to create a fresh cache instance each time\n !(globalThis as any).__incrementalCacheShared &&\n (params as any).IncrementalCache\n ) {\n ;(globalThis as any).__incrementalCache = new (\n params as {\n IncrementalCache: typeof import('../lib/incremental-cache').IncrementalCache\n }\n ).IncrementalCache({\n CurCacheHandler: params.incrementalCacheHandler,\n minimalMode: process.env.NODE_ENV !== 'development',\n fetchCacheKeyPrefix: process.env.__NEXT_FETCH_CACHE_KEY_PREFIX,\n dev: process.env.NODE_ENV === 'development',\n requestHeaders: params.request.headers as any,\n\n previewProps: getEdgePreviewProps(),\n prerenderManifest: {\n version: -1 as any, // letting us know this doesn't conform to spec\n routes: {},\n dynamicRoutes: {},\n notFoundRoutes: [],\n preview: getEdgePreviewProps(),\n },\n })\n }\n\n // if we're in an edge runtime sandbox, we should use the waitUntil\n // that we receive from the enclosing NextServer\n const outerWaitUntil =\n params.request.waitUntil ?? getBuiltinRequestContext()?.waitUntil\n\n const event = new NextFetchEvent({\n request,\n page: params.page,\n context: outerWaitUntil ? { waitUntil: outerWaitUntil } : undefined,\n })\n let response\n let cookiesFromResponse\n\n response = await propagator(request, () => {\n // we only care to make async storage available for middleware\n const isMiddleware =\n params.page === '/middleware' ||\n params.page === '/src/middleware' ||\n params.page === '/proxy' ||\n params.page === '/src/proxy'\n\n if (isMiddleware) {\n // if we're in an edge function, we only get a subset of `nextConfig` (no `experimental`),\n // so we have to inject it via DefinePlugin.\n // in `next start` this will be passed normally (see `NextNodeServer.runMiddleware`).\n\n const waitUntil = event.waitUntil.bind(event)\n const closeController = new CloseController()\n\n return getTracer().trace(\n MiddlewareSpan.execute,\n {\n spanName: `middleware ${request.method}`,\n attributes: {\n 'http.target': request.nextUrl.pathname,\n 'http.method': request.method,\n },\n },\n async () => {\n try {\n const onUpdateCookies = (cookies: Array) => {\n cookiesFromResponse = cookies\n }\n const previewProps = getEdgePreviewProps()\n const page = '/' // Fake Work\n const fallbackRouteParams = null\n\n const implicitTags = await getImplicitTags(\n page,\n request.nextUrl.pathname,\n fallbackRouteParams\n )\n\n const requestStore = createRequestStoreForAPI(\n request,\n request.nextUrl,\n implicitTags,\n onUpdateCookies,\n previewProps,\n // Edge route handlers can't use `\"use cache\"`, so there's no HMR\n // refresh hash to thread through here.\n undefined\n )\n\n const workStore = createWorkStore({\n page,\n renderOpts: {\n cacheLifeProfiles: proxyCacheLifeProfiles,\n // Proxy doesn't do static generation, so this value does not\n // apply here. 0 is a sentinel: if something ever reads it,\n // it'll surface loudly instead of silently using a misleading\n // default.\n staticPageGenerationTimeout: 0,\n cacheComponents: false,\n // Proxy doesn't run instant validation; the level value is\n // irrelevant here.\n // TODO: remove validationLevel and other global config from renderOpts\n validationLevel: 'warning',\n experimental: {\n isRoutePPREnabled: false,\n authInterrupts:\n !!params.request.nextConfig?.experimental?.authInterrupts,\n // Proxy doesn't fill Cache Components entries, so this value\n // is never read. 0 is a sentinel: if something ever reads it,\n // the cache fill will time out immediately and surface the\n // bug.\n useCacheTimeout: 0,\n durableUseCacheEntries: false,\n },\n waitUntil,\n onClose: closeController.onClose.bind(closeController),\n onAfterTaskError: undefined,\n },\n isPrefetchRequest:\n request.headers.get(NEXT_ROUTER_PREFETCH_HEADER) === '1',\n buildId: buildId ?? '',\n deploymentId: deploymentId ?? '',\n previouslyRevalidatedTags: [],\n })\n\n return await workAsyncStorage.run(workStore, () =>\n workUnitAsyncStorage.run(\n requestStore,\n params.handler,\n request,\n event\n )\n )\n } finally {\n // middleware cannot stream, so we can consider the response closed\n // as soon as the handler returns.\n // we can delay running it until a bit later --\n // if it's needed, we'll have a `waitUntil` lock anyway.\n setTimeout(() => {\n closeController.dispatchClose()\n }, 0)\n }\n }\n )\n }\n return params.handler(request, event)\n })\n\n // check if response is a Response object\n if (response && !(response instanceof Response)) {\n throw new TypeError('Expected an instance of Response to be returned')\n }\n\n if (response && cookiesFromResponse) {\n response.headers.set('set-cookie', cookiesFromResponse)\n }\n\n /**\n * For rewrites we must always include the locale in the final pathname\n * so we re-create the NextURL forcing it to include it when the it is\n * an internal rewrite. Also we make sure the outgoing rewrite URL is\n * a data URL if the request was a data request.\n */\n const rewrite = response?.headers.get('x-middleware-rewrite')\n if (response && rewrite && (isRSCRequest || !isEdgeRendering)) {\n const destination = new NextURL(rewrite, {\n forceLocale: true,\n headers: params.request.headers,\n nextConfig: params.request.nextConfig,\n })\n\n if (!process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE && !isEdgeRendering) {\n if (destination.host === request.nextUrl.host) {\n destination.buildId = buildId || destination.buildId\n response.headers.set('x-middleware-rewrite', String(destination))\n }\n }\n\n /**\n * When the request is a data request we must show if there was a rewrite\n * with an internal header so the client knows which component to load\n * from the data request.\n */\n const { url: relativeDestination, isRelative } = parseRelativeURL(\n destination.toString(),\n requestURL.toString()\n )\n\n if (\n !isEdgeRendering &&\n isNextDataRequest &&\n // if the rewrite is external and external rewrite\n // resolving config is enabled don't add this header\n // so the upstream app can set it instead\n !(\n process.env.__NEXT_EXTERNAL_MIDDLEWARE_REWRITE_RESOLVE &&\n relativeDestination.match(/http(s)?:\\/\\//)\n )\n ) {\n response.headers.set('x-nextjs-rewrite', relativeDestination)\n }\n\n // Check to see if this is a non-relative rewrite. If it is, we need\n // to check to see if it's an allowed origin to receive the rewritten\n // headers.\n const isAllowedOrigin = !isRelative\n ? params.request.nextConfig?.experimental?.clientParamParsingOrigins?.some(\n (origin) => new RegExp(origin).test(destination.origin)\n )\n : false\n\n // If this is an RSC request, and the pathname or search has changed, and\n // this isn't an external rewrite, we need to set the rewritten pathname and\n // query headers.\n if (isRSCRequest && (isRelative || isAllowedOrigin)) {\n if (requestURL.pathname !== destination.pathname) {\n response.headers.set(NEXT_REWRITTEN_PATH_HEADER, destination.pathname)\n }\n if (requestURL.search !== destination.search) {\n response.headers.set(\n NEXT_REWRITTEN_QUERY_HEADER,\n // remove the leading ? from the search string\n destination.search.slice(1)\n )\n }\n }\n }\n\n /**\n * Always forward the `_rsc` search parameter to the rewritten URL for RSC requests,\n * unless it's already present. This is necessary to ensure that RSC hash validation\n * works correctly after a rewrite. For internal rewrites, the server can validate the\n * RSC hash using the original URL, so forwarding the `_rsc` parameter is less critical.\n * However, for external rewrites (where the request is proxied to another Next.js server),\n * the external server does not have access to the original URL or its search parameters.\n * In these cases, forwarding the `_rsc` parameter is essential so that the external server\n * can perform the correct RSC hash validation.\n */\n if (response && rewrite && isRSCRequest && rscHash) {\n const rewriteURL = new URL(rewrite)\n if (!rewriteURL.searchParams.has(NEXT_RSC_UNION_QUERY)) {\n rewriteURL.searchParams.set(NEXT_RSC_UNION_QUERY, rscHash)\n response.headers.set('x-middleware-rewrite', rewriteURL.toString())\n }\n }\n\n /**\n * For redirects we will not include the locale in case when it is the\n * default and we must also make sure the outgoing URL is a data one if\n * the incoming request was a data request.\n */\n const redirect = response?.headers.get('Location')\n if (response && redirect && !isEdgeRendering) {\n const redirectURL = new NextURL(redirect, {\n forceLocale: false,\n headers: params.request.headers,\n nextConfig: params.request.nextConfig,\n })\n\n /**\n * Responses created from redirects have immutable headers so we have\n * to clone the response to be able to modify it.\n */\n response = new Response(response.body, response)\n\n if (!process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE) {\n if (redirectURL.host === requestURL.host) {\n redirectURL.buildId = buildId || redirectURL.buildId\n response.headers.set(\n 'Location',\n getRelativeURL(redirectURL, requestURL)\n )\n }\n }\n\n /**\n * When the request is a data request we can't use the location header as\n * it may end up with CORS error. Instead we map to an internal header so\n * the client knows the destination.\n */\n if (isNextDataRequest) {\n response.headers.delete('Location')\n response.headers.set(\n 'x-nextjs-redirect',\n getRelativeURL(redirectURL.toString(), requestURL.toString())\n )\n }\n }\n\n const finalResponse = response ? response : NextResponse.next()\n\n // Flight headers are not overridable / removable so they are applied at the end.\n const middlewareOverrideHeaders = finalResponse.headers.get(\n 'x-middleware-override-headers'\n )\n const overwrittenHeaders: string[] = []\n if (middlewareOverrideHeaders) {\n for (const [key, value] of flightHeaders) {\n finalResponse.headers.set(`x-middleware-request-${key}`, value)\n overwrittenHeaders.push(key)\n }\n\n if (overwrittenHeaders.length > 0) {\n finalResponse.headers.set(\n 'x-middleware-override-headers',\n middlewareOverrideHeaders + ',' + overwrittenHeaders.join(',')\n )\n }\n }\n\n return {\n response: finalResponse,\n waitUntil: getWaitUntilPromiseFromEvent(event) ?? Promise.resolve(),\n fetchMetrics: request.fetchMetrics,\n }\n}\n"],"names":["PageSignatureError","fromNodeOutgoingHttpHeaders","normalizeNextQueryParam","NextFetchEvent","getWaitUntilPromiseFromEvent","NextRequest","NextResponse","parseRelativeURL","getRelativeURL","NextURL","stripInternalSearchParams","normalizeRscURL","FLIGHT_HEADERS","NEXT_REWRITTEN_PATH_HEADER","NEXT_REWRITTEN_QUERY_HEADER","NEXT_RSC_UNION_QUERY","RSC_HEADER","ensureInstrumentationRegistered","createRequestStoreForAPI","workUnitAsyncStorage","createWorkStore","workAsyncStorage","InvariantError","NEXT_ROUTER_PREFETCH_HEADER","getTracer","MiddlewareSpan","CloseController","getEdgePreviewProps","getBuiltinRequestContext","getImplicitTags","isRSCRequestHeader","setRequestMeta","proxyCacheLifeProfiles","default","NextRequestHint","constructor","params","input","init","sourcePage","page","request","respondWith","waitUntil","headersGetter","keys","headers","Array","from","get","key","undefined","propagator","fn","tracer","withPropagatedContext","testApisIntercepted","ensureTestApisIntercepted","process","env","NEXT_PRIVATE_TEST_PROXY","interceptTestApis","wrapRequestHandler","require","adapter","isEdgeRendering","globalThis","__BUILD_MANIFEST","url","requestURL","bypassNextUrl","URL","nextConfig","searchParams","value","getAll","normalizedKey","delete","val","append","buildId","__NEXT_BUILD_ID","deploymentId","NEXT_DEPLOYMENT_ID","requestHeaders","isNextDataRequest","has","isRSCRequest","pathname","flightHeaders","Map","__NEXT_NO_MIDDLEWARE_URL_NORMALIZE","header","set","normalizeURL","rscHash","toString","body","method","signal","requestMeta","Object","defineProperty","enumerable","__incrementalCacheShared","IncrementalCache","__incrementalCache","CurCacheHandler","incrementalCacheHandler","minimalMode","NODE_ENV","fetchCacheKeyPrefix","__NEXT_FETCH_CACHE_KEY_PREFIX","dev","previewProps","prerenderManifest","version","routes","dynamicRoutes","notFoundRoutes","preview","outerWaitUntil","event","context","response","cookiesFromResponse","isMiddleware","bind","closeController","trace","execute","spanName","attributes","nextUrl","onUpdateCookies","cookies","fallbackRouteParams","implicitTags","requestStore","workStore","renderOpts","cacheLifeProfiles","staticPageGenerationTimeout","cacheComponents","validationLevel","experimental","isRoutePPREnabled","authInterrupts","useCacheTimeout","durableUseCacheEntries","onClose","onAfterTaskError","isPrefetchRequest","previouslyRevalidatedTags","run","handler","setTimeout","dispatchClose","Response","TypeError","rewrite","destination","forceLocale","host","String","relativeDestination","isRelative","__NEXT_EXTERNAL_MIDDLEWARE_REWRITE_RESOLVE","match","isAllowedOrigin","clientParamParsingOrigins","some","origin","RegExp","test","search","slice","rewriteURL","redirect","redirectURL","finalResponse","next","middlewareOverrideHeaders","overwrittenHeaders","push","length","join","Promise","resolve","fetchMetrics"],"mappings":"AAEA,SAASA,kBAAkB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AkC,EAAE;YACnD,IAAIwF,YAAYhB,IAAI,KAAK9F,WAAW8F,IAAI,EAAE;gBACxCgB,YAAYnG,OAAO,GAAGA,WAAWmG,YAAYnG,OAAO;gBACpD4C,SAAS9E,OAAO,CAAC+C,GAAG,CAClB,YACArF,eAAe2K,aAAa9G;YAEhC;QACF;QAEA;;;;KAIC,GACD,IAAIgB,mBAAmB;YACrBuC,SAAS9E,OAAO,CAAC+B,MAAM,CAAC;YACxB+C,SAAS9E,OAAO,CAAC+C,GAAG,CAClB,qBACArF,eAAe2K,YAAYnF,QAAQ,IAAI3B,WAAW2B,QAAQ;QAE9D;IACF;IAEA,MAAMoF,gBAAgBxD,WAAWA,WAAWtH,aAAa+K,IAAI;IAE7D,iFAAiF;IACjF,MAAMC,4BAA4BF,cAActI,OAAO,CAACG,GAAG,CACzD;IAEF,MAAMsI,qBAA+B,EAAE;IACvC,IAAID,2BAA2B;QAC7B,KAAK,MAAM,CAACpI,KAAKwB,MAAM,IAAIe,cAAe;YACxC2F,cAActI,OAAO,CAAC+C,GAAG,CAAC,CAAC,qBAAqB,EAAE3C,KAAK,EAAEwB;YACzD6G,mBAAmBC,IAAI,CAACtI;QAC1B;QAEA,IAAIqI,mBAAmBE,MAAM,GAAG,GAAG;YACjCL,cAActI,OAAO,CAAC+C,GAAG,CACvB,iCACAyF,4BAA4B,MAAMC,mBAAmBG,IAAI,CAAC;QAE9D;IACF;IAEA,OAAO;QACL9D,UAAUwD;QACVzI,WAAWvC,6BAA6BsH,UAAUiE,QAAQC,OAAO;QACjEC,cAAcpJ,QAAQoJ,YAAY;IACpC;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/edge-route-module-wrapper.js b/e-commerce/node_modules/next/dist/esm/server/web/edge-route-module-wrapper.js new file mode 100644 index 0000000000000000000000000000000000000000..11035d23fd9aa0c83bf6ff03cff391ce3e5be75d --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/edge-route-module-wrapper.js @@ -0,0 +1,129 @@ +import './globals'; +import { adapter } from './adapter'; +import { IncrementalCache } from '../lib/incremental-cache'; +import { initializeCacheHandlers, setCacheHandler } from '../use-cache/handlers'; +import { internal_getCurrentFunctionWaitUntil } from './internal-edge-wait-until'; +import { getServerUtils } from '../server-utils'; +import { searchParamsToUrlQuery } from '../../shared/lib/router/utils/querystring'; +import { CloseController, trackStreamConsumed } from './web-on-close'; +import { getEdgePreviewProps } from './get-edge-preview-props'; +import { WebNextRequest } from '../../server/base-http/web'; +import { isDynamicRoute } from '../../shared/lib/router/utils'; +/** + * EdgeRouteModuleWrapper is a wrapper around a route module. + * + * Note that this class should only be used in the edge runtime. + */ export class EdgeRouteModuleWrapper { + /** + * The constructor is wrapped with private to ensure that it can only be + * constructed by the static wrap method. + * + * @param routeModule the route module to wrap + */ constructor(routeModule, cacheHandlers){ + this.routeModule = routeModule; + this.cacheHandlers = cacheHandlers; + this.pageIsDynamic = isDynamicRoute(routeModule.definition.pathname); + } + /** + * This will wrap a module with the EdgeModuleWrapper and return a function + * that can be used as a handler for the edge runtime. + * + * @param module the module to wrap + * @param options any options that should be passed to the adapter and + * override the ones passed from the runtime + * @returns a function that can be used as a handler for the edge runtime + */ static wrap(routeModule, options) { + // Create the module wrapper. + const wrapper = new EdgeRouteModuleWrapper(routeModule, options.cacheHandlers ?? {}); + // Return the wrapping function. + return (opts)=>{ + return adapter({ + ...opts, + IncrementalCache, + incrementalCacheHandler: options.incrementalCacheHandler, + // Bind the handler method to the wrapper so it still has context. + handler: wrapper.handler.bind(wrapper), + page: options.page + }); + }; + } + async handler(request, evt) { + const utils = getServerUtils({ + pageIsDynamic: this.pageIsDynamic, + page: this.routeModule.definition.pathname, + basePath: request.nextUrl.basePath, + // We don't need the `handleRewrite` util, so can just pass an empty object + rewrites: {}, + // only used for rewrites, so setting an arbitrary default value here + caseSensitive: false + }); + const { nextConfig } = this.routeModule.getNextConfigEdge(new WebNextRequest(request)); + initializeCacheHandlers(nextConfig.cacheMaxMemorySize); + for (const [kind, cacheHandler] of Object.entries(this.cacheHandlers)){ + setCacheHandler(kind, cacheHandler); + } + const { params } = utils.normalizeDynamicRouteParams(searchParamsToUrlQuery(request.nextUrl.searchParams), false); + const waitUntil = evt.waitUntil.bind(evt); + const closeController = new CloseController(); + const previewProps = getEdgePreviewProps(); + // Create the context for the handler. This contains the params from the + // match (if any). + const context = { + params, + previewProps, + renderOpts: { + waitUntil, + onClose: closeController.onClose.bind(closeController), + onAfterTaskError: undefined, + cacheComponents: !!process.env.__NEXT_CACHE_COMPONENTS, + // Edge runtime doesn't run instant validation; the level value is + // irrelevant here. + // TODO: Remove validationLevel and other global config from renderOpts + validationLevel: 'warning', + experimental: { + authInterrupts: !!process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS, + // Edge runtime doesn't support Cache Components, so this value is + // never read. 0 is a sentinel: if something ever reads it, the cache + // fill will time out immediately and surface the bug. + useCacheTimeout: 0, + durableUseCacheEntries: false + }, + cacheLifeProfiles: nextConfig.cacheLife, + // Edge runtime doesn't do static generation, so this value does not + // apply here. 0 is a sentinel: if something ever reads it, it'll + // surface loudly instead of silently using a misleading default. + staticPageGenerationTimeout: 0 + }, + sharedContext: { + buildId: '', + deploymentId: '' + } + }; + // Get the response from the handler. + let res = await this.routeModule.handle(request, context); + const waitUntilPromises = [ + internal_getCurrentFunctionWaitUntil() + ]; + if (context.renderOpts.pendingWaitUntil) { + waitUntilPromises.push(context.renderOpts.pendingWaitUntil); + } + evt.waitUntil(Promise.all(waitUntilPromises)); + if (!res.body) { + // we can delay running it until a bit later -- + // if it's needed, we'll have a `waitUntil` lock anyway. + setTimeout(()=>closeController.dispatchClose(), 0); + } else { + // NOTE: if this is a streaming response, onClose may be called later, + // so we can't rely on `closeController.listeners` -- it might be 0 at this point. + const trackedBody = trackStreamConsumed(res.body, ()=>closeController.dispatchClose()); + res = new Response(trackedBody, { + status: res.status, + statusText: res.statusText, + headers: res.headers + }); + } + return res; + } +} + +//# sourceMappingURL=edge-route-module-wrapper.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/edge-route-module-wrapper.js.map b/e-commerce/node_modules/next/dist/esm/server/web/edge-route-module-wrapper.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c5990f3f7e286b8041c25b5323c77ea7ded5ad87 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/edge-route-module-wrapper.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/web/edge-route-module-wrapper.ts"],"sourcesContent":["import type {\n AppRouteRouteHandlerContext,\n AppRouteRouteModule,\n} from '../route-modules/app-route/module'\n\nimport './globals'\n\nimport { adapter, type NextRequestHint, type EdgeHandler } from './adapter'\nimport {\n IncrementalCache,\n type CacheHandler as IncrementalCacheHandler,\n} from '../lib/incremental-cache'\nimport type { CacheHandler } from '../lib/cache-handlers/types'\nimport { initializeCacheHandlers, setCacheHandler } from '../use-cache/handlers'\nimport type { NextFetchEvent } from './spec-extension/fetch-event'\nimport { internal_getCurrentFunctionWaitUntil } from './internal-edge-wait-until'\nimport { getServerUtils } from '../server-utils'\nimport { searchParamsToUrlQuery } from '../../shared/lib/router/utils/querystring'\nimport { CloseController, trackStreamConsumed } from './web-on-close'\nimport { getEdgePreviewProps } from './get-edge-preview-props'\nimport { WebNextRequest } from '../../server/base-http/web'\nimport { isDynamicRoute } from '../../shared/lib/router/utils'\n\nexport interface WrapOptions {\n page: string\n cacheHandlers?: Record\n incrementalCacheHandler?: typeof IncrementalCacheHandler\n}\n\n/**\n * EdgeRouteModuleWrapper is a wrapper around a route module.\n *\n * Note that this class should only be used in the edge runtime.\n */\nexport class EdgeRouteModuleWrapper {\n private readonly pageIsDynamic: boolean\n\n /**\n * The constructor is wrapped with private to ensure that it can only be\n * constructed by the static wrap method.\n *\n * @param routeModule the route module to wrap\n */\n private constructor(\n private readonly routeModule: AppRouteRouteModule,\n private readonly cacheHandlers: Record\n ) {\n this.pageIsDynamic = isDynamicRoute(routeModule.definition.pathname)\n }\n\n /**\n * This will wrap a module with the EdgeModuleWrapper and return a function\n * that can be used as a handler for the edge runtime.\n *\n * @param module the module to wrap\n * @param options any options that should be passed to the adapter and\n * override the ones passed from the runtime\n * @returns a function that can be used as a handler for the edge runtime\n */\n public static wrap(\n routeModule: AppRouteRouteModule,\n options: WrapOptions\n ): EdgeHandler {\n // Create the module wrapper.\n const wrapper = new EdgeRouteModuleWrapper(\n routeModule,\n options.cacheHandlers ?? {}\n )\n\n // Return the wrapping function.\n return (opts) => {\n return adapter({\n ...opts,\n IncrementalCache,\n incrementalCacheHandler: options.incrementalCacheHandler,\n // Bind the handler method to the wrapper so it still has context.\n handler: wrapper.handler.bind(wrapper),\n page: options.page,\n })\n }\n }\n\n private async handler(\n request: NextRequestHint,\n evt: NextFetchEvent\n ): Promise {\n const utils = getServerUtils({\n pageIsDynamic: this.pageIsDynamic,\n page: this.routeModule.definition.pathname,\n basePath: request.nextUrl.basePath,\n // We don't need the `handleRewrite` util, so can just pass an empty object\n rewrites: {},\n // only used for rewrites, so setting an arbitrary default value here\n caseSensitive: false,\n })\n\n const { nextConfig } = this.routeModule.getNextConfigEdge(\n new WebNextRequest(request)\n )\n initializeCacheHandlers(nextConfig.cacheMaxMemorySize)\n for (const [kind, cacheHandler] of Object.entries(this.cacheHandlers)) {\n setCacheHandler(kind, cacheHandler)\n }\n\n const { params } = utils.normalizeDynamicRouteParams(\n searchParamsToUrlQuery(request.nextUrl.searchParams),\n false\n )\n\n const waitUntil = evt.waitUntil.bind(evt)\n const closeController = new CloseController()\n\n const previewProps = getEdgePreviewProps()\n\n // Create the context for the handler. This contains the params from the\n // match (if any).\n const context: AppRouteRouteHandlerContext = {\n params,\n previewProps,\n renderOpts: {\n waitUntil,\n onClose: closeController.onClose.bind(closeController),\n onAfterTaskError: undefined,\n cacheComponents: !!process.env.__NEXT_CACHE_COMPONENTS,\n // Edge runtime doesn't run instant validation; the level value is\n // irrelevant here.\n // TODO: Remove validationLevel and other global config from renderOpts\n validationLevel: 'warning',\n experimental: {\n authInterrupts: !!process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS,\n // Edge runtime doesn't support Cache Components, so this value is\n // never read. 0 is a sentinel: if something ever reads it, the cache\n // fill will time out immediately and surface the bug.\n useCacheTimeout: 0,\n durableUseCacheEntries: false,\n },\n cacheLifeProfiles: nextConfig.cacheLife,\n // Edge runtime doesn't do static generation, so this value does not\n // apply here. 0 is a sentinel: if something ever reads it, it'll\n // surface loudly instead of silently using a misleading default.\n staticPageGenerationTimeout: 0,\n },\n sharedContext: {\n buildId: '', // TODO: Populate this properly.\n deploymentId: '', // TODO: Populate this properly.\n },\n }\n\n // Get the response from the handler.\n let res = await this.routeModule.handle(request, context)\n\n const waitUntilPromises = [internal_getCurrentFunctionWaitUntil()]\n if (context.renderOpts.pendingWaitUntil) {\n waitUntilPromises.push(context.renderOpts.pendingWaitUntil)\n }\n evt.waitUntil(Promise.all(waitUntilPromises))\n\n if (!res.body) {\n // we can delay running it until a bit later --\n // if it's needed, we'll have a `waitUntil` lock anyway.\n setTimeout(() => closeController.dispatchClose(), 0)\n } else {\n // NOTE: if this is a streaming response, onClose may be called later,\n // so we can't rely on `closeController.listeners` -- it might be 0 at this point.\n const trackedBody = trackStreamConsumed(res.body, () =>\n closeController.dispatchClose()\n )\n res = new Response(trackedBody, {\n status: res.status,\n statusText: res.statusText,\n headers: res.headers,\n })\n }\n\n return res\n }\n}\n"],"names":["adapter","IncrementalCache","initializeCacheHandlers","setCacheHandler","internal_getCurrentFunctionWaitUntil","getServerUtils","searchParamsToUrlQuery","CloseController","trackStreamConsumed","getEdgePreviewProps","WebNextRequest","isDynamicRoute","EdgeRouteModuleWrapper","routeModule","cacheHandlers","pageIsDynamic","definition","pathname","wrap","options","wrapper","opts","incrementalCacheHandler","handler","bind","page","request","evt","utils","basePath","nextUrl","rewrites","caseSensitive","nextConfig","getNextConfigEdge","cacheMaxMemorySize","kind","cacheHandler","Object","entries","params","normalizeDynamicRouteParams","searchParams","waitUntil","closeController","previewProps","context","renderOpts","onClose","onAfterTaskError","undefined","cacheComponents","process","env","__NEXT_CACHE_COMPONENTS","validationLevel","experimental","authInterrupts","__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS","useCacheTimeout","durableUseCacheEntries","cacheLifeProfiles","cacheLife","staticPageGenerationTimeout","sharedContext","buildId","deploymentId","res","handle","waitUntilPromises","pendingWaitUntil","push","Promise","all","body","setTimeout","dispatchClose","trackedBody","Response","status","statusText","headers"],"mappings":"AAKA,OAAO,YAAW;AAElB,SAASA,OAAO,QAAgD,YAAW;AAC3E,SACEC,gBAAgB,QAEX,2BAA0B;AAEjC,SAASC,uBAAuB,EAAEC,eAAe,QAAQ,wBAAuB;AAEhF,SAASC,oCAAoC,QAAQ,6BAA4B;AACjF,SAASC,cAAc,QAAQ,kBAAiB;AAChD,SAASC,sBAAsB,QAAQ,4CAA2C;AAClF,SAASC,eAAe,EAAEC,mBAAmB,QAAQ,iBAAgB;AACrE,SAASC,mBAAmB,QAAQ,2BAA0B;AAC9D,SAASC,cAAc,QAAQ,6BAA4B;AAC3D,SAASC,cAAc,QAAQ,gCAA+B;AAQ9D;;;;CAIC,GACD,OAAO,MAAMC;IAGX;;;;;GAKC,GACD,YACE,AAAiBC,WAAgC,EACjD,AAAiBC,aAA2C,CAC5D;aAFiBD,cAAAA;aACAC,gBAAAA;QAEjB,IAAI,CAACC,aAAa,GAAGJ,eAAeE,YAAYG,UAAU,CAACC,QAAQ;IACrE;IAEA;;;;;;;;GAQC,GACD,OAAcC,KACZL,WAAgC,EAChCM,OAAoB,EACP;QACb,6BAA6B;QAC7B,MAAMC,UAAU,IAAIR,uBAClBC,aACAM,QAAQL,aAAa,IAAI,CAAC;QAG5B,gCAAgC;QAChC,OAAO,CAACO;YACN,OAAOrB,QAAQ;gBACb,GAAGqB,IAAI;gBACPpB;gBACAqB,yBAAyBH,QAAQG,uBAAuB;gBACxD,kEAAkE;gBAClEC,SAASH,QAAQ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wB;gBAC1B;gBACAC,mBAAmB5B,WAAW6B,SAAS;gBACvC,oEAAoE;gBACpE,iEAAiE;gBACjE,iEAAiE;gBACjEC,6BAA6B;YAC/B;YACAC,eAAe;gBACbC,SAAS;gBACTC,cAAc;YAChB;QACF;QAEA,qCAAqC;QACrC,IAAIC,MAAM,MAAM,IAAI,CAACtD,WAAW,CAACuD,MAAM,CAAC1C,SAASoB;QAEjD,MAAMuB,oBAAoB;YAACjE;SAAuC;QAClE,IAAI0C,QAAQC,UAAU,CAACuB,gBAAgB,EAAE;YACvCD,kBAAkBE,IAAI,CAACzB,QAAQC,UAAU,CAACuB,gBAAgB;QAC5D;QACA3C,IAAIgB,SAAS,CAAC6B,QAAQC,GAAG,CAACJ;QAE1B,IAAI,CAACF,IAAIO,IAAI,EAAE;YACb,+CAA+C;YAC/C,wDAAwD;YACxDC,WAAW,IAAM/B,gBAAgBgC,aAAa,IAAI;QACpD,OAAO;YACL,sEAAsE;YACtE,kFAAkF;YAClF,MAAMC,cAAcrE,oBAAoB2D,IAAIO,IAAI,EAAE,IAChD9B,gBAAgBgC,aAAa;YAE/BT,MAAM,IAAIW,SAASD,aAAa;gBAC9BE,QAAQZ,IAAIY,MAAM;gBAClBC,YAAYb,IAAIa,UAAU;gBAC1BC,SAASd,IAAIc,OAAO;YACtB;QACF;QAEA,OAAOd;IACT;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/error.js b/e-commerce/node_modules/next/dist/esm/server/web/error.js new file mode 100644 index 0000000000000000000000000000000000000000..731f2704e8e2b52e66f1ab313432f69989fdb521 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/error.js @@ -0,0 +1,28 @@ +export class PageSignatureError extends Error { + constructor({ page }){ + super(`The middleware "${page}" accepts an async API directly with the form: + + export function middleware(request, event) { + return NextResponse.redirect('/new-location') + } + + Read more: https://nextjs.org/docs/messages/middleware-new-signature + `); + } +} +export class RemovedPageError extends Error { + constructor(){ + super(`The request.page has been deprecated in favour of \`URLPattern\`. + Read more: https://nextjs.org/docs/messages/middleware-request-page + `); + } +} +export class RemovedUAError extends Error { + constructor(){ + super(`The request.ua has been removed in favour of \`userAgent\` function. + Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent + `); + } +} + +//# sourceMappingURL=error.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/error.js.map b/e-commerce/node_modules/next/dist/esm/server/web/error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c27ca1339d9299cd44bf4c20f0d4e6655054deb7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/error.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/web/error.ts"],"sourcesContent":["export class PageSignatureError extends Error {\n constructor({ page }: { page: string }) {\n super(`The middleware \"${page}\" accepts an async API directly with the form:\n \n export function middleware(request, event) {\n return NextResponse.redirect('/new-location')\n }\n \n Read more: https://nextjs.org/docs/messages/middleware-new-signature\n `)\n }\n}\n\nexport class RemovedPageError extends Error {\n constructor() {\n super(`The request.page has been deprecated in favour of \\`URLPattern\\`.\n Read more: https://nextjs.org/docs/messages/middleware-request-page\n `)\n }\n}\n\nexport class RemovedUAError extends Error {\n constructor() {\n super(`The request.ua has been removed in favour of \\`userAgent\\` function.\n Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent\n `)\n }\n}\n"],"names":["PageSignatureError","Error","constructor","page","RemovedPageError","RemovedUAError"],"mappings":"AAAA,OAAO,MAAMA,2BAA2BC;IACtCC,YAAY,EAAEC,IAAI,EAAoB,CAAE;QACtC,KAAK,CAAC,CAAC,gBAAgB,EAAEA,KAAK;;;;;;;EAOhC,CAAC;IACD;AACF;AAEA,OAAO,MAAMC,yBAAyBH;IACpCC,aAAc;QACZ,KAAK,CAAC,CAAC;;EAET,CAAC;IACD;AACF;AAEA,OAAO,MAAMG,uBAAuBJ;IAClCC,aAAc;QACZ,KAAK,CAAC,CAAC;;EAET,CAAC;IACD;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/exports/index.js b/e-commerce/node_modules/next/dist/esm/server/web/exports/index.js new file mode 100644 index 0000000000000000000000000000000000000000..9a99de5cb6b628164d0084f0a1556054e1887486 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/exports/index.js @@ -0,0 +1,10 @@ +// Alias index file of next/server for edge runtime for tree-shaking purpose +export { ImageResponse } from '../spec-extension/image-response'; +export { NextRequest } from '../spec-extension/request'; +export { NextResponse } from '../spec-extension/response'; +export { userAgent, userAgentFromString } from '../spec-extension/user-agent'; +export { URLPattern } from '../spec-extension/url-pattern'; +export { after } from '../../after'; +export { connection } from '../../request/connection'; + +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/exports/index.js.map b/e-commerce/node_modules/next/dist/esm/server/web/exports/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6b47e33a519b57c61b5e4b746460e42337af51c4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/exports/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/web/exports/index.ts"],"sourcesContent":["// Alias index file of next/server for edge runtime for tree-shaking purpose\n\nexport { ImageResponse } from '../spec-extension/image-response'\nexport { NextRequest } from '../spec-extension/request'\nexport { NextResponse } from '../spec-extension/response'\nexport { userAgent, userAgentFromString } from '../spec-extension/user-agent'\nexport { URLPattern } from '../spec-extension/url-pattern'\nexport { after } from '../../after'\nexport { connection } from '../../request/connection'\n"],"names":["ImageResponse","NextRequest","NextResponse","userAgent","userAgentFromString","URLPattern","after","connection"],"mappings":"AAAA,4EAA4E;AAE5E,SAASA,aAAa,QAAQ,mCAAkC;AAChE,SAASC,WAAW,QAAQ,4BAA2B;AACvD,SAASC,YAAY,QAAQ,6BAA4B;AACzD,SAASC,SAAS,EAAEC,mBAAmB,QAAQ,+BAA8B;AAC7E,SAASC,UAAU,QAAQ,gCAA+B;AAC1D,SAASC,KAAK,QAAQ,cAAa;AACnC,SAASC,UAAU,QAAQ,2BAA0B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/get-edge-preview-props.js b/e-commerce/node_modules/next/dist/esm/server/web/get-edge-preview-props.js new file mode 100644 index 0000000000000000000000000000000000000000..a102809712ae85b40706e202f18f0be2ffe3838a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/get-edge-preview-props.js @@ -0,0 +1,13 @@ +/** + * In edge runtime, these props directly accessed from environment variables. + * - local: env vars will be injected through edge-runtime as runtime env vars + * - deployment: env vars will be replaced by edge build pipeline + */ export function getEdgePreviewProps() { + return { + previewModeId: process.env.__NEXT_PREVIEW_MODE_ID || '', + previewModeSigningKey: process.env.__NEXT_PREVIEW_MODE_SIGNING_KEY || '', + previewModeEncryptionKey: process.env.__NEXT_PREVIEW_MODE_ENCRYPTION_KEY || '' + }; +} + +//# sourceMappingURL=get-edge-preview-props.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/get-edge-preview-props.js.map b/e-commerce/node_modules/next/dist/esm/server/web/get-edge-preview-props.js.map new file mode 100644 index 0000000000000000000000000000000000000000..eb9c5e7c73fba33b4ee916f0427239d1b018927e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/get-edge-preview-props.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/web/get-edge-preview-props.ts"],"sourcesContent":["/**\n * In edge runtime, these props directly accessed from environment variables.\n * - local: env vars will be injected through edge-runtime as runtime env vars\n * - deployment: env vars will be replaced by edge build pipeline\n */\nexport function getEdgePreviewProps() {\n return {\n previewModeId: process.env.__NEXT_PREVIEW_MODE_ID || '',\n previewModeSigningKey: process.env.__NEXT_PREVIEW_MODE_SIGNING_KEY || '',\n previewModeEncryptionKey:\n process.env.__NEXT_PREVIEW_MODE_ENCRYPTION_KEY || '',\n }\n}\n"],"names":["getEdgePreviewProps","previewModeId","process","env","__NEXT_PREVIEW_MODE_ID","previewModeSigningKey","__NEXT_PREVIEW_MODE_SIGNING_KEY","previewModeEncryptionKey","__NEXT_PREVIEW_MODE_ENCRYPTION_KEY"],"mappings":"AAAA;;;;CAIC,GACD,OAAO,SAASA;IACd,OAAO;QACLC,eAAeC,QAAQC,GAAG,CAACC,sBAAsB,IAAI;QACrDC,uBAAuBH,QAAQC,GAAG,CAACG,+BAA+B,IAAI;QACtEC,0BACEL,QAAQC,GAAG,CAACK,kCAAkC,IAAI;IACtD;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/globals.js b/e-commerce/node_modules/next/dist/esm/server/web/globals.js new file mode 100644 index 0000000000000000000000000000000000000000..d90ab2d6e95ac1995ae6ccee53009c34b6cfaa4f --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/globals.js @@ -0,0 +1,90 @@ +export async function getEdgeInstrumentationModule() { + const instrumentation = '_ENTRIES' in globalThis && _ENTRIES.middleware_instrumentation && await _ENTRIES.middleware_instrumentation; + return instrumentation; +} +let instrumentationModulePromise = null; +async function registerInstrumentation() { + // Ensure registerInstrumentation is not called in production build + if (process.env.NEXT_PHASE === 'phase-production-build') return; + if (!instrumentationModulePromise) { + instrumentationModulePromise = getEdgeInstrumentationModule(); + } + const instrumentation = await instrumentationModulePromise; + if (instrumentation == null ? void 0 : instrumentation.register) { + try { + await instrumentation.register(); + } catch (err) { + err.message = `An error occurred while loading instrumentation hook: ${err.message}`; + throw err; + } + } +} +export async function edgeInstrumentationOnRequestError(...args) { + const instrumentation = await getEdgeInstrumentationModule(); + try { + var _instrumentation_onRequestError; + await (instrumentation == null ? void 0 : (_instrumentation_onRequestError = instrumentation.onRequestError) == null ? void 0 : _instrumentation_onRequestError.call(instrumentation, ...args)); + } catch (err) { + // Log the soft error and continue, since the original error has already been thrown + console.error('Error in instrumentation.onRequestError:', err); + } +} +let registerInstrumentationPromise = null; +export function ensureInstrumentationRegistered() { + if (!registerInstrumentationPromise) { + registerInstrumentationPromise = registerInstrumentation(); + } + return registerInstrumentationPromise; +} +function getUnsupportedModuleErrorMessage(module) { + // warning: if you change these messages, you must adjust how dev-overlay's middleware detects modules not found + return `The edge runtime does not support Node.js '${module}' module. +Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`; +} +function __import_unsupported(moduleName) { + const proxy = new Proxy(function() {}, { + get (_obj, prop) { + if (prop === 'then') { + return {}; + } + throw new Error(getUnsupportedModuleErrorMessage(moduleName)); + }, + construct () { + throw new Error(getUnsupportedModuleErrorMessage(moduleName)); + }, + apply (_target, _this, args) { + if (typeof args[0] === 'function') { + return args[0](proxy); + } + throw new Error(getUnsupportedModuleErrorMessage(moduleName)); + } + }); + return new Proxy({}, { + get: ()=>proxy + }); +} +function enhanceGlobals() { + if (process.env.NEXT_RUNTIME !== 'edge') { + return; + } + // The condition is true when the "process" module is provided + if (process !== global.process) { + // prefer local process but global.process has correct "env" + process.env = global.process.env; + global.process = process; + } + // to allow building code that import but does not use node.js modules, + // webpack will expect this function to exist in global scope + try { + Object.defineProperty(globalThis, '__import_unsupported', { + value: __import_unsupported, + enumerable: false, + configurable: false + }); + } catch {} + // Eagerly fire instrumentation hook to make the startup faster. + void ensureInstrumentationRegistered(); +} +enhanceGlobals(); + +//# sourceMappingURL=globals.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/globals.js.map b/e-commerce/node_modules/next/dist/esm/server/web/globals.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f59910a13c29be02f572dc70dfea18beef78601a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/globals.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/web/globals.ts"],"sourcesContent":["import type {\n InstrumentationModule,\n InstrumentationOnRequestError,\n} from '../instrumentation/types'\n\ndeclare const _ENTRIES: any\n\nexport async function getEdgeInstrumentationModule(): Promise<\n InstrumentationModule | undefined\n> {\n const instrumentation =\n '_ENTRIES' in globalThis &&\n _ENTRIES.middleware_instrumentation &&\n (await _ENTRIES.middleware_instrumentation)\n\n return instrumentation\n}\n\nlet instrumentationModulePromise: Promise | null = null\nasync function registerInstrumentation() {\n // Ensure registerInstrumentation is not called in production build\n if (process.env.NEXT_PHASE === 'phase-production-build') return\n if (!instrumentationModulePromise) {\n instrumentationModulePromise = getEdgeInstrumentationModule()\n }\n const instrumentation = await instrumentationModulePromise\n if (instrumentation?.register) {\n try {\n await instrumentation.register()\n } catch (err: any) {\n err.message = `An error occurred while loading instrumentation hook: ${err.message}`\n throw err\n }\n }\n}\n\nexport async function edgeInstrumentationOnRequestError(\n ...args: Parameters\n) {\n const instrumentation = await getEdgeInstrumentationModule()\n try {\n await instrumentation?.onRequestError?.(...args)\n } catch (err) {\n // Log the soft error and continue, since the original error has already been thrown\n console.error('Error in instrumentation.onRequestError:', err)\n }\n}\n\nlet registerInstrumentationPromise: Promise | null = null\nexport function ensureInstrumentationRegistered() {\n if (!registerInstrumentationPromise) {\n registerInstrumentationPromise = registerInstrumentation()\n }\n return registerInstrumentationPromise\n}\n\nfunction getUnsupportedModuleErrorMessage(module: string) {\n // warning: if you change these messages, you must adjust how dev-overlay's middleware detects modules not found\n return `The edge runtime does not support Node.js '${module}' module.\nLearn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`\n}\n\nfunction __import_unsupported(moduleName: string) {\n const proxy: any = new Proxy(function () {}, {\n get(_obj, prop) {\n if (prop === 'then') {\n return {}\n }\n throw new Error(getUnsupportedModuleErrorMessage(moduleName))\n },\n construct() {\n throw new Error(getUnsupportedModuleErrorMessage(moduleName))\n },\n apply(_target, _this, args) {\n if (typeof args[0] === 'function') {\n return args[0](proxy)\n }\n throw new Error(getUnsupportedModuleErrorMessage(moduleName))\n },\n })\n return new Proxy({}, { get: () => proxy })\n}\n\nfunction enhanceGlobals() {\n if (process.env.NEXT_RUNTIME !== 'edge') {\n return\n }\n\n // The condition is true when the \"process\" module is provided\n if (process !== global.process) {\n // prefer local process but global.process has correct \"env\"\n process.env = global.process.env\n global.process = process\n }\n\n // to allow building code that import but does not use node.js modules,\n // webpack will expect this function to exist in global scope\n try {\n Object.defineProperty(globalThis, '__import_unsupported', {\n value: __import_unsupported,\n enumerable: false,\n configurable: false,\n })\n } catch {}\n\n // Eagerly fire instrumentation hook to make the startup faster.\n void ensureInstrumentationRegistered()\n}\n\nenhanceGlobals()\n"],"names":["getEdgeInstrumentationModule","instrumentation","globalThis","_ENTRIES","middleware_instrumentation","instrumentationModulePromise","registerInstrumentation","process","env","NEXT_PHASE","register","err","message","edgeInstrumentationOnRequestError","args","onRequestError","console","error","registerInstrumentationPromise","ensureInstrumentationRegistered","getUnsupportedModuleErrorMessage","module","__import_unsupported","moduleName","proxy","Proxy","get","_obj","prop","Error","construct","apply","_target","_this","enhanceGlobals","NEXT_RUNTIME","global","Object","defineProperty","value","enumerable","configurable"],"mappings":"AAOA,OAAO,eAAeA;IAGpB,MAAMC,kBACJ,cAAcC,cACdC,SAASC,0BAA0B,IAClC,MAAMD,SAASC,0BAA0B;IAE5C,OAAOH;AACT;AAEA,IAAII,+BAAoD;AACxD,eAAeC;IACb,mEAAmE;IACnE,IAAIC,QAAQC,GAAG,CAACC,UAAU,KAAK,0BAA0B;IACzD,IAAI,CAACJ,8BAA8B;QACjCA,+BAA+BL;IACjC;IACA,MAAMC,kBAAkB,MAAMI;IAC9B,IAAIJ,mCAAAA,gBAAiBS,QAAQ,EAAE;QAC7B,IAAI;YACF,MAAMT,gBAAgBS,QAAQ;QAChC,EAAE,OAAOC,KAAU;YACjBA,IAAIC,OAAO,GAAG,CAAC,sDAAsD,EAAED,IAAIC,OAAO,EAAE;YACpF,MAAMD;QACR;IACF;AACF;AAEA,OAAO,eAAeE,kCACpB,GAAGC,IAA+C;IAElD,MAAMb,kBAAkB,MAAMD;IAC9B,IAAI;YACIC;QAAN,OAAMA,oCAAAA,kCAAAA,gBAAiBc,cAAc,qBAA/Bd,qCAAAA,oBAAqCa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;AAEAe","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/http.js b/e-commerce/node_modules/next/dist/esm/server/web/http.js new file mode 100644 index 0000000000000000000000000000000000000000..6724d11521633c72eef75c1ba3f7860c49869859 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/http.js @@ -0,0 +1,23 @@ +/** + * List of valid HTTP methods that can be implemented by Next.js's Custom App + * Routes. + */ export const HTTP_METHODS = [ + 'GET', + 'HEAD', + 'OPTIONS', + 'POST', + 'PUT', + 'DELETE', + 'PATCH' +]; +/** + * Checks to see if the passed string is an HTTP method. Note that this is case + * sensitive. + * + * @param maybeMethod the string that may be an HTTP method + * @returns true if the string is an HTTP method + */ export function isHTTPMethod(maybeMethod) { + return HTTP_METHODS.includes(maybeMethod); +} + +//# sourceMappingURL=http.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/http.js.map b/e-commerce/node_modules/next/dist/esm/server/web/http.js.map new file mode 100644 index 0000000000000000000000000000000000000000..95fa5dd94c01bdb6f9357afe32b51a84ba820fd2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/http.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/web/http.ts"],"sourcesContent":["/**\n * List of valid HTTP methods that can be implemented by Next.js's Custom App\n * Routes.\n */\nexport const HTTP_METHODS = [\n 'GET',\n 'HEAD',\n 'OPTIONS',\n 'POST',\n 'PUT',\n 'DELETE',\n 'PATCH',\n] as const\n\n/**\n * A type representing the valid HTTP methods that can be implemented by\n * Next.js's Custom App Routes.\n */\nexport type HTTP_METHOD = (typeof HTTP_METHODS)[number]\n\n/**\n * Checks to see if the passed string is an HTTP method. Note that this is case\n * sensitive.\n *\n * @param maybeMethod the string that may be an HTTP method\n * @returns true if the string is an HTTP method\n */\nexport function isHTTPMethod(maybeMethod: string): maybeMethod is HTTP_METHOD {\n return HTTP_METHODS.includes(maybeMethod as HTTP_METHOD)\n}\n"],"names":["HTTP_METHODS","isHTTPMethod","maybeMethod","includes"],"mappings":"AAAA;;;CAGC,GACD,OAAO,MAAMA,eAAe;IAC1B;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAS;AAQV;;;;;;CAMC,GACD,OAAO,SAASC,aAAaC,WAAmB;IAC9C,OAAOF,aAAaG,QAAQ,CAACD;AAC/B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/internal-edge-wait-until.js b/e-commerce/node_modules/next/dist/esm/server/web/internal-edge-wait-until.js new file mode 100644 index 0000000000000000000000000000000000000000..e84db8df2ff3f492038b31ac6cd3705913b3c3c2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/internal-edge-wait-until.js @@ -0,0 +1,42 @@ +// An internal module to expose the "waitUntil" API to Edge SSR and Edge Route Handler functions. +// This is highly experimental and subject to change. +// We still need a global key to bypass Webpack's layering of modules. +const GLOBAL_KEY = Symbol.for('__next_internal_waitUntil__'); +const state = // @ts-ignore +globalThis[GLOBAL_KEY] || // @ts-ignore +(globalThis[GLOBAL_KEY] = { + waitUntilCounter: 0, + waitUntilResolve: undefined, + waitUntilPromise: null +}); +// No matter how many concurrent requests are being handled, we want to make sure +// that the final promise is only resolved once all of the waitUntil promises have +// settled. +function resolveOnePromise() { + state.waitUntilCounter--; + if (state.waitUntilCounter === 0) { + state.waitUntilResolve(); + state.waitUntilPromise = null; + } +} +export function internal_getCurrentFunctionWaitUntil() { + return state.waitUntilPromise; +} +export function internal_runWithWaitUntil(fn) { + const result = fn(); + if (result && typeof result === 'object' && 'then' in result && 'finally' in result && typeof result.then === 'function' && typeof result.finally === 'function') { + if (!state.waitUntilCounter) { + // Create the promise for the next batch of waitUntil calls. + state.waitUntilPromise = new Promise((resolve)=>{ + state.waitUntilResolve = resolve; + }); + } + state.waitUntilCounter++; + return result.finally(()=>{ + resolveOnePromise(); + }); + } + return result; +} + +//# sourceMappingURL=internal-edge-wait-until.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/internal-edge-wait-until.js.map b/e-commerce/node_modules/next/dist/esm/server/web/internal-edge-wait-until.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1861edcd9f0a1db76c01d87576d43237f4040f19 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/internal-edge-wait-until.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/web/internal-edge-wait-until.ts"],"sourcesContent":["// An internal module to expose the \"waitUntil\" API to Edge SSR and Edge Route Handler functions.\n// This is highly experimental and subject to change.\n\n// We still need a global key to bypass Webpack's layering of modules.\nconst GLOBAL_KEY = Symbol.for('__next_internal_waitUntil__')\n\nconst state: {\n waitUntilCounter: number\n waitUntilResolve: () => void\n waitUntilPromise: Promise | null\n} =\n // @ts-ignore\n globalThis[GLOBAL_KEY] ||\n // @ts-ignore\n (globalThis[GLOBAL_KEY] = {\n waitUntilCounter: 0,\n waitUntilResolve: undefined,\n waitUntilPromise: null,\n })\n\n// No matter how many concurrent requests are being handled, we want to make sure\n// that the final promise is only resolved once all of the waitUntil promises have\n// settled.\nfunction resolveOnePromise() {\n state.waitUntilCounter--\n if (state.waitUntilCounter === 0) {\n state.waitUntilResolve()\n state.waitUntilPromise = null\n }\n}\n\nexport function internal_getCurrentFunctionWaitUntil() {\n return state.waitUntilPromise\n}\n\nexport function internal_runWithWaitUntil(fn: () => T): T {\n const result = fn()\n if (\n result &&\n typeof result === 'object' &&\n 'then' in result &&\n 'finally' in result &&\n typeof result.then === 'function' &&\n typeof result.finally === 'function'\n ) {\n if (!state.waitUntilCounter) {\n // Create the promise for the next batch of waitUntil calls.\n state.waitUntilPromise = new Promise((resolve) => {\n state.waitUntilResolve = resolve\n })\n }\n state.waitUntilCounter++\n return result.finally(() => {\n resolveOnePromise()\n })\n }\n\n return result\n}\n"],"names":["GLOBAL_KEY","Symbol","for","state","globalThis","waitUntilCounter","waitUntilResolve","undefined","waitUntilPromise","resolveOnePromise","internal_getCurrentFunctionWaitUntil","internal_runWithWaitUntil","fn","result","then","finally","Promise","resolve"],"mappings":"AAAA,iGAAiG;AACjG,qDAAqD;AAErD,sEAAsE;AACtE,MAAMA,aAAaC,OAAOC,GAAG,CAAC;AAE9B,MAAMC,QAKJ,aAAa;AACbC,UAAU,CAACJ,WAAW,IACtB,aAAa;AACZI,CAAAA,UAAU,CAACJ,WAAW,GAAG;IACxBK,kBAAkB;IAClBC,kBAAkBC;IAClBC,kBAAkB;AACpB,CAAA;AAEF,iFAAiF;AACjF,kFAAkF;AAClF,WAAW;AACX,SAASC;IACPN,MAAME,gBAAgB;IACtB,IAAIF,MAAME,gBAAgB,KAAK,GAAG;QAChCF,MAAMG,gBAAgB;QACtBH,MAAMK,gBAAgB,GAAG;IAC3B;AACF;AAEA,OAAO,SAASE;IACd,OAAOP,MAAMK,gBAAgB;AAC/B;AAEA,OAAO,SAASG,0BAA6BC,EAAW;IACtD,MAAMC,SAASD;IACf,IACEC,UACA,OAAOA,WAAW,YAClB,UAAUA,UACV,aAAaA,UACb,OAAOA,OAAOC,IAAI,KAAK,cACvB,OAAOD,OAAOE,OAAO,KAAK,YAC1B;QACA,IAAI,CAACZ,MAAME,gBAAgB,EAAE;YAC3B,4DAA4D;YAC5DF,MAAMK,gBAAgB,GAAG,IAAIQ,QAAc,CAACC;gBAC1Cd,MAAMG,gBAAgB,GAAGW;YAC3B;QACF;QACAd,MAAME,gBAAgB;QACtB,OAAOQ,OAAOE,OAAO,CAAC;YACpBN;QACF;IACF;IAEA,OAAOI;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/next-url.js b/e-commerce/node_modules/next/dist/esm/server/web/next-url.js new file mode 100644 index 0000000000000000000000000000000000000000..d65d75483528979ab98ae0161ed834ef5328ce6b --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/next-url.js @@ -0,0 +1,185 @@ +import { detectDomainLocale } from '../../shared/lib/i18n/detect-domain-locale'; +import { formatNextPathnameInfo } from '../../shared/lib/router/utils/format-next-pathname-info'; +import { getHostname } from '../../shared/lib/get-hostname'; +import { getNextPathnameInfo } from '../../shared/lib/router/utils/get-next-pathname-info'; +const REGEX_LOCALHOST_HOSTNAME = /^(?:127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|\[::1\]|localhost)$/; +function parseURL(url, base) { + const parsed = new URL(String(url), base && String(base)); + if (REGEX_LOCALHOST_HOSTNAME.test(parsed.hostname)) { + parsed.hostname = 'localhost'; + } + return parsed; +} +const Internal = Symbol('NextURLInternal'); +export class NextURL { + constructor(input, baseOrOpts, opts){ + let base; + let options; + if (typeof baseOrOpts === 'object' && 'pathname' in baseOrOpts || typeof baseOrOpts === 'string') { + base = baseOrOpts; + options = opts || {}; + } else { + options = opts || baseOrOpts || {}; + } + this[Internal] = { + url: parseURL(input, base ?? options.base), + options: options, + basePath: '' + }; + this.analyze(); + } + analyze() { + var _this_Internal_options_nextConfig_i18n, _this_Internal_options_nextConfig, _this_Internal_domainLocale, _this_Internal_options_nextConfig_i18n1, _this_Internal_options_nextConfig1; + const info = getNextPathnameInfo(this[Internal].url.pathname, { + nextConfig: this[Internal].options.nextConfig, + parseData: !process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE, + i18nProvider: this[Internal].options.i18nProvider + }); + const hostname = getHostname(this[Internal].url, this[Internal].options.headers); + this[Internal].domainLocale = this[Internal].options.i18nProvider ? this[Internal].options.i18nProvider.detectDomainLocale(hostname) : detectDomainLocale((_this_Internal_options_nextConfig = this[Internal].options.nextConfig) == null ? void 0 : (_this_Internal_options_nextConfig_i18n = _this_Internal_options_nextConfig.i18n) == null ? void 0 : _this_Internal_options_nextConfig_i18n.domains, hostname); + const defaultLocale = ((_this_Internal_domainLocale = this[Internal].domainLocale) == null ? void 0 : _this_Internal_domainLocale.defaultLocale) || ((_this_Internal_options_nextConfig1 = this[Internal].options.nextConfig) == null ? void 0 : (_this_Internal_options_nextConfig_i18n1 = _this_Internal_options_nextConfig1.i18n) == null ? void 0 : _this_Internal_options_nextConfig_i18n1.defaultLocale); + this[Internal].url.pathname = info.pathname; + this[Internal].defaultLocale = defaultLocale; + this[Internal].basePath = info.basePath ?? ''; + this[Internal].buildId = info.buildId; + this[Internal].locale = info.locale ?? defaultLocale; + this[Internal].trailingSlash = info.trailingSlash; + } + formatPathname() { + return formatNextPathnameInfo({ + basePath: this[Internal].basePath, + buildId: this[Internal].buildId, + defaultLocale: !this[Internal].options.forceLocale ? this[Internal].defaultLocale : undefined, + locale: this[Internal].locale, + pathname: this[Internal].url.pathname, + trailingSlash: this[Internal].trailingSlash + }); + } + formatSearch() { + return this[Internal].url.search; + } + get buildId() { + return this[Internal].buildId; + } + set buildId(buildId) { + this[Internal].buildId = buildId; + } + get locale() { + return this[Internal].locale ?? ''; + } + set locale(locale) { + var _this_Internal_options_nextConfig_i18n, _this_Internal_options_nextConfig; + if (!this[Internal].locale || !((_this_Internal_options_nextConfig = this[Internal].options.nextConfig) == null ? void 0 : (_this_Internal_options_nextConfig_i18n = _this_Internal_options_nextConfig.i18n) == null ? void 0 : _this_Internal_options_nextConfig_i18n.locales.includes(locale))) { + throw new TypeError(`The NextURL configuration includes no locale "${locale}"`); + } + this[Internal].locale = locale; + } + get defaultLocale() { + return this[Internal].defaultLocale; + } + get domainLocale() { + return this[Internal].domainLocale; + } + get searchParams() { + return this[Internal].url.searchParams; + } + get host() { + return this[Internal].url.host; + } + set host(value) { + this[Internal].url.host = value; + } + get hostname() { + return this[Internal].url.hostname; + } + set hostname(value) { + this[Internal].url.hostname = value; + } + get port() { + return this[Internal].url.port; + } + set port(value) { + this[Internal].url.port = value; + } + get protocol() { + return this[Internal].url.protocol; + } + set protocol(value) { + this[Internal].url.protocol = value; + } + get href() { + const pathname = this.formatPathname(); + const search = this.formatSearch(); + return `${this.protocol}//${this.host}${pathname}${search}${this.hash}`; + } + set href(url) { + this[Internal].url = parseURL(url); + this.analyze(); + } + get origin() { + return this[Internal].url.origin; + } + get pathname() { + return this[Internal].url.pathname; + } + set pathname(value) { + this[Internal].url.pathname = value; + } + get hash() { + return this[Internal].url.hash; + } + set hash(value) { + this[Internal].url.hash = value; + } + get search() { + return this[Internal].url.search; + } + set search(value) { + this[Internal].url.search = value; + } + get password() { + return this[Internal].url.password; + } + set password(value) { + this[Internal].url.password = value; + } + get username() { + return this[Internal].url.username; + } + set username(value) { + this[Internal].url.username = value; + } + get basePath() { + return this[Internal].basePath; + } + set basePath(value) { + this[Internal].basePath = value.startsWith('/') ? value : `/${value}`; + } + toString() { + return this.href; + } + toJSON() { + return this.href; + } + [Symbol.for('edge-runtime.inspect.custom')]() { + return { + href: this.href, + origin: this.origin, + protocol: this.protocol, + username: this.username, + password: this.password, + host: this.host, + hostname: this.hostname, + port: this.port, + pathname: this.pathname, + search: this.search, + searchParams: this.searchParams, + hash: this.hash + }; + } + clone() { + return new NextURL(String(this), this[Internal].options); + } +} + +//# sourceMappingURL=next-url.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/next-url.js.map b/e-commerce/node_modules/next/dist/esm/server/web/next-url.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f70a74e6506fabcf85eb982ab4478c94d148bd61 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/next-url.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/web/next-url.ts"],"sourcesContent":["import type { OutgoingHttpHeaders } from 'http'\nimport type { DomainLocale, I18NConfig } from '../config-shared'\nimport type { I18NProvider } from '../lib/i18n-provider'\n\nimport { detectDomainLocale } from '../../shared/lib/i18n/detect-domain-locale'\nimport { formatNextPathnameInfo } from '../../shared/lib/router/utils/format-next-pathname-info'\nimport { getHostname } from '../../shared/lib/get-hostname'\nimport { getNextPathnameInfo } from '../../shared/lib/router/utils/get-next-pathname-info'\n\ninterface Options {\n base?: string | URL\n headers?: OutgoingHttpHeaders\n forceLocale?: boolean\n nextConfig?: {\n basePath?: string\n i18n?: I18NConfig | null\n trailingSlash?: boolean\n }\n i18nProvider?: I18NProvider\n}\n\nconst REGEX_LOCALHOST_HOSTNAME =\n /^(?:127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|\\[::1\\]|localhost)$/\n\nfunction parseURL(url: string | URL, base?: string | URL) {\n const parsed = new URL(String(url), base && String(base))\n if (REGEX_LOCALHOST_HOSTNAME.test(parsed.hostname)) {\n parsed.hostname = 'localhost'\n }\n return parsed\n}\n\nconst Internal = Symbol('NextURLInternal')\n\nexport class NextURL {\n private [Internal]: {\n basePath: string\n buildId?: string\n flightSearchParameters?: Record\n defaultLocale?: string\n domainLocale?: DomainLocale\n locale?: string\n options: Options\n trailingSlash?: boolean\n url: URL\n }\n\n constructor(input: string | URL, base?: string | URL, opts?: Options)\n constructor(input: string | URL, opts?: Options)\n constructor(\n input: string | URL,\n baseOrOpts?: string | URL | Options,\n opts?: Options\n ) {\n let base: undefined | string | URL\n let options: Options\n\n if (\n (typeof baseOrOpts === 'object' && 'pathname' in baseOrOpts) ||\n typeof baseOrOpts === 'string'\n ) {\n base = baseOrOpts\n options = opts || {}\n } else {\n options = opts || baseOrOpts || {}\n }\n\n this[Internal] = {\n url: parseURL(input, base ?? options.base),\n options: options,\n basePath: '',\n }\n\n this.analyze()\n }\n\n private analyze() {\n const info = getNextPathnameInfo(this[Internal].url.pathname, {\n nextConfig: this[Internal].options.nextConfig,\n parseData: !process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE,\n i18nProvider: this[Internal].options.i18nProvider,\n })\n\n const hostname = getHostname(\n this[Internal].url,\n this[Internal].options.headers\n )\n this[Internal].domainLocale = this[Internal].options.i18nProvider\n ? this[Internal].options.i18nProvider.detectDomainLocale(hostname)\n : detectDomainLocale(\n this[Internal].options.nextConfig?.i18n?.domains,\n hostname\n )\n\n const defaultLocale =\n this[Internal].domainLocale?.defaultLocale ||\n this[Internal].options.nextConfig?.i18n?.defaultLocale\n\n this[Internal].url.pathname = info.pathname\n this[Internal].defaultLocale = defaultLocale\n this[Internal].basePath = info.basePath ?? ''\n this[Internal].buildId = info.buildId\n this[Internal].locale = info.locale ?? defaultLocale\n this[Internal].trailingSlash = info.trailingSlash\n }\n\n private formatPathname() {\n return formatNextPathnameInfo({\n basePath: this[Internal].basePath,\n buildId: this[Internal].buildId,\n defaultLocale: !this[Internal].options.forceLocale\n ? this[Internal].defaultLocale\n : undefined,\n locale: this[Internal].locale,\n pathname: this[Internal].url.pathname,\n trailingSlash: this[Internal].trailingSlash,\n })\n }\n\n private formatSearch() {\n return this[Internal].url.search\n }\n\n public get buildId() {\n return this[Internal].buildId\n }\n\n public set buildId(buildId: string | undefined) {\n this[Internal].buildId = buildId\n }\n\n public get locale() {\n return this[Internal].locale ?? ''\n }\n\n public set locale(locale: string) {\n if (\n !this[Internal].locale ||\n !this[Internal].options.nextConfig?.i18n?.locales.includes(locale)\n ) {\n throw new TypeError(\n `The NextURL configuration includes no locale \"${locale}\"`\n )\n }\n\n this[Internal].locale = locale\n }\n\n get defaultLocale() {\n return this[Internal].defaultLocale\n }\n\n get domainLocale() {\n return this[Internal].domainLocale\n }\n\n get searchParams() {\n return this[Internal].url.searchParams\n }\n\n get host() {\n return this[Internal].url.host\n }\n\n set host(value: string) {\n this[Internal].url.host = value\n }\n\n get hostname() {\n return this[Internal].url.hostname\n }\n\n set hostname(value: string) {\n this[Internal].url.hostname = value\n }\n\n get port() {\n return this[Internal].url.port\n }\n\n set port(value: string) {\n this[Internal].url.port = value\n }\n\n get protocol() {\n return this[Internal].url.protocol\n }\n\n set protocol(value: string) {\n this[Internal].url.protocol = value\n }\n\n get href() {\n const pathname = this.formatPathname()\n const search = this.formatSearch()\n return `${this.protocol}//${this.host}${pathname}${search}${this.hash}`\n }\n\n set href(url: string) {\n this[Internal].url = parseURL(url)\n this.analyze()\n }\n\n get origin() {\n return this[Internal].url.origin\n }\n\n get pathname() {\n return this[Internal].url.pathname\n }\n\n set pathname(value: string) {\n this[Internal].url.pathname = value\n }\n\n get hash() {\n return this[Internal].url.hash\n }\n\n set hash(value: string) {\n this[Internal].url.hash = value\n }\n\n get search() {\n return this[Internal].url.search\n }\n\n set search(value: string) {\n this[Internal].url.search = value\n }\n\n get password() {\n return this[Internal].url.password\n }\n\n set password(value: string) {\n this[Internal].url.password = value\n }\n\n get username() {\n return this[Internal].url.username\n }\n\n set username(value: string) {\n this[Internal].url.username = value\n }\n\n get basePath() {\n return this[Internal].basePath\n }\n\n set basePath(value: string) {\n this[Internal].basePath = value.startsWith('/') ? value : `/${value}`\n }\n\n toString() {\n return this.href\n }\n\n toJSON() {\n return this.href\n }\n\n [Symbol.for('edge-runtime.inspect.custom')]() {\n return {\n href: this.href,\n origin: this.origin,\n protocol: this.protocol,\n username: this.username,\n password: this.password,\n host: this.host,\n hostname: this.hostname,\n port: this.port,\n pathname: this.pathname,\n search: this.search,\n searchParams: this.searchParams,\n hash: this.hash,\n }\n }\n\n clone() {\n return new NextURL(String(this), this[Internal].options)\n }\n}\n"],"names":["detectDomainLocale","formatNextPathnameInfo","getHostname","getNextPathnameInfo","REGEX_LOCALHOST_HOSTNAME","parseURL","url","base","parsed","URL","String","test","hostname","Internal","Symbol","NextURL","constructor","input","baseOrOpts","opts","options","basePath","analyze","info","pathname","nextConfig","parseData","process","env","__NEXT_NO_MIDDLEWARE_URL_NORMALIZE","i18nProvider","headers","domainLocale","i18n","domains","defaultLocale","buildId","locale","trailingSlash","formatPathname","forceLocale","undefined","formatSearch","search","locales","includes","TypeError","searchParams","host","value","port","protocol","href","hash","origin","password","username","startsWith","toString","toJSON","for","clone"],"mappings":"AAIA,SAASA,kBAAkB,QAAQ,6CAA4C;AAC/E,SAASC,sBAAsB,QAAQ,0DAAyD;AAChG,SAASC,WAAW,QAAQ,gCAA+B;AAC3D,SAASC,mBAAmB,QAAQ,uDAAsD;AAc1F,MAAMC,2BACJ;AAEF,SAASC,SAASC,GAAiB,EAAEC,IAAmB;IACtD,MAAMC,SAAS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IAEA,IAAIA,SAASN,KAAa,EAAE;QAC1B,IAAI,CAACpC,SAAS,CAACP,GAAG,CAACiD,QAAQ,GAAGN;IAChC;IAEA,IAAIO,WAAW;QACb,OAAO,IAAI,CAAC3C,SAAS,CAACP,GAAG,CAACkD,QAAQ;IACpC;IAEA,IAAIA,SAASP,KAAa,EAAE;QAC1B,IAAI,CAACpC,SAAS,CAACP,GAAG,CAACkD,QAAQ,GAAGP;IAChC;IAEA,IAAI5B,WAAW;QACb,OAAO,IAAI,CAACR,SAAS,CAACQ,QAAQ;IAChC;IAEA,IAAIA,SAAS4B,KAAa,EAAE;QAC1B,IAAI,CAACpC,SAAS,CAACQ,QAAQ,GAAG4B,MAAMQ,UAAU,CAAC,OAAOR,QAAQ,CAAC,CAAC,EAAEA,OAAO;IACvE;IAEAS,WAAW;QACT,OAAO,IAAI,CAACN,IAAI;IAClB;IAEAO,SAAS;QACP,OAAO,IAAI,CAACP,IAAI;IAClB;IAEA,CAACtC,OAAO8C,GAAG,CAAC,+BAA+B,GAAG;QAC5C,OAAO;YACLR,MAAM,IAAI,CAACA,IAAI;YACfE,QAAQ,IAAI,CAACA,MAAM;YACnBH,UAAU,IAAI,CAACA,QAAQ;YACvBK,UAAU,IAAI,CAACA,QAAQ;YACvBD,UAAU,IAAI,CAACA,QAAQ;YACvBP,MAAM,IAAI,CAACA,IAAI;YACfpC,UAAU,IAAI,CAACA,QAAQ;YACvBsC,MAAM,IAAI,CAACA,IAAI;YACf1B,UAAU,IAAI,CAACA,QAAQ;YACvBmB,QAAQ,IAAI,CAACA,MAAM;YACnBI,cAAc,IAAI,CAACA,YAAY;YAC/BM,MAAM,IAAI,CAACA,IAAI;QACjB;IACF;IAEAQ,QAAQ;QACN,OAAO,IAAI9C,QAAQL,OAAO,IAAI,GAAG,IAAI,CAACG,SAAS,CAACO,OAAO;IACzD;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/sandbox/context.js b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/context.js new file mode 100644 index 0000000000000000000000000000000000000000..d222be9b473623608679de0e3652167b7dc55763 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/context.js @@ -0,0 +1,419 @@ +import { AsyncLocalStorage } from 'async_hooks'; +import { COMPILER_NAMES, EDGE_UNSUPPORTED_NODE_APIS } from '../../../shared/lib/constants'; +import { EdgeRuntime } from 'next/dist/compiled/edge-runtime'; +import { readFileSync, promises as fs } from 'fs'; +import { validateURL } from '../utils'; +import { pick } from '../../../lib/pick'; +import { fetchInlineAsset } from './fetch-inline-assets'; +import { runInContext } from 'vm'; +import BufferImplementation from 'node:buffer'; +import EventsImplementation from 'node:events'; +import AssertImplementation from 'node:assert'; +import UtilImplementation from 'node:util'; +import AsyncHooksImplementation from 'node:async_hooks'; +import { intervalsManager, timeoutsManager } from './resource-managers'; +import { createLocalRequestContext } from '../../after/builtin-request-context'; +import { patchErrorInspectEdgeLite, patchErrorInspectNodeJS } from '../../patch-error-inspect'; +let getServerError; +let decorateServerError; +if (process.env.NODE_ENV === 'development') { + getServerError = require('../../dev/node-stack-frames').getServerError; + decorateServerError = require('../../../shared/lib/error-source').decorateServerError; +} else { + getServerError = (error)=>error; + decorateServerError = ()=>{}; +} +/** + * A Map of cached module contexts indexed by the module name. It allows + * to have a different cache scoped per module name or depending on the + * provided module key on creation. + */ const moduleContexts = new Map(); +const pendingModuleCaches = new Map(); +/** + * Same as clearModuleContext but for all module contexts. + */ export async function clearAllModuleContexts() { + intervalsManager.removeAll(); + timeoutsManager.removeAll(); + moduleContexts.clear(); + pendingModuleCaches.clear(); +} +/** + * For a given path a context, this function checks if there is any module + * context that contains the path with an older content and, if that's the + * case, removes the context from the cache. + * + * This function also clears all intervals and timeouts created by the + * module context. + */ export async function clearModuleContext(path) { + intervalsManager.removeAll(); + timeoutsManager.removeAll(); + const handleContext = (key, cache, context)=>{ + if (cache == null ? void 0 : cache.paths.has(path)) { + context.delete(key); + } + }; + for (const [key, cache] of moduleContexts){ + handleContext(key, cache, moduleContexts); + } + for (const [key, cache] of pendingModuleCaches){ + handleContext(key, await cache, pendingModuleCaches); + } +} +async function loadWasm(wasm) { + const modules = {}; + await Promise.all(wasm.map(async (binding)=>{ + const module = await WebAssembly.compile(// @ts-expect-error - Argument of type 'Buffer' is not assignable to parameter of type 'BufferSource'. + await fs.readFile(binding.filePath)); + modules[binding.name] = module; + })); + return modules; +} +function buildEnvironmentVariablesFrom(injectedEnvironments) { + let env = Object.fromEntries([ + ...Object.entries(process.env), + ...Object.entries(injectedEnvironments), + [ + 'NEXT_RUNTIME', + 'edge' + ] + ]); + return env; +} +function throwUnsupportedAPIError(name) { + const error = new Error(`A Node.js API is used (${name}) which is not supported in the Edge Runtime. +Learn more: https://nextjs.org/docs/api-reference/edge-runtime`); + decorateServerError(error, COMPILER_NAMES.edgeServer); + throw error; +} +function createProcessPolyfill(env) { + const processPolyfill = { + env: buildEnvironmentVariablesFrom(env) + }; + const overriddenValue = {}; + for (const key of Object.keys(process)){ + if (key === 'env') continue; + Object.defineProperty(processPolyfill, key, { + get () { + if (overriddenValue[key] !== undefined) { + return overriddenValue[key]; + } + if (typeof process[key] === 'function') { + return ()=>throwUnsupportedAPIError(`process.${key}`); + } + return undefined; + }, + set (value) { + overriddenValue[key] = value; + }, + enumerable: false + }); + } + return processPolyfill; +} +function addStub(context, name) { + Object.defineProperty(context, name, { + get () { + return function() { + throwUnsupportedAPIError(name); + }; + }, + enumerable: false + }); +} +function getDecorateUnhandledError(runtime) { + const EdgeRuntimeError = runtime.evaluate(`Error`); + return (error)=>{ + if (error instanceof EdgeRuntimeError) { + decorateServerError(error, COMPILER_NAMES.edgeServer); + } + }; +} +function getDecorateUnhandledRejection(runtime) { + const EdgeRuntimeError = runtime.evaluate(`Error`); + return (rejected)=>{ + if (rejected.reason instanceof EdgeRuntimeError) { + decorateServerError(rejected.reason, COMPILER_NAMES.edgeServer); + } + }; +} +const NativeModuleMap = (()=>{ + const mods = { + 'node:buffer': pick(BufferImplementation, [ + 'constants', + 'kMaxLength', + 'kStringMaxLength', + 'Buffer', + 'SlowBuffer' + ]), + 'node:events': pick(EventsImplementation, [ + 'EventEmitter', + 'captureRejectionSymbol', + 'defaultMaxListeners', + 'errorMonitor', + 'listenerCount', + 'on', + 'once' + ]), + 'node:async_hooks': pick(AsyncHooksImplementation, [ + 'AsyncLocalStorage', + 'AsyncResource' + ]), + 'node:assert': pick(AssertImplementation, [ + 'AssertionError', + 'deepEqual', + 'deepStrictEqual', + 'doesNotMatch', + 'doesNotReject', + 'doesNotThrow', + 'equal', + 'fail', + 'ifError', + 'match', + 'notDeepEqual', + 'notDeepStrictEqual', + 'notEqual', + 'notStrictEqual', + 'ok', + 'rejects', + 'strict', + 'strictEqual', + 'throws' + ]), + 'node:util': pick(UtilImplementation, [ + '_extend', + 'callbackify', + 'format', + 'inherits', + 'promisify', + 'types' + ]) + }; + return new Map(Object.entries(mods)); +})(); +export const requestStore = new AsyncLocalStorage(); +export const edgeSandboxNextRequestContext = createLocalRequestContext(); +/** + * Create a module cache specific for the provided parameters. It includes + * a runtime context, require cache and paths cache. + */ async function createModuleContext(options) { + const warnedEvals = new Set(); + const warnedWasmCodegens = new Set(); + const { edgeFunctionEntry } = options; + const wasm = await loadWasm(edgeFunctionEntry.wasm ?? []); + const runtime = new EdgeRuntime({ + codeGeneration: process.env.NODE_ENV !== 'production' ? { + strings: true, + wasm: true + } : undefined, + extend: (context)=>{ + context.process = createProcessPolyfill(edgeFunctionEntry.env); + Object.defineProperty(context, 'require', { + enumerable: false, + value: (id)=>{ + const value = NativeModuleMap.get(id); + if (!value) { + throw TypeError('Native module not found: ' + id); + } + return value; + } + }); + if (process.env.NODE_ENV !== 'production') { + context.__next_log_error__ = function(err) { + options.onError(err); + }; + } + context.__next_eval__ = function __next_eval__(fn) { + const key = fn.toString(); + if (!warnedEvals.has(key)) { + const warning = getServerError(new Error(`Dynamic Code Evaluation (e. g. 'eval', 'new Function') not allowed in Edge Runtime +Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation`), COMPILER_NAMES.edgeServer); + warning.name = 'DynamicCodeEvaluationWarning'; + Error.captureStackTrace(warning, __next_eval__); + warnedEvals.add(key); + options.onWarning(warning); + } + return fn(); + }; + context.__next_webassembly_compile__ = function __next_webassembly_compile__(fn) { + const key = fn.toString(); + if (!warnedWasmCodegens.has(key)) { + const warning = getServerError(new Error(`Dynamic WASM code generation (e. g. 'WebAssembly.compile') not allowed in Edge Runtime. +Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation`), COMPILER_NAMES.edgeServer); + warning.name = 'DynamicWasmCodeGenerationWarning'; + Error.captureStackTrace(warning, __next_webassembly_compile__); + warnedWasmCodegens.add(key); + options.onWarning(warning); + } + return fn(); + }; + context.__next_webassembly_instantiate__ = async function __next_webassembly_instantiate__(fn) { + const result = await fn(); + // If a buffer is given, WebAssembly.instantiate returns an object + // containing both a module and an instance while it returns only an + // instance if a WASM module is given. Utilize the fact to determine + // if the WASM code generation happens. + // + // https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiate#primary_overload_%E2%80%94_taking_wasm_binary_code + const instantiatedFromBuffer = result.hasOwnProperty('module'); + const key = fn.toString(); + if (instantiatedFromBuffer && !warnedWasmCodegens.has(key)) { + const warning = getServerError(new Error(`Dynamic WASM code generation ('WebAssembly.instantiate' with a buffer parameter) not allowed in Edge Runtime. +Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation`), COMPILER_NAMES.edgeServer); + warning.name = 'DynamicWasmCodeGenerationWarning'; + Error.captureStackTrace(warning, __next_webassembly_instantiate__); + warnedWasmCodegens.add(key); + options.onWarning(warning); + } + return result; + }; + const __fetch = context.fetch; + context.fetch = async (input, init = {})=>{ + const callingError = new Error('[internal]'); + const assetResponse = await fetchInlineAsset({ + input, + assets: options.edgeFunctionEntry.assets, + distDir: options.distDir, + context + }); + if (assetResponse) { + return assetResponse; + } + init.headers = new Headers(init.headers ?? {}); + if (!init.headers.has('user-agent')) { + init.headers.set(`user-agent`, `Next.js Middleware`); + } + const response = typeof input === 'object' && 'url' in input ? __fetch(input.url, { + ...pick(input, [ + 'method', + 'body', + 'cache', + 'credentials', + 'integrity', + 'keepalive', + 'mode', + 'redirect', + 'referrer', + 'referrerPolicy', + 'signal' + ]), + ...init, + headers: { + ...Object.fromEntries(input.headers), + ...Object.fromEntries(init.headers) + } + }) : __fetch(String(input), init); + return await response.catch((err)=>{ + callingError.message = err.message; + err.stack = callingError.stack; + throw err; + }); + }; + const __Request = context.Request; + context.Request = class extends __Request { + constructor(input, init){ + const url = typeof input !== 'string' && 'url' in input ? input.url : String(input); + if (typeof input === 'string') { + validateURL(url); + super(input, init); + } else { + super(input, init); + validateURL(url); + } + this.next = init == null ? void 0 : init.next; + } + }; + const __redirect = context.Response.redirect.bind(context.Response); + context.Response.redirect = (...args)=>{ + validateURL(args[0]); + return __redirect(...args); + }; + for (const name of EDGE_UNSUPPORTED_NODE_APIS){ + addStub(context, name); + } + Object.assign(context, wasm); + context.performance = performance; + context.AsyncLocalStorage = AsyncLocalStorage; + // @ts-ignore the timeouts have weird types in the edge runtime + context.setInterval = (...args)=>intervalsManager.add([ + context, + ...args + ]); + // @ts-ignore the timeouts have weird types in the edge runtime + context.clearInterval = (interval)=>intervalsManager.remove(interval); + // @ts-ignore the timeouts have weird types in the edge runtime + context.setTimeout = (...args)=>timeoutsManager.add([ + context, + ...args + ]); + // @ts-ignore the timeouts have weird types in the edge runtime + context.clearTimeout = (timeout)=>timeoutsManager.remove(timeout); + // Duplicated from packages/next/src/server/after/builtin-request-context.ts + // because we need to use the sandboxed `Symbol.for`, not the one from the outside + const NEXT_REQUEST_CONTEXT_SYMBOL = context.Symbol.for('@next/request-context'); + Object.defineProperty(context, NEXT_REQUEST_CONTEXT_SYMBOL, { + enumerable: false, + value: edgeSandboxNextRequestContext + }); + return context; + } + }); + const decorateUnhandledError = getDecorateUnhandledError(runtime); + runtime.context.addEventListener('error', decorateUnhandledError); + const decorateUnhandledRejection = getDecorateUnhandledRejection(runtime); + runtime.context.addEventListener('unhandledrejection', decorateUnhandledRejection); + patchErrorInspectEdgeLite(runtime.context.Error); + // An Error from within the Edge Runtime could also bubble up into the Node.js process. + // For example, uncaught errors are handled in the Node.js runtime. + patchErrorInspectNodeJS(runtime.context.Error); + return { + runtime, + paths: new Map(), + warnedEvals: new Set() + }; +} +function getModuleContextShared(options) { + let deferredModuleContext = pendingModuleCaches.get(options.moduleName); + if (!deferredModuleContext) { + deferredModuleContext = createModuleContext(options); + pendingModuleCaches.set(options.moduleName, deferredModuleContext); + } + return deferredModuleContext; +} +/** + * For a given module name this function will get a cached module + * context or create it. It will return the module context along + * with a function that allows to run some code from a given + * filepath within the context. + */ export async function getModuleContext(options) { + let lazyModuleContext; + if (options.useCache) { + lazyModuleContext = moduleContexts.get(options.moduleName) || await getModuleContextShared(options); + } + if (!lazyModuleContext) { + lazyModuleContext = await createModuleContext(options); + moduleContexts.set(options.moduleName, lazyModuleContext); + } + const moduleContext = lazyModuleContext; + const evaluateInContext = (filepath)=>{ + if (!moduleContext.paths.has(filepath)) { + const content = readFileSync(filepath, 'utf-8'); + try { + runInContext(content, moduleContext.runtime.context, { + filename: filepath + }); + moduleContext.paths.set(filepath, content); + } catch (error) { + if (options.useCache) { + moduleContext == null ? void 0 : moduleContext.paths.delete(filepath); + } + throw error; + } + } + }; + return { + ...moduleContext, + evaluateInContext + }; +} + +//# sourceMappingURL=context.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/sandbox/context.js.map b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/context.js.map new file mode 100644 index 0000000000000000000000000000000000000000..bc3364d68fcf92b94e3453eca0ed41c90d491e53 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/context.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/web/sandbox/context.ts"],"sourcesContent":["import type { AssetBinding } from '../../../build/webpack/loaders/get-module-build-info'\nimport type {\n EdgeFunctionDefinition,\n SUPPORTED_NATIVE_MODULES,\n} from '../../../build/webpack/plugins/middleware-plugin'\nimport type { UnwrapPromise } from '../../../lib/coalesced-function'\nimport { AsyncLocalStorage } from 'async_hooks'\nimport {\n COMPILER_NAMES,\n EDGE_UNSUPPORTED_NODE_APIS,\n} from '../../../shared/lib/constants'\nimport { EdgeRuntime } from 'next/dist/compiled/edge-runtime'\nimport { readFileSync, promises as fs } from 'fs'\nimport { validateURL } from '../utils'\nimport { pick } from '../../../lib/pick'\nimport { fetchInlineAsset } from './fetch-inline-assets'\nimport { runInContext } from 'vm'\nimport BufferImplementation from 'node:buffer'\nimport EventsImplementation from 'node:events'\nimport AssertImplementation from 'node:assert'\nimport UtilImplementation from 'node:util'\nimport AsyncHooksImplementation from 'node:async_hooks'\nimport { intervalsManager, timeoutsManager } from './resource-managers'\nimport { createLocalRequestContext } from '../../after/builtin-request-context'\nimport {\n patchErrorInspectEdgeLite,\n patchErrorInspectNodeJS,\n} from '../../patch-error-inspect'\n\ninterface ModuleContext {\n runtime: EdgeRuntime\n paths: Map\n warnedEvals: Set\n}\n\nlet getServerError: typeof import('../../dev/node-stack-frames').getServerError\nlet decorateServerError: typeof import('../../../shared/lib/error-source').decorateServerError\n\nif (process.env.NODE_ENV === 'development') {\n getServerError = (\n require('../../dev/node-stack-frames') as typeof import('../../dev/node-stack-frames') as typeof import('../../dev/node-stack-frames')\n ).getServerError\n decorateServerError = (\n require('../../../shared/lib/error-source') as typeof import('../../../shared/lib/error-source')\n ).decorateServerError\n} else {\n getServerError = (error) => error\n decorateServerError = () => {}\n}\n\n/**\n * A Map of cached module contexts indexed by the module name. It allows\n * to have a different cache scoped per module name or depending on the\n * provided module key on creation.\n */\nconst moduleContexts = new Map()\n\nconst pendingModuleCaches = new Map>()\n\n/**\n * Same as clearModuleContext but for all module contexts.\n */\nexport async function clearAllModuleContexts() {\n intervalsManager.removeAll()\n timeoutsManager.removeAll()\n moduleContexts.clear()\n pendingModuleCaches.clear()\n}\n\n/**\n * For a given path a context, this function checks if there is any module\n * context that contains the path with an older content and, if that's the\n * case, removes the context from the cache.\n *\n * This function also clears all intervals and timeouts created by the\n * module context.\n */\nexport async function clearModuleContext(path: string) {\n intervalsManager.removeAll()\n timeoutsManager.removeAll()\n\n const handleContext = (\n key: string,\n cache: ReturnType<(typeof moduleContexts)['get']>,\n context: typeof moduleContexts | typeof pendingModuleCaches\n ) => {\n if (cache?.paths.has(path)) {\n context.delete(key)\n }\n }\n\n for (const [key, cache] of moduleContexts) {\n handleContext(key, cache, moduleContexts)\n }\n for (const [key, cache] of pendingModuleCaches) {\n handleContext(key, await cache, pendingModuleCaches)\n }\n}\n\nasync function loadWasm(\n wasm: AssetBinding[]\n): Promise> {\n const modules: Record = {}\n\n await Promise.all(\n wasm.map(async (binding) => {\n const module = await WebAssembly.compile(\n // @ts-expect-error - Argument of type 'Buffer' is not assignable to parameter of type 'BufferSource'.\n await fs.readFile(binding.filePath)\n )\n modules[binding.name] = module\n })\n )\n\n return modules\n}\n\nfunction buildEnvironmentVariablesFrom(\n injectedEnvironments: Record\n): Record {\n let env = Object.fromEntries([\n ...Object.entries(process.env),\n ...Object.entries(injectedEnvironments),\n ['NEXT_RUNTIME', 'edge'],\n ])\n return env\n}\n\nfunction throwUnsupportedAPIError(name: string) {\n const error =\n new Error(`A Node.js API is used (${name}) which is not supported in the Edge Runtime.\nLearn more: https://nextjs.org/docs/api-reference/edge-runtime`)\n decorateServerError(error, COMPILER_NAMES.edgeServer)\n throw error\n}\n\nfunction createProcessPolyfill(env: Record) {\n const processPolyfill = { env: buildEnvironmentVariablesFrom(env) }\n const overriddenValue: Record = {}\n\n for (const key of Object.keys(process)) {\n if (key === 'env') continue\n Object.defineProperty(processPolyfill, key, {\n get() {\n if (overriddenValue[key] !== undefined) {\n return overriddenValue[key]\n }\n if (typeof (process as any)[key] === 'function') {\n return () => throwUnsupportedAPIError(`process.${key}`)\n }\n return undefined\n },\n set(value) {\n overriddenValue[key] = value\n },\n enumerable: false,\n })\n }\n return processPolyfill\n}\n\nfunction addStub(context: EdgeRuntime['context'], name: string) {\n Object.defineProperty(context, name, {\n get() {\n return function () {\n throwUnsupportedAPIError(name)\n }\n },\n enumerable: false,\n })\n}\n\nfunction getDecorateUnhandledError(runtime: EdgeRuntime) {\n const EdgeRuntimeError = runtime.evaluate(`Error`)\n return (error: any) => {\n if (error instanceof EdgeRuntimeError) {\n decorateServerError(error, COMPILER_NAMES.edgeServer)\n }\n }\n}\n\nfunction getDecorateUnhandledRejection(runtime: EdgeRuntime) {\n const EdgeRuntimeError = runtime.evaluate(`Error`)\n return (rejected: { reason: typeof EdgeRuntimeError }) => {\n if (rejected.reason instanceof EdgeRuntimeError) {\n decorateServerError(rejected.reason, COMPILER_NAMES.edgeServer)\n }\n }\n}\n\nconst NativeModuleMap = (() => {\n const mods: Record<\n `node:${(typeof SUPPORTED_NATIVE_MODULES)[number]}`,\n unknown\n > = {\n 'node:buffer': pick(BufferImplementation, [\n 'constants',\n 'kMaxLength',\n 'kStringMaxLength',\n 'Buffer',\n 'SlowBuffer',\n ]),\n 'node:events': pick(EventsImplementation, [\n 'EventEmitter',\n 'captureRejectionSymbol',\n 'defaultMaxListeners',\n 'errorMonitor',\n 'listenerCount',\n 'on',\n 'once',\n ]),\n 'node:async_hooks': pick(AsyncHooksImplementation, [\n 'AsyncLocalStorage',\n 'AsyncResource',\n ]),\n 'node:assert': pick(AssertImplementation, [\n 'AssertionError',\n 'deepEqual',\n 'deepStrictEqual',\n 'doesNotMatch',\n 'doesNotReject',\n 'doesNotThrow',\n 'equal',\n 'fail',\n 'ifError',\n 'match',\n 'notDeepEqual',\n 'notDeepStrictEqual',\n 'notEqual',\n 'notStrictEqual',\n 'ok',\n 'rejects',\n 'strict',\n 'strictEqual',\n 'throws',\n ]),\n 'node:util': pick(UtilImplementation, [\n '_extend' as any,\n 'callbackify',\n 'format',\n 'inherits',\n 'promisify',\n 'types',\n ]),\n }\n return new Map(Object.entries(mods))\n})()\n\nexport const requestStore = new AsyncLocalStorage<{\n headers: Headers\n}>()\n\nexport const edgeSandboxNextRequestContext = createLocalRequestContext()\n\n/**\n * Create a module cache specific for the provided parameters. It includes\n * a runtime context, require cache and paths cache.\n */\nasync function createModuleContext(options: ModuleContextOptions) {\n const warnedEvals = new Set()\n const warnedWasmCodegens = new Set()\n const { edgeFunctionEntry } = options\n const wasm = await loadWasm(edgeFunctionEntry.wasm ?? [])\n const runtime = new EdgeRuntime({\n codeGeneration:\n process.env.NODE_ENV !== 'production'\n ? { strings: true, wasm: true }\n : undefined,\n extend: (context) => {\n context.process = createProcessPolyfill(edgeFunctionEntry.env)\n\n Object.defineProperty(context, 'require', {\n enumerable: false,\n value: (id: string) => {\n const value = NativeModuleMap.get(id)\n if (!value) {\n throw TypeError('Native module not found: ' + id)\n }\n return value\n },\n })\n\n if (process.env.NODE_ENV !== 'production') {\n context.__next_log_error__ = function (err: unknown) {\n options.onError(err)\n }\n }\n\n context.__next_eval__ = function __next_eval__(fn: Function) {\n const key = fn.toString()\n if (!warnedEvals.has(key)) {\n const warning = getServerError(\n new Error(\n `Dynamic Code Evaluation (e. g. 'eval', 'new Function') not allowed in Edge Runtime\nLearn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation`\n ),\n COMPILER_NAMES.edgeServer\n )\n warning.name = 'DynamicCodeEvaluationWarning'\n Error.captureStackTrace(warning, __next_eval__)\n warnedEvals.add(key)\n options.onWarning(warning)\n }\n return fn()\n }\n\n context.__next_webassembly_compile__ =\n function __next_webassembly_compile__(fn: Function) {\n const key = fn.toString()\n if (!warnedWasmCodegens.has(key)) {\n const warning = getServerError(\n new Error(`Dynamic WASM code generation (e. g. 'WebAssembly.compile') not allowed in Edge Runtime.\nLearn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation`),\n COMPILER_NAMES.edgeServer\n )\n warning.name = 'DynamicWasmCodeGenerationWarning'\n Error.captureStackTrace(warning, __next_webassembly_compile__)\n warnedWasmCodegens.add(key)\n options.onWarning(warning)\n }\n return fn()\n }\n\n context.__next_webassembly_instantiate__ =\n async function __next_webassembly_instantiate__(fn: Function) {\n const result = await fn()\n\n // If a buffer is given, WebAssembly.instantiate returns an object\n // containing both a module and an instance while it returns only an\n // instance if a WASM module is given. Utilize the fact to determine\n // if the WASM code generation happens.\n //\n // https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiate#primary_overload_%E2%80%94_taking_wasm_binary_code\n const instantiatedFromBuffer = result.hasOwnProperty('module')\n\n const key = fn.toString()\n if (instantiatedFromBuffer && !warnedWasmCodegens.has(key)) {\n const warning = getServerError(\n new Error(`Dynamic WASM code generation ('WebAssembly.instantiate' with a buffer parameter) not allowed in Edge Runtime.\nLearn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation`),\n COMPILER_NAMES.edgeServer\n )\n warning.name = 'DynamicWasmCodeGenerationWarning'\n Error.captureStackTrace(warning, __next_webassembly_instantiate__)\n warnedWasmCodegens.add(key)\n options.onWarning(warning)\n }\n return result\n }\n\n const __fetch = context.fetch\n context.fetch = async (input, init = {}) => {\n const callingError = new Error('[internal]')\n const assetResponse = await fetchInlineAsset({\n input,\n assets: options.edgeFunctionEntry.assets,\n distDir: options.distDir,\n context,\n })\n if (assetResponse) {\n return assetResponse\n }\n\n init.headers = new Headers(init.headers ?? {})\n\n if (!init.headers.has('user-agent')) {\n init.headers.set(`user-agent`, `Next.js Middleware`)\n }\n\n const response =\n typeof input === 'object' && 'url' in input\n ? __fetch(input.url, {\n ...pick(input, [\n 'method',\n 'body',\n 'cache',\n 'credentials',\n 'integrity',\n 'keepalive',\n 'mode',\n 'redirect',\n 'referrer',\n 'referrerPolicy',\n 'signal',\n ]),\n ...init,\n headers: {\n ...Object.fromEntries(input.headers),\n ...Object.fromEntries(init.headers),\n },\n })\n : __fetch(String(input), init)\n\n return await response.catch((err) => {\n callingError.message = err.message\n err.stack = callingError.stack\n throw err\n })\n }\n\n const __Request = context.Request\n context.Request = class extends __Request {\n next?: NextFetchRequestConfig | undefined\n constructor(input: URL | RequestInfo, init?: RequestInit | undefined) {\n const url =\n typeof input !== 'string' && 'url' in input\n ? input.url\n : String(input)\n\n if (typeof input === 'string') {\n validateURL(url)\n super(input, init)\n } else {\n super(input, init)\n validateURL(url)\n }\n this.next = init?.next\n }\n }\n\n const __redirect = context.Response.redirect.bind(context.Response)\n context.Response.redirect = (...args) => {\n validateURL(args[0])\n return __redirect(...args)\n }\n\n for (const name of EDGE_UNSUPPORTED_NODE_APIS) {\n addStub(context, name)\n }\n\n Object.assign(context, wasm)\n\n context.performance = performance\n\n context.AsyncLocalStorage = AsyncLocalStorage\n\n // @ts-ignore the timeouts have weird types in the edge runtime\n context.setInterval = (...args: Parameters) =>\n intervalsManager.add([context, ...args])\n\n // @ts-ignore the timeouts have weird types in the edge runtime\n context.clearInterval = (interval: number) =>\n intervalsManager.remove(interval)\n\n // @ts-ignore the timeouts have weird types in the edge runtime\n context.setTimeout = (...args: Parameters) =>\n timeoutsManager.add([context, ...args])\n\n // @ts-ignore the timeouts have weird types in the edge runtime\n context.clearTimeout = (timeout: number) =>\n timeoutsManager.remove(timeout)\n\n // Duplicated from packages/next/src/server/after/builtin-request-context.ts\n // because we need to use the sandboxed `Symbol.for`, not the one from the outside\n const NEXT_REQUEST_CONTEXT_SYMBOL = context.Symbol.for(\n '@next/request-context'\n )\n Object.defineProperty(context, NEXT_REQUEST_CONTEXT_SYMBOL, {\n enumerable: false,\n value: edgeSandboxNextRequestContext,\n })\n\n return context\n },\n })\n\n const decorateUnhandledError = getDecorateUnhandledError(runtime)\n runtime.context.addEventListener('error', decorateUnhandledError)\n const decorateUnhandledRejection = getDecorateUnhandledRejection(runtime)\n runtime.context.addEventListener(\n 'unhandledrejection',\n decorateUnhandledRejection\n )\n\n patchErrorInspectEdgeLite(runtime.context.Error)\n // An Error from within the Edge Runtime could also bubble up into the Node.js process.\n // For example, uncaught errors are handled in the Node.js runtime.\n patchErrorInspectNodeJS(runtime.context.Error)\n\n return {\n runtime,\n paths: new Map(),\n warnedEvals: new Set(),\n }\n}\n\ninterface ModuleContextOptions {\n moduleName: string\n onError: (err: unknown) => void\n onWarning: (warn: Error) => void\n useCache: boolean\n distDir: string\n edgeFunctionEntry: Pick\n}\n\nfunction getModuleContextShared(options: ModuleContextOptions) {\n let deferredModuleContext = pendingModuleCaches.get(options.moduleName)\n if (!deferredModuleContext) {\n deferredModuleContext = createModuleContext(options)\n pendingModuleCaches.set(options.moduleName, deferredModuleContext)\n }\n return deferredModuleContext\n}\n\n/**\n * For a given module name this function will get a cached module\n * context or create it. It will return the module context along\n * with a function that allows to run some code from a given\n * filepath within the context.\n */\nexport async function getModuleContext(options: ModuleContextOptions): Promise<{\n evaluateInContext: (filepath: string) => void\n runtime: EdgeRuntime\n paths: Map\n warnedEvals: Set\n}> {\n let lazyModuleContext:\n | UnwrapPromise>\n | undefined\n\n if (options.useCache) {\n lazyModuleContext =\n moduleContexts.get(options.moduleName) ||\n (await getModuleContextShared(options))\n }\n\n if (!lazyModuleContext) {\n lazyModuleContext = await createModuleContext(options)\n moduleContexts.set(options.moduleName, lazyModuleContext)\n }\n\n const moduleContext = lazyModuleContext\n\n const evaluateInContext = (filepath: string) => {\n if (!moduleContext.paths.has(filepath)) {\n const content = readFileSync(filepath, 'utf-8')\n try {\n runInContext(content, moduleContext.runtime.context, {\n filename: filepath,\n })\n moduleContext.paths.set(filepath, content)\n } catch (error) {\n if (options.useCache) {\n moduleContext?.paths.delete(filepath)\n }\n throw error\n }\n }\n }\n\n return { ...moduleContext, evaluateInContext }\n}\n"],"names":["AsyncLocalStorage","COMPILER_NAMES","EDGE_UNSUPPORTED_NODE_APIS","EdgeRuntime","readFileSync","promises","fs","validateURL","pick","fetchInlineAsset","runInContext","BufferImplementation","EventsImplementation","AssertImplementation","UtilImplementation","AsyncHooksImplementation","intervalsManager","timeoutsManager","createLocalRequestContext","patchErrorInspectEdgeLite","patchErrorInspectNodeJS","getServerError","decorateServerError","process","env","NODE_ENV","require","error","moduleContexts","Map","pendingModuleCaches","clearAllModuleContexts","removeAll","clear","clearModuleContext","path","handleContext","key","cache","context","paths","has","delete","loadWasm","wasm","modules","Promise","all","map","binding","module","WebAssembly","compile","readFile","filePath","name","buildEnvironmentVariablesFrom","injectedEnvironments","Object","fromEntries","entries","throwUnsupportedAPIError","Error","edgeServer","createProcessPolyfill","processPolyfill","overriddenValue","keys","defineProperty","get","undefined","set","value","enumerable","addStub","getDecorateUnhandledError","runtime","EdgeRuntimeError","evaluate","getDecorateUnhandledRejection","rejected","reason","NativeModuleMap","mods","requestStore","edgeSandboxNextRequestContext","createModuleContext","options","warnedEvals","Set","warnedWasmCodegens","edgeFunctionEntry","codeGeneration","strings","extend","id","TypeError","__next_log_error__","err","onError","__next_eval__","fn","toString","warning","captureStackTrace","add","onWarning","__next_webassembly_compile__","__next_webassembly_instantiate__","result","instantiatedFromBuffer","hasOwnProperty","__fetch","fetch","input","init","callingError","assetResponse","assets","distDir","headers","Headers","response","url","String","catch","message","stack","__Request","Request","constructor","next","__redirect","Response","redirect","bind","args","assign","performance","setInterval","clearInterval","interval","remove","setTimeout","clearTimeout","timeout","NEXT_REQUEST_CONTEXT_SYMBOL","Symbol","for","decorateUnhandledError","addEventListener","decorateUnhandledRejection","getModuleContextShared","deferredModuleContext","moduleName","getModuleContext","lazyModuleContext","useCache","moduleContext","evaluateInContext","filepath","content","filename"],"mappings":"AAMA,SAASA,iBAAiB,QAAQ,cAAa;AAC/C,SACEC,cAAc,EACdC,0BAA0B,QACrB,gCAA+B;AACtC,SAASC,WAAW,QAAQ,kCAAiC;AAC7D,SAASC,YAAY,EAAEC,YAAYC,EAAE,QAAQ,KAAI;AACjD,SAASC,WAAW,QAAQ,WAAU;AACtC,SAASC,IAAI,QAAQ,oBAAmB;AACxC,SAASC,gBAAgB,QAAQ,wBAAuB;AACxD,SAASC,YAAY,QAAQ,KAAI;AACjC,OAA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QAAQmE,UAAU,EAAED;IAC9C;IACA,OAAOA;AACT;AAEA;;;;;CAKC,GACD,OAAO,eAAeE,iBAAiBpE,OAA6B;IAMlE,IAAIqE;IAIJ,IAAIrE,QAAQsE,QAAQ,EAAE;QACpBD,oBACEhI,eAAeyC,GAAG,CAACkB,QAAQmE,UAAU,KACpC,MAAMF,uBAAuBjE;IAClC;IAEA,IAAI,CAACqE,mBAAmB;QACtBA,oBAAoB,MAAMtE,oBAAoBC;QAC9C3D,eAAe2C,GAAG,CAACgB,QAAQmE,UAAU,EAAEE;IACzC;IAEA,MAAME,gBAAgBF;IAEtB,MAAMG,oBAAoB,CAACC;QACzB,IAAI,CAACF,cAActH,KAAK,CAACC,GAAG,CAACuH,WAAW;YACtC,MAAMC,UAAU7J,aAAa4J,UAAU;YACvC,IAAI;gBACFtJ,aAAauJ,SAASH,cAAclF,OAAO,CAACrC,OAAO,EAAE;oBACnD2H,UAAUF;gBACZ;gBACAF,cAActH,KAAK,CAAC+B,GAAG,CAACyF,UAAUC;YACpC,EAAE,OAAOtI,OAAO;gBACd,IAAI4D,QAAQsE,QAAQ,EAAE;oBACpBC,iCAAAA,cAAetH,KAAK,CAACE,MAAM,CAACsH;gBAC9B;gBACA,MAAMrI;YACR;QACF;IACF;IAEA,OAAO;QAAE,GAAGmI,aAAa;QAAEC;IAAkB;AAC/C","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/sandbox/fetch-inline-assets.js b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/fetch-inline-assets.js new file mode 100644 index 0000000000000000000000000000000000000000..7cdea6d0b09e0e2e8574702a550900b5faf3781d --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/fetch-inline-assets.js @@ -0,0 +1,29 @@ +import { createReadStream, promises as fs } from 'fs'; +import { requestToBodyStream } from '../../body-streams'; +import { resolve } from 'path'; +/** + * Short-circuits the `fetch` function + * to return a stream for a given asset, if a user used `new URL("file", import.meta.url)`. + * This allows to embed assets in Edge Runtime. + */ export async function fetchInlineAsset(options) { + const inputString = String(options.input); + if (!inputString.startsWith('blob:')) { + return; + } + const name = inputString.replace('blob:', ''); + const asset = options.assets ? options.assets.find((x)=>x.name === name) : { + name, + filePath: name + }; + if (!asset) { + return; + } + const filePath = resolve(options.distDir, asset.filePath); + const fileIsReadable = await fs.access(filePath).then(()=>true, ()=>false); + if (fileIsReadable) { + const readStream = createReadStream(filePath); + return new options.context.Response(requestToBodyStream(options.context, Uint8Array, readStream)); + } +} + +//# sourceMappingURL=fetch-inline-assets.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/sandbox/fetch-inline-assets.js.map b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/fetch-inline-assets.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b23f5e45799f730a7a97b1b77978a7aaeb258cda --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/fetch-inline-assets.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/web/sandbox/fetch-inline-assets.ts"],"sourcesContent":["import type { EdgeFunctionDefinition } from '../../../build/webpack/plugins/middleware-plugin'\nimport { createReadStream, promises as fs } from 'fs'\nimport { requestToBodyStream } from '../../body-streams'\nimport { resolve } from 'path'\n\n/**\n * Short-circuits the `fetch` function\n * to return a stream for a given asset, if a user used `new URL(\"file\", import.meta.url)`.\n * This allows to embed assets in Edge Runtime.\n */\nexport async function fetchInlineAsset(options: {\n input: RequestInfo | URL\n distDir: string\n assets: EdgeFunctionDefinition['assets']\n context: { Response: typeof Response; ReadableStream: typeof ReadableStream }\n}): Promise {\n const inputString = String(options.input)\n if (!inputString.startsWith('blob:')) {\n return\n }\n\n const name = inputString.replace('blob:', '')\n const asset = options.assets\n ? options.assets.find((x) => x.name === name)\n : {\n name,\n filePath: name,\n }\n if (!asset) {\n return\n }\n\n const filePath = resolve(options.distDir, asset.filePath)\n const fileIsReadable = await fs.access(filePath).then(\n () => true,\n () => false\n )\n\n if (fileIsReadable) {\n const readStream = createReadStream(filePath)\n return new options.context.Response(\n requestToBodyStream(options.context, Uint8Array, readStream)\n )\n }\n}\n"],"names":["createReadStream","promises","fs","requestToBodyStream","resolve","fetchInlineAsset","options","inputString","String","input","startsWith","name","replace","asset","assets","find","x","filePath","distDir","fileIsReadable","access","then","readStream","context","Response","Uint8Array"],"mappings":"AACA,SAASA,gBAAgB,EAAEC,YAAYC,EAAE,QAAQ,KAAI;AACrD,SAASC,mBAAmB,QAAQ,qBAAoB;AACxD,SAASC,OAAO,QAAQ,OAAM;AAE9B;;;;CAIC,GACD,OAAO,eAAeC,iBAAiBC,OAKtC;IACC,MAAMC,cAAcC,OAAOF,QAAQG,KAAK;IACxC,IAAI,CAACF,YAAYG,UAAU,CAAC,UAAU;QACpC;IACF;IAEA,MAAMC,OAAOJ,YAAYK,OAAO,CAAC,SAAS;IAC1C,MAAMC,QAAQP,QAAQQ,MAAM,GACxBR,QAAQQ,MAAM,CAACC,IAAI,CAAC,CAACC,IAAMA,EAAEL,IAAI,KAAKA,QACtC;QACEA;QACAM,UAAUN;IACZ;IACJ,IAAI,CAACE,OAAO;QACV;IACF;IAEA,MAAMI,WAAWb,QAAQE,QAAQY,OAAO,EAAEL,MAAMI,QAAQ;IACxD,MAAME,iBAAiB,MAAMjB,GAAGkB,MAAM,CAACH,UAAUI,IAAI,CACnD,IAAM,MACN,IAAM;IAGR,IAAIF,gBAAgB;QAClB,MAAMG,aAAatB,iBAAiBiB;QACpC,OAAO,IAAIX,QAAQiB,OAAO,CAACC,QAAQ,CACjCrB,oBAAoBG,QAAQiB,OAAO,EAAEE,YAAYH;IAErD;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/sandbox/index.js b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/index.js new file mode 100644 index 0000000000000000000000000000000000000000..901b217efaaccb01ee1448eed69ce90b07752e1d --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/index.js @@ -0,0 +1,4 @@ +export * from './sandbox'; +export { clearModuleContext } from './context'; + +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/sandbox/index.js.map b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ff426daca3f6d01000b7fbcd3d0398407421d759 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/web/sandbox/index.ts"],"sourcesContent":["export * from './sandbox'\nexport { clearModuleContext } from './context'\n"],"names":["clearModuleContext"],"mappings":"AAAA,cAAc,YAAW;AACzB,SAASA,kBAAkB,QAAQ,YAAW","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/sandbox/resource-managers.js b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/resource-managers.js new file mode 100644 index 0000000000000000000000000000000000000000..2b703a584b53613a7d51afe40e75c137f77c42a2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/resource-managers.js @@ -0,0 +1,93 @@ +class ResourceManager { + add(resourceArgs) { + const resource = this.create(resourceArgs); + this.resources.add(resource); + return resource; + } + remove(resource) { + this.untrack(resource); + this.destroy(resource); + } + /** + * Stop tracking a resource without destroying it. Used when a resource has + * already been released by other means (e.g. a one-shot timeout that ran to + * completion) so it should no longer be retained by this manager. + */ untrack(resource) { + this.resources.delete(resource); + } + removeAll() { + for (const resource of this.resources){ + this.destroy(resource); + } + this.resources.clear(); + } + /** Number of resources currently tracked. Exposed for observability/tests. */ get size() { + return this.resources.size; + } + constructor(){ + this.resources = new Set(); + } +} +export class IntervalsManager extends ResourceManager { + create(args) { + // TODO: use the edge runtime provided `setInterval` instead + return webSetIntervalPolyfill(...args); + } + destroy(interval) { + clearInterval(interval); + } +} +export class TimeoutsManager extends ResourceManager { + create(args) { + // TODO: use the edge runtime provided `setTimeout` instead + const [globalObject, callback, ms, ...rest] = args; + // A one-shot timeout releases itself from tracking once its callback has + // run. Otherwise fire-and-forget timeouts (whose ids user code never + // passes to `clearTimeout`) would accumulate for the lifetime of the + // module context and leak memory in long-lived server processes. + // See: https://github.com/vercel/next.js/issues/95094 + let timeoutId; + const callbackWithRelease = (...callbackArgs)=>{ + try { + return callback.apply(globalObject, callbackArgs); + } finally{ + this.untrack(timeoutId); + } + }; + timeoutId = webSetTimeoutPolyfill(globalObject, callbackWithRelease, ms, ...rest); + return timeoutId; + } + destroy(timeout) { + clearTimeout(timeout); + } +} +function webSetIntervalPolyfill(globalObject, callback, ms, ...args) { + return setInterval(()=>{ + // node's `setInterval` sets `this` to the `Timeout` instance it returned, + // but web `setInterval` always sets `this` to `window` + // see: https://developer.mozilla.org/en-US/docs/Web/API/Window/setInterval#the_this_problem + return callback.apply(globalObject, args); + }, ms)[Symbol.toPrimitive](); +} +function webSetTimeoutPolyfill(globalObject, callback, ms, ...args) { + const wrappedCallback = ()=>{ + try { + // node's `setTimeout` sets `this` to the `Timeout` instance it returned, + // but web `setTimeout` always sets `this` to `window` + // see: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout#the_this_problem + return callback.apply(globalObject, args); + } finally{ + // On certain older node versions (<20.16.0, <22.4.0), + // a `setTimeout` whose Timeout was converted to a primitive will leak. + // See: https://github.com/nodejs/node/issues/53335 + // We can work around this by explicitly calling `clearTimeout` after the callback runs. + clearTimeout(timeout); + } + }; + const timeout = setTimeout(wrappedCallback, ms); + return timeout[Symbol.toPrimitive](); +} +export const intervalsManager = new IntervalsManager(); +export const timeoutsManager = new TimeoutsManager(); + +//# sourceMappingURL=resource-managers.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/sandbox/resource-managers.js.map b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/resource-managers.js.map new file mode 100644 index 0000000000000000000000000000000000000000..9742429fd21f65624622107572e85bed9d5a7efa --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/resource-managers.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/web/sandbox/resource-managers.ts"],"sourcesContent":["abstract class ResourceManager {\n private resources = new Set()\n\n abstract create(resourceArgs: Args): T\n abstract destroy(resource: T): void\n\n add(resourceArgs: Args) {\n const resource = this.create(resourceArgs)\n this.resources.add(resource)\n return resource\n }\n\n remove(resource: T) {\n this.untrack(resource)\n this.destroy(resource)\n }\n\n /**\n * Stop tracking a resource without destroying it. Used when a resource has\n * already been released by other means (e.g. a one-shot timeout that ran to\n * completion) so it should no longer be retained by this manager.\n */\n protected untrack(resource: T) {\n this.resources.delete(resource)\n }\n\n removeAll() {\n for (const resource of this.resources) {\n this.destroy(resource)\n }\n this.resources.clear()\n }\n\n /** Number of resources currently tracked. Exposed for observability/tests. */\n get size() {\n return this.resources.size\n }\n}\n\nexport class IntervalsManager extends ResourceManager<\n number,\n Parameters\n> {\n create(args: Parameters) {\n // TODO: use the edge runtime provided `setInterval` instead\n return webSetIntervalPolyfill(...args)\n }\n\n destroy(interval: number) {\n clearInterval(interval)\n }\n}\n\nexport class TimeoutsManager extends ResourceManager<\n number,\n Parameters\n> {\n create(args: Parameters) {\n // TODO: use the edge runtime provided `setTimeout` instead\n const [globalObject, callback, ms, ...rest] = args\n\n // A one-shot timeout releases itself from tracking once its callback has\n // run. Otherwise fire-and-forget timeouts (whose ids user code never\n // passes to `clearTimeout`) would accumulate for the lifetime of the\n // module context and leak memory in long-lived server processes.\n // See: https://github.com/vercel/next.js/issues/95094\n let timeoutId: number\n const callbackWithRelease = (...callbackArgs: typeof rest) => {\n try {\n return callback.apply(globalObject, callbackArgs)\n } finally {\n this.untrack(timeoutId)\n }\n }\n\n timeoutId = webSetTimeoutPolyfill(\n globalObject,\n callbackWithRelease,\n ms,\n ...rest\n )\n return timeoutId\n }\n\n destroy(timeout: number) {\n clearTimeout(timeout)\n }\n}\n\nexport type GlobalObject = import('edge-runtime').EdgeRuntime['context']\n\nfunction webSetIntervalPolyfill(\n globalObject: GlobalObject,\n callback: (...args: TArgs) => void,\n ms?: number,\n ...args: TArgs\n): number {\n return setInterval(() => {\n // node's `setInterval` sets `this` to the `Timeout` instance it returned,\n // but web `setInterval` always sets `this` to `window`\n // see: https://developer.mozilla.org/en-US/docs/Web/API/Window/setInterval#the_this_problem\n return callback.apply(globalObject, args)\n }, ms)[Symbol.toPrimitive]()\n}\n\nfunction webSetTimeoutPolyfill(\n globalObject: GlobalObject,\n callback: (...args: TArgs) => void,\n ms?: number,\n ...args: TArgs\n): number {\n const wrappedCallback = () => {\n try {\n // node's `setTimeout` sets `this` to the `Timeout` instance it returned,\n // but web `setTimeout` always sets `this` to `window`\n // see: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout#the_this_problem\n return callback.apply(globalObject, args)\n } finally {\n // On certain older node versions (<20.16.0, <22.4.0),\n // a `setTimeout` whose Timeout was converted to a primitive will leak.\n // See: https://github.com/nodejs/node/issues/53335\n // We can work around this by explicitly calling `clearTimeout` after the callback runs.\n clearTimeout(timeout)\n }\n }\n const timeout = setTimeout(wrappedCallback, ms)\n return timeout[Symbol.toPrimitive]()\n}\n\nexport const intervalsManager = new IntervalsManager()\nexport const timeoutsManager = new TimeoutsManager()\n"],"names":["ResourceManager","add","resourceArgs","resource","create","resources","remove","untrack","destroy","delete","removeAll","clear","size","Set","IntervalsManager","args","webSetIntervalPolyfill","interval","clearInterval","TimeoutsManager","globalObject","callback","ms","rest","timeoutId","callbackWithRelease","callbackArgs","apply","webSetTimeoutPolyfill","timeout","clearTimeout","setInterval","Symbol","toPrimitive","wrappedCallback","setTimeout","intervalsManager","timeoutsManager"],"mappings":"AAAA,MAAeA;IAMbC,IAAIC,YAAkB,EAAE;QACtB,MAAMC,WAAW,IAAI,CAACC,MAAM,CAACF;QAC7B,IAAI,CAACG,SAAS,CAACJ,GAAG,CAACE;QACnB,OAAOA;IACT;IAEAG,O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AAcL;IACtC,GAAGO,GAAG,CAACU,OAAOC,WAAW,CAAC;AAC5B;AAEA,SAASL,sBACPR,YAA0B,EAC1BC,QAAkC,EAClCC,EAAW,EACX,GAAGP,IAAW;IAEd,MAAMmB,kBAAkB;QACtB,IAAI;YACF,yEAAyE;YACzE,sDAAsD;YACtD,2FAA2F;YAC3F,OAAOb,SAASM,KAAK,CAACP,cAAcL;QACtC,SAAU;YACR,sDAAsD;YACtD,uEAAuE;YACvE,mDAAmD;YACnD,wFAAwF;YACxFe,aAAaD;QACf;IACF;IACA,MAAMA,UAAUM,WAAWD,iBAAiBZ;IAC5C,OAAOO,OAAO,CAACG,OAAOC,WAAW,CAAC;AACpC;AAEA,OAAO,MAAMG,mBAAmB,IAAItB,mBAAkB;AACtD,OAAO,MAAMuB,kBAAkB,IAAIlB,kBAAiB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/sandbox/sandbox.js b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/sandbox.js new file mode 100644 index 0000000000000000000000000000000000000000..5f5973ada8c235fa6b91ce1e49d08841ccc4a89f --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/sandbox.js @@ -0,0 +1,107 @@ +import { getModuleContext, requestStore, edgeSandboxNextRequestContext } from './context'; +import { requestToBodyStream } from '../../body-streams'; +import { getBuiltinRequestContext } from '../../after/builtin-request-context'; +import { RouterServerContextSymbol, routerServerGlobal } from '../../lib/router-utils/router-server-context'; +export const ErrorSource = Symbol('SandboxError'); +const FORBIDDEN_HEADERS = [ + 'content-length', + 'content-encoding', + 'transfer-encoding' +]; +/** + * Decorates the runner function making sure all errors it can produce are + * tagged with `edge-server` so they can properly be rendered in dev. + */ function withTaggedErrors(fn) { + if (process.env.NODE_ENV === 'development') { + const { getServerError } = require('../../dev/node-stack-frames'); + return (params)=>fn(params).then((result)=>{ + var _result_waitUntil; + return { + ...result, + waitUntil: result == null ? void 0 : (_result_waitUntil = result.waitUntil) == null ? void 0 : _result_waitUntil.catch((error)=>{ + // TODO: used COMPILER_NAMES.edgeServer instead. Verify that it does not increase the runtime size. + throw getServerError(error, 'edge-server'); + }) + }; + }).catch((error)=>{ + // TODO: used COMPILER_NAMES.edgeServer instead + throw getServerError(error, 'edge-server'); + }); + } + return fn; +} +export async function getRuntimeContext(params) { + const { runtime, evaluateInContext } = await getModuleContext({ + moduleName: params.name, + onWarning: params.onWarning ?? (()=>{}), + onError: params.onError ?? (()=>{}), + useCache: params.useCache !== false, + edgeFunctionEntry: params.edgeFunctionEntry, + distDir: params.distDir + }); + if (params.incrementalCache) { + runtime.context.globalThis.__incrementalCacheShared = true; + runtime.context.globalThis.__incrementalCache = params.incrementalCache; + } + // expose router server context for access to dev handlers like + // logErrorWithOriginalStack + ; + runtime.context.globalThis[RouterServerContextSymbol] = routerServerGlobal[RouterServerContextSymbol]; + if (params.serverComponentsHmrCache) { + runtime.context.globalThis.__serverComponentsHmrCache = params.serverComponentsHmrCache; + } + if (params.clientAssetToken) { + runtime.context.globalThis.NEXT_CLIENT_ASSET_SUFFIX = params.clientAssetToken ? `?dpl=${params.clientAssetToken}` : ''; + } + for (const paramPath of params.paths){ + evaluateInContext(paramPath); + } + return runtime; +} +export const run = withTaggedErrors(async function runWithTaggedErrors(params) { + var _params_request_body; + const runtime = await getRuntimeContext(params); + const edgeFunction = (await runtime.context._ENTRIES[`middleware_${params.name}`]).default; + const cloned = ![ + 'HEAD', + 'GET' + ].includes(params.request.method) ? (_params_request_body = params.request.body) == null ? void 0 : _params_request_body.cloneBodyStream() : undefined; + const KUint8Array = runtime.evaluate('Uint8Array'); + const urlInstance = new URL(params.request.url); + params.request.url = urlInstance.toString(); + const headers = new Headers(); + for (const [key, value] of Object.entries(params.request.headers)){ + headers.set(key, (value == null ? void 0 : value.toString()) ?? ''); + } + try { + let result = undefined; + const builtinRequestCtx = { + ...getBuiltinRequestContext(), + // FIXME(after): + // arguably, this is an abuse of "@next/request-context" -- + // it'd make more sense to simply forward its existing value into the sandbox (in `createModuleContext`) + // but here we're using it to just pass in `waitUntil` regardless if we were running in this context or not. + waitUntil: params.request.waitUntil + }; + await edgeSandboxNextRequestContext.run(builtinRequestCtx, ()=>requestStore.run({ + headers + }, async ()=>{ + result = await edgeFunction({ + request: { + ...params.request, + body: cloned && requestToBodyStream(runtime.context, KUint8Array, cloned) + } + }); + for (const headerName of FORBIDDEN_HEADERS){ + result.response.headers.delete(headerName); + } + })); + if (!result) throw new Error('Edge function did not return a response'); + return result; + } finally{ + var _params_request_body1; + await ((_params_request_body1 = params.request.body) == null ? void 0 : _params_request_body1.finalize()); + } +}); + +//# sourceMappingURL=sandbox.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/sandbox/sandbox.js.map b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/sandbox.js.map new file mode 100644 index 0000000000000000000000000000000000000000..03ef637d84c08049bc6b7044e0c06375e6e0d94f --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/sandbox/sandbox.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/web/sandbox/sandbox.ts"],"sourcesContent":["import type { NodejsRequestData, FetchEventResult } from '../types'\nimport type { EdgeFunctionDefinition } from '../../../build/webpack/plugins/middleware-plugin'\nimport type { EdgeRuntime } from 'next/dist/compiled/edge-runtime'\nimport {\n getModuleContext,\n requestStore,\n edgeSandboxNextRequestContext,\n} from './context'\nimport { requestToBodyStream } from '../../body-streams'\nimport type { ServerComponentsHmrCache } from '../../response-cache'\nimport {\n getBuiltinRequestContext,\n type BuiltinRequestContextValue,\n} from '../../after/builtin-request-context'\nimport {\n RouterServerContextSymbol,\n routerServerGlobal,\n} from '../../lib/router-utils/router-server-context'\nimport type { EdgeHandler } from '../adapter'\n\nexport const ErrorSource = Symbol('SandboxError')\n\nconst FORBIDDEN_HEADERS = [\n 'content-length',\n 'content-encoding',\n 'transfer-encoding',\n]\n\ninterface RunnerFnParams {\n name: string\n onError?: (err: unknown) => void\n onWarning?: (warn: Error) => void\n paths: string[]\n request: NodejsRequestData\n useCache: boolean\n edgeFunctionEntry: Pick\n distDir: string\n incrementalCache?: any\n serverComponentsHmrCache?: ServerComponentsHmrCache\n clientAssetToken: string\n}\n\ntype RunnerFn = (params: RunnerFnParams) => Promise\n\n/**\n * Decorates the runner function making sure all errors it can produce are\n * tagged with `edge-server` so they can properly be rendered in dev.\n */\nfunction withTaggedErrors(fn: RunnerFn): RunnerFn {\n if (process.env.NODE_ENV === 'development') {\n const { getServerError } =\n require('../../dev/node-stack-frames') as typeof import('../../dev/node-stack-frames')\n\n return (params) =>\n fn(params)\n .then((result) => ({\n ...result,\n waitUntil: result?.waitUntil?.catch((error) => {\n // TODO: used COMPILER_NAMES.edgeServer instead. Verify that it does not increase the runtime size.\n throw getServerError(error, 'edge-server')\n }),\n }))\n .catch((error) => {\n // TODO: used COMPILER_NAMES.edgeServer instead\n throw getServerError(error, 'edge-server')\n })\n }\n\n return fn\n}\n\nexport async function getRuntimeContext(\n params: Omit\n): Promise> {\n const { runtime, evaluateInContext } = await getModuleContext({\n moduleName: params.name,\n onWarning: params.onWarning ?? (() => {}),\n onError: params.onError ?? (() => {}),\n useCache: params.useCache !== false,\n edgeFunctionEntry: params.edgeFunctionEntry,\n distDir: params.distDir,\n })\n\n if (params.incrementalCache) {\n runtime.context.globalThis.__incrementalCacheShared = true\n runtime.context.globalThis.__incrementalCache = params.incrementalCache\n }\n\n // expose router server context for access to dev handlers like\n // logErrorWithOriginalStack\n ;(runtime.context.globalThis as any as typeof routerServerGlobal)[\n RouterServerContextSymbol\n ] = routerServerGlobal[RouterServerContextSymbol]\n\n if (params.serverComponentsHmrCache) {\n runtime.context.globalThis.__serverComponentsHmrCache =\n params.serverComponentsHmrCache\n }\n\n if (params.clientAssetToken) {\n runtime.context.globalThis.NEXT_CLIENT_ASSET_SUFFIX =\n params.clientAssetToken ? `?dpl=${params.clientAssetToken}` : ''\n }\n\n for (const paramPath of params.paths) {\n evaluateInContext(paramPath)\n }\n return runtime\n}\n\nexport const run = withTaggedErrors(async function runWithTaggedErrors(params) {\n const runtime = await getRuntimeContext(params)\n\n const edgeFunction: EdgeHandler = (\n await runtime.context._ENTRIES[`middleware_${params.name}`]\n ).default\n\n const cloned = !['HEAD', 'GET'].includes(params.request.method)\n ? params.request.body?.cloneBodyStream()\n : undefined\n\n const KUint8Array = runtime.evaluate('Uint8Array')\n const urlInstance = new URL(params.request.url)\n\n params.request.url = urlInstance.toString()\n\n const headers = new Headers()\n for (const [key, value] of Object.entries(params.request.headers)) {\n headers.set(key, value?.toString() ?? '')\n }\n\n try {\n let result: FetchEventResult | undefined = undefined\n const builtinRequestCtx: BuiltinRequestContextValue = {\n ...getBuiltinRequestContext(),\n // FIXME(after):\n // arguably, this is an abuse of \"@next/request-context\" --\n // it'd make more sense to simply forward its existing value into the sandbox (in `createModuleContext`)\n // but here we're using it to just pass in `waitUntil` regardless if we were running in this context or not.\n waitUntil: params.request.waitUntil,\n }\n await edgeSandboxNextRequestContext.run(builtinRequestCtx, () =>\n requestStore.run({ headers }, async () => {\n result = await edgeFunction({\n request: {\n ...params.request,\n body:\n cloned &&\n requestToBodyStream(runtime.context, KUint8Array, cloned),\n },\n })\n for (const headerName of FORBIDDEN_HEADERS) {\n result.response.headers.delete(headerName)\n }\n })\n )\n\n if (!result) throw new Error('Edge function did not return a response')\n return result\n } finally {\n await params.request.body?.finalize()\n }\n})\n"],"names":["getModuleContext","requestStore","edgeSandboxNextRequestContext","requestToBodyStream","getBuiltinRequestContext","RouterServerContextSymbol","routerServerGlobal","ErrorSource","Symbol","FORBIDDEN_HEADERS","withTaggedErrors","fn","process","env","NODE_ENV","getServerError","require","params","then","result","waitUntil","catch","error","getRuntimeContext","runtime","evaluateInContext","moduleName","name","onWarning","onError","useCache","edgeFunctionEntry","distDir","incrementalCache","context","globalThis","__incrementalCacheShared","__incrementalCache","serverComponentsHmrCache","__serverComponentsHmrCache","clientAssetToken","NEXT_CLIENT_ASSET_SUFFIX","paramPath","paths","run","runWithTaggedErrors","edgeFunction","_ENTRIES","default","cloned","includes","request","method","body","cloneBodyStream","undefined","KUint8Array","evaluate","urlInstance","URL","url","toString","headers","Headers","key","value","Object","entries","set","builtinRequestCtx","headerName","response","delete","Error","finalize"],"mappings":"AAGA,SACEA,gBAAgB,EAChBC,YAAY,EACZC,6BAA6B,QACxB,YAAW;AAClB,SAASC,mBAAmB,QAAQ,qBAAoB;AAExD,SACEC,wBAAwB,QAEnB,sCAAqC;AAC5C,SACEC,yBAAyB,EACzBC,kBAAkB,QACb,+CAA8C;AAGrD,OAAO,MAAMC,cAAcC,OAAO,gBAAe;AAEjD,MAAMC,oBAAoB;IACxB;IACA;IACA;CACD;AAkBD;;;CAGC,GACD,SAASC,iBAAiBC,EAAY;IACpC,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1C,MAAM,EAAEC,cAAc,EAAE,GACtBC,QAAQ;QAEV,OAAO,CAACC,SACNN,GAAGM,QACAC,IAAI,CAAC,CAACC;oBAEMA;uBAFM;oBACjB,GAAGA,MAAM;oBACTC,SAAS,EAAED,2BAAAA,oBAAAA,OAAQC,SAAS,qBAAjBD,kBAAmBE,KAAK,CAAC,CAACC;wBACnC,mGAAmG;wBACnG,MAAMP,eAAeO,OAAO;oBAC9B;gBACF;eACCD,KAAK,CAAC,CAACC;gBACN,+CAA+C;gBAC/C,MAAMP,eAAeO,OAAO;YAC9B;IACN;IAEA,OAAOX;AACT;AAEA,OAAO,eAAeY,kBACpBN,MAAuC;IAEvC,MAAM,EAAEO,OAAO,EAAEC,iBAAiB,EAAE,GAAG,MAAMzB,iBAAiB;QAC5D0B,YAAYT,OAAOU,IAAI;QACvBC,WAAWX,OAAOW,SAAS,IAAK,CAAA,KAAO,CAAA;QACvCC,SAASZ,OAAOY,OAAO,IAAK,CAAA,KAAO,CAAA;QACnCC,UAAUb,OAAOa,QAAQ,KAAK;QAC9BC,mBAAmBd,OAAOc,iBA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3C,OAAOkC,OAAO,CAACS,GAAG,GAAGF,YAAYG,QAAQ;IAEzC,MAAMC,UAAU,IAAIC;IACpB,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAAClD,OAAOkC,OAAO,CAACW,OAAO,EAAG;QACjEA,QAAQM,GAAG,CAACJ,KAAKC,CAAAA,yBAAAA,MAAOJ,QAAQ,OAAM;IACxC;IAEA,IAAI;QACF,IAAI1C,SAAuCoC;QAC3C,MAAMc,oBAAgD;YACpD,GAAGjE,0BAA0B;YAC7B,gBAAgB;YAChB,2DAA2D;YAC3D,wGAAwG;YACxG,4GAA4G;YAC5GgB,WAAWH,OAAOkC,OAAO,CAAC/B,SAAS;QACrC;QACA,MAAMlB,8BAA8B0C,GAAG,CAACyB,mBAAmB,IACzDpE,aAAa2C,GAAG,CAAC;gBAAEkB;YAAQ,GAAG;gBAC5B3C,SAAS,MAAM2B,aAAa;oBAC1BK,SAAS;wBACP,GAAGlC,OAAOkC,OAAO;wBACjBE,MACEJ,UACA9C,oBAAoBqB,QAAQU,OAAO,EAAEsB,aAAaP;oBACtD;gBACF;gBACA,KAAK,MAAMqB,cAAc7D,kBAAmB;oBAC1CU,OAAOoD,QAAQ,CAACT,OAAO,CAACU,MAAM,CAACF;gBACjC;YACF;QAGF,IAAI,CAACnD,QAAQ,MAAM,IAAIsD,MAAM;QAC7B,OAAOtD;IACT,SAAU;YACFF;QAAN,QAAMA,wBAAAA,OAAOkC,OAAO,CAACE,IAAI,qBAAnBpC,sBAAqByD,QAAQ;IACrC;AACF,GAAE","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/headers.js b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/headers.js new file mode 100644 index 0000000000000000000000000000000000000000..7acdf2967d83e7a4a66013e1c432a4623c9ac46a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/headers.js @@ -0,0 +1,268 @@ +import { ReflectAdapter } from './reflect'; +/** + * @internal + */ export class ReadonlyHeadersError extends Error { + constructor(){ + super('Headers cannot be modified. Read more: https://nextjs.org/docs/app/api-reference/functions/headers'); + } + static callable() { + throw new ReadonlyHeadersError(); + } +} +/** + * Builds the read methods for a sealed view that exposes all of `target`. + */ function createPassThroughMethods(target, sealed) { + return { + get: target.get.bind(target), + has: target.has.bind(target), + getSetCookie: target.getSetCookie.bind(target), + keys: target.keys.bind(target), + values: target.values.bind(target), + entries: target.entries.bind(target), + [Symbol.iterator]: target[Symbol.iterator].bind(target), + // The native method passes the unsealed target as the callback's `parent` + // argument. That is a mutable handle on the underlying headers. Pass the + // sealed view instead. + forEach (callbackfn, thisArg) { + for (const [name, value] of target.entries()){ + callbackfn.call(thisArg, value, name, sealed); + } + } + }; +} +/** + * Builds the read methods for a sealed view that omits the header names matched + * by `isHidden`. + */ function createHidingMethods(target, sealed, isHidden) { + function* entries() { + for (const entry of target.entries()){ + if (!isHidden(entry[0])) { + yield entry; + } + } + } + return { + entries, + [Symbol.iterator]: entries, + get: (name)=>isHidden(name) ? null : target.get(name), + has: (name)=>isHidden(name) ? false : target.has(name), + getSetCookie: ()=>isHidden('set-cookie') ? [] : target.getSetCookie(), + *keys () { + for (const name of target.keys()){ + if (!isHidden(name)) { + yield name; + } + } + }, + *values () { + for (const [, value] of entries()){ + yield value; + } + }, + // The native method passes the unsealed target as the callback's `parent` + // argument. That is a mutable handle on the underlying headers. Pass the + // sealed view instead. + forEach (callbackfn, thisArg) { + for (const [name, value] of entries()){ + callbackfn.call(thisArg, value, name, sealed); + } + } + }; +} +export class HeadersAdapter extends Headers { + constructor(headers){ + // We've already overridden the methods that would be called, so we're just + // calling the super constructor to ensure that the instanceof check works. + super(); + this.headers = new Proxy(headers, { + get (target, prop, receiver) { + // Because this is just an object, we expect that all "get" operations + // are for properties. If it's a "get" for a symbol, we'll just return + // the symbol. + if (typeof prop === 'symbol') { + return ReflectAdapter.get(target, prop, receiver); + } + const lowercased = prop.toLowerCase(); + // Let's find the original casing of the key. This assumes that there is + // no mixed case keys (e.g. "Content-Type" and "content-type") in the + // headers object. + const original = Object.keys(headers).find((o)=>o.toLowerCase() === lowercased); + // If the original casing doesn't exist, return undefined. + if (typeof original === 'undefined') return; + // If the original casing exists, return the value. + return ReflectAdapter.get(target, original, receiver); + }, + set (target, prop, value, receiver) { + if (typeof prop === 'symbol') { + return ReflectAdapter.set(target, prop, value, receiver); + } + const lowercased = prop.toLowerCase(); + // Let's find the original casing of the key. This assumes that there is + // no mixed case keys (e.g. "Content-Type" and "content-type") in the + // headers object. + const original = Object.keys(headers).find((o)=>o.toLowerCase() === lowercased); + // If the original casing doesn't exist, use the prop as the key. + return ReflectAdapter.set(target, original ?? prop, value, receiver); + }, + has (target, prop) { + if (typeof prop === 'symbol') return ReflectAdapter.has(target, prop); + const lowercased = prop.toLowerCase(); + // Let's find the original casing of the key. This assumes that there is + // no mixed case keys (e.g. "Content-Type" and "content-type") in the + // headers object. + const original = Object.keys(headers).find((o)=>o.toLowerCase() === lowercased); + // If the original casing doesn't exist, return false. + if (typeof original === 'undefined') return false; + // If the original casing exists, return true. + return ReflectAdapter.has(target, original); + }, + deleteProperty (target, prop) { + if (typeof prop === 'symbol') return ReflectAdapter.deleteProperty(target, prop); + const lowercased = prop.toLowerCase(); + // Let's find the original casing of the key. This assumes that there is + // no mixed case keys (e.g. "Content-Type" and "content-type") in the + // headers object. + const original = Object.keys(headers).find((o)=>o.toLowerCase() === lowercased); + // If the original casing doesn't exist, return true. + if (typeof original === 'undefined') return true; + // If the original casing exists, delete the property. + return ReflectAdapter.deleteProperty(target, original); + } + }); + } + /** + * Seals a Headers instance to prevent modification by throwing an error when + * any mutating method is called. + * + * The sealed view stays live. Later writes to `headers` remain visible + * through it. + * + * `hidden` omits the given header names from every read operation (`get`, + * `has`, `getSetCookie`, `forEach`, and iteration). The names must be + * lowercase. The underlying headers are neither copied nor mutated, so hidden + * headers remain available to the framework. + */ static seal(headers, hidden) { + const isHidden = hidden && hidden.size > 0 ? (name)=>hidden.has(name.toLowerCase()) : null; + // The methods are built once per sealed view and reused, so repeated access + // returns the same function instead of a fresh closure. They are assigned + // after the proxy exists because `forEach` hands the proxy to its callback. + // Creating the proxy runs no trap, so nothing can read them before then. + let methods; + const sealed = new Proxy(headers, { + get (target, prop, receiver) { + switch(prop){ + case 'append': + case 'delete': + case 'set': + return ReadonlyHeadersError.callable; + case Symbol.iterator: + return methods[Symbol.iterator]; + case 'get': + case 'has': + case 'getSetCookie': + case 'keys': + case 'values': + case 'entries': + case 'forEach': + return methods[prop]; + default: + return ReflectAdapter.get(target, prop, receiver); + } + } + }); + methods = isHidden ? createHidingMethods(headers, sealed, isHidden) : createPassThroughMethods(headers, sealed); + return sealed; + } + /** + * @param headers + * @returns A fresh object identity backed by the original value + */ static fresh(headers) { + return new Proxy(headers, { + get (target, prop, receiver) { + return ReflectAdapter.get(target, prop, receiver); + } + }); + } + /** + * Merges a header value into a string. This stores multiple values as an + * array, so we need to merge them into a string. + * + * @param value a header value + * @returns a merged header value (a string) + */ merge(value) { + if (Array.isArray(value)) return value.join(', '); + return value; + } + /** + * Creates a Headers instance from a plain object or a Headers instance. + * + * @param headers a plain object or a Headers instance + * @returns a headers instance + */ static from(headers) { + if (headers instanceof Headers) return headers; + return new HeadersAdapter(headers); + } + append(name, value) { + const existing = this.headers[name]; + if (typeof existing === 'string') { + this.headers[name] = [ + existing, + value + ]; + } else if (Array.isArray(existing)) { + existing.push(value); + } else { + this.headers[name] = value; + } + } + delete(name) { + delete this.headers[name]; + } + get(name) { + const value = this.headers[name]; + if (typeof value !== 'undefined') return this.merge(value); + return null; + } + has(name) { + return typeof this.headers[name] !== 'undefined'; + } + set(name, value) { + this.headers[name] = value; + } + forEach(callbackfn, thisArg) { + for (const [name, value] of this.entries()){ + callbackfn.call(thisArg, value, name, this); + } + } + *entries() { + for (const key of Object.keys(this.headers)){ + const name = key.toLowerCase(); + // We assert here that this is a string because we got it from the + // Object.keys() call above. + const value = this.get(name); + yield [ + name, + value + ]; + } + } + *keys() { + for (const key of Object.keys(this.headers)){ + const name = key.toLowerCase(); + yield name; + } + } + *values() { + for (const key of Object.keys(this.headers)){ + // We assert here that this is a string because we got it from the + // Object.keys() call above. + const value = this.get(key); + yield value; + } + } + [Symbol.iterator]() { + return this.entries(); + } +} + +//# sourceMappingURL=headers.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/headers.js.map b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/headers.js.map new file mode 100644 index 0000000000000000000000000000000000000000..708eb9d3a672b94bfd019798b98829386282a3fd --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/headers.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/server/web/spec-extension/adapters/headers.ts"],"sourcesContent":["import type { IncomingHttpHeaders } from 'http'\n\nimport { ReflectAdapter } from './reflect'\n\n/**\n * @internal\n */\nexport class ReadonlyHeadersError extends Error {\n constructor() {\n super(\n 'Headers cannot be modified. Read more: https://nextjs.org/docs/app/api-reference/functions/headers'\n )\n }\n\n public static callable() {\n throw new ReadonlyHeadersError()\n }\n}\n\nexport type ReadonlyHeaders = Headers & {\n /** @deprecated Method unavailable on `ReadonlyHeaders`. Read more: https://nextjs.org/docs/app/api-reference/functions/headers */\n append(...args: any[]): void\n /** @deprecated Method unavailable on `ReadonlyHeaders`. Read more: https://nextjs.org/docs/app/api-reference/functions/headers */\n set(...args: any[]): void\n /** @deprecated Method unavailable on `ReadonlyHeaders`. Read more: https://nextjs.org/docs/app/api-reference/functions/headers */\n delete(...args: any[]): void\n}\n\n/**\n * The read methods that a sealed view provides itself instead of forwarding to\n * the underlying `Headers`. Deriving the type from `Headers` keeps the\n * implementations in step with the platform signatures.\n */\ntype SealedHeaderMethods = Pick<\n Headers,\n | 'get'\n | 'has'\n | 'getSetCookie'\n | 'keys'\n | 'values'\n | 'entries'\n | 'forEach'\n | typeof Symbol.iterator\n>\n\n/**\n * Builds the read methods for a sealed view that exposes all of `target`.\n */\nfunction createPassThroughMethods(\n target: Headers,\n sealed: ReadonlyHeaders\n): SealedHeaderMethods {\n return {\n get: target.get.bind(target),\n has: target.has.bind(target),\n getSetCookie: target.getSetCookie.bind(target),\n keys: target.keys.bind(target),\n values: target.values.bind(target),\n entries: target.entries.bind(target),\n [Symbol.iterator]: target[Symbol.iterator].bind(target),\n // The native method passes the unsealed target as the callback's `parent`\n // argument. That is a mutable handle on the underlying headers. Pass the\n // sealed view instead.\n forEach(callbackfn, thisArg) {\n for (const [name, value] of target.entries()) {\n callbackfn.call(thisArg, value, name, sealed)\n }\n },\n }\n}\n\n/**\n * Builds the read methods for a sealed view that omits the header names matched\n * by `isHidden`.\n */\nfunction createHidingMethods(\n target: Headers,\n sealed: ReadonlyHeaders,\n isHidden: (name: string) => boolean\n): SealedHeaderMethods {\n function* entries(): HeadersIterator<[string, string]> {\n for (const entry of target.entries()) {\n if (!isHidden(entry[0])) {\n yield entry\n }\n }\n }\n\n return {\n entries,\n [Symbol.iterator]: entries,\n get: (name) => (isHidden(name) ? null : target.get(name)),\n has: (name) => (isHidden(name) ? false : target.has(name)),\n getSetCookie: () => (isHidden('set-cookie') ? [] : target.getSetCookie()),\n *keys(): HeadersIterator {\n for (const name of target.keys()) {\n if (!isHidden(name)) {\n yield name\n }\n }\n },\n *values(): HeadersIterator {\n for (const [, value] of entries()) {\n yield value\n }\n },\n // The native method passes the unsealed target as the callback's `parent`\n // argument. That is a mutable handle on the underlying headers. Pass the\n // sealed view instead.\n forEach(callbackfn, thisArg) {\n for (const [name, value] of entries()) {\n callbackfn.call(thisArg, value, name, sealed)\n }\n },\n }\n}\n\nexport class HeadersAdapter extends Headers {\n private readonly headers: IncomingHttpHeaders\n\n constructor(headers: IncomingHttpHeaders) {\n // We've already overridden the methods that would be called, so we're just\n // calling the super constructor to ensure that the instanceof check works.\n super()\n\n this.headers = new Proxy(headers, {\n get(target, prop, receiver) {\n // Because this is just an object, we expect that all \"get\" operations\n // are for properties. If it's a \"get\" for a symbol, we'll just return\n // the symbol.\n if (typeof prop === 'symbol') {\n return ReflectAdapter.get(target, prop, receiver)\n }\n\n const lowercased = prop.toLowerCase()\n\n // Let's find the original casing of the key. This assumes that there is\n // no mixed case keys (e.g. \"Content-Type\" and \"content-type\") in the\n // headers object.\n const original = Object.keys(headers).find(\n (o) => o.toLowerCase() === lowercased\n )\n\n // If the original casing doesn't exist, return undefined.\n if (typeof original === 'undefined') return\n\n // If the original casing exists, return the value.\n return ReflectAdapter.get(target, original, receiver)\n },\n set(target, prop, value, receiver) {\n if (typeof prop === 'symbol') {\n return ReflectAdapter.set(target, prop, value, receiver)\n }\n\n const lowercased = prop.toLowerCase()\n\n // Let's find the original casing of the key. This assumes that there is\n // no mixed case keys (e.g. \"Content-Type\" and \"content-type\") in the\n // headers object.\n const original = Object.keys(headers).find(\n (o) => o.toLowerCase() === lowercased\n )\n\n // If the original casing doesn't exist, use the prop as the key.\n return ReflectAdapter.set(target, original ?? prop, value, receiver)\n },\n has(target, prop) {\n if (typeof prop === 'symbol') return ReflectAdapter.has(target, prop)\n\n const lowercased = prop.toLowerCase()\n\n // Let's find the original casing of the key. This assumes that there is\n // no mixed case keys (e.g. \"Content-Type\" and \"content-type\") in the\n // headers object.\n const original = Object.keys(headers).find(\n (o) => o.toLowerCase() === lowercased\n )\n\n // If the original casing doesn't exist, return false.\n if (typeof original === 'undefined') return false\n\n // If the original casing exists, return true.\n return ReflectAdapter.has(target, original)\n },\n deleteProperty(target, prop) {\n if (typeof prop === 'symbol')\n return ReflectAdapter.deleteProperty(target, prop)\n\n const lowercased = prop.toLowerCase()\n\n // Let's find the original casing of the key. This assumes that there is\n // no mixed case keys (e.g. \"Content-Type\" and \"content-type\") in the\n // headers object.\n const original = Object.keys(headers).find(\n (o) => o.toLowerCase() === lowercased\n )\n\n // If the original casing doesn't exist, return true.\n if (typeof original === 'undefined') return true\n\n // If the original casing exists, delete the property.\n return ReflectAdapter.deleteProperty(target, original)\n },\n })\n }\n\n /**\n * Seals a Headers instance to prevent modification by throwing an error when\n * any mutating method is called.\n *\n * The sealed view stays live. Later writes to `headers` remain visible\n * through it.\n *\n * `hidden` omits the given header names from every read operation (`get`,\n * `has`, `getSetCookie`, `forEach`, and iteration). The names must be\n * lowercase. The underlying headers are neither copied nor mutated, so hidden\n * headers remain available to the framework.\n */\n public static seal(\n headers: Headers,\n hidden?: ReadonlySet\n ): ReadonlyHeaders {\n const isHidden =\n hidden && hidden.size > 0\n ? (name: string): boolean => hidden.has(name.toLowerCase())\n : null\n\n // The methods are built once per sealed view and reused, so repeated access\n // returns the same function instead of a fresh closure. They are assigned\n // after the proxy exists because `forEach` hands the proxy to its callback.\n // Creating the proxy runs no trap, so nothing can read them before then.\n let methods: SealedHeaderMethods\n\n const sealed: ReadonlyHeaders = new Proxy(headers, {\n get(target, prop, receiver) {\n switch (prop) {\n case 'append':\n case 'delete':\n case 'set':\n return ReadonlyHeadersError.callable\n case Symbol.iterator:\n return methods[Symbol.iterator]\n case 'get':\n case 'has':\n case 'getSetCookie':\n case 'keys':\n case 'values':\n case 'entries':\n case 'forEach':\n return methods[prop]\n default:\n return ReflectAdapter.get(target, prop, receiver)\n }\n },\n })\n\n methods = isHidden\n ? createHidingMethods(headers, sealed, isHidden)\n : createPassThroughMethods(headers, sealed)\n\n return sealed\n }\n\n /**\n * @param headers\n * @returns A fresh object identity backed by the original value\n */\n public static fresh(headers: ReadonlyHeaders): ReadonlyHeaders {\n return new Proxy(headers, {\n get(target, prop, receiver) {\n return ReflectAdapter.get(target, prop, receiver)\n },\n })\n }\n\n /**\n * Merges a header value into a string. This stores multiple values as an\n * array, so we need to merge them into a string.\n *\n * @param value a header value\n * @returns a merged header value (a string)\n */\n private merge(value: string | string[]): string {\n if (Array.isArray(value)) return value.join(', ')\n\n return value\n }\n\n /**\n * Creates a Headers instance from a plain object or a Headers instance.\n *\n * @param headers a plain object or a Headers instance\n * @returns a headers instance\n */\n public static from(headers: IncomingHttpHeaders | Headers): Headers {\n if (headers instanceof Headers) return headers\n\n return new HeadersAdapter(headers)\n }\n\n public append(name: string, value: string): void {\n const existing = this.headers[name]\n if (typeof existing === 'string') {\n this.headers[name] = [existing, value]\n } else if (Array.isArray(existing)) {\n existing.push(value)\n } else {\n this.headers[name] = value\n }\n }\n\n public delete(name: string): void {\n delete this.headers[name]\n }\n\n public get(name: string): string | null {\n const value = this.headers[name]\n if (typeof value !== 'undefined') return this.merge(value)\n\n return null\n }\n\n public has(name: string): boolean {\n return typeof this.headers[name] !== 'undefined'\n }\n\n public set(name: string, value: string): void {\n this.headers[name] = value\n }\n\n public forEach(\n callbackfn: (value: string, name: string, parent: Headers) => void,\n thisArg?: any\n ): void {\n for (const [name, value] of this.entries()) {\n callbackfn.call(thisArg, value, name, this)\n }\n }\n\n public *entries(): HeadersIterator<[string, string]> {\n for (const key of Object.keys(this.headers)) {\n const name = key.toLowerCase()\n // We assert here that this is a string because we got it from the\n // Object.keys() call above.\n const value = this.get(name) as string\n\n yield [name, value] as [string, string]\n }\n }\n\n public *keys(): HeadersIterator {\n for (const key of Object.keys(this.headers)) {\n const name = key.toLowerCase()\n yield name\n }\n }\n\n public *values(): HeadersIterator {\n for (const key of Object.keys(this.headers)) {\n // We assert here that this is a string because we got it from the\n // Object.keys() call above.\n const value = this.get(key) as string\n\n yield value\n }\n }\n\n public [Symbol.iterator](): HeadersIterator<[string, string]> {\n return this.entries()\n }\n}\n"],"names":["ReflectAdapter","ReadonlyHeadersError","Error","constructor","callable","createPassThroughMethods","target","sealed","get","bind","has","getSetCookie","keys","values","entries","Symbol","iterator","forEach","callbackfn","thisArg","name","value","call","createHidingMethods","isHidden","entry","HeadersAdapter","Headers","headers","Proxy","prop","receiver","lowercased","toLowerCase","original","Object","find","o","set","deleteProperty","seal","hidden","size","methods","fresh","merge","Array","isArray","join","from","append","existing","push","delete","key"],"mappings":"AAEA,SAASA,cAAc,QAAQ,Y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;IACF;IAEA,CAAQP,SAAkC;QACxC,KAAK,MAAMyC,OAAOnB,OAAOvB,IAAI,CAAC,IAAI,CAACgB,OAAO,EAAG;YAC3C,kEAAkE;YAClE,4BAA4B;YAC5B,MAAMP,QAAQ,IAAI,CAACb,GAAG,CAAC8C;YAEvB,MAAMjC;QACR;IACF;IAEO,CAACN,OAAOC,QAAQ,CAAC,GAAsC;QAC5D,OAAO,IAAI,CAACF,OAAO;IACrB;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/next-request.js b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/next-request.js new file mode 100644 index 0000000000000000000000000000000000000000..9d9e74b3f9692314f28b8b707100513c305c24e9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/next-request.js @@ -0,0 +1,117 @@ +import { getRequestMeta } from '../../../request-meta'; +import { fromNodeOutgoingHttpHeaders } from '../../utils'; +import { NextRequest } from '../request'; +import { isNodeNextRequest, isWebNextRequest } from '../../../base-http/helpers'; +export const ResponseAbortedName = 'ResponseAborted'; +export class ResponseAborted extends Error { + constructor(...args){ + super(...args), this.name = ResponseAbortedName; + } +} +/** + * Creates an AbortController tied to the closing of a ServerResponse (or other + * appropriate Writable). + * + * If the `close` event is fired before the `finish` event, then we'll send the + * `abort` signal. + */ export function createAbortController(response) { + const controller = new AbortController(); + // If `finish` fires first, then `res.end()` has been called and the close is + // just us finishing the stream on our side. If `close` fires first, then we + // know the client disconnected before we finished. + response.once('close', ()=>{ + if (response.writableFinished) return; + controller.abort(new ResponseAborted()); + }); + return controller; +} +/** + * Creates an AbortSignal tied to the closing of a ServerResponse (or other + * appropriate Writable). + * + * This cannot be done with the request (IncomingMessage or Readable) because + * the `abort` event will not fire if to data has been fully read (because that + * will "close" the readable stream and nothing fires after that). + */ export function signalFromNodeResponse(response) { + const { errored, destroyed } = response; + if (errored || destroyed) { + return AbortSignal.abort(errored ?? new ResponseAborted()); + } + const { signal } = createAbortController(response); + return signal; +} +export class NextRequestAdapter { + static fromBaseNextRequest(request, signal) { + if (// The type check here ensures that `req` is correctly typed, and the + // environment variable check provides dead code elimination. + process.env.NEXT_RUNTIME === 'edge' && isWebNextRequest(request)) { + return NextRequestAdapter.fromWebNextRequest(request); + } else if (// The type check here ensures that `req` is correctly typed, and the + // environment variable check provides dead code elimination. + process.env.NEXT_RUNTIME !== 'edge' && isNodeNextRequest(request)) { + return NextRequestAdapter.fromNodeNextRequest(request, signal); + } else { + throw new Error('Invariant: Unsupported NextRequest type'); + } + } + static fromNodeNextRequest(request, signal) { + // HEAD and GET requests can not have a body. + let body = null; + if (request.method !== 'GET' && request.method !== 'HEAD' && request.body) { + // @ts-expect-error - this is handled by undici, when streams/web land use it instead + body = request.body; + } + let url; + if (request.url.startsWith('http')) { + url = new URL(request.url); + } else { + // Grab the full URL from the request metadata. + const base = getRequestMeta(request, 'initURL'); + if (!base || !base.startsWith('http')) { + // Because the URL construction relies on the fact that the URL provided + // is absolute, we need to provide a base URL. We can't use the request + // URL because it's relative, so we use a dummy URL instead. + url = new URL(request.url, 'http://n'); + } else { + url = new URL(request.url, base); + } + } + return new NextRequest(url, { + method: request.method, + headers: fromNodeOutgoingHttpHeaders(request.headers), + duplex: 'half', + signal, + // geo + // ip + // nextConfig + // body can not be passed if request was aborted + // or we get a Request body was disturbed error + ...signal.aborted ? {} : { + body + } + }); + } + static fromWebNextRequest(request) { + // HEAD and GET requests can not have a body. + let body = null; + if (request.method !== 'GET' && request.method !== 'HEAD') { + body = request.body; + } + return new NextRequest(request.url, { + method: request.method, + headers: fromNodeOutgoingHttpHeaders(request.headers), + duplex: 'half', + signal: request.request.signal, + // geo + // ip + // nextConfig + // body can not be passed if request was aborted + // or we get a Request body was disturbed error + ...request.request.signal.aborted ? {} : { + body + } + }); + } +} + +//# sourceMappingURL=next-request.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/next-request.js.map b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/next-request.js.map new file mode 100644 index 0000000000000000000000000000000000000000..bda66900eda84a0663721afaf6217468352a3234 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/next-request.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/server/web/spec-extension/adapters/next-request.ts"],"sourcesContent":["import type { BaseNextRequest } from '../../../base-http'\nimport type { NodeNextRequest } from '../../../base-http/node'\nimport type { WebNextRequest } from '../../../base-http/web'\nimport type { Writable } from 'node:stream'\n\nimport { getRequestMeta } from '../../../request-meta'\nimport { fromNodeOutgoingHttpHeaders } from '../../utils'\nimport { NextRequest } from '../request'\nimport { isNodeNextRequest, isWebNextRequest } from '../../../base-http/helpers'\n\nexport const ResponseAbortedName = 'ResponseAborted'\nexport class ResponseAborted extends Error {\n public readonly name = ResponseAbortedName\n}\n\n/**\n * Creates an AbortController tied to the closing of a ServerResponse (or other\n * appropriate Writable).\n *\n * If the `close` event is fired before the `finish` event, then we'll send the\n * `abort` signal.\n */\nexport function createAbortController(response: Writable): AbortController {\n const controller = new AbortController()\n\n // If `finish` fires first, then `res.end()` has been called and the close is\n // just us finishing the stream on our side. If `close` fires first, then we\n // know the client disconnected before we finished.\n response.once('close', () => {\n if (response.writableFinished) return\n\n controller.abort(new ResponseAborted())\n })\n\n return controller\n}\n\n/**\n * Creates an AbortSignal tied to the closing of a ServerResponse (or other\n * appropriate Writable).\n *\n * This cannot be done with the request (IncomingMessage or Readable) because\n * the `abort` event will not fire if to data has been fully read (because that\n * will \"close\" the readable stream and nothing fires after that).\n */\nexport function signalFromNodeResponse(response: Writable): AbortSignal {\n const { errored, destroyed } = response\n if (errored || destroyed) {\n return AbortSignal.abort(errored ?? new ResponseAborted())\n }\n\n const { signal } = createAbortController(response)\n return signal\n}\n\nexport class NextRequestAdapter {\n public static fromBaseNextRequest(\n request: BaseNextRequest,\n signal: AbortSignal\n ): NextRequest {\n if (\n // The type check here ensures that `req` is correctly typed, and the\n // environment variable check provides dead code elimination.\n process.env.NEXT_RUNTIME === 'edge' &&\n isWebNextRequest(request)\n ) {\n return NextRequestAdapter.fromWebNextRequest(request)\n } else if (\n // The type check here ensures that `req` is correctly typed, and the\n // environment variable check provides dead code elimination.\n process.env.NEXT_RUNTIME !== 'edge' &&\n isNodeNextRequest(request)\n ) {\n return NextRequestAdapter.fromNodeNextRequest(request, signal)\n } else {\n throw new Error('Invariant: Unsupported NextRequest type')\n }\n }\n\n public static fromNodeNextRequest(\n request: NodeNextRequest,\n signal: AbortSignal\n ): NextRequest {\n // HEAD and GET requests can not have a body.\n let body: BodyInit | null = null\n if (request.method !== 'GET' && request.method !== 'HEAD' && request.body) {\n // @ts-expect-error - this is handled by undici, when streams/web land use it instead\n body = request.body\n }\n\n let url: URL\n if (request.url.startsWith('http')) {\n url = new URL(request.url)\n } else {\n // Grab the full URL from the request metadata.\n const base = getRequestMeta(request, 'initURL')\n if (!base || !base.startsWith('http')) {\n // Because the URL construction relies on the fact that the URL provided\n // is absolute, we need to provide a base URL. We can't use the request\n // URL because it's relative, so we use a dummy URL instead.\n url = new URL(request.url, 'http://n')\n } else {\n url = new URL(request.url, base)\n }\n }\n\n return new NextRequest(url, {\n method: request.method,\n headers: fromNodeOutgoingHttpHeaders(request.headers),\n duplex: 'half',\n signal,\n // geo\n // ip\n // nextConfig\n\n // body can not be passed if request was aborted\n // or we get a Request body was disturbed error\n ...(signal.aborted\n ? {}\n : {\n body,\n }),\n })\n }\n\n public static fromWebNextRequest(request: WebNextRequest): NextRequest {\n // HEAD and GET requests can not have a body.\n let body: ReadableStream | null = null\n if (request.method !== 'GET' && request.method !== 'HEAD') {\n body = request.body\n }\n\n return new NextRequest(request.url, {\n method: request.method,\n headers: fromNodeOutgoingHttpHeaders(request.headers),\n duplex: 'half',\n signal: request.request.signal,\n // geo\n // ip\n // nextConfig\n\n // body can not be passed if request was aborted\n // or we get a Request body was disturbed error\n ...(request.request.signal.aborted\n ? {}\n : {\n body,\n }),\n })\n }\n}\n"],"names":["getRequestMeta","fromNodeOutgoingHttpHeaders","NextRequest","isNodeNextRequest","isWebNextRequest","ResponseAbortedName","ResponseAborted","Error","name","createAbortController","response","controller","AbortController","once","writableFinished","abort","signalFromNodeResponse","errored","destroyed","AbortSignal","signal","NextRequestAdapter","fromBaseNextRequest","request","process","env","NEXT_RUNTIME","fromWebNextRequest","fromNodeNextRequest","body","method","url","startsWith","URL","base","headers","duplex","aborted"],"mappings":"AAKA,SAASA,cAAc,QAAQ,wBAAuB;AACtD,SAASC,2BAA2B,QAAQ,cAAa;AACzD,SAASC,WAAW,QAAQ,aAAY;AACxC,SAASC,iBAAiB,EAAEC,gBAAgB,QAAQ,6BAA4B;AAEhF,OAAO,MAAMC,sBAAsB,kBAAiB;AACpD,OAAO,MAAMC,wBAAwBC;;QAA9B,qBACWC,OAAOH;;AACzB;AAEA;;;;;;CAMC,GACD,OAAO,SAASI,sBAAsBC,QAAkB;IACtD,MAAMC,aAAa,IAAIC;IAEvB,6EAA6E;IAC7E,4EAA4E;IAC5E,mDAAmD;IACnDF,SAASG,IAAI,CAAC,SAAS;QACrB,IAAIH,SAASI,gBAAgB,EAAE;QAE/BH,WAAWI,KAAK,CAAC,IAAIT;IACvB;IAEA,OAAOK;AACT;AAEA;;;;;;;CAOC,GACD,OAAO,SAASK,uBAAuBN,QAAkB;IACvD,MAAM,EAAEO,OAAO,EAAEC,SAAS,EAAE,GAAGR;IAC/B,IAAIO,WAAWC,WAAW;QACxB,OAAOC,YAAYJ,KAAK,CAACE,WAAW,IAAIX;IAC1C;IAEA,MAAM,EAAEc,MAAM,EAAE,GAAGX,sBAAsBC;IACzC,OAAOU;AACT;AAEA,OAAO,MAAMC;IACX,OAAcC,oBACZC,OAAwB,EACxBH,MAAmB,EACN;QACb,IACE,qEAAqE;QACrE,6DAA6D;QAC7DI,QAAQC,GAAG,CAACC,YAAY,KAAK,UAC7BtB,iBAAiBmB,UACj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KAAK,QAAQ;YACzDD,OAAON,QAAQM,IAAI;QACrB;QAEA,OAAO,IAAI3B,YAAYqB,QAAQQ,GAAG,EAAE;YAClCD,QAAQP,QAAQO,MAAM;YACtBK,SAASlC,4BAA4BsB,QAAQY,OAAO;YACpDC,QAAQ;YACRhB,QAAQG,QAAQA,OAAO,CAACH,MAAM;YAC9B,MAAM;YACN,KAAK;YACL,aAAa;YAEb,gDAAgD;YAChD,+CAA+C;YAC/C,GAAIG,QAAQA,OAAO,CAACH,MAAM,CAACiB,OAAO,GAC9B,CAAC,IACD;gBACER;YACF,CAAC;QACP;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/reflect.js b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/reflect.js new file mode 100644 index 0000000000000000000000000000000000000000..4281dff56d40d45956753d441143c5cf28369cf1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/reflect.js @@ -0,0 +1,20 @@ +export class ReflectAdapter { + static get(target, prop, receiver) { + const value = Reflect.get(target, prop, receiver); + if (typeof value === 'function') { + return value.bind(target); + } + return value; + } + static set(target, prop, value, receiver) { + return Reflect.set(target, prop, value, receiver); + } + static has(target, prop) { + return Reflect.has(target, prop); + } + static deleteProperty(target, prop) { + return Reflect.deleteProperty(target, prop); + } +} + +//# sourceMappingURL=reflect.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/reflect.js.map b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/reflect.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0d28e73dc5fd0af0b5c5b660d92577df96ffed76 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/reflect.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/server/web/spec-extension/adapters/reflect.ts"],"sourcesContent":["export class ReflectAdapter {\n static get(\n target: T,\n prop: string | symbol,\n receiver: unknown\n ): any {\n const value = Reflect.get(target, prop, receiver)\n if (typeof value === 'function') {\n return value.bind(target)\n }\n\n return value\n }\n\n static set(\n target: T,\n prop: string | symbol,\n value: any,\n receiver: any\n ): boolean {\n return Reflect.set(target, prop, value, receiver)\n }\n\n static has(target: T, prop: string | symbol): boolean {\n return Reflect.has(target, prop)\n }\n\n static deleteProperty(\n target: T,\n prop: string | symbol\n ): boolean {\n return Reflect.deleteProperty(target, prop)\n }\n}\n"],"names":["ReflectAdapter","get","target","prop","receiver","value","Reflect","bind","set","has","deleteProperty"],"mappings":"AAAA,OAAO,MAAMA;IACX,OAAOC,IACLC,MAAS,EACTC,IAAqB,EACrBC,QAAiB,EACZ;QACL,MAAMC,QAAQC,QAAQL,GAAG,CAACC,QAAQC,MAAMC;QACxC,IAAI,OAAOC,UAAU,YAAY;YAC/B,OAAOA,MAAME,IAAI,CAACL;QACpB;QAEA,OAAOG;IACT;IAEA,OAAOG,IACLN,MAAS,EACTC,IAAqB,EACrBE,KAAU,EACVD,QAAa,EACJ;QACT,OAAOE,QAAQE,GAAG,CAACN,QAAQC,MAAME,OAAOD;IAC1C;IAEA,OAAOK,IAAsBP,MAAS,EAAEC,IAAqB,EAAW;QACtE,OAAOG,QAAQG,GAAG,CAACP,QAAQC;IAC7B;IAEA,OAAOO,eACLR,MAAS,EACTC,IAAqB,EACZ;QACT,OAAOG,QAAQI,cAAc,CAACR,QAAQC;IACxC;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/request-cookies.js b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/request-cookies.js new file mode 100644 index 0000000000000000000000000000000000000000..c44cf72164242ac233658fa0ac16581e1584a5d9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/request-cookies.js @@ -0,0 +1,178 @@ +import { RequestCookies } from '../cookies'; +import { ResponseCookies } from '../cookies'; +import { ReflectAdapter } from './reflect'; +import { workAsyncStorage } from '../../../app-render/work-async-storage.external'; +import { ActionDidRevalidateStaticAndDynamic } from '../../../../shared/lib/action-revalidation-kind'; +/** + * @internal + */ export class ReadonlyRequestCookiesError extends Error { + constructor(){ + super('Cookies can only be modified in a Server Action or Route Handler. Read more: https://nextjs.org/docs/app/api-reference/functions/cookies#options'); + } + static callable() { + throw new ReadonlyRequestCookiesError(); + } +} +export class RequestCookiesAdapter { + static seal(cookies) { + return new Proxy(cookies, { + get (target, prop, receiver) { + switch(prop){ + case 'clear': + case 'delete': + case 'set': + return ReadonlyRequestCookiesError.callable; + default: + return ReflectAdapter.get(target, prop, receiver); + } + } + }); + } + /** + * @param cookies + * @returns A fresh object identity backed by the original value + */ static fresh(cookies) { + return new Proxy(cookies, { + get (target, prop, receiver) { + return ReflectAdapter.get(target, prop, receiver); + } + }); + } +} +const SYMBOL_MODIFY_COOKIE_VALUES = Symbol.for('next.mutated.cookies'); +export function getModifiedCookieValues(cookies) { + const modified = cookies[SYMBOL_MODIFY_COOKIE_VALUES]; + if (!modified || !Array.isArray(modified) || modified.length === 0) { + return []; + } + return modified; +} +export function appendMutableCookies(headers, mutableCookies) { + const modifiedCookieValues = getModifiedCookieValues(mutableCookies); + if (modifiedCookieValues.length === 0) { + return false; + } + // Return a new response that extends the response with + // the modified cookies as fallbacks. `res` cookies + // will still take precedence. + const resCookies = new ResponseCookies(headers); + const returnedCookies = resCookies.getAll(); + // Set the modified cookies as fallbacks. + for (const cookie of modifiedCookieValues){ + resCookies.set(cookie); + } + // Set the original cookies as the final values. + for (const cookie of returnedCookies){ + resCookies.set(cookie); + } + return true; +} +export class MutableRequestCookiesAdapter { + static wrap(cookies, onUpdateCookies) { + const responseCookies = new ResponseCookies(new Headers()); + for (const cookie of cookies.getAll()){ + responseCookies.set(cookie); + } + let modifiedValues = []; + const modifiedCookies = new Set(); + const updateResponseCookies = ()=>{ + // TODO-APP: change method of getting workStore + const workStore = workAsyncStorage.getStore(); + if (workStore) { + workStore.pathWasRevalidated = ActionDidRevalidateStaticAndDynamic; + } + const allCookies = responseCookies.getAll(); + modifiedValues = allCookies.filter((c)=>modifiedCookies.has(c.name)); + if (onUpdateCookies) { + const serializedCookies = []; + for (const cookie of modifiedValues){ + const tempCookies = new ResponseCookies(new Headers()); + tempCookies.set(cookie); + serializedCookies.push(tempCookies.toString()); + } + onUpdateCookies(serializedCookies); + } + }; + const wrappedCookies = new Proxy(responseCookies, { + get (target, prop, receiver) { + switch(prop){ + // A special symbol to get the modified cookie values + case SYMBOL_MODIFY_COOKIE_VALUES: + return modifiedValues; + // TODO: Throw error if trying to set a cookie after the response + // headers have been set. + case 'delete': + return function(...args) { + modifiedCookies.add(typeof args[0] === 'string' ? args[0] : args[0].name); + try { + target.delete(...args); + return wrappedCookies; + } finally{ + updateResponseCookies(); + } + }; + case 'set': + return function(...args) { + modifiedCookies.add(typeof args[0] === 'string' ? args[0] : args[0].name); + try { + target.set(...args); + return wrappedCookies; + } finally{ + updateResponseCookies(); + } + }; + default: + return ReflectAdapter.get(target, prop, receiver); + } + } + }); + return wrappedCookies; + } +} +export function createCookiesWithMutableAccessCheck(requestStore) { + const wrappedCookies = new Proxy(requestStore.mutableCookies, { + get (target, prop, receiver) { + switch(prop){ + case 'delete': + return function(...args) { + ensureCookiesAreStillMutable(requestStore, 'cookies().delete'); + target.delete(...args); + return wrappedCookies; + }; + case 'set': + return function(...args) { + ensureCookiesAreStillMutable(requestStore, 'cookies().set'); + target.set(...args); + return wrappedCookies; + }; + default: + return ReflectAdapter.get(target, prop, receiver); + } + } + }); + return wrappedCookies; +} +export function areCookiesMutableInCurrentPhase(requestStore) { + return requestStore.phase === 'action'; +} +/** Ensure that cookies() starts throwing on mutation + * if we changed phases and can no longer mutate. + * + * This can happen when going: + * 'render' -> 'after' + * 'action' -> 'render' + * */ function ensureCookiesAreStillMutable(requestStore, _callingExpression) { + if (!areCookiesMutableInCurrentPhase(requestStore)) { + // TODO: maybe we can give a more precise error message based on callingExpression? + throw new ReadonlyRequestCookiesError(); + } +} +export function responseCookiesToRequestCookies(responseCookies) { + const requestCookies = new RequestCookies(new Headers()); + for (const cookie of responseCookies.getAll()){ + requestCookies.set(cookie); + } + return requestCookies; +} + +//# sourceMappingURL=request-cookies.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/request-cookies.js.map b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/request-cookies.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1a3bdbde1f4ae5e268bce9aa380476adee5dafd2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/adapters/request-cookies.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/server/web/spec-extension/adapters/request-cookies.ts"],"sourcesContent":["import { RequestCookies } from '../cookies'\n\nimport { ResponseCookies } from '../cookies'\nimport { ReflectAdapter } from './reflect'\nimport { workAsyncStorage } from '../../../app-render/work-async-storage.external'\nimport type { RequestStore } from '../../../app-render/work-unit-async-storage.external'\nimport { ActionDidRevalidateStaticAndDynamic } from '../../../../shared/lib/action-revalidation-kind'\n\n/**\n * @internal\n */\nexport class ReadonlyRequestCookiesError extends Error {\n constructor() {\n super(\n 'Cookies can only be modified in a Server Action or Route Handler. Read more: https://nextjs.org/docs/app/api-reference/functions/cookies#options'\n )\n }\n\n public static callable() {\n throw new ReadonlyRequestCookiesError()\n }\n}\n\n// We use this to type some APIs but we don't construct instances directly\nexport type { ResponseCookies }\n\n// The `cookies()` API is a mix of request and response cookies. For `.get()` methods,\n// we want to return the request cookie if it exists. For mutative methods like `.set()`,\n// we want to return the response cookie.\nexport type ReadonlyRequestCookies = Omit<\n RequestCookies,\n 'set' | 'clear' | 'delete'\n> &\n Pick\n\nexport class RequestCookiesAdapter {\n public static seal(cookies: RequestCookies): ReadonlyRequestCookies {\n return new Proxy(cookies as any, {\n get(target, prop, receiver) {\n switch (prop) {\n case 'clear':\n case 'delete':\n case 'set':\n return ReadonlyRequestCookiesError.callable\n default:\n return ReflectAdapter.get(target, prop, receiver)\n }\n },\n })\n }\n\n /**\n * @param cookies\n * @returns A fresh object identity backed by the original value\n */\n public static fresh(cookies: ReadonlyRequestCookies): ReadonlyRequestCookies {\n return new Proxy(cookies, {\n get(target, prop, receiver) {\n return ReflectAdapter.get(target, prop, receiver)\n },\n })\n }\n}\n\nconst SYMBOL_MODIFY_COOKIE_VALUES = Symbol.for('next.mutated.cookies')\n\nexport function getModifiedCookieValues(\n cookies: ResponseCookies\n): ResponseCookie[] {\n const modified: ResponseCookie[] | undefined = (cookies as unknown as any)[\n SYMBOL_MODIFY_COOKIE_VALUES\n ]\n if (!modified || !Array.isArray(modified) || modified.length === 0) {\n return []\n }\n\n return modified\n}\n\ntype SetCookieArgs =\n | [key: string, value: string, cookie?: Partial]\n | [options: ResponseCookie]\n\nexport function appendMutableCookies(\n headers: Headers,\n mutableCookies: ResponseCookies\n): boolean {\n const modifiedCookieValues = getModifiedCookieValues(mutableCookies)\n if (modifiedCookieValues.length === 0) {\n return false\n }\n\n // Return a new response that extends the response with\n // the modified cookies as fallbacks. `res` cookies\n // will still take precedence.\n const resCookies = new ResponseCookies(headers)\n const returnedCookies = resCookies.getAll()\n\n // Set the modified cookies as fallbacks.\n for (const cookie of modifiedCookieValues) {\n resCookies.set(cookie)\n }\n\n // Set the original cookies as the final values.\n for (const cookie of returnedCookies) {\n resCookies.set(cookie)\n }\n\n return true\n}\n\ntype ResponseCookie = NonNullable<\n ReturnType['get']>\n>\n\nexport class MutableRequestCookiesAdapter {\n public static wrap(\n cookies: RequestCookies,\n onUpdateCookies?: (cookies: string[]) => void\n ): ResponseCookies {\n const responseCookies = new ResponseCookies(new Headers())\n for (const cookie of cookies.getAll()) {\n responseCookies.set(cookie)\n }\n\n let modifiedValues: ResponseCookie[] = []\n const modifiedCookies = new Set()\n const updateResponseCookies = () => {\n // TODO-APP: change method of getting workStore\n const workStore = workAsyncStorage.getStore()\n if (workStore) {\n workStore.pathWasRevalidated = ActionDidRevalidateStaticAndDynamic\n }\n\n const allCookies = responseCookies.getAll()\n modifiedValues = allCookies.filter((c) => modifiedCookies.has(c.name))\n if (onUpdateCookies) {\n const serializedCookies: string[] = []\n for (const cookie of modifiedValues) {\n const tempCookies = new ResponseCookies(new Headers())\n tempCookies.set(cookie)\n serializedCookies.push(tempCookies.toString())\n }\n\n onUpdateCookies(serializedCookies)\n }\n }\n\n const wrappedCookies = new Proxy(responseCookies, {\n get(target, prop, receiver) {\n switch (prop) {\n // A special symbol to get the modified cookie values\n case SYMBOL_MODIFY_COOKIE_VALUES:\n return modifiedValues\n\n // TODO: Throw error if trying to set a cookie after the response\n // headers have been set.\n case 'delete':\n return function (...args: [string] | [ResponseCookie]) {\n modifiedCookies.add(\n typeof args[0] === 'string' ? args[0] : args[0].name\n )\n try {\n target.delete(...args)\n return wrappedCookies\n } finally {\n updateResponseCookies()\n }\n }\n case 'set':\n return function (...args: SetCookieArgs) {\n modifiedCookies.add(\n typeof args[0] === 'string' ? args[0] : args[0].name\n )\n try {\n target.set(...args)\n return wrappedCookies\n } finally {\n updateResponseCookies()\n }\n }\n\n default:\n return ReflectAdapter.get(target, prop, receiver)\n }\n },\n })\n\n return wrappedCookies\n }\n}\n\nexport function createCookiesWithMutableAccessCheck(\n requestStore: RequestStore\n): ResponseCookies {\n const wrappedCookies = new Proxy(requestStore.mutableCookies, {\n get(target, prop, receiver) {\n switch (prop) {\n case 'delete':\n return function (...args: [string] | [ResponseCookie]) {\n ensureCookiesAreStillMutable(requestStore, 'cookies().delete')\n target.delete(...args)\n return wrappedCookies\n }\n case 'set':\n return function (...args: SetCookieArgs) {\n ensureCookiesAreStillMutable(requestStore, 'cookies().set')\n target.set(...args)\n return wrappedCookies\n }\n\n default:\n return ReflectAdapter.get(target, prop, receiver)\n }\n },\n })\n return wrappedCookies\n}\n\nexport function areCookiesMutableInCurrentPhase(requestStore: RequestStore) {\n return requestStore.phase === 'action'\n}\n\n/** Ensure that cookies() starts throwing on mutation\n * if we changed phases and can no longer mutate.\n *\n * This can happen when going:\n * 'render' -> 'after'\n * 'action' -> 'render'\n * */\nfunction ensureCookiesAreStillMutable(\n requestStore: RequestStore,\n _callingExpression: string\n) {\n if (!areCookiesMutableInCurrentPhase(requestStore)) {\n // TODO: maybe we can give a more precise error message based on callingExpression?\n throw new ReadonlyRequestCookiesError()\n }\n}\n\nexport function responseCookiesToRequestCookies(\n responseCookies: ResponseCookies\n): RequestCookies {\n const requestCookies = new RequestCookies(new Headers())\n for (const cookie of responseCookies.getAll()) {\n requestCookies.set(cookie)\n }\n return requestCookies\n}\n"],"names":["RequestCookies","ResponseCookies","ReflectAdapter","workAsyncStorage","ActionDidRevalidateStaticAndDynamic","ReadonlyRequestCookiesError","Error","constructor","callable","RequestCookiesAdapter","seal","cookies","Proxy","get","target","prop","receiver","fresh","SYMBOL_MODIFY_COOKIE_VALUES","Symbol","for","getModifiedCookieValues","modified","Array","isArray","length","appendMutableCookies","headers","mutableCookies","modifiedCookieValues","resCookies","returnedCookies","getAll","cookie","set","MutableRequestCookiesAdapter","wrap","onUpdateCookies","responseCookies","Headers","modifiedValues","modifiedCookies","Set","updateResponseCookies","workStore","getStore","pathWasRevalidated","allCookies","filter","c","has","name","serializedCookies","tempCookies","push","toString","wrappedCookies","args","add","delete","createCookiesWithMutableAccessCheck","requestStore","ensureCookiesAreStillMutable","areCookiesMutableInCurrentPhase","phase","_callingExpression","responseCookiesToRequestCookies","requestCookies"],"mappings":"AAAA,SAASA,cAAc,QAAQ,aAAY;AAE3C,SAASC,eAAe,QAAQ,aAAY;AAC5C,SAASC,cAAc,QAAQ,YAAW;AAC1C,SAASC,gBAAgB,QAAQ,kDAAiD;AAElF,SAASC,mCAAmC,QAAQ,kDAAiD;AAErG;;CAEC,GACD,OAAO,MAAMC,oCAAoCC;IAC/CC,aAAc;QACZ,KAAK,CACH;IAEJ;IAEA,OAAcC,WAAW;QACvB,MAAM,IAAIH;IACZ;AACF;AAc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IAAI,CAAC,EAAE,KAAK,WAAWA,IAAI,CAAC,EAAE,GAAGA,IAAI,CAAC,EAAE,CAACN,IAAI;4BAEtD,IAAI;gCACFrC,OAAOoB,GAAG,IAAIuB;gCACd,OAAOD;4BACT,SAAU;gCACRb;4BACF;wBACF;oBAEF;wBACE,OAAOzC,eAAeW,GAAG,CAACC,QAAQC,MAAMC;gBAC5C;YACF;QACF;QAEA,OAAOwC;IACT;AACF;AAEA,OAAO,SAASI,oCACdC,YAA0B;IAE1B,MAAML,iBAAiB,IAAI5C,MAAMiD,aAAajC,cAAc,EAAE;QAC5Df,KAAIC,MAAM,EAAEC,IAAI,EAAEC,QAAQ;YACxB,OAAQD;gBACN,KAAK;oBACH,OAAO,SAAU,GAAG0C,IAAiC;wBACnDK,6BAA6BD,cAAc;wBAC3C/C,OAAO6C,MAAM,IAAIF;wBACjB,OAAOD;oBACT;gBACF,KAAK;oBACH,OAAO,SAAU,GAAGC,IAAmB;wBACrCK,6BAA6BD,cAAc;wBAC3C/C,OAAOoB,GAAG,IAAIuB;wBACd,OAAOD;oBACT;gBAEF;oBACE,OAAOtD,eAAeW,GAAG,CAACC,QAAQC,MAAMC;YAC5C;QACF;IACF;IACA,OAAOwC;AACT;AAEA,OAAO,SAASO,gCAAgCF,YAA0B;IACxE,OAAOA,aAAaG,KAAK,KAAK;AAChC;AAEA;;;;;;GAMG,GACH,SAASF,6BACPD,YAA0B,EAC1BI,kBAA0B;IAE1B,IAAI,CAACF,gCAAgCF,eAAe;QAClD,mFAAmF;QACnF,MAAM,IAAIxD;IACZ;AACF;AAEA,OAAO,SAAS6D,gCACd5B,eAAgC;IAEhC,MAAM6B,iBAAiB,IAAInE,eAAe,IAAIuC;IAC9C,KAAK,MAAMN,UAAUK,gBAAgBN,MAAM,GAAI;QAC7CmC,eAAejC,GAAG,CAACD;IACrB;IACA,OAAOkC;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/cookies.js b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/cookies.js new file mode 100644 index 0000000000000000000000000000000000000000..0602e0196df23e1c0baf11b1856c98693082dbb1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/cookies.js @@ -0,0 +1,3 @@ +export { RequestCookies, ResponseCookies, stringifyCookie } from 'next/dist/compiled/@edge-runtime/cookies'; + +//# sourceMappingURL=cookies.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/cookies.js.map b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/cookies.js.map new file mode 100644 index 0000000000000000000000000000000000000000..341570d84d3baee0dd447af512788a365f2fb9e2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/cookies.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/web/spec-extension/cookies.ts"],"sourcesContent":["export {\n RequestCookies,\n ResponseCookies,\n stringifyCookie,\n} from 'next/dist/compiled/@edge-runtime/cookies'\n"],"names":["RequestCookies","ResponseCookies","stringifyCookie"],"mappings":"AAAA,SACEA,cAAc,EACdC,eAAe,EACfC,eAAe,QACV,2CAA0C","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/fetch-event.js b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/fetch-event.js new file mode 100644 index 0000000000000000000000000000000000000000..c2370325626f8635760a045340a348f79da51976 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/fetch-event.js @@ -0,0 +1,68 @@ +import { PageSignatureError } from '../error'; +const responseSymbol = Symbol('response'); +const passThroughSymbol = Symbol('passThrough'); +const waitUntilSymbol = Symbol('waitUntil'); +class FetchEvent { + constructor(_request, waitUntil){ + this[passThroughSymbol] = false; + this[waitUntilSymbol] = waitUntil ? { + kind: 'external', + function: waitUntil + } : { + kind: 'internal', + promises: [] + }; + } + // TODO: is this dead code? NextFetchEvent never lets this get called + respondWith(response) { + if (!this[responseSymbol]) { + this[responseSymbol] = Promise.resolve(response); + } + } + // TODO: is this dead code? passThroughSymbol is unused + passThroughOnException() { + this[passThroughSymbol] = true; + } + waitUntil(promise) { + if (this[waitUntilSymbol].kind === 'external') { + // if we received an external waitUntil, we delegate to it + // TODO(after): this will make us not go through `getServerError(error, 'edge-server')` in `sandbox` + const waitUntil = this[waitUntilSymbol].function; + return waitUntil(promise); + } else { + // if we didn't receive an external waitUntil, we make it work on our own + // (and expect the caller to do something with the promises) + this[waitUntilSymbol].promises.push(promise); + } + } +} +export function getWaitUntilPromiseFromEvent(event) { + return event[waitUntilSymbol].kind === 'internal' ? Promise.all(event[waitUntilSymbol].promises).then(()=>{}) : undefined; +} +export class NextFetchEvent extends FetchEvent { + constructor(params){ + var _params_context; + super(params.request, (_params_context = params.context) == null ? void 0 : _params_context.waitUntil); + this.sourcePage = params.page; + } + /** + * @deprecated The `request` is now the first parameter and the API is now async. + * + * Read more: https://nextjs.org/docs/messages/middleware-new-signature + */ get request() { + throw new PageSignatureError({ + page: this.sourcePage + }); + } + /** + * @deprecated Using `respondWith` is no longer needed. + * + * Read more: https://nextjs.org/docs/messages/middleware-new-signature + */ respondWith() { + throw new PageSignatureError({ + page: this.sourcePage + }); + } +} + +//# sourceMappingURL=fetch-event.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/fetch-event.js.map b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/fetch-event.js.map new file mode 100644 index 0000000000000000000000000000000000000000..2bbb5ad8ae94584b53efdf3206283eca934be09c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/fetch-event.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/web/spec-extension/fetch-event.ts"],"sourcesContent":["import type { WaitUntil } from '../../after/builtin-request-context'\nimport { PageSignatureError } from '../error'\nimport type { NextRequest } from './request'\n\nconst responseSymbol = Symbol('response')\nconst passThroughSymbol = Symbol('passThrough')\nconst waitUntilSymbol = Symbol('waitUntil')\n\nclass FetchEvent {\n // TODO(after): get rid of the 'internal' variant and always use an external waitUntil\n // (this means removing `FetchEventResult.waitUntil` which also requires a builder change)\n readonly [waitUntilSymbol]:\n | { kind: 'internal'; promises: Promise[] }\n | { kind: 'external'; function: WaitUntil };\n\n [responseSymbol]?: Promise;\n [passThroughSymbol] = false\n\n constructor(_request: Request, waitUntil?: WaitUntil) {\n this[waitUntilSymbol] = waitUntil\n ? { kind: 'external', function: waitUntil }\n : { kind: 'internal', promises: [] }\n }\n\n // TODO: is this dead code? NextFetchEvent never lets this get called\n respondWith(response: Response | Promise): void {\n if (!this[responseSymbol]) {\n this[responseSymbol] = Promise.resolve(response)\n }\n }\n\n // TODO: is this dead code? passThroughSymbol is unused\n passThroughOnException(): void {\n this[passThroughSymbol] = true\n }\n\n waitUntil(promise: Promise): void {\n if (this[waitUntilSymbol].kind === 'external') {\n // if we received an external waitUntil, we delegate to it\n // TODO(after): this will make us not go through `getServerError(error, 'edge-server')` in `sandbox`\n const waitUntil = this[waitUntilSymbol].function\n return waitUntil(promise)\n } else {\n // if we didn't receive an external waitUntil, we make it work on our own\n // (and expect the caller to do something with the promises)\n this[waitUntilSymbol].promises.push(promise)\n }\n }\n}\n\nexport function getWaitUntilPromiseFromEvent(\n event: FetchEvent\n): Promise | undefined {\n return event[waitUntilSymbol].kind === 'internal'\n ? Promise.all(event[waitUntilSymbol].promises).then(() => {})\n : undefined\n}\n\nexport class NextFetchEvent extends FetchEvent {\n sourcePage: string\n\n constructor(params: {\n request: NextRequest\n page: string\n context: { waitUntil: WaitUntil } | undefined\n }) {\n super(params.request, params.context?.waitUntil)\n this.sourcePage = params.page\n }\n\n /**\n * @deprecated The `request` is now the first parameter and the API is now async.\n *\n * Read more: https://nextjs.org/docs/messages/middleware-new-signature\n */\n get request() {\n throw new PageSignatureError({\n page: this.sourcePage,\n })\n }\n\n /**\n * @deprecated Using `respondWith` is no longer needed.\n *\n * Read more: https://nextjs.org/docs/messages/middleware-new-signature\n */\n respondWith() {\n throw new PageSignatureError({\n page: this.sourcePage,\n })\n }\n}\n"],"names":["PageSignatureError","responseSymbol","Symbol","passThroughSymbol","waitUntilSymbol","FetchEvent","constructor","_request","waitUntil","kind","function","promises","respondWith","response","Promise","resolve","passThroughOnException","promise","push","getWaitUntilPromiseFromEvent","event","all","then","undefined","NextFetchEvent","params","request","context","sourcePage","page"],"mappings":"AACA,SAASA,kBAAkB,QAAQ,WAAU;AAG7C,MAAMC,iBAAiBC,OAAO;AAC9B,MAAMC,oBAAoBD,OAAO;AACjC,MAAME,kBAAkBF,OAAO;AAE/B,MAAMG;IAUJC,YAAYC,QAAiB,EAAEC,SAAqB,CAAE;YAFtD,CAACL,kBAAkB,GAAG;QAGpB,IAAI,CAACC,gBAAgB,GAAGI,YACpB;YAAEC,MAAM;YAAYC,UAAUF;QAAU,IACxC;YAAEC,MAAM;YAAYE,UAAU,EAAE;QAAC;IACvC;IAEA,qEAAqE;IACrEC,YAAYC,QAAsC,EAAQ;QACxD,IAAI,CAAC,IAAI,CAACZ,eAAe,EAAE;YACzB,IAAI,CAACA,eAAe,GAAGa,QAAQC,OAAO,CAACF;QACzC;IACF;IAEA,uDAAuD;IACvDG,yBAA+B;QAC7B,IAAI,CAACb,kBAAkB,GAAG;IAC5B;IAEAK,UAAUS,OAAqB,EAAQ;QACrC,IAAI,IAAI,CAACb,gBAAgB,CAACK,IAAI,KAAK,YAAY;YAC7C,0DAA0D;YAC1D,oGAAoG;YACpG,MAAMD,YAAY,IAAI,CAACJ,gBAAgB,CAACM,QAAQ;YAChD,OAAOF,UAAUS;QACnB,OAAO;YACL,yEAAyE;YACzE,4DAA4D;YAC5D,IAAI,CAACb,gBAAgB,CAACO,QAAQ,CAACO,IAAI,CAACD;QACtC;IACF;AACF;AAEA,OAAO,SAASE,6BACdC,KAAiB;IAEjB,OAAOA,KAAK,CAAChB,gBAAgB,CAACK,IAAI,KAAK,aACnCK,QAAQO,GAAG,CAACD,KAAK,CAAChB,gBAAgB,CAACO,QAAQ,EAAEW,IAAI,CAAC,KAAO,KACzDC;AACN;AAEA,OAAO,MAAMC,uBAAuBnB;IAGlCC,YAAYmB,MAIX,CAAE;YACqBA;QAAtB,KAAK,CAACA,OAAOC,OAAO,GAAED,kBAAAA,OAAOE,OAAO,qBAAdF,gBAAgBjB,SAAS;QAC/C,IAAI,CAACoB,UAAU,GAAGH,OAAOI,IAAI;IAC/B;IAEA;;;;GAIC,GACD,IAAIH,UAAU;QACZ,MAAM,IAAI1B,mBAAmB;YAC3B6B,MAAM,IAAI,CAACD,UAAU;QACvB;IACF;IAEA;;;;GAIC,GACDhB,cAAc;QACZ,MAAM,IAAIZ,mBAAmB;YAC3B6B,MAAM,IAAI,CAACD,UAAU;QACvB;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/image-response.js b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/image-response.js new file mode 100644 index 0000000000000000000000000000000000000000..00630219c4ea1a395905f91d71f93e890d065a99 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/image-response.js @@ -0,0 +1,8 @@ +/** + * @deprecated ImageResponse moved from "next/server" to "next/og" since Next.js 14, please import from "next/og" instead. + * Migration with codemods: https://nextjs.org/docs/app/building-your-application/upgrading/codemods#next-og-import + */ export function ImageResponse() { + throw new Error('ImageResponse moved from "next/server" to "next/og" since Next.js 14, please import from "next/og" instead'); +} + +//# sourceMappingURL=image-response.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/image-response.js.map b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/image-response.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e7dc9d421b873fa9b4bbb8a670c540aabad9d5b3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/image-response.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/web/spec-extension/image-response.ts"],"sourcesContent":["/**\n * @deprecated ImageResponse moved from \"next/server\" to \"next/og\" since Next.js 14, please import from \"next/og\" instead.\n * Migration with codemods: https://nextjs.org/docs/app/building-your-application/upgrading/codemods#next-og-import\n */\nexport function ImageResponse(): never {\n throw new Error(\n 'ImageResponse moved from \"next/server\" to \"next/og\" since Next.js 14, please import from \"next/og\" instead'\n )\n}\n"],"names":["ImageResponse","Error"],"mappings":"AAAA;;;CAGC,GACD,OAAO,SAASA;IACd,MAAM,IAAIC,MACR;AAEJ","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/request.js b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/request.js new file mode 100644 index 0000000000000000000000000000000000000000..1148ce210729aae4e3eb41106d0bf3e19b8eb7b9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/request.js @@ -0,0 +1,81 @@ +import { NextURL } from '../next-url'; +import { toNodeOutgoingHttpHeaders, validateURL } from '../utils'; +import { RemovedUAError, RemovedPageError } from '../error'; +import { RequestCookies } from './cookies'; +export const INTERNALS = Symbol('internal request'); +/** + * This class extends the [Web `Request` API](https://developer.mozilla.org/docs/Web/API/Request) with additional convenience methods. + * + * Read more: [Next.js Docs: `NextRequest`](https://nextjs.org/docs/app/api-reference/functions/next-request) + */ export class NextRequest extends Request { + constructor(input, init = {}){ + const url = typeof input !== 'string' && 'url' in input ? input.url : String(input); + validateURL(url); + // node Request instance requires duplex option when a body + // is present or it errors, we don't handle this for + // Request being passed in since it would have already + // errored if this wasn't configured + if (process.env.NEXT_RUNTIME !== 'edge') { + if (init.body && init.duplex !== 'half') { + init.duplex = 'half'; + } + } + if (input instanceof Request) super(input, init); + else super(url, init); + const nextUrl = new NextURL(url, { + headers: toNodeOutgoingHttpHeaders(this.headers), + nextConfig: init.nextConfig + }); + this[INTERNALS] = { + cookies: new RequestCookies(this.headers), + nextUrl, + url: process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE ? url : nextUrl.toString() + }; + } + [Symbol.for('edge-runtime.inspect.custom')]() { + return { + cookies: this.cookies, + nextUrl: this.nextUrl, + url: this.url, + // rest of props come from Request + bodyUsed: this.bodyUsed, + cache: this.cache, + credentials: this.credentials, + destination: this.destination, + headers: Object.fromEntries(this.headers), + integrity: this.integrity, + keepalive: this.keepalive, + method: this.method, + mode: this.mode, + redirect: this.redirect, + referrer: this.referrer, + referrerPolicy: this.referrerPolicy, + signal: this.signal + }; + } + get cookies() { + return this[INTERNALS].cookies; + } + get nextUrl() { + return this[INTERNALS].nextUrl; + } + /** + * @deprecated + * `page` has been deprecated in favour of `URLPattern`. + * Read more: https://nextjs.org/docs/messages/middleware-request-page + */ get page() { + throw new RemovedPageError(); + } + /** + * @deprecated + * `ua` has been removed in favour of \`userAgent\` function. + * Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent + */ get ua() { + throw new RemovedUAError(); + } + get url() { + return this[INTERNALS].url; + } +} + +//# sourceMappingURL=request.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/request.js.map b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/request.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6d77bad8ac866bb6082e4e9024b3624e316e9ec5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/request.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/web/spec-extension/request.ts"],"sourcesContent":["import type { I18NConfig } from '../../config-shared'\nimport { NextURL } from '../next-url'\nimport { toNodeOutgoingHttpHeaders, validateURL } from '../utils'\nimport { RemovedUAError, RemovedPageError } from '../error'\nimport { RequestCookies } from './cookies'\n\nexport const INTERNALS = Symbol('internal request')\n\n/**\n * This class extends the [Web `Request` API](https://developer.mozilla.org/docs/Web/API/Request) with additional convenience methods.\n *\n * Read more: [Next.js Docs: `NextRequest`](https://nextjs.org/docs/app/api-reference/functions/next-request)\n */\nexport class NextRequest extends Request {\n /** @internal */\n [INTERNALS]: {\n cookies: RequestCookies\n url: string\n nextUrl: NextURL\n }\n\n constructor(input: URL | RequestInfo, init: RequestInit = {}) {\n const url =\n typeof input !== 'string' && 'url' in input ? input.url : String(input)\n\n validateURL(url)\n\n // node Request instance requires duplex option when a body\n // is present or it errors, we don't handle this for\n // Request being passed in since it would have already\n // errored if this wasn't configured\n if (process.env.NEXT_RUNTIME !== 'edge') {\n if (init.body && init.duplex !== 'half') {\n init.duplex = 'half'\n }\n }\n\n if (input instanceof Request) super(input, init)\n else super(url, init)\n\n const nextUrl = new NextURL(url, {\n headers: toNodeOutgoingHttpHeaders(this.headers),\n nextConfig: init.nextConfig,\n })\n this[INTERNALS] = {\n cookies: new RequestCookies(this.headers),\n nextUrl,\n url: process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE\n ? url\n : nextUrl.toString(),\n }\n }\n\n [Symbol.for('edge-runtime.inspect.custom')]() {\n return {\n cookies: this.cookies,\n nextUrl: this.nextUrl,\n url: this.url,\n // rest of props come from Request\n bodyUsed: this.bodyUsed,\n cache: this.cache,\n credentials: this.credentials,\n destination: this.destination,\n headers: Object.fromEntries(this.headers),\n integrity: this.integrity,\n keepalive: this.keepalive,\n method: this.method,\n mode: this.mode,\n redirect: this.redirect,\n referrer: this.referrer,\n referrerPolicy: this.referrerPolicy,\n signal: this.signal,\n }\n }\n\n public get cookies() {\n return this[INTERNALS].cookies\n }\n\n public get nextUrl() {\n return this[INTERNALS].nextUrl\n }\n\n /**\n * @deprecated\n * `page` has been deprecated in favour of `URLPattern`.\n * Read more: https://nextjs.org/docs/messages/middleware-request-page\n */\n public get page() {\n throw new RemovedPageError()\n }\n\n /**\n * @deprecated\n * `ua` has been removed in favour of \\`userAgent\\` function.\n * Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent\n */\n public get ua() {\n throw new RemovedUAError()\n }\n\n public get url() {\n return this[INTERNALS].url\n }\n}\n\nexport interface RequestInit extends globalThis.RequestInit {\n nextConfig?: {\n basePath?: string\n i18n?: I18NConfig | null\n trailingSlash?: boolean\n }\n signal?: AbortSignal\n // see https://github.com/whatwg/fetch/pull/1457\n duplex?: 'half'\n}\n"],"names":["NextURL","toNodeOutgoingHttpHeaders","validateURL","RemovedUAError","RemovedPageError","RequestCookies","INTERNALS","Symbol","NextRequest","Request","constructor","input","init","url","String","process","env","NEXT_RUNTIME","body","duplex","nextUrl","headers","nextConfig","cookies","__NEXT_NO_MIDDLEWARE_URL_NORMALIZE","toString","for","bodyUsed","cache","credentials","destination","Object","fromEntries","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy","signal","page","ua"],"mappings":"AACA,SAASA,OAAO,QAAQ,cAAa;AACrC,SAASC,yBAAyB,EAAEC,WAAW,QAAQ,WAAU;AACjE,SAASC,cAAc,EAAEC,gBAAgB,QAAQ,WAAU;AAC3D,SAASC,cAAc,QAAQ,YAAW;AAE1C,OAAO,MAAMC,YAAYC,OAAO,oBAAmB;AAEnD;;;;CAIC,GACD,OAAO,MAAMC,oBAAoBC;IAQ/BC,YAAYC,KAAwB,EAAEC,OAAoB,CAAC,CAAC,CAAE;QAC5D,MAAMC,MACJ,OAAOF,UAAU,YAAY,SAASA,QAAQA,MAAME,GAAG,GAAGC,OAAOH;QAEnET,YAAYW;QAEZ,2DAA2D;QAC3D,oDAAoD;QACpD,sDAAsD;QACtD,oCAAoC;QACpC,IAAIE,QAAQC,GAAG,CAACC,YAAY,KAAK,QAAQ;YACvC,IAAIL,KAAKM,IAAI,IAAIN,KAAKO,MAAM,KAAK,QAAQ;gBACvCP,KAAKO,MAAM,GAAG;YAChB;QACF;QAEA,IAAIR,iBAAiBF,SAAS,KAAK,CAACE,OAAOC;aACtC,KAAK,CAACC,KAAKD;QAEhB,MAAMQ,UAAU,IAAIpB,QAAQa,KAAK;YAC/BQ,SAASpB,0BAA0B,IAAI,CAACoB,OAAO;YAC/CC,YAAYV,KAAKU,UAAU;QAC7B;QACA,IAAI,CAAChB,UAAU,GAAG;YAChBiB,SAAS,IAAIlB,eAAe,IAAI,CAACgB,OAAO;YACxCD;YACAP,KAAKE,QAAQC,GAAG,CAACQ,kCAAkC,GAC/CX,MACAO,QAAQK,QAAQ;QACtB;IACF;IAEA,CAAClB,OAAOmB,GAAG,CAAC,+BAA+B,GAAG;QAC5C,OAAO;YACLH,SAAS,IAAI,CAACA,OAAO;YACrBH,SAAS,IAAI,CAACA,OAAO;YACrBP,KAAK,IAAI,CAACA,GAAG;YACb,kCAAkC;YAClCc,UAAU,IAAI,CAACA,QAAQ;YACvBC,OAAO,IAAI,CAACA,KAAK;YACjBC,aAAa,IAAI,CAACA,WAAW;YAC7BC,aAAa,IAAI,CAACA,WAAW;YAC7BT,SAASU,OAAOC,WAAW,CAAC,IAAI,CAACX,OAAO;YACxCY,WAAW,IAAI,CAACA,SAAS;YACzBC,WAAW,IAAI,CAACA,SAAS;YACzBC,QAAQ,IAAI,CAACA,MAAM;YACnBC,MAAM,IAAI,CAACA,IAAI;YACfC,UAAU,IAAI,CAACA,QAAQ;YACvBC,UAAU,IAAI,CAACA,QAAQ;YACvBC,gBAAgB,IAAI,CAACA,cAAc;YACnCC,QAAQ,IAAI,CAACA,MAAM;QACrB;IACF;IAEA,IAAWjB,UAAU;QACnB,OAAO,IAAI,CAACjB,UAAU,CAACiB,OAAO;IAChC;IAEA,IAAWH,UAAU;QACnB,OAAO,IAAI,CAACd,UAAU,CAACc,OAAO;IAChC;IAEA;;;;GAIC,GACD,IAAWqB,OAAO;QAChB,MAAM,IAAIrC;IACZ;IAEA;;;;GAIC,GACD,IAAWsC,KAAK;QACd,MAAM,IAAIvC;IACZ;IAEA,IAAWU,MAAM;QACf,OAAO,IAAI,CAACP,UAAU,CAACO,GAAG;IAC5B;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/response.js b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/response.js new file mode 100644 index 0000000000000000000000000000000000000000..aa2d9b38ae2aafc2daf52bbb7e263b32bb50bde4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/response.js @@ -0,0 +1,122 @@ +import { stringifyCookie } from '../../web/spec-extension/cookies'; +import { NextURL } from '../next-url'; +import { toNodeOutgoingHttpHeaders, validateURL } from '../utils'; +import { ReflectAdapter } from './adapters/reflect'; +import { ResponseCookies } from './cookies'; +const INTERNALS = Symbol('internal response'); +const REDIRECTS = new Set([ + 301, + 302, + 303, + 307, + 308 +]); +function handleMiddlewareField(init, headers) { + var _init_request; + if (init == null ? void 0 : (_init_request = init.request) == null ? void 0 : _init_request.headers) { + if (!(init.request.headers instanceof Headers)) { + throw new Error('request.headers must be an instance of Headers'); + } + const keys = []; + for (const [key, value] of init.request.headers){ + headers.set('x-middleware-request-' + key, value); + keys.push(key); + } + headers.set('x-middleware-override-headers', keys.join(',')); + } +} +/** + * This class extends the [Web `Response` API](https://developer.mozilla.org/docs/Web/API/Response) with additional convenience methods. + * + * Read more: [Next.js Docs: `NextResponse`](https://nextjs.org/docs/app/api-reference/functions/next-response) + */ export class NextResponse extends Response { + constructor(body, init = {}){ + super(body, init); + const headers = this.headers; + const cookies = new ResponseCookies(headers); + const cookiesProxy = new Proxy(cookies, { + get (target, prop, receiver) { + switch(prop){ + case 'delete': + case 'set': + { + return (...args)=>{ + const result = Reflect.apply(target[prop], target, args); + const newHeaders = new Headers(headers); + if (result instanceof ResponseCookies) { + headers.set('x-middleware-set-cookie', result.getAll().map((cookie)=>stringifyCookie(cookie)).join(',')); + } + handleMiddlewareField(init, newHeaders); + return result; + }; + } + default: + return ReflectAdapter.get(target, prop, receiver); + } + } + }); + this[INTERNALS] = { + cookies: cookiesProxy, + url: init.url ? new NextURL(init.url, { + headers: toNodeOutgoingHttpHeaders(headers), + nextConfig: init.nextConfig + }) : undefined + }; + } + [Symbol.for('edge-runtime.inspect.custom')]() { + return { + cookies: this.cookies, + url: this.url, + // rest of props come from Response + body: this.body, + bodyUsed: this.bodyUsed, + headers: Object.fromEntries(this.headers), + ok: this.ok, + redirected: this.redirected, + status: this.status, + statusText: this.statusText, + type: this.type + }; + } + get cookies() { + return this[INTERNALS].cookies; + } + static json(body, init) { + const response = Response.json(body, init); + return new NextResponse(response.body, response); + } + static redirect(url, init) { + const status = typeof init === 'number' ? init : (init == null ? void 0 : init.status) ?? 307; + if (!REDIRECTS.has(status)) { + throw new RangeError('Failed to execute "redirect" on "response": Invalid status code'); + } + const initObj = typeof init === 'object' ? init : {}; + const headers = new Headers(initObj == null ? void 0 : initObj.headers); + headers.set('Location', validateURL(url)); + return new NextResponse(null, { + ...initObj, + headers, + status + }); + } + static rewrite(destination, init) { + const headers = new Headers(init == null ? void 0 : init.headers); + headers.set('x-middleware-rewrite', validateURL(destination)); + handleMiddlewareField(init, headers); + return new NextResponse(null, { + ...init, + headers + }); + } + static next(init) { + const headers = new Headers(init == null ? void 0 : init.headers); + headers.set('x-middleware-next', '1'); + handleMiddlewareField(init, headers); + return new NextResponse(null, { + ...init, + headers + }); + } +} + +//# sourceMappingURL=response.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/response.js.map b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/response.js.map new file mode 100644 index 0000000000000000000000000000000000000000..311251c0df41af0d691da79d8639c5286f232ff3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/response.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/web/spec-extension/response.ts"],"sourcesContent":["import { stringifyCookie } from '../../web/spec-extension/cookies'\nimport type { I18NConfig } from '../../config-shared'\nimport { NextURL } from '../next-url'\nimport { toNodeOutgoingHttpHeaders, validateURL } from '../utils'\nimport { ReflectAdapter } from './adapters/reflect'\n\nimport { ResponseCookies } from './cookies'\n\nconst INTERNALS = Symbol('internal response')\nconst REDIRECTS = new Set([301, 302, 303, 307, 308])\n\nfunction handleMiddlewareField(\n init: MiddlewareResponseInit | undefined,\n headers: Headers\n) {\n if (init?.request?.headers) {\n if (!(init.request.headers instanceof Headers)) {\n throw new Error('request.headers must be an instance of Headers')\n }\n\n const keys = []\n for (const [key, value] of init.request.headers) {\n headers.set('x-middleware-request-' + key, value)\n keys.push(key)\n }\n\n headers.set('x-middleware-override-headers', keys.join(','))\n }\n}\n\n/**\n * This class extends the [Web `Response` API](https://developer.mozilla.org/docs/Web/API/Response) with additional convenience methods.\n *\n * Read more: [Next.js Docs: `NextResponse`](https://nextjs.org/docs/app/api-reference/functions/next-response)\n */\nexport class NextResponse extends Response {\n [INTERNALS]: {\n cookies: ResponseCookies\n url?: NextURL\n body?: Body\n }\n\n constructor(body?: BodyInit | null, init: ResponseInit = {}) {\n super(body, init)\n\n const headers = this.headers\n const cookies = new ResponseCookies(headers)\n\n const cookiesProxy = new Proxy(cookies, {\n get(target, prop, receiver) {\n switch (prop) {\n case 'delete':\n case 'set': {\n return (...args: [string, string]) => {\n const result = Reflect.apply(target[prop], target, args)\n const newHeaders = new Headers(headers)\n\n if (result instanceof ResponseCookies) {\n headers.set(\n 'x-middleware-set-cookie',\n result\n .getAll()\n .map((cookie) => stringifyCookie(cookie))\n .join(',')\n )\n }\n\n handleMiddlewareField(init, newHeaders)\n return result\n }\n }\n default:\n return ReflectAdapter.get(target, prop, receiver)\n }\n },\n })\n\n this[INTERNALS] = {\n cookies: cookiesProxy,\n url: init.url\n ? new NextURL(init.url, {\n headers: toNodeOutgoingHttpHeaders(headers),\n nextConfig: init.nextConfig,\n })\n : undefined,\n }\n }\n\n [Symbol.for('edge-runtime.inspect.custom')]() {\n return {\n cookies: this.cookies,\n url: this.url,\n // rest of props come from Response\n body: this.body,\n bodyUsed: this.bodyUsed,\n headers: Object.fromEntries(this.headers),\n ok: this.ok,\n redirected: this.redirected,\n status: this.status,\n statusText: this.statusText,\n type: this.type,\n }\n }\n\n public get cookies() {\n return this[INTERNALS].cookies\n }\n\n static json(\n body: JsonBody,\n init?: ResponseInit\n ): NextResponse {\n const response: Response = Response.json(body, init)\n return new NextResponse(response.body, response)\n }\n\n static redirect(url: string | NextURL | URL, init?: number | ResponseInit) {\n const status = typeof init === 'number' ? init : (init?.status ?? 307)\n if (!REDIRECTS.has(status)) {\n throw new RangeError(\n 'Failed to execute \"redirect\" on \"response\": Invalid status code'\n )\n }\n const initObj = typeof init === 'object' ? init : {}\n const headers = new Headers(initObj?.headers)\n headers.set('Location', validateURL(url))\n\n return new NextResponse(null, {\n ...initObj,\n headers,\n status,\n })\n }\n\n static rewrite(\n destination: string | NextURL | URL,\n init?: MiddlewareResponseInit\n ) {\n const headers = new Headers(init?.headers)\n headers.set('x-middleware-rewrite', validateURL(destination))\n\n handleMiddlewareField(init, headers)\n return new NextResponse(null, { ...init, headers })\n }\n\n static next(init?: MiddlewareResponseInit) {\n const headers = new Headers(init?.headers)\n headers.set('x-middleware-next', '1')\n\n handleMiddlewareField(init, headers)\n return new NextResponse(null, { ...init, headers })\n }\n}\n\ninterface ResponseInit extends globalThis.ResponseInit {\n nextConfig?: {\n basePath?: string\n i18n?: I18NConfig\n trailingSlash?: boolean\n }\n url?: string\n}\n\ninterface ModifiedRequest {\n /**\n * If this is set, the request headers will be overridden with this value.\n */\n headers?: Headers\n}\n\ninterface MiddlewareResponseInit extends globalThis.ResponseInit {\n /**\n * These fields will override the request from clients.\n */\n request?: ModifiedRequest\n}\n"],"names":["stringifyCookie","NextURL","toNodeOutgoingHttpHeaders","validateURL","ReflectAdapter","ResponseCookies","INTERNALS","Symbol","REDIRECTS","Set","handleMiddlewareField","init","headers","request","Headers","Error","keys","key","value","set","push","join","NextResponse","Response","constructor","body","cookies","cookiesProxy","Proxy","get","target","prop","receiver","args","result","Reflect","apply","newHeaders","getAll","map","cookie","url","nextConfig","undefined","for","bodyUsed","Object","fromEntries","ok","redirected","status","statusText","type","json","response","redirect","has","RangeError","initObj","rewrite","destination","next"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mCAAkC;AAElE,SAASC,OAAO,QAAQ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;YAC1B,MAAM,IAAIO,WACR;QAEJ;QACA,MAAMC,UAAU,OAAO/C,SAAS,WAAWA,OAAO,CAAC;QACnD,MAAMC,UAAU,IAAIE,QAAQ4C,2BAAAA,QAAS9C,OAAO;QAC5CA,QAAQO,GAAG,CAAC,YAAYhB,YAAYsC;QAEpC,OAAO,IAAInB,aAAa,MAAM;YAC5B,GAAGoC,OAAO;YACV9C;YACAsC;QACF;IACF;IAEA,OAAOS,QACLC,WAAmC,EACnCjD,IAA6B,EAC7B;QACA,MAAMC,UAAU,IAAIE,QAAQH,wBAAAA,KAAMC,OAAO;QACzCA,QAAQO,GAAG,CAAC,wBAAwBhB,YAAYyD;QAEhDlD,sBAAsBC,MAAMC;QAC5B,OAAO,IAAIU,aAAa,MAAM;YAAE,GAAGX,IAAI;YAAEC;QAAQ;IACnD;IAEA,OAAOiD,KAAKlD,IAA6B,EAAE;QACzC,MAAMC,UAAU,IAAIE,QAAQH,wBAAAA,KAAMC,OAAO;QACzCA,QAAQO,GAAG,CAAC,qBAAqB;QAEjCT,sBAAsBC,MAAMC;QAC5B,OAAO,IAAIU,aAAa,MAAM;YAAE,GAAGX,IAAI;YAAEC;QAAQ;IACnD;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/revalidate.js b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/revalidate.js new file mode 100644 index 0000000000000000000000000000000000000000..c85b866d38aa84a0816f8d359f26ff0281aaf248 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/revalidate.js @@ -0,0 +1,179 @@ +import { abortAndThrowOnSynchronousRequestDataAccess } from '../../app-render/dynamic-rendering'; +import { isDynamicRoute } from '../../../shared/lib/router/utils'; +import { NEXT_CACHE_IMPLICIT_TAG_ID, NEXT_CACHE_SOFT_TAG_MAX_LENGTH } from '../../../lib/constants'; +import { workAsyncStorage } from '../../app-render/work-async-storage.external'; +import { workUnitAsyncStorage } from '../../app-render/work-unit-async-storage.external'; +import { DynamicServerError } from '../../../client/components/hooks-server-context'; +import { InvariantError } from '../../../shared/lib/invariant-error'; +import { ActionDidRevalidateDynamicOnly, ActionDidRevalidateStaticAndDynamic as ActionDidRevalidate } from '../../../shared/lib/action-revalidation-kind'; +import { removeTrailingSlash } from '../../../shared/lib/router/utils/remove-trailing-slash'; +import { encodeHeaderSafe } from '../../lib/encode-header-safe'; +import { createRevalidateDuringRenderError, createRevalidateInBuildTimeGeneratorError, createRevalidateInCachedFunctionError } from '../../use-cache/use-cache-messages'; +import { validateAndNormalizeCacheLifeProfile } from '../../use-cache/cache-life-profile'; +/** + * This function allows you to purge [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific cache tag. + * + * The second argument specifies a [`cacheLife`](https://nextjs.org/docs/app/api-reference/functions/cacheLife#reference) profile + * (e.g. `"max"`), or a `{ expire }` object. For immediate expiration in Server Actions, use + * [`updateTag`](https://nextjs.org/docs/app/api-reference/functions/updateTag) instead. + * + * Read more: [Next.js Docs: `revalidateTag`](https://nextjs.org/docs/app/api-reference/functions/revalidateTag) + */ export function revalidateTag(tag, profile) { + if (!profile) { + console.warn('"revalidateTag" without the second argument is now deprecated, add second argument of "max" or use "updateTag". See more info here: https://nextjs.org/docs/messages/revalidate-tag-single-arg'); + } else if (typeof profile === 'object') { + profile = validateAndNormalizeCacheLifeProfile(profile, { + kind: 'inline' + }); + } + return revalidate([ + encodeHeaderSafe(tag) + ], `revalidateTag(${JSON.stringify(tag)})`, profile); +} +/** + * This function allows you to update [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific cache tag. + * This can only be called from within a Server Action to enable read-your-own-writes semantics. + * + * Read more: [Next.js Docs: `updateTag`](https://nextjs.org/docs/app/api-reference/functions/updateTag) + */ export function updateTag(tag) { + const workStore = workAsyncStorage.getStore(); + // TODO: change this after investigating why phase: 'action' is + // set for route handlers + if (!workStore || workStore.page.endsWith('/route')) { + throw new Error('updateTag can only be called from within a Server Action. ' + 'To invalidate cache tags in Route Handlers or other contexts, use revalidateTag instead. ' + 'See more info here: https://nextjs.org/docs/app/api-reference/functions/updateTag'); + } + // updateTag uses immediate expiration (no profile) without deprecation warning + return revalidate([ + encodeHeaderSafe(tag) + ], `updateTag(${JSON.stringify(tag)})`, undefined); +} +/** + * This function allows you to refresh client cache from server actions. + * It's useful as dynamic data can be cached on the client which won't + * be refreshed by updateTag + */ export function refresh() { + const workStore = workAsyncStorage.getStore(); + const workUnitStore = workUnitAsyncStorage.getStore(); + if (!workStore || workStore.page.endsWith('/route') || (workUnitStore == null ? void 0 : workUnitStore.phase) !== 'action') { + throw new Error('refresh can only be called from within a Server Action. ' + 'See more info here: https://nextjs.org/docs/app/api-reference/functions/refresh'); + } + if (workStore) { + // The Server Action version of refresh() only revalidates the dynamic data + // on the client. It doesn't affect cached data. + workStore.pathWasRevalidated = ActionDidRevalidateDynamicOnly; + } +} +/** + * This function allows you to purge [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific path. + * + * Read more: [Next.js Docs: `revalidatePath`](https://nextjs.org/docs/app/api-reference/functions/revalidatePath) + */ export function revalidatePath(originalPath, type) { + if (originalPath.length > NEXT_CACHE_SOFT_TAG_MAX_LENGTH) { + console.warn(`Warning: revalidatePath received "${originalPath}" which exceeded max length of ${NEXT_CACHE_SOFT_TAG_MAX_LENGTH}. See more info here https://nextjs.org/docs/app/api-reference/functions/revalidatePath`); + return; + } + let normalizedPath = `${NEXT_CACHE_IMPLICIT_TAG_ID}${encodeHeaderSafe(removeTrailingSlash(originalPath))}`; + if (type) { + normalizedPath += `${normalizedPath.endsWith('/') ? '' : '/'}${type}`; + } else if (isDynamicRoute(originalPath)) { + console.warn(`Warning: a dynamic page path "${originalPath}" was passed to "revalidatePath", but the "type" parameter is missing. This has no effect by default, see more info here https://nextjs.org/docs/app/api-reference/functions/revalidatePath`); + } + const tags = [ + normalizedPath + ]; + if (normalizedPath === `${NEXT_CACHE_IMPLICIT_TAG_ID}/`) { + tags.push(`${NEXT_CACHE_IMPLICIT_TAG_ID}/index`); + } else if (normalizedPath === `${NEXT_CACHE_IMPLICIT_TAG_ID}/index`) { + tags.push(`${NEXT_CACHE_IMPLICIT_TAG_ID}/`); + } + return revalidate(tags, `revalidatePath(${JSON.stringify(originalPath)})`); +} +function revalidate(tags, expression, profile) { + const store = workAsyncStorage.getStore(); + if (!store || !store.incrementalCache) { + throw new Error(`Invariant: static generation store missing in ${expression}`); + } + const workUnitStore = workUnitAsyncStorage.getStore(); + if (workUnitStore) { + // Prefer the more specific contexts over the general render-phase error. + switch(workUnitStore.type){ + case 'build-time-generator': + throw createRevalidateInBuildTimeGeneratorError(store.route, expression, workUnitStore.functionName); + case 'cache': + case 'private-cache': + case 'unstable-cache': + throw createRevalidateInCachedFunctionError(store.route, expression); + case 'prerender': + case 'prerender-runtime': + case 'prerender-client': + case 'validation-client': + case 'prerender-legacy': + case 'request': + break; + default: + workUnitStore; + } + if (workUnitStore.phase === 'render') { + throw createRevalidateDuringRenderError(store.route, expression); + } + switch(workUnitStore.type){ + case 'prerender': + case 'prerender-runtime': + // cacheComponents Prerender + const error = new Error(`Route ${store.route} used ${expression} without first calling \`await connection()\`.`); + return abortAndThrowOnSynchronousRequestDataAccess(store.route, expression, error, workUnitStore); + case 'prerender-client': + case 'validation-client': + throw new InvariantError(`${expression} must not be used within a client component. Next.js should be preventing ${expression} from being included in client components statically, but did not in this case.`); + case 'prerender-legacy': + workUnitStore.revalidate = 0; + const err = new DynamicServerError(`Route ${store.route} couldn't be rendered statically because it used \`${expression}\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`); + store.dynamicUsageDescription = expression; + store.dynamicUsageStack = err.stack; + throw err; + case 'request': + break; + default: + workUnitStore; + } + } + if (!store.pendingRevalidatedTags) { + store.pendingRevalidatedTags = []; + } + const revalidatedAt = performance.timeOrigin + performance.now(); + for (const tag of tags){ + const existingIndex = store.pendingRevalidatedTags.findIndex((item)=>{ + if (item.tag !== tag) return false; + // Compare profiles: both strings, both objects, or both undefined + if (typeof item.profile === 'string' && typeof profile === 'string') { + return item.profile === profile; + } + if (typeof item.profile === 'object' && typeof profile === 'object') { + return JSON.stringify(item.profile) === JSON.stringify(profile); + } + return item.profile === profile; + }); + if (existingIndex === -1) { + store.pendingRevalidatedTags.push({ + tag, + profile, + revalidatedAt + }); + } else { + // Revalidating a tag again invalidates everything produced up to now, so + // the latest revalidation is the one that decides which entries are + // stale. + store.pendingRevalidatedTags[existingIndex].revalidatedAt = revalidatedAt; + } + } + // if profile is provided and this is a stale-while-revalidate + // update we do not mark the path as revalidated so that server + // actions don't pull their own writes + const cacheLife = profile && typeof profile === 'object' ? profile : profile && typeof profile === 'string' && (store == null ? void 0 : store.cacheLifeProfiles[profile]) ? store.cacheLifeProfiles[profile] : undefined; + if (!profile || (cacheLife == null ? void 0 : cacheLife.expire) === 0) { + // TODO: only revalidate if the path matches + store.pathWasRevalidated = ActionDidRevalidate; + } +} + +//# sourceMappingURL=revalidate.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/revalidate.js.map b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/revalidate.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a7c8fd8726340d494aeaa6e6831ace1060de1b53 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/revalidate.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/web/spec-extension/revalidate.ts"],"sourcesContent":["import { abortAndThrowOnSynchronousRequestDataAccess } from '../../app-render/dynamic-rendering'\nimport { isDynamicRoute } from '../../../shared/lib/router/utils'\nimport {\n NEXT_CACHE_IMPLICIT_TAG_ID,\n NEXT_CACHE_SOFT_TAG_MAX_LENGTH,\n} from '../../../lib/constants'\nimport { workAsyncStorage } from '../../app-render/work-async-storage.external'\nimport { workUnitAsyncStorage } from '../../app-render/work-unit-async-storage.external'\nimport { DynamicServerError } from '../../../client/components/hooks-server-context'\nimport { InvariantError } from '../../../shared/lib/invariant-error'\nimport {\n ActionDidRevalidateDynamicOnly,\n ActionDidRevalidateStaticAndDynamic as ActionDidRevalidate,\n} from '../../../shared/lib/action-revalidation-kind'\nimport { removeTrailingSlash } from '../../../shared/lib/router/utils/remove-trailing-slash'\nimport { encodeHeaderSafe } from '../../lib/encode-header-safe'\nimport {\n createRevalidateDuringRenderError,\n createRevalidateInBuildTimeGeneratorError,\n createRevalidateInCachedFunctionError,\n} from '../../use-cache/use-cache-messages'\nimport { validateAndNormalizeCacheLifeProfile } from '../../use-cache/cache-life-profile'\n\ntype CacheLifeConfig = {\n expire?: number\n}\n\n/**\n * This function allows you to purge [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific cache tag.\n *\n * The second argument specifies a [`cacheLife`](https://nextjs.org/docs/app/api-reference/functions/cacheLife#reference) profile\n * (e.g. `\"max\"`), or a `{ expire }` object. For immediate expiration in Server Actions, use\n * [`updateTag`](https://nextjs.org/docs/app/api-reference/functions/updateTag) instead.\n *\n * Read more: [Next.js Docs: `revalidateTag`](https://nextjs.org/docs/app/api-reference/functions/revalidateTag)\n */\nexport function revalidateTag(tag: string, profile: string | CacheLifeConfig) {\n if (!profile) {\n console.warn(\n '\"revalidateTag\" without the second argument is now deprecated, add second argument of \"max\" or use \"updateTag\". See more info here: https://nextjs.org/docs/messages/revalidate-tag-single-arg'\n )\n } else if (typeof profile === 'object') {\n profile = validateAndNormalizeCacheLifeProfile(profile, { kind: 'inline' })\n }\n return revalidate(\n [encodeHeaderSafe(tag)],\n `revalidateTag(${JSON.stringify(tag)})`,\n profile\n )\n}\n\n/**\n * This function allows you to update [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific cache tag.\n * This can only be called from within a Server Action to enable read-your-own-writes semantics.\n *\n * Read more: [Next.js Docs: `updateTag`](https://nextjs.org/docs/app/api-reference/functions/updateTag)\n */\nexport function updateTag(tag: string) {\n const workStore = workAsyncStorage.getStore()\n\n // TODO: change this after investigating why phase: 'action' is\n // set for route handlers\n if (!workStore || workStore.page.endsWith('/route')) {\n throw new Error(\n 'updateTag can only be called from within a Server Action. ' +\n 'To invalidate cache tags in Route Handlers or other contexts, use revalidateTag instead. ' +\n 'See more info here: https://nextjs.org/docs/app/api-reference/functions/updateTag'\n )\n }\n // updateTag uses immediate expiration (no profile) without deprecation warning\n return revalidate(\n [encodeHeaderSafe(tag)],\n `updateTag(${JSON.stringify(tag)})`,\n undefined\n )\n}\n\n/**\n * This function allows you to refresh client cache from server actions.\n * It's useful as dynamic data can be cached on the client which won't\n * be refreshed by updateTag\n */\nexport function refresh() {\n const workStore = workAsyncStorage.getStore()\n const workUnitStore = workUnitAsyncStorage.getStore()\n\n if (\n !workStore ||\n workStore.page.endsWith('/route') ||\n workUnitStore?.phase !== 'action'\n ) {\n throw new Error(\n 'refresh can only be called from within a Server Action. ' +\n 'See more info here: https://nextjs.org/docs/app/api-reference/functions/refresh'\n )\n }\n\n if (workStore) {\n // The Server Action version of refresh() only revalidates the dynamic data\n // on the client. It doesn't affect cached data.\n workStore.pathWasRevalidated = ActionDidRevalidateDynamicOnly\n }\n}\n\n/**\n * This function allows you to purge [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific path.\n *\n * Read more: [Next.js Docs: `revalidatePath`](https://nextjs.org/docs/app/api-reference/functions/revalidatePath)\n */\nexport function revalidatePath(originalPath: string, type?: 'layout' | 'page') {\n if (originalPath.length > NEXT_CACHE_SOFT_TAG_MAX_LENGTH) {\n console.warn(\n `Warning: revalidatePath received \"${originalPath}\" which exceeded max length of ${NEXT_CACHE_SOFT_TAG_MAX_LENGTH}. See more info here https://nextjs.org/docs/app/api-reference/functions/revalidatePath`\n )\n return\n }\n\n let normalizedPath = `${NEXT_CACHE_IMPLICIT_TAG_ID}${encodeHeaderSafe(removeTrailingSlash(originalPath))}`\n\n if (type) {\n normalizedPath += `${normalizedPath.endsWith('/') ? '' : '/'}${type}`\n } else if (isDynamicRoute(originalPath)) {\n console.warn(\n `Warning: a dynamic page path \"${originalPath}\" was passed to \"revalidatePath\", but the \"type\" parameter is missing. This has no effect by default, see more info here https://nextjs.org/docs/app/api-reference/functions/revalidatePath`\n )\n }\n\n const tags = [normalizedPath]\n if (normalizedPath === `${NEXT_CACHE_IMPLICIT_TAG_ID}/`) {\n tags.push(`${NEXT_CACHE_IMPLICIT_TAG_ID}/index`)\n } else if (normalizedPath === `${NEXT_CACHE_IMPLICIT_TAG_ID}/index`) {\n tags.push(`${NEXT_CACHE_IMPLICIT_TAG_ID}/`)\n }\n\n return revalidate(tags, `revalidatePath(${JSON.stringify(originalPath)})`)\n}\n\nfunction revalidate(\n tags: string[],\n expression: string,\n profile?: string | CacheLifeConfig\n) {\n const store = workAsyncStorage.getStore()\n if (!store || !store.incrementalCache) {\n throw new Error(\n `Invariant: static generation store missing in ${expression}`\n )\n }\n\n const workUnitStore = workUnitAsyncStorage.getStore()\n if (workUnitStore) {\n // Prefer the more specific contexts over the general render-phase error.\n switch (workUnitStore.type) {\n case 'build-time-generator':\n throw createRevalidateInBuildTimeGeneratorError(\n store.route,\n expression,\n workUnitStore.functionName\n )\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n throw createRevalidateInCachedFunctionError(store.route, expression)\n case 'prerender':\n case 'prerender-runtime':\n case 'prerender-client':\n case 'validation-client':\n case 'prerender-legacy':\n case 'request':\n break\n default:\n workUnitStore satisfies never\n }\n\n if (workUnitStore.phase === 'render') {\n throw createRevalidateDuringRenderError(store.route, expression)\n }\n\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-runtime':\n // cacheComponents Prerender\n const error = new Error(\n `Route ${store.route} used ${expression} without first calling \\`await connection()\\`.`\n )\n return abortAndThrowOnSynchronousRequestDataAccess(\n store.route,\n expression,\n error,\n workUnitStore\n )\n case 'prerender-client':\n case 'validation-client':\n throw new InvariantError(\n `${expression} must not be used within a client component. Next.js should be preventing ${expression} from being included in client components statically, but did not in this case.`\n )\n case 'prerender-legacy':\n workUnitStore.revalidate = 0\n\n const err = new DynamicServerError(\n `Route ${store.route} couldn't be rendered statically because it used \\`${expression}\\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`\n )\n store.dynamicUsageDescription = expression\n store.dynamicUsageStack = err.stack\n\n throw err\n case 'request':\n // TODO(restart-on-cache-miss): we should do a sync IO error here in dev\n // to match prerender behavior\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n if (!store.pendingRevalidatedTags) {\n store.pendingRevalidatedTags = []\n }\n\n const revalidatedAt = performance.timeOrigin + performance.now()\n\n for (const tag of tags) {\n const existingIndex = store.pendingRevalidatedTags.findIndex((item) => {\n if (item.tag !== tag) return false\n // Compare profiles: both strings, both objects, or both undefined\n if (typeof item.profile === 'string' && typeof profile === 'string') {\n return item.profile === profile\n }\n if (typeof item.profile === 'object' && typeof profile === 'object') {\n return JSON.stringify(item.profile) === JSON.stringify(profile)\n }\n return item.profile === profile\n })\n if (existingIndex === -1) {\n store.pendingRevalidatedTags.push({\n tag,\n profile,\n revalidatedAt,\n })\n } else {\n // Revalidating a tag again invalidates everything produced up to now, so\n // the latest revalidation is the one that decides which entries are\n // stale.\n store.pendingRevalidatedTags[existingIndex].revalidatedAt = revalidatedAt\n }\n }\n\n // if profile is provided and this is a stale-while-revalidate\n // update we do not mark the path as revalidated so that server\n // actions don't pull their own writes\n const cacheLife =\n profile && typeof profile === 'object'\n ? profile\n : profile &&\n typeof profile === 'string' &&\n store?.cacheLifeProfiles[profile]\n ? store.cacheLifeProfiles[profile]\n : undefined\n\n if (!profile || cacheLife?.expire === 0) {\n // TODO: only revalidate if the path matches\n store.pathWasRevalidated = ActionDidRevalidate\n }\n}\n"],"names":["abortAndThrowOnSynchronousRequestDataAccess","isDynamicRoute","NEXT_CACHE_IMPLICIT_TAG_ID","NEXT_CACHE_SOFT_TAG_MAX_LENGTH","workAsyncStorage","workUnitAsyncStorage","DynamicServerError","InvariantError","ActionDidRevalidateDynamicOnly","ActionDidRevalidateStaticAndDynamic","ActionDidRevalidate","removeTrailingSlash","encodeHeaderSafe","createRevalidateDuringRenderError","createRevalidateInBuildTimeGeneratorError","createRevalidateInCachedFunctionError","validateAndNormalizeCacheLifeProfile","revalidateTag","tag","profile","console","warn","kind","revalidate","JSON","stringify","updateTag","workStore","getStore","page","endsWith","Error","undefined","refresh","workUnitStore","phase","pathWasRevalidated","revalidatePath","originalPath","type","length","normalizedPath","tags","push","expression","store","incrementalCache","route","functionName","error","err","dynamicUsageDescription","dynamicUsageStack","stack","pendingRevalidatedTags","revalidatedAt","performance","timeOrigin","now","existingIndex","findIndex","item","cacheLife","cacheLifeProfiles","expire"],"mappings":"AAAA,SAASA,2CAA2C,QAAQ,qCAAoC;AAChG,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SACEC,0BAA0B,EAC1BC,8BAA8B,QACzB,yBAAwB;AAC/B,SAASC,gBAAgB,QAAQ,+CAA8C;AAC/E,SAASC,oBAAoB,QAAQ,oDAAmD;AACxF,SAASC,kBAAkB,QAAQ,kDAAiD;AACpF,SAASC,cAAc,QAAQ,sCAAqC;AACpE,SACEC,8BAA8B,EAC9BC,uCAAuCC,mBAAmB,QACrD,+CAA8C;AACrD,SAASC,mBAAmB,QAAQ,yDAAwD;AAC5F,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SACEC,iCAAiC,EACjCC,yCAAyC,EACzCC,qCAAqC,QAChC,qCAAoC;AAC3C,SAASC,oCAAoC,QAAQ,qCAAoC;AAMzF;;;;;;;;CAQC,GACD,OAAO,SAASC,cAAcC,GAAW,EAAEC,OAAiC;IAC1E,IAAI,CAACA,SAAS;QACZC,QAAQC,IAAI,CACV;IAEJ,OAAO,IAAI,OAAOF,YAAY,UAAU;QACtCA,UAAUH,qCAAqCG,SAAS;YAAEG,MAAM;QAAS;IAC3E;IACA,OAAOC,WACL;QAACX,iBAAiBM;KAAK,EACvB,CAAC,cAAc,EAAEM,KAAKC,SAAS,CAACP,KAAK,CAAC,CAAC,EACvCC;AAEJ;AAEA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AOA,YAAY,WAC1BA,UACAA,WACE,OAAOA,YAAY,aACnB0B,yBAAAA,MAAOkB,iBAAiB,CAAC5C,QAAQ,IACjC0B,MAAMkB,iBAAiB,CAAC5C,QAAQ,GAChCa;IAER,IAAI,CAACb,WAAW2C,CAAAA,6BAAAA,UAAWE,MAAM,MAAK,GAAG;QACvC,4CAA4C;QAC5CnB,MAAMT,kBAAkB,GAAG1B;IAC7B;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/unstable-cache.js b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/unstable-cache.js new file mode 100644 index 0000000000000000000000000000000000000000..8401e64a5cc4fea8876f0c63076f358876fb9594 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/unstable-cache.js @@ -0,0 +1,293 @@ +import { CACHE_ONE_YEAR_SECONDS } from '../../../lib/constants'; +import { validateRevalidate, validateTags } from '../../lib/patch-fetch'; +import { encodeHeaderSafe } from '../../lib/encode-header-safe'; +import { workAsyncStorage } from '../../app-render/work-async-storage.external'; +import { getCacheSignal, getDraftModeProviderForCacheScope, willConsumerServerCache, workUnitAsyncStorage } from '../../app-render/work-unit-async-storage.external'; +import { CachedRouteKind, IncrementalCacheKind } from '../../response-cache'; +let noStoreFetchIdx = 0; +async function cacheNewResult(result, incrementalCache, cacheKey, tags, revalidate, fetchIdx, fetchUrl) { + await incrementalCache.set(cacheKey, { + kind: CachedRouteKind.FETCH, + data: { + headers: {}, + // TODO: handle non-JSON values? + body: JSON.stringify(result), + status: 200, + url: '' + }, + revalidate: typeof revalidate !== 'number' ? CACHE_ONE_YEAR_SECONDS : revalidate + }, { + fetchCache: true, + tags, + fetchIdx, + fetchUrl + }); + return; +} +/** + * This function allows you to cache the results of expensive operations, like database queries, and reuse them across multiple requests. + * + * Read more: [Next.js Docs: `unstable_cache`](https://nextjs.org/docs/app/api-reference/functions/unstable_cache) + */ export function unstable_cache(cb, keyParts, options = {}) { + if (options.revalidate === 0) { + throw new Error(`Invariant revalidate: 0 can not be passed to unstable_cache(), must be "false" or "> 0" ${cb.toString()}`); + } + // Validate the tags provided are valid + const tags = options.tags ? validateTags(options.tags, `unstable_cache ${cb.toString()}`) : []; + // Validate the revalidate option, and adopt the normalized value, which + // maps `false` and `Infinity` to INFINITE_CACHE so that the stored value + // survives JSON serialization. + const revalidate = validateRevalidate(options.revalidate, `unstable_cache ${cb.name || cb.toString()}`); + // Stash the fixed part of the key at construction time. The invocation key will combine + // the fixed key with the arguments when actually called + // @TODO if cb.toString() is long we should hash it + // @TODO come up with a collision-free way to combine keyParts + // @TODO consider validating the keyParts are all strings. TS can't provide runtime guarantees + // and the error produced by accidentally using something that cannot be safely coerced is likely + // hard to debug + const fixedKey = `${cb.toString()}-${Array.isArray(keyParts) && keyParts.join(',')}`; + const cachedCb = async (...args)=>{ + const workStore = workAsyncStorage.getStore(); + const workUnitStore = workUnitAsyncStorage.getStore(); + // We must be able to find the incremental cache otherwise we throw + const maybeIncrementalCache = (workStore == null ? void 0 : workStore.incrementalCache) || globalThis.__incrementalCache; + if (!maybeIncrementalCache) { + throw new Error(`Invariant: incrementalCache missing in unstable_cache ${cb.toString()}`); + } + const incrementalCache = maybeIncrementalCache; + const cacheSignal = workUnitStore ? getCacheSignal(workUnitStore) : null; + if (cacheSignal) { + cacheSignal.beginRead(); + } + try { + // If there's no request store, we aren't in a request (or we're not in + // app router) and if there's no static generation store, we aren't in app + // router. Default to an empty pathname and search params when there's no + // request store or static generation store available. + const fetchUrlPrefix = workStore && workUnitStore ? getFetchUrlPrefix(workStore, workUnitStore) : ''; + // Construct the complete cache key for this function invocation + // @TODO stringify is likely not safe here. We will coerce undefined to null which will make + // the keyspace smaller than the execution space + const invocationKey = `${fixedKey}-${JSON.stringify(args)}`; + const cacheKey = await incrementalCache.generateSimpleCacheKey(invocationKey); + // $urlWithPath,$sortedQueryStringKeys,$hashOfEveryThingElse + // + // A cache implementation may serialize this name into an HTTP request + // header, so it is encoded here. Both parts can carry a character above + // U+00FF: the search parameters are decoded, and a JavaScript identifier + // may hold one. The character class leaves the separating spaces and the + // URL punctuation untouched, so the shape above is preserved. + // + // `toWellFormed` replaces lone surrogates, which `cb.name` can hold and + // which `encodeURIComponent` rejects. The name identifies the call for + // debug metrics, so a replacement character is an acceptable trade for + // not failing the render. + const fetchUrl = encodeHeaderSafe(`unstable_cache ${fetchUrlPrefix} ${cb.name ? ` ${cb.name}` : cacheKey}`.toWellFormed()); + const fetchIdx = (workStore ? workStore.nextFetchId : noStoreFetchIdx) ?? 1; + const implicitTags = workUnitStore == null ? void 0 : workUnitStore.implicitTags; + const innerCacheStore = { + type: 'unstable-cache', + phase: 'render', + consumerWillServerCache: true, + implicitTags, + draftMode: workUnitStore && workStore && getDraftModeProviderForCacheScope(workStore, workUnitStore), + rootParams: undefined + }; + if (workStore) { + workStore.nextFetchId = fetchIdx + 1; + // We are in an App Router context. We try to return the cached entry if it exists and is valid + // If the entry is fresh we return it. If the entry is stale we return it but revalidate the entry in + // the background. If the entry is missing or invalid we generate a new entry and return it. + let isNestedUnstableCache = false; + if (workUnitStore) { + switch(workUnitStore.type){ + case 'cache': + case 'private-cache': + case 'prerender': + case 'prerender-runtime': + case 'prerender-legacy': + // We update the store's revalidate property if the revalidate option is a higher precedence + // revalidate === undefined doesn't affect timing. + // revalidate === INFINITE_CACHE (from `false` or `Infinity`) doesn't shrink timing. it stays at the maximum. + if (typeof revalidate === 'number') { + if (workUnitStore.revalidate < revalidate) { + // The store is already revalidating on a shorter time interval, leave it alone + } else { + workUnitStore.revalidate = revalidate; + } + } + // We need to accumulate the tags for this invocation within the store + const collectedTags = workUnitStore.tags; + if (collectedTags === null) { + workUnitStore.tags = tags.slice(); + } else { + for (const tag of tags){ + // @TODO refactor tags to be a set to avoid this O(n) lookup + if (!collectedTags.includes(tag)) { + collectedTags.push(tag); + } + } + } + break; + case 'unstable-cache': + isNestedUnstableCache = true; + break; + case 'prerender-client': + case 'validation-client': + case 'request': + case 'build-time-generator': + break; + default: + workUnitStore; + } + } + if (// when we are nested inside of other unstable_cache's + // we should bypass cache similar to fetches + !isNestedUnstableCache && workStore.fetchCache !== 'force-no-store' && !workStore.isOnDemandRevalidate && !incrementalCache.isOnDemandRevalidate && !workStore.isDraftMode) { + // We attempt to get the current cache entry from the incremental cache. + const cacheEntry = await incrementalCache.get(cacheKey, { + kind: IncrementalCacheKind.FETCH, + revalidate, + tags, + softTags: implicitTags == null ? void 0 : implicitTags.tags, + fetchIdx, + fetchUrl + }); + if (cacheEntry && cacheEntry.value) { + // The entry exists and has a value + if (cacheEntry.value.kind !== CachedRouteKind.FETCH) { + // The entry is invalid and we need a special warning + // @TODO why do we warn this way? Should this just be an error? How are these errors surfaced + // so bugs can be reported + // @TODO the invocation key can have sensitive data in it. we should not log this entire object + console.error(`Invariant invalid cacheEntry returned for ${invocationKey}`); + // will fall through to generating a new cache entry below + } else { + // We have a valid cache entry so we will be returning it. We also check to see if we need + // to background revalidate it by checking if it is stale. + const cachedResponse = cacheEntry.value.data.body !== undefined ? JSON.parse(cacheEntry.value.data.body) : undefined; + if (cacheEntry.isStale) { + if (!workStore.pendingRevalidates) { + workStore.pendingRevalidates = {}; + } + // Check if there's already a pending revalidation to avoid duplicate work + if (!workStore.pendingRevalidates[invocationKey]) { + // Create the revalidation promise + const revalidationPromise = workUnitAsyncStorage.run(innerCacheStore, cb, ...args).then(async (result)=>{ + await cacheNewResult(result, incrementalCache, cacheKey, tags, revalidate, fetchIdx, fetchUrl); + return result; + }).catch((err)=>{ + // @TODO This error handling seems wrong. We swallow the error? + console.error(`revalidating cache with key: ${invocationKey}`, err); + // Return the stale value on error for foreground revalidation + return cachedResponse; + }); + // Attach the empty catch here so we don't get a "unhandled promise + // rejection" warning. (Behavior is matched with patch-fetch) + if (willConsumerServerCache(workUnitStore)) { + revalidationPromise.catch(()=>{}); + } + workStore.pendingRevalidates[invocationKey] = revalidationPromise; + } + // Check if we need to do foreground revalidation + if (willConsumerServerCache(workUnitStore)) { + // When the consumer will persist this result in a server + // cache, wait for fresh data so it doesn't persist a stale + // value. The `await` here also keeps `cacheSignal.endRead` (in + // the outer `finally`) suspended until the recompute + + // cacheNewResult actually complete, so a prospective + // prerender's `cacheSignal` doesn't resolve `cacheReady` + // prematurely. + return await workStore.pendingRevalidates[invocationKey]; + } + // Otherwise, we're doing background revalidation - return stale immediately + } + // We had a valid cache entry so we return it here + return cachedResponse; + } + } + } + // If we got this far then we had an invalid cache entry and need to generate a new one + const result = await workUnitAsyncStorage.run(innerCacheStore, cb, ...args); + if (!workStore.isDraftMode) { + if (!workStore.pendingRevalidates) { + workStore.pendingRevalidates = {}; + } + // We need to push the cache result promise to pending + // revalidates otherwise it won't be awaited and is just + // dangling + workStore.pendingRevalidates[invocationKey] = cacheNewResult(result, incrementalCache, cacheKey, tags, revalidate, fetchIdx, fetchUrl); + } + return result; + } else { + noStoreFetchIdx += 1; + // We are in Pages Router or were called outside of a render. We don't have a store + // so we just call the callback directly when it needs to run. + // If the entry is fresh we return it. If the entry is stale we return it but revalidate the entry in + // the background. If the entry is missing or invalid we generate a new entry and return it. + if (!incrementalCache.isOnDemandRevalidate) { + // We aren't doing an on demand revalidation so we check use the cache if valid + const cacheEntry = await incrementalCache.get(cacheKey, { + kind: IncrementalCacheKind.FETCH, + revalidate, + tags, + fetchIdx, + fetchUrl, + softTags: implicitTags == null ? void 0 : implicitTags.tags + }); + if (cacheEntry && cacheEntry.value) { + // The entry exists and has a value + if (cacheEntry.value.kind !== CachedRouteKind.FETCH) { + // The entry is invalid and we need a special warning + // @TODO why do we warn this way? Should this just be an error? How are these errors surfaced + // so bugs can be reported + console.error(`Invariant invalid cacheEntry returned for ${invocationKey}`); + // will fall through to generating a new cache entry below + } else if (!cacheEntry.isStale) { + // We have a valid cache entry and it is fresh so we return it + return cacheEntry.value.data.body !== undefined ? JSON.parse(cacheEntry.value.data.body) : undefined; + } + } + } + // If we got this far then we had an invalid cache entry and need to generate a new one + const result = await workUnitAsyncStorage.run(innerCacheStore, cb, ...args); + // we need to wait setting the new cache result here as + // we don't have pending revalidates on workStore to + // push to and we can't have a dangling promise + await cacheNewResult(result, incrementalCache, cacheKey, tags, revalidate, fetchIdx, fetchUrl); + return result; + } + } finally{ + if (cacheSignal) { + cacheSignal.endRead(); + } + } + }; + // TODO: once AsyncLocalStorage.run() returns the correct types this override will no longer be necessary + return cachedCb; +} +function getFetchUrlPrefix(workStore, workUnitStore) { + switch(workUnitStore.type){ + case 'request': + const pathname = workUnitStore.url.pathname; + const searchParams = new URLSearchParams(workUnitStore.url.search); + const sortedSearch = [ + ...searchParams.keys() + ].sort((a, b)=>a.localeCompare(b)).map((key)=>`${key}=${searchParams.get(key)}`).join('&'); + return `${pathname}${sortedSearch.length ? '?' : ''}${sortedSearch}`; + case 'prerender': + case 'prerender-client': + case 'validation-client': + case 'prerender-runtime': + case 'prerender-legacy': + case 'cache': + case 'private-cache': + case 'unstable-cache': + case 'build-time-generator': + return workStore.route; + default: + return workUnitStore; + } +} + +//# sourceMappingURL=unstable-cache.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/unstable-cache.js.map b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/unstable-cache.js.map new file mode 100644 index 0000000000000000000000000000000000000000..4f151bf97278c4384487a28e427ca5cc17a2fb29 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/unstable-cache.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/web/spec-extension/unstable-cache.ts"],"sourcesContent":["import type { IncrementalCache } from '../../lib/incremental-cache'\n\nimport { CACHE_ONE_YEAR_SECONDS } from '../../../lib/constants'\nimport { validateRevalidate, validateTags } from '../../lib/patch-fetch'\nimport { encodeHeaderSafe } from '../../lib/encode-header-safe'\nimport {\n workAsyncStorage,\n type WorkStore,\n} from '../../app-render/work-async-storage.external'\nimport {\n getCacheSignal,\n getDraftModeProviderForCacheScope,\n willConsumerServerCache,\n workUnitAsyncStorage,\n} from '../../app-render/work-unit-async-storage.external'\nimport {\n CachedRouteKind,\n IncrementalCacheKind,\n type CachedFetchData,\n} from '../../response-cache'\nimport type {\n UnstableCacheStore,\n WorkUnitStore,\n} from '../../app-render/work-unit-async-storage.external'\n\ntype Callback = (...args: any[]) => Promise\n\nlet noStoreFetchIdx = 0\n\nasync function cacheNewResult(\n result: T,\n incrementalCache: IncrementalCache,\n cacheKey: string,\n tags: string[],\n revalidate: number | false | undefined,\n fetchIdx: number,\n fetchUrl: string\n): Promise {\n await incrementalCache.set(\n cacheKey,\n {\n kind: CachedRouteKind.FETCH,\n data: {\n headers: {},\n // TODO: handle non-JSON values?\n body: JSON.stringify(result),\n status: 200,\n url: '',\n } satisfies CachedFetchData,\n revalidate:\n typeof revalidate !== 'number' ? CACHE_ONE_YEAR_SECONDS : revalidate,\n },\n { fetchCache: true, tags, fetchIdx, fetchUrl }\n )\n return\n}\n\n/**\n * This function allows you to cache the results of expensive operations, like database queries, and reuse them across multiple requests.\n *\n * Read more: [Next.js Docs: `unstable_cache`](https://nextjs.org/docs/app/api-reference/functions/unstable_cache)\n */\nexport function unstable_cache(\n cb: T,\n keyParts?: string[],\n options: {\n /**\n * The revalidation interval in seconds.\n */\n revalidate?: number | false\n tags?: string[]\n } = {}\n): T {\n if (options.revalidate === 0) {\n throw new Error(\n `Invariant revalidate: 0 can not be passed to unstable_cache(), must be \"false\" or \"> 0\" ${cb.toString()}`\n )\n }\n\n // Validate the tags provided are valid\n const tags = options.tags\n ? validateTags(options.tags, `unstable_cache ${cb.toString()}`)\n : []\n\n // Validate the revalidate option, and adopt the normalized value, which\n // maps `false` and `Infinity` to INFINITE_CACHE so that the stored value\n // survives JSON serialization.\n const revalidate = validateRevalidate(\n options.revalidate,\n `unstable_cache ${cb.name || cb.toString()}`\n )\n\n // Stash the fixed part of the key at construction time. The invocation key will combine\n // the fixed key with the arguments when actually called\n // @TODO if cb.toString() is long we should hash it\n // @TODO come up with a collision-free way to combine keyParts\n // @TODO consider validating the keyParts are all strings. TS can't provide runtime guarantees\n // and the error produced by accidentally using something that cannot be safely coerced is likely\n // hard to debug\n const fixedKey = `${cb.toString()}-${\n Array.isArray(keyParts) && keyParts.join(',')\n }`\n\n const cachedCb = async (...args: any[]) => {\n const workStore = workAsyncStorage.getStore()\n const workUnitStore = workUnitAsyncStorage.getStore()\n\n // We must be able to find the incremental cache otherwise we throw\n const maybeIncrementalCache:\n | import('../../lib/incremental-cache').IncrementalCache\n | undefined =\n workStore?.incrementalCache || (globalThis as any).__incrementalCache\n\n if (!maybeIncrementalCache) {\n throw new Error(\n `Invariant: incrementalCache missing in unstable_cache ${cb.toString()}`\n )\n }\n const incrementalCache = maybeIncrementalCache\n\n const cacheSignal = workUnitStore ? getCacheSignal(workUnitStore) : null\n if (cacheSignal) {\n cacheSignal.beginRead()\n }\n try {\n // If there's no request store, we aren't in a request (or we're not in\n // app router) and if there's no static generation store, we aren't in app\n // router. Default to an empty pathname and search params when there's no\n // request store or static generation store available.\n const fetchUrlPrefix =\n workStore && workUnitStore\n ? getFetchUrlPrefix(workStore, workUnitStore)\n : ''\n\n // Construct the complete cache key for this function invocation\n // @TODO stringify is likely not safe here. We will coerce undefined to null which will make\n // the keyspace smaller than the execution space\n const invocationKey = `${fixedKey}-${JSON.stringify(args)}`\n const cacheKey =\n await incrementalCache.generateSimpleCacheKey(invocationKey)\n // $urlWithPath,$sortedQueryStringKeys,$hashOfEveryThingElse\n //\n // A cache implementation may serialize this name into an HTTP request\n // header, so it is encoded here. Both parts can carry a character above\n // U+00FF: the search parameters are decoded, and a JavaScript identifier\n // may hold one. The character class leaves the separating spaces and the\n // URL punctuation untouched, so the shape above is preserved.\n //\n // `toWellFormed` replaces lone surrogates, which `cb.name` can hold and\n // which `encodeURIComponent` rejects. The name identifies the call for\n // debug metrics, so a replacement character is an acceptable trade for\n // not failing the render.\n const fetchUrl = encodeHeaderSafe(\n `unstable_cache ${fetchUrlPrefix} ${cb.name ? ` ${cb.name}` : cacheKey}`.toWellFormed()\n )\n const fetchIdx =\n (workStore ? workStore.nextFetchId : noStoreFetchIdx) ?? 1\n\n const implicitTags = workUnitStore?.implicitTags\n\n const innerCacheStore: UnstableCacheStore = {\n type: 'unstable-cache',\n phase: 'render',\n consumerWillServerCache: true,\n implicitTags,\n draftMode:\n workUnitStore &&\n workStore &&\n getDraftModeProviderForCacheScope(workStore, workUnitStore),\n rootParams: undefined,\n }\n\n if (workStore) {\n workStore.nextFetchId = fetchIdx + 1\n\n // We are in an App Router context. We try to return the cached entry if it exists and is valid\n // If the entry is fresh we return it. If the entry is stale we return it but revalidate the entry in\n // the background. If the entry is missing or invalid we generate a new entry and return it.\n\n let isNestedUnstableCache = false\n\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'cache':\n case 'private-cache':\n case 'prerender':\n case 'prerender-runtime':\n case 'prerender-legacy':\n // We update the store's revalidate property if the revalidate option is a higher precedence\n // revalidate === undefined doesn't affect timing.\n // revalidate === INFINITE_CACHE (from `false` or `Infinity`) doesn't shrink timing. it stays at the maximum.\n if (typeof revalidate === 'number') {\n if (workUnitStore.revalidate < revalidate) {\n // The store is already revalidating on a shorter time interval, leave it alone\n } else {\n workUnitStore.revalidate = revalidate\n }\n }\n\n // We need to accumulate the tags for this invocation within the store\n const collectedTags = workUnitStore.tags\n if (collectedTags === null) {\n workUnitStore.tags = tags.slice()\n } else {\n for (const tag of tags) {\n // @TODO refactor tags to be a set to avoid this O(n) lookup\n if (!collectedTags.includes(tag)) {\n collectedTags.push(tag)\n }\n }\n }\n break\n case 'unstable-cache':\n isNestedUnstableCache = true\n break\n case 'prerender-client':\n case 'validation-client':\n case 'request':\n case 'build-time-generator':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n if (\n // when we are nested inside of other unstable_cache's\n // we should bypass cache similar to fetches\n !isNestedUnstableCache &&\n workStore.fetchCache !== 'force-no-store' &&\n !workStore.isOnDemandRevalidate &&\n !incrementalCache.isOnDemandRevalidate &&\n !workStore.isDraftMode\n ) {\n // We attempt to get the current cache entry from the incremental cache.\n const cacheEntry = await incrementalCache.get(cacheKey, {\n kind: IncrementalCacheKind.FETCH,\n revalidate,\n tags,\n softTags: implicitTags?.tags,\n fetchIdx,\n fetchUrl,\n })\n\n if (cacheEntry && cacheEntry.value) {\n // The entry exists and has a value\n if (cacheEntry.value.kind !== CachedRouteKind.FETCH) {\n // The entry is invalid and we need a special warning\n // @TODO why do we warn this way? Should this just be an error? How are these errors surfaced\n // so bugs can be reported\n // @TODO the invocation key can have sensitive data in it. we should not log this entire object\n console.error(\n `Invariant invalid cacheEntry returned for ${invocationKey}`\n )\n // will fall through to generating a new cache entry below\n } else {\n // We have a valid cache entry so we will be returning it. We also check to see if we need\n // to background revalidate it by checking if it is stale.\n const cachedResponse =\n cacheEntry.value.data.body !== undefined\n ? JSON.parse(cacheEntry.value.data.body)\n : undefined\n\n if (cacheEntry.isStale) {\n if (!workStore.pendingRevalidates) {\n workStore.pendingRevalidates = {}\n }\n\n // Check if there's already a pending revalidation to avoid duplicate work\n if (!workStore.pendingRevalidates[invocationKey]) {\n // Create the revalidation promise\n const revalidationPromise = workUnitAsyncStorage\n .run(innerCacheStore, cb, ...args)\n .then(async (result) => {\n await cacheNewResult(\n result,\n incrementalCache,\n cacheKey,\n tags,\n revalidate,\n fetchIdx,\n fetchUrl\n )\n return result\n })\n .catch((err) => {\n // @TODO This error handling seems wrong. We swallow the error?\n console.error(\n `revalidating cache with key: ${invocationKey}`,\n err\n )\n // Return the stale value on error for foreground revalidation\n return cachedResponse\n })\n\n // Attach the empty catch here so we don't get a \"unhandled promise\n // rejection\" warning. (Behavior is matched with patch-fetch)\n if (willConsumerServerCache(workUnitStore)) {\n revalidationPromise.catch(() => {})\n }\n\n workStore.pendingRevalidates[invocationKey] =\n revalidationPromise\n }\n\n // Check if we need to do foreground revalidation\n if (willConsumerServerCache(workUnitStore)) {\n // When the consumer will persist this result in a server\n // cache, wait for fresh data so it doesn't persist a stale\n // value. The `await` here also keeps `cacheSignal.endRead` (in\n // the outer `finally`) suspended until the recompute +\n // cacheNewResult actually complete, so a prospective\n // prerender's `cacheSignal` doesn't resolve `cacheReady`\n // prematurely.\n return await workStore.pendingRevalidates[invocationKey]\n }\n // Otherwise, we're doing background revalidation - return stale immediately\n }\n\n // We had a valid cache entry so we return it here\n return cachedResponse\n }\n }\n }\n\n // If we got this far then we had an invalid cache entry and need to generate a new one\n const result = await workUnitAsyncStorage.run(\n innerCacheStore,\n cb,\n ...args\n )\n\n if (!workStore.isDraftMode) {\n if (!workStore.pendingRevalidates) {\n workStore.pendingRevalidates = {}\n }\n\n // We need to push the cache result promise to pending\n // revalidates otherwise it won't be awaited and is just\n // dangling\n workStore.pendingRevalidates[invocationKey] = cacheNewResult(\n result,\n incrementalCache,\n cacheKey,\n tags,\n revalidate,\n fetchIdx,\n fetchUrl\n )\n }\n\n return result\n } else {\n noStoreFetchIdx += 1\n // We are in Pages Router or were called outside of a render. We don't have a store\n // so we just call the callback directly when it needs to run.\n // If the entry is fresh we return it. If the entry is stale we return it but revalidate the entry in\n // the background. If the entry is missing or invalid we generate a new entry and return it.\n\n if (!incrementalCache.isOnDemandRevalidate) {\n // We aren't doing an on demand revalidation so we check use the cache if valid\n const cacheEntry = await incrementalCache.get(cacheKey, {\n kind: IncrementalCacheKind.FETCH,\n revalidate,\n tags,\n fetchIdx,\n fetchUrl,\n softTags: implicitTags?.tags,\n })\n\n if (cacheEntry && cacheEntry.value) {\n // The entry exists and has a value\n if (cacheEntry.value.kind !== CachedRouteKind.FETCH) {\n // The entry is invalid and we need a special warning\n // @TODO why do we warn this way? Should this just be an error? How are these errors surfaced\n // so bugs can be reported\n console.error(\n `Invariant invalid cacheEntry returned for ${invocationKey}`\n )\n // will fall through to generating a new cache entry below\n } else if (!cacheEntry.isStale) {\n // We have a valid cache entry and it is fresh so we return it\n return cacheEntry.value.data.body !== undefined\n ? JSON.parse(cacheEntry.value.data.body)\n : undefined\n }\n }\n }\n\n // If we got this far then we had an invalid cache entry and need to generate a new one\n const result = await workUnitAsyncStorage.run(\n innerCacheStore,\n cb,\n ...args\n )\n\n // we need to wait setting the new cache result here as\n // we don't have pending revalidates on workStore to\n // push to and we can't have a dangling promise\n await cacheNewResult(\n result,\n incrementalCache,\n cacheKey,\n tags,\n revalidate,\n fetchIdx,\n fetchUrl\n )\n return result\n }\n } finally {\n if (cacheSignal) {\n cacheSignal.endRead()\n }\n }\n }\n // TODO: once AsyncLocalStorage.run() returns the correct types this override will no longer be necessary\n return cachedCb as unknown as T\n}\n\nfunction getFetchUrlPrefix(\n workStore: WorkStore,\n workUnitStore: WorkUnitStore\n): string {\n switch (workUnitStore.type) {\n case 'request':\n const pathname = workUnitStore.url.pathname\n const searchParams = new URLSearchParams(workUnitStore.url.search)\n\n const sortedSearch = [...searchParams.keys()]\n .sort((a, b) => a.localeCompare(b))\n .map((key) => `${key}=${searchParams.get(key)}`)\n .join('&')\n\n return `${pathname}${sortedSearch.length ? '?' : ''}${sortedSearch}`\n case 'prerender':\n case 'prerender-client':\n case 'validation-client':\n case 'prerender-runtime':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'build-time-generator':\n return workStore.route\n default:\n return workUnitStore satisfies never\n }\n}\n"],"names":["CACHE_ONE_YEAR_SECONDS","validateRevalidate","validateTags","encodeHeaderSafe","workAsyncStorage","getCacheSignal","getDraftModeProviderForCacheScope","willConsumerServerCache","workUnitAsyncStorage","CachedRouteKind","IncrementalCacheKind","noStoreFetchIdx","cacheNewResult","result","incrementalCache","cacheKey","tags","revalidate","fetchIdx","fetchUrl","set","kind","FETCH","data","headers","body","JSON","stringify","status","url","fetchCache","unstable_cache","cb","keyParts","options","Error","toString","name","fixedKey","Array","isArray","join","cachedCb","args","workStore","getStore","workUnitStore","maybeIncrementalCache","globalThis","__incrementalCache","cacheSignal","beginRead","fetchUrlPrefix","getFetchUrlPrefix","invocationKey","generateSimpleCacheKey","toWellFormed","nextFetchId","implicitTags","innerCacheStore","type","phase","consumerWillServerCache","draftMode","rootParams","undefined","isNestedUnstableCache","collectedTags","slice","tag","includes","push","isOnDemandRevalidate","isDraftMode","cacheEntry","get","softTags","value","console","error","cachedResponse","parse","isStale","pendingRevalidates","revalidationPromise","run","then","catch","err","endRead","pathname","searchParams","URLSearchParams","search","sortedSearch","keys","sort","a","b","localeCompare","map","key","length","route"],"mappings":"AAEA,SAASA,sBAAsB,QAAQ,yBAAwB;AAC/D,SAASC,kBAAkB,EAAEC,YAAY,QAAQ,wBAAuB;AACxE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SACEC,gBAAgB,QAEX,+CAA8C;AACrD,SACEC,cAAc,EACdC,iCAAiC,EACjCC,uBAAuB,EACvBC,oBAAoB,QACf,oDAAmD;AAC1D,SACEC,eAAe,EACfC,oBAAoB,QAEf,uBAAsB;AAQ7B,IAAIC,kBAAkB;AAEtB,eAAeC,eACbC,MAAS,EACTC,gBAAkC,EAClCC,QAAgB,EAChBC,IAAc,EACdC,UAAsC,EACtCC,QAAgB,EAChBC,QAAgB;IAEhB,MAAML,iBAAiBM,GAAG,CACxBL,UACA;QACEM,MAAMZ,gBAAgBa,KAAK;QAC3BC,MAAM;YACJC,SAAS,CAAC;YACV,gCAAgC;YAChCC,MAAMC,KAAKC,SAAS,CAACd;YACrBe,QAAQ;YACRC,KAAK;QACP;QACAZ,YACE,OAAOA,eAAe,WAAWjB,yBAAyBiB;IAC9D,GACA;QAAEa,YAAY;QAAMd;QAAME;QAAUC;IAAS;IAE/C;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASY,eACdC,EAAK,EACLC,QAAmB,EACnBC,UAMI,CAAC,CAAC;IAEN,IAAIA,QAAQjB,UAAU,KAAK,GAAG;QAC5B,MAAM,IAAIkB,MACR,CAAC,wFAAwF,EAAEH,GAAGI,QAAQ,IAAI;IAE9G;IAEA,uCAAuC;IACvC,MAAMpB,OAAOkB,QAAQlB,IAAI,GACrBd,aAAagC,QAA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mBAAIH,aAAaI,IAAI;aAAG,CAC1CC,IAAI,CAAC,CAACC,GAAGC,IAAMD,EAAEE,aAAa,CAACD,IAC/BE,GAAG,CAAC,CAACC,MAAQ,GAAGA,IAAI,CAAC,EAAEV,aAAahB,GAAG,CAAC0B,MAAM,EAC9C5D,IAAI,CAAC;YAER,OAAO,GAAGiD,WAAWI,aAAaQ,MAAM,GAAG,MAAM,KAAKR,cAAc;QACtE,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;YACH,OAAOlD,UAAU2D,KAAK;QACxB;YACE,OAAOzD;IACX;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/unstable-no-store.js b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/unstable-no-store.js new file mode 100644 index 0000000000000000000000000000000000000000..1825e4b8f6c805adefff4a488962e43d5166bac8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/unstable-no-store.js @@ -0,0 +1,54 @@ +import { workAsyncStorage } from '../../app-render/work-async-storage.external'; +import { workUnitAsyncStorage } from '../../app-render/work-unit-async-storage.external'; +import { markCurrentScopeAsDynamic } from '../../app-render/dynamic-rendering'; +/** + * This function can be used to declaratively opt out of static rendering and indicate a particular component should not be cached. + * + * It marks the current scope as dynamic. + * + * - In [non-PPR](https://nextjs.org/docs/app/api-reference/next-config-js/partial-prerendering) cases this will make a static render + * halt and mark the page as dynamic. + * - In PPR cases this will postpone the render at this location. + * + * If we are inside a cache scope then this function does nothing. + * + * @note It expects to be called within App Router and will error otherwise. + * + * Read more: [Next.js Docs: `unstable_noStore`](https://nextjs.org/docs/app/api-reference/functions/unstable_noStore) + */ export function unstable_noStore() { + const callingExpression = 'unstable_noStore()'; + const store = workAsyncStorage.getStore(); + const workUnitStore = workUnitAsyncStorage.getStore(); + if (!store) { + // This generally implies we are being called in Pages router. We should probably not support + // unstable_noStore in contexts outside of `react-server` condition but since we historically + // have not errored here previously, we maintain that behavior for now. + return; + } else if (store.forceStatic) { + return; + } else { + store.isUnstableNoStore = true; + if (workUnitStore) { + switch(workUnitStore.type){ + case 'prerender': + case 'prerender-client': + case 'validation-client': + case 'prerender-runtime': + // unstable_noStore() is a noop in Dynamic I/O. + return; + case 'prerender-legacy': + case 'request': + case 'cache': + case 'private-cache': + case 'unstable-cache': + case 'build-time-generator': + break; + default: + workUnitStore; + } + } + markCurrentScopeAsDynamic(store, workUnitStore, callingExpression); + } +} + +//# sourceMappingURL=unstable-no-store.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/unstable-no-store.js.map b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/unstable-no-store.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a92ad6c64fe549218ea263f5c30d591816c082b4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/unstable-no-store.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/web/spec-extension/unstable-no-store.ts"],"sourcesContent":["import { workAsyncStorage } from '../../app-render/work-async-storage.external'\nimport { workUnitAsyncStorage } from '../../app-render/work-unit-async-storage.external'\nimport { markCurrentScopeAsDynamic } from '../../app-render/dynamic-rendering'\n\n/**\n * This function can be used to declaratively opt out of static rendering and indicate a particular component should not be cached.\n *\n * It marks the current scope as dynamic.\n *\n * - In [non-PPR](https://nextjs.org/docs/app/api-reference/next-config-js/partial-prerendering) cases this will make a static render\n * halt and mark the page as dynamic.\n * - In PPR cases this will postpone the render at this location.\n *\n * If we are inside a cache scope then this function does nothing.\n *\n * @note It expects to be called within App Router and will error otherwise.\n *\n * Read more: [Next.js Docs: `unstable_noStore`](https://nextjs.org/docs/app/api-reference/functions/unstable_noStore)\n */\nexport function unstable_noStore() {\n const callingExpression = 'unstable_noStore()'\n const store = workAsyncStorage.getStore()\n const workUnitStore = workUnitAsyncStorage.getStore()\n if (!store) {\n // This generally implies we are being called in Pages router. We should probably not support\n // unstable_noStore in contexts outside of `react-server` condition but since we historically\n // have not errored here previously, we maintain that behavior for now.\n return\n } else if (store.forceStatic) {\n return\n } else {\n store.isUnstableNoStore = true\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'prerender':\n case 'prerender-client':\n case 'validation-client':\n case 'prerender-runtime':\n // unstable_noStore() is a noop in Dynamic I/O.\n return\n case 'prerender-legacy':\n case 'request':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'build-time-generator':\n break\n default:\n workUnitStore satisfies never\n }\n }\n markCurrentScopeAsDynamic(store, workUnitStore, callingExpression)\n }\n}\n"],"names":["workAsyncStorage","workUnitAsyncStorage","markCurrentScopeAsDynamic","unstable_noStore","callingExpression","store","getStore","workUnitStore","forceStatic","isUnstableNoStore","type"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,+CAA8C;AAC/E,SAASC,oBAAoB,QAAQ,oDAAmD;AACxF,SAASC,yBAAyB,QAAQ,qCAAoC;AAE9E;;;;;;;;;;;;;;CAcC,GACD,OAAO,SAASC;IACd,MAAMC,oBAAoB;IAC1B,MAAMC,QAAQL,iBAAiBM,QAAQ;IACvC,MAAMC,gBAAgBN,qBAAqBK,QAAQ;IACnD,IAAI,CAACD,OAAO;QACV,6FAA6F;QAC7F,6FAA6F;QAC7F,uEAAuE;QACvE;IACF,OAAO,IAAIA,MAAMG,WAAW,EAAE;QAC5B;IACF,OAAO;QACLH,MAAMI,iBAAiB,GAAG;QAC1B,IAAIF,eAAe;YACjB,OAAQA,cAAcG,IAAI;gBACxB,KAAK;gBACL,KAAK;gBACL,KAAK;gBACL,KAAK;oBACH,+CAA+C;oBAC/C;gBACF,KAAK;gBACL,KAAK;gBACL,KAAK;gBACL,KAAK;gBACL,KAAK;gBACL,KAAK;oBACH;gBACF;oBACEH;YACJ;QACF;QACAL,0BAA0BG,OAAOE,eAAeH;IAClD;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/url-pattern.js b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/url-pattern.js new file mode 100644 index 0000000000000000000000000000000000000000..b929f1204432619a7e4ff4160c83a082b84f342d --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/url-pattern.js @@ -0,0 +1,4 @@ +const GlobalURLPattern = typeof URLPattern === 'undefined' ? undefined : URLPattern; +export { GlobalURLPattern as URLPattern }; + +//# sourceMappingURL=url-pattern.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/url-pattern.js.map b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/url-pattern.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b67024e7f36347d7373a6793d237e083e5a2c1fd --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/url-pattern.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/web/spec-extension/url-pattern.ts"],"sourcesContent":["const GlobalURLPattern =\n typeof URLPattern === 'undefined' ? undefined : URLPattern\n\nexport { GlobalURLPattern as URLPattern }\n"],"names":["GlobalURLPattern","URLPattern","undefined"],"mappings":"AAAA,MAAMA,mBACJ,OAAOC,eAAe,cAAcC,YAAYD;AAElD,SAASD,oBAAoBC,UAAU,GAAE","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/user-agent.js b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/user-agent.js new file mode 100644 index 0000000000000000000000000000000000000000..6ff3004f3669de7c7ec43e1bf553c3d9e85dd0e9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/user-agent.js @@ -0,0 +1,15 @@ +import parseua from 'next/dist/compiled/ua-parser-js'; +export function isBot(input) { + return /Googlebot|Mediapartners-Google|AdsBot-Google|googleweblight|Storebot-Google|Google-PageRenderer|Google-InspectionTool|Bingbot|BingPreview|Slurp|DuckDuckBot|baiduspider|yandex|sogou|LinkedInBot|bitlybot|tumblr|vkShare|quora link preview|facebookexternalhit|facebookcatalog|Twitterbot|applebot|redditbot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|ia_archiver|GPTBot/i.test(input); +} +export function userAgentFromString(input) { + return { + ...parseua(input), + isBot: input === undefined ? false : isBot(input) + }; +} +export function userAgent({ headers }) { + return userAgentFromString(headers.get('user-agent') || undefined); +} + +//# sourceMappingURL=user-agent.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/user-agent.js.map b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/user-agent.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b3a1dcf4932893bce09eb8f185647cbacf9457a3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/spec-extension/user-agent.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/server/web/spec-extension/user-agent.ts"],"sourcesContent":["import parseua from 'next/dist/compiled/ua-parser-js'\n\ninterface UserAgent {\n isBot: boolean\n ua: string\n browser: {\n name?: string\n version?: string\n major?: string\n }\n device: {\n model?: string\n type?: string\n vendor?: string\n }\n engine: {\n name?: string\n version?: string\n }\n os: {\n name?: string\n version?: string\n }\n cpu: {\n architecture?: string\n }\n}\n\nexport function isBot(input: string): boolean {\n return /Googlebot|Mediapartners-Google|AdsBot-Google|googleweblight|Storebot-Google|Google-PageRenderer|Google-InspectionTool|Bingbot|BingPreview|Slurp|DuckDuckBot|baiduspider|yandex|sogou|LinkedInBot|bitlybot|tumblr|vkShare|quora link preview|facebookexternalhit|facebookcatalog|Twitterbot|applebot|redditbot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|ia_archiver|GPTBot/i.test(\n input\n )\n}\n\nexport function userAgentFromString(input: string | undefined): UserAgent {\n return {\n ...parseua(input),\n isBot: input === undefined ? false : isBot(input),\n }\n}\n\nexport function userAgent({ headers }: { headers: Headers }): UserAgent {\n return userAgentFromString(headers.get('user-agent') || undefined)\n}\n"],"names":["parseua","isBot","input","test","userAgentFromString","undefined","userAgent","headers","get"],"mappings":"AAAA,OAAOA,aAAa,kCAAiC;AA4BrD,OAAO,SAASC,MAAMC,KAAa;IACjC,OAAO,iXAAiXC,IAAI,CAC1XD;AAEJ;AAEA,OAAO,SAASE,oBAAoBF,KAAyB;IAC3D,OAAO;QACL,GAAGF,QAAQE,MAAM;QACjBD,OAAOC,UAAUG,YAAY,QAAQJ,MAAMC;IAC7C;AACF;AAEA,OAAO,SAASI,UAAU,EAAEC,OAAO,EAAwB;IACzD,OAAOH,oBAAoBG,QAAQC,GAAG,CAAC,iBAAiBH;AAC1D","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/types.js b/e-commerce/node_modules/next/dist/esm/server/web/types.js new file mode 100644 index 0000000000000000000000000000000000000000..4a04190e595cf236965e65c4422d0137e02eaff0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/types.js @@ -0,0 +1,10 @@ +/** + * Proxy allows you to run code before a request is completed. + * Then, based on the incoming request, you can modify the response + * by rewriting, redirecting, modifying the request or response headers, + * or responding directly. + * + * Read more: [Next.js Docs: Proxy](https://nextjs.org/docs/app/building-your-application/routing/middleware) + */ export { }; + +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/types.js.map b/e-commerce/node_modules/next/dist/esm/server/web/types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..cc42934e5e54e632e4d92bb2cb3e5ebad2a1308c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/types.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/web/types.ts"],"sourcesContent":["import type { ExperimentalConfig, I18NConfig } from '../config-shared'\nimport type { NextRequest } from './spec-extension/request'\nimport type { NextFetchEvent } from './spec-extension/fetch-event'\nimport type { NextResponse } from './spec-extension/response'\nimport type { CloneableBody } from '../body-streams'\nimport type { OutgoingHttpHeaders } from 'http'\nimport type { FetchMetrics } from '../base-http'\nimport type { RequestMeta } from '../request-meta'\n\n/**\n * @deprecated Use `ProxyConfig` instead. Middleware has been renamed to Proxy.\n */\nexport type { MiddlewareConfigInput as MiddlewareConfig } from '../../build/segment-config/middleware/middleware-config'\n\nexport type { MiddlewareConfigInput as ProxyConfig } from '../../build/segment-config/middleware/middleware-config'\n\nexport interface RequestData {\n headers: OutgoingHttpHeaders\n method: string\n nextConfig?: {\n basePath?: string\n i18n?: I18NConfig | null\n trailingSlash?: boolean\n experimental?: Pick<\n ExperimentalConfig,\n 'cacheLife' | 'authInterrupts' | 'clientParamParsingOrigins'\n >\n }\n page?: {\n name?: string\n params?: { [key: string]: string | string[] | undefined }\n }\n url: string\n body?: ReadableStream\n signal: AbortSignal\n requestMeta?: RequestMeta\n /** passed in when running in edge runtime sandbox */\n waitUntil?: (promise: Promise) => void\n}\n\nexport type NodejsRequestData = Omit & {\n body?: CloneableBody\n}\n\nexport interface FetchEventResult {\n response: Response\n waitUntil: Promise\n fetchMetrics?: FetchMetrics\n}\n\nexport type NextMiddlewareResult =\n | NextResponse\n | Response\n | null\n | undefined\n | void\n\n/**\n * Middleware allows you to run code before a request is completed.\n * Then, based on the incoming request, you can modify the response\n * by rewriting, redirecting, modifying the request or response headers,\n * or responding directly.\n *\n * @deprecated Use `NextProxy` instead. Middleware has been renamed to Proxy.\n * Read more: [Next.js Docs: Middleware](https://nextjs.org/docs/app/building-your-application/routing/middleware)\n */\nexport type NextMiddleware = (\n request: NextRequest,\n event: NextFetchEvent\n) => NextMiddlewareResult | Promise\n\n/**\n * Proxy allows you to run code before a request is completed.\n * Then, based on the incoming request, you can modify the response\n * by rewriting, redirecting, modifying the request or response headers,\n * or responding directly.\n *\n * Read more: [Next.js Docs: Proxy](https://nextjs.org/docs/app/building-your-application/routing/middleware)\n */\nexport type NextProxy = NextMiddleware\n"],"names":[],"mappings":"AAuEA;;;;;;;CAOC,GACD,WAAsC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/utils.js b/e-commerce/node_modules/next/dist/esm/server/web/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..6b55e1343e475d0b75c4fe0bdcd663b160d46e38 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/utils.js @@ -0,0 +1,141 @@ +import { NEXT_INTERCEPTION_MARKER_PREFIX, NEXT_QUERY_PARAM_PREFIX } from '../../lib/constants'; +/** + * Converts a Node.js IncomingHttpHeaders object to a Headers object. Any + * headers with multiple values will be joined with a comma and space. Any + * headers that have an undefined value will be ignored and others will be + * coerced to strings. + * + * @param nodeHeaders the headers object to convert + * @returns the converted headers object + */ export function fromNodeOutgoingHttpHeaders(nodeHeaders) { + const headers = new Headers(); + for (let [key, value] of Object.entries(nodeHeaders)){ + const values = Array.isArray(value) ? value : [ + value + ]; + for (let v of values){ + if (typeof v === 'undefined') continue; + if (typeof v === 'number') { + v = v.toString(); + } + headers.append(key, v); + } + } + return headers; +} +/* + Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas + that are within a single set-cookie field-value, such as in the Expires portion. + This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2 + Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128 + React Native's fetch does this for *every* header, including set-cookie. + + Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25 + Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation +*/ export function splitCookiesString(cookiesString) { + var cookiesStrings = []; + var pos = 0; + var start; + var ch; + var lastComma; + var nextStart; + var cookiesSeparatorFound; + function skipWhitespace() { + while(pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))){ + pos += 1; + } + return pos < cookiesString.length; + } + function notSpecialChar() { + ch = cookiesString.charAt(pos); + return ch !== '=' && ch !== ';' && ch !== ','; + } + while(pos < cookiesString.length){ + start = pos; + cookiesSeparatorFound = false; + while(skipWhitespace()){ + ch = cookiesString.charAt(pos); + if (ch === ',') { + // ',' is a cookie separator if we have later first '=', not ';' or ',' + lastComma = pos; + pos += 1; + skipWhitespace(); + nextStart = pos; + while(pos < cookiesString.length && notSpecialChar()){ + pos += 1; + } + // currently special character + if (pos < cookiesString.length && cookiesString.charAt(pos) === '=') { + // we found cookies separator + cookiesSeparatorFound = true; + // pos is inside the next cookie, so back up and return it. + pos = nextStart; + cookiesStrings.push(cookiesString.substring(start, lastComma)); + start = pos; + } else { + // in param ',' or param separator ';', + // we continue from that comma + pos = lastComma + 1; + } + } else { + pos += 1; + } + } + if (!cookiesSeparatorFound || pos >= cookiesString.length) { + cookiesStrings.push(cookiesString.substring(start, cookiesString.length)); + } + } + return cookiesStrings; +} +/** + * Converts a Headers object to a Node.js OutgoingHttpHeaders object. This is + * required to support the set-cookie header, which may have multiple values. + * + * @param headers the headers object to convert + * @returns the converted headers object + */ export function toNodeOutgoingHttpHeaders(headers) { + const nodeHeaders = {}; + const cookies = []; + if (headers) { + for (const [key, value] of headers.entries()){ + if (key.toLowerCase() === 'set-cookie') { + // We may have gotten a comma joined string of cookies, or multiple + // set-cookie headers. We need to merge them into one header array + // to represent all the cookies. + cookies.push(...splitCookiesString(value)); + nodeHeaders[key] = cookies.length === 1 ? cookies[0] : cookies; + } else { + nodeHeaders[key] = value; + } + } + } + return nodeHeaders; +} +/** + * Validate the correctness of a user-provided URL. + */ export function validateURL(url) { + try { + return String(new URL(String(url))); + } catch (error) { + throw new Error(`URL is malformed "${String(url)}". Please use only absolute URLs - https://nextjs.org/docs/messages/middleware-relative-urls`, { + cause: error + }); + } +} +/** + * Normalizes `nxtP` and `nxtI` query param values to remove the prefix. + * This function does not mutate the input key. + */ export function normalizeNextQueryParam(key) { + const prefixes = [ + NEXT_QUERY_PARAM_PREFIX, + NEXT_INTERCEPTION_MARKER_PREFIX + ]; + for (const prefix of prefixes){ + if (key !== prefix && key.startsWith(prefix)) { + return key.substring(prefix.length); + } + } + return null; +} + +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/utils.js.map b/e-commerce/node_modules/next/dist/esm/server/web/utils.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b46119008bbf42600adf4afb7a97407fd99118e9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/utils.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/web/utils.ts"],"sourcesContent":["import type { OutgoingHttpHeaders } from 'http'\nimport {\n NEXT_INTERCEPTION_MARKER_PREFIX,\n NEXT_QUERY_PARAM_PREFIX,\n} from '../../lib/constants'\n\n/**\n * Converts a Node.js IncomingHttpHeaders object to a Headers object. Any\n * headers with multiple values will be joined with a comma and space. Any\n * headers that have an undefined value will be ignored and others will be\n * coerced to strings.\n *\n * @param nodeHeaders the headers object to convert\n * @returns the converted headers object\n */\nexport function fromNodeOutgoingHttpHeaders(\n nodeHeaders: OutgoingHttpHeaders\n): Headers {\n const headers = new Headers()\n for (let [key, value] of Object.entries(nodeHeaders)) {\n const values = Array.isArray(value) ? value : [value]\n for (let v of values) {\n if (typeof v === 'undefined') continue\n if (typeof v === 'number') {\n v = v.toString()\n }\n\n headers.append(key, v)\n }\n }\n return headers\n}\n\n/*\n Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas\n that are within a single set-cookie field-value, such as in the Expires portion.\n This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2\n Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128\n React Native's fetch does this for *every* header, including set-cookie.\n \n Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25\n Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation\n*/\nexport function splitCookiesString(cookiesString: string) {\n var cookiesStrings = []\n var pos = 0\n var start\n var ch\n var lastComma\n var nextStart\n var cookiesSeparatorFound\n\n function skipWhitespace() {\n while (pos < cookiesString.length && /\\s/.test(cookiesString.charAt(pos))) {\n pos += 1\n }\n return pos < cookiesString.length\n }\n\n function notSpecialChar() {\n ch = cookiesString.charAt(pos)\n\n return ch !== '=' && ch !== ';' && ch !== ','\n }\n\n while (pos < cookiesString.length) {\n start = pos\n cookiesSeparatorFound = false\n\n while (skipWhitespace()) {\n ch = cookiesString.charAt(pos)\n if (ch === ',') {\n // ',' is a cookie separator if we have later first '=', not ';' or ','\n lastComma = pos\n pos += 1\n\n skipWhitespace()\n nextStart = pos\n\n while (pos < cookiesString.length && notSpecialChar()) {\n pos += 1\n }\n\n // currently special character\n if (pos < cookiesString.length && cookiesString.charAt(pos) === '=') {\n // we found cookies separator\n cookiesSeparatorFound = true\n // pos is inside the next cookie, so back up and return it.\n pos = nextStart\n cookiesStrings.push(cookiesString.substring(start, lastComma))\n start = pos\n } else {\n // in param ',' or param separator ';',\n // we continue from that comma\n pos = lastComma + 1\n }\n } else {\n pos += 1\n }\n }\n\n if (!cookiesSeparatorFound || pos >= cookiesString.length) {\n cookiesStrings.push(cookiesString.substring(start, cookiesString.length))\n }\n }\n\n return cookiesStrings\n}\n\n/**\n * Converts a Headers object to a Node.js OutgoingHttpHeaders object. This is\n * required to support the set-cookie header, which may have multiple values.\n *\n * @param headers the headers object to convert\n * @returns the converted headers object\n */\nexport function toNodeOutgoingHttpHeaders(\n headers: Headers\n): OutgoingHttpHeaders {\n const nodeHeaders: OutgoingHttpHeaders = {}\n const cookies: string[] = []\n if (headers) {\n for (const [key, value] of headers.entries()) {\n if (key.toLowerCase() === 'set-cookie') {\n // We may have gotten a comma joined string of cookies, or multiple\n // set-cookie headers. We need to merge them into one header array\n // to represent all the cookies.\n cookies.push(...splitCookiesString(value))\n nodeHeaders[key] = cookies.length === 1 ? cookies[0] : cookies\n } else {\n nodeHeaders[key] = value\n }\n }\n }\n return nodeHeaders\n}\n\n/**\n * Validate the correctness of a user-provided URL.\n */\nexport function validateURL(url: string | URL): string {\n try {\n return String(new URL(String(url)))\n } catch (error: any) {\n throw new Error(\n `URL is malformed \"${String(\n url\n )}\". Please use only absolute URLs - https://nextjs.org/docs/messages/middleware-relative-urls`,\n { cause: error }\n )\n }\n}\n\n/**\n * Normalizes `nxtP` and `nxtI` query param values to remove the prefix.\n * This function does not mutate the input key.\n */\nexport function normalizeNextQueryParam(key: string): null | string {\n const prefixes = [NEXT_QUERY_PARAM_PREFIX, NEXT_INTERCEPTION_MARKER_PREFIX]\n for (const prefix of prefixes) {\n if (key !== prefix && key.startsWith(prefix)) {\n return key.substring(prefix.length)\n }\n }\n return null\n}\n"],"names":["NEXT_INTERCEPTION_MARKER_PREFIX","NEXT_QUERY_PARAM_PREFIX","fromNodeOutgoingHttpHeaders","nodeHeaders","headers","Headers","key","value","Object","entries","values","Array","isArray","v","toString","append","splitCookiesString","cookiesString","cookiesStrings","pos","start","ch","lastComma","nextStart","cookiesSeparatorFound","skipWhitespace","length","test","charAt","notSpecialChar","push","substring","toNodeOutgoingHttpHeaders","cookies","toLowerCase","validateURL","url","String","URL","error","Error","cause","normalizeNextQueryParam","prefixes","prefix","startsWith"],"mappings":"AACA,SACEA,+BAA+B,EAC/BC,uBAAuB,QAClB,sBAAqB;AAE5B;;;;;;;;CAQC,GACD,OAAO,SAASC,4BACdC,WAAgC;IAEhC,MAAMC,UAAU,IAAIC;IACpB,KAAK,IAAI,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACN,aAAc;QACpD,MAAMO,SAASC,MAAMC,OAAO,CAACL,SAASA,QAAQ;YAACA;SAAM;QACrD,KAAK,IAAIM,KAAKH,OAAQ;YACpB,IAAI,OAAOG,MAAM,aAAa;YAC9B,IAAI,OAAOA,MAAM,UAAU;gBACzBA,IAAIA,EAAEC,QAAQ;YAChB;YAEAV,QAAQW,MAAM,CAACT,KAAKO;QACtB;IACF;IACA,OAAOT;AACT;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,OAAgB;IAEhB,MAAMD,cAAmC,CAAC;IAC1C,MAAM8B,UAAoB,EAAE;IAC5B,IAAI7B,SAAS;QACX,KAAK,MAAM,CAACE,KAAKC,MAAM,IAAIH,QAAQK,OAAO,GAAI;YAC5C,IAAIH,IAAI4B,WAAW,OAAO,cAAc;gBACtC,mEAAmE;gBACnE,kEAAkE;gBAClE,gCAAgC;gBAChCD,QAAQH,IAAI,IAAId,mBAAmBT;gBACnCJ,WAAW,CAACG,IAAI,GAAG2B,QAAQP,MAAM,KAAK,IAAIO,OAAO,CAAC,EAAE,GAAGA;YACzD,OAAO;gBACL9B,WAAW,CAACG,IAAI,GAAGC;YACrB;QACF;IACF;IACA,OAAOJ;AACT;AAEA;;CAEC,GACD,OAAO,SAASgC,YAAYC,GAAiB;IAC3C,IAAI;QACF,OAAOC,OAAO,IAAIC,IAAID,OAAOD;IAC/B,EAAE,OAAOG,OAAY;QACnB,MAAM,IAAIC,MACR,CAAC,kBAAkB,EAAEH,OACnBD,KACA,4FAA4F,CAAC,EAC/F;YAAEK,OAAOF;QAAM;IAEnB;AACF;AAEA;;;CAGC,GACD,OAAO,SAASG,wBAAwBpC,GAAW;IACjD,MAAMqC,WAAW;QAAC1C;QAAyBD;KAAgC;IAC3E,KAAK,MAAM4C,UAAUD,SAAU;QAC7B,IAAIrC,QAAQsC,UAAUtC,IAAIuC,UAAU,CAACD,SAAS;YAC5C,OAAOtC,IAAIyB,SAAS,CAACa,OAAOlB,MAAM;QACpC;IACF;IACA,OAAO;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/web-on-close.js b/e-commerce/node_modules/next/dist/esm/server/web/web-on-close.js new file mode 100644 index 0000000000000000000000000000000000000000..cba9ecc1e02a9b5595330102e595f89441a9df42 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/web-on-close.js @@ -0,0 +1,53 @@ +/** Monitor when the consumer finishes reading the response body. +that's as close as we can get to `res.on('close')` using web APIs. +*/ export function trackBodyConsumed(body, onEnd) { + if (typeof body === 'string') { + const generator = async function* generate() { + const encoder = new TextEncoder(); + yield encoder.encode(body); + onEnd(); + }; + // @ts-expect-error BodyInit typings doesn't seem to include AsyncIterables even though it's supported in practice + return generator(); + } else { + return trackStreamConsumed(body, onEnd); + } +} +export function trackStreamConsumed(stream, onEnd) { + // NOTE: This function must handle `stream` being aborted or cancelled, + // so it can't just be this: + // + // return stream.pipeThrough(new TransformStream({ flush() { onEnd() } })) + // + // because that doesn't handle cancellations. + // (and cancellation handling via `Transformer.cancel` is only available in node >20) + const dest = new TransformStream(); + const runOnEnd = ()=>onEnd(); + stream.pipeTo(dest.writable).then(runOnEnd, runOnEnd); + return dest.readable; +} +export class CloseController { + onClose(callback) { + if (this.isClosed) { + throw new Error('Cannot subscribe to a closed CloseController'); + } + this.target.addEventListener('close', callback); + this.listeners++; + } + dispatchClose() { + if (this.isClosed) { + throw new Error('Cannot close a CloseController multiple times'); + } + if (this.listeners > 0) { + this.target.dispatchEvent(new Event('close')); + } + this.isClosed = true; + } + constructor(){ + this.target = new EventTarget(); + this.listeners = 0; + this.isClosed = false; + } +} + +//# sourceMappingURL=web-on-close.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/server/web/web-on-close.js.map b/e-commerce/node_modules/next/dist/esm/server/web/web-on-close.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1d0436f80c5b3990cb398ea98fc3f18d63299639 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/server/web/web-on-close.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/server/web/web-on-close.ts"],"sourcesContent":["/** Monitor when the consumer finishes reading the response body.\nthat's as close as we can get to `res.on('close')` using web APIs.\n*/\nexport function trackBodyConsumed(\n body: string | ReadableStream,\n onEnd: () => void\n): BodyInit {\n if (typeof body === 'string') {\n const generator = async function* generate() {\n const encoder = new TextEncoder()\n yield encoder.encode(body)\n onEnd()\n }\n // @ts-expect-error BodyInit typings doesn't seem to include AsyncIterables even though it's supported in practice\n return generator()\n } else {\n return trackStreamConsumed(body, onEnd)\n }\n}\n\nexport function trackStreamConsumed(\n stream: ReadableStream,\n onEnd: () => void\n): ReadableStream {\n // NOTE: This function must handle `stream` being aborted or cancelled,\n // so it can't just be this:\n //\n // return stream.pipeThrough(new TransformStream({ flush() { onEnd() } }))\n //\n // because that doesn't handle cancellations.\n // (and cancellation handling via `Transformer.cancel` is only available in node >20)\n const dest = new TransformStream()\n const runOnEnd = () => onEnd()\n stream.pipeTo(dest.writable).then(runOnEnd, runOnEnd)\n return dest.readable\n}\n\nexport class CloseController {\n private target = new EventTarget()\n listeners = 0\n isClosed = false\n\n onClose(callback: () => void) {\n if (this.isClosed) {\n throw new Error('Cannot subscribe to a closed CloseController')\n }\n\n this.target.addEventListener('close', callback)\n this.listeners++\n }\n\n dispatchClose() {\n if (this.isClosed) {\n throw new Error('Cannot close a CloseController multiple times')\n }\n if (this.listeners > 0) {\n this.target.dispatchEvent(new Event('close'))\n }\n this.isClosed = true\n }\n}\n"],"names":["trackBodyConsumed","body","onEnd","generator","generate","encoder","TextEncoder","encode","trackStreamConsumed","stream","dest","TransformStream","runOnEnd","pipeTo","writable","then","readable","CloseController","onClose","callback","isClosed","Error","target","addEventListener","listeners","dispatchClose","dispatchEvent","Event","EventTarget"],"mappings":"AAAA;;AAEA,GACA,OAAO,SAASA,kBACdC,IAA6B,EAC7BC,KAAiB;IAEjB,IAAI,OAAOD,SAAS,UAAU;QAC5B,MAAME,YAAY,gBAAgBC;YAChC,MAAMC,UAAU,IAAIC;YACpB,MAAMD,QAAQE,MAAM,CAACN;YACrBC;QACF;QACA,kHAAkH;QAClH,OAAOC;IACT,OAAO;QACL,OAAOK,oBAAoBP,MAAMC;IACnC;AACF;AAEA,OAAO,SAASM,oBACdC,MAA8B,EAC9BP,KAAiB;IAEjB,uEAAuE;IACvE,4BAA4B;IAC5B,EAAE;IACF,4EAA4E;IAC5E,EAAE;IACF,6CAA6C;IAC7C,qFAAqF;IACrF,MAAMQ,OAAO,IAAIC;IACjB,MAAMC,WAAW,IAAMV;IACvBO,OAAOI,MAAM,CAACH,KAAKI,QAAQ,EAAEC,IAAI,CAACH,UAAUA;IAC5C,OAAOF,KAAKM,QAAQ;AACtB;AAEA,OAAO,MAAMC;IAKXC,QAAQC,QAAoB,EAAE;QAC5B,IAAI,IAAI,CAACC,QAAQ,EAAE;YACjB,MAAM,IAAIC,MAAM;QAClB;QAEA,IAAI,CAACC,MAAM,CAACC,gBAAgB,CAAC,SAASJ;QACtC,IAAI,CAACK,SAAS;IAChB;IAEAC,gBAAgB;QACd,IAAI,IAAI,CAACL,QAAQ,EAAE;YACjB,MAAM,IAAIC,MAAM;QAClB;QACA,IAAI,IAAI,CAACG,SAAS,GAAG,GAAG;YACtB,IAAI,CAACF,MAAM,CAACI,aAAa,CAAC,IAAIC,MAAM;QACtC;QACA,IAAI,CAACP,QAAQ,GAAG;IAClB;;aArBQE,SAAS,IAAIM;aACrBJ,YAAY;aACZJ,WAAW;;AAoBb","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/action-revalidation-kind.js b/e-commerce/node_modules/next/dist/esm/shared/lib/action-revalidation-kind.js new file mode 100644 index 0000000000000000000000000000000000000000..539c59324e53c7f39d38e1309d532bd41f1d50cb --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/action-revalidation-kind.js @@ -0,0 +1,5 @@ +export const ActionDidNotRevalidate = 0; +export const ActionDidRevalidateStaticAndDynamic = 1; +export const ActionDidRevalidateDynamicOnly = 2; + +//# sourceMappingURL=action-revalidation-kind.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/action-revalidation-kind.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/action-revalidation-kind.js.map new file mode 100644 index 0000000000000000000000000000000000000000..69ff8cf00d6aef5a4da4c201c4dcb0a87f69e311 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/action-revalidation-kind.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/action-revalidation-kind.ts"],"sourcesContent":["export type ActionRevalidationKind = 0 | 1 | 2\n\nexport const ActionDidNotRevalidate = 0\nexport const ActionDidRevalidateStaticAndDynamic = 1\nexport const ActionDidRevalidateDynamicOnly = 2\n"],"names":["ActionDidNotRevalidate","ActionDidRevalidateStaticAndDynamic","ActionDidRevalidateDynamicOnly"],"mappings":"AAEA,OAAO,MAAMA,yBAAyB,EAAC;AACvC,OAAO,MAAMC,sCAAsC,EAAC;AACpD,OAAO,MAAMC,iCAAiC,EAAC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/app-dynamic.js b/e-commerce/node_modules/next/dist/esm/shared/lib/app-dynamic.js new file mode 100644 index 0000000000000000000000000000000000000000..7d2b4714d1742a91c7b61303271092c295236bb7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/app-dynamic.js @@ -0,0 +1,17 @@ +import Loadable from './lazy-dynamic/loadable'; +export default function dynamic(dynamicOptions, options) { + const loadableOptions = {}; + if (typeof dynamicOptions === 'function') { + loadableOptions.loader = dynamicOptions; + } + const mergedOptions = { + ...loadableOptions, + ...options + }; + return Loadable({ + ...mergedOptions, + modules: mergedOptions.loadableGenerated?.modules + }); +} + +//# sourceMappingURL=app-dynamic.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/app-dynamic.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/app-dynamic.js.map new file mode 100644 index 0000000000000000000000000000000000000000..44041d8b6c10c1a13b6b7b9fb1d335809975a79c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/app-dynamic.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/app-dynamic.tsx"],"sourcesContent":["import type React from 'react'\nimport type { JSX } from 'react'\nimport Loadable from './lazy-dynamic/loadable'\n\nimport type {\n LoadableGeneratedOptions,\n DynamicOptionsLoadingProps,\n Loader,\n LoaderComponent,\n} from './lazy-dynamic/types'\n\nexport {\n type LoadableGeneratedOptions,\n type DynamicOptionsLoadingProps,\n type Loader,\n type LoaderComponent,\n}\n\nexport type DynamicOptions

= LoadableGeneratedOptions & {\n loading?: () => JSX.Element | null\n loader?: Loader

\n loadableGenerated?: LoadableGeneratedOptions\n modules?: string[]\n ssr?: boolean\n}\n\nexport type LoadableOptions

= DynamicOptions

\n\nexport type LoadableFn

= (\n opts: LoadableOptions

\n) => React.ComponentType

\n\nexport type LoadableComponent

= React.ComponentType

\n\nexport default function dynamic

(\n dynamicOptions: DynamicOptions

| Loader

,\n options?: DynamicOptions

\n): React.ComponentType

{\n const loadableOptions: LoadableOptions

= {}\n\n if (typeof dynamicOptions === 'function') {\n loadableOptions.loader = dynamicOptions\n }\n\n const mergedOptions = {\n ...loadableOptions,\n ...options,\n }\n\n return Loadable({\n ...mergedOptions,\n modules: mergedOptions.loadableGenerated?.modules,\n })\n}\n"],"names":["Loadable","dynamic","dynamicOptions","options","loadableOptions","loader","mergedOptions","modules","loadableGenerated"],"mappings":"AAEA,OAAOA,cAAc,0BAAyB;AAgC9C,eAAe,SAASC,QACtBC,cAA6C,EAC7CC,OAA2B;IAE3B,MAAMC,kBAAsC,CAAC;IAE7C,IAAI,OAAOF,mBAAmB,YAAY;QACxCE,gBAAgBC,MAAM,GAAGH;IAC3B;IAEA,MAAMI,gBAAgB;QACpB,GAAGF,eAAe;QAClB,GAAGD,OAAO;IACZ;IAEA,OAAOH,SAAS;QACd,GAAGM,aAAa;QAChBC,SAASD,cAAcE,iBAAiB,EAAED;IAC5C;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/app-router-context.shared-runtime.js b/e-commerce/node_modules/next/dist/esm/shared/lib/app-router-context.shared-runtime.js new file mode 100644 index 0000000000000000000000000000000000000000..4cff5dd8cbb6c7fa4e59a67164ffb17cc8a1d90a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/app-router-context.shared-runtime.js @@ -0,0 +1,15 @@ +'use client'; +import React from 'react'; +export const AppRouterContext = React.createContext(null); +export const LayoutRouterContext = React.createContext(null); +export const GlobalLayoutRouterContext = React.createContext(null); +export const TemplateContext = React.createContext(null); +if (process.env.NODE_ENV !== 'production') { + AppRouterContext.displayName = 'AppRouterContext'; + LayoutRouterContext.displayName = 'LayoutRouterContext'; + GlobalLayoutRouterContext.displayName = 'GlobalLayoutRouterContext'; + TemplateContext.displayName = 'TemplateContext'; +} +export const MissingSlotContext = React.createContext(new Set()); + +//# sourceMappingURL=app-router-context.shared-runtime.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/app-router-context.shared-runtime.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/app-router-context.shared-runtime.js.map new file mode 100644 index 0000000000000000000000000000000000000000..332b24cf5deae0730057316e7afc0e9a5d8480c8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/app-router-context.shared-runtime.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/app-router-context.shared-runtime.ts"],"sourcesContent":["'use client'\n\nimport type { RouteTree } from '../../client/components/segment-cache/cache'\n\nimport type {\n ScrollHandlerRef,\n PrefetchKind,\n} from '../../client/components/router-reducer/router-reducer-types'\nimport type { Params } from '../../server/request/params'\nimport type {\n FlightRouterState,\n FlightSegmentPath,\n CacheNode,\n LoadingModuleData,\n} from './app-router-types'\nimport React from 'react'\n\nexport interface NavigateOptions {\n scroll?: boolean\n /**\n * Transition types to apply when navigating. These types are passed to\n * [`React.addTransitionType`](https://react.dev/reference/react/addTransitionType)\n * inside the navigation transition, enabling\n * [``](https://react.dev/reference/react/ViewTransition) components\n * to apply different animations based on the type of navigation.\n */\n transitionTypes?: string[]\n}\n\nexport interface PrefetchOptions {\n kind: PrefetchKind\n onInvalidate?: () => void\n}\n\nexport interface AppRouterInstance {\n /**\n * Navigate to the previous history entry.\n */\n back(): void\n /**\n * Navigate to the next history entry.\n */\n forward(): void\n /**\n * Refresh the current page.\n */\n refresh(): void\n /**\n * Refresh the current page. Use in development only.\n * @internal\n */\n hmrRefresh(): void\n /**\n * Navigate to the provided href.\n * Pushes a new history entry.\n */\n push(href: string, options?: NavigateOptions): void\n /**\n * Navigate to the provided href.\n * Replaces the current history entry.\n */\n replace(href: string, options?: NavigateOptions): void\n /**\n * Prefetch the provided href.\n */\n prefetch(href: string, options?: PrefetchOptions): void\n /**\n * Perform a gesture navigation using prefetched data.\n * Only available when experimental.gestureTransition is enabled.\n * @experimental\n */\n experimental_gesturePush?(href: string, options?: NavigateOptions): void\n /**\n * An opaque string identifier scoped to the current route segment.\n *\n * Changes when the surrounding segment is freshly created by a push or\n * replace navigation. Stays the same for back/forward navigations,\n * `router.refresh()`, and search-param/hash-only changes.\n *\n * Intended to be passed to a React `key` to opt out of state preservation\n * on fresh navigations:\n *\n * ```tsx\n *

\n * ```\n *\n * In most cases, prefer resetting state explicitly in an event handler, or\n * deriving a key from your data (e.g. a draft id from the server). Use\n * `bfcacheId` only when those patterns aren't a fit.\n */\n bfcacheId: string\n}\n\nexport const AppRouterContext = React.createContext(\n null\n)\nexport const LayoutRouterContext = React.createContext<{\n parentTree: FlightRouterState\n parentRenderTree: RouteTree\n parentSegmentPath: FlightSegmentPath | null\n parentParams: Params\n parentLoadingData: LoadingModuleData | null\n debugNameContext: string\n url: string\n isActive: boolean\n} | null>(null)\n\nexport const GlobalLayoutRouterContext = React.createContext<{\n tree: FlightRouterState\n scrollRef: ScrollHandlerRef\n nextUrl: string | null\n previousNextUrl: string | null\n}>(null as any)\n\nexport const TemplateContext = React.createContext(null as any)\n\nif (process.env.NODE_ENV !== 'production') {\n AppRouterContext.displayName = 'AppRouterContext'\n LayoutRouterContext.displayName = 'LayoutRouterContext'\n GlobalLayoutRouterContext.displayName = 'GlobalLayoutRouterContext'\n TemplateContext.displayName = 'TemplateContext'\n}\n\nexport const MissingSlotContext = React.createContext>(new Set())\n"],"names":["React","AppRouterContext","createContext","LayoutRouterContext","GlobalLayoutRouterContext","TemplateContext","process","env","NODE_ENV","displayName","MissingSlotContext","Set"],"mappings":"AAAA;AAeA,OAAOA,WAAW,QAAO;AA8EzB,OAAO,MAAMC,mBAAmBD,MAAME,aAAa,CACjD,MACD;AACD,OAAO,MAAMC,sBAAsBH,MAAME,aAAa,CAS5C,MAAK;AAEf,OAAO,MAAME,4BAA4BJ,MAAME,aAAa,CAKzD,MAAY;AAEf,OAAO,MAAMG,kBAAkBL,MAAME,aAAa,CAAkB,MAAY;AAEhF,IAAII,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzCP,iBAAiBQ,WAAW,GAAG;IAC/BN,oBAAoBM,WAAW,GAAG;IAClCL,0BAA0BK,WAAW,GAAG;IACxCJ,gBAAgBI,WAAW,GAAG;AAChC;AAEA,OAAO,MAAMC,qBAAqBV,MAAME,aAAa,CAAc,IAAIS,OAAM","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/app-router-types.js b/e-commerce/node_modules/next/dist/esm/shared/lib/app-router-types.js new file mode 100644 index 0000000000000000000000000000000000000000..40c29dbc143829600ed4dc569ddfda9ae647cbda --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/app-router-types.js @@ -0,0 +1,168 @@ +/** + * App Router types - Client-safe types for the Next.js App Router + * + * This file contains type definitions that can be safely imported + * by both client-side and server-side code without circular dependencies. + */ export var PrefetchHint = /*#__PURE__*/ function(PrefetchHint) { + // NOTE: The 0b00001 bit was previously HasRuntimePrefetch (prefetch: + // 'allow-runtime'). Partial Prefetching allows using runtime requests + // for every segment, so the bit was removed. Do not reuse it without + // considering caches populated by older builds. + // This segment or one of its descendants opts into Partial Prefetching, i.e. + // uses the two-phase (Shell then Speculative) prefetch flow. Set when + // `prefetch` is 'partial' (including the default implied by the global + // `partialPrefetching` config). Propagates upward so the root segment + // reflects the entire subtree. + // + // Partial Prefetching routes may use runtime requests for both shells + // and prefetches. They *may* be optimized to a use a static request + // if no runtime data was accessed during the prerender. + // However, If the route has `ensureStatic` configured to "shell", "prefetch", + // or "navigation", we *must* use static requests for the shell (and possibly the + // prefetch). + // Both of these cases are signalled to the scheduler via the + // `ShouldAttemptStatic{Shell,Prefetch}` hints and the `needsRuntimeRequest` + // promise. + PrefetchHint[PrefetchHint["SubtreeHasPartialPrefetching"] = 2] = "SubtreeHasPartialPrefetching"; + // This segment itself has a loading.tsx boundary. + PrefetchHint[PrefetchHint["SegmentHasLoadingBoundary"] = 4] = "SegmentHasLoadingBoundary"; + // A descendant segment (but not this one) has a loading.tsx boundary. + // Propagates upward so the root reflects the entire subtree. + PrefetchHint[PrefetchHint["SubtreeHasLoadingBoundary"] = 8] = "SubtreeHasLoadingBoundary"; + // This segment is at or above the application's root layout — the root layout + // segment itself and all of its ancestors. A dynamic param in one of these + // segments is a "root param". + PrefetchHint[PrefetchHint["IsRootLayoutOrAbove"] = 16] = "IsRootLayoutOrAbove"; + // This segment's response includes its parent's data inlined into it. + // Set at build time by the segment size measurement pass. + PrefetchHint[PrefetchHint["ParentInlinedIntoSelf"] = 32] = "ParentInlinedIntoSelf"; + // This segment's data is inlined into one of its children — don't fetch + // it separately. Set at build time by the segment size measurement pass. + PrefetchHint[PrefetchHint["InlinedIntoChild"] = 64] = "InlinedIntoChild"; + // On a __PAGE__: this page's response includes the head (metadata/viewport) + // in its transport data (PartialTransportData's `h`). + PrefetchHint[PrefetchHint["HeadInlinedIntoSelf"] = 128] = "HeadInlinedIntoSelf"; + // On the root hint node: the head was NOT inlined into any page — fetch + // it separately. Absence of this bit means the head is bundled into a page. + PrefetchHint[PrefetchHint["HeadOutlined"] = 256] = "HeadOutlined"; + // The inlining hints in this tree may be stale because the tree was + // generated before collectPrefetchHints ran (e.g. the initial RSC payload + // for a fully static page at build time). When writing this tree into the + // cache, the route entry should be immediately expired so it gets + // re-fetched with correct hints. Only set during build-time prerendering, + // never at runtime. + PrefetchHint[PrefetchHint["InliningHintsStale"] = 512] = "InliningHintsStale"; + // This segment has prefetch = 'force-disabled'. The opt-out is passive + // and applies to this segment only: it never INITIATES a prefetch — no + // static data is emitted or fetched, and it's never the reason a runtime + // prefetch spawns — but it may ride along in a runtime response issued on + // another segment's behalf. Descendants prefetch normally. + // + // TODO: Also set as an internal fallback when the prefetch hints manifest + // is unavailable (see #91407 mitigations), which only means "no static + // prefetch data exists" — not a user opt-out. Split the fallback into its + // own bit so the two intents can diverge. + PrefetchHint[PrefetchHint["PrefetchDisabled"] = 1024] = "PrefetchDisabled"; + // NOTE: The 0b100000000000 bit was previously SubtreeHasRuntimePrefetch. + // Partial Prefetching now implies runtime completeness for every segment + // (see SubtreeHasPartialPrefetching), so the bit was removed. Do not reuse + // it without considering caches populated by older builds. + // NOTE: The 0b1000000000000 bit was previously SubtreeHasEagerPrefetch + // (prefetch: 'unstable_eager', plus every segment that did not opt into + // Partial Prefetching). After `unstable_eager` was removed, it's no longer needed. + // This segment or one of its descendants exports `instant = false`, + // explicitly opting out of Partial Prefetching. Propagates upward so the root + // reflects the entire subtree. Used only to suppress the dev-time + // `` warning — unlike PrefetchDisabled, it has no effect + // on the actual prefetch behavior. + PrefetchHint[PrefetchHint["SubtreeHasInstantFalse"] = 8192] = "SubtreeHasInstantFalse"; + // The client should attempt a static prefetch for this route: the + // build-time prerender did not access any runtime data (cookies, headers, + // searchParams, ...), so a static prefetch is expected to be as complete + // as a runtime one. A fallback-param access only unsets the bit when the + // route can never be upgraded from a fallback to a concrete prerender — + // on an upgradeable route, ISR later produces the concrete prerender a + // static attempt would hit (until then, the static responses' own + // signal reports the insufficiency per response). Purely advisory, and + // both error directions are safe: if set when a runtime request is + // actually needed, that same response-level signal (the load-bearing + // `needsRuntimeRequest` promise combined with each segment's `isPartial`) + // directs the client to follow up — the cost is a wasted static attempt. + // If unset when static would have sufficed, the client goes straight to a + // runtime prefetch, which is a superset of the static response — the cost + // is only reduced cacheability. Like the other bits, this one is computed + // once per build and stays constant for the build's lifetime; it rides + // the prefetch-hints manifest into every response that carries hints — + // `/_tree` prefetch responses and the FlightRouterState of dynamic + // navigations alike. (Routes missing from the manifest — see the #91407 + // fallbacks — simply never carry it.) Set on every node of the tree, but + // does not propagate. + PrefetchHint[PrefetchHint["ShouldAttemptStaticShell"] = 16384] = "ShouldAttemptStaticShell"; + PrefetchHint[PrefetchHint["ShouldAttemptStaticPrefetch"] = 32768] = "ShouldAttemptStaticPrefetch"; + // This dynamic segment only accepts build-time parameter values. Kept on + // the affected node, without propagating or copying it to other segments. + // Until the client knows the allowed values, any such node prevents route + // prediction, even when the route's components never read the parameter. + PrefetchHint[PrefetchHint["IsClosedParam"] = 65536] = "IsClosedParam"; + // A descendant segment (but not this one) has a closed parameter. Propagates + // upward so route prediction can check the root instead of walking the tree. + PrefetchHint[PrefetchHint["SubtreeHasClosedParams"] = 131072] = "SubtreeHasClosedParams"; + return PrefetchHint; +}({}); +/** + * Bitmask for checking whether a segment's static prefetch is skipped — i.e. + * the server emits no static data for it (its node in a segment response + * carries identity only, and it participates in a bundle only as a + * pass-through) and the client never issues a static request for it. + * + * Static prefetching is disabled ONLY by `prefetch: 'force-disabled'` + * (PrefetchDisabled). Notably, Partial Prefetching segments DO have static + * data even though they can use runtime requests: the server emits it + * unconditionally — it can't be gated on the ShouldAttemptStatic{Shell,Prefetch} + * hints, because which segments carry static data must be deterministic + * from build-time config. A runtime request may still be needed for the + * segment, but the scheduler may attempt a static prefetch first (per the + * ShouldAttemptStatic{Shell,Prefetch} hints) and skip the runtime request if the + * static response proves sufficient. + * + * Usage: `(hints & StaticPrefetchDisabled) !== 0` + */ export const StaticPrefetchDisabled = 1024; +export const StaticAttemptHints = 16384 | 32768; +/** + * The subset of PrefetchHint bits that propagate upward from a child segment to + * its ancestors (as opposed to segment-local bits like SegmentHasLoadingBoundary + * or IsRootLayoutOrAbove). Used to clear stale propagated bits before re-deriving them + * from a node's children. + */ export const SubtreePrefetchHints = 2 | 8 | 8192 | 131072; +/** + * Folds a child segment's prefetch hints into its parent's, propagating the + * "subtree" flags. A child's segment-local flag (e.g. it has a loading + * boundary) becomes the corresponding "subtree" flag on the parent, so the + * root segment ends up reflecting the entire subtree. + * + * Used wherever a route tree is assembled bottom-up: on the server when building + * a transport tree (createTransportTreeFromLoaderTree) and on the client when + * overlaying a navigation response onto the existing tree + * (createNavigationSeed). Keep these in sync by routing both through + * this helper. + */ export function propagateSubtreeBits(parentHints, childHints) { + if (childHints & 2) { + parentHints |= 2; + } + // A child with a loading boundary (directly, or anywhere in its subtree) makes + // this a SubtreeHasLoadingBoundary on the parent. + if (childHints & (4 | 8)) { + parentHints |= 8; + } + // And for `instant = false`. The bit is set directly on each opted-out + // segment, so there's no separate segment-local flag — propagate it as-is. + if (childHints & 8192) { + parentHints |= 8192; + } + if (childHints & (65536 | 131072)) { + parentHints |= 131072; + } + return parentHints; +} + +//# sourceMappingURL=app-router-types.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/app-router-types.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/app-router-types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..2d707c920546c7e96ec42d4d2b122f021be56fe5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/app-router-types.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/app-router-types.ts"],"sourcesContent":["/**\n * App Router types - Client-safe types for the Next.js App Router\n *\n * This file contains type definitions that can be safely imported\n * by both client-side and server-side code without circular dependencies.\n */\n\nimport type React from 'react'\n\nexport type LoadingModuleData =\n | [React.JSX.Element, React.ReactNode, React.ReactNode]\n | null\n\nimport type {\n VaryParams,\n VaryParamsIterable,\n} from './segment-cache/vary-params-decoding'\nimport type { FullTransportData, PartialTransportData } from './rsc-transport'\n\n/** viewport metadata node */\nexport type HeadData = React.ReactNode\n\n/**\n * Render state for a segment. Reuse this object while its data is unchanged;\n * create a new one when a navigation replaces the segment's data.\n */\nexport type CacheNode = {\n /**\n * When rsc is not null, it represents the RSC data for the\n * corresponding segment.\n *\n * `null` is a valid React Node but because segment data is always a\n * component, we can use `null` to represent empty. When it is\n * null, it represents missing data, and rendering should suspend.\n */\n rsc: React.ReactNode\n\n /**\n * Represents a static version of the segment that can be shown immediately,\n * and may or may not contain dynamic holes. It's prefetched before a\n * navigation occurs.\n *\n * During rendering, we will choose whether to render `rsc` or `prefetchRsc`\n * with `useDeferredValue`. As with the `rsc` field, a value of `null` means\n * no value was provided. In this case, the LayoutRouter will go straight to\n * rendering the `rsc` value; if that one is also missing, it will suspend and\n * trigger a lazy fetch.\n */\n prefetchRsc: React.ReactNode\n\n /**\n * The source of the params `rsc` depends on, from the response that\n * produced it. Null when unknown: the data came from the segment cache, or\n * from a render that didn't track params, or `rsc` is still pending — it\n * is set alongside `rsc` when the response arrives. A navigation that only\n * changes params this output did not depend on can keep rendering it.\n */\n varyParams: VaryParams | null\n\n /**\n * A shared mutable ref that tracks whether this segment should be scrolled\n * to. All new segments created during a single navigation share the same\n * ref. When any segment's scroll handler fires, it sets `current` to\n * `false` so no other segment scrolls for the same navigation.\n *\n * `null` means this segment is not a scroll target (e.g., a reused shared\n * layout segment).\n */\n scrollRef: ScrollRef | null\n\n /**\n * Globally-unique identifier minted from a monotonic counter when the\n * CacheNode is freshly created. Surfaced to user code as a string via\n * `useRouter().bfcacheId` and intended to be used as a React `key` to\n * opt out of Activity-based state preservation on fresh navigations.\n *\n * Preserved when the CacheNode is reused (shared layouts, refresh,\n * search/hash-only navigations) or restored from the BFCache during a\n * back/forward navigation.\n */\n bfcacheId: number\n}\n\n/**\n * A mutable ref shared across all new segments created during a single\n * navigation. Used to ensure that only one segment scrolls per navigation.\n */\nexport type ScrollRef = { current: boolean }\n\nexport type DynamicParamTypes =\n | 'catchall'\n | 'catchall-intercepted-(..)(..)'\n | 'catchall-intercepted-(.)'\n | 'catchall-intercepted-(..)'\n | 'catchall-intercepted-(...)'\n | 'optional-catchall'\n | 'dynamic'\n | 'dynamic-intercepted-(..)(..)'\n | 'dynamic-intercepted-(.)'\n | 'dynamic-intercepted-(..)'\n | 'dynamic-intercepted-(...)'\n\nexport type DynamicParamTypesShort =\n | 'c'\n | 'ci(..)(..)'\n | 'ci(.)'\n | 'ci(..)'\n | 'ci(...)'\n | 'oc'\n | 'd'\n | 'di(..)(..)'\n | 'di(.)'\n | 'di(..)'\n | 'di(...)'\n\n// The tuple form of a segment, used for dynamic route params\nexport type DynamicSegmentTuple = [\n // Param name\n paramName: string,\n // Param cache key (almost the same as the value, but arrays are\n // concatenated into strings)\n // TODO: We should change this to just be the value. Currently we convert\n // it back to a value when passing to useParams. It only needs to be\n // a string when converted to a a cache key, but that doesn't mean we\n // need to store it as that representation.\n paramCacheKey: string,\n // Dynamic param type\n dynamicParamType: DynamicParamTypesShort,\n // Static sibling segments at the same URL level. Used by the client\n // router to determine if a prefetch can be reused when navigating to\n // a static sibling of a dynamic route. For example, if the route is\n // /products/[id] and there's also /products/sale, then staticSiblings\n // would be ['sale']. null means the siblings are unknown (e.g. in\n // webpack dev mode).\n staticSiblings: readonly string[] | null,\n]\n\nexport type Segment = string | DynamicSegmentTuple\n\n/**\n * Router state\n */\nexport type FlightRouterState = [\n segment: Segment,\n parallelRoutes: { [parallelRouterKey: string]: FlightRouterState },\n refreshState?: CompressedRefreshState | null,\n /**\n * - \"refetch\" is used during a request to inform the server where rendering\n * should start from.\n *\n * - \"inside-shared-layout\" is used during a prefetch request to inform the\n * server that even if the segment matches, it should be treated as if it's\n * within the \"new\" part of a navigation — inside the shared layout. If\n * the segment doesn't match, then it has no effect, since it would be\n * treated as new regardless. If it does match, though, the server does not\n * need to render it, because the client already has it.\n *\n * - \"metadata-only\" instructs the server to skip rendering the segments and\n * only send the head data.\n *\n * A bit confusing, but that's because it has only one extremely narrow use\n * case — during a non-PPR prefetch, the server uses it to find the first\n * loading boundary beneath a shared layout.\n *\n * TODO: We should rethink the protocol for dynamic requests. It might not\n * make sense for the client to send a FlightRouterState, since this type is\n * overloaded with concerns.\n */\n refresh?: 'refetch' | 'inside-shared-layout' | 'metadata-only' | null,\n /**\n * Bitmask of PrefetchHint flags. Encodes route structure metadata:\n * root layout, loading boundaries, instant configs, and prefetch strategy\n * hints. Only set when non-zero. JSON encodes an omitted slot as null when\n * a later slot is present.\n */\n prefetchHints?: number | null,\n /**\n * The rendered search params of a page segment. An empty string means there\n * are none. Only set on page nodes, and left out of request headers.\n * TODO: Revisit this as part of the larger FlightRouterState refactor.\n */\n renderedSearch?: string,\n]\n\n/**\n * When rendering a parallel route, some of the parallel paths may not match\n * the current URL. In that case, the Next client has to render something,\n * so it will render whichever was the last route to match that slot. We use\n * this type to track when this has happened. It's a tuple of the original\n * URL that was used to fetch the segment, and the (possibly rewritten) search\n * query that was rendered by the server. The URL is needed when performing\n * a refresh of the segment, and the search query is needed for looking up\n * matching entries in the segment cache.\n */\nexport type CompressedRefreshState = [url: string, renderedSearch: string]\n\nexport const enum PrefetchHint {\n // NOTE: The 0b00001 bit was previously HasRuntimePrefetch (prefetch:\n // 'allow-runtime'). Partial Prefetching allows using runtime requests\n // for every segment, so the bit was removed. Do not reuse it without\n // considering caches populated by older builds.\n\n // This segment or one of its descendants opts into Partial Prefetching, i.e.\n // uses the two-phase (Shell then Speculative) prefetch flow. Set when\n // `prefetch` is 'partial' (including the default implied by the global\n // `partialPrefetching` config). Propagates upward so the root segment\n // reflects the entire subtree.\n //\n // Partial Prefetching routes may use runtime requests for both shells\n // and prefetches. They *may* be optimized to a use a static request\n // if no runtime data was accessed during the prerender.\n // However, If the route has `ensureStatic` configured to \"shell\", \"prefetch\",\n // or \"navigation\", we *must* use static requests for the shell (and possibly the\n // prefetch).\n // Both of these cases are signalled to the scheduler via the\n // `ShouldAttemptStatic{Shell,Prefetch}` hints and the `needsRuntimeRequest`\n // promise.\n SubtreeHasPartialPrefetching = 0b00010,\n // This segment itself has a loading.tsx boundary.\n SegmentHasLoadingBoundary = 0b00100,\n // A descendant segment (but not this one) has a loading.tsx boundary.\n // Propagates upward so the root reflects the entire subtree.\n SubtreeHasLoadingBoundary = 0b01000,\n // This segment is at or above the application's root layout — the root layout\n // segment itself and all of its ancestors. A dynamic param in one of these\n // segments is a \"root param\".\n IsRootLayoutOrAbove = 0b10000,\n // This segment's response includes its parent's data inlined into it.\n // Set at build time by the segment size measurement pass.\n ParentInlinedIntoSelf = 0b100000,\n // This segment's data is inlined into one of its children — don't fetch\n // it separately. Set at build time by the segment size measurement pass.\n InlinedIntoChild = 0b1000000,\n // On a __PAGE__: this page's response includes the head (metadata/viewport)\n // in its transport data (PartialTransportData's `h`).\n HeadInlinedIntoSelf = 0b10000000,\n // On the root hint node: the head was NOT inlined into any page — fetch\n // it separately. Absence of this bit means the head is bundled into a page.\n HeadOutlined = 0b100000000,\n // The inlining hints in this tree may be stale because the tree was\n // generated before collectPrefetchHints ran (e.g. the initial RSC payload\n // for a fully static page at build time). When writing this tree into the\n // cache, the route entry should be immediately expired so it gets\n // re-fetched with correct hints. Only set during build-time prerendering,\n // never at runtime.\n InliningHintsStale = 0b1000000000,\n // This segment has prefetch = 'force-disabled'. The opt-out is passive\n // and applies to this segment only: it never INITIATES a prefetch — no\n // static data is emitted or fetched, and it's never the reason a runtime\n // prefetch spawns — but it may ride along in a runtime response issued on\n // another segment's behalf. Descendants prefetch normally.\n //\n // TODO: Also set as an internal fallback when the prefetch hints manifest\n // is unavailable (see #91407 mitigations), which only means \"no static\n // prefetch data exists\" — not a user opt-out. Split the fallback into its\n // own bit so the two intents can diverge.\n PrefetchDisabled = 0b10000000000,\n // NOTE: The 0b100000000000 bit was previously SubtreeHasRuntimePrefetch.\n // Partial Prefetching now implies runtime completeness for every segment\n // (see SubtreeHasPartialPrefetching), so the bit was removed. Do not reuse\n // it without considering caches populated by older builds.\n\n // NOTE: The 0b1000000000000 bit was previously SubtreeHasEagerPrefetch\n // (prefetch: 'unstable_eager', plus every segment that did not opt into\n // Partial Prefetching). After `unstable_eager` was removed, it's no longer needed.\n\n // This segment or one of its descendants exports `instant = false`,\n // explicitly opting out of Partial Prefetching. Propagates upward so the root\n // reflects the entire subtree. Used only to suppress the dev-time\n // `` warning — unlike PrefetchDisabled, it has no effect\n // on the actual prefetch behavior.\n SubtreeHasInstantFalse = 0b10000000000000,\n // The client should attempt a static prefetch for this route: the\n // build-time prerender did not access any runtime data (cookies, headers,\n // searchParams, ...), so a static prefetch is expected to be as complete\n // as a runtime one. A fallback-param access only unsets the bit when the\n // route can never be upgraded from a fallback to a concrete prerender —\n // on an upgradeable route, ISR later produces the concrete prerender a\n // static attempt would hit (until then, the static responses' own\n // signal reports the insufficiency per response). Purely advisory, and\n // both error directions are safe: if set when a runtime request is\n // actually needed, that same response-level signal (the load-bearing\n // `needsRuntimeRequest` promise combined with each segment's `isPartial`)\n // directs the client to follow up — the cost is a wasted static attempt.\n // If unset when static would have sufficed, the client goes straight to a\n // runtime prefetch, which is a superset of the static response — the cost\n // is only reduced cacheability. Like the other bits, this one is computed\n // once per build and stays constant for the build's lifetime; it rides\n // the prefetch-hints manifest into every response that carries hints —\n // `/_tree` prefetch responses and the FlightRouterState of dynamic\n // navigations alike. (Routes missing from the manifest — see the #91407\n // fallbacks — simply never carry it.) Set on every node of the tree, but\n // does not propagate.\n ShouldAttemptStaticShell = 0b100000000000000,\n ShouldAttemptStaticPrefetch = 0b1000000000000000,\n // This dynamic segment only accepts build-time parameter values. Kept on\n // the affected node, without propagating or copying it to other segments.\n // Until the client knows the allowed values, any such node prevents route\n // prediction, even when the route's components never read the parameter.\n IsClosedParam = 0b10000000000000000,\n // A descendant segment (but not this one) has a closed parameter. Propagates\n // upward so route prediction can check the root instead of walking the tree.\n SubtreeHasClosedParams = 0b100000000000000000,\n}\n\n/**\n * Bitmask for checking whether a segment's static prefetch is skipped — i.e.\n * the server emits no static data for it (its node in a segment response\n * carries identity only, and it participates in a bundle only as a\n * pass-through) and the client never issues a static request for it.\n *\n * Static prefetching is disabled ONLY by `prefetch: 'force-disabled'`\n * (PrefetchDisabled). Notably, Partial Prefetching segments DO have static\n * data even though they can use runtime requests: the server emits it\n * unconditionally — it can't be gated on the ShouldAttemptStatic{Shell,Prefetch}\n * hints, because which segments carry static data must be deterministic\n * from build-time config. A runtime request may still be needed for the\n * segment, but the scheduler may attempt a static prefetch first (per the\n * ShouldAttemptStatic{Shell,Prefetch} hints) and skip the runtime request if the\n * static response proves sufficient.\n *\n * Usage: `(hints & StaticPrefetchDisabled) !== 0`\n */\nexport const StaticPrefetchDisabled = PrefetchHint.PrefetchDisabled\n\nexport const StaticAttemptHints =\n PrefetchHint.ShouldAttemptStaticShell |\n PrefetchHint.ShouldAttemptStaticPrefetch\n\n/**\n * The subset of PrefetchHint bits that propagate upward from a child segment to\n * its ancestors (as opposed to segment-local bits like SegmentHasLoadingBoundary\n * or IsRootLayoutOrAbove). Used to clear stale propagated bits before re-deriving them\n * from a node's children.\n */\nexport const SubtreePrefetchHints =\n PrefetchHint.SubtreeHasPartialPrefetching |\n PrefetchHint.SubtreeHasLoadingBoundary |\n PrefetchHint.SubtreeHasInstantFalse |\n PrefetchHint.SubtreeHasClosedParams\n\n/**\n * Folds a child segment's prefetch hints into its parent's, propagating the\n * \"subtree\" flags. A child's segment-local flag (e.g. it has a loading\n * boundary) becomes the corresponding \"subtree\" flag on the parent, so the\n * root segment ends up reflecting the entire subtree.\n *\n * Used wherever a route tree is assembled bottom-up: on the server when building\n * a transport tree (createTransportTreeFromLoaderTree) and on the client when\n * overlaying a navigation response onto the existing tree\n * (createNavigationSeed). Keep these in sync by routing both through\n * this helper.\n */\nexport function propagateSubtreeBits(\n parentHints: number,\n childHints: number\n): number {\n if (childHints & PrefetchHint.SubtreeHasPartialPrefetching) {\n parentHints |= PrefetchHint.SubtreeHasPartialPrefetching\n }\n // A child with a loading boundary (directly, or anywhere in its subtree) makes\n // this a SubtreeHasLoadingBoundary on the parent.\n if (\n childHints &\n (PrefetchHint.SegmentHasLoadingBoundary |\n PrefetchHint.SubtreeHasLoadingBoundary)\n ) {\n parentHints |= PrefetchHint.SubtreeHasLoadingBoundary\n }\n // And for `instant = false`. The bit is set directly on each opted-out\n // segment, so there's no separate segment-local flag — propagate it as-is.\n if (childHints & PrefetchHint.SubtreeHasInstantFalse) {\n parentHints |= PrefetchHint.SubtreeHasInstantFalse\n }\n if (\n childHints &\n (PrefetchHint.IsClosedParam | PrefetchHint.SubtreeHasClosedParams)\n ) {\n parentHints |= PrefetchHint.SubtreeHasClosedParams\n }\n return parentHints\n}\n\n/**\n * A path through the segment tree: a repeating sequence of segment and\n * parallel route key. Used by the client to address positions in the\n * render tree (see layout-router).\n */\nexport type FlightSegmentPath =\n // Uses `any` as repeating pattern can't be typed.\n | any[]\n // Looks somewhat like this\n | [\n segment: Segment,\n parallelRouterKey: string,\n segment: Segment,\n parallelRouterKey: string,\n segment: Segment,\n parallelRouterKey: string,\n ]\n\n/**\n * Per-route prefetch hints computed at build time. Mirrors the shape of the\n * loader tree so hints can be traversed in parallel during router state\n * creation. Each node stores a bitmask of PrefetchHint flags\n * (ParentInlinedIntoSelf, InlinedIntoChild) computed by the segment size\n * measurement pass.\n *\n * Persisted to prefetch-hints.json as Record (keyed\n * by route pattern) and loaded at server startup.\n */\nexport type PrefetchHints = {\n /** Bitmask of PrefetchHint flags for this segment. */\n hints: number\n /** Child hint nodes, keyed by parallel route key. */\n slots: Record | null\n}\n\nexport type ActionResult = Promise\n\nexport type InitialRSCPayload = {\n /** buildId, can be empty if the x-nextjs-build-id header is set */\n b?: string\n /** initialCanonicalUrlParts */\n c: string[]\n /** initialRenderedSearch */\n q: string\n /** couldBeIntercepted */\n i: boolean\n /** initial transport data — the tree + head for hydration */\n t: FullTransportData\n /** missingSlots */\n m: Set | undefined\n /** GlobalError */\n G: [React.ComponentType, React.ReactNode | undefined]\n /** supportsPerSegmentPrefetching */\n S: boolean\n /**\n * rootVaryParams - the root params accessed anywhere in the response, emitted\n * once. The client unions these into the head and every segment's vary\n * params, rather than the server folding them into each set.\n */\n r?: VaryParamsIterable\n /** staleTime in seconds - Only present when Cache Components is enabled. */\n s?: AsyncIterable\n /**\n * runtimeDataAccessed — whether the render has accessed a data source that\n * hangs during a static prerender but would resolve during a runtime\n * prerender (cookies, headers, fallback params, searchParams, ...). The\n * flag is monotonic (false → true, at most once), so it's encoded as a\n * promise: resolved `true` at the moment of first access — the fulfillment\n * row's position in the stream records the stage the access happened in —\n * or resolved `false` when the prerender completes without one, a row that\n * lands past every stage boundary. A truncated (shell) decode therefore\n * reads the answer as of the shell stage: fulfilled `true` iff the access\n * happened during a stage it includes, pending (⇒ no access) otherwise.\n * Unlike an async iterable, a pending promise costs Flight no abort\n * listener on the render. Used when generating per-segment prefetch\n * responses (forwarded as each response's own `u`).\n * The build-time constant `PrefetchHint.ShouldAttemptStatic{Shell,Prefetch}`\n * hint is tracked separately.\n * Only present for static prerenders when Cache Components is enabled.\n */\n u?: Promise\n /** staticStageByteLength - Resolves when the static stage ends. */\n l?: Promise\n /**\n * shellByteLength - Resolves when the shell stage ends.\n * If it resolves to null, then the shell is the same as the main response.\n * */\n a?: Promise\n /** runtimePrefetchStream — Embedded runtime prefetch Flight stream. */\n p?: ReadableStream\n /**\n * dynamicStaleTime — Per-page BFCache stale time in seconds, from\n * `unstable_dynamicStaleTime`. Only included for dynamic renders. Controls\n * how long the client router cache retains dynamic navigation data. This is\n * distinct from the `s` field, which controls segment cache (prefetch)\n * staleness.\n */\n d?: number\n /**\n * revealAfter (dev only). Resolves once the server has flushed the\n * shell-stage content to the stream (static shell, or runtime-prefetchable\n * shell for runtime-prefetch routes), or earlier on a cache miss. The client\n * decodes this from the payload and defers resolving the response's deferred\n * RSCs on it, so a boundary's children aren't revealed before their row has\n * been decoded (which would flush a premature Suspense fallback). Its\n * resolution row follows the children's row in the payload, so the children\n * are decoded by the time the client unblocks. The HTML render gates on the\n * same signal server-side instead of reading this field.\n */\n _revealAfter?: Promise\n}\n\n/**\n * The fields shared by every navigation/prefetch response kind. Not used\n * directly — see NavigationFlightResponse (the general form) and the\n * per-context aliases DynamicNavigationFlightResponse and\n * PrefetchFlightResponse below. Fields that only apply to some response\n * kinds are optional.\n */\ntype NavigationFlightResponseBase = {\n /** buildId, can be empty if the x-nextjs-build-id header is set */\n b?: string\n /**\n * transport data — present iff the response carries a SPA payload.\n * Absent when the response renders nothing (see `n` for MPA navigations).\n *\n * In a per-segment prefetch response the tree is root-anchored with `d`\n * present on exactly the segments whose data is bundled into the response\n * (the requested segment and any ancestors inlined into it, per the\n * build-time prefetch hints); the remaining nodes — the spine above the\n * bundle, and segments with static prefetching disabled — carry identity\n * but no data. Every node carries the same hints the `/_tree` response\n * emits for it, so the tree decodes like any other transport tree. Data\n * nodes use the staged encodings: `p` is a promise and `s` is present\n * (see TransportSegmentData). The head (`h`) is present iff it's bundled\n * into the response: the standalone head response (whose tree is a bare\n * root identity), or a page response whose bundle accepted the head\n * (PrefetchHint.HeadInlinedIntoSelf).\n */\n t?: PartialTransportData\n /**\n * MPA navigation URL — present iff the client should hard-navigate to\n * this URL instead of applying a SPA payload. Reserved: no server path\n * emits it today (hard navigations are signaled by non-RSC content types\n * or a build-id mismatch), but the client honors it.\n */\n n?: string\n /** staleTime - Only present in live-render responses.\n * Per-segment prefetch responses carry staleTime per node instead (see\n * TransportSegmentData). */\n s?: AsyncIterable\n /** staticStageByteLength - Resolves when the static stage ends. */\n l?: Promise\n /**\n * shellByteLength - Resolves when the shell stage ends.\n * If it resolves to null, then the shell is the same as the main response.\n *\n * In a per-segment prefetch response this is the shell byte boundary the\n * client uses for the shell double-decode: re-decoding the buffered\n * response truncated at the offset yields the shell variant of every\n * segment (param-dependent content reduced to still-pending references).\n * `0` means no shell exists (the page wasn't produced by staged\n * rendering) — never a valid offset, so it doubles as the \"none\"\n * sentinel. The resolution row flushes past the boundary, so a truncated\n * shell decode reads it as pending, which is harmless. The client's\n * buffered read leans on the same fact from the other side: 0 read from\n * an unfulfilled `a` implies a bug — see the shell-extraction comment in\n * fetchAndWritePerSegmentPrefetchResponse (segment-cache/cache.ts).\n */\n a?: Promise\n /**\n * needsRuntimeRequest — presence means the response carries a stage-scoped\n * runtime-data verdict. Per-segment prefetch responses always emit one,\n * and so does any prerendered page payload, which embeds the prerender's\n * runtime-data probe — that covers navigation responses served from\n * prerender output and the truncated initial payload alike. Live renders\n * emit none. Only per-segment responses additionally promise-encode the\n * head's partiality (see TransportSegmentData). The value is the page's\n * runtime-data-access flag (the page payload's own `u`; per-segment\n * responses forward it from the staged decode of the page data).\n * Fulfilled `true` means a runtime prefetch would return more\n * than this static response; pending or fulfilled `false` means it\n * wouldn't. Promise-encoded so the answer rewinds with a truncated\n * decode: the fulfillment row lands on the same side of the shell byte\n * boundary (`a`) as the access it records. Tracking is page-global, so it\n * lives on the response, not on each segment; per-segment granularity\n * comes from combining it with each segment's partiality:\n * needsRuntimeRequest(segment) = (settled true) && (isPartial pending).\n * The derived value must never falsely claim that no runtime request is\n * needed, so every fallback is conservative: pages that carry no `u`\n * (legacy render paths) forward an already-resolved `true`. Unlike the\n * build-constant prefetch hints, this is computed per render and may\n * change between responses for the same build — it reflects THIS\n * response.\n */\n u?: Promise\n /**\n * shellUsedSessionData — present only in runtime-shell prefetch\n * responses: true if resolving session data unblocked new content in the\n * shell. Only meaningful where there's a proper session shell.\n * Promise-encoded so the answer rewinds with a truncated decode.\n * Currently has no client consumer; emitted for forward compatibility.\n */\n w?: Promise\n /**\n * isUpgradeableISRFallback — present (true) iff this is a per-segment\n * prefetch response generated from a fallback shell render (i.e. the page\n * had not yet been prerendered with concrete params, so it was rendered\n * with `fallbackRouteParams`). The client uses this to schedule a retry,\n * since a more complete version may become available once the server's\n * background regeneration finishes.\n *\n * Note: this is distinct from per-segment partiality. A fully-prerendered\n * PPR page can have partial segments (dynamic holes filled by runtime\n * requests); those should not be retried. This flag specifically means a\n * more complete *static* version may become available.\n */\n f?: boolean\n /**\n * rootVaryParams - the root params accessed anywhere in the response, emitted\n * once. The client unions these into the head and every segment's vary\n * params.\n */\n r?: VaryParamsIterable\n /** runtimePrefetchStream — Embedded runtime prefetch Flight stream. */\n p?: ReadableStream\n /**\n * dynamicStaleTime — Per-page BFCache stale time in seconds, from\n * `unstable_dynamicStaleTime`. Only included for dynamic renders. Controls\n * how long the client router cache retains dynamic navigation data. This is\n * distinct from the `s` field, which controls segment cache (prefetch)\n * staleness.\n */\n d?: number\n /**\n * revealAfter (dev only). Resolves once the server has flushed the\n * shell-stage content to the stream (static shell, or runtime-prefetchable\n * shell for runtime-prefetch routes), or earlier on a cache miss. The client\n * decodes this from the payload and defers resolving the response's deferred\n * RSCs on it, so a boundary's children aren't revealed before their row has\n * been decoded (which would flush a premature Suspense fallback). Its\n * resolution row follows the children's row in the payload, so the children\n * are decoded by the time the client unblocks. The HTML render gates on the\n * same signal server-side instead of reading this field.\n */\n _revealAfter?: Promise\n}\n\n/**\n * A live-render response: navigations, refreshes, runtime prefetches, and\n * dynamic route tree prefetches. Live renders always emit `S`, `q`, and `i`,\n * so they're required here — used at the sites that produce these responses\n * (app-render) and the decode sites that only ever receive them, so a\n * malformed response fails the type rather than being masked by a fallback.\n */\nexport type DynamicNavigationFlightResponse = NavigationFlightResponseBase & {\n /**\n * supportsPerSegmentPrefetching — whether per-segment prefetch responses\n * can be served for this route.\n */\n S: boolean\n /** renderedSearch */\n q: string\n /** couldBeIntercepted */\n i: boolean\n}\n\n/**\n * A per-segment prefetch response served from static storage: the `/_tree`\n * route tree prefetch and the per-segment responses generated by\n * collect-segment-data. Never carries `S` (implied by the response's\n * existence), `q` (search-agnostic; the client writes these responses into\n * the cache using the rendered search already recorded on the route tree\n * entry), or `i` (the client reads the Vary header instead). Structurally\n * the shared base — the alias marks the response kind at the sites that\n * produce and decode it.\n */\nexport type PrefetchFlightResponse = NavigationFlightResponseBase\n\n/**\n * The general form: a response that may be either kind, for the flows that\n * handle both (the `/_tree` fetch, which receives a live render when\n * per-segment prefetching is unsupported, and the shared cache-write path).\n * Both aliases above are assignable to it.\n */\nexport type NavigationFlightResponse = NavigationFlightResponseBase & {\n /**\n * supportsPerSegmentPrefetching — present in live-render responses;\n * absent in per-segment prefetch responses served from static storage\n * (where it's implied by the response's existence).\n */\n S?: boolean\n /**\n * renderedSearch — present in live-render responses; absent in\n * per-segment prefetch responses, which are search-agnostic (the client\n * writes them into the cache using the rendered search already recorded\n * on the route tree entry).\n */\n q?: string\n /**\n * couldBeIntercepted — present in live-render responses; absent in\n * per-segment prefetch responses (the client reads the Vary header\n * instead).\n */\n i?: boolean\n}\n\n// Response from `createFromFetch` for server actions.\nexport type ActionFlightResponse = {\n /** actionResult */\n a: ActionResult\n /** buildId, can be empty if the x-nextjs-build-id header is set */\n b?: string\n /**\n * transport data — present iff the action response re-rendered the page.\n * Absent when the action rendered nothing (see `n` for MPA navigations).\n */\n t?: PartialTransportData\n /**\n * MPA navigation URL — present iff the client should hard-navigate to\n * this URL instead of applying a SPA payload. Reserved: no server path\n * emits it today, but the client honors it.\n */\n n?: string\n /** renderedSearch */\n q: string\n /** couldBeIntercepted */\n i: boolean\n}\n\nexport type RSCPayload =\n | InitialRSCPayload\n | NavigationFlightResponse\n | ActionFlightResponse\n\nexport type InstantCookie =\n // pending (waiting to capture)\n | [captured: 0, id: string]\n // captured MPA page load\n | [captured: 1, id: string, state: null]\n // captured SPA navigation (from/to route trees)\n | [\n captured: 1,\n id: string,\n state: { from: FlightRouterState; to: FlightRouterState | null },\n ]\n"],"names":["PrefetchHint","StaticPrefetchDisabled","StaticAttemptHints","SubtreePrefetchHints","propagateSubtreeBits","parentHints","childHints"],"mappings":"AAAA;;;;;CAKC,GA+LD,OAAO,IAAA,AAAWA,sCAAAA;IAChB,qEAAqE;IACrE,sEAAsE;IACtE,qEAAqE;IACrE,gDAAgD;IAEhD,6EAA6E;IAC7E,sEAAsE;IACtE,uEAAuE;IACvE,sEAAsE;IACtE,+BAA+B;IAC/B,EAAE;IACF,sEAAsE;IACtE,oEAAoE;IACpE,wDAAwD;IACxD,8EAA8E;IAC9E,iF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;CAKC,GACD,OAAO,MAAMG,uBACXH,sBAGmC;AAErC;;;;;;;;;;;CAWC,GACD,OAAO,SAASI,qBACdC,WAAmB,EACnBC,UAAkB;IAElB,IAAIA,gBAAwD;QAC1DD;IACF;IACA,+EAA+E;IAC/E,kDAAkD;IAClD,IACEC,aACCN,CAAAA,KACsC,GACvC;QACAK;IACF;IACA,uEAAuE;IACvE,2EAA2E;IAC3E,IAAIC,mBAAkD;QACpDD;IACF;IACA,IACEC,aACCN,CAAAA,cAA+D,GAChE;QACAK;IACF;IACA,OAAOA;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/bloom-filter.js b/e-commerce/node_modules/next/dist/esm/shared/lib/bloom-filter.js new file mode 100644 index 0000000000000000000000000000000000000000..64fc3b07dd68c412f0cc7ad14ab5ae81daf40c06 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/bloom-filter.js @@ -0,0 +1,75 @@ +// minimal implementation MurmurHash2 hash function +function murmurhash2(str) { + let h = 0; + for(let i = 0; i < str.length; i++){ + const c = str.charCodeAt(i); + h = Math.imul(h ^ c, 0x5bd1e995); + h ^= h >>> 13; + h = Math.imul(h, 0x5bd1e995); + } + return h >>> 0; +} +// default to 0.01% error rate as the filter compresses very well +const DEFAULT_ERROR_RATE = 0.0001; +export class BloomFilter { + constructor(numItems, errorRate = DEFAULT_ERROR_RATE){ + this.numItems = numItems; + this.errorRate = errorRate; + this.numBits = Math.ceil(-(numItems * Math.log(errorRate)) / (Math.log(2) * Math.log(2))); + this.numHashes = Math.ceil(this.numBits / numItems * Math.log(2)); + this.bitArray = new Array(this.numBits).fill(0); + } + static from(items, errorRate = DEFAULT_ERROR_RATE) { + const filter = new BloomFilter(items.length, errorRate); + for (const item of items){ + filter.add(item); + } + return filter; + } + export() { + const data = { + numItems: this.numItems, + errorRate: this.errorRate, + numBits: this.numBits, + numHashes: this.numHashes, + bitArray: this.bitArray + }; + if (process.env.NEXT_RUNTIME === 'nodejs') { + if (this.errorRate < DEFAULT_ERROR_RATE) { + const filterData = JSON.stringify(data); + const gzipSize = require('next/dist/compiled/gzip-size').sync(filterData); + if (gzipSize > 1024) { + console.warn(`Creating filter with error rate less than 0.1% (0.001) can increase the size dramatically proceed with caution. Received error rate ${this.errorRate} resulted in size ${filterData.length} bytes, ${gzipSize} bytes (gzip)`); + } + } + } + return data; + } + import(data) { + this.numItems = data.numItems; + this.errorRate = data.errorRate; + this.numBits = data.numBits; + this.numHashes = data.numHashes; + this.bitArray = data.bitArray; + } + add(item) { + const hashValues = this.getHashValues(item); + hashValues.forEach((hash)=>{ + this.bitArray[hash] = 1; + }); + } + contains(item) { + const hashValues = this.getHashValues(item); + return hashValues.every((hash)=>this.bitArray[hash]); + } + getHashValues(item) { + const hashValues = []; + for(let i = 1; i <= this.numHashes; i++){ + const hash = murmurhash2(`${item}${i}`) % this.numBits; + hashValues.push(hash); + } + return hashValues; + } +} + +//# sourceMappingURL=bloom-filter.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/bloom-filter.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/bloom-filter.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6f70c885a3b164ca3ced2aa3060e407c01c5c762 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/bloom-filter.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/bloom-filter.ts"],"sourcesContent":["// minimal implementation MurmurHash2 hash function\nfunction murmurhash2(str: string) {\n let h = 0\n for (let i = 0; i < str.length; i++) {\n const c = str.charCodeAt(i)\n h = Math.imul(h ^ c, 0x5bd1e995)\n h ^= h >>> 13\n h = Math.imul(h, 0x5bd1e995)\n }\n return h >>> 0\n}\n\n// default to 0.01% error rate as the filter compresses very well\nconst DEFAULT_ERROR_RATE = 0.0001\n\nexport class BloomFilter {\n numItems: number\n errorRate: number\n numBits: number\n numHashes: number\n bitArray: number[]\n\n constructor(numItems: number, errorRate: number = DEFAULT_ERROR_RATE) {\n this.numItems = numItems\n this.errorRate = errorRate\n this.numBits = Math.ceil(\n -(numItems * Math.log(errorRate)) / (Math.log(2) * Math.log(2))\n )\n this.numHashes = Math.ceil((this.numBits / numItems) * Math.log(2))\n this.bitArray = new Array(this.numBits).fill(0)\n }\n\n static from(items: string[], errorRate = DEFAULT_ERROR_RATE) {\n const filter = new BloomFilter(items.length, errorRate)\n\n for (const item of items) {\n filter.add(item)\n }\n return filter\n }\n\n export() {\n const data = {\n numItems: this.numItems,\n errorRate: this.errorRate,\n numBits: this.numBits,\n numHashes: this.numHashes,\n bitArray: this.bitArray,\n }\n\n if (process.env.NEXT_RUNTIME === 'nodejs') {\n if (this.errorRate < DEFAULT_ERROR_RATE) {\n const filterData = JSON.stringify(data)\n const gzipSize = (\n require('next/dist/compiled/gzip-size') as typeof import('next/dist/compiled/gzip-size')\n ).sync(filterData)\n\n if (gzipSize > 1024) {\n console.warn(\n `Creating filter with error rate less than 0.1% (0.001) can increase the size dramatically proceed with caution. Received error rate ${this.errorRate} resulted in size ${filterData.length} bytes, ${gzipSize} bytes (gzip)`\n )\n }\n }\n }\n\n return data\n }\n\n import(data: ReturnType<(typeof this)['export']>) {\n this.numItems = data.numItems\n this.errorRate = data.errorRate\n this.numBits = data.numBits\n this.numHashes = data.numHashes\n this.bitArray = data.bitArray\n }\n\n add(item: string) {\n const hashValues = this.getHashValues(item)\n hashValues.forEach((hash) => {\n this.bitArray[hash] = 1\n })\n }\n\n contains(item: string) {\n const hashValues = this.getHashValues(item)\n return hashValues.every((hash) => this.bitArray[hash])\n }\n\n getHashValues(item: string) {\n const hashValues = []\n for (let i = 1; i <= this.numHashes; i++) {\n const hash = murmurhash2(`${item}${i}`) % this.numBits\n hashValues.push(hash)\n }\n return hashValues\n }\n}\n"],"names":["murmurhash2","str","h","i","length","c","charCodeAt","Math","imul","DEFAULT_ERROR_RATE","BloomFilter","constructor","numItems","errorRate","numBits","ceil","log","numHashes","bitArray","Array","fill","from","items","filter","item","add","export","data","process","env","NEXT_RUNTIME","filterData","JSON","stringify","gzipSize","require","sync","console","warn","import","hashValues","getHashValues","forEach","hash","contains","every","push"],"mappings":"AAAA,mDAAmD;AACnD,SAASA,YAAYC,GAAW;IAC9B,IAAIC,IAAI;IACR,IAAK,IAAIC,IAAI,GAAGA,IAAIF,IAAIG,MAAM,EAAED,IAAK;QACnC,MAAME,IAAIJ,IAAIK,UAAU,CAACH;QACzBD,IAAIK,KAAKC,IAAI,CAACN,IAAIG,GAAG;QACrBH,KAAKA,MAAM;QACXA,IAAIK,KAAKC,IAAI,CAACN,GAAG;IACnB;IACA,OAAOA,MAAM;AACf;AAEA,iEAAiE;AACjE,MAAMO,qBAAqB;AAE3B,OAAO,MAAMC;IAOXC,YAAYC,QAAgB,EAAEC,YAAoBJ,kBAAkB,CAAE;QACpE,IAAI,CAACG,QAAQ,GAAGA;QAChB,IAAI,CAACC,SAAS,GAAGA;QACjB,IAAI,CAACC,OAAO,GAAGP,KAAKQ,IAAI,CACtB,CAAEH,CAAAA,WAAWL,KAAKS,GAAG,CAACH,UAAS,IAAMN,CAAAA,KAAKS,GAAG,CAAC,KAAKT,KAAKS,GAAG,CAAC,EAAC;QAE/D,IAAI,CAACC,SAAS,GAAGV,KAAKQ,IAAI,CAAC,AAAC,IAAI,CAACD,OAAO,GAAGF,WAAYL,KAAKS,GAAG,CAAC;QAChE,IAAI,CAACE,QAAQ,GAAG,IAAIC,MAAM,IAAI,CAACL,OAAO,EAAEM,IAAI,CAAC;IAC/C;IAEA,OAAOC,KAAKC,KAAe,EAAET,YAAYJ,kBAAkB,EAAE;QAC3D,MAAMc,SAAS,IAAIb,YAAYY,MAAMlB,MAAM,EAAES;QAE7C,KAAK,MAAMW,QAAQF,MAAO;YACxBC,OAAOE,GAAG,CAACD;QACb;QACA,OAAOD;IACT;IAEAG,SAAS;QACP,MAAMC,OAAO;YACXf,UAAU,IAAI,CAACA,QAAQ;YACvBC,WAAW,IAA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C,MAAMwC,OAAO3C,YAAY,GAAGwB,OAAOrB,GAAG,IAAI,IAAI,CAACW,OAAO;YACtD0B,WAAWM,IAAI,CAACH;QAClB;QACA,OAAOH;IACT;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/constants.js b/e-commerce/node_modules/next/dist/esm/shared/lib/constants.js new file mode 100644 index 0000000000000000000000000000000000000000..0cb2b1189ae97b3e6260614ea684144af33bbefe --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/constants.js @@ -0,0 +1,171 @@ +import MODERN_BROWSERSLIST_TARGET from './modern-browserslist-target'; +export { MODERN_BROWSERSLIST_TARGET }; +export const COMPILER_NAMES = { + client: 'client', + server: 'server', + edgeServer: 'edge-server' +}; +export const COMPILER_INDEXES = { + [COMPILER_NAMES.client]: 0, + [COMPILER_NAMES.server]: 1, + [COMPILER_NAMES.edgeServer]: 2 +}; +// Re-export entry constants for backward compatibility +export { UNDERSCORE_NOT_FOUND_ROUTE, UNDERSCORE_NOT_FOUND_ROUTE_ENTRY, UNDERSCORE_GLOBAL_ERROR_ROUTE, UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY } from './entry-constants'; +export var AdapterOutputType = /*#__PURE__*/ function(AdapterOutputType) { + /** + * `PAGES` represents all the React pages that are under `pages/`. + */ AdapterOutputType["PAGES"] = "PAGES"; + /** + * `PAGES_API` represents all the API routes under `pages/api/`. + */ AdapterOutputType["PAGES_API"] = "PAGES_API"; + /** + * `APP_PAGE` represents all the React pages that are under `app/` with the + * filename of `page.{j,t}s{,x}`. + */ AdapterOutputType["APP_PAGE"] = "APP_PAGE"; + /** + * `APP_ROUTE` represents all the API routes and metadata routes that are under `app/` with the + * filename of `route.{j,t}s{,x}`. + */ AdapterOutputType["APP_ROUTE"] = "APP_ROUTE"; + /** + * `PRERENDER` represents an ISR enabled route that might + * have a seeded cache entry or fallback generated during build + */ AdapterOutputType["PRERENDER"] = "PRERENDER"; + /** + * `STATIC_FILE` represents a static file (ie /_next/static) + */ AdapterOutputType["STATIC_FILE"] = "STATIC_FILE"; + /** + * `MIDDLEWARE` represents the middleware output if present + */ AdapterOutputType["MIDDLEWARE"] = "MIDDLEWARE"; + return AdapterOutputType; +}({}); +export const PHASE_EXPORT = 'phase-export'; +export const PHASE_ANALYZE = 'phase-analyze'; +export const PHASE_PRODUCTION_BUILD = 'phase-production-build'; +export const PHASE_PRODUCTION_SERVER = 'phase-production-server'; +export const PHASE_DEVELOPMENT_SERVER = 'phase-development-server'; +export const PHASE_TEST = 'phase-test'; +export const PHASE_INFO = 'phase-info'; +export const PAGES_MANIFEST = 'pages-manifest.json'; +export const APP_PATHS_MANIFEST = 'app-paths-manifest.json'; +export const APP_PATH_ROUTES_MANIFEST = 'app-path-routes-manifest.json'; +export const BUILD_MANIFEST = 'build-manifest.json'; +export const FUNCTIONS_CONFIG_MANIFEST = 'functions-config-manifest.json'; +export const SUBRESOURCE_INTEGRITY_MANIFEST = 'subresource-integrity-manifest'; +export const NEXT_FONT_MANIFEST = 'next-font-manifest'; +export const EXPORT_MARKER = 'export-marker.json'; +export const EXPORT_DETAIL = 'export-detail.json'; +export const PRERENDER_MANIFEST = 'prerender-manifest.json'; +export const PREFETCH_HINTS = 'prefetch-hints.json'; +export const PREVIEW_PROPS_MANIFEST = 'preview-props.json'; +export const ROUTES_MANIFEST = 'routes-manifest.json'; +export const IMAGES_MANIFEST = 'images-manifest.json'; +export const SERVER_FILES_MANIFEST = 'required-server-files'; +export const DEV_CLIENT_PAGES_MANIFEST = '_devPagesManifest.json'; +export const REQUEST_INSIGHTS_DEV_ENDPOINT = '/_next/development/request-insights'; +export const MIDDLEWARE_MANIFEST = 'middleware-manifest.json'; +export const TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST = '_clientMiddlewareManifest.js'; +export const TURBOPACK_CLIENT_BUILD_MANIFEST = 'client-build-manifest.json'; +export const DEV_CLIENT_MIDDLEWARE_MANIFEST = '_devMiddlewareManifest.json'; +export const REACT_LOADABLE_MANIFEST = 'react-loadable-manifest.json'; +export const SERVER_DIRECTORY = 'server'; +export const CONFIG_FILES = [ + 'next.config.js', + 'next.config.mjs', + 'next.config.ts', + // process.features can be undefined on Edge runtime + // TODO: Remove `as any` once we bump @types/node to v22.10.0+ + ...process?.features?.typescript ? [ + 'next.config.mts' + ] : [] +]; +export const BUILD_ID_FILE = 'BUILD_ID'; +export const BLOCKED_PAGES = [ + '/_document', + '/_app', + '/_error' +]; +export const CLIENT_PUBLIC_FILES_PATH = 'public'; +export const CLIENT_STATIC_FILES_PATH = 'static'; +export const STRING_LITERAL_DROP_BUNDLE = '__NEXT_DROP_CLIENT_FILE__'; +export const NEXT_BUILTIN_DOCUMENT = '__NEXT_BUILTIN_DOCUMENT__'; +export const BARREL_OPTIMIZATION_PREFIX = '__barrel_optimize__'; +// server/[entry]/page_client-reference-manifest.js +export const CLIENT_REFERENCE_MANIFEST = 'client-reference-manifest'; +// server/server-reference-manifest +export const SERVER_REFERENCE_MANIFEST = 'server-reference-manifest'; +// server/middleware-build-manifest.js +export const MIDDLEWARE_BUILD_MANIFEST = 'middleware-build-manifest'; +// server/middleware-react-loadable-manifest.js +export const MIDDLEWARE_REACT_LOADABLE_MANIFEST = 'middleware-react-loadable-manifest'; +// server/interception-route-rewrite-manifest.js +export const INTERCEPTION_ROUTE_REWRITE_MANIFEST = 'interception-route-rewrite-manifest'; +// server/dynamic-css-manifest.js +export const DYNAMIC_CSS_MANIFEST = 'dynamic-css-manifest'; +// static/runtime/main.js +export const CLIENT_STATIC_FILES_RUNTIME_MAIN = `main`; +export const CLIENT_STATIC_FILES_RUNTIME_MAIN_APP = `${CLIENT_STATIC_FILES_RUNTIME_MAIN}-app`; +// next internal client components chunk for layouts +export const APP_CLIENT_INTERNALS = 'app-pages-internals'; +// static/runtime/react-refresh.js +export const CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH = `react-refresh`; +// static/runtime/webpack.js +export const CLIENT_STATIC_FILES_RUNTIME_WEBPACK = `webpack`; +// static/runtime/polyfills.js +export const CLIENT_STATIC_FILES_RUNTIME_POLYFILLS = 'polyfills'; +export const CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL = Symbol(CLIENT_STATIC_FILES_RUNTIME_POLYFILLS); +export const DEFAULT_RUNTIME_WEBPACK = 'webpack-runtime'; +export const EDGE_RUNTIME_WEBPACK = 'edge-runtime-webpack'; +export const STATIC_PROPS_ID = '__N_SSG'; +export const SERVER_PROPS_ID = '__N_SSP'; +export const DEFAULT_SERIF_FONT = { + name: 'Times New Roman', + xAvgCharWidth: 821, + azAvgWidth: 854.3953488372093, + unitsPerEm: 2048 +}; +export const DEFAULT_SANS_SERIF_FONT = { + name: 'Arial', + xAvgCharWidth: 904, + azAvgWidth: 934.5116279069767, + unitsPerEm: 2048 +}; +export const STATIC_STATUS_PAGES = [ + '/500' +]; +export const TRACE_OUTPUT_VERSION = 1; +// in `MB` +export const TURBO_TRACE_DEFAULT_MEMORY_LIMIT = 6000; +export const RSC_MODULE_TYPES = { + client: 'client', + server: 'server' +}; +// comparing +// https://nextjs.org/docs/api-reference/edge-runtime +// with +// https://nodejs.org/docs/latest/api/globals.html +export const EDGE_UNSUPPORTED_NODE_APIS = [ + 'clearImmediate', + 'setImmediate', + 'BroadcastChannel', + 'ByteLengthQueuingStrategy', + 'CompressionStream', + 'CountQueuingStrategy', + 'DecompressionStream', + 'DomException', + 'MessageChannel', + 'MessageEvent', + 'MessagePort', + 'ReadableByteStreamController', + 'ReadableStreamBYOBRequest', + 'ReadableStreamDefaultController', + 'TransformStreamDefaultController', + 'WritableStreamDefaultController' +]; +export const SYSTEM_ENTRYPOINTS = new Set([ + CLIENT_STATIC_FILES_RUNTIME_MAIN, + CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH, + CLIENT_STATIC_FILES_RUNTIME_MAIN_APP +]); + +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/constants.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/constants.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1fe07571aca662d741bc924957ebec5e51557eb4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/constants.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/constants.ts"],"sourcesContent":["import MODERN_BROWSERSLIST_TARGET from './modern-browserslist-target'\n\nexport { MODERN_BROWSERSLIST_TARGET }\n\nexport type ValueOf = Required[keyof T]\n\nexport const COMPILER_NAMES = {\n client: 'client',\n server: 'server',\n edgeServer: 'edge-server',\n} as const\n\nexport type CompilerNameValues = ValueOf\n\nexport const COMPILER_INDEXES: {\n [compilerKey in CompilerNameValues]: number\n} = {\n [COMPILER_NAMES.client]: 0,\n [COMPILER_NAMES.server]: 1,\n [COMPILER_NAMES.edgeServer]: 2,\n} as const\n\n// Re-export entry constants for backward compatibility\nexport {\n UNDERSCORE_NOT_FOUND_ROUTE,\n UNDERSCORE_NOT_FOUND_ROUTE_ENTRY,\n UNDERSCORE_GLOBAL_ERROR_ROUTE,\n UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY,\n} from './entry-constants'\n\nexport enum AdapterOutputType {\n /**\n * `PAGES` represents all the React pages that are under `pages/`.\n */\n PAGES = 'PAGES',\n\n /**\n * `PAGES_API` represents all the API routes under `pages/api/`.\n */\n PAGES_API = 'PAGES_API',\n /**\n * `APP_PAGE` represents all the React pages that are under `app/` with the\n * filename of `page.{j,t}s{,x}`.\n */\n APP_PAGE = 'APP_PAGE',\n\n /**\n * `APP_ROUTE` represents all the API routes and metadata routes that are under `app/` with the\n * filename of `route.{j,t}s{,x}`.\n */\n APP_ROUTE = 'APP_ROUTE',\n\n /**\n * `PRERENDER` represents an ISR enabled route that might\n * have a seeded cache entry or fallback generated during build\n */\n PRERENDER = 'PRERENDER',\n\n /**\n * `STATIC_FILE` represents a static file (ie /_next/static)\n */\n STATIC_FILE = 'STATIC_FILE',\n\n /**\n * `MIDDLEWARE` represents the middleware output if present\n */\n MIDDLEWARE = 'MIDDLEWARE',\n}\n\nexport const PHASE_EXPORT = 'phase-export'\nexport const PHASE_ANALYZE = 'phase-analyze'\nexport const PHASE_PRODUCTION_BUILD = 'phase-production-build'\nexport const PHASE_PRODUCTION_SERVER = 'phase-production-server'\nexport const PHASE_DEVELOPMENT_SERVER = 'phase-development-server'\nexport const PHASE_TEST = 'phase-test'\nexport const PHASE_INFO = 'phase-info'\n\nexport type PHASE_TYPE =\n | typeof PHASE_INFO\n | typeof PHASE_TEST\n | typeof PHASE_EXPORT\n | typeof PHASE_ANALYZE\n | typeof PHASE_PRODUCTION_BUILD\n | typeof PHASE_PRODUCTION_SERVER\n | typeof PHASE_DEVELOPMENT_SERVER\n\nexport const PAGES_MANIFEST = 'pages-manifest.json'\nexport const APP_PATHS_MANIFEST = 'app-paths-manifest.json'\nexport const APP_PATH_ROUTES_MANIFEST = 'app-path-routes-manifest.json'\nexport const BUILD_MANIFEST = 'build-manifest.json'\nexport const FUNCTIONS_CONFIG_MANIFEST = 'functions-config-manifest.json'\nexport const SUBRESOURCE_INTEGRITY_MANIFEST = 'subresource-integrity-manifest'\nexport const NEXT_FONT_MANIFEST = 'next-font-manifest'\nexport const EXPORT_MARKER = 'export-marker.json'\nexport const EXPORT_DETAIL = 'export-detail.json'\nexport const PRERENDER_MANIFEST = 'prerender-manifest.json'\nexport const PREFETCH_HINTS = 'prefetch-hints.json'\nexport const PREVIEW_PROPS_MANIFEST = 'preview-props.json'\nexport const ROUTES_MANIFEST = 'routes-manifest.json'\nexport const IMAGES_MANIFEST = 'images-manifest.json'\nexport const SERVER_FILES_MANIFEST = 'required-server-files'\nexport const DEV_CLIENT_PAGES_MANIFEST = '_devPagesManifest.json'\nexport const REQUEST_INSIGHTS_DEV_ENDPOINT =\n '/_next/development/request-insights'\nexport const MIDDLEWARE_MANIFEST = 'middleware-manifest.json'\nexport const TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST =\n '_clientMiddlewareManifest.js'\nexport const TURBOPACK_CLIENT_BUILD_MANIFEST = 'client-build-manifest.json'\nexport const DEV_CLIENT_MIDDLEWARE_MANIFEST = '_devMiddlewareManifest.json'\nexport const REACT_LOADABLE_MANIFEST = 'react-loadable-manifest.json'\nexport const SERVER_DIRECTORY = 'server'\nexport const CONFIG_FILES = [\n 'next.config.js',\n 'next.config.mjs',\n 'next.config.ts',\n // process.features can be undefined on Edge runtime\n // TODO: Remove `as any` once we bump @types/node to v22.10.0+\n ...((process?.features as any)?.typescript ? ['next.config.mts'] : []),\n]\nexport const BUILD_ID_FILE = 'BUILD_ID'\nexport const BLOCKED_PAGES = ['/_document', '/_app', '/_error']\nexport const CLIENT_PUBLIC_FILES_PATH = 'public'\nexport const CLIENT_STATIC_FILES_PATH = 'static'\nexport const STRING_LITERAL_DROP_BUNDLE = '__NEXT_DROP_CLIENT_FILE__'\nexport const NEXT_BUILTIN_DOCUMENT = '__NEXT_BUILTIN_DOCUMENT__'\nexport const BARREL_OPTIMIZATION_PREFIX = '__barrel_optimize__'\n\n// server/[entry]/page_client-reference-manifest.js\nexport const CLIENT_REFERENCE_MANIFEST = 'client-reference-manifest'\n// server/server-reference-manifest\nexport const SERVER_REFERENCE_MANIFEST = 'server-reference-manifest'\n// server/middleware-build-manifest.js\nexport const MIDDLEWARE_BUILD_MANIFEST = 'middleware-build-manifest'\n// server/middleware-react-loadable-manifest.js\nexport const MIDDLEWARE_REACT_LOADABLE_MANIFEST =\n 'middleware-react-loadable-manifest'\n// server/interception-route-rewrite-manifest.js\nexport const INTERCEPTION_ROUTE_REWRITE_MANIFEST =\n 'interception-route-rewrite-manifest'\n// server/dynamic-css-manifest.js\nexport const DYNAMIC_CSS_MANIFEST = 'dynamic-css-manifest'\n\n// static/runtime/main.js\nexport const CLIENT_STATIC_FILES_RUNTIME_MAIN = `main`\nexport const CLIENT_STATIC_FILES_RUNTIME_MAIN_APP = `${CLIENT_STATIC_FILES_RUNTIME_MAIN}-app`\n// next internal client components chunk for layouts\nexport const APP_CLIENT_INTERNALS = 'app-pages-internals'\n// static/runtime/react-refresh.js\nexport const CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH = `react-refresh`\n// static/runtime/webpack.js\nexport const CLIENT_STATIC_FILES_RUNTIME_WEBPACK = `webpack`\n// static/runtime/polyfills.js\nexport const CLIENT_STATIC_FILES_RUNTIME_POLYFILLS = 'polyfills'\nexport const CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL = Symbol(\n CLIENT_STATIC_FILES_RUNTIME_POLYFILLS\n)\nexport const DEFAULT_RUNTIME_WEBPACK = 'webpack-runtime'\nexport const EDGE_RUNTIME_WEBPACK = 'edge-runtime-webpack'\nexport const STATIC_PROPS_ID = '__N_SSG'\nexport const SERVER_PROPS_ID = '__N_SSP'\nexport const DEFAULT_SERIF_FONT = {\n name: 'Times New Roman',\n xAvgCharWidth: 821,\n azAvgWidth: 854.3953488372093,\n unitsPerEm: 2048,\n}\nexport const DEFAULT_SANS_SERIF_FONT = {\n name: 'Arial',\n xAvgCharWidth: 904,\n azAvgWidth: 934.5116279069767,\n unitsPerEm: 2048,\n}\nexport const STATIC_STATUS_PAGES = ['/500']\nexport const TRACE_OUTPUT_VERSION = 1\n// in `MB`\nexport const TURBO_TRACE_DEFAULT_MEMORY_LIMIT = 6000\n\nexport const RSC_MODULE_TYPES = {\n client: 'client',\n server: 'server',\n} as const\n\n// comparing\n// https://nextjs.org/docs/api-reference/edge-runtime\n// with\n// https://nodejs.org/docs/latest/api/globals.html\nexport const EDGE_UNSUPPORTED_NODE_APIS = [\n 'clearImmediate',\n 'setImmediate',\n 'BroadcastChannel',\n 'ByteLengthQueuingStrategy',\n 'CompressionStream',\n 'CountQueuingStrategy',\n 'DecompressionStream',\n 'DomException',\n 'MessageChannel',\n 'MessageEvent',\n 'MessagePort',\n 'ReadableByteStreamController',\n 'ReadableStreamBYOBRequest',\n 'ReadableStreamDefaultController',\n 'TransformStreamDefaultController',\n 'WritableStreamDefaultController',\n]\n\nexport const SYSTEM_ENTRYPOINTS = new Set([\n CLIENT_STATIC_FILES_RUNTIME_MAIN,\n CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH,\n CLIENT_STATIC_FILES_RUNTIME_MAIN_APP,\n])\n"],"names":["MODERN_BROWSERSLIST_TARGET","COMPILER_NAMES","client","server","edgeServer","COMPILER_INDEXES","UNDERSCORE_NOT_FOUND_ROUTE","UNDERSCORE_NOT_FOUND_ROUTE_ENTRY","UNDERSCORE_GLOBAL_ERROR_ROUTE","UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY","AdapterOutputType","PHASE_EXPORT","PHASE_ANALYZE","PHASE_PRODUCTION_BUILD","PHASE_PRODUCTION_SERVER","PHASE_DEVELOPMENT_SERVER","PHASE_TEST","PHASE_INFO","PAGES_MANIFEST","APP_PATHS_MANIFEST","APP_PATH_ROUTES_MANIFEST","BUILD_MANIFEST","FUNCTIONS_CONFIG_MANIFEST","SUBRESOURCE_INTEGRITY_MANIFEST","NEXT_FONT_MANIFEST","EXPORT_MARKER","EXPORT_DETAIL","PRERENDER_MANIFEST","PREFETCH_HINTS","PREVIEW_PROPS_MANIFEST","ROUTES_MANIFEST","IMAGES_MANIFEST","SERVER_FILES_MANIFEST","DEV_CLIENT_PAGES_MANIFEST","REQUEST_INSIGHTS_DEV_ENDPOINT","MIDDLEWARE_MANIFEST","TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST","TURBOPACK_CLIENT_BUILD_MANIFEST","DEV_CLIENT_MIDDLEWARE_MANIFEST","REACT_LOADABLE_MANIFEST","SERVER_DIRECTORY","CONFIG_FILES","process","features","typescript","BUILD_ID_FILE","BLOCKED_PAGES","CLIENT_PUBLIC_FILES_PATH","CLIENT_STATIC_FILES_PATH","STRING_LITERAL_DROP_BUNDLE","NEXT_BUILTIN_DOCUMENT","BARREL_OPTIMIZATION_PREFIX","CLIENT_REFERENCE_MANIFEST","SERVER_REFERENCE_MANIFEST","MIDDLEWARE_BUILD_MANIFEST","MIDDLEWARE_REACT_LOADABLE_MANIFEST","INTERCEPTION_ROUTE_REWRITE_MANIFEST","DYNAMIC_CSS_MANIFEST","CLIENT_STATIC_FILES_RUNTIME_MAIN","CLIENT_STATIC_FILES_RUNTIME_MAIN_APP","APP_CLIENT_INTERNALS","CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH","CLIENT_STATIC_FILES_RUNTIME_WEBPACK","CLIENT_STATIC_FILES_RUNTIME_POLYFILLS","CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL","Symbol","DEFAULT_RUNTIME_WEBPACK","EDGE_RUNTIME_WEBPACK","STATIC_PROPS_ID","SERVER_PROPS_ID","DEFAULT_SERIF_FONT","name","xAvgCharWidth","azAvgWidth","unitsPerEm","DEFAULT_SANS_SERIF_FONT","STATIC_STATUS_PAGES","TRACE_OUTPUT_VERSION","TURBO_TRACE_DEFAULT_MEMORY_LIMIT","RSC_MODULE_TYPES","EDGE_UNSUPPORTED_NODE_APIS","SYSTEM_ENTRYPOINTS","Set"],"mappings":"AAAA,OAAOA,gCAAgC,+BAA8B;AAErE,SAASA,0BAA0B,GAAE;AAIrC,OAAO,MAAMC,iBAAiB;IAC5BC,QAAQ;IACRC,QAAQ;IACRC,YAAY;AACd,EAAU;AAIV,OAAO,MAAMC,mBAET;IACF,CAACJ,eAAeC,MAAM,CAAC,EAAE;IACzB,CAACD,eAAeE,MAAM,CAAC,EAAE;IACzB,CAACF,eAAeG,UAAU,CAAC,EAAE;AAC/B,EAAU;AAEV,uDAAuD;AACvD,SACEE,0BAA0B,EAC1BC,gCAAgC,EAChCC,6BAA6B,EAC7BC,mCAAmC,QAC9B,oBAAmB;AAE1B,OAAO,IAAA,AAAKC,2CAAAA;IACV;;GAEC;IAGD;;GAEC;IAED;;;GAGC;IAGD;;;GAGC;IAGD;;;GAGC;IAGD;;GAEC;IAGD;;GAEC;WAnCSA;MAqCX;AAED,OAAO,MAAMC,eAAe,eAAc;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Y;AACd,EAAC;AACD,OAAO,MAAME,sBAAsB;IAAC;CAAO,CAAA;AAC3C,OAAO,MAAMC,uBAAuB,EAAC;AACrC,UAAU;AACV,OAAO,MAAMC,mCAAmC,KAAI;AAEpD,OAAO,MAAMC,mBAAmB;IAC9B7E,QAAQ;IACRC,QAAQ;AACV,EAAU;AAEV,YAAY;AACZ,qDAAqD;AACrD,OAAO;AACP,kDAAkD;AAClD,OAAO,MAAM6E,6BAA6B;IACxC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED,OAAO,MAAMC,qBAAqB,IAAIC,IAAY;IAChDxB;IACAG;IACAF;CACD,EAAC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/deep-freeze.js b/e-commerce/node_modules/next/dist/esm/shared/lib/deep-freeze.js new file mode 100644 index 0000000000000000000000000000000000000000..458a2db0d6791e090acce7f955d7a0fc970bcbfe --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/deep-freeze.js @@ -0,0 +1,27 @@ +/** + * Recursively freezes an object and all of its properties. This prevents the + * object from being modified at runtime. When the JS runtime is running in + * strict mode, any attempts to modify a frozen object will throw an error. + * + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze + * @param obj The object to freeze. + */ export function deepFreeze(obj) { + // If the object is already frozen, there's no need to freeze it again. + if (Object.isFrozen(obj)) return obj; + // An array is an object, but we also want to freeze each element in the array + // as well. + if (Array.isArray(obj)) { + for (const item of obj){ + if (!item || typeof item !== 'object') continue; + deepFreeze(item); + } + return Object.freeze(obj); + } + for (const value of Object.values(obj)){ + if (!value || typeof value !== 'object') continue; + deepFreeze(value); + } + return Object.freeze(obj); +} + +//# sourceMappingURL=deep-freeze.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/deep-freeze.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/deep-freeze.js.map new file mode 100644 index 0000000000000000000000000000000000000000..13099969f75e25c9806348a0ec22396acf6cb2f8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/deep-freeze.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/deep-freeze.ts"],"sourcesContent":["import type { DeepReadonly } from './deep-readonly'\n\n/**\n * Recursively freezes an object and all of its properties. This prevents the\n * object from being modified at runtime. When the JS runtime is running in\n * strict mode, any attempts to modify a frozen object will throw an error.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze\n * @param obj The object to freeze.\n */\nexport function deepFreeze(obj: T): DeepReadonly {\n // If the object is already frozen, there's no need to freeze it again.\n if (Object.isFrozen(obj)) return obj as DeepReadonly\n\n // An array is an object, but we also want to freeze each element in the array\n // as well.\n if (Array.isArray(obj)) {\n for (const item of obj) {\n if (!item || typeof item !== 'object') continue\n deepFreeze(item)\n }\n\n return Object.freeze(obj) as DeepReadonly\n }\n\n for (const value of Object.values(obj)) {\n if (!value || typeof value !== 'object') continue\n deepFreeze(value)\n }\n\n return Object.freeze(obj) as DeepReadonly\n}\n"],"names":["deepFreeze","obj","Object","isFrozen","Array","isArray","item","freeze","value","values"],"mappings":"AAEA;;;;;;;CAOC,GACD,OAAO,SAASA,WAA6BC,GAAM;IACjD,uEAAuE;IACvE,IAAIC,OAAOC,QAAQ,CAACF,MAAM,OAAOA;IAEjC,8EAA8E;IAC9E,WAAW;IACX,IAAIG,MAAMC,OAAO,CAACJ,MAAM;QACtB,KAAK,MAAMK,QAAQL,IAAK;YACtB,IAAI,CAACK,QAAQ,OAAOA,SAAS,UAAU;YACvCN,WAAWM;QACb;QAEA,OAAOJ,OAAOK,MAAM,CAACN;IACvB;IAEA,KAAK,MAAMO,SAASN,OAAOO,MAAM,CAACR,KAAM;QACtC,IAAI,CAACO,SAAS,OAAOA,UAAU,UAAU;QACzCR,WAAWQ;IACb;IAEA,OAAON,OAAOK,MAAM,CAACN;AACvB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/deep-readonly.js b/e-commerce/node_modules/next/dist/esm/shared/lib/deep-readonly.js new file mode 100644 index 0000000000000000000000000000000000000000..63b073bf5269cb9d0c02f78d9a475b93cfc9f3a5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/deep-readonly.js @@ -0,0 +1,7 @@ +/** + * A type that represents a deeply readonly object. This is similar to + * TypeScript's `Readonly` type, but it recursively applies the `readonly` + * modifier to all properties of an object and all elements of arrays. + */ export { }; + +//# sourceMappingURL=deep-readonly.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/deep-readonly.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/deep-readonly.js.map new file mode 100644 index 0000000000000000000000000000000000000000..5e71e5601aa69256edaba32b76663c494a8fa10f --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/deep-readonly.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/deep-readonly.ts"],"sourcesContent":["/**\n * A type that represents a deeply readonly object. This is similar to\n * TypeScript's `Readonly` type, but it recursively applies the `readonly`\n * modifier to all properties of an object and all elements of arrays.\n */\nexport type DeepReadonly = T extends (infer R)[]\n ? ReadonlyArray>\n : T extends object\n ? {\n readonly [K in keyof T]: DeepReadonly\n }\n : T\n"],"names":[],"mappings":"AAAA;;;;CAIC,GACD,WAMO","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/deployment-id.js b/e-commerce/node_modules/next/dist/esm/shared/lib/deployment-id.js new file mode 100644 index 0000000000000000000000000000000000000000..2aee6fe832994cda5a50c0f406e036b1d8f4c6fb --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/deployment-id.js @@ -0,0 +1,33 @@ +let deploymentId; +if (typeof window !== 'undefined') { + deploymentId = document.documentElement.dataset.dplId; + // Immediately remove the attribute to prevent hydration errors (the dplId was inserted into the + // HTML only), React isn't aware of it at all. + document.documentElement.removeAttribute('data-dpl-id'); +} else { + // Client side: replaced with globalThis.NEXT_DEPLOYMENT_ID + // Server side: left as is or replaced with a string or replaced with false + deploymentId = process.env.NEXT_DEPLOYMENT_ID || undefined; +} +export function getDeploymentId() { + return deploymentId; +} +export function getDeploymentIdQuery(ampersand = false) { + let id = getDeploymentId(); + if (id) { + return `${ampersand ? '&' : '?'}dpl=${id}`; + } + return ''; +} +export function getAssetToken() { + return process.env.NEXT_SUPPORTS_IMMUTABLE_ASSETS ? undefined : process.env.NEXT_DEPLOYMENT_ID; +} +export function getAssetTokenQuery(ampersand = false) { + let id = getAssetToken(); + if (id) { + return `${ampersand ? '&' : '?'}dpl=${id}`; + } + return ''; +} + +//# sourceMappingURL=deployment-id.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/deployment-id.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/deployment-id.js.map new file mode 100644 index 0000000000000000000000000000000000000000..826fee266cba4069175bf3f5893ed6e40c784dcc --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/deployment-id.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/deployment-id.ts"],"sourcesContent":["let deploymentId: string | undefined\n\nif (typeof window !== 'undefined') {\n deploymentId = document.documentElement.dataset.dplId\n // Immediately remove the attribute to prevent hydration errors (the dplId was inserted into the\n // HTML only), React isn't aware of it at all.\n document.documentElement.removeAttribute('data-dpl-id')\n} else {\n // Client side: replaced with globalThis.NEXT_DEPLOYMENT_ID\n // Server side: left as is or replaced with a string or replaced with false\n deploymentId = process.env.NEXT_DEPLOYMENT_ID || undefined\n}\n\nexport function getDeploymentId(): string | undefined {\n return deploymentId\n}\n\nexport function getDeploymentIdQuery(ampersand = false): string {\n let id = getDeploymentId()\n if (id) {\n return `${ampersand ? '&' : '?'}dpl=${id}`\n }\n return ''\n}\n\nexport function getAssetToken(): string | undefined {\n return process.env.NEXT_SUPPORTS_IMMUTABLE_ASSETS\n ? undefined\n : process.env.NEXT_DEPLOYMENT_ID\n}\n\nexport function getAssetTokenQuery(ampersand = false): string {\n let id = getAssetToken()\n if (id) {\n return `${ampersand ? '&' : '?'}dpl=${id}`\n }\n return ''\n}\n"],"names":["deploymentId","window","document","documentElement","dataset","dplId","removeAttribute","process","env","NEXT_DEPLOYMENT_ID","undefined","getDeploymentId","getDeploymentIdQuery","ampersand","id","getAssetToken","NEXT_SUPPORTS_IMMUTABLE_ASSETS","getAssetTokenQuery"],"mappings":"AAAA,IAAIA;AAEJ,IAAI,OAAOC,WAAW,aAAa;IACjCD,eAAeE,SAASC,eAAe,CAACC,OAAO,CAACC,KAAK;IACrD,gGAAgG;IAChG,8CAA8C;IAC9CH,SAASC,eAAe,CAACG,eAAe,CAAC;AAC3C,OAAO;IACL,2DAA2D;IAC3D,2EAA2E;IAC3EN,eAAeO,QAAQC,GAAG,CAACC,kBAAkB,IAAIC;AACnD;AAEA,OAAO,SAASC;IACd,OAAOX;AACT;AAEA,OAAO,SAASY,qBAAqBC,YAAY,KAAK;IACpD,IAAIC,KAAKH;IACT,IAAIG,IAAI;QACN,OAAO,GAAGD,YAAY,MAAM,IAAI,IAAI,EAAEC,IAAI;IAC5C;IACA,OAAO;AACT;AAEA,OAAO,SAASC;IACd,OAAOR,QAAQC,GAAG,CAACQ,8BAA8B,GAC7CN,YACAH,QAAQC,GAAG,CAACC,kBAAkB;AACpC;AAEA,OAAO,SAASQ,mBAAmBJ,YAAY,KAAK;IAClD,IAAIC,KAAKC;IACT,IAAID,IAAI;QACN,OAAO,GAAGD,YAAY,MAAM,IAAI,IAAI,EAAEC,IAAI;IAC5C;IACA,OAAO;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/dset.d.ts b/e-commerce/node_modules/next/dist/esm/shared/lib/dset.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7883ed0fcc10d6a5cbe1196d9c83c05a17fd9c5a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/dset.d.ts @@ -0,0 +1,5 @@ +export function dset( + obj: T, + keys: string | ArrayLike, + value: V +): void diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/dset.js b/e-commerce/node_modules/next/dist/esm/shared/lib/dset.js new file mode 100644 index 0000000000000000000000000000000000000000..8d4a4f4dfa4dcac847aae603bcb63ecee06d265d --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/dset.js @@ -0,0 +1,24 @@ +/* +The MIT License (MIT) + +Copyright (c) Luke Edwards (lukeed.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ // This file is based on https://github.com/lukeed/dset/blob/v3.1.3/src/index.js +// It's been edited for the needs of this script +// See the LICENSE at the top of the file +export function dset(obj, keys, val) { + keys.split && (keys = keys.split('.')); + var i = 0, l = keys.length, t = obj, x, k; + while(i < l){ + k = keys[i++]; + if (k === '__proto__' || k === 'constructor' || k === 'prototype') break; + t = t[k] = i === l ? val : typeof (x = t[k]) === typeof keys ? x : keys[i] * 0 !== 0 || !!~('' + keys[i]).indexOf('.') ? {} : []; + } +} + +//# sourceMappingURL=dset.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/dset.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/dset.js.map new file mode 100644 index 0000000000000000000000000000000000000000..073cf9e565692be837fe9b692731cf9ae1df0f6d --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/dset.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/dset.js"],"sourcesContent":["/*\nThe MIT License (MIT)\n\nCopyright (c) Luke Edwards (lukeed.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n// This file is based on https://github.com/lukeed/dset/blob/v3.1.3/src/index.js\n// It's been edited for the needs of this script\n// See the LICENSE at the top of the file\n\nexport function dset(obj, keys, val) {\n keys.split && (keys = keys.split('.'))\n var i = 0,\n l = keys.length,\n t = obj,\n x,\n k\n while (i < l) {\n k = keys[i++]\n if (k === '__proto__' || k === 'constructor' || k === 'prototype') break\n t = t[k] =\n i === l\n ? val\n : typeof (x = t[k]) === typeof keys\n ? x\n : keys[i] * 0 !== 0 || !!~('' + keys[i]).indexOf('.')\n ? {}\n : []\n }\n}\n"],"names":["dset","obj","keys","val","split","i","l","length","t","x","k","indexOf"],"mappings":"AAAA;;;;;;;;;;AAUA,GAEA,gFAAgF;AAChF,gDAAgD;AAChD,yCAAyC;AAEzC,OAAO,SAASA,KAAKC,GAAG,EAAEC,IAAI,EAAEC,GAAG;IACjCD,KAAKE,KAAK,IAAKF,CAAAA,OAAOA,KAAKE,KAAK,CAAC,IAAG;IACpC,IAAIC,IAAI,GACNC,IAAIJ,KAAKK,MAAM,EACfC,IAAIP,KACJQ,GACAC;IACF,MAAOL,IAAIC,EAAG;QACZI,IAAIR,IAAI,CAACG,IAAI;QACb,IAAIK,MAAM,eAAeA,MAAM,iBAAiBA,MAAM,aAAa;QACnEF,IAAIA,CAAC,CAACE,EAAE,GACNL,MAAMC,IACFH,MACA,OAAQM,CAAAA,IAAID,CAAC,CAACE,EAAE,AAAD,MAAO,OAAOR,OAC3BO,IACAP,IAAI,CAACG,EAAE,GAAG,MAAM,KAAK,CAAC,CAAC,CAAC,AAAC,CAAA,KAAKH,IAAI,CAACG,EAAE,AAAD,EAAGM,OAAO,CAAC,OAC7C,CAAC,IACD,EAAE;IACd;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/dynamic.js b/e-commerce/node_modules/next/dist/esm/shared/lib/dynamic.js new file mode 100644 index 0000000000000000000000000000000000000000..df0f9137b814ae5d27f02a984aa9799545327432 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/dynamic.js @@ -0,0 +1,101 @@ +import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; +import React from 'react'; +import Loadable from './loadable.shared-runtime'; +const isServerSide = typeof window === 'undefined'; +// Normalize loader to return the module as form { default: Component } for `React.lazy`. +// Also for backward compatible since next/dynamic allows to resolve a component directly with loader +// Client component reference proxy need to be converted to a module. +function convertModule(mod) { + return { + default: mod?.default || mod + }; +} +export function noSSR(LoadableInitializer, loadableOptions) { + // Removing webpack and modules means react-loadable won't try preloading + delete loadableOptions.webpack; + delete loadableOptions.modules; + // This check is necessary to prevent react-loadable from initializing on the server + if (!isServerSide) { + return LoadableInitializer(loadableOptions); + } + const Loading = loadableOptions.loading; + // This will only be rendered on the server side + return ()=>/*#__PURE__*/ _jsx(Loading, { + error: null, + isLoading: true, + pastDelay: false, + timedOut: false + }); +} +/** + * This function lets you dynamically import a component. + * It uses [React.lazy()](https://react.dev/reference/react/lazy) with [Suspense](https://react.dev/reference/react/Suspense) under the hood. + * + * Read more: [Next.js Docs: `next/dynamic`](https://nextjs.org/docs/app/building-your-application/optimizing/lazy-loading#nextdynamic) + */ export default function dynamic(dynamicOptions, options) { + let loadableFn = Loadable; + let loadableOptions = { + // A loading component is not required, so we default it + loading: ({ error, isLoading, pastDelay })=>{ + if (!pastDelay) return null; + if (process.env.NODE_ENV !== 'production') { + if (isLoading) { + return null; + } + if (error) { + return /*#__PURE__*/ _jsxs("p", { + children: [ + error.message, + /*#__PURE__*/ _jsx("br", {}), + error.stack + ] + }); + } + } + return null; + } + }; + // Support for direct import(), eg: dynamic(import('../hello-world')) + // Note that this is only kept for the edge case where someone is passing in a promise as first argument + // The react-loadable babel plugin will turn dynamic(import('../hello-world')) into dynamic(() => import('../hello-world')) + // To make sure we don't execute the import without rendering first + if (dynamicOptions instanceof Promise) { + loadableOptions.loader = ()=>dynamicOptions; + // Support for having import as a function, eg: dynamic(() => import('../hello-world')) + } else if (typeof dynamicOptions === 'function') { + loadableOptions.loader = dynamicOptions; + // Support for having first argument being options, eg: dynamic({loader: import('../hello-world')}) + } else if (typeof dynamicOptions === 'object') { + loadableOptions = { + ...loadableOptions, + ...dynamicOptions + }; + } + // Support for passing options, eg: dynamic(import('../hello-world'), {loading: () =>

Loading something

}) + loadableOptions = { + ...loadableOptions, + ...options + }; + const loaderFn = loadableOptions.loader; + const loader = ()=>loaderFn != null ? loaderFn().then(convertModule) : Promise.resolve(convertModule(()=>null)); + // coming from build/babel/plugins/react-loadable-plugin.js + if (loadableOptions.loadableGenerated) { + loadableOptions = { + ...loadableOptions, + ...loadableOptions.loadableGenerated + }; + delete loadableOptions.loadableGenerated; + } + // support for disabling server side rendering, eg: dynamic(() => import('../hello-world'), {ssr: false}). + if (typeof loadableOptions.ssr === 'boolean' && !loadableOptions.ssr) { + delete loadableOptions.webpack; + delete loadableOptions.modules; + return noSSR(loadableFn, loadableOptions); + } + return loadableFn({ + ...loadableOptions, + loader: loader + }); +} + +//# sourceMappingURL=dynamic.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/dynamic.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/dynamic.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7a3dea32b1c7e6250cd90348dacbbf1ad88d9aef --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/dynamic.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/dynamic.tsx"],"sourcesContent":["import React from 'react'\nimport Loadable from './loadable.shared-runtime'\n\nconst isServerSide = typeof window === 'undefined'\n\ntype ComponentModule

= { default: React.ComponentType

}\n\nexport declare type LoaderComponent

= Promise<\n React.ComponentType

| ComponentModule

\n>\n\nexport declare type Loader

=\n | (() => LoaderComponent

)\n | LoaderComponent

\n\nexport type LoaderMap = { [module: string]: () => Loader }\n\nexport type LoadableGeneratedOptions = {\n webpack?(): any\n modules?(): LoaderMap\n}\n\nexport type DynamicOptionsLoadingProps = {\n error?: Error | null\n isLoading?: boolean\n pastDelay?: boolean\n retry?: () => void\n timedOut?: boolean\n}\n\n// Normalize loader to return the module as form { default: Component } for `React.lazy`.\n// Also for backward compatible since next/dynamic allows to resolve a component directly with loader\n// Client component reference proxy need to be converted to a module.\nfunction convertModule

(mod: React.ComponentType

| ComponentModule

) {\n return { default: (mod as ComponentModule

)?.default || mod }\n}\n\nexport type DynamicOptions

= LoadableGeneratedOptions & {\n loading?: (loadingProps: DynamicOptionsLoadingProps) => React.ReactNode\n loader?: Loader

| LoaderMap\n loadableGenerated?: LoadableGeneratedOptions\n ssr?: boolean\n}\n\nexport type LoadableOptions

= DynamicOptions

\n\nexport type LoadableFn

= (\n opts: LoadableOptions

\n) => React.ComponentType

\n\nexport type LoadableComponent

= React.ComponentType

\n\nexport function noSSR

(\n LoadableInitializer: LoadableFn

,\n loadableOptions: DynamicOptions

\n): React.ComponentType

{\n // Removing webpack and modules means react-loadable won't try preloading\n delete loadableOptions.webpack\n delete loadableOptions.modules\n\n // This check is necessary to prevent react-loadable from initializing on the server\n if (!isServerSide) {\n return LoadableInitializer(loadableOptions)\n }\n\n const Loading = loadableOptions.loading!\n // This will only be rendered on the server side\n return () => (\n \n )\n}\n\n/**\n * This function lets you dynamically import a component.\n * It uses [React.lazy()](https://react.dev/reference/react/lazy) with [Suspense](https://react.dev/reference/react/Suspense) under the hood.\n *\n * Read more: [Next.js Docs: `next/dynamic`](https://nextjs.org/docs/app/building-your-application/optimizing/lazy-loading#nextdynamic)\n */\nexport default function dynamic

(\n dynamicOptions: DynamicOptions

| Loader

,\n options?: DynamicOptions

\n): React.ComponentType

{\n let loadableFn = Loadable as LoadableFn

\n\n let loadableOptions: LoadableOptions

= {\n // A loading component is not required, so we default it\n loading: ({ error, isLoading, pastDelay }) => {\n if (!pastDelay) return null\n if (process.env.NODE_ENV !== 'production') {\n if (isLoading) {\n return null\n }\n if (error) {\n return (\n

\n {error.message}\n
\n {error.stack}\n

\n )\n }\n }\n return null\n },\n }\n\n // Support for direct import(), eg: dynamic(import('../hello-world'))\n // Note that this is only kept for the edge case where someone is passing in a promise as first argument\n // The react-loadable babel plugin will turn dynamic(import('../hello-world')) into dynamic(() => import('../hello-world'))\n // To make sure we don't execute the import without rendering first\n if (dynamicOptions instanceof Promise) {\n loadableOptions.loader = () => dynamicOptions\n // Support for having import as a function, eg: dynamic(() => import('../hello-world'))\n } else if (typeof dynamicOptions === 'function') {\n loadableOptions.loader = dynamicOptions\n // Support for having first argument being options, eg: dynamic({loader: import('../hello-world')})\n } else if (typeof dynamicOptions === 'object') {\n loadableOptions = { ...loadableOptions, ...dynamicOptions }\n }\n\n // Support for passing options, eg: dynamic(import('../hello-world'), {loading: () =>

Loading something

})\n loadableOptions = { ...loadableOptions, ...options }\n\n const loaderFn = loadableOptions.loader as () => LoaderComponent

\n const loader = () =>\n loaderFn != null\n ? loaderFn().then(convertModule)\n : Promise.resolve(convertModule(() => null))\n\n // coming from build/babel/plugins/react-loadable-plugin.js\n if (loadableOptions.loadableGenerated) {\n loadableOptions = {\n ...loadableOptions,\n ...loadableOptions.loadableGenerated,\n }\n delete loadableOptions.loadableGenerated\n }\n\n // support for disabling server side rendering, eg: dynamic(() => import('../hello-world'), {ssr: false}).\n if (typeof loadableOptions.ssr === 'boolean' && !loadableOptions.ssr) {\n delete loadableOptions.webpack\n delete loadableOptions.modules\n\n return noSSR(loadableFn, loadableOptions)\n }\n\n return loadableFn({ ...loadableOptions, loader: loader as Loader

})\n}\n"],"names":["React","Loadable","isServerSide","window","convertModule","mod","default","noSSR","LoadableInitializer","loadableOptions","webpack","modules","Loading","loading","error","isLoading","pastDelay","timedOut","dynamic","dynamicOptions","options","loadableFn","process","env","NODE_ENV","p","message","br","stack","Promise","loader","loaderFn","then","resolve","loadableGenerated","ssr"],"mappings":";AAAA,OAAOA,WAAW,QAAO;AACzB,OAAOC,cAAc,4BAA2B;AAEhD,MAAMC,eAAe,OAAOC,WAAW;AA2BvC,yFAAyF;AACzF,qGAAqG;AACrG,qEAAqE;AACrE,SAASC,cAAiBC,GAAgD;IACxE,OAAO;QAAEC,SAAS,AAACD,KAA4BC,WAAWD;IAAI;AAChE;AAiBA,OAAO,SAASE,MACdC,mBAAkC,EAClCC,eAAkC;IAElC,yEAAyE;IACzE,OAAOA,gBAAgBC,OAAO;IAC9B,OAAOD,gBAAgBE,OAAO;IAE9B,oFA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AE;QACrCzB,kBAAkB;YAChB,GAAGA,eAAe;YAClB,GAAGA,gBAAgByB,iBAAiB;QACtC;QACA,OAAOzB,gBAAgByB,iBAAiB;IAC1C;IAEA,0GAA0G;IAC1G,IAAI,OAAOzB,gBAAgB0B,GAAG,KAAK,aAAa,CAAC1B,gBAAgB0B,GAAG,EAAE;QACpE,OAAO1B,gBAAgBC,OAAO;QAC9B,OAAOD,gBAAgBE,OAAO;QAE9B,OAAOJ,MAAMc,YAAYZ;IAC3B;IAEA,OAAOY,WAAW;QAAE,GAAGZ,eAAe;QAAEqB,QAAQA;IAAoB;AACtE","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/encode-uri-path.js b/e-commerce/node_modules/next/dist/esm/shared/lib/encode-uri-path.js new file mode 100644 index 0000000000000000000000000000000000000000..757a6e058be9c5997a1f9bc770716e462d3adcb8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/encode-uri-path.js @@ -0,0 +1,5 @@ +export function encodeURIPath(file) { + return file.split('/').map((p)=>encodeURIComponent(p)).join('/'); +} + +//# sourceMappingURL=encode-uri-path.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/encode-uri-path.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/encode-uri-path.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f182fee0e8f3d3b463d0e77f43a374c11264561c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/encode-uri-path.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/encode-uri-path.ts"],"sourcesContent":["export function encodeURIPath(file: string) {\n return file\n .split('/')\n .map((p) => encodeURIComponent(p))\n .join('/')\n}\n"],"names":["encodeURIPath","file","split","map","p","encodeURIComponent","join"],"mappings":"AAAA,OAAO,SAASA,cAAcC,IAAY;IACxC,OAAOA,KACJC,KAAK,CAAC,KACNC,GAAG,CAAC,CAACC,IAAMC,mBAAmBD,IAC9BE,IAAI,CAAC;AACV","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/entry-constants.js b/e-commerce/node_modules/next/dist/esm/shared/lib/entry-constants.js new file mode 100644 index 0000000000000000000000000000000000000000..4561c0151799fbd5045fbc92297d6d3be5068cfd --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/entry-constants.js @@ -0,0 +1,6 @@ +export const UNDERSCORE_NOT_FOUND_ROUTE = '/_not-found'; +export const UNDERSCORE_NOT_FOUND_ROUTE_ENTRY = `${UNDERSCORE_NOT_FOUND_ROUTE}/page`; +export const UNDERSCORE_GLOBAL_ERROR_ROUTE = '/_global-error'; +export const UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY = `${UNDERSCORE_GLOBAL_ERROR_ROUTE}/page`; + +//# sourceMappingURL=entry-constants.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/entry-constants.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/entry-constants.js.map new file mode 100644 index 0000000000000000000000000000000000000000..8ffdb019562671cdcd7221d36f0bd754d33fa1ef --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/entry-constants.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/entry-constants.ts"],"sourcesContent":["export const UNDERSCORE_NOT_FOUND_ROUTE = '/_not-found'\nexport const UNDERSCORE_NOT_FOUND_ROUTE_ENTRY = `${UNDERSCORE_NOT_FOUND_ROUTE}/page`\nexport const UNDERSCORE_GLOBAL_ERROR_ROUTE = '/_global-error'\nexport const UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY = `${UNDERSCORE_GLOBAL_ERROR_ROUTE}/page`\n"],"names":["UNDERSCORE_NOT_FOUND_ROUTE","UNDERSCORE_NOT_FOUND_ROUTE_ENTRY","UNDERSCORE_GLOBAL_ERROR_ROUTE","UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY"],"mappings":"AAAA,OAAO,MAAMA,6BAA6B,cAAa;AACvD,OAAO,MAAMC,mCAAmC,GAAGD,2BAA2B,KAAK,CAAC,CAAA;AACpF,OAAO,MAAME,gCAAgC,iBAAgB;AAC7D,OAAO,MAAMC,sCAAsC,GAAGD,8BAA8B,KAAK,CAAC,CAAA","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/error-source.js b/e-commerce/node_modules/next/dist/esm/shared/lib/error-source.js new file mode 100644 index 0000000000000000000000000000000000000000..ab3b3ca4768f82f34fbc6e6569696ed862413558 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/error-source.js @@ -0,0 +1,14 @@ +const symbolError = Symbol.for('NextjsError'); +export function getErrorSource(error) { + return error[symbolError] || null; +} +export function decorateServerError(error, type) { + Object.defineProperty(error, symbolError, { + writable: false, + enumerable: false, + configurable: false, + value: type + }); +} + +//# sourceMappingURL=error-source.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/error-source.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/error-source.js.map new file mode 100644 index 0000000000000000000000000000000000000000..8076f31fdb360ff54992c8dc1f267a31459b2f6e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/error-source.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/error-source.ts"],"sourcesContent":["const symbolError = Symbol.for('NextjsError')\n\nexport function getErrorSource(error: Error): 'server' | 'edge-server' | null {\n return (error as any)[symbolError] || null\n}\n\nexport type ErrorSourceType = 'edge-server' | 'server'\n\nexport function decorateServerError(error: Error, type: ErrorSourceType) {\n Object.defineProperty(error, symbolError, {\n writable: false,\n enumerable: false,\n configurable: false,\n value: type,\n })\n}\n"],"names":["symbolError","Symbol","for","getErrorSource","error","decorateServerError","type","Object","defineProperty","writable","enumerable","configurable","value"],"mappings":"AAAA,MAAMA,cAAcC,OAAOC,GAAG,CAAC;AAE/B,OAAO,SAASC,eAAeC,KAAY;IACzC,OAAO,AAACA,KAAa,CAACJ,YAAY,IAAI;AACxC;AAIA,OAAO,SAASK,oBAAoBD,KAAY,EAAEE,IAAqB;IACrEC,OAAOC,cAAc,CAACJ,OAAOJ,aAAa;QACxCS,UAAU;QACVC,YAAY;QACZC,cAAc;QACdC,OAAON;IACT;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/canary-only-config-error.js b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/canary-only-config-error.js new file mode 100644 index 0000000000000000000000000000000000000000..ab7fd2d4fcb17f65bd4ca44c49feb8a959a1c3c7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/canary-only-config-error.js @@ -0,0 +1,22 @@ +export function isStableBuild() { + const nextVersion = "16.4.0"; + return !nextVersion?.includes('canary') && // Commit preview tarballs (e.g. `16.4.0-preview-84cee7e6-20260917`, see + // scripts/set-preview-version.js) are built from arbitrary canary commits, + // so they are not stable. Numbered preview releases published to npm + // (e.g. `16.3.0-preview.10`) are stable. + !nextVersion?.includes('-preview-') && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV; +} +export class CanaryOnlyConfigError extends Error { + constructor(arg){ + if (typeof arg === 'object' && 'feature' in arg) { + super(`The experimental feature "${arg.feature}" can only be enabled when using the latest canary version of Next.js.`); + } else { + super(arg); + } + // This error is meant to interrupt the server start/build process + // but the stack trace isn't meaningful, as it points to internal code. + this.stack = undefined; + } +} + +//# sourceMappingURL=canary-only-config-error.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/canary-only-config-error.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/canary-only-config-error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..5fac5956dc9b3d262a286aab2071bc97887a9853 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/canary-only-config-error.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/errors/canary-only-config-error.ts"],"sourcesContent":["export function isStableBuild() {\n const nextVersion = process.env.__NEXT_VERSION\n return (\n !nextVersion?.includes('canary') &&\n // Commit preview tarballs (e.g. `16.4.0-preview-84cee7e6-20260917`, see\n // scripts/set-preview-version.js) are built from arbitrary canary commits,\n // so they are not stable. Numbered preview releases published to npm\n // (e.g. `16.3.0-preview.10`) are stable.\n !nextVersion?.includes('-preview-') &&\n !process.env.__NEXT_TEST_MODE &&\n !process.env.NEXT_PRIVATE_LOCAL_DEV\n )\n}\n\nexport class CanaryOnlyConfigError extends Error {\n constructor(arg: { feature: string } | string) {\n if (typeof arg === 'object' && 'feature' in arg) {\n super(\n `The experimental feature \"${arg.feature}\" can only be enabled when using the latest canary version of Next.js.`\n )\n } else {\n super(arg)\n }\n\n // This error is meant to interrupt the server start/build process\n // but the stack trace isn't meaningful, as it points to internal code.\n this.stack = undefined\n }\n}\n"],"names":["isStableBuild","nextVersion","process","env","__NEXT_VERSION","includes","__NEXT_TEST_MODE","NEXT_PRIVATE_LOCAL_DEV","CanaryOnlyConfigError","Error","constructor","arg","feature","stack","undefined"],"mappings":"AAAA,OAAO,SAASA;IACd,MAAMC,cAAcC,QAAQC,GAAG,CAACC,cAAc;IAC9C,OACE,CAACH,aAAaI,SAAS,aACvB,wEAAwE;IACxE,2EAA2E;IAC3E,qEAAqE;IACrE,yCAAyC;IACzC,CAACJ,aAAaI,SAAS,gBACvB,CAACH,QAAQC,GAAG,CAACG,gBAAgB,IAC7B,CAACJ,QAAQC,GAAG,CAACI,sBAAsB;AAEvC;AAEA,OAAO,MAAMC,8BAA8BC;IACzCC,YAAYC,GAAiC,CAAE;QAC7C,IAAI,OAAOA,QAAQ,YAAY,aAAaA,KAAK;YAC/C,KAAK,CACH,CAAC,0BAA0B,EAAEA,IAAIC,OAAO,CAAC,sEAAsE,CAAC;QAEpH,OAAO;YACL,KAAK,CAACD;QACR;QAEA,kEAAkE;QAClE,uEAAuE;QACvE,IAAI,CAACE,KAAK,GAAGC;IACf;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/code-frame.js b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/code-frame.js new file mode 100644 index 0000000000000000000000000000000000000000..14c9114db11ea280148d674171e1099f23919886 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/code-frame.js @@ -0,0 +1,14 @@ +import { getBindingsSync } from '../../../build/swc'; +/** + * Renders a code frame showing the location of an error in source code. + * Requires native bindings to be installed — throws otherwise. + */ export function codeFrameColumns(file, location, options = {}) { + // Default to the terminal width. The CLI passes it on when it pipes this + // process's output for the upgrade menu. + if (options.maxWidth === undefined) { + options.maxWidth = process.stdout.columns ?? (Number(process.env.NEXT_PRIVATE_TERMINAL_COLUMNS) || undefined); + } + return getBindingsSync().codeFrameColumns(file, location, options); +} + +//# sourceMappingURL=code-frame.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/code-frame.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/code-frame.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d5326a5026f09c6daac5a728f92d9c59d82ab8d3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/code-frame.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/errors/code-frame.ts"],"sourcesContent":["import { getBindingsSync } from '../../../build/swc'\nimport type {\n NapiCodeFrameLocation,\n NapiCodeFrameOptions,\n} from '../../../build/swc/generated-native'\n\n/**\n * Renders a code frame showing the location of an error in source code.\n * Requires native bindings to be installed — throws otherwise.\n */\nexport function codeFrameColumns(\n file: string,\n location: NapiCodeFrameLocation,\n options: NapiCodeFrameOptions = {}\n): string | undefined {\n // Default to the terminal width. The CLI passes it on when it pipes this\n // process's output for the upgrade menu.\n if (options.maxWidth === undefined) {\n options.maxWidth =\n process.stdout.columns ??\n (Number(process.env.NEXT_PRIVATE_TERMINAL_COLUMNS) || undefined)\n }\n return getBindingsSync().codeFrameColumns(file, location, options)\n}\n\nexport type { NapiCodeFrameLocation, NapiCodeFrameOptions }\n"],"names":["getBindingsSync","codeFrameColumns","file","location","options","maxWidth","undefined","process","stdout","columns","Number","env","NEXT_PRIVATE_TERMINAL_COLUMNS"],"mappings":"AAAA,SAASA,eAAe,QAAQ,qBAAoB;AAMpD;;;CAGC,GACD,OAAO,SAASC,iBACdC,IAAY,EACZC,QAA+B,EAC/BC,UAAgC,CAAC,CAAC;IAElC,yEAAyE;IACzE,yCAAyC;IACzC,IAAIA,QAAQC,QAAQ,KAAKC,WAAW;QAClCF,QAAQC,QAAQ,GACdE,QAAQC,MAAM,CAACC,OAAO,IACrBC,CAAAA,OAAOH,QAAQI,GAAG,CAACC,6BAA6B,KAAKN,SAAQ;IAClE;IACA,OAAON,kBAAkBC,gBAAgB,CAACC,MAAMC,UAAUC;AAC5D","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/constants.js b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/constants.js new file mode 100644 index 0000000000000000000000000000000000000000..dc88e2cb89460ddfd345329dab28ae38a7ab7eb0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/constants.js @@ -0,0 +1,3 @@ +export const MISSING_ROOT_TAGS_ERROR = 'NEXT_MISSING_ROOT_TAGS'; + +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/constants.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/constants.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3e490bf638280865a0f51e43fe8ffd81069955cd --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/constants.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/errors/constants.ts"],"sourcesContent":["export const MISSING_ROOT_TAGS_ERROR = 'NEXT_MISSING_ROOT_TAGS'\n"],"names":["MISSING_ROOT_TAGS_ERROR"],"mappings":"AAAA,OAAO,MAAMA,0BAA0B,yBAAwB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/empty-generate-static-params-error.js b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/empty-generate-static-params-error.js new file mode 100644 index 0000000000000000000000000000000000000000..d5b81cb86b57cc059ff16f307fe0358ac3f7ddf2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/empty-generate-static-params-error.js @@ -0,0 +1,17 @@ +export function throwEmptyGenerateStaticParamsError(// Compiler-injected factory whose error stack is anchored at the user's +// `generateStaticParams`. The transform injects it for every app page that +// exports `generateStaticParams` by a statically-visible name, but a few +// forms can't be detected from the page module alone (e.g. `export *` +// re-exports), so it may be absent. +createError) { + if (createError) { + throw createError(); + } + // Fallback for the rare case the compiler couldn't inject an anchored factory + // (e.g. a wildcard re-export). The stack points at framework internals, but + // we keep it: those frames are ignore-listed in the output and stay available + // for debugging. + throw new Error('When using Cache Components, all `generateStaticParams` functions must return at least one result. ' + 'This is to ensure that we can perform build-time validation that there is no other dynamic accesses that would cause a runtime error.\n\n' + 'Learn more: https://nextjs.org/docs/messages/empty-generate-static-params'); +} + +//# sourceMappingURL=empty-generate-static-params-error.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/empty-generate-static-params-error.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/empty-generate-static-params-error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..cacc1b1990a774bfa0080f5eb7e7891a97e82acf --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/empty-generate-static-params-error.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/errors/empty-generate-static-params-error.ts"],"sourcesContent":["export function throwEmptyGenerateStaticParamsError(\n // Compiler-injected factory whose error stack is anchored at the user's\n // `generateStaticParams`. The transform injects it for every app page that\n // exports `generateStaticParams` by a statically-visible name, but a few\n // forms can't be detected from the page module alone (e.g. `export *`\n // re-exports), so it may be absent.\n createError: (() => Error) | undefined\n): never {\n if (createError) {\n throw createError()\n }\n\n // Fallback for the rare case the compiler couldn't inject an anchored factory\n // (e.g. a wildcard re-export). The stack points at framework internals, but\n // we keep it: those frames are ignore-listed in the output and stay available\n // for debugging.\n throw new Error(\n 'When using Cache Components, all `generateStaticParams` functions must return at least one result. ' +\n 'This is to ensure that we can perform build-time validation that there is no other dynamic accesses that would cause a runtime error.\\n\\n' +\n 'Learn more: https://nextjs.org/docs/messages/empty-generate-static-params'\n )\n}\n"],"names":["throwEmptyGenerateStaticParamsError","createError","Error"],"mappings":"AAAA,OAAO,SAASA,oCACd,wEAAwE;AACxE,2EAA2E;AAC3E,yEAAyE;AACzE,sEAAsE;AACtE,oCAAoC;AACpCC,WAAsC;IAEtC,IAAIA,aAAa;QACf,MAAMA;IACR;IAEA,8EAA8E;IAC9E,4EAA4E;IAC5E,8EAA8E;IAC9E,iBAAiB;IACjB,MAAM,IAAIC,MACR,wGACE,8IACA;AAEN","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/ensure-static-gsp-errors.js b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/ensure-static-gsp-errors.js new file mode 100644 index 0000000000000000000000000000000000000000..daf669bc139d82c1801dcd5d23c8d24c1560efdc --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/ensure-static-gsp-errors.js @@ -0,0 +1,8 @@ +export function throwMissingGspErrorInStaticRoute(page) { + throw new Error(`Page "${page}": \`ensureStatic = "navigation"\` requires an exported \`generateStaticParams()\` function.\nLearn more: https://nextjs.org/docs/messages/generate-static-params#with-ensurestatic`); +} +export function throwIncompleteStaticParamsErrorInStaticRoute(page, missingParamNames) { + throw new Error(`Page "${page}": \`generateStaticParams()\` returned incomplete params. Routes using \`ensureStatic = "navigation"\` must return every dynamic route parameter. Missing: ${missingParamNames.map((name)=>`"${name}"`).join(', ')}.\nLearn more: https://nextjs.org/docs/messages/generate-static-params#with-ensurestatic`); +} + +//# sourceMappingURL=ensure-static-gsp-errors.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/ensure-static-gsp-errors.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/ensure-static-gsp-errors.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d6e311839ec04cc575964c5e22f35c7b592687d6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/ensure-static-gsp-errors.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/errors/ensure-static-gsp-errors.ts"],"sourcesContent":["export function throwMissingGspErrorInStaticRoute(page: string) {\n throw new Error(\n `Page \"${page}\": \\`ensureStatic = \"navigation\"\\` requires an exported \\`generateStaticParams()\\` function.\\nLearn more: https://nextjs.org/docs/messages/generate-static-params#with-ensurestatic`\n )\n}\n\nexport function throwIncompleteStaticParamsErrorInStaticRoute(\n page: string,\n missingParamNames: string[]\n) {\n throw new Error(\n `Page \"${page}\": \\`generateStaticParams()\\` returned incomplete params. Routes using \\`ensureStatic = \"navigation\"\\` must return every dynamic route parameter. Missing: ${missingParamNames.map((name) => `\"${name}\"`).join(', ')}.\\nLearn more: https://nextjs.org/docs/messages/generate-static-params#with-ensurestatic`\n )\n}\n"],"names":["throwMissingGspErrorInStaticRoute","page","Error","throwIncompleteStaticParamsErrorInStaticRoute","missingParamNames","map","name","join"],"mappings":"AAAA,OAAO,SAASA,kCAAkCC,IAAY;IAC5D,MAAM,IAAIC,MACR,CAAC,MAAM,EAAED,KAAK,mLAAmL,CAAC;AAEtM;AAEA,OAAO,SAASE,8CACdF,IAAY,EACZG,iBAA2B;IAE3B,MAAM,IAAIF,MACR,CAAC,MAAM,EAAED,KAAK,2JAA2J,EAAEG,kBAAkBC,GAAG,CAAC,CAACC,OAAS,CAAC,CAAC,EAAEA,KAAK,CAAC,CAAC,EAAEC,IAAI,CAAC,MAAM,wFAAwF,CAAC;AAEhU","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/hard-deprecated-config-error.js b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/hard-deprecated-config-error.js new file mode 100644 index 0000000000000000000000000000000000000000..155964fe206a5ad5d480923104b4f38f7fe3322a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/hard-deprecated-config-error.js @@ -0,0 +1,10 @@ +export class HardDeprecatedConfigError extends Error { + constructor(message){ + super(message); + // This error is meant to interrupt the server start/build process + // but the stack trace isn't meaningful, as it points to internal code. + this.stack = undefined; + } +} + +//# sourceMappingURL=hard-deprecated-config-error.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/hard-deprecated-config-error.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/hard-deprecated-config-error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7226ce0c54f129c56b89377d58c6c27b503db46e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/hard-deprecated-config-error.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/errors/hard-deprecated-config-error.ts"],"sourcesContent":["export class HardDeprecatedConfigError extends Error {\n constructor(message: string) {\n super(message)\n\n // This error is meant to interrupt the server start/build process\n // but the stack trace isn't meaningful, as it points to internal code.\n this.stack = undefined\n }\n}\n"],"names":["HardDeprecatedConfigError","Error","constructor","message","stack","undefined"],"mappings":"AAAA,OAAO,MAAMA,kCAAkCC;IAC7CC,YAAYC,OAAe,CAAE;QAC3B,KAAK,CAACA;QAEN,kEAAkE;QAClE,uEAAuE;QACvE,IAAI,CAACC,KAAK,GAAGC;IACf;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/incompatible-parallel-route-slots-error.js b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/incompatible-parallel-route-slots-error.js new file mode 100644 index 0000000000000000000000000000000000000000..859c1b379fa3bb8ef023261e5e5d0a62ae11ef53 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/incompatible-parallel-route-slots-error.js @@ -0,0 +1,26 @@ +export class IncompatibleParallelRouteSlotsError extends Error { + constructor(routes){ + const routesByLayout = new Map(); + for (const route of routes){ + const layoutRoutes = routesByLayout.get(route.layoutFile); + if (layoutRoutes) { + layoutRoutes.push(route); + } else { + routesByLayout.set(route.layoutFile, [ + route + ]); + } + } + const formattedLayouts = [ + ...routesByLayout + ].sort(([a], [b])=>a.localeCompare(b)).map(([layoutFile, layoutRoutes])=>{ + const formattedRoutes = layoutRoutes.sort((a, b)=>a.route.localeCompare(b.route)).map(({ route, missingSlots })=>`- ${route} is missing a matching page or default.tsx in ${missingSlots.join(', ')}`).join('\n'); + return `${layoutFile}\n${formattedRoutes}`; + }).join('\n\n'); + super(`The following layouts have parallel route slots that cannot render the same URLs:\n${formattedLayouts}\n\nEvery URL matched by one slot must have a matching page or default.tsx in every sibling slot.`); + this.name = 'IncompatibleParallelRouteSlotsError'; + this.stack = undefined; + } +} + +//# sourceMappingURL=incompatible-parallel-route-slots-error.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/incompatible-parallel-route-slots-error.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/incompatible-parallel-route-slots-error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0939be83a9d2e46365eea049783fc2816224908a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/incompatible-parallel-route-slots-error.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/errors/incompatible-parallel-route-slots-error.ts"],"sourcesContent":["export type IncompatibleParallelRouteSlots = {\n layoutFile: string\n route: string\n missingSlots: readonly string[]\n}\n\nexport class IncompatibleParallelRouteSlotsError extends Error {\n constructor(routes: readonly IncompatibleParallelRouteSlots[]) {\n const routesByLayout = new Map()\n\n for (const route of routes) {\n const layoutRoutes = routesByLayout.get(route.layoutFile)\n if (layoutRoutes) {\n layoutRoutes.push(route)\n } else {\n routesByLayout.set(route.layoutFile, [route])\n }\n }\n\n const formattedLayouts = [...routesByLayout]\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([layoutFile, layoutRoutes]) => {\n const formattedRoutes = layoutRoutes\n .sort((a, b) => a.route.localeCompare(b.route))\n .map(\n ({ route, missingSlots }) =>\n `- ${route} is missing a matching page or default.tsx in ${missingSlots.join(', ')}`\n )\n .join('\\n')\n return `${layoutFile}\\n${formattedRoutes}`\n })\n .join('\\n\\n')\n\n super(\n `The following layouts have parallel route slots that cannot render the same URLs:\\n${formattedLayouts}\\n\\nEvery URL matched by one slot must have a matching page or default.tsx in every sibling slot.`\n )\n\n this.name = 'IncompatibleParallelRouteSlotsError'\n this.stack = undefined\n }\n}\n"],"names":["IncompatibleParallelRouteSlotsError","Error","constructor","routes","routesByLayout","Map","route","layoutRoutes","get","layoutFile","push","set","formattedLayouts","sort","a","b","localeCompare","map","formattedRoutes","missingSlots","join","name","stack","undefined"],"mappings":"AAMA,OAAO,MAAMA,4CAA4CC;IACvDC,YAAYC,MAAiD,CAAE;QAC7D,MAAMC,iBAAiB,IAAIC;QAE3B,KAAK,MAAMC,SAASH,OAAQ;YAC1B,MAAMI,eAAeH,eAAeI,GAAG,CAACF,MAAMG,UAAU;YACxD,IAAIF,cAAc;gBAChBA,aAAaG,IAAI,CAACJ;YACpB,OAAO;gBACLF,eAAeO,GAAG,CAACL,MAAMG,UAAU,EAAE;oBAACH;iBAAM;YAC9C;QACF;QAEA,MAAMM,mBAAmB;eAAIR;SAAe,CACzCS,IAAI,CAAC,CAAC,CAACC,EAAE,EAAE,CAACC,EAAE,GAAKD,EAAEE,aAAa,CAACD,IACnCE,GAAG,CAAC,CAAC,CAACR,YAAYF,aAAa;YAC9B,MAAMW,kBAAkBX,aACrBM,IAAI,CAAC,CAACC,GAAGC,IAAMD,EAAER,KAAK,CAACU,aAAa,CAACD,EAAET,KAAK,GAC5CW,GAAG,CACF,CAAC,EAAEX,KAAK,EAAEa,YAAY,EAAE,GACtB,CAAC,EAAE,EAAEb,MAAM,8CAA8C,EAAEa,aAAaC,IAAI,CAAC,OAAO,EAEvFA,IAAI,CAAC;YACR,OAAO,GAAGX,WAAW,EAAE,EAAES,iBAAiB;QAC5C,GACCE,IAAI,CAAC;QAER,KAAK,CACH,CAAC,mFAAmF,EAAER,iBAAiB,iGAAiG,CAAC;QAG3M,IAAI,CAACS,IAAI,GAAG;QACZ,IAAI,CAACC,KAAK,GAAGC;IACf;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/missing-canonical-interception-routes-error.js b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/missing-canonical-interception-routes-error.js new file mode 100644 index 0000000000000000000000000000000000000000..4ea12e2bead7c3ac702ac832a11d956d06ef344c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/missing-canonical-interception-routes-error.js @@ -0,0 +1,10 @@ +export class MissingCanonicalInterceptionRoutesError extends Error { + constructor(routes){ + const formattedRoutes = routes.map(({ interceptionRoute, canonicalRoute })=>`- ${interceptionRoute} (expected ${canonicalRoute})`).join('\n'); + super(`The following interception routes do not have a canonical route:\n${formattedRoutes}\n\nEvery interception route must have a matching non-interception route so the URL can be loaded directly or refreshed.`); + this.name = 'MissingCanonicalInterceptionRoutesError'; + this.stack = undefined; + } +} + +//# sourceMappingURL=missing-canonical-interception-routes-error.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/missing-canonical-interception-routes-error.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/missing-canonical-interception-routes-error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..df958fd1ffac62bfe97a15d6c3bb8b98377e5766 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/missing-canonical-interception-routes-error.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/errors/missing-canonical-interception-routes-error.ts"],"sourcesContent":["import type { MissingCanonicalInterceptionRoute } from '../router/utils/interception-routes'\n\nexport class MissingCanonicalInterceptionRoutesError extends Error {\n constructor(routes: readonly MissingCanonicalInterceptionRoute[]) {\n const formattedRoutes = routes\n .map(\n ({ interceptionRoute, canonicalRoute }) =>\n `- ${interceptionRoute} (expected ${canonicalRoute})`\n )\n .join('\\n')\n super(\n `The following interception routes do not have a canonical route:\\n${formattedRoutes}\\n\\nEvery interception route must have a matching non-interception route so the URL can be loaded directly or refreshed.`\n )\n\n this.name = 'MissingCanonicalInterceptionRoutesError'\n this.stack = undefined\n }\n}\n"],"names":["MissingCanonicalInterceptionRoutesError","Error","constructor","routes","formattedRoutes","map","interceptionRoute","canonicalRoute","join","name","stack","undefined"],"mappings":"AAEA,OAAO,MAAMA,gDAAgDC;IAC3DC,YAAYC,MAAoD,CAAE;QAChE,MAAMC,kBAAkBD,OACrBE,GAAG,CACF,CAAC,EAAEC,iBAAiB,EAAEC,cAAc,EAAE,GACpC,CAAC,EAAE,EAAED,kBAAkB,WAAW,EAAEC,eAAe,CAAC,CAAC,EAExDC,IAAI,CAAC;QACR,KAAK,CACH,CAAC,kEAAkE,EAAEJ,gBAAgB,wHAAwH,CAAC;QAGhN,IAAI,CAACK,IAAI,GAAG;QACZ,IAAI,CAACC,KAAK,GAAGC;IACf;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/missing-default-parallel-route-error.js b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/missing-default-parallel-route-error.js new file mode 100644 index 0000000000000000000000000000000000000000..d61637a3c5d767fac610f1d25d7e153327db0591 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/missing-default-parallel-route-error.js @@ -0,0 +1,9 @@ +import { UsageError } from './usage-error'; +export class MissingDefaultParallelRouteError extends UsageError { + constructor(fullSegmentPath, slotName){ + super(`Missing required default.js file for parallel route at ${fullSegmentPath}\n` + `The parallel route slot "${slotName}" is missing a default.js file. When using parallel routes, each slot must have a default.js file to serve as a fallback.\n\n` + `Create a default.js file at: ${fullSegmentPath}/default.js`, 'https://nextjs.org/docs/messages/slot-missing-default'); + this.name = 'MissingDefaultParallelRouteError'; + } +} + +//# sourceMappingURL=missing-default-parallel-route-error.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/missing-default-parallel-route-error.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/missing-default-parallel-route-error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ca344468acb851220be4e511cbaedbf330235d68 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/missing-default-parallel-route-error.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/errors/missing-default-parallel-route-error.ts"],"sourcesContent":["import { UsageError } from './usage-error'\n\nexport class MissingDefaultParallelRouteError extends UsageError {\n constructor(fullSegmentPath: string, slotName: string) {\n super(\n `Missing required default.js file for parallel route at ${fullSegmentPath}\\n` +\n `The parallel route slot \"${slotName}\" is missing a default.js file. When using parallel routes, each slot must have a default.js file to serve as a fallback.\\n\\n` +\n `Create a default.js file at: ${fullSegmentPath}/default.js`,\n 'https://nextjs.org/docs/messages/slot-missing-default'\n )\n\n this.name = 'MissingDefaultParallelRouteError'\n }\n}\n"],"names":["UsageError","MissingDefaultParallelRouteError","constructor","fullSegmentPath","slotName","name"],"mappings":"AAAA,SAASA,UAAU,QAAQ,gBAAe;AAE1C,OAAO,MAAMC,yCAAyCD;IACpDE,YAAYC,eAAuB,EAAEC,QAAgB,CAAE;QACrD,KAAK,CACH,CAAC,uDAAuD,EAAED,gBAAgB,EAAE,CAAC,GAC3E,CAAC,yBAAyB,EAAEC,SAAS,6HAA6H,CAAC,GACnK,CAAC,6BAA6B,EAAED,gBAAgB,WAAW,CAAC,EAC9D;QAGF,IAAI,CAACE,IAAI,GAAG;IACd;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/unmatched-app-pages-error.js b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/unmatched-app-pages-error.js new file mode 100644 index 0000000000000000000000000000000000000000..b3912449c9ae6b5f0533ab6e7318e12e40f426a8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/unmatched-app-pages-error.js @@ -0,0 +1,10 @@ +export class UnmatchedAppPagesError extends Error { + constructor(pagePaths){ + const formattedPagePaths = pagePaths.map((pagePath)=>`- ${pagePath}`).join('\n'); + super(`The following page files do not match any complete route:\n${formattedPagePaths}\n\nEvery page must be part of at least one complete route. Add matching pages or default files for the sibling parallel route slots, or remove the unreachable pages.`); + this.name = 'UnmatchedAppPagesError'; + this.stack = undefined; + } +} + +//# sourceMappingURL=unmatched-app-pages-error.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/unmatched-app-pages-error.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/unmatched-app-pages-error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..dd3dfe72c1c566c1ad71c049785a91441d1929ca --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/unmatched-app-pages-error.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/errors/unmatched-app-pages-error.ts"],"sourcesContent":["export class UnmatchedAppPagesError extends Error {\n constructor(pagePaths: readonly string[]) {\n const formattedPagePaths = pagePaths\n .map((pagePath) => `- ${pagePath}`)\n .join('\\n')\n super(\n `The following page files do not match any complete route:\\n${formattedPagePaths}\\n\\nEvery page must be part of at least one complete route. Add matching pages or default files for the sibling parallel route slots, or remove the unreachable pages.`\n )\n\n this.name = 'UnmatchedAppPagesError'\n this.stack = undefined\n }\n}\n"],"names":["UnmatchedAppPagesError","Error","constructor","pagePaths","formattedPagePaths","map","pagePath","join","name","stack","undefined"],"mappings":"AAAA,OAAO,MAAMA,+BAA+BC;IAC1CC,YAAYC,SAA4B,CAAE;QACxC,MAAMC,qBAAqBD,UACxBE,GAAG,CAAC,CAACC,WAAa,CAAC,EAAE,EAAEA,UAAU,EACjCC,IAAI,CAAC;QACR,KAAK,CACH,CAAC,2DAA2D,EAAEH,mBAAmB,sKAAsK,CAAC;QAG1P,IAAI,CAACI,IAAI,GAAG;QACZ,IAAI,CAACC,KAAK,GAAGC;IACf;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/usage-error.js b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/usage-error.js new file mode 100644 index 0000000000000000000000000000000000000000..f69bb9eaf826c5a292d1f1ead0341f32bfdbf055 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/usage-error.js @@ -0,0 +1,11 @@ +export class UsageError extends Error { + constructor(message, docUrl){ + super(`${message}\n\nLearn more: ${docUrl}`); + this.name = 'UsageError'; + // This error is meant to interrupt the server start/build process + // but the stack trace isn't meaningful, as it points to internal code. + this.stack = undefined; + } +} + +//# sourceMappingURL=usage-error.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/errors/usage-error.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/usage-error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7374ba05dec0de769774e7ce3b2254f053dd7a17 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/errors/usage-error.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/errors/usage-error.ts"],"sourcesContent":["export class UsageError extends Error {\n constructor(message: string, docUrl: string) {\n super(`${message}\\n\\nLearn more: ${docUrl}`)\n this.name = 'UsageError'\n\n // This error is meant to interrupt the server start/build process\n // but the stack trace isn't meaningful, as it points to internal code.\n this.stack = undefined\n }\n}\n"],"names":["UsageError","Error","constructor","message","docUrl","name","stack","undefined"],"mappings":"AAAA,OAAO,MAAMA,mBAAmBC;IAC9BC,YAAYC,OAAe,EAAEC,MAAc,CAAE;QAC3C,KAAK,CAAC,GAAGD,QAAQ,gBAAgB,EAAEC,QAAQ;QAC3C,IAAI,CAACC,IAAI,GAAG;QAEZ,kEAAkE;QAClE,uEAAuE;QACvE,IAAI,CAACC,KAAK,GAAGC;IACf;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/escape-regexp.js b/e-commerce/node_modules/next/dist/esm/shared/lib/escape-regexp.js new file mode 100644 index 0000000000000000000000000000000000000000..bfa97e544c794af0d128eb1a25b762b90f0b8d84 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/escape-regexp.js @@ -0,0 +1,12 @@ +// regexp is based on https://github.com/sindresorhus/escape-string-regexp +const reHasRegExp = /[|\\{}()[\]^$+*?.-]/; +const reReplaceRegExp = /[|\\{}()[\]^$+*?.-]/g; +export function escapeStringRegexp(str) { + // see also: https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/escapeRegExp.js#L23 + if (reHasRegExp.test(str)) { + return str.replace(reReplaceRegExp, '\\$&'); + } + return str; +} + +//# sourceMappingURL=escape-regexp.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/escape-regexp.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/escape-regexp.js.map new file mode 100644 index 0000000000000000000000000000000000000000..8cace6473a257231a570c1366c7482168de04892 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/escape-regexp.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/escape-regexp.ts"],"sourcesContent":["// regexp is based on https://github.com/sindresorhus/escape-string-regexp\nconst reHasRegExp = /[|\\\\{}()[\\]^$+*?.-]/\nconst reReplaceRegExp = /[|\\\\{}()[\\]^$+*?.-]/g\n\nexport function escapeStringRegexp(str: string) {\n // see also: https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/escapeRegExp.js#L23\n if (reHasRegExp.test(str)) {\n return str.replace(reReplaceRegExp, '\\\\$&')\n }\n return str\n}\n"],"names":["reHasRegExp","reReplaceRegExp","escapeStringRegexp","str","test","replace"],"mappings":"AAAA,0EAA0E;AAC1E,MAAMA,cAAc;AACpB,MAAMC,kBAAkB;AAExB,OAAO,SAASC,mBAAmBC,GAAW;IAC5C,+GAA+G;IAC/G,IAAIH,YAAYI,IAAI,CAACD,MAAM;QACzB,OAAOA,IAAIE,OAAO,CAACJ,iBAAiB;IACtC;IACA,OAAOE;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/find-closest-quality.js b/e-commerce/node_modules/next/dist/esm/shared/lib/find-closest-quality.js new file mode 100644 index 0000000000000000000000000000000000000000..7a573354953ffdcb496aacf2511900d8033d403d --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/find-closest-quality.js @@ -0,0 +1,14 @@ +/** + * Find the closest matching `quality` in the list of `config.qualities` + * @param quality the quality prop passed to the image component + * @param config the "images" configuration from next.config.js + * @returns the closest matching quality value + */ export function findClosestQuality(quality, config) { + const q = quality || 75; + if (!config?.qualities?.length) { + return q; + } + return config.qualities.reduce((prev, cur)=>Math.abs(cur - q) < Math.abs(prev - q) ? cur : prev, config.qualities[0]); +} + +//# sourceMappingURL=find-closest-quality.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/find-closest-quality.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/find-closest-quality.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a351cea79c2c6f2778524ecac72ad3c7775db5c0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/find-closest-quality.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/find-closest-quality.ts"],"sourcesContent":["import type { NextConfig } from '../../server/config-shared'\n\n/**\n * Find the closest matching `quality` in the list of `config.qualities`\n * @param quality the quality prop passed to the image component\n * @param config the \"images\" configuration from next.config.js\n * @returns the closest matching quality value\n */\nexport function findClosestQuality(\n quality: number | undefined,\n config: NextConfig['images'] | undefined\n): number {\n const q = quality || 75\n if (!config?.qualities?.length) {\n return q\n }\n return config.qualities.reduce(\n (prev, cur) => (Math.abs(cur - q) < Math.abs(prev - q) ? cur : prev),\n config.qualities[0]\n )\n}\n"],"names":["findClosestQuality","quality","config","q","qualities","length","reduce","prev","cur","Math","abs"],"mappings":"AAEA;;;;;CAKC,GACD,OAAO,SAASA,mBACdC,OAA2B,EAC3BC,MAAwC;IAExC,MAAMC,IAAIF,WAAW;IACrB,IAAI,CAACC,QAAQE,WAAWC,QAAQ;QAC9B,OAAOF;IACT;IACA,OAAOD,OAAOE,SAAS,CAACE,MAAM,CAC5B,CAACC,MAAMC,MAASC,KAAKC,GAAG,CAACF,MAAML,KAAKM,KAAKC,GAAG,CAACH,OAAOJ,KAAKK,MAAMD,MAC/DL,OAAOE,SAAS,CAAC,EAAE;AAEvB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/fnv1a.js b/e-commerce/node_modules/next/dist/esm/shared/lib/fnv1a.js new file mode 100644 index 0000000000000000000000000000000000000000..1d029a7da0269c464b52ae4affa0d11c030ea268 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/fnv1a.js @@ -0,0 +1,42 @@ +// source: https://github.com/sindresorhus/fnv1a +// FNV_PRIMES and FNV_OFFSETS from +// http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param +const FNV_PRIMES = { + 32: BigInt(16777619), + 64: BigInt(1099511628211), + 128: BigInt(309485009821345068724781371), + 256: BigInt(374144419156711147060143317175368453031918731002211), + 512: BigInt(35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759), + 1024: BigInt(5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573) +}; +const FNV_OFFSETS = { + 32: BigInt(2166136261), + 64: BigInt(14695981039346656037), + 128: BigInt(144066263297769815596495629667062367629), + 256: BigInt(100029257958052580907070968620625704837092796014241193945225284501741471925557), + 512: BigInt(9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785), + 1024: BigInt(14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915) +}; +export default function fnv1a(inputString, { size = 32, seed = 0 } = {}) { + if (!FNV_PRIMES[size]) { + throw new Error('The `size` option must be one of 32, 64, 128, 256, 512, or 1024'); + } + let hash = FNV_OFFSETS[size] ^ BigInt(seed); + const fnvPrime = FNV_PRIMES[size]; + // Handle Unicode code points > 0x7f + let isUnicoded = false; + for(let index = 0; index < inputString.length; index++){ + let characterCode = inputString.charCodeAt(index); + // Non-ASCII characters trigger the Unicode escape logic + if (characterCode > 0x7f && !isUnicoded) { + inputString = unescape(encodeURIComponent(inputString)); + characterCode = inputString.charCodeAt(index); + isUnicoded = true; + } + hash ^= BigInt(characterCode); + hash = BigInt.asUintN(size, hash * fnvPrime); + } + return hash; +} + +//# sourceMappingURL=fnv1a.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/fnv1a.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/fnv1a.js.map new file mode 100644 index 0000000000000000000000000000000000000000..844577063efdff8ebce05ff233e5e3f3cae1004d --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/fnv1a.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/fnv1a.ts"],"sourcesContent":["// source: https://github.com/sindresorhus/fnv1a\n// FNV_PRIMES and FNV_OFFSETS from\n// http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param\n\nconst FNV_PRIMES = {\n 32: BigInt(16_777_619),\n 64: BigInt(1_099_511_628_211),\n 128: BigInt(309_485_009_821_345_068_724_781_371),\n 256: BigInt(\n 374_144_419_156_711_147_060_143_317_175_368_453_031_918_731_002_211\n ),\n 512: BigInt(\n 35_835_915_874_844_867_368_919_076_489_095_108_449_946_327_955_754_392_558_399_825_615_420_669_938_882_575_126_094_039_892_345_713_852_759\n ),\n 1024: BigInt(\n 5_016_456_510_113_118_655_434_598_811_035_278_955_030_765_345_404_790_744_303_017_523_831_112_055_108_147_451_509_157_692_220_295_382_716_162_651_878_526_895_249_385_292_291_816_524_375_083_746_691_371_804_094_271_873_160_484_737_966_720_260_389_217_684_476_157_468_082_573\n ),\n} as const\n\nconst FNV_OFFSETS = {\n 32: BigInt(2_166_136_261),\n 64: BigInt(14_695_981_039_346_656_037),\n 128: BigInt(144_066_263_297_769_815_596_495_629_667_062_367_629),\n 256: BigInt(\n 100_029_257_958_052_580_907_070_968_620_625_704_837_092_796_014_241_193_945_225_284_501_741_471_925_557\n ),\n 512: BigInt(\n 9_659_303_129_496_669_498_009_435_400_716_310_466_090_418_745_672_637_896_108_374_329_434_462_657_994_582_932_197_716_438_449_813_051_892_206_539_805_784_495_328_239_340_083_876_191_928_701_583_869_517_785\n ),\n 1024: BigInt(\n 14_197_795_064_947_621_068_722_070_641_403_218_320_880_622_795_441_933_960_878_474_914_617_582_723_252_296_732_303_717_722_150_864_096_521_202_355_549_365_628_174_669_108_571_814_760_471_015_076_148_029_755_969_804_077_320_157_692_458_563_003_215_304_957_150_157_403_644_460_363_550_505_412_711_285_966_361_610_267_868_082_893_823_963_790_439_336_411_086_884_584_107_735_010_676_915\n ),\n} as const\n\nexport default function fnv1a(\n inputString: string,\n {\n size = 32,\n seed = 0,\n }: {\n size?: keyof typeof FNV_PRIMES\n seed?: number\n } = {}\n) {\n if (!FNV_PRIMES[size]) {\n throw new Error(\n 'The `size` option must be one of 32, 64, 128, 256, 512, or 1024'\n )\n }\n\n let hash: bigint = FNV_OFFSETS[size] ^ BigInt(seed)\n const fnvPrime = FNV_PRIMES[size]\n\n // Handle Unicode code points > 0x7f\n let isUnicoded = false\n\n for (let index = 0; index < inputString.length; index++) {\n let characterCode = inputString.charCodeAt(index)\n\n // Non-ASCII characters trigger the Unicode escape logic\n if (characterCode > 0x7f && !isUnicoded) {\n inputString = unescape(encodeURIComponent(inputString))\n characterCode = inputString.charCodeAt(index)\n isUnicoded = true\n }\n\n hash ^= BigInt(characterCode)\n hash = BigInt.asUintN(size, hash * fnvPrime)\n }\n\n return hash\n}\n"],"names":["FNV_PRIMES","BigInt","FNV_OFFSETS","fnv1a","inputString","size","seed","Error","hash","fnvPrime","isUnicoded","index","length","characterCode","charCodeAt","unescape","encodeURIComponent","asUintN"],"mappings":"AAAA,gDAAgD;AAChD,kCAAkC;AAClC,iEAAiE;AAEjE,MAAMA,aAAa;IACjB,IAAIC,OAAO;IACX,IAAIA,OAAO;IACX,KAAKA,OAAO;IACZ,KAAKA,OACH;IAEF,KAAKA,OACH;IAEF,MAAMA,OACJ;AAEJ;AAEA,MAAMC,cAAc;IAClB,IAAID,OAAO;IACX,IAAIA,OAAO;IACX,KAAKA,OAAO;IACZ,KAAKA,OACH;IAEF,KAAKA,OACH;IAEF,MAAMA,OACJ;AAEJ;AAEA,eAAe,SAASE,MACtBC,WAAmB,EACnB,EACEC,OAAO,EAAE,EACTC,OAAO,CAAC,EAIT,GAAG,CAAC,CAAC;IAEN,IAAI,CAACN,UAAU,CAACK,KAAK,EAAE;QACrB,MAAM,IAAIE,MACR;IAEJ;IAEA,IAAIC,OAAeN,WAAW,CAACG,KAAK,GAAGJ,OAAOK;IAC9C,MAAMG,WAAWT,UAAU,CAACK,KAAK;IAEjC,oCAAoC;IACpC,IAAIK,aAAa;IAEjB,IAAK,IAAIC,QAAQ,GAAGA,QAAQP,YAAYQ,MAAM,EAAED,QAAS;QACvD,IAAIE,gBAAgBT,YAAYU,UAAU,CAACH;QAE3C,wDAAwD;QACxD,IAAIE,gBAAgB,QAAQ,CAACH,YAAY;YACvCN,cAAcW,SAASC,mBAAmBZ;YAC1CS,gBAAgBT,YAAYU,UAAU,CAACH;YACvCD,aAAa;QACf;QAEAF,QAAQP,OAAOY;QACfL,OAAOP,OAAOgB,OAAO,CAACZ,MAAMG,OAAOC;IACrC;IAEA,OAAOD;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/format-webpack-messages.js b/e-commerce/node_modules/next/dist/esm/shared/lib/format-webpack-messages.js new file mode 100644 index 0000000000000000000000000000000000000000..c0d4f92cc6ea1efde27d1cde3425729c421d0339 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/format-webpack-messages.js @@ -0,0 +1,173 @@ +/** +MIT License + +Copyright (c) 2015-present, Facebook, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ import stripAnsi from 'next/dist/compiled/strip-ansi'; +// This file is based on https://github.com/facebook/create-react-app/blob/7b1a32be6ec9f99a6c9a3c66813f3ac09c4736b9/packages/react-dev-utils/formatWebpackMessages.js +// It's been edited to remove chalk and CRA-specific logic +const friendlySyntaxErrorLabel = 'Syntax error:'; +const WEBPACK_BREAKING_CHANGE_POLYFILLS = '\n\nBREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.'; +function isLikelyASyntaxError(message) { + return stripAnsi(message).includes(friendlySyntaxErrorLabel); +} +let hadMissingSassError = false; +// Cleans up webpack error messages. +function formatMessage(message, verbose, importTraceNote) { + // TODO: Replace this once webpack 5 is stable + if (typeof message === 'object' && message.message) { + let filteredModuleTrace = message.moduleTrace && message.moduleTrace.filter((trace)=>!/next-(middleware|client-pages|route|edge-function)-loader\.js/.test(trace.originName)); + let body = message.message; + const breakingChangeIndex = body.indexOf(WEBPACK_BREAKING_CHANGE_POLYFILLS); + if (breakingChangeIndex >= 0) { + body = body.slice(0, breakingChangeIndex); + } + // TODO: Rspack currently doesn't populate moduleName correctly in some cases, + // fall back to moduleIdentifier as a workaround + if (process.env.NEXT_RSPACK && !message.moduleName && !message.file && message.moduleIdentifier) { + const parts = message.moduleIdentifier.split('!'); + message.moduleName = parts[parts.length - 1]; + } + message = (message.moduleName ? stripAnsi(message.moduleName) + '\n' : '') + (message.file ? stripAnsi(message.file) + '\n' : '') + body + (message.details && verbose ? '\n' + message.details : '') + (filteredModuleTrace && filteredModuleTrace.length ? (importTraceNote || '\n\nImport trace for requested module:') + filteredModuleTrace.map((trace)=>`\n${trace.moduleName}`).join('') : '') + (message.stack && verbose ? '\n' + message.stack : ''); + } + let lines = message.split('\n'); + // Extract loader paths from Webpack-added headers and move them to end. + // Original format: "Module build failed (from ./loaders/foo-loader.js):" + // The header line is removed and the path is appended at the end as: + // " (from ./loaders/foo-loader.js)" + // https://github.com/webpack/webpack/blob/master/lib/ModuleError.js + const loaderPaths = []; + lines = lines.filter((line)=>{ + const match = /Module [A-z ]+\(from (.+)\):?\s*$/.exec(line); + if (match) { + loaderPaths.push(match[1]); + return false; + } + return true; + }); + // Transform parsing error into syntax error + // TODO: move this to our ESLint formatter? + lines = lines.map((line)=>{ + const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(line); + if (!parsingError) { + return line; + } + const [, errorLine, errorColumn, errorMessage] = parsingError; + return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`; + }); + message = lines.join('\n'); + // Smoosh syntax errors (commonly found in CSS) + message = message.replace(/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g, `${friendlySyntaxErrorLabel} $3 ($1:$2)\n`); + // Clean up export errors + message = message.replace(/^.*export '(.+?)' was not found in '(.+?)'.*$/gm, `Attempted import error: '$1' is not exported from '$2'.`); + message = message.replace(/^.*export 'default' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, `Attempted import error: '$2' does not contain a default export (imported as '$1').`); + message = message.replace(/^.*export '(.+?)' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, `Attempted import error: '$1' is not exported from '$3' (imported as '$2').`); + lines = message.split('\n'); + // Remove leading newline + if (lines.length > 2 && lines[1].trim() === '') { + lines.splice(1, 1); + } + // Cleans up verbose "module not found" messages for files and packages. + if (lines[1] && lines[1].startsWith('Module not found: ')) { + lines = [ + lines[0], + lines[1].replace('Error: ', '').replace('Module not found: Cannot find file:', 'Cannot find file:'), + ...lines.slice(2) + ]; + } + // Add helpful message for users trying to use Sass for the first time + if (lines[1] && lines[1].match(/Cannot find module.+sass/)) { + // ./file.module.scss (<>) => ./file.module.scss + const firstLine = lines[0].split('!'); + lines[0] = firstLine[firstLine.length - 1]; + lines[1] = "To use Next.js' built-in Sass support, you first need to install `sass`.\n"; + lines[1] += 'Run `npm i sass` or `yarn add sass` inside your workspace.\n'; + lines[1] += '\nLearn more: https://nextjs.org/docs/messages/install-sass'; + // dispose of unhelpful stack trace + lines = lines.slice(0, 2); + hadMissingSassError = true; + } else if (hadMissingSassError && message.match(/(sass-loader|resolve-url-loader: CSS error)/)) { + // dispose of unhelpful stack trace following missing sass module + lines = []; + } + if (!verbose) { + message = lines.join('\n'); + // Internal stacks are generally useless so we strip them... with the + // exception of stacks containing `webpack:` because they're normally + // from user code generated by Webpack. For more information see + // https://github.com/facebook/create-react-app/pull/1050 + message = message.replace(/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, '') // at ... ...:x:y + ; + message = message.replace(/^\s*at\s(\n|$)/gm, '') // at + ; + message = message.replace(/File was processed with these loaders:\n(.+[\\/](next[\\/]dist[\\/].+|@next[\\/]react-refresh-utils[\\/]loader)\.js\n)*You may need an additional loader to handle the result of these loaders.\n/g, ''); + lines = message.split('\n'); + } + // Append loader paths at the end (before any remaining stack trace) + if (loaderPaths.length > 0) { + for (const loaderPath of loaderPaths){ + // Don't show internal Next.js loader paths — they're noise for users + if (!/[/\\]next[/\\]dist[/\\]/.test(loaderPath)) { + lines.push(` (from ${loaderPath})`); + } + } + } + // Remove duplicated newlines + lines = lines.filter((line, index, arr)=>index === 0 || line.trim() !== '' || line.trim() !== arr[index - 1].trim()); + // Reassemble the message + message = lines.join('\n'); + return message.trim(); +} +export default function formatWebpackMessages(json, verbose) { + const formattedErrors = json.errors.map((message)=>{ + const isUnknownNextFontError = message.message.includes('An error occurred in `next/font`.'); + return formatMessage(message, isUnknownNextFontError || verbose); + }); + const formattedWarnings = json.warnings.map((message)=>{ + return formatMessage(message, verbose); + }); + // Reorder errors to put the most relevant ones first. + let reactServerComponentsError = -1; + for(let i = 0; i < formattedErrors.length; i++){ + const error = formattedErrors[i]; + if (error.includes('ReactServerComponentsError')) { + reactServerComponentsError = i; + break; + } + } + // Move the reactServerComponentsError to the top if it exists + if (reactServerComponentsError !== -1) { + const error = formattedErrors.splice(reactServerComponentsError, 1); + formattedErrors.unshift(error[0]); + } + const result = { + ...json, + errors: formattedErrors, + warnings: formattedWarnings + }; + if (!verbose && result.errors.some(isLikelyASyntaxError)) { + // If there are any syntax errors, show just them. + result.errors = result.errors.filter(isLikelyASyntaxError); + result.warnings = []; + } + return result; +} + +//# sourceMappingURL=format-webpack-messages.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/format-webpack-messages.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/format-webpack-messages.js.map new file mode 100644 index 0000000000000000000000000000000000000000..82456dcc9c9f5cd69272f423511d0d15b087a1ad --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/format-webpack-messages.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/format-webpack-messages.ts"],"sourcesContent":["/**\nMIT License\n\nCopyright (c) 2015-present, Facebook, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nimport stripAnsi from 'next/dist/compiled/strip-ansi'\n// This file is based on https://github.com/facebook/create-react-app/blob/7b1a32be6ec9f99a6c9a3c66813f3ac09c4736b9/packages/react-dev-utils/formatWebpackMessages.js\n// It's been edited to remove chalk and CRA-specific logic\n\nconst friendlySyntaxErrorLabel = 'Syntax error:'\n\nconst WEBPACK_BREAKING_CHANGE_POLYFILLS =\n '\\n\\nBREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.'\n\nfunction isLikelyASyntaxError(message: string) {\n return stripAnsi(message).includes(friendlySyntaxErrorLabel)\n}\n\nlet hadMissingSassError = false\n\n// Cleans up webpack error messages.\nfunction formatMessage(\n message: any,\n verbose?: boolean,\n importTraceNote?: boolean\n) {\n // TODO: Replace this once webpack 5 is stable\n if (typeof message === 'object' && message.message) {\n let filteredModuleTrace =\n message.moduleTrace &&\n message.moduleTrace.filter(\n (trace: any) =>\n !/next-(middleware|client-pages|route|edge-function)-loader\\.js/.test(\n trace.originName\n )\n )\n\n let body = message.message\n const breakingChangeIndex = body.indexOf(WEBPACK_BREAKING_CHANGE_POLYFILLS)\n if (breakingChangeIndex >= 0) {\n body = body.slice(0, breakingChangeIndex)\n }\n\n // TODO: Rspack currently doesn't populate moduleName correctly in some cases,\n // fall back to moduleIdentifier as a workaround\n if (\n process.env.NEXT_RSPACK &&\n !message.moduleName &&\n !message.file &&\n message.moduleIdentifier\n ) {\n const parts = message.moduleIdentifier.split('!')\n message.moduleName = parts[parts.length - 1]\n }\n\n message =\n (message.moduleName ? stripAnsi(message.moduleName) + '\\n' : '') +\n (message.file ? stripAnsi(message.file) + '\\n' : '') +\n body +\n (message.details && verbose ? '\\n' + message.details : '') +\n (filteredModuleTrace && filteredModuleTrace.length\n ? (importTraceNote || '\\n\\nImport trace for requested module:') +\n filteredModuleTrace\n .map((trace: any) => `\\n${trace.moduleName}`)\n .join('')\n : '') +\n (message.stack && verbose ? '\\n' + message.stack : '')\n }\n let lines = message.split('\\n')\n\n // Extract loader paths from Webpack-added headers and move them to end.\n // Original format: \"Module build failed (from ./loaders/foo-loader.js):\"\n // The header line is removed and the path is appended at the end as:\n // \" (from ./loaders/foo-loader.js)\"\n // https://github.com/webpack/webpack/blob/master/lib/ModuleError.js\n const loaderPaths: string[] = []\n lines = lines.filter((line: string) => {\n const match = /Module [A-z ]+\\(from (.+)\\):?\\s*$/.exec(line)\n if (match) {\n loaderPaths.push(match[1])\n return false\n }\n return true\n })\n\n // Transform parsing error into syntax error\n // TODO: move this to our ESLint formatter?\n lines = lines.map((line: string) => {\n const parsingError = /Line (\\d+):(?:(\\d+):)?\\s*Parsing error: (.+)$/.exec(\n line\n )\n if (!parsingError) {\n return line\n }\n const [, errorLine, errorColumn, errorMessage] = parsingError\n return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`\n })\n\n message = lines.join('\\n')\n // Smoosh syntax errors (commonly found in CSS)\n message = message.replace(\n /SyntaxError\\s+\\((\\d+):(\\d+)\\)\\s*(.+?)\\n/g,\n `${friendlySyntaxErrorLabel} $3 ($1:$2)\\n`\n )\n // Clean up export errors\n message = message.replace(\n /^.*export '(.+?)' was not found in '(.+?)'.*$/gm,\n `Attempted import error: '$1' is not exported from '$2'.`\n )\n message = message.replace(\n /^.*export 'default' \\(imported as '(.+?)'\\) was not found in '(.+?)'.*$/gm,\n `Attempted import error: '$2' does not contain a default export (imported as '$1').`\n )\n message = message.replace(\n /^.*export '(.+?)' \\(imported as '(.+?)'\\) was not found in '(.+?)'.*$/gm,\n `Attempted import error: '$1' is not exported from '$3' (imported as '$2').`\n )\n lines = message.split('\\n')\n\n // Remove leading newline\n if (lines.length > 2 && lines[1].trim() === '') {\n lines.splice(1, 1)\n }\n\n // Cleans up verbose \"module not found\" messages for files and packages.\n if (lines[1] && lines[1].startsWith('Module not found: ')) {\n lines = [\n lines[0],\n lines[1]\n .replace('Error: ', '')\n .replace('Module not found: Cannot find file:', 'Cannot find file:'),\n ...lines.slice(2),\n ]\n }\n\n // Add helpful message for users trying to use Sass for the first time\n if (lines[1] && lines[1].match(/Cannot find module.+sass/)) {\n // ./file.module.scss (<>) => ./file.module.scss\n const firstLine = lines[0].split('!')\n lines[0] = firstLine[firstLine.length - 1]\n\n lines[1] =\n \"To use Next.js' built-in Sass support, you first need to install `sass`.\\n\"\n lines[1] += 'Run `npm i sass` or `yarn add sass` inside your workspace.\\n'\n lines[1] += '\\nLearn more: https://nextjs.org/docs/messages/install-sass'\n\n // dispose of unhelpful stack trace\n lines = lines.slice(0, 2)\n hadMissingSassError = true\n } else if (\n hadMissingSassError &&\n message.match(/(sass-loader|resolve-url-loader: CSS error)/)\n ) {\n // dispose of unhelpful stack trace following missing sass module\n lines = []\n }\n\n if (!verbose) {\n message = lines.join('\\n')\n // Internal stacks are generally useless so we strip them... with the\n // exception of stacks containing `webpack:` because they're normally\n // from user code generated by Webpack. For more information see\n // https://github.com/facebook/create-react-app/pull/1050\n message = message.replace(\n /^\\s*at\\s((?!webpack:).)*:\\d+:\\d+[\\s)]*(\\n|$)/gm,\n ''\n ) // at ... ...:x:y\n message = message.replace(/^\\s*at\\s(\\n|$)/gm, '') // at \n\n message = message.replace(\n /File was processed with these loaders:\\n(.+[\\\\/](next[\\\\/]dist[\\\\/].+|@next[\\\\/]react-refresh-utils[\\\\/]loader)\\.js\\n)*You may need an additional loader to handle the result of these loaders.\\n/g,\n ''\n )\n\n lines = message.split('\\n')\n }\n\n // Append loader paths at the end (before any remaining stack trace)\n if (loaderPaths.length > 0) {\n for (const loaderPath of loaderPaths) {\n // Don't show internal Next.js loader paths — they're noise for users\n if (!/[/\\\\]next[/\\\\]dist[/\\\\]/.test(loaderPath)) {\n lines.push(` (from ${loaderPath})`)\n }\n }\n }\n\n // Remove duplicated newlines\n lines = (lines as string[]).filter(\n (line, index, arr) =>\n index === 0 || line.trim() !== '' || line.trim() !== arr[index - 1].trim()\n )\n\n // Reassemble the message\n message = lines.join('\\n')\n return message.trim()\n}\n\nexport default function formatWebpackMessages(json: any, verbose?: boolean) {\n const formattedErrors = json.errors.map((message: any) => {\n const isUnknownNextFontError = message.message.includes(\n 'An error occurred in `next/font`.'\n )\n return formatMessage(message, isUnknownNextFontError || verbose)\n })\n const formattedWarnings = json.warnings.map((message: any) => {\n return formatMessage(message, verbose)\n })\n\n // Reorder errors to put the most relevant ones first.\n let reactServerComponentsError = -1\n\n for (let i = 0; i < formattedErrors.length; i++) {\n const error = formattedErrors[i]\n if (error.includes('ReactServerComponentsError')) {\n reactServerComponentsError = i\n break\n }\n }\n\n // Move the reactServerComponentsError to the top if it exists\n if (reactServerComponentsError !== -1) {\n const error = formattedErrors.splice(reactServerComponentsError, 1)\n formattedErrors.unshift(error[0])\n }\n\n const result = {\n ...json,\n errors: formattedErrors,\n warnings: formattedWarnings,\n }\n if (!verbose && result.errors.some(isLikelyASyntaxError)) {\n // If there are any syntax errors, show just them.\n result.errors = result.errors.filter(isLikelyASyntaxError)\n result.warnings = []\n }\n return result\n}\n"],"names":["stripAnsi","friendlySyntaxErrorLabel","WEBPACK_BREAKING_CHANGE_POLYFILLS","isLikelyASyntaxError","message","includes","hadMissingSassError","formatMessage","verbose","importTraceNote","filteredModuleTrace","moduleTrace","filter","trace","test","originName","body","breakingChangeIndex","indexOf","slice","process","env","NEXT_RSPACK","moduleName","file","moduleIdentifier","parts","split","length","details","map","join","stack","lines","loaderPaths","line","match","exec","push","parsingError","errorLine","errorColumn","errorMessage","replace","trim","splice","startsWith","firstLine","loaderPath","index","arr","formatWebpackMessages","json","formattedErrors","errors","isUnknownNextFontError","formattedWarnings","warnings","reactServerComponentsError","i","error","unshift","result","some"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;AAsBA,GACA,OAAOA,eAAe,gCAA+B;AACrD,qKAAqK;AACrK,0DAA0D;AAE1D,MAAMC,2BAA2B;AAEjC,MAAMC,oCACJ;AAEF,SAASC,qBAAqBC,OAAe;IAC3C,OAAOJ,UAAUI,SAASC,QAAQ,CAACJ;AACrC;AAEA,IAAIK,sBAAsB;AAE1B,oCAAoC;AACpC,SAASC,cACPH,OAAY,EACZI,OAAiB,EACjBC,eAAyB;IAEzB,8CAA8C;IAC9C,IAAI,OAAOL,YAAY,YAAYA,QAAQA,OAAO,EAAE;QAClD,IAAIM,sBACFN,QAAQO,WAAW,IACnBP,QAAQO,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B,MAAMF,IAAI,CAAC;IACrB,OAAO3B,QAAQwC,IAAI;AACrB;AAEA,eAAe,SAASO,sBAAsBC,IAAS,EAAE5C,OAAiB;IACxE,MAAM6C,kBAAkBD,KAAKE,MAAM,CAACxB,GAAG,CAAC,CAAC1B;QACvC,MAAMmD,yBAAyBnD,QAAQA,OAAO,CAACC,QAAQ,CACrD;QAEF,OAAOE,cAAcH,SAASmD,0BAA0B/C;IAC1D;IACA,MAAMgD,oBAAoBJ,KAAKK,QAAQ,CAAC3B,GAAG,CAAC,CAAC1B;QAC3C,OAAOG,cAAcH,SAASI;IAChC;IAEA,sDAAsD;IACtD,IAAIkD,6BAA6B,CAAC;IAElC,IAAK,IAAIC,IAAI,GAAGA,IAAIN,gBAAgBzB,MAAM,EAAE+B,IAAK;QAC/C,MAAMC,QAAQP,eAAe,CAACM,EAAE;QAChC,IAAIC,MAAMvD,QAAQ,CAAC,+BAA+B;YAChDqD,6BAA6BC;YAC7B;QACF;IACF;IAEA,8DAA8D;IAC9D,IAAID,+BAA+B,CAAC,GAAG;QACrC,MAAME,QAAQP,gBAAgBR,MAAM,CAACa,4BAA4B;QACjEL,gBAAgBQ,OAAO,CAACD,KAAK,CAAC,EAAE;IAClC;IAEA,MAAME,SAAS;QACb,GAAGV,IAAI;QACPE,QAAQD;QACRI,UAAUD;IACZ;IACA,IAAI,CAAChD,WAAWsD,OAAOR,MAAM,CAACS,IAAI,CAAC5D,uBAAuB;QACxD,kDAAkD;QAClD2D,OAAOR,MAAM,GAAGQ,OAAOR,MAAM,CAAC1C,MAAM,CAACT;QACrC2D,OAAOL,QAAQ,GAAG,EAAE;IACtB;IACA,OAAOK;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/get-hostname.js b/e-commerce/node_modules/next/dist/esm/shared/lib/get-hostname.js new file mode 100644 index 0000000000000000000000000000000000000000..f6af3a00075b521120ed33377dbc55861cdc8b1d --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/get-hostname.js @@ -0,0 +1,18 @@ +/** + * Takes an object with a hostname property (like a parsed URL) and some + * headers that may contain Host and returns the preferred hostname. + * @param parsed An object containing a hostname property. + * @param headers A dictionary with headers containing a `host`. + */ export function getHostname(parsed, headers) { + // Get the hostname from the headers if it exists, otherwise use the parsed + // hostname. + let hostname; + if (headers?.host && !Array.isArray(headers.host)) { + hostname = headers.host.toString().split(':', 1)[0]; + } else if (parsed.hostname) { + hostname = parsed.hostname; + } else return; + return hostname.toLowerCase(); +} + +//# sourceMappingURL=get-hostname.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/get-hostname.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/get-hostname.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e98d7e9fce7f587f3f0b852275519485195b01e1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/get-hostname.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/get-hostname.ts"],"sourcesContent":["import type { OutgoingHttpHeaders } from 'http'\n\n/**\n * Takes an object with a hostname property (like a parsed URL) and some\n * headers that may contain Host and returns the preferred hostname.\n * @param parsed An object containing a hostname property.\n * @param headers A dictionary with headers containing a `host`.\n */\nexport function getHostname(\n parsed: { hostname?: string | null },\n headers?: OutgoingHttpHeaders\n): string | undefined {\n // Get the hostname from the headers if it exists, otherwise use the parsed\n // hostname.\n let hostname: string\n if (headers?.host && !Array.isArray(headers.host)) {\n hostname = headers.host.toString().split(':', 1)[0]\n } else if (parsed.hostname) {\n hostname = parsed.hostname\n } else return\n\n return hostname.toLowerCase()\n}\n"],"names":["getHostname","parsed","headers","hostname","host","Array","isArray","toString","split","toLowerCase"],"mappings":"AAEA;;;;;CAKC,GACD,OAAO,SAASA,YACdC,MAAoC,EACpCC,OAA6B;IAE7B,2EAA2E;IAC3E,YAAY;IACZ,IAAIC;IACJ,IAAID,SAASE,QAAQ,CAACC,MAAMC,OAAO,CAACJ,QAAQE,IAAI,GAAG;QACjDD,WAAWD,QAAQE,IAAI,CAACG,QAAQ,GAAGC,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE;IACrD,OAAO,IAAIP,OAAOE,QAAQ,EAAE;QAC1BA,WAAWF,OAAOE,QAAQ;IAC5B,OAAO;IAEP,OAAOA,SAASM,WAAW;AAC7B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/get-img-props.js b/e-commerce/node_modules/next/dist/esm/shared/lib/get-img-props.js new file mode 100644 index 0000000000000000000000000000000000000000..b62af7f73b45054b0e2e7d691991b99a0ae0050c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/get-img-props.js @@ -0,0 +1,482 @@ +import { getAssetToken, getDeploymentId } from './deployment-id'; +import { getImageBlurSvg } from './image-blur-svg'; +const VALID_LOADING_VALUES = [ + 'lazy', + 'eager', + undefined +]; +// Object-fit values that are not valid background-size values +const INVALID_BACKGROUND_SIZE_VALUES = [ + '-moz-initial', + 'fill', + 'none', + 'scale-down', + undefined +]; +function isStaticRequire(src) { + return src.default !== undefined; +} +function isStaticImageData(src) { + return src.src !== undefined; +} +function isStaticImport(src) { + return !!src && typeof src === 'object' && (isStaticRequire(src) || isStaticImageData(src)); +} +const allImgs = new Map(); +let perfObserver; +function getInt(x) { + if (typeof x === 'undefined') { + return x; + } + if (typeof x === 'number') { + return Number.isFinite(x) ? x : NaN; + } + if (typeof x === 'string' && /^[0-9]+$/.test(x)) { + return parseInt(x, 10); + } + return NaN; +} +function getWidths({ deviceSizes, allSizes }, width, sizes) { + if (sizes) { + // Find all the "vw" percent sizes used in the sizes prop + const viewportWidthRe = /(^|\s)(1?\d?\d)vw/g; + const percentSizes = []; + for(let match; match = viewportWidthRe.exec(sizes); match){ + percentSizes.push(parseInt(match[2])); + } + if (percentSizes.length) { + const smallestRatio = Math.min(...percentSizes) * 0.01; + return { + widths: allSizes.filter((s)=>s >= deviceSizes[0] * smallestRatio), + kind: 'w' + }; + } + return { + widths: allSizes, + kind: 'w' + }; + } + if (typeof width !== 'number') { + return { + widths: deviceSizes, + kind: 'w' + }; + } + const widths = [ + ...new Set(// > This means that most OLED screens that say they are 3x resolution, + // > are actually 3x in the green color, but only 1.5x in the red and + // > blue colors. Showing a 3x resolution image in the app vs a 2x + // > resolution image will be visually the same, though the 3x image + // > takes significantly more data. Even true 3x resolution screens are + // > wasteful as the human eye cannot see that level of detail without + // > something like a magnifying glass. + // https://blog.twitter.com/engineering/en_us/topics/infrastructure/2019/capping-image-fidelity-on-ultra-high-resolution-devices.html + [ + width, + width * 2 /*, width * 3*/ + ].map((w)=>allSizes.find((p)=>p >= w) || allSizes[allSizes.length - 1])) + ]; + return { + widths, + kind: 'x' + }; +} +function generateImgAttrs({ config, src, unoptimized, width, quality, sizes, loader }) { + if (unoptimized) { + if (src.startsWith('/') && !src.startsWith('//')) { + let deploymentId = getDeploymentId(); + if (src.includes('/_next/static/immutable') && !getAssetToken()) { + // immutable static asset and supported by platform, don't add `?dpl=` + deploymentId = undefined; + } else if (deploymentId) { + // We unfortunately can't easily use `new URL()` here, because it normalizes the URL which causes + // double-encoding with the `encodeURIComponent(src)` below + const qIndex = src.indexOf('?'); + if (qIndex !== -1) { + const params = new URLSearchParams(src.slice(qIndex + 1)); + const srcDpl = params.get('dpl'); + if (!srcDpl) { + // src is missing the dpl parameter, but we have a deploymentId, so add it to the src URL + params.append('dpl', deploymentId); + src = src.slice(0, qIndex) + '?' + params.toString(); + } + } else { + // src is missing the dpl parameter, but we have a deploymentId, so add it to the src URL + src = src + `?dpl=${deploymentId}`; + } + } + } + return { + src, + srcSet: undefined, + sizes: undefined + }; + } + const { widths, kind } = getWidths(config, width, sizes); + const last = widths.length - 1; + return { + sizes: !sizes && kind === 'w' ? '100vw' : sizes, + srcSet: widths.map((w, i)=>`${loader({ + config, + src, + quality, + width: w + })} ${kind === 'w' ? w : i + 1}${kind}`).join(', '), + // It's intended to keep `src` the last attribute because React updates + // attributes in order. If we keep `src` the first one, Safari will + // immediately start to fetch `src`, before `sizes` and `srcSet` are even + // updated by React. That causes multiple unnecessary requests if `srcSet` + // and `sizes` are defined. + // This bug cannot be reproduced in Chrome or Firefox. + src: loader({ + config, + src, + quality, + width: widths[last] + }) + }; +} +/** + * A shared function, used on both client and server, to generate the props for . + */ export function getImgProps({ src, sizes, unoptimized = false, priority = false, preload = false, loading, className, quality, width, height, fill = false, style, overrideSrc, onLoad, onLoadingComplete, placeholder = 'empty', blurDataURL, fetchPriority, decoding = 'async', layout, objectFit, objectPosition, lazyBoundary, lazyRoot, ...rest }, _state) { + const { imgConf: config, showAltText, blurComplete, defaultLoader } = _state; + if (typeof defaultLoader === 'undefined') { + throw new Error('images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config'); + } + let loader = rest.loader || defaultLoader; + // Remove property so it's not spread on element + delete rest.loader; + delete rest.srcSet; + // This special value indicates that the user + // didn't define a "loader" prop or "loader" config. + const isDefaultLoader = '__next_img_default' in loader; + if (isDefaultLoader) { + if (config.loader === 'custom') { + throw new Error(`Image with src "${src}" is missing "loader" prop.` + `\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader`); + } + } else { + // The user defined a "loader" prop or config. + // Since the config object is internal only, we + // must not pass it to the user-defined "loader". + const customImageLoader = loader; + loader = (obj)=>{ + const { config: _, ...opts } = obj; + return customImageLoader(opts); + }; + } + if (layout) { + if (layout === 'fill') { + fill = true; + } + const layoutToStyle = { + intrinsic: { + maxWidth: '100%', + height: 'auto' + }, + responsive: { + width: '100%', + height: 'auto' + } + }; + const layoutToSizes = { + responsive: '100vw', + fill: '100vw' + }; + const layoutStyle = layoutToStyle[layout]; + if (layoutStyle) { + style = { + ...style, + ...layoutStyle + }; + } + const layoutSizes = layoutToSizes[layout]; + if (layoutSizes && !sizes) { + sizes = layoutSizes; + } + } + let staticSrc = ''; + let widthInt = getInt(width); + let heightInt = getInt(height); + let blurWidth; + let blurHeight; + if (isStaticImport(src)) { + const staticImageData = isStaticRequire(src) ? src.default : src; + if (!staticImageData.src) { + throw new Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(staticImageData)}`); + } + if (!staticImageData.height || !staticImageData.width) { + throw new Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(staticImageData)}`); + } + blurWidth = staticImageData.blurWidth; + blurHeight = staticImageData.blurHeight; + blurDataURL = blurDataURL || staticImageData.blurDataURL; + staticSrc = staticImageData.src; + if (!fill) { + if (!widthInt && !heightInt) { + widthInt = staticImageData.width; + heightInt = staticImageData.height; + } else if (widthInt && !heightInt) { + const ratio = widthInt / staticImageData.width; + heightInt = Math.round(staticImageData.height * ratio); + } else if (!widthInt && heightInt) { + const ratio = heightInt / staticImageData.height; + widthInt = Math.round(staticImageData.width * ratio); + } + } + } + src = typeof src === 'string' ? src : staticSrc; + let isLazy = !priority && !preload && (loading === 'lazy' || typeof loading === 'undefined'); + if (!src || src.startsWith('data:') || src.startsWith('blob:')) { + // https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs + unoptimized = true; + isLazy = false; + } + if (config.unoptimized) { + unoptimized = true; + } + if (isDefaultLoader && !config.dangerouslyAllowSVG && src.split('?', 1)[0].endsWith('.svg')) { + // Special case to make svg serve as-is to avoid proxying + // through the built-in Image Optimization API. + unoptimized = true; + } + const qualityInt = getInt(quality); + if (process.env.NODE_ENV !== 'production') { + const { warnOnce } = require('./utils/warn-once'); + if (config.output === 'export' && isDefaultLoader && !unoptimized) { + throw new Error(`Image Optimization using the default loader is not compatible with \`{ output: 'export' }\`. + Possible solutions: + - Remove \`{ output: 'export' }\` and run "next start" to run server mode including the Image Optimization API. + - Configure \`{ images: { unoptimized: true } }\` in \`next.config.js\` to disable the Image Optimization API. + Read more: https://nextjs.org/docs/messages/export-image-api`); + } + if (!src) { + // React doesn't show the stack trace and there's + // no `src` to help identify which image, so we + // instead console.error(ref) during mount. + unoptimized = true; + } else { + if (fill) { + if (width) { + throw new Error(`Image with src "${src}" has both "width" and "fill" properties. Only one should be used.`); + } + if (height) { + throw new Error(`Image with src "${src}" has both "height" and "fill" properties. Only one should be used.`); + } + if (style?.position && style.position !== 'absolute') { + throw new Error(`Image with src "${src}" has both "fill" and "style.position" properties. Images with "fill" always use position absolute - it cannot be modified.`); + } + if (style?.width && style.width !== '100%') { + throw new Error(`Image with src "${src}" has both "fill" and "style.width" properties. Images with "fill" always use width 100% - it cannot be modified.`); + } + if (style?.height && style.height !== '100%') { + throw new Error(`Image with src "${src}" has both "fill" and "style.height" properties. Images with "fill" always use height 100% - it cannot be modified.`); + } + } else { + if (typeof widthInt === 'undefined') { + throw new Error(`Image with src "${src}" is missing required "width" property.`); + } else if (isNaN(widthInt)) { + throw new Error(`Image with src "${src}" has invalid "width" property. Expected a numeric value in pixels but received "${width}".`); + } + if (typeof heightInt === 'undefined') { + throw new Error(`Image with src "${src}" is missing required "height" property.`); + } else if (isNaN(heightInt)) { + throw new Error(`Image with src "${src}" has invalid "height" property. Expected a numeric value in pixels but received "${height}".`); + } + // eslint-disable-next-line no-control-regex + if (/^[\x00-\x20]/.test(src)) { + throw new Error(`Image with src "${src}" cannot start with a space or control character. Use src.trimStart() to remove it or encodeURIComponent(src) to keep it.`); + } + // eslint-disable-next-line no-control-regex + if (/[\x00-\x20]$/.test(src)) { + throw new Error(`Image with src "${src}" cannot end with a space or control character. Use src.trimEnd() to remove it or encodeURIComponent(src) to keep it.`); + } + } + } + if (!VALID_LOADING_VALUES.includes(loading)) { + throw new Error(`Image with src "${src}" has invalid "loading" property. Provided "${loading}" should be one of ${VALID_LOADING_VALUES.map(String).join(',')}.`); + } + if (priority && loading === 'lazy') { + throw new Error(`Image with src "${src}" has both "priority" and "loading='lazy'" properties. Only one should be used.`); + } + if (preload && loading === 'lazy') { + throw new Error(`Image with src "${src}" has both "preload" and "loading='lazy'" properties. Only one should be used.`); + } + if (preload && priority) { + throw new Error(`Image with src "${src}" has both "preload" and "priority" properties. Only "preload" should be used.`); + } + if (placeholder !== 'empty' && placeholder !== 'blur' && !placeholder.startsWith('data:image/')) { + throw new Error(`Image with src "${src}" has invalid "placeholder" property "${placeholder}".`); + } + if (placeholder !== 'empty') { + if (widthInt && heightInt && widthInt * heightInt < 1600) { + warnOnce(`Image with src "${src}" is smaller than 40x40. Consider removing the "placeholder" property to improve performance.`); + } + } + if (qualityInt && config.qualities && !config.qualities.includes(qualityInt)) { + warnOnce(`Image with src "${src}" is using quality "${qualityInt}" which is not configured in images.qualities [${config.qualities.join(', ')}]. Please update your config to [${[ + ...config.qualities, + qualityInt + ].sort().join(', ')}].` + `\nRead more: https://nextjs.org/docs/messages/next-image-unconfigured-qualities`); + } + if (placeholder === 'blur' && !blurDataURL) { + const VALID_BLUR_EXT = [ + 'jpeg', + 'png', + 'webp', + 'avif' + ] // should match next-image-loader + ; + throw new Error(`Image with src "${src}" has "placeholder='blur'" property but is missing the "blurDataURL" property. + Possible solutions: + - Add a "blurDataURL" property, the contents should be a small Data URL to represent the image + - Change the "src" property to a static import with one of the supported file types: ${VALID_BLUR_EXT.join(',')} (animated images not supported) + - Remove the "placeholder" property, effectively no blur effect + Read more: https://nextjs.org/docs/messages/placeholder-blur-data-url`); + } + if ('ref' in rest) { + warnOnce(`Image with src "${src}" is using unsupported "ref" property. Consider using the "onLoad" property instead.`); + } + if (!unoptimized && !isDefaultLoader) { + const urlStr = loader({ + config, + src, + width: widthInt || 400, + quality: qualityInt || 75 + }); + let url; + try { + url = new URL(urlStr); + } catch (err) {} + if (urlStr === src || url && url.pathname === src && !url.search) { + warnOnce(`Image with src "${src}" has a "loader" property that does not implement width. Please implement it or use the "unoptimized" property instead.` + `\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader-width`); + } + } + if (onLoadingComplete) { + warnOnce(`Image with src "${src}" is using deprecated "onLoadingComplete" property. Please use the "onLoad" property instead.`); + } + for (const [legacyKey, legacyValue] of Object.entries({ + layout, + objectFit, + objectPosition, + lazyBoundary, + lazyRoot + })){ + if (legacyValue) { + warnOnce(`Image with src "${src}" has legacy prop "${legacyKey}". Did you forget to run the codemod?` + `\nRead more: https://nextjs.org/docs/messages/next-image-upgrade-to-13`); + } + } + if (typeof window !== 'undefined' && !perfObserver && window.PerformanceObserver) { + perfObserver = new PerformanceObserver((entryList)=>{ + for (const entry of entryList.getEntries()){ + // @ts-ignore - missing "LargestContentfulPaint" class with "element" prop + const imgSrc = entry?.element?.src || ''; + const lcpImage = allImgs.get(imgSrc); + if (lcpImage && lcpImage.loading === 'lazy' && lcpImage.placeholder === 'empty' && !lcpImage.src.startsWith('data:') && !lcpImage.src.startsWith('blob:')) { + // https://web.dev/lcp/#measure-lcp-in-javascript + warnOnce(`Image with src "${lcpImage.src}" was detected as the Largest Contentful Paint (LCP). Please add the \`loading="eager"\` property if this image is above the fold.` + `\nRead more: https://nextjs.org/docs/app/api-reference/components/image#loading`); + } + } + }); + try { + perfObserver.observe({ + type: 'largest-contentful-paint', + buffered: true + }); + } catch (err) { + // Log error but don't crash the app + console.error(err); + } + } + } + const imgStyle = Object.assign(fill ? { + position: 'absolute', + height: '100%', + width: '100%', + left: 0, + top: 0, + right: 0, + bottom: 0, + objectFit, + objectPosition + } : {}, showAltText ? {} : { + color: 'transparent' + }, style); + const backgroundImage = !blurComplete && placeholder !== 'empty' ? placeholder === 'blur' ? `url("data:image/svg+xml;charset=utf-8,${getImageBlurSvg({ + widthInt, + heightInt, + blurWidth, + blurHeight, + blurDataURL: blurDataURL || '', + objectFit: imgStyle.objectFit + })}")` : `url("${placeholder}")` // assume `data:image/` + : null; + const backgroundSize = !INVALID_BACKGROUND_SIZE_VALUES.includes(imgStyle.objectFit) ? imgStyle.objectFit : imgStyle.objectFit === 'fill' ? '100% 100%' // the background-size equivalent of `fill` + : 'cover'; + let placeholderStyle = backgroundImage ? { + backgroundSize, + backgroundPosition: imgStyle.objectPosition || '50% 50%', + backgroundRepeat: 'no-repeat', + backgroundImage + } : {}; + if (process.env.NODE_ENV === 'development') { + if (placeholderStyle.backgroundImage && placeholder === 'blur' && blurDataURL?.startsWith('/')) { + // During `next dev`, we don't want to generate blur placeholders with webpack + // because it can delay starting the dev server. Instead, `next-image-loader.js` + // will inline a special url to lazily generate the blur placeholder at request time. + placeholderStyle.backgroundImage = `url("${blurDataURL}")`; + } + } + const imgAttributes = generateImgAttrs({ + config, + src, + unoptimized, + width: widthInt, + quality: qualityInt, + sizes, + loader + }); + const loadingFinal = isLazy ? 'lazy' : loading; + if (process.env.NODE_ENV !== 'production') { + if (typeof window !== 'undefined') { + let fullUrl; + try { + fullUrl = new URL(imgAttributes.src); + } catch (e) { + fullUrl = new URL(imgAttributes.src, window.location.href); + } + allImgs.set(fullUrl.href, { + src, + loading: loadingFinal, + placeholder + }); + } + } + const props = { + ...rest, + loading: loadingFinal, + fetchPriority, + width: widthInt, + height: heightInt, + decoding, + className, + style: { + ...imgStyle, + ...placeholderStyle + }, + sizes: imgAttributes.sizes, + srcSet: imgAttributes.srcSet, + src: overrideSrc || imgAttributes.src + }; + const meta = { + unoptimized, + preload: preload || priority, + placeholder, + fill + }; + return { + props, + meta + }; +} + +//# sourceMappingURL=get-img-props.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/get-img-props.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/get-img-props.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e10baa350a055a1e0a531879bf9592ae868c5435 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/get-img-props.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/get-img-props.ts"],"sourcesContent":["import { getAssetToken, getDeploymentId } from './deployment-id'\nimport { getImageBlurSvg } from './image-blur-svg'\nimport type {\n ImageLoaderProps,\n ImageLoaderPropsWithConfig,\n PreparedImageConfig,\n} from './image-config'\n\nimport type { CSSProperties, JSX } from 'react'\n\nexport interface StaticImageData {\n src: string\n height: number\n width: number\n blurDataURL?: string\n blurWidth?: number\n blurHeight?: number\n}\n\nexport interface StaticRequire {\n default: StaticImageData\n}\n\nexport type StaticImport = StaticRequire | StaticImageData\n\nexport type ImageProps = Omit<\n JSX.IntrinsicElements['img'],\n 'src' | 'srcSet' | 'ref' | 'alt' | 'width' | 'height' | 'loading'\n> & {\n src: string | StaticImport\n alt: string\n width?: number | `${number}`\n height?: number | `${number}`\n fill?: boolean\n loader?: ImageLoader\n quality?: number | `${number}`\n preload?: boolean\n /**\n * @deprecated Use `preload` prop instead.\n * See https://nextjs.org/docs/app/api-reference/components/image#preload\n */\n priority?: boolean\n loading?: LoadingValue\n placeholder?: PlaceholderValue\n blurDataURL?: string\n unoptimized?: boolean\n overrideSrc?: string\n /**\n * @deprecated Use `onLoad` instead.\n * @see https://nextjs.org/docs/app/api-reference/components/image#onload\n */\n onLoadingComplete?: OnLoadingComplete\n /**\n * @deprecated Use `fill` prop instead of `layout=\"fill\"` or change import to `next/legacy/image`.\n * @see https://nextjs.org/docs/api-reference/next/legacy/image\n */\n layout?: string\n /**\n * @deprecated Use `style` prop instead.\n */\n objectFit?: string\n /**\n * @deprecated Use `style` prop instead.\n */\n objectPosition?: string\n /**\n * @deprecated This prop does not do anything.\n */\n lazyBoundary?: string\n /**\n * @deprecated This prop does not do anything.\n */\n lazyRoot?: string\n}\n\nexport type ImgProps = Omit & {\n loading: LoadingValue\n width: number | undefined\n height: number | undefined\n style: NonNullable\n sizes: string | undefined\n srcSet: string | undefined\n src: string\n}\n\nconst VALID_LOADING_VALUES = ['lazy', 'eager', undefined] as const\n\n// Object-fit values that are not valid background-size values\nconst INVALID_BACKGROUND_SIZE_VALUES = [\n '-moz-initial',\n 'fill',\n 'none',\n 'scale-down',\n undefined,\n]\ntype LoadingValue = (typeof VALID_LOADING_VALUES)[number]\ntype ImageConfig = PreparedImageConfig\n\nexport type ImageLoader = (p: ImageLoaderProps) => string\n\n// Do not export - this is an internal type only\n// because `next.config.js` is only meant for the\n// built-in loaders, not for a custom loader() prop.\ntype ImageLoaderWithConfig = (p: ImageLoaderPropsWithConfig) => string\n\nexport type PlaceholderValue = 'blur' | 'empty' | `data:image/${string}`\nexport type OnLoad = React.ReactEventHandler | undefined\nexport type OnLoadingComplete = (img: HTMLImageElement) => void\n\nexport type PlaceholderStyle = Partial<\n Pick<\n CSSProperties,\n | 'backgroundSize'\n | 'backgroundPosition'\n | 'backgroundRepeat'\n | 'backgroundImage'\n >\n>\n\nfunction isStaticRequire(\n src: StaticRequire | StaticImageData\n): src is StaticRequire {\n return (src as StaticRequire).default !== undefined\n}\n\nfunction isStaticImageData(\n src: StaticRequire | StaticImageData\n): src is StaticImageData {\n return (src as StaticImageData).src !== undefined\n}\n\nfunction isStaticImport(src: string | StaticImport): src is StaticImport {\n return (\n !!src &&\n typeof src === 'object' &&\n (isStaticRequire(src as StaticImport) ||\n isStaticImageData(src as StaticImport))\n )\n}\n\nconst allImgs = new Map<\n string,\n { src: string; loading: LoadingValue; placeholder: PlaceholderValue }\n>()\nlet perfObserver: PerformanceObserver | undefined\n\nfunction getInt(x: unknown): number | undefined {\n if (typeof x === 'undefined') {\n return x\n }\n if (typeof x === 'number') {\n return Number.isFinite(x) ? x : NaN\n }\n if (typeof x === 'string' && /^[0-9]+$/.test(x)) {\n return parseInt(x, 10)\n }\n return NaN\n}\n\nfunction getWidths(\n { deviceSizes, allSizes }: ImageConfig,\n width: number | undefined,\n sizes: string | undefined\n): { widths: number[]; kind: 'w' | 'x' } {\n if (sizes) {\n // Find all the \"vw\" percent sizes used in the sizes prop\n const viewportWidthRe = /(^|\\s)(1?\\d?\\d)vw/g\n const percentSizes = []\n for (let match; (match = viewportWidthRe.exec(sizes)); match) {\n percentSizes.push(parseInt(match[2]))\n }\n if (percentSizes.length) {\n const smallestRatio = Math.min(...percentSizes) * 0.01\n return {\n widths: allSizes.filter((s) => s >= deviceSizes[0] * smallestRatio),\n kind: 'w',\n }\n }\n return { widths: allSizes, kind: 'w' }\n }\n if (typeof width !== 'number') {\n return { widths: deviceSizes, kind: 'w' }\n }\n\n const widths = [\n ...new Set(\n // > This means that most OLED screens that say they are 3x resolution,\n // > are actually 3x in the green color, but only 1.5x in the red and\n // > blue colors. Showing a 3x resolution image in the app vs a 2x\n // > resolution image will be visually the same, though the 3x image\n // > takes significantly more data. Even true 3x resolution screens are\n // > wasteful as the human eye cannot see that level of detail without\n // > something like a magnifying glass.\n // https://blog.twitter.com/engineering/en_us/topics/infrastructure/2019/capping-image-fidelity-on-ultra-high-resolution-devices.html\n [width, width * 2 /*, width * 3*/].map(\n (w) => allSizes.find((p) => p >= w) || allSizes[allSizes.length - 1]\n )\n ),\n ]\n return { widths, kind: 'x' }\n}\n\ntype GenImgAttrsData = {\n config: ImageConfig\n src: string\n unoptimized: boolean\n loader: ImageLoaderWithConfig\n width?: number\n quality?: number\n sizes?: string\n}\n\ntype GenImgAttrsResult = {\n src: string\n srcSet: string | undefined\n sizes: string | undefined\n}\n\nfunction generateImgAttrs({\n config,\n src,\n unoptimized,\n width,\n quality,\n sizes,\n loader,\n}: GenImgAttrsData): GenImgAttrsResult {\n if (unoptimized) {\n if (src.startsWith('/') && !src.startsWith('//')) {\n let deploymentId = getDeploymentId()\n if (src.includes('/_next/static/immutable') && !getAssetToken()) {\n // immutable static asset and supported by platform, don't add `?dpl=`\n deploymentId = undefined\n } else if (deploymentId) {\n // We unfortunately can't easily use `new URL()` here, because it normalizes the URL which causes\n // double-encoding with the `encodeURIComponent(src)` below\n const qIndex = src.indexOf('?')\n if (qIndex !== -1) {\n const params = new URLSearchParams(src.slice(qIndex + 1))\n const srcDpl = params.get('dpl')\n if (!srcDpl) {\n // src is missing the dpl parameter, but we have a deploymentId, so add it to the src URL\n params.append('dpl', deploymentId)\n src = src.slice(0, qIndex) + '?' + params.toString()\n }\n } else {\n // src is missing the dpl parameter, but we have a deploymentId, so add it to the src URL\n src = src + `?dpl=${deploymentId}`\n }\n }\n }\n return { src, srcSet: undefined, sizes: undefined }\n }\n\n const { widths, kind } = getWidths(config, width, sizes)\n const last = widths.length - 1\n\n return {\n sizes: !sizes && kind === 'w' ? '100vw' : sizes,\n srcSet: widths\n .map(\n (w, i) =>\n `${loader({ config, src, quality, width: w })} ${\n kind === 'w' ? w : i + 1\n }${kind}`\n )\n .join(', '),\n\n // It's intended to keep `src` the last attribute because React updates\n // attributes in order. If we keep `src` the first one, Safari will\n // immediately start to fetch `src`, before `sizes` and `srcSet` are even\n // updated by React. That causes multiple unnecessary requests if `srcSet`\n // and `sizes` are defined.\n // This bug cannot be reproduced in Chrome or Firefox.\n src: loader({ config, src, quality, width: widths[last] }),\n }\n}\n\n/**\n * A shared function, used on both client and server, to generate the props for .\n */\nexport function getImgProps(\n {\n src,\n sizes,\n unoptimized = false,\n priority = false,\n preload = false,\n loading,\n className,\n quality,\n width,\n height,\n fill = false,\n style,\n overrideSrc,\n onLoad,\n onLoadingComplete,\n placeholder = 'empty',\n blurDataURL,\n fetchPriority,\n decoding = 'async',\n layout,\n objectFit,\n objectPosition,\n lazyBoundary,\n lazyRoot,\n ...rest\n }: ImageProps,\n _state: {\n defaultLoader: ImageLoaderWithConfig\n imgConf: ImageConfig\n showAltText?: boolean\n blurComplete?: boolean\n }\n): {\n props: ImgProps\n meta: {\n unoptimized: boolean\n preload: boolean\n placeholder: NonNullable\n fill: boolean\n }\n} {\n const { imgConf: config, showAltText, blurComplete, defaultLoader } = _state\n\n if (typeof defaultLoader === 'undefined') {\n throw new Error(\n 'images.loaderFile detected but the file is missing default export.\\nRead more: https://nextjs.org/docs/messages/invalid-images-config'\n )\n }\n let loader: ImageLoaderWithConfig = rest.loader || defaultLoader\n\n // Remove property so it's not spread on element\n delete rest.loader\n delete (rest as any).srcSet\n\n // This special value indicates that the user\n // didn't define a \"loader\" prop or \"loader\" config.\n const isDefaultLoader = '__next_img_default' in loader\n\n if (isDefaultLoader) {\n if (config.loader === 'custom') {\n throw new Error(\n `Image with src \"${src}\" is missing \"loader\" prop.` +\n `\\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader`\n )\n }\n } else {\n // The user defined a \"loader\" prop or config.\n // Since the config object is internal only, we\n // must not pass it to the user-defined \"loader\".\n const customImageLoader = loader as ImageLoader\n loader = (obj) => {\n const { config: _, ...opts } = obj\n return customImageLoader(opts)\n }\n }\n\n if (layout) {\n if (layout === 'fill') {\n fill = true\n }\n const layoutToStyle: Record | undefined> = {\n intrinsic: { maxWidth: '100%', height: 'auto' },\n responsive: { width: '100%', height: 'auto' },\n }\n const layoutToSizes: Record = {\n responsive: '100vw',\n fill: '100vw',\n }\n const layoutStyle = layoutToStyle[layout]\n if (layoutStyle) {\n style = { ...style, ...layoutStyle }\n }\n const layoutSizes = layoutToSizes[layout]\n if (layoutSizes && !sizes) {\n sizes = layoutSizes\n }\n }\n\n let staticSrc = ''\n let widthInt = getInt(width)\n let heightInt = getInt(height)\n let blurWidth: number | undefined\n let blurHeight: number | undefined\n if (isStaticImport(src)) {\n const staticImageData = isStaticRequire(src) ? src.default : src\n\n if (!staticImageData.src) {\n throw new Error(\n `An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(\n staticImageData\n )}`\n )\n }\n if (!staticImageData.height || !staticImageData.width) {\n throw new Error(\n `An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(\n staticImageData\n )}`\n )\n }\n\n blurWidth = staticImageData.blurWidth\n blurHeight = staticImageData.blurHeight\n blurDataURL = blurDataURL || staticImageData.blurDataURL\n staticSrc = staticImageData.src\n\n if (!fill) {\n if (!widthInt && !heightInt) {\n widthInt = staticImageData.width\n heightInt = staticImageData.height\n } else if (widthInt && !heightInt) {\n const ratio = widthInt / staticImageData.width\n heightInt = Math.round(staticImageData.height * ratio)\n } else if (!widthInt && heightInt) {\n const ratio = heightInt / staticImageData.height\n widthInt = Math.round(staticImageData.width * ratio)\n }\n }\n }\n src = typeof src === 'string' ? src : staticSrc\n\n let isLazy =\n !priority &&\n !preload &&\n (loading === 'lazy' || typeof loading === 'undefined')\n if (!src || src.startsWith('data:') || src.startsWith('blob:')) {\n // https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs\n unoptimized = true\n isLazy = false\n }\n if (config.unoptimized) {\n unoptimized = true\n }\n if (\n isDefaultLoader &&\n !config.dangerouslyAllowSVG &&\n src.split('?', 1)[0].endsWith('.svg')\n ) {\n // Special case to make svg serve as-is to avoid proxying\n // through the built-in Image Optimization API.\n unoptimized = true\n }\n\n const qualityInt = getInt(quality)\n\n if (process.env.NODE_ENV !== 'production') {\n const { warnOnce } =\n require('./utils/warn-once') as typeof import('./utils/warn-once')\n if (config.output === 'export' && isDefaultLoader && !unoptimized) {\n throw new Error(\n `Image Optimization using the default loader is not compatible with \\`{ output: 'export' }\\`.\n Possible solutions:\n - Remove \\`{ output: 'export' }\\` and run \"next start\" to run server mode including the Image Optimization API.\n - Configure \\`{ images: { unoptimized: true } }\\` in \\`next.config.js\\` to disable the Image Optimization API.\n Read more: https://nextjs.org/docs/messages/export-image-api`\n )\n }\n if (!src) {\n // React doesn't show the stack trace and there's\n // no `src` to help identify which image, so we\n // instead console.error(ref) during mount.\n unoptimized = true\n } else {\n if (fill) {\n if (width) {\n throw new Error(\n `Image with src \"${src}\" has both \"width\" and \"fill\" properties. Only one should be used.`\n )\n }\n if (height) {\n throw new Error(\n `Image with src \"${src}\" has both \"height\" and \"fill\" properties. Only one should be used.`\n )\n }\n if (style?.position && style.position !== 'absolute') {\n throw new Error(\n `Image with src \"${src}\" has both \"fill\" and \"style.position\" properties. Images with \"fill\" always use position absolute - it cannot be modified.`\n )\n }\n if (style?.width && style.width !== '100%') {\n throw new Error(\n `Image with src \"${src}\" has both \"fill\" and \"style.width\" properties. Images with \"fill\" always use width 100% - it cannot be modified.`\n )\n }\n if (style?.height && style.height !== '100%') {\n throw new Error(\n `Image with src \"${src}\" has both \"fill\" and \"style.height\" properties. Images with \"fill\" always use height 100% - it cannot be modified.`\n )\n }\n } else {\n if (typeof widthInt === 'undefined') {\n throw new Error(\n `Image with src \"${src}\" is missing required \"width\" property.`\n )\n } else if (isNaN(widthInt)) {\n throw new Error(\n `Image with src \"${src}\" has invalid \"width\" property. Expected a numeric value in pixels but received \"${width}\".`\n )\n }\n if (typeof heightInt === 'undefined') {\n throw new Error(\n `Image with src \"${src}\" is missing required \"height\" property.`\n )\n } else if (isNaN(heightInt)) {\n throw new Error(\n `Image with src \"${src}\" has invalid \"height\" property. Expected a numeric value in pixels but received \"${height}\".`\n )\n }\n // eslint-disable-next-line no-control-regex\n if (/^[\\x00-\\x20]/.test(src)) {\n throw new Error(\n `Image with src \"${src}\" cannot start with a space or control character. Use src.trimStart() to remove it or encodeURIComponent(src) to keep it.`\n )\n }\n // eslint-disable-next-line no-control-regex\n if (/[\\x00-\\x20]$/.test(src)) {\n throw new Error(\n `Image with src \"${src}\" cannot end with a space or control character. Use src.trimEnd() to remove it or encodeURIComponent(src) to keep it.`\n )\n }\n }\n }\n if (!VALID_LOADING_VALUES.includes(loading)) {\n throw new Error(\n `Image with src \"${src}\" has invalid \"loading\" property. Provided \"${loading}\" should be one of ${VALID_LOADING_VALUES.map(\n String\n ).join(',')}.`\n )\n }\n if (priority && loading === 'lazy') {\n throw new Error(\n `Image with src \"${src}\" has both \"priority\" and \"loading='lazy'\" properties. Only one should be used.`\n )\n }\n if (preload && loading === 'lazy') {\n throw new Error(\n `Image with src \"${src}\" has both \"preload\" and \"loading='lazy'\" properties. Only one should be used.`\n )\n }\n if (preload && priority) {\n throw new Error(\n `Image with src \"${src}\" has both \"preload\" and \"priority\" properties. Only \"preload\" should be used.`\n )\n }\n if (\n placeholder !== 'empty' &&\n placeholder !== 'blur' &&\n !placeholder.startsWith('data:image/')\n ) {\n throw new Error(\n `Image with src \"${src}\" has invalid \"placeholder\" property \"${placeholder}\".`\n )\n }\n if (placeholder !== 'empty') {\n if (widthInt && heightInt && widthInt * heightInt < 1600) {\n warnOnce(\n `Image with src \"${src}\" is smaller than 40x40. Consider removing the \"placeholder\" property to improve performance.`\n )\n }\n }\n if (\n qualityInt &&\n config.qualities &&\n !config.qualities.includes(qualityInt)\n ) {\n warnOnce(\n `Image with src \"${src}\" is using quality \"${qualityInt}\" which is not configured in images.qualities [${config.qualities.join(', ')}]. Please update your config to [${[...config.qualities, qualityInt].sort().join(', ')}].` +\n `\\nRead more: https://nextjs.org/docs/messages/next-image-unconfigured-qualities`\n )\n }\n if (placeholder === 'blur' && !blurDataURL) {\n const VALID_BLUR_EXT = ['jpeg', 'png', 'webp', 'avif'] // should match next-image-loader\n\n throw new Error(\n `Image with src \"${src}\" has \"placeholder='blur'\" property but is missing the \"blurDataURL\" property.\n Possible solutions:\n - Add a \"blurDataURL\" property, the contents should be a small Data URL to represent the image\n - Change the \"src\" property to a static import with one of the supported file types: ${VALID_BLUR_EXT.join(\n ','\n )} (animated images not supported)\n - Remove the \"placeholder\" property, effectively no blur effect\n Read more: https://nextjs.org/docs/messages/placeholder-blur-data-url`\n )\n }\n if ('ref' in rest) {\n warnOnce(\n `Image with src \"${src}\" is using unsupported \"ref\" property. Consider using the \"onLoad\" property instead.`\n )\n }\n\n if (!unoptimized && !isDefaultLoader) {\n const urlStr = loader({\n config,\n src,\n width: widthInt || 400,\n quality: qualityInt || 75,\n })\n let url: URL | undefined\n try {\n url = new URL(urlStr)\n } catch (err) {}\n if (urlStr === src || (url && url.pathname === src && !url.search)) {\n warnOnce(\n `Image with src \"${src}\" has a \"loader\" property that does not implement width. Please implement it or use the \"unoptimized\" property instead.` +\n `\\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader-width`\n )\n }\n }\n\n if (onLoadingComplete) {\n warnOnce(\n `Image with src \"${src}\" is using deprecated \"onLoadingComplete\" property. Please use the \"onLoad\" property instead.`\n )\n }\n\n for (const [legacyKey, legacyValue] of Object.entries({\n layout,\n objectFit,\n objectPosition,\n lazyBoundary,\n lazyRoot,\n })) {\n if (legacyValue) {\n warnOnce(\n `Image with src \"${src}\" has legacy prop \"${legacyKey}\". Did you forget to run the codemod?` +\n `\\nRead more: https://nextjs.org/docs/messages/next-image-upgrade-to-13`\n )\n }\n }\n\n if (\n typeof window !== 'undefined' &&\n !perfObserver &&\n window.PerformanceObserver\n ) {\n perfObserver = new PerformanceObserver((entryList) => {\n for (const entry of entryList.getEntries()) {\n // @ts-ignore - missing \"LargestContentfulPaint\" class with \"element\" prop\n const imgSrc = entry?.element?.src || ''\n const lcpImage = allImgs.get(imgSrc)\n if (\n lcpImage &&\n lcpImage.loading === 'lazy' &&\n lcpImage.placeholder === 'empty' &&\n !lcpImage.src.startsWith('data:') &&\n !lcpImage.src.startsWith('blob:')\n ) {\n // https://web.dev/lcp/#measure-lcp-in-javascript\n warnOnce(\n `Image with src \"${lcpImage.src}\" was detected as the Largest Contentful Paint (LCP). Please add the \\`loading=\"eager\"\\` property if this image is above the fold.` +\n `\\nRead more: https://nextjs.org/docs/app/api-reference/components/image#loading`\n )\n }\n }\n })\n try {\n perfObserver.observe({\n type: 'largest-contentful-paint',\n buffered: true,\n })\n } catch (err) {\n // Log error but don't crash the app\n console.error(err)\n }\n }\n }\n const imgStyle = Object.assign(\n fill\n ? {\n position: 'absolute',\n height: '100%',\n width: '100%',\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n objectFit,\n objectPosition,\n }\n : {},\n showAltText ? {} : { color: 'transparent' },\n style\n )\n\n const backgroundImage =\n !blurComplete && placeholder !== 'empty'\n ? placeholder === 'blur'\n ? `url(\"data:image/svg+xml;charset=utf-8,${getImageBlurSvg({\n widthInt,\n heightInt,\n blurWidth,\n blurHeight,\n blurDataURL: blurDataURL || '', // assume not undefined\n objectFit: imgStyle.objectFit,\n })}\")`\n : `url(\"${placeholder}\")` // assume `data:image/`\n : null\n\n const backgroundSize = !INVALID_BACKGROUND_SIZE_VALUES.includes(\n imgStyle.objectFit\n )\n ? imgStyle.objectFit\n : imgStyle.objectFit === 'fill'\n ? '100% 100%' // the background-size equivalent of `fill`\n : 'cover'\n\n let placeholderStyle: PlaceholderStyle = backgroundImage\n ? {\n backgroundSize,\n backgroundPosition: imgStyle.objectPosition || '50% 50%',\n backgroundRepeat: 'no-repeat',\n backgroundImage,\n }\n : {}\n\n if (process.env.NODE_ENV === 'development') {\n if (\n placeholderStyle.backgroundImage &&\n placeholder === 'blur' &&\n blurDataURL?.startsWith('/')\n ) {\n // During `next dev`, we don't want to generate blur placeholders with webpack\n // because it can delay starting the dev server. Instead, `next-image-loader.js`\n // will inline a special url to lazily generate the blur placeholder at request time.\n placeholderStyle.backgroundImage = `url(\"${blurDataURL}\")`\n }\n }\n\n const imgAttributes = generateImgAttrs({\n config,\n src,\n unoptimized,\n width: widthInt,\n quality: qualityInt,\n sizes,\n loader,\n })\n\n const loadingFinal = isLazy ? 'lazy' : loading\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof window !== 'undefined') {\n let fullUrl: URL\n try {\n fullUrl = new URL(imgAttributes.src)\n } catch (e) {\n fullUrl = new URL(imgAttributes.src, window.location.href)\n }\n allImgs.set(fullUrl.href, { src, loading: loadingFinal, placeholder })\n }\n }\n\n const props: ImgProps = {\n ...rest,\n loading: loadingFinal,\n fetchPriority,\n width: widthInt,\n height: heightInt,\n decoding,\n className,\n style: { ...imgStyle, ...placeholderStyle },\n sizes: imgAttributes.sizes,\n srcSet: imgAttributes.srcSet,\n src: overrideSrc || imgAttributes.src,\n }\n const meta = { unoptimized, preload: preload || priority, placeholder, fill }\n return { props, meta }\n}\n"],"names":["getAssetToken","getDeploymentId","getImageBlurSvg","VALID_LOADING_VALUES","undefined","INVALID_BACKGROUND_SIZE_VALUES","isStaticRequire","src","default","isStaticImageData","isStaticImport","allImgs","Map","perfObserver","getInt","x","Number","isFinite","NaN","test","parseInt","getWidths","deviceSizes","allSizes","width","sizes","viewportWidthRe","percentSizes","match","exec","push","length","smallestRatio","Math","min","widths","filter","s","kind","Set","map","w","find","p","generateImgAttrs","config","unoptimized","quality","loader","startsWith","deploymentId","includes","qIndex","indexOf","params","URLSearchParams","slice","srcDpl","get","append","toString","srcSet","last","i","join","getImgProps","priority","preload","loading","className","height","fill","style","overrideSrc","onLoad","onLoadingComplete","placeholder","blurDataURL","fetchPriority","decoding","layout","objectFit","objectPosition","lazyBoundary","lazyRoot","rest","_state","imgConf","showAltText","blurComplete","defaultLoader","Error","isDefaultLoader","customImageLoader","obj","_","opts","layoutToStyle","intrinsic","maxWidth","responsive","layoutToSizes","layoutStyle","layoutSizes","staticSrc","widthInt","heightInt","blurWidth","blurHeight","staticImageData","JSON","stringify","ratio","round","isLazy","dangerouslyAllowSVG","split","endsWith","qualityInt","process","env","NODE_ENV","warnOnce","require","output","position","isNaN","String","qualities","sort","VALID_BLUR_EXT","urlStr","url","URL","err","pathname","search","legacyKey","legacyValue","Object","entries","window","PerformanceObserver","entryList","entry","getEntries","imgSrc","element","lcpImage","observe","type","buffered","console","error","imgStyle","assign","left","top","right","bottom","color","backgroundImage","backgroundSize","placeholderStyle","backgroundPosition","backgroundRepeat","imgAttributes","loadingFinal","fullUrl","e","location","href","set","props","meta"],"mappings":"AAAA,SAASA,aAAa,EAAEC,eAAe,QAAQ,kBAAiB;AAChE,SAASC,eAAe,QAAQ,mBAAkB;AAoFlD,MAAMC,uBAAuB;IAAC;IAAQ;IAASC;CAAU;AAEzD,8DAA8D;AAC9D,MAAMC,iCAAiC;IACrC;IACA;IACA;IACA;IACAD;CACD;AAyBD,SAASE,gBACPC,GAAoC;IAEpC,OAAO,AAACA,IAAsBC,OAAO,KAAKJ;AAC5C;AAEA,SAASK,kBACPF,GAAoC;IAEpC,OAAO,AAACA,IAAwBA,GAAG,KAAKH;AAC1C;AAEA,SAASM,eAAeH,GAA0B;IAChD,OACE,CAAC,CAACA,OACF,OAAOA,QAAQ,YACdD,CAAAA,gBAAgBC,QACfE,kBAAkBF,IAAmB;AAE3C;AAEA,MAAMI,UAAU,IAAIC;AAIpB,IAAIC;AAEJ,SAASC,OAAOC,CAAU;IACxB,IAAI,OAAOA,MAAM,aAAa;QAC5B,OAAOA;IACT;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aL;IAAK;IAC5E,OAAO;QAAEsG;QAAOC;IAAK;AACvB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/get-rspack.js b/e-commerce/node_modules/next/dist/esm/shared/lib/get-rspack.js new file mode 100644 index 0000000000000000000000000000000000000000..8e0f0a920d3dade920e5d1d3082fe8e0723ded7f --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/get-rspack.js @@ -0,0 +1,21 @@ +import { warnOnce } from '../../build/output/log'; +export function getRspackCore() { + warnRspack(); + try { + // eslint-disable-next-line @next/internal/typechecked-require + return require('next-rspack/rspack-core'); + } catch (e) { + if (e instanceof Error && 'code' in e && e.code === 'MODULE_NOT_FOUND') { + throw new Error('@rspack/core is not available. Please make sure `next-rspack` is correctly installed.'); + } + throw e; + } +} +function warnRspack() { + if (process.env.__NEXT_TEST_MODE) { + return; + } + warnOnce(`\`next-rspack\` is currently experimental. It's not an official Next.js plugin, and is supported by the Rspack team in partnership with Next.js. Help improve Next.js and Rspack by providing feedback at https://github.com/vercel/next.js/discussions/77800`); +} + +//# sourceMappingURL=get-rspack.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/get-rspack.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/get-rspack.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e59b4337f46078351f14d148716aec3e30141b47 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/get-rspack.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/get-rspack.ts"],"sourcesContent":["import { warnOnce } from '../../build/output/log'\n\nexport function getRspackCore() {\n warnRspack()\n try {\n // eslint-disable-next-line @next/internal/typechecked-require\n return require('next-rspack/rspack-core')\n } catch (e) {\n if (e instanceof Error && 'code' in e && e.code === 'MODULE_NOT_FOUND') {\n throw new Error(\n '@rspack/core is not available. Please make sure `next-rspack` is correctly installed.'\n )\n }\n\n throw e\n }\n}\n\nfunction warnRspack() {\n if (process.env.__NEXT_TEST_MODE) {\n return\n }\n warnOnce(\n `\\`next-rspack\\` is currently experimental. It's not an official Next.js plugin, and is supported by the Rspack team in partnership with Next.js. Help improve Next.js and Rspack by providing feedback at https://github.com/vercel/next.js/discussions/77800`\n )\n}\n"],"names":["warnOnce","getRspackCore","warnRspack","require","e","Error","code","process","env","__NEXT_TEST_MODE"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,yBAAwB;AAEjD,OAAO,SAASC;IACdC;IACA,IAAI;QACF,8DAA8D;QAC9D,OAAOC,QAAQ;IACjB,EAAE,OAAOC,GAAG;QACV,IAAIA,aAAaC,SAAS,UAAUD,KAAKA,EAAEE,IAAI,KAAK,oBAAoB;YACtE,MAAM,IAAID,MACR;QAEJ;QAEA,MAAMD;IACR;AACF;AAEA,SAASF;IACP,IAAIK,QAAQC,GAAG,CAACC,gBAAgB,EAAE;QAChC;IACF;IACAT,SACE,CAAC,6PAA6P,CAAC;AAEnQ","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/get-webpack-bundler.js b/e-commerce/node_modules/next/dist/esm/shared/lib/get-webpack-bundler.js new file mode 100644 index 0000000000000000000000000000000000000000..87f5dd63533f1c0f0ea08e186b9e73f902a0c201 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/get-webpack-bundler.js @@ -0,0 +1,12 @@ +import { webpack } from 'next/dist/compiled/webpack/webpack'; +import { getRspackCore } from './get-rspack'; +/** + * Depending on if Rspack is active or not, returns the appropriate set of + * webpack-compatible api. + * + * @returns webpack bundler + */ export default function getWebpackBundler() { + return process.env.NEXT_RSPACK ? getRspackCore() : webpack; +} + +//# sourceMappingURL=get-webpack-bundler.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/get-webpack-bundler.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/get-webpack-bundler.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d9946f48e2595aae04ee1184986393d6e22ae1e1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/get-webpack-bundler.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/get-webpack-bundler.ts"],"sourcesContent":["import { webpack } from 'next/dist/compiled/webpack/webpack'\nimport { getRspackCore } from './get-rspack'\n\n/**\n * Depending on if Rspack is active or not, returns the appropriate set of\n * webpack-compatible api.\n *\n * @returns webpack bundler\n */\nexport default function getWebpackBundler(): typeof webpack {\n return process.env.NEXT_RSPACK ? getRspackCore() : webpack\n}\n"],"names":["webpack","getRspackCore","getWebpackBundler","process","env","NEXT_RSPACK"],"mappings":"AAAA,SAASA,OAAO,QAAQ,qCAAoC;AAC5D,SAASC,aAAa,QAAQ,eAAc;AAE5C;;;;;CAKC,GACD,eAAe,SAASC;IACtB,OAAOC,QAAQC,GAAG,CAACC,WAAW,GAAGJ,kBAAkBD;AACrD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/hash.js b/e-commerce/node_modules/next/dist/esm/shared/lib/hash.js new file mode 100644 index 0000000000000000000000000000000000000000..279667a217cea0bac95a910b6c50def5fb3812c1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/hash.js @@ -0,0 +1,20 @@ +// http://www.cse.yorku.ca/~oz/hash.html +// More specifically, 32-bit hash via djbxor +// (ref: https://gist.github.com/eplawless/52813b1d8ad9af510d85?permalink_comment_id=3367765#gistcomment-3367765) +// This is due to number type differences between rust for turbopack to js number types, +// where rust does not have easy way to repreesnt js's 53-bit float number type for the matching +// overflow behavior. This is more `correct` in terms of having canonical hash across different runtime / implementation +// as can gaurantee determinstic output from 32bit hash. +export function djb2Hash(str) { + let hash = 5381; + for(let i = 0; i < str.length; i++){ + const char = str.charCodeAt(i); + hash = (hash << 5) + hash + char & 0xffffffff; + } + return hash >>> 0; +} +export function hexHash(str) { + return djb2Hash(str).toString(36).slice(0, 5); +} + +//# sourceMappingURL=hash.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/hash.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/hash.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ec651d020e93b1bfd98bfc12de095459fbcbca37 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/hash.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/hash.ts"],"sourcesContent":["// http://www.cse.yorku.ca/~oz/hash.html\n// More specifically, 32-bit hash via djbxor\n// (ref: https://gist.github.com/eplawless/52813b1d8ad9af510d85?permalink_comment_id=3367765#gistcomment-3367765)\n// This is due to number type differences between rust for turbopack to js number types,\n// where rust does not have easy way to repreesnt js's 53-bit float number type for the matching\n// overflow behavior. This is more `correct` in terms of having canonical hash across different runtime / implementation\n// as can gaurantee determinstic output from 32bit hash.\nexport function djb2Hash(str: string) {\n let hash = 5381\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i)\n hash = ((hash << 5) + hash + char) & 0xffffffff\n }\n return hash >>> 0\n}\n\nexport function hexHash(str: string) {\n return djb2Hash(str).toString(36).slice(0, 5)\n}\n"],"names":["djb2Hash","str","hash","i","length","char","charCodeAt","hexHash","toString","slice"],"mappings":"AAAA,wCAAwC;AACxC,4CAA4C;AAC5C,iHAAiH;AACjH,wFAAwF;AACxF,gGAAgG;AAChG,wHAAwH;AACxH,wDAAwD;AACxD,OAAO,SAASA,SAASC,GAAW;IAClC,IAAIC,OAAO;IACX,IAAK,IAAIC,IAAI,GAAGA,IAAIF,IAAIG,MAAM,EAAED,IAAK;QACnC,MAAME,OAAOJ,IAAIK,UAAU,CAACH;QAC5BD,OAAO,AAAEA,CAAAA,QAAQ,CAAA,IAAKA,OAAOG,OAAQ;IACvC;IACA,OAAOH,SAAS;AAClB;AAEA,OAAO,SAASK,QAAQN,GAAW;IACjC,OAAOD,SAASC,KAAKO,QAAQ,CAAC,IAAIC,KAAK,CAAC,GAAG;AAC7C","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/head-manager-context.shared-runtime.js b/e-commerce/node_modules/next/dist/esm/shared/lib/head-manager-context.shared-runtime.js new file mode 100644 index 0000000000000000000000000000000000000000..9da0222f95448892fa7df8fbf35e086276ed4849 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/head-manager-context.shared-runtime.js @@ -0,0 +1,7 @@ +import React from 'react'; +export const HeadManagerContext = React.createContext({}); +if (process.env.NODE_ENV !== 'production') { + HeadManagerContext.displayName = 'HeadManagerContext'; +} + +//# sourceMappingURL=head-manager-context.shared-runtime.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/head-manager-context.shared-runtime.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/head-manager-context.shared-runtime.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ddafcc43cdcd7e259d217022eb32eb4fce9b2ac5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/head-manager-context.shared-runtime.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/head-manager-context.shared-runtime.ts"],"sourcesContent":["import React from 'react'\n\nexport const HeadManagerContext: React.Context<{\n updateHead?: (state: any) => void\n mountedInstances?: any\n updateScripts?: (state: any) => void\n scripts?: any\n getIsSsr?: () => boolean\n\n // Used in app directory, to render script tags as server components.\n appDir?: boolean\n nonce?: string\n}> = React.createContext({})\n\nif (process.env.NODE_ENV !== 'production') {\n HeadManagerContext.displayName = 'HeadManagerContext'\n}\n"],"names":["React","HeadManagerContext","createContext","process","env","NODE_ENV","displayName"],"mappings":"AAAA,OAAOA,WAAW,QAAO;AAEzB,OAAO,MAAMC,qBAURD,MAAME,aAAa,CAAC,CAAC,GAAE;AAE5B,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzCJ,mBAAmBK,WAAW,GAAG;AACnC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/head.js b/e-commerce/node_modules/next/dist/esm/shared/lib/head.js new file mode 100644 index 0000000000000000000000000000000000000000..266296bdbf8d6ed5dc5d08ba77d9c8d22eb13394 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/head.js @@ -0,0 +1,134 @@ +'use client'; +import { jsx as _jsx } from "react/jsx-runtime"; +import React, { useContext } from 'react'; +import Effect from './side-effect'; +import { HeadManagerContext } from './head-manager-context.shared-runtime'; +export function defaultHead() { + const head = [ + /*#__PURE__*/ _jsx("meta", { + charSet: "utf-8" + }, "charset"), + /*#__PURE__*/ _jsx("meta", { + name: "viewport", + content: "width=device-width" + }, "viewport") + ]; + return head; +} +function onlyReactElement(list, child) { + // React children can be "string" or "number" in this case we ignore them for backwards compat + if (typeof child === 'string' || typeof child === 'number') { + return list; + } + // Adds support for React.Fragment + if (child.type === React.Fragment) { + return list.concat(// @ts-expect-error @types/react does not remove fragments but this could also return ReactPortal[] + React.Children.toArray(child.props.children).reduce(// @ts-expect-error @types/react does not remove fragments but this could also return ReactPortal[] + (fragmentList, fragmentChild)=>{ + if (typeof fragmentChild === 'string' || typeof fragmentChild === 'number') { + return fragmentList; + } + return fragmentList.concat(fragmentChild); + }, [])); + } + return list.concat(child); +} +const METATYPES = [ + 'name', + 'httpEquiv', + 'charSet', + 'itemProp' +]; +/* + returns a function for filtering head child elements + which shouldn't be duplicated, like + Also adds support for deduplicated `key` properties +*/ function unique() { + const keys = new Set(); + const tags = new Set(); + const metaTypes = new Set(); + const metaCategories = {}; + return (h)=>{ + let isUnique = true; + let hasKey = false; + if (h.key && typeof h.key !== 'number' && h.key.indexOf('$') > 0) { + hasKey = true; + const key = h.key.slice(h.key.indexOf('$') + 1); + if (keys.has(key)) { + isUnique = false; + } else { + keys.add(key); + } + } + switch(h.type){ + case 'title': + case 'base': + if (tags.has(h.type)) { + isUnique = false; + } else { + tags.add(h.type); + } + break; + case 'meta': + for(let i = 0, len = METATYPES.length; i < len; i++){ + const metatype = METATYPES[i]; + if (!h.props.hasOwnProperty(metatype)) continue; + if (metatype === 'charSet') { + if (metaTypes.has(metatype)) { + isUnique = false; + } else { + metaTypes.add(metatype); + } + } else { + const category = h.props[metatype]; + const categories = metaCategories[metatype] || new Set(); + if ((metatype !== 'name' || !hasKey) && categories.has(category)) { + isUnique = false; + } else { + categories.add(category); + metaCategories[metatype] = categories; + } + } + } + break; + default: + break; + } + return isUnique; + }; +} +/** + * + * @param headChildrenElements List of children of <Head> + */ function reduceComponents(headChildrenElements) { + return headChildrenElements.reduce(onlyReactElement, []).reverse().concat(defaultHead().reverse()).filter(unique()).reverse().map((c, i)=>{ + const key = c.key || i; + if (process.env.NODE_ENV === 'development') { + const { warnOnce } = require('./utils/warn-once'); + // omit JSON-LD structured data snippets from the warning + if (c.type === 'script' && c.props['type'] !== 'application/ld+json') { + const srcMessage = c.props['src'] ? `<script> tag with src="${c.props['src']}"` : `inline <script>`; + warnOnce(`Do not add <script> tags using next/head (see ${srcMessage}). Use next/script instead. \nSee more info here: https://nextjs.org/docs/messages/no-script-tags-in-head-component`); + } else if (c.type === 'link' && c.props['rel'] === 'stylesheet') { + warnOnce(`Do not add stylesheets using next/head (see <link rel="stylesheet"> tag with href="${c.props['href']}"). Use Document instead. \nSee more info here: https://nextjs.org/docs/messages/no-stylesheets-in-head-component`); + } + } + return /*#__PURE__*/ React.cloneElement(c, { + key + }); + }); +} +/** + * This component injects elements to `<head>` of your page. + * To avoid duplicated `tags` in `<head>` you can use the `key` property, which will make sure every tag is only rendered once. + */ function Head({ children }) { + const headManager = useContext(HeadManagerContext); + return /*#__PURE__*/ _jsx(Effect, { + reduceComponentsToState: reduceComponents, + headManager: headManager, + children: children + }); +} +export default Head; + +//# sourceMappingURL=head.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/head.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/head.js.map new file mode 100644 index 0000000000000000000000000000000000000000..4be0aa7cbb67e047331d7cae82abb05c530c43f1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/head.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/head.tsx"],"sourcesContent":["'use client'\n\nimport React, { useContext, type JSX } from 'react'\nimport Effect from './side-effect'\nimport { HeadManagerContext } from './head-manager-context.shared-runtime'\n\nexport function defaultHead(): JSX.Element[] {\n const head = [\n <meta charSet=\"utf-8\" key=\"charset\" />,\n <meta name=\"viewport\" content=\"width=device-width\" key=\"viewport\" />,\n ]\n return head\n}\n\nfunction onlyReactElement(\n list: Array<React.ReactElement<any>>,\n child: React.ReactElement | number | string\n): Array<React.ReactElement<any>> {\n // React children can be \"string\" or \"number\" in this case we ignore them for backwards compat\n if (typeof child === 'string' || typeof child === 'number') {\n return list\n }\n // Adds support for React.Fragment\n if (child.type === React.Fragment) {\n return list.concat(\n // @ts-expect-error @types/react does not remove fragments but this could also return ReactPortal[]\n React.Children.toArray(child.props.children).reduce(\n // @ts-expect-error @types/react does not remove fragments but this could also return ReactPortal[]\n (\n fragmentList: Array<React.ReactElement<any>>,\n fragmentChild: React.ReactElement | number | string\n ): Array<React.ReactElement<any>> => {\n if (\n typeof fragmentChild === 'string' ||\n typeof fragmentChild === 'number'\n ) {\n return fragmentList\n }\n return fragmentList.concat(fragmentChild)\n },\n []\n )\n )\n }\n return list.concat(child)\n}\n\nconst METATYPES = ['name', 'httpEquiv', 'charSet', 'itemProp']\n\n/*\n returns a function for filtering head child elements\n which shouldn't be duplicated, like <title/>\n Also adds support for deduplicated `key` properties\n*/\nfunction unique() {\n const keys = new Set()\n const tags = new Set()\n const metaTypes = new Set()\n const metaCategories: { [metatype: string]: Set<string> } = {}\n\n return (h: React.ReactElement<any>) => {\n let isUnique = true\n let hasKey = false\n\n if (h.key && typeof h.key !== 'number' && h.key.indexOf('$') > 0) {\n hasKey = true\n const key = h.key.slice(h.key.indexOf('$') + 1)\n if (keys.has(key)) {\n isUnique = false\n } else {\n keys.add(key)\n }\n }\n\n switch (h.type) {\n case 'title':\n case 'base':\n if (tags.has(h.type)) {\n isUnique = false\n } else {\n tags.add(h.type)\n }\n break\n case 'meta':\n for (let i = 0, len = METATYPES.length; i < len; i++) {\n const metatype = METATYPES[i]\n if (!h.props.hasOwnProperty(metatype)) continue\n\n if (metatype === 'charSet') {\n if (metaTypes.has(metatype)) {\n isUnique = false\n } else {\n metaTypes.add(metatype)\n }\n } else {\n const category = h.props[metatype]\n const categories = metaCategories[metatype] || new Set()\n if ((metatype !== 'name' || !hasKey) && categories.has(category)) {\n isUnique = false\n } else {\n categories.add(category)\n metaCategories[metatype] = categories\n }\n }\n }\n break\n default:\n break\n }\n\n return isUnique\n }\n}\n\n/**\n *\n * @param headChildrenElements List of children of <Head>\n */\nfunction reduceComponents(\n headChildrenElements: Array<React.ReactElement<any>>\n) {\n return headChildrenElements\n .reduce(onlyReactElement, [])\n .reverse()\n .concat(defaultHead().reverse())\n .filter(unique())\n .reverse()\n .map((c: React.ReactElement<any>, i: number) => {\n const key = c.key || i\n if (process.env.NODE_ENV === 'development') {\n const { warnOnce } =\n require('./utils/warn-once') as typeof import('./utils/warn-once')\n // omit JSON-LD structured data snippets from the warning\n if (c.type === 'script' && c.props['type'] !== 'application/ld+json') {\n const srcMessage = c.props['src']\n ? `<script> tag with src=\"${c.props['src']}\"`\n : `inline <script>`\n warnOnce(\n `Do not add <script> tags using next/head (see ${srcMessage}). Use next/script instead. \\nSee more info here: https://nextjs.org/docs/messages/no-script-tags-in-head-component`\n )\n } else if (c.type === 'link' && c.props['rel'] === 'stylesheet') {\n warnOnce(\n `Do not add stylesheets using next/head (see <link rel=\"stylesheet\"> tag with href=\"${c.props['href']}\"). Use Document instead. \\nSee more info here: https://nextjs.org/docs/messages/no-stylesheets-in-head-component`\n )\n }\n }\n return React.cloneElement(c, { key })\n })\n}\n\n/**\n * This component injects elements to `<head>` of your page.\n * To avoid duplicated `tags` in `<head>` you can use the `key` property, which will make sure every tag is only rendered once.\n */\nfunction Head({ children }: { children: React.ReactNode }) {\n const headManager = useContext(HeadManagerContext)\n return (\n <Effect\n reduceComponentsToState={reduceComponents}\n headManager={headManager}\n >\n {children}\n </Effect>\n )\n}\n\nexport default Head\n"],"names":["React","useContext","Effect","HeadManagerContext","defaultHead","head","meta","charSet","name","content","onlyReactElement","list","child","type","Fragment","concat","Children","toArray","props","children","reduce","fragmentList","fragmentChild","METATYPES","unique","keys","Set","tags","metaTypes","metaCategories","h","isUnique","hasKey","key","indexOf","slice","has","add","i","len","length","metatype","hasOwnProperty","category","categories","reduceComponents","headChildrenElements","reverse","filter","map","c","process","env","NODE_ENV","warnOnce","require","srcMessage","cloneElement","Head","headManager","reduceComponentsToState"],"mappings":"AAAA;;AAEA,OAAOA,SAASC,UAAU,QAAkB,QAAO;AACnD,OAAOC,YAAY,gBAAe;AAClC,SAASC,kBAAkB,QAAQ,wCAAuC;AAE1E,OAAO,SAASC;IACd,MAAMC,OAAO;sBACX,KAACC;YAAKC,SAAQ;WAAY;sBAC1B,KAACD;YAAKE,MAAK;YAAWC,SAAQ;WAAyB;KACxD;IACD,OAAOJ;AACT;AAEA,SAASK,iBACPC,IAAoC,EACpCC,KAA2C;IAE3C,8FAA8F;IAC9F,IAAI,OAAOA,UAAU,YAAY,OAAOA,UAAU,UAAU;QAC1D,OAAOD;IACT;IACA,kCAAkC;IAClC,IAAIC,MAAMC,IAAI,KAAKb,MAAMc,QAAQ,EAAE;QACjC,OAAOH,KAAKI,MAAM,CAChB,mGAAmG;QACnGf,MAAMgB,QAAQ,CAACC,OAAO,CAACL,MAAMM,KAAK,CAACC,QAAQ,EAAEC,MAAM,CACjD,mGAAmG;QACnG,CACEC,cACAC;YAEA,IACE,OAAOA,kBAAkB,YACzB,OAAOA,kBAAkB,UACzB;gBACA,OAAOD;YACT;YACA,OAAOA,aAAaN,MAAM,CAACO;QAC7B,GACA,EAAE;IAGR;IACA,OAAOX,KAAKI,MAAM,CAACH;AACrB;AAEA,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EA,eAAeuC,KAAI","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/hooks-client-context.shared-runtime.js b/e-commerce/node_modules/next/dist/esm/shared/lib/hooks-client-context.shared-runtime.js new file mode 100644 index 0000000000000000000000000000000000000000..9dc1d2fe4bc45cdab2f18cb13e1a86ea72f7e340 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/hooks-client-context.shared-runtime.js @@ -0,0 +1,26 @@ +'use client'; +import { createContext } from 'react'; +import { ReadonlyURLSearchParams } from '../../client/components/readonly-url-search-params'; +export const SearchParamsContext = createContext(null); +export const PathnameContext = createContext(null); +export const PathParamsContext = createContext(null); +export const NavigationPromisesContext = createContext(null); +// Creates an instrumented promise for Suspense DevTools +// These promises are always fulfilled and exist purely for +// tracking in React's Suspense DevTools. +export function createDevToolsInstrumentedPromise(displayName, value) { + const promise = Promise.resolve(value); + promise.status = 'fulfilled'; + promise.value = value; + promise.displayName = `${displayName} (SSR)`; + return promise; +} +export { ReadonlyURLSearchParams }; +if (process.env.NODE_ENV !== 'production') { + SearchParamsContext.displayName = 'SearchParamsContext'; + PathnameContext.displayName = 'PathnameContext'; + PathParamsContext.displayName = 'PathParamsContext'; + NavigationPromisesContext.displayName = 'NavigationPromisesContext'; +} + +//# sourceMappingURL=hooks-client-context.shared-runtime.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/hooks-client-context.shared-runtime.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/hooks-client-context.shared-runtime.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f6daed42bf9b87f2db9ff3f4c4cd03e2162b2df0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/hooks-client-context.shared-runtime.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/hooks-client-context.shared-runtime.ts"],"sourcesContent":["'use client'\n\nimport { createContext } from 'react'\nimport type { Params } from '../../server/request/params'\nimport { ReadonlyURLSearchParams } from '../../client/components/readonly-url-search-params'\n\nexport const SearchParamsContext = createContext<URLSearchParams | null>(null)\nexport const PathnameContext = createContext<string | null>(null)\nexport const PathParamsContext = createContext<Params | null>(null)\n\n// Dev-only context for Suspense DevTools instrumentation\n// These promises are used to track navigation hook usage in React DevTools\nexport type InstrumentedPromise<T> = Promise<T> & {\n status: 'fulfilled'\n value: T\n displayName: string\n}\n\nexport type NavigationPromises = {\n pathname: InstrumentedPromise<string>\n searchParams: InstrumentedPromise<ReadonlyURLSearchParams>\n params: InstrumentedPromise<Params>\n // Layout segment hooks (updated at each layout boundary)\n selectedLayoutSegmentPromises?: Map<\n string,\n InstrumentedPromise<string | null>\n >\n selectedLayoutSegmentsPromises?: Map<string, InstrumentedPromise<string[]>>\n}\n\nexport const NavigationPromisesContext =\n createContext<NavigationPromises | null>(null)\n\n// Creates an instrumented promise for Suspense DevTools\n// These promises are always fulfilled and exist purely for\n// tracking in React's Suspense DevTools.\nexport function createDevToolsInstrumentedPromise<T>(\n displayName: string,\n value: T\n): InstrumentedPromise<T> {\n const promise = Promise.resolve(value) as InstrumentedPromise<T>\n promise.status = 'fulfilled'\n promise.value = value\n promise.displayName = `${displayName} (SSR)`\n return promise\n}\n\nexport { ReadonlyURLSearchParams }\n\nif (process.env.NODE_ENV !== 'production') {\n SearchParamsContext.displayName = 'SearchParamsContext'\n PathnameContext.displayName = 'PathnameContext'\n PathParamsContext.displayName = 'PathParamsContext'\n NavigationPromisesContext.displayName = 'NavigationPromisesContext'\n}\n"],"names":["createContext","ReadonlyURLSearchParams","SearchParamsContext","PathnameContext","PathParamsContext","NavigationPromisesContext","createDevToolsInstrumentedPromise","displayName","value","promise","Promise","resolve","status","process","env","NODE_ENV"],"mappings":"AAAA;AAEA,SAASA,aAAa,QAAQ,QAAO;AAErC,SAASC,uBAAuB,QAAQ,qDAAoD;AAE5F,OAAO,MAAMC,sBAAsBF,cAAsC,MAAK;AAC9E,OAAO,MAAMG,kBAAkBH,cAA6B,MAAK;AACjE,OAAO,MAAMI,oBAAoBJ,cAA6B,MAAK;AAsBnE,OAAO,MAAMK,4BACXL,cAAyC,MAAK;AAEhD,wDAAwD;AACxD,2DAA2D;AAC3D,yCAAyC;AACzC,OAAO,SAASM,kCACdC,WAAmB,EACnBC,KAAQ;IAER,MAAMC,UAAUC,QAAQC,OAAO,CAACH;IAChCC,QAAQG,MAAM,GAAG;IACjBH,QAAQD,KAAK,GAAGA;IAChBC,QAAQF,WAAW,GAAG,GAAGA,YAAY,MAAM,CAAC;IAC5C,OAAOE;AACT;AAEA,SAASR,uBAAuB,GAAE;AAElC,IAAIY,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzCb,oBAAoBK,WAAW,GAAG;IAClCJ,gBAAgBI,WAAW,GAAG;IAC9BH,kBAAkBG,WAAW,GAAG;IAChCF,0BAA0BE,WAAW,GAAG;AAC1C","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/html-context.shared-runtime.js b/e-commerce/node_modules/next/dist/esm/shared/lib/html-context.shared-runtime.js new file mode 100644 index 0000000000000000000000000000000000000000..2f72f98d75a5ab56d056ec6e3272409be3f70c43 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/html-context.shared-runtime.js @@ -0,0 +1,14 @@ +import { createContext, useContext } from 'react'; +export const HtmlContext = createContext(undefined); +if (process.env.NODE_ENV !== 'production') { + HtmlContext.displayName = 'HtmlContext'; +} +export function useHtmlContext() { + const context = useContext(HtmlContext); + if (!context) { + throw new Error(`<Html> should not be imported outside of pages/_document.\n` + 'Read more: https://nextjs.org/docs/messages/no-document-import-in-page'); + } + return context; +} + +//# sourceMappingURL=html-context.shared-runtime.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/html-context.shared-runtime.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/html-context.shared-runtime.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a82c26356ef6736d6f95415b3309cd4d3a4aea48 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/html-context.shared-runtime.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/html-context.shared-runtime.ts"],"sourcesContent":["import type { BuildManifest } from '../../server/get-page-files'\nimport type { ServerRuntime } from '../../types'\nimport type { NEXT_DATA } from './utils'\nimport type { NextFontManifest } from '../../build/webpack/plugins/next-font-manifest-plugin'\nimport type { DeepReadonly } from './deep-readonly'\n\nimport { createContext, useContext, type JSX } from 'react'\n\nexport type HtmlProps = {\n __NEXT_DATA__: NEXT_DATA\n nonce?: string\n dangerousAsPath: string\n docComponentsRendered: {\n Html?: boolean\n Main?: boolean\n Head?: boolean\n NextScript?: boolean\n }\n buildManifest: BuildManifest\n isDevelopment: boolean\n deploymentId: string | undefined\n dynamicImports: string[]\n /**\n * This manifest is only needed for Pages dir, Production, Webpack\n * @see https://github.com/vercel/next.js/pull/72959\n */\n dynamicCssManifest: Set<string>\n assetPrefix?: string\n headTags: any[]\n unstable_runtimeJS?: false\n unstable_JsPreload?: false\n assetQueryString: string\n mutableAssetQueryString: string\n /**\n * Asset query string for CSS and font assets.\n * See https://github.com/vercel/next.js/issues/92118.\n */\n cssAssetQueryString: string\n scriptLoader: {\n afterInteractive?: string[]\n beforeInteractive?: any[]\n worker?: any[]\n }\n locale?: string\n disableOptimizedLoading?: boolean\n styles?: React.ReactElement[] | Iterable<React.ReactNode>\n head?: Array<JSX.Element | null>\n crossOrigin?: 'anonymous' | 'use-credentials' | '' | undefined\n optimizeCss?: any\n nextConfigOutput?: 'standalone' | 'export'\n nextScriptWorkers?: boolean\n runtime?: ServerRuntime\n hasConcurrentFeatures?: boolean\n largePageDataBytes?: number\n nextFontManifest?: DeepReadonly<NextFontManifest>\n experimentalClientTraceMetadata?: string[]\n}\n\nexport const HtmlContext = createContext<HtmlProps | undefined>(undefined)\nif (process.env.NODE_ENV !== 'production') {\n HtmlContext.displayName = 'HtmlContext'\n}\n\nexport function useHtmlContext() {\n const context = useContext(HtmlContext)\n\n if (!context) {\n throw new Error(\n `<Html> should not be imported outside of pages/_document.\\n` +\n 'Read more: https://nextjs.org/docs/messages/no-document-import-in-page'\n )\n }\n\n return context\n}\n"],"names":["createContext","useContext","HtmlContext","undefined","process","env","NODE_ENV","displayName","useHtmlContext","context","Error"],"mappings":"AAMA,SAASA,aAAa,EAAEC,UAAU,QAAkB,QAAO;AAoD3D,OAAO,MAAMC,cAAcF,cAAqCG,WAAU;AAC1E,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzCJ,YAAYK,WAAW,GAAG;AAC5B;AAEA,OAAO,SAASC;IACd,MAAMC,UAAUR,WAAWC;IAE3B,IAAI,CAACO,SAAS;QACZ,MAAM,IAAIC,MACR,CAAC,2DAA2D,CAAC,GAC3D;IAEN;IAEA,OAAOD;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/htmlescape.js b/e-commerce/node_modules/next/dist/esm/shared/lib/htmlescape.js new file mode 100644 index 0000000000000000000000000000000000000000..3c7661a24930b20692fb9b1281cf6ec081bcd6a0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/htmlescape.js @@ -0,0 +1,26 @@ +// This utility is based on https://github.com/zertosh/htmlescape +// License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE +const ESCAPE_LOOKUP = { + '&': '\\u0026', + '>': '\\u003e', + '<': '\\u003c', + '\u2028': '\\u2028', + '\u2029': '\\u2029' +}; +export const ESCAPE_REGEX = /[&><\u2028\u2029]/g; +const ATTRIBUTE_ESCAPE_LOOKUP = { + '&': '&', + '"': '"', + "'": ''', + '<': '<', + '>': '>' +}; +const ATTRIBUTE_ESCAPE_REGEX = /[&"'<>]/g; +export function htmlEscapeJsonString(str) { + return str.replace(ESCAPE_REGEX, (match)=>ESCAPE_LOOKUP[match]); +} +export function htmlEscapeAttributeString(str) { + return str.replace(ATTRIBUTE_ESCAPE_REGEX, (match)=>ATTRIBUTE_ESCAPE_LOOKUP[match]); +} + +//# sourceMappingURL=htmlescape.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/htmlescape.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/htmlescape.js.map new file mode 100644 index 0000000000000000000000000000000000000000..07fe60343b7343a395f06e9de266c15ce9170d60 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/htmlescape.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/htmlescape.ts"],"sourcesContent":["// This utility is based on https://github.com/zertosh/htmlescape\n// License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE\n\nconst ESCAPE_LOOKUP: { [match: string]: string } = {\n '&': '\\\\u0026',\n '>': '\\\\u003e',\n '<': '\\\\u003c',\n '\\u2028': '\\\\u2028',\n '\\u2029': '\\\\u2029',\n}\n\nexport const ESCAPE_REGEX = /[&><\\u2028\\u2029]/g\n\nconst ATTRIBUTE_ESCAPE_LOOKUP: { [match: string]: string } = {\n '&': '&',\n '\"': '"',\n \"'\": ''',\n '<': '<',\n '>': '>',\n}\n\nconst ATTRIBUTE_ESCAPE_REGEX = /[&\"'<>]/g\n\nexport function htmlEscapeJsonString(str: string): string {\n return str.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match])\n}\n\nexport function htmlEscapeAttributeString(str: string): string {\n return str.replace(\n ATTRIBUTE_ESCAPE_REGEX,\n (match) => ATTRIBUTE_ESCAPE_LOOKUP[match]\n )\n}\n"],"names":["ESCAPE_LOOKUP","ESCAPE_REGEX","ATTRIBUTE_ESCAPE_LOOKUP","ATTRIBUTE_ESCAPE_REGEX","htmlEscapeJsonString","str","replace","match","htmlEscapeAttributeString"],"mappings":"AAAA,iEAAiE;AACjE,uGAAuG;AAEvG,MAAMA,gBAA6C;IACjD,KAAK;IACL,KAAK;IACL,KAAK;IACL,UAAU;IACV,UAAU;AACZ;AAEA,OAAO,MAAMC,eAAe,qBAAoB;AAEhD,MAAMC,0BAAuD;IAC3D,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;AACP;AAEA,MAAMC,yBAAyB;AAE/B,OAAO,SAASC,qBAAqBC,GAAW;IAC9C,OAAOA,IAAIC,OAAO,CAACL,cAAc,CAACM,QAAUP,aAAa,CAACO,MAAM;AAClE;AAEA,OAAO,SAASC,0BAA0BH,GAAW;IACnD,OAAOA,IAAIC,OAAO,CAChBH,wBACA,CAACI,QAAUL,uBAAuB,CAACK,MAAM;AAE7C","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/i18n/detect-domain-locale.js b/e-commerce/node_modules/next/dist/esm/shared/lib/i18n/detect-domain-locale.js new file mode 100644 index 0000000000000000000000000000000000000000..a09c172906e3f05d7b066b872b3400c9053b6b1e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/i18n/detect-domain-locale.js @@ -0,0 +1,15 @@ +export function detectDomainLocale(domainItems, hostname, detectedLocale) { + if (!domainItems) return; + if (detectedLocale) { + detectedLocale = detectedLocale.toLowerCase(); + } + for (const item of domainItems){ + // remove port if present + const domainHostname = item.domain?.split(':', 1)[0].toLowerCase(); + if (hostname === domainHostname || detectedLocale === item.defaultLocale.toLowerCase() || item.locales?.some((locale)=>locale.toLowerCase() === detectedLocale)) { + return item; + } + } +} + +//# sourceMappingURL=detect-domain-locale.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/i18n/detect-domain-locale.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/i18n/detect-domain-locale.js.map new file mode 100644 index 0000000000000000000000000000000000000000..49536d8e52e7b229786c1968318fe771e65d44e2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/i18n/detect-domain-locale.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/i18n/detect-domain-locale.ts"],"sourcesContent":["import type { DomainLocale } from '../../../server/config-shared'\n\nexport function detectDomainLocale(\n domainItems?: readonly DomainLocale[],\n hostname?: string,\n detectedLocale?: string\n) {\n if (!domainItems) return\n\n if (detectedLocale) {\n detectedLocale = detectedLocale.toLowerCase()\n }\n\n for (const item of domainItems) {\n // remove port if present\n const domainHostname = item.domain?.split(':', 1)[0].toLowerCase()\n if (\n hostname === domainHostname ||\n detectedLocale === item.defaultLocale.toLowerCase() ||\n item.locales?.some((locale) => locale.toLowerCase() === detectedLocale)\n ) {\n return item\n }\n }\n}\n"],"names":["detectDomainLocale","domainItems","hostname","detectedLocale","toLowerCase","item","domainHostname","domain","split","defaultLocale","locales","some","locale"],"mappings":"AAEA,OAAO,SAASA,mBACdC,WAAqC,EACrCC,QAAiB,EACjBC,cAAuB;IAEvB,IAAI,CAACF,aAAa;IAElB,IAAIE,gBAAgB;QAClBA,iBAAiBA,eAAeC,WAAW;IAC7C;IAEA,KAAK,MAAMC,QAAQJ,YAAa;QAC9B,yBAAyB;QACzB,MAAMK,iBAAiBD,KAAKE,MAAM,EAAEC,MAAM,KAAK,EAAE,CAAC,EAAE,CAACJ;QACrD,IACEF,aAAaI,kBACbH,mBAAmBE,KAAKI,aAAa,CAACL,WAAW,MACjDC,KAAKK,OAAO,EAAEC,KAAK,CAACC,SAAWA,OAAOR,WAAW,OAAOD,iBACxD;YACA,OAAOE;QACT;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/i18n/get-locale-redirect.js b/e-commerce/node_modules/next/dist/esm/shared/lib/i18n/get-locale-redirect.js new file mode 100644 index 0000000000000000000000000000000000000000..5a8bb493bf37dd5a6c9891636181bb27effc8528 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/i18n/get-locale-redirect.js @@ -0,0 +1,49 @@ +import { acceptLanguage } from '../../../server/accept-header'; +import { denormalizePagePath } from '../page-path/denormalize-page-path'; +import { detectDomainLocale } from './detect-domain-locale'; +import { formatUrl } from '../router/utils/format-url'; +import { getCookieParser } from '../../../server/api-utils/get-cookie-parser'; +function getLocaleFromCookie(i18n, headers = {}) { + const nextLocale = getCookieParser(headers || {})()?.NEXT_LOCALE?.toLowerCase(); + return nextLocale ? i18n.locales.find((locale)=>nextLocale === locale.toLowerCase()) : undefined; +} +function detectLocale({ i18n, headers, domainLocale, preferredLocale, pathLocale }) { + return pathLocale || domainLocale?.defaultLocale || getLocaleFromCookie(i18n, headers) || preferredLocale || i18n.defaultLocale; +} +function getAcceptPreferredLocale(i18n, headers) { + if (headers?.['accept-language'] && !Array.isArray(headers['accept-language'])) { + try { + return acceptLanguage(headers['accept-language'], i18n.locales); + } catch (err) {} + } +} +export function getLocaleRedirect({ defaultLocale, domainLocale, pathLocale, headers, nextConfig, urlParsed }) { + if (nextConfig.i18n && nextConfig.i18n.localeDetection !== false && denormalizePagePath(urlParsed.pathname) === '/') { + const preferredLocale = getAcceptPreferredLocale(nextConfig.i18n, headers); + const detectedLocale = detectLocale({ + i18n: nextConfig.i18n, + preferredLocale, + headers, + pathLocale, + domainLocale + }); + const preferredDomain = detectDomainLocale(nextConfig.i18n.domains, undefined, preferredLocale); + if (domainLocale && preferredDomain) { + const isPDomain = preferredDomain.domain === domainLocale.domain; + const isPLocale = preferredDomain.defaultLocale === preferredLocale; + if (!isPDomain || !isPLocale) { + const scheme = `http${preferredDomain.http ? '' : 's'}`; + const rlocale = isPLocale ? '' : preferredLocale; + return `${scheme}://${preferredDomain.domain}/${rlocale}`; + } + } + if (detectedLocale.toLowerCase() !== defaultLocale.toLowerCase()) { + return formatUrl({ + ...urlParsed, + pathname: `${nextConfig.basePath || ''}/${detectedLocale}${nextConfig.trailingSlash ? '/' : ''}` + }); + } + } +} + +//# sourceMappingURL=get-locale-redirect.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/i18n/get-locale-redirect.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/i18n/get-locale-redirect.js.map new file mode 100644 index 0000000000000000000000000000000000000000..fbd18f1ef3f3e754b5ae40cb5f768235c022477c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/i18n/get-locale-redirect.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/i18n/get-locale-redirect.ts"],"sourcesContent":["import type { DomainLocale } from '../../../server/config'\nimport type { I18NConfig } from '../../../server/config-shared'\nimport { acceptLanguage } from '../../../server/accept-header'\nimport { denormalizePagePath } from '../page-path/denormalize-page-path'\nimport { detectDomainLocale } from './detect-domain-locale'\nimport { formatUrl } from '../router/utils/format-url'\nimport { getCookieParser } from '../../../server/api-utils/get-cookie-parser'\n\ninterface Options {\n defaultLocale: string\n domainLocale?: DomainLocale\n headers?: { [key: string]: string | string[] | undefined }\n nextConfig: {\n basePath?: string\n i18n?: I18NConfig | null\n trailingSlash?: boolean\n }\n pathLocale?: string\n urlParsed: { hostname?: string | null; pathname: string }\n}\n\nfunction getLocaleFromCookie(\n i18n: I18NConfig,\n headers: { [key: string]: string | string[] | undefined } = {}\n) {\n const nextLocale = getCookieParser(\n headers || {}\n )()?.NEXT_LOCALE?.toLowerCase()\n return nextLocale\n ? i18n.locales.find((locale) => nextLocale === locale.toLowerCase())\n : undefined\n}\n\nfunction detectLocale({\n i18n,\n headers,\n domainLocale,\n preferredLocale,\n pathLocale,\n}: {\n i18n: I18NConfig\n preferredLocale?: string\n headers?: { [key: string]: string | string[] | undefined }\n domainLocale?: DomainLocale\n pathLocale?: string\n}) {\n return (\n pathLocale ||\n domainLocale?.defaultLocale ||\n getLocaleFromCookie(i18n, headers) ||\n preferredLocale ||\n i18n.defaultLocale\n )\n}\n\nfunction getAcceptPreferredLocale(\n i18n: I18NConfig,\n headers?: { [key: string]: string | string[] | undefined }\n) {\n if (\n headers?.['accept-language'] &&\n !Array.isArray(headers['accept-language'])\n ) {\n try {\n return acceptLanguage(headers['accept-language'], i18n.locales)\n } catch (err) {}\n }\n}\n\nexport function getLocaleRedirect({\n defaultLocale,\n domainLocale,\n pathLocale,\n headers,\n nextConfig,\n urlParsed,\n}: Options) {\n if (\n nextConfig.i18n &&\n nextConfig.i18n.localeDetection !== false &&\n denormalizePagePath(urlParsed.pathname) === '/'\n ) {\n const preferredLocale = getAcceptPreferredLocale(nextConfig.i18n, headers)\n const detectedLocale = detectLocale({\n i18n: nextConfig.i18n,\n preferredLocale,\n headers,\n pathLocale,\n domainLocale,\n })\n\n const preferredDomain = detectDomainLocale(\n nextConfig.i18n.domains,\n undefined,\n preferredLocale\n )\n\n if (domainLocale && preferredDomain) {\n const isPDomain = preferredDomain.domain === domainLocale.domain\n const isPLocale = preferredDomain.defaultLocale === preferredLocale\n if (!isPDomain || !isPLocale) {\n const scheme = `http${preferredDomain.http ? '' : 's'}`\n const rlocale = isPLocale ? '' : preferredLocale\n return `${scheme}://${preferredDomain.domain}/${rlocale}`\n }\n }\n\n if (detectedLocale.toLowerCase() !== defaultLocale.toLowerCase()) {\n return formatUrl({\n ...urlParsed,\n pathname: `${nextConfig.basePath || ''}/${detectedLocale}${\n nextConfig.trailingSlash ? '/' : ''\n }`,\n })\n }\n }\n}\n"],"names":["acceptLanguage","denormalizePagePath","detectDomainLocale","formatUrl","getCookieParser","getLocaleFromCookie","i18n","headers","nextLocale","NEXT_LOCALE","toLowerCase","locales","find","locale","undefined","detectLocale","domainLocale","preferredLocale","pathLocale","defaultLocale","getAcceptPreferredLocale","Array","isArray","err","getLocaleRedirect","nextConfig","urlParsed","localeDetection","pathname","detectedLocale","preferredDomain","domains","isPDomain","domain","isPLocale","scheme","http","rlocale","basePath","trailingSlash"],"mappings":"AAEA,SAASA,cAAc,QAAQ,gCAA+B;AAC9D,SAASC,mBAAmB,QAAQ,qCAAoC;AACxE,SAASC,kBAAkB,QAAQ,yBAAwB;AAC3D,SAASC,SAAS,QAAQ,6BAA4B;AACtD,SAASC,eAAe,QAAQ,8CAA6C;AAe7E,SAASC,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AS,CAAC,IAAI,EAAEL,gBAAgBM,IAAI,GAAG,KAAK,KAAK;gBACvD,MAAMC,UAAUH,YAAY,KAAKjB;gBACjC,OAAO,GAAGkB,OAAO,GAAG,EAAEL,gBAAgBG,MAAM,CAAC,CAAC,EAAEI,SAAS;YAC3D;QACF;QAEA,IAAIR,eAAenB,WAAW,OAAOS,cAAcT,WAAW,IAAI;YAChE,OAAOP,UAAU;gBACf,GAAGuB,SAAS;gBACZE,UAAU,GAAGH,WAAWa,QAAQ,IAAI,GAAG,CAAC,EAAET,iBACxCJ,WAAWc,aAAa,GAAG,MAAM,IACjC;YACJ;QACF;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/i18n/normalize-locale-path.js b/e-commerce/node_modules/next/dist/esm/shared/lib/i18n/normalize-locale-path.js new file mode 100644 index 0000000000000000000000000000000000000000..f2e7124d67b430c6a6b3f933405efb06a070fe0e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/i18n/normalize-locale-path.js @@ -0,0 +1,52 @@ +/** + * A cache of lowercased locales for each list of locales. This is stored as a + * WeakMap so if the locales are garbage collected, the cache entry will be + * removed as well. + */ const cache = new WeakMap(); +/** + * For a pathname that may include a locale from a list of locales, it + * removes the locale from the pathname returning it alongside with the + * detected locale. + * + * @param pathname A pathname that may include a locale. + * @param locales A list of locales. + * @returns The detected locale and pathname without locale + */ export function normalizeLocalePath(pathname, locales) { + // If locales is undefined, return the pathname as is. + if (!locales) return { + pathname + }; + // Get the cached lowercased locales or create a new cache entry. + let lowercasedLocales = cache.get(locales); + if (!lowercasedLocales) { + lowercasedLocales = locales.map((locale)=>locale.toLowerCase()); + cache.set(locales, lowercasedLocales); + } + let detectedLocale; + // The first segment will be empty, because it has a leading `/`. If + // there is no further segment, there is no locale (or it's the default). + const segments = pathname.split('/', 2); + // If there's no second segment (ie, the pathname is just `/`), there's no + // locale. + if (!segments[1]) return { + pathname + }; + // The second segment will contain the locale part if any. + const segment = segments[1].toLowerCase(); + // See if the segment matches one of the locales. If it doesn't, there is + // no locale (or it's the default). + const index = lowercasedLocales.indexOf(segment); + if (index < 0) return { + pathname + }; + // Return the case-sensitive locale. + detectedLocale = locales[index]; + // Remove the `/${locale}` part of the pathname. + pathname = pathname.slice(detectedLocale.length + 1) || '/'; + return { + pathname, + detectedLocale + }; +} + +//# sourceMappingURL=normalize-locale-path.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/i18n/normalize-locale-path.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/i18n/normalize-locale-path.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f2831a823ed20047c54c7ca64d81edaf365e06dc --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/i18n/normalize-locale-path.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/i18n/normalize-locale-path.ts"],"sourcesContent":["export interface PathLocale {\n detectedLocale?: string\n pathname: string\n}\n\n/**\n * A cache of lowercased locales for each list of locales. This is stored as a\n * WeakMap so if the locales are garbage collected, the cache entry will be\n * removed as well.\n */\nconst cache = new WeakMap<readonly string[], readonly string[]>()\n\n/**\n * For a pathname that may include a locale from a list of locales, it\n * removes the locale from the pathname returning it alongside with the\n * detected locale.\n *\n * @param pathname A pathname that may include a locale.\n * @param locales A list of locales.\n * @returns The detected locale and pathname without locale\n */\nexport function normalizeLocalePath(\n pathname: string,\n locales?: readonly string[]\n): PathLocale {\n // If locales is undefined, return the pathname as is.\n if (!locales) return { pathname }\n\n // Get the cached lowercased locales or create a new cache entry.\n let lowercasedLocales = cache.get(locales)\n if (!lowercasedLocales) {\n lowercasedLocales = locales.map((locale) => locale.toLowerCase())\n cache.set(locales, lowercasedLocales)\n }\n\n let detectedLocale: string | undefined\n\n // The first segment will be empty, because it has a leading `/`. If\n // there is no further segment, there is no locale (or it's the default).\n const segments = pathname.split('/', 2)\n\n // If there's no second segment (ie, the pathname is just `/`), there's no\n // locale.\n if (!segments[1]) return { pathname }\n\n // The second segment will contain the locale part if any.\n const segment = segments[1].toLowerCase()\n\n // See if the segment matches one of the locales. If it doesn't, there is\n // no locale (or it's the default).\n const index = lowercasedLocales.indexOf(segment)\n if (index < 0) return { pathname }\n\n // Return the case-sensitive locale.\n detectedLocale = locales[index]\n\n // Remove the `/${locale}` part of the pathname.\n pathname = pathname.slice(detectedLocale.length + 1) || '/'\n\n return { pathname, detectedLocale }\n}\n"],"names":["cache","WeakMap","normalizeLocalePath","pathname","locales","lowercasedLocales","get","map","locale","toLowerCase","set","detectedLocale","segments","split","segment","index","indexOf","slice","length"],"mappings":"AAKA;;;;CAIC,GACD,MAAMA,QAAQ,IAAIC;AAElB;;;;;;;;CAQC,GACD,OAAO,SAASC,oBACdC,QAAgB,EAChBC,OAA2B;IAE3B,sDAAsD;IACtD,IAAI,CAACA,SAAS,OAAO;QAAED;IAAS;IAEhC,iEAAiE;IACjE,IAAIE,oBAAoBL,MAAMM,GAAG,CAACF;IAClC,IAAI,CAACC,mBAAmB;QACtBA,oBAAoBD,QAAQG,GAAG,CAAC,CAACC,SAAWA,OAAOC,WAAW;QAC9DT,MAAMU,GAAG,CAACN,SAASC;IACrB;IAEA,IAAIM;IAEJ,oEAAoE;IACpE,yEAAyE;IACzE,MAAMC,WAAWT,SAASU,KAAK,CAAC,KAAK;IAErC,0EAA0E;IAC1E,UAAU;IACV,IAAI,CAACD,QAAQ,CAAC,EAAE,EAAE,OAAO;QAAET;IAAS;IAEpC,0DAA0D;IAC1D,MAAMW,UAAUF,QAAQ,CAAC,EAAE,CAACH,WAAW;IAEvC,yEAAyE;IACzE,mCAAmC;IACnC,MAAMM,QAAQV,kBAAkBW,OAAO,CAACF;IACxC,IAAIC,QAAQ,GAAG,OAAO;QAAEZ;IAAS;IAEjC,oCAAoC;IACpCQ,iBAAiBP,OAAO,CAACW,MAAM;IAE/B,gDAAgD;IAChDZ,WAAWA,SAASc,KAAK,CAACN,eAAeO,MAAM,GAAG,MAAM;IAExD,OAAO;QAAEf;QAAUQ;IAAe;AACpC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/image-blur-svg.js b/e-commerce/node_modules/next/dist/esm/shared/lib/image-blur-svg.js new file mode 100644 index 0000000000000000000000000000000000000000..2e275bf7754b7e8544d3785cf83e79ce199499ac --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/image-blur-svg.js @@ -0,0 +1,12 @@ +/** + * A shared function, used on both client and server, to generate a SVG blur placeholder. + */ export function getImageBlurSvg({ widthInt, heightInt, blurWidth, blurHeight, blurDataURL, objectFit }) { + const std = 20; + const svgWidth = blurWidth ? blurWidth * 40 : widthInt; + const svgHeight = blurHeight ? blurHeight * 40 : heightInt; + const viewBox = svgWidth && svgHeight ? `viewBox='0 0 ${svgWidth} ${svgHeight}'` : ''; + const preserveAspectRatio = viewBox ? 'none' : objectFit === 'contain' ? 'xMidYMid' : objectFit === 'cover' ? 'xMidYMid slice' : 'none'; + return `%3Csvg xmlns='http://www.w3.org/2000/svg' ${viewBox}%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='${std}'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='${std}'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${preserveAspectRatio}' style='filter: url(%23b);' href='${blurDataURL}'/%3E%3C/svg%3E`; +} + +//# sourceMappingURL=image-blur-svg.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/image-blur-svg.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/image-blur-svg.js.map new file mode 100644 index 0000000000000000000000000000000000000000..baff1237a34d1d025db9ef6a7e60b2d30535e0e6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/image-blur-svg.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/image-blur-svg.ts"],"sourcesContent":["/**\n * A shared function, used on both client and server, to generate a SVG blur placeholder.\n */\nexport function getImageBlurSvg({\n widthInt,\n heightInt,\n blurWidth,\n blurHeight,\n blurDataURL,\n objectFit,\n}: {\n widthInt?: number\n heightInt?: number\n blurWidth?: number\n blurHeight?: number\n blurDataURL: string\n objectFit?: string\n}): string {\n const std = 20\n const svgWidth = blurWidth ? blurWidth * 40 : widthInt\n const svgHeight = blurHeight ? blurHeight * 40 : heightInt\n\n const viewBox =\n svgWidth && svgHeight ? `viewBox='0 0 ${svgWidth} ${svgHeight}'` : ''\n const preserveAspectRatio = viewBox\n ? 'none'\n : objectFit === 'contain'\n ? 'xMidYMid'\n : objectFit === 'cover'\n ? 'xMidYMid slice'\n : 'none'\n\n return `%3Csvg xmlns='http://www.w3.org/2000/svg' ${viewBox}%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='${std}'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='${std}'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${preserveAspectRatio}' style='filter: url(%23b);' href='${blurDataURL}'/%3E%3C/svg%3E`\n}\n"],"names":["getImageBlurSvg","widthInt","heightInt","blurWidth","blurHeight","blurDataURL","objectFit","std","svgWidth","svgHeight","viewBox","preserveAspectRatio"],"mappings":"AAAA;;CAEC,GACD,OAAO,SAASA,gBAAgB,EAC9BC,QAAQ,EACRC,SAAS,EACTC,SAAS,EACTC,UAAU,EACVC,WAAW,EACXC,SAAS,EAQV;IACC,MAAMC,MAAM;IACZ,MAAMC,WAAWL,YAAYA,YAAY,KAAKF;IAC9C,MAAMQ,YAAYL,aAAaA,aAAa,KAAKF;IAEjD,MAAMQ,UACJF,YAAYC,YAAY,CAAC,aAAa,EAAED,SAAS,CAAC,EAAEC,UAAU,CAAC,CAAC,GAAG;IACrE,MAAME,sBAAsBD,UACxB,SACAJ,cAAc,YACZ,aACAA,cAAc,UACZ,mBACA;IAER,OAAO,CAAC,0CAA0C,EAAEI,QAAQ,yFAAyF,EAAEH,IAAI,+PAA+P,EAAEA,IAAI,2FAA2F,EAAEI,oBAAoB,mCAAmC,EAAEN,YAAY,eAAe,CAAC;AACplB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/image-config-context.shared-runtime.js b/e-commerce/node_modules/next/dist/esm/shared/lib/image-config-context.shared-runtime.js new file mode 100644 index 0000000000000000000000000000000000000000..362a81d9fb83d6d71e8ba3b7a7c4879924ed58da --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/image-config-context.shared-runtime.js @@ -0,0 +1,8 @@ +import React from 'react'; +import { imageConfigDefault } from './image-config'; +export const ImageConfigContext = React.createContext(imageConfigDefault); +if (process.env.NODE_ENV !== 'production') { + ImageConfigContext.displayName = 'ImageConfigContext'; +} + +//# sourceMappingURL=image-config-context.shared-runtime.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/image-config-context.shared-runtime.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/image-config-context.shared-runtime.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3ce5d97efaa6315c901a3df5039a6d65170aa112 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/image-config-context.shared-runtime.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/image-config-context.shared-runtime.ts"],"sourcesContent":["import React from 'react'\nimport type { ImageConfigComplete } from './image-config'\nimport { imageConfigDefault } from './image-config'\n\nexport const ImageConfigContext =\n React.createContext<ImageConfigComplete>(imageConfigDefault)\n\nif (process.env.NODE_ENV !== 'production') {\n ImageConfigContext.displayName = 'ImageConfigContext'\n}\n"],"names":["React","imageConfigDefault","ImageConfigContext","createContext","process","env","NODE_ENV","displayName"],"mappings":"AAAA,OAAOA,WAAW,QAAO;AAEzB,SAASC,kBAAkB,QAAQ,iBAAgB;AAEnD,OAAO,MAAMC,qBACXF,MAAMG,aAAa,CAAsBF,oBAAmB;AAE9D,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzCJ,mBAAmBK,WAAW,GAAG;AACnC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/image-config.js b/e-commerce/node_modules/next/dist/esm/shared/lib/image-config.js new file mode 100644 index 0000000000000000000000000000000000000000..e6eaf7f82ff83c72c4274bb7502c21aa88bfcbaf --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/image-config.js @@ -0,0 +1,105 @@ +export const VALID_LOADERS = [ + 'default', + 'imgix', + 'cloudinary', + 'akamai', + 'custom' +]; +const missingImageConfig = {}; +const preparedImageConfigs = new WeakMap(); +/** + * Prepare owned, sorted image options once for each env/context pair. + * Changed options require new objects because results are cached by identity. + */ export function prepareImageConfig(envConfig, contextConfig) { + const envKey = envConfig ?? missingImageConfig; + const contextKey = contextConfig ?? missingImageConfig; + let preparedByContext = preparedImageConfigs.get(envKey); + if (preparedByContext) { + const cached = preparedByContext.get(contextKey); + if (cached) { + return cached; + } + } + const source = envConfig || contextConfig || imageConfigDefault; + const deviceSizes = [ + ...source.deviceSizes + ].sort((a, b)=>a - b); + const imageSizes = [ + ...source.imageSizes + ]; + const prepared = { + deviceSizes, + imageSizes, + allSizes: [ + ...deviceSizes, + ...imageSizes + ].sort((a, b)=>a - b), + qualities: source.qualities === undefined ? undefined : [ + ...source.qualities + ].sort((a, b)=>a - b), + path: source.path, + loader: source.loader, + dangerouslyAllowSVG: source.dangerouslyAllowSVG, + unoptimized: source.unoptimized, + domains: source.domains, + remotePatterns: source.remotePatterns, + // The inlined browser options supply their own patterns. During SSR the + // context supplies security-sensitive patterns omitted from the inline data. + localPatterns: typeof window === 'undefined' && contextConfig !== undefined ? contextConfig.localPatterns : source.localPatterns, + output: source.output + }; + if (!preparedByContext) { + preparedByContext = new WeakMap(); + preparedImageConfigs.set(envKey, preparedByContext); + } + preparedByContext.set(contextKey, prepared); + return prepared; +} +export const imageConfigDefault = { + deviceSizes: [ + 640, + 750, + 828, + 1080, + 1200, + 1920, + 2048, + 3840 + ], + imageSizes: [ + 32, + 48, + 64, + 96, + 128, + 256, + 384 + ], + path: '/_next/image', + loader: 'default', + loaderFile: '', + /** + * @deprecated Use `remotePatterns` instead to protect your application from malicious users. + */ domains: [], + disableStaticImages: false, + minimumCacheTTL: 14400, + formats: [ + 'image/webp' + ], + maximumDiskCacheSize: undefined, + maximumRedirects: 3, + maximumResponseBody: 50000000, + dangerouslyAllowLocalIP: false, + dangerouslyAllowSVG: false, + contentSecurityPolicy: `script-src 'none'; frame-src 'none'; sandbox;`, + contentDispositionType: 'attachment', + localPatterns: undefined, + remotePatterns: [], + qualities: [ + 75 + ], + unoptimized: false, + customCacheHandler: false +}; + +//# sourceMappingURL=image-config.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/image-config.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/image-config.js.map new file mode 100644 index 0000000000000000000000000000000000000000..202bbdae75c9d79411f457fccb1dc1218f6b88fd --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/image-config.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/image-config.ts"],"sourcesContent":["export const VALID_LOADERS = [\n 'default',\n 'imgix',\n 'cloudinary',\n 'akamai',\n 'custom',\n] as const\n\nexport type LoaderValue = (typeof VALID_LOADERS)[number]\n\nexport type ImageLoaderProps = {\n src: string\n width: number\n quality?: number\n}\n\nexport type ImageLoaderPropsWithConfig = ImageLoaderProps & {\n config: Readonly<ImageConfig>\n}\n\nexport type LocalPattern = {\n /**\n * Can be literal or wildcard.\n * Single `*` matches a single path segment.\n * Double `**` matches any number of path segments.\n */\n pathname?: string\n\n /**\n * Can be literal query string such as `?v=1` or\n * empty string meaning no query string.\n */\n search?: string\n}\n\nexport type RemotePattern = {\n /**\n * Must be `http` or `https`.\n */\n protocol?: 'http' | 'https'\n\n /**\n * Can be literal or wildcard.\n * Single `*` matches a single subdomain.\n * Double `**` matches any number of subdomains.\n */\n hostname: string\n\n /**\n * Can be literal port such as `8080` or empty string\n * meaning no port.\n */\n port?: string\n\n /**\n * Can be literal or wildcard.\n * Single `*` matches a single path segment.\n * Double `**` matches any number of path segments.\n */\n pathname?: string\n\n /**\n * Can be literal query string such as `?v=1` or\n * empty string meaning no query string.\n */\n search?: string\n}\n\ntype ImageFormat = 'image/avif' | 'image/webp'\n\n/**\n * Image configurations\n *\n * @see [Image configuration options](https://nextjs.org/docs/api-reference/next/image#configuration-options)\n */\nexport type ImageConfigComplete = {\n /** @see [Device sizes documentation](https://nextjs.org/docs/api-reference/next/image#device-sizes) */\n deviceSizes: number[]\n\n /** @see [Image sizing documentation](https://nextjs.org/docs/app/building-your-application/optimizing/images#image-sizing) */\n imageSizes: number[]\n\n /** @see [Image loaders configuration](https://nextjs.org/docs/api-reference/next/legacy/image#loader) */\n loader: LoaderValue\n\n /** @see [Image loader configuration](https://nextjs.org/docs/app/api-reference/components/image#path) */\n path: string\n\n /** @see [Image loader configuration](https://nextjs.org/docs/api-reference/next/image#loader-configuration) */\n loaderFile: string\n\n /**\n * @deprecated Use `remotePatterns` instead.\n */\n domains: string[]\n\n /** @see [Disable static image import configuration](https://nextjs.org/docs/api-reference/next/image#disable-static-imports) */\n disableStaticImages: boolean\n\n /** @see [Cache behavior](https://nextjs.org/docs/api-reference/next/image#caching-behavior) */\n minimumCacheTTL: number\n\n /** @see [Acceptable formats](https://nextjs.org/docs/api-reference/next/image#acceptable-formats) */\n formats: ImageFormat[]\n\n /** @see [Maximum Disk Cache Size (in bytes)](https://nextjs.org/docs/api-reference/next/image#maximumdiskcachesize) */\n maximumDiskCacheSize: number | undefined\n\n /** @see [Maximum Redirects](https://nextjs.org/docs/api-reference/next/image#maximumredirects) */\n maximumRedirects: number\n\n /** @see [Maximum Response Body](https://nextjs.org/docs/api-reference/next/image#maximumresponsebody) */\n maximumResponseBody: number\n\n /** @see [Dangerously Allow Local IP](https://nextjs.org/docs/api-reference/next/image#dangerously-allow-local-ip) */\n dangerouslyAllowLocalIP: boolean\n\n /** @see [Dangerously Allow SVG](https://nextjs.org/docs/api-reference/next/image#dangerously-allow-svg) */\n dangerouslyAllowSVG: boolean\n\n /** @see [Content Security Policy](https://nextjs.org/docs/api-reference/next/image#contentsecuritypolicy) */\n contentSecurityPolicy: string\n\n /** @see [Content Disposition Type](https://nextjs.org/docs/api-reference/next/image#contentdispositiontype) */\n contentDispositionType: 'inline' | 'attachment'\n\n /** @see [Remote Patterns](https://nextjs.org/docs/api-reference/next/image#remotepatterns) */\n remotePatterns: Array<URL | RemotePattern>\n\n /** @see [Local Patterns](https://nextjs.org/docs/api-reference/next/image#localPatterns) */\n localPatterns: LocalPattern[] | undefined\n\n /** @see [Qualities](https://nextjs.org/docs/api-reference/next/image#qualities) */\n qualities: number[] | undefined\n\n /** @see [Unoptimized](https://nextjs.org/docs/api-reference/next/image#unoptimized) */\n unoptimized: boolean\n\n /**\n * When true, the `cacheHandler` configured in next.config.js will also be used\n * for caching optimized images. When false, images use the default filesystem cache.\n * @see [Image Optimization Caching](https://nextjs.org/docs/app/api-reference/config/next-config-js/cacheHandler#image-optimization-caching)\n */\n customCacheHandler: boolean\n}\n\nexport type ImageConfig = Partial<ImageConfigComplete>\n\ntype RequiredImageConfigForRendering = Pick<\n ImageConfigComplete,\n | 'deviceSizes'\n | 'imageSizes'\n | 'loader'\n | 'path'\n | 'dangerouslyAllowSVG'\n | 'unoptimized'\n>\n\nexport type ImageConfigForRendering = RequiredImageConfigForRendering &\n Partial<\n Pick<\n ImageConfigComplete,\n 'qualities' | 'domains' | 'remotePatterns' | 'localPatterns'\n >\n > & {\n output?: 'standalone' | 'export'\n }\n\nexport type PreparedImageConfig = RequiredImageConfigForRendering & {\n allSizes: number[]\n qualities: ImageConfigComplete['qualities']\n domains: ImageConfigComplete['domains'] | undefined\n remotePatterns: ImageConfigComplete['remotePatterns'] | undefined\n localPatterns: ImageConfigComplete['localPatterns']\n output: 'standalone' | 'export' | undefined\n}\n\nconst missingImageConfig = {}\nconst preparedImageConfigs = new WeakMap<\n object,\n WeakMap<object, PreparedImageConfig>\n>()\n\n/**\n * Prepare owned, sorted image options once for each env/context pair.\n * Changed options require new objects because results are cached by identity.\n */\nexport function prepareImageConfig(\n envConfig?: ImageConfigForRendering,\n contextConfig?: ImageConfigComplete\n): PreparedImageConfig {\n const envKey = envConfig ?? missingImageConfig\n const contextKey = contextConfig ?? missingImageConfig\n let preparedByContext = preparedImageConfigs.get(envKey)\n if (preparedByContext) {\n const cached = preparedByContext.get(contextKey)\n if (cached) {\n return cached\n }\n }\n\n const source: ImageConfigForRendering =\n envConfig || contextConfig || imageConfigDefault\n const deviceSizes = [...source.deviceSizes].sort((a, b) => a - b)\n const imageSizes = [...source.imageSizes]\n const prepared: PreparedImageConfig = {\n deviceSizes,\n imageSizes,\n allSizes: [...deviceSizes, ...imageSizes].sort((a, b) => a - b),\n qualities:\n source.qualities === undefined\n ? undefined\n : [...source.qualities].sort((a, b) => a - b),\n path: source.path,\n loader: source.loader,\n dangerouslyAllowSVG: source.dangerouslyAllowSVG,\n unoptimized: source.unoptimized,\n domains: source.domains,\n remotePatterns: source.remotePatterns,\n // The inlined browser options supply their own patterns. During SSR the\n // context supplies security-sensitive patterns omitted from the inline data.\n localPatterns:\n typeof window === 'undefined' && contextConfig !== undefined\n ? contextConfig.localPatterns\n : source.localPatterns,\n output: source.output,\n }\n\n if (!preparedByContext) {\n preparedByContext = new WeakMap()\n preparedImageConfigs.set(envKey, preparedByContext)\n }\n preparedByContext.set(contextKey, prepared)\n return prepared\n}\n\nexport const imageConfigDefault: ImageConfigComplete = {\n deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],\n imageSizes: [32, 48, 64, 96, 128, 256, 384],\n path: '/_next/image',\n loader: 'default',\n loaderFile: '',\n /**\n * @deprecated Use `remotePatterns` instead to protect your application from malicious users.\n */\n domains: [],\n disableStaticImages: false,\n minimumCacheTTL: 14400, // 4 hours\n formats: ['image/webp'],\n maximumDiskCacheSize: undefined, // auto-detect by default\n maximumRedirects: 3,\n maximumResponseBody: 50_000_000, // 50 MB\n dangerouslyAllowLocalIP: false,\n dangerouslyAllowSVG: false,\n contentSecurityPolicy: `script-src 'none'; frame-src 'none'; sandbox;`,\n contentDispositionType: 'attachment',\n localPatterns: undefined, // default: allow all local images\n remotePatterns: [], // default: allow no remote images\n qualities: [75],\n unoptimized: false,\n customCacheHandler: false,\n}\n"],"names":["VALID_LOADERS","missingImageConfig","preparedImageConfigs","WeakMap","prepareImageConfig","envConfig","contextConfig","envKey","contextKey","preparedByContext","get","cached","source","imageConfigDefault","deviceSizes","sort","a","b","imageSizes","prepared","allSizes","qualities","undefined","path","loader","dangerouslyAllowSVG","unoptimized","domains","remotePatterns","localPatterns","window","output","set","loaderFile","disableStaticImages","minimumCacheTTL","formats","maximumDiskCacheSize","maximumRedirects","maximumResponseBody","dangerouslyAllowLocalIP","contentSecurityPolicy","contentDispositionType","customCacheHandler"],"mappings":"AAAA,OAAO,MAAMA,gBAAgB;IAC3B;IACA;IACA;IACA;IACA;CACD,CAAS;AA2KV,MAAMC,qBAAqB,CAAC;AAC5B,MAAMC,uBAAuB,IAAIC;AAKjC;;;CAGC,GACD,OAAO,SAASC,mBACdC,SAAmC,EACnCC,aAAmC;IAEnC,MAAMC,SAASF,aAAaJ;IAC5B,MAAMO,aAAaF,iBAAiBL;IACp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AAY;IACZ;;GAEC,GACDN,SAAS,EAAE;IACXO,qBAAqB;IACrBC,iBAAiB;IACjBC,SAAS;QAAC;KAAa;IACvBC,sBAAsBf;IACtBgB,kBAAkB;IAClBC,qBAAqB;IACrBC,yBAAyB;IACzBf,qBAAqB;IACrBgB,uBAAuB,CAAC,6CAA6C,CAAC;IACtEC,wBAAwB;IACxBb,eAAeP;IACfM,gBAAgB,EAAE;IAClBP,WAAW;QAAC;KAAG;IACfK,aAAa;IACbiB,oBAAoB;AACtB,EAAC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/image-external-get-image-props.js b/e-commerce/node_modules/next/dist/esm/shared/lib/image-external-get-image-props.js new file mode 100644 index 0000000000000000000000000000000000000000..88e4dbfc1c0587c505a4e2cf2cc7709d04774cd8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/image-external-get-image-props.js @@ -0,0 +1,35 @@ +import { prepareImageConfig } from './image-config'; +import { getImgProps } from './get-img-props'; +// This is replaced by a bundler alias. Use a namespace import so a custom +// loader without a default export can reach the framework's runtime validation +// instead of failing static ESM export validation first. +import * as defaultLoaderModule from 'next/dist/shared/lib/image-loader'; +const defaultLoader = Reflect.get(defaultLoaderModule, 'default'); +// The bundler replaces this with fixed options. Public getImageProps has no +// context, so prepare those options once when the module is loaded. +const imageConfig = prepareImageConfig(process.env.__NEXT_IMAGE_OPTS); +/** + * For more advanced use cases, you can call `getImageProps()` + * to get the props that would be passed to the underlying `<img>` element, + * and instead pass to them to another component, style, canvas, etc. + * + * Read more: [Next.js docs: `getImageProps`](https://nextjs.org/docs/app/api-reference/components/image#getimageprops) + */ export function getImageProps(imgProps) { + const { props } = getImgProps(imgProps, { + defaultLoader, + imgConf: imageConfig + }); + // Normally we don't care about undefined props because we pass to JSX, + // but this exported function could be used by the end user for anything + // so we delete undefined props to clean it up a little. + for (const [key, value] of Object.entries(props)){ + if (value === undefined) { + delete props[key]; + } + } + return { + props + }; +} + +//# sourceMappingURL=image-external-get-image-props.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/image-external-get-image-props.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/image-external-get-image-props.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3bc7d4044667cd4ace03c72a7cd17b42e92040f9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/image-external-get-image-props.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/image-external-get-image-props.ts"],"sourcesContent":["import {\n prepareImageConfig,\n type ImageConfigForRendering,\n} from './image-config'\nimport type { ImageProps } from './get-img-props'\n\nimport { getImgProps } from './get-img-props'\n\n// This is replaced by a bundler alias. Use a namespace import so a custom\n// loader without a default export can reach the framework's runtime validation\n// instead of failing static ESM export validation first.\nimport * as defaultLoaderModule from 'next/dist/shared/lib/image-loader'\n\nconst defaultLoader = Reflect.get(defaultLoaderModule, 'default')\n// The bundler replaces this with fixed options. Public getImageProps has no\n// context, so prepare those options once when the module is loaded.\nconst imageConfig = prepareImageConfig(\n process.env.__NEXT_IMAGE_OPTS as any as ImageConfigForRendering | undefined\n)\n\n/**\n * For more advanced use cases, you can call `getImageProps()`\n * to get the props that would be passed to the underlying `<img>` element,\n * and instead pass to them to another component, style, canvas, etc.\n *\n * Read more: [Next.js docs: `getImageProps`](https://nextjs.org/docs/app/api-reference/components/image#getimageprops)\n */\nexport function getImageProps(imgProps: ImageProps) {\n const { props } = getImgProps(imgProps, {\n defaultLoader,\n imgConf: imageConfig,\n })\n // Normally we don't care about undefined props because we pass to JSX,\n // but this exported function could be used by the end user for anything\n // so we delete undefined props to clean it up a little.\n for (const [key, value] of Object.entries(props)) {\n if (value === undefined) {\n delete props[key as keyof typeof props]\n }\n }\n return { props }\n}\n"],"names":["prepareImageConfig","getImgProps","defaultLoaderModule","defaultLoader","Reflect","get","imageConfig","process","env","__NEXT_IMAGE_OPTS","getImageProps","imgProps","props","imgConf","key","value","Object","entries","undefined"],"mappings":"AAAA,SACEA,kBAAkB,QAEb,iBAAgB;AAGvB,SAASC,WAAW,QAAQ,kBAAiB;AAE7C,0EAA0E;AAC1E,+EAA+E;AAC/E,yDAAyD;AACzD,YAAYC,yBAAyB,oCAAmC;AAExE,MAAMC,gBAAgBC,QAAQC,GAAG,CAACH,qBAAqB;AACvD,4EAA4E;AAC5E,oEAAoE;AACpE,MAAMI,cAAcN,mBAClBO,QAAQC,GAAG,CAACC,iBAAiB;AAG/B;;;;;;CAMC,GACD,OAAO,SAASC,cAAcC,QAAoB;IAChD,MAAM,EAAEC,KAAK,EAAE,GAAGX,YAAYU,UAAU;QACtCR;QACAU,SAASP;IACX;IACA,uEAAuE;IACvE,wEAAwE;IACxE,wDAAwD;IACxD,KAAK,MAAM,CAACQ,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACL,OAAQ;QAChD,IAAIG,UAAUG,WAAW;YACvB,OAAON,KAAK,CAACE,IAA0B;QACzC;IACF;IACA,OAAO;QAAEF;IAAM;AACjB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/image-external.js b/e-commerce/node_modules/next/dist/esm/shared/lib/image-external.js new file mode 100644 index 0000000000000000000000000000000000000000..d3853d667907c2667a7051cac6bc5a192d14a792 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/image-external.js @@ -0,0 +1,5 @@ +'use turbopack: no side effects'; +export { Image as default } from '../../client/image-component'; +export { getImageProps } from './image-external-get-image-props'; + +//# sourceMappingURL=image-external.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/image-external.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/image-external.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d9a11b941402c779ca3868f584970a411a7cea04 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/image-external.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/image-external.tsx"],"sourcesContent":["'use turbopack: no side effects'\nimport type { ImageLoaderProps } from './image-config'\nimport type { ImageProps, ImageLoader, StaticImageData } from './get-img-props'\n\nexport { Image as default } from '../../client/image-component'\nexport { getImageProps } from './image-external-get-image-props'\n\nexport type { ImageProps, ImageLoaderProps, ImageLoader, StaticImageData }\n"],"names":["Image","default","getImageProps"],"mappings":"AAAA;AAIA,SAASA,SAASC,OAAO,QAAQ,+BAA8B;AAC/D,SAASC,aAAa,QAAQ,mCAAkC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/image-loader.js b/e-commerce/node_modules/next/dist/esm/shared/lib/image-loader.js new file mode 100644 index 0000000000000000000000000000000000000000..771c284b19d8f55d2718d957e369f41099cb4812 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/image-loader.js @@ -0,0 +1,84 @@ +import { findClosestQuality } from './find-closest-quality'; +import { getAssetToken, getDeploymentId } from './deployment-id'; +function defaultLoader({ config, src, width, quality }) { + if (process.env.NODE_ENV !== 'production') { + const missingValues = []; + // these should always be provided but make sure they are + if (!src) missingValues.push('src'); + if (!width) missingValues.push('width'); + if (missingValues.length > 0) { + throw new Error(`Next Image Optimization requires ${missingValues.join(', ')} to be provided. Make sure you pass them as props to the \`next/image\` component. Received: ${JSON.stringify({ + src, + width, + quality + })}`); + } + } + // Extract dpl parameter early so validation uses the clean URL. + // If a immutable asset token should be used, it was already added as a query parameter and will + // be extracted and reused here. + let deploymentId = getDeploymentId(); + if (src.startsWith('/') && !src.startsWith('//')) { + if (src.includes('/_next/static/immutable') && !getAssetToken()) { + // immutable static asset and supported by platform, don't add `?dpl=` + deploymentId = undefined; + } else { + // We unfortunately can't easily use `new URL()` here, because it normalizes the URL which causes + // double-encoding with the `encodeURIComponent(src)` below + const qIndex = src.indexOf('?'); + if (qIndex !== -1) { + const params = new URLSearchParams(src.slice(qIndex + 1)); + const srcDpl = params.get('dpl'); + if (srcDpl) { + deploymentId = srcDpl; + params.delete('dpl'); + const remaining = params.toString(); + src = src.slice(0, qIndex) + (remaining ? '?' + remaining : ''); + } + } + } + } + if (src.startsWith('/') && src.includes('?') && config.localPatterns?.length === 1 && config.localPatterns[0].pathname === '**' && config.localPatterns[0].search === '') { + throw new Error(`Image with src "${src}" is using a query string which is not configured in images.localPatterns.` + `\nRead more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`); + } + if (process.env.NODE_ENV !== 'production') { + if (src.startsWith('//')) { + throw new Error(`Failed to parse src "${src}" on \`next/image\`, protocol-relative URL (//) must be changed to an absolute URL (http:// or https://)`); + } + if (src.startsWith('/') && config.localPatterns) { + if (process.env.NODE_ENV !== 'test' && // micromatch isn't compatible with edge runtime + process.env.NEXT_RUNTIME !== 'edge') { + // We use dynamic require because this should only error in development + const { hasLocalMatch } = require('./match-local-pattern'); + if (!hasLocalMatch(config.localPatterns, src)) { + throw new Error(`Invalid src prop (${src}) on \`next/image\` does not match \`images.localPatterns\` configured in your \`next.config.js\`\n` + `See more info: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`); + } + } + } + if (!src.startsWith('/') && (config.domains || config.remotePatterns)) { + let parsedSrc; + try { + parsedSrc = new URL(src); + } catch (err) { + console.error(err); + throw new Error(`Failed to parse src "${src}" on \`next/image\`, if using relative image it must start with a leading slash "/" or be an absolute URL (http:// or https://)`); + } + if (process.env.NODE_ENV !== 'test' && // micromatch isn't compatible with edge runtime + process.env.NEXT_RUNTIME !== 'edge') { + // We use dynamic require because this should only error in development + const { hasRemoteMatch } = require('./match-remote-pattern'); + if (!hasRemoteMatch(config.domains, config.remotePatterns, parsedSrc)) { + throw new Error(`Invalid src prop (${src}) on \`next/image\`, hostname "${parsedSrc.hostname}" is not configured under images in your \`next.config.js\`\n` + `See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host`); + } + } + } + } + const q = findClosestQuality(quality, config); + return `${config.path}?url=${encodeURIComponent(src)}&w=${width}&q=${q}${src.startsWith('/') && deploymentId ? `&dpl=${deploymentId}` : ''}`; +} +// We use this to determine if the import is the default loader +// or a custom loader defined by the user in next.config.js +defaultLoader.__next_img_default = true; +export default defaultLoader; + +//# sourceMappingURL=image-loader.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/image-loader.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/image-loader.js.map new file mode 100644 index 0000000000000000000000000000000000000000..42cfb8c61ea82461716a37b0eca192f589e3abde --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/image-loader.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/image-loader.ts"],"sourcesContent":["import type { ImageLoaderPropsWithConfig } from './image-config'\nimport { findClosestQuality } from './find-closest-quality'\nimport { getAssetToken, getDeploymentId } from './deployment-id'\n\nfunction defaultLoader({\n config,\n src,\n width,\n quality,\n}: ImageLoaderPropsWithConfig): string {\n if (process.env.NODE_ENV !== 'production') {\n const missingValues = []\n\n // these should always be provided but make sure they are\n if (!src) missingValues.push('src')\n if (!width) missingValues.push('width')\n\n if (missingValues.length > 0) {\n throw new Error(\n `Next Image Optimization requires ${missingValues.join(\n ', '\n )} to be provided. Make sure you pass them as props to the \\`next/image\\` component. Received: ${JSON.stringify(\n { src, width, quality }\n )}`\n )\n }\n }\n\n // Extract dpl parameter early so validation uses the clean URL.\n // If a immutable asset token should be used, it was already added as a query parameter and will\n // be extracted and reused here.\n let deploymentId = getDeploymentId()\n if (src.startsWith('/') && !src.startsWith('//')) {\n if (src.includes('/_next/static/immutable') && !getAssetToken()) {\n // immutable static asset and supported by platform, don't add `?dpl=`\n deploymentId = undefined\n } else {\n // We unfortunately can't easily use `new URL()` here, because it normalizes the URL which causes\n // double-encoding with the `encodeURIComponent(src)` below\n const qIndex = src.indexOf('?')\n if (qIndex !== -1) {\n const params = new URLSearchParams(src.slice(qIndex + 1))\n const srcDpl = params.get('dpl')\n if (srcDpl) {\n deploymentId = srcDpl\n params.delete('dpl')\n const remaining = params.toString()\n src = src.slice(0, qIndex) + (remaining ? '?' + remaining : '')\n }\n }\n }\n }\n\n if (\n src.startsWith('/') &&\n src.includes('?') &&\n config.localPatterns?.length === 1 &&\n config.localPatterns[0].pathname === '**' &&\n config.localPatterns[0].search === ''\n ) {\n throw new Error(\n `Image with src \"${src}\" is using a query string which is not configured in images.localPatterns.` +\n `\\nRead more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`\n )\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (src.startsWith('//')) {\n throw new Error(\n `Failed to parse src \"${src}\" on \\`next/image\\`, protocol-relative URL (//) must be changed to an absolute URL (http:// or https://)`\n )\n }\n\n if (src.startsWith('/') && config.localPatterns) {\n if (\n process.env.NODE_ENV !== 'test' &&\n // micromatch isn't compatible with edge runtime\n process.env.NEXT_RUNTIME !== 'edge'\n ) {\n // We use dynamic require because this should only error in development\n const { hasLocalMatch } =\n require('./match-local-pattern') as typeof import('./match-local-pattern')\n if (!hasLocalMatch(config.localPatterns, src)) {\n throw new Error(\n `Invalid src prop (${src}) on \\`next/image\\` does not match \\`images.localPatterns\\` configured in your \\`next.config.js\\`\\n` +\n `See more info: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`\n )\n }\n }\n }\n\n if (!src.startsWith('/') && (config.domains || config.remotePatterns)) {\n let parsedSrc: URL\n try {\n parsedSrc = new URL(src)\n } catch (err) {\n console.error(err)\n throw new Error(\n `Failed to parse src \"${src}\" on \\`next/image\\`, if using relative image it must start with a leading slash \"/\" or be an absolute URL (http:// or https://)`\n )\n }\n\n if (\n process.env.NODE_ENV !== 'test' &&\n // micromatch isn't compatible with edge runtime\n process.env.NEXT_RUNTIME !== 'edge'\n ) {\n // We use dynamic require because this should only error in development\n const { hasRemoteMatch } =\n require('./match-remote-pattern') as typeof import('./match-remote-pattern')\n if (\n !hasRemoteMatch(config.domains!, config.remotePatterns!, parsedSrc)\n ) {\n throw new Error(\n `Invalid src prop (${src}) on \\`next/image\\`, hostname \"${parsedSrc.hostname}\" is not configured under images in your \\`next.config.js\\`\\n` +\n `See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host`\n )\n }\n }\n }\n }\n\n const q = findClosestQuality(quality, config)\n\n return `${config.path}?url=${encodeURIComponent(src)}&w=${width}&q=${q}${\n src.startsWith('/') && deploymentId ? `&dpl=${deploymentId}` : ''\n }`\n}\n\n// We use this to determine if the import is the default loader\n// or a custom loader defined by the user in next.config.js\ndefaultLoader.__next_img_default = true\n\nexport default defaultLoader\n"],"names":["findClosestQuality","getAssetToken","getDeploymentId","defaultLoader","config","src","width","quality","process","env","NODE_ENV","missingValues","push","length","Error","join","JSON","stringify","deploymentId","startsWith","includes","undefined","qIndex","indexOf","params","URLSearchParams","slice","srcDpl","get","delete","remaining","toString","localPatterns","pathname","search","NEXT_RUNTIME","hasLocalMatch","require","domains","remotePatterns","parsedSrc","URL","err","console","error","hasRemoteMatch","hostname","q","path","encodeURIComponent","__next_img_default"],"mappings":"AACA,SAASA,kBAAkB,QAAQ,yBAAwB;AAC3D,SAASC,aAAa,EAAEC,eAAe,QAAQ,kBAAiB;AAEhE,SAASC,cAAc,EACrBC,MAAM,EACNC,GAAG,EACHC,KAAK,EACLC,OAAO,EACoB;IAC3B,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,MAAMC,gBAAgB,EAAE;QAExB,yDAAyD;QACzD,IAAI,CAACN,KAAKM,cAAcC,IAAI,CAAC;QAC7B,IAAI,CAACN,OAAOK,cAAcC,IAAI,CAAC;QAE/B,IAAID,cAAcE,MAAM,GAAG,GAAG;YAC5B,MAAM,IAAIC,MACR,CAAC,iCAAiC,EAAEH,cAAcI,IAAI,CACpD,MACA,6FAA6F,EAAEC,KAAKC,SAAS,CAC7G;gBAAEZ;gBAAKC;gBAAOC;YAAQ,IACrB;QAEP;IACF;IAEA,gEAAgE;IAChE,gGAAgG;IAChG,gCAAgC;IAChC,IAAIW,eAAehB;IACnB,IAAIG,IAAIc,UAAU,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ared/lib/instant-messages.js b/e-commerce/node_modules/next/dist/esm/shared/lib/instant-messages.js new file mode 100644 index 0000000000000000000000000000000000000000..eca24cb6413b1bbd1e1fbd904c116c55bfc5b9c1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/instant-messages.js @@ -0,0 +1,13 @@ +export function createUnrenderedSegmentError(route, missingFiles) { + let message = `Route "${route}": Could not validate that a segment in your UI has instant navigation.`; + if (missingFiles.length > 0) { + const label = missingFiles.length === 1 ? 'Dropped segment' : 'Dropped segments'; + message += `\n\nThis segment was dropped from rendering. Issues that would prevent instant navigation will go undetected.` + `\n\n${label}:\n${missingFiles.map((p)=>` ${p}`).join('\n')}` + `\n\nWays to fix this:` + `\n - [render] Render the dropped segment` + `\n - [ignore] Set \`export const instant = false\` to opt the dropped segment out of instant-navigation validation` + `\n\nLearn more: https://nextjs.org/docs/messages/instant-unrendered-segment`; + } + return new Error(message); +} +export function createLinkPrefetchPartialError(pathname) { + return new Error(`Next.js encountered dynamic data during prefetching for "${pathname}".\n\n` + `This will lead to slower, more expensive prefetches.\n\n` + `Ways to fix this:\n` + ` - [upgrade] Opt into Partial Prefetching by exporting \`const prefetch = 'partial'\` from the page or layout, or by setting \`partialPrefetching: true\` in next.config to opt the whole app in\n` + ` - [disable] Remove \`prefetch={true}\` from the <Link> to use the default prefetch\n` + ` - [ignore] Set \`export const instant = false\` to opt the route out of instant-navigation validation\n\n` + `Learn more: https://nextjs.org/docs/messages/instant-link-prefetch-partial`); +} + +//# sourceMappingURL=instant-messages.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/instant-messages.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/instant-messages.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a8ed8265f8ec33f465b13d05cf037b3ed2e6e6f4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/instant-messages.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/instant-messages.ts"],"sourcesContent":["export function createUnrenderedSegmentError(\n route: string,\n missingFiles: readonly string[]\n): Error {\n let message = `Route \"${route}\": Could not validate that a segment in your UI has instant navigation.`\n if (missingFiles.length > 0) {\n const label =\n missingFiles.length === 1 ? 'Dropped segment' : 'Dropped segments'\n message +=\n `\\n\\nThis segment was dropped from rendering. Issues that would prevent instant navigation will go undetected.` +\n `\\n\\n${label}:\\n${missingFiles.map((p) => ` ${p}`).join('\\n')}` +\n `\\n\\nWays to fix this:` +\n `\\n - [render] Render the dropped segment` +\n `\\n - [ignore] Set \\`export const instant = false\\` to opt the dropped segment out of instant-navigation validation` +\n `\\n\\nLearn more: https://nextjs.org/docs/messages/instant-unrendered-segment`\n }\n return new Error(message)\n}\n\nexport function createLinkPrefetchPartialError(pathname: string): Error {\n return new Error(\n `Next.js encountered dynamic data during prefetching for \"${pathname}\".\\n\\n` +\n `This will lead to slower, more expensive prefetches.\\n\\n` +\n `Ways to fix this:\\n` +\n ` - [upgrade] Opt into Partial Prefetching by exporting \\`const prefetch = 'partial'\\` from the page or layout, or by setting \\`partialPrefetching: true\\` in next.config to opt the whole app in\\n` +\n ` - [disable] Remove \\`prefetch={true}\\` from the <Link> to use the default prefetch\\n` +\n ` - [ignore] Set \\`export const instant = false\\` to opt the route out of instant-navigation validation\\n\\n` +\n `Learn more: https://nextjs.org/docs/messages/instant-link-prefetch-partial`\n )\n}\n"],"names":["createUnrenderedSegmentError","route","missingFiles","message","length","label","map","p","join","Error","createLinkPrefetchPartialError","pathname"],"mappings":"AAAA,OAAO,SAASA,6BACdC,KAAa,EACbC,YAA+B;IAE/B,IAAIC,UAAU,CAAC,OAAO,EAAEF,MAAM,uEAAuE,CAAC;IACtG,IAAIC,aAAaE,MAAM,GAAG,GAAG;QAC3B,MAAMC,QACJH,aAAaE,MAAM,KAAK,IAAI,oBAAoB;QAClDD,WACE,CAAC,6GAA6G,CAAC,GAC/G,CAAC,IAAI,EAAEE,MAAM,GAAG,EAAEH,aAAaI,GAAG,CAAC,CAACC,IAAM,CAAC,EAAE,EAAEA,GAAG,EAAEC,IAAI,CAAC,OAAO,GAChE,CAAC,qBAAqB,CAAC,GACvB,CAAC,yCAAyC,CAAC,GAC3C,CAAC,mHAAmH,CAAC,GACrH,CAAC,2EAA2E,CAAC;IACjF;IACA,OAAO,IAAIC,MAAMN;AACnB;AAEA,OAAO,SAASO,+BAA+BC,QAAgB;IAC7D,OAAO,IAAIF,MACT,CAAC,yDAAyD,EAAEE,SAAS,MAAM,CAAC,GAC1E,CAAC,wDAAwD,CAAC,GAC1D,CAAC,mBAAmB,CAAC,GACrB,CAAC,mMAAmM,CAAC,GACrM,CAAC,sFAAsF,CAAC,GACxF,CAAC,2GAA2G,CAAC,GAC7G,CAAC,0EAA0E,CAAC;AAElF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/instant-nav-cookie.js b/e-commerce/node_modules/next/dist/esm/shared/lib/instant-nav-cookie.js new file mode 100644 index 0000000000000000000000000000000000000000..9533f9c8710f4e53fa132f49c50030adef4aef39 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/instant-nav-cookie.js @@ -0,0 +1,39 @@ +export function parseInstantNavCookieValue(raw) { + try { + const parsed = JSON.parse(raw); + if (Array.isArray(parsed) && parsed.length >= 3) { + const rawState = parsed[2]; + if (rawState === null) { + return { + state: 'mpa' + }; + } + // SPA capture: rawState is { from, to } + if (typeof rawState === 'object' && rawState !== null) { + const fromTree = rawState.from ?? [ + '', + {} + ]; + const toTree = rawState.to ?? null; + return { + state: 'spa', + fromTree, + toTree + }; + } + return { + state: 'spa', + fromTree: [ + '', + {} + ], + toTree: null + }; + } + } catch {} + return { + state: 'pending' + }; +} + +//# sourceMappingURL=instant-nav-cookie.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/instant-nav-cookie.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/instant-nav-cookie.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6b397fd2e4b1a2556e28acf444e2a8254105263b --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/instant-nav-cookie.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/instant-nav-cookie.ts"],"sourcesContent":["import type { FlightRouterState } from './app-router-types'\n\nexport type InstantNavCookieData =\n | { state: 'pending' }\n | { state: 'mpa' }\n | {\n state: 'spa'\n fromTree: FlightRouterState\n toTree: FlightRouterState | null\n }\n\nexport function parseInstantNavCookieValue(raw: string): InstantNavCookieData {\n try {\n const parsed = JSON.parse(raw)\n if (Array.isArray(parsed) && parsed.length >= 3) {\n const rawState = parsed[2]\n if (rawState === null) {\n return { state: 'mpa' }\n }\n // SPA capture: rawState is { from, to }\n if (typeof rawState === 'object' && rawState !== null) {\n const fromTree: FlightRouterState = rawState.from ?? ['', {}]\n const toTree: FlightRouterState | null = rawState.to ?? null\n return { state: 'spa', fromTree, toTree }\n }\n return { state: 'spa', fromTree: ['', {}], toTree: null }\n }\n } catch {}\n return { state: 'pending' }\n}\n"],"names":["parseInstantNavCookieValue","raw","parsed","JSON","parse","Array","isArray","length","rawState","state","fromTree","from","toTree","to"],"mappings":"AAWA,OAAO,SAASA,2BAA2BC,GAAW;IACpD,IAAI;QACF,MAAMC,SAASC,KAAKC,KAAK,CAACH;QAC1B,IAAII,MAAMC,OAAO,CAACJ,WAAWA,OAAOK,MAAM,IAAI,GAAG;YAC/C,MAAMC,WAAWN,MAAM,CAAC,EAAE;YAC1B,IAAIM,aAAa,MAAM;gBACrB,OAAO;oBAAEC,OAAO;gBAAM;YACxB;YACA,wCAAwC;YACxC,IAAI,OAAOD,aAAa,YAAYA,aAAa,MAAM;gBACrD,MAAME,WAA8BF,SAASG,IAAI,IAAI;oBAAC;oBAAI,CAAC;iBAAE;gBAC7D,MAAMC,SAAmCJ,SAASK,EAAE,IAAI;gBACxD,OAAO;oBAAEJ,OAAO;oBAAOC;oBAAUE;gBAAO;YAC1C;YACA,OAAO;gBAAEH,OAAO;gBAAOC,UAAU;oBAAC;oBAAI,CAAC;iBAAE;gBAAEE,QAAQ;YAAK;QAC1D;IACF,EAAE,OAAM,CAAC;IACT,OAAO;QAAEH,OAAO;IAAU;AAC5B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/invariant-error.js b/e-commerce/node_modules/next/dist/esm/shared/lib/invariant-error.js new file mode 100644 index 0000000000000000000000000000000000000000..571e1bf46b4b1330e818234d8dd239424eccd399 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/invariant-error.js @@ -0,0 +1,8 @@ +export class InvariantError extends Error { + constructor(message, options){ + super(`Invariant: ${message.endsWith('.') ? message : message + '.'} This is a bug in Next.js.`, options); + this.name = 'InvariantError'; + } +} + +//# sourceMappingURL=invariant-error.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/invariant-error.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/invariant-error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..643b09899ae4f531bea62f5f99ccb2e67e2084d6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/invariant-error.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/invariant-error.ts"],"sourcesContent":["export class InvariantError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(\n `Invariant: ${message.endsWith('.') ? message : message + '.'} This is a bug in Next.js.`,\n options\n )\n this.name = 'InvariantError'\n }\n}\n"],"names":["InvariantError","Error","constructor","message","options","endsWith","name"],"mappings":"AAAA,OAAO,MAAMA,uBAAuBC;IAClCC,YAAYC,OAAe,EAAEC,OAAsB,CAAE;QACnD,KAAK,CACH,CAAC,WAAW,EAAED,QAAQE,QAAQ,CAAC,OAAOF,UAAUA,UAAU,IAAI,0BAA0B,CAAC,EACzFC;QAEF,IAAI,CAACE,IAAI,GAAG;IACd;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/is-internal.js b/e-commerce/node_modules/next/dist/esm/shared/lib/is-internal.js new file mode 100644 index 0000000000000000000000000000000000000000..335dcbcc39fe1abf36bd37566cdc7f36eecce132 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/is-internal.js @@ -0,0 +1,11 @@ +/** React that's compiled with `next`. Used by App Router. */ export const reactVendoredRe = /[\\/]next[\\/]dist[\\/]compiled[\\/](react|react-dom|react-server-dom-(webpack|turbopack)|scheduler)[\\/]/; +/** React the user installed. Used by Pages Router, or user imports in App Router. */ export const reactNodeModulesRe = /node_modules[\\/](react|react-dom|scheduler)[\\/]/; +export const nextInternalsRe = /(node_modules[\\/]next[\\/]|[\\/].next[\\/]static[\\/]chunks[\\/]webpack\.js$|(edge-runtime-webpack|webpack-runtime)\.js$)/; +export default function isInternal(file) { + if (!file) return false; + // NOTE: native code has a version of the same logic in crates/next-napi-bindings/src/next_api/utils.rs + // keep them in sync. + return nextInternalsRe.test(file) || reactVendoredRe.test(file) || reactNodeModulesRe.test(file); +} + +//# sourceMappingURL=is-internal.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/is-internal.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/is-internal.js.map new file mode 100644 index 0000000000000000000000000000000000000000..68ea00e1bc1f98ca6a55973fbc7d23379f3fe93c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/is-internal.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/is-internal.ts"],"sourcesContent":["/** React that's compiled with `next`. Used by App Router. */\nexport const reactVendoredRe =\n /[\\\\/]next[\\\\/]dist[\\\\/]compiled[\\\\/](react|react-dom|react-server-dom-(webpack|turbopack)|scheduler)[\\\\/]/\n\n/** React the user installed. Used by Pages Router, or user imports in App Router. */\nexport const reactNodeModulesRe =\n /node_modules[\\\\/](react|react-dom|scheduler)[\\\\/]/\n\nexport const nextInternalsRe =\n /(node_modules[\\\\/]next[\\\\/]|[\\\\/].next[\\\\/]static[\\\\/]chunks[\\\\/]webpack\\.js$|(edge-runtime-webpack|webpack-runtime)\\.js$)/\n\nexport default function isInternal(file: string | null) {\n if (!file) return false\n // NOTE: native code has a version of the same logic in crates/next-napi-bindings/src/next_api/utils.rs\n // keep them in sync.\n\n return (\n nextInternalsRe.test(file) ||\n reactVendoredRe.test(file) ||\n reactNodeModulesRe.test(file)\n )\n}\n"],"names":["reactVendoredRe","reactNodeModulesRe","nextInternalsRe","isInternal","file","test"],"mappings":"AAAA,2DAA2D,GAC3D,OAAO,MAAMA,kBACX,4GAA2G;AAE7G,mFAAmF,GACnF,OAAO,MAAMC,qBACX,oDAAmD;AAErD,OAAO,MAAMC,kBACX,6HAA4H;AAE9H,eAAe,SAASC,WAAWC,IAAmB;IACpD,IAAI,CAACA,MAAM,OAAO;IAClB,uGAAuG;IACvG,qBAAqB;IAErB,OACEF,gBAAgBG,IAAI,CAACD,SACrBJ,gBAAgBK,IAAI,CAACD,SACrBH,mBAAmBI,IAAI,CAACD;AAE5B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/is-plain-object.js b/e-commerce/node_modules/next/dist/esm/shared/lib/is-plain-object.js new file mode 100644 index 0000000000000000000000000000000000000000..c5f178922a9bbe1ea92e30890f66ddafddbf1737 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/is-plain-object.js @@ -0,0 +1,20 @@ +export function getObjectClassLabel(value) { + return Object.prototype.toString.call(value); +} +export function isPlainObject(value) { + if (getObjectClassLabel(value) !== '[object Object]') { + return false; + } + const prototype = Object.getPrototypeOf(value); + /** + * this used to be previously: + * + * `return prototype === null || prototype === Object.prototype` + * + * but Edge Runtime expose Object from vm, being that kind of type-checking wrongly fail. + * + * It was changed to the current implementation since it's resilient to serialization. + */ return prototype === null || prototype.hasOwnProperty('isPrototypeOf'); +} + +//# sourceMappingURL=is-plain-object.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/is-plain-object.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/is-plain-object.js.map new file mode 100644 index 0000000000000000000000000000000000000000..17ae2906f8f97eaf3855c4119c06eb3a1de6ba95 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/is-plain-object.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/is-plain-object.ts"],"sourcesContent":["export function getObjectClassLabel(value: any): string {\n return Object.prototype.toString.call(value)\n}\n\nexport function isPlainObject(value: any): boolean {\n if (getObjectClassLabel(value) !== '[object Object]') {\n return false\n }\n\n const prototype = Object.getPrototypeOf(value)\n\n /**\n * this used to be previously:\n *\n * `return prototype === null || prototype === Object.prototype`\n *\n * but Edge Runtime expose Object from vm, being that kind of type-checking wrongly fail.\n *\n * It was changed to the current implementation since it's resilient to serialization.\n */\n return prototype === null || prototype.hasOwnProperty('isPrototypeOf')\n}\n"],"names":["getObjectClassLabel","value","Object","prototype","toString","call","isPlainObject","getPrototypeOf","hasOwnProperty"],"mappings":"AAAA,OAAO,SAASA,oBAAoBC,KAAU;IAC5C,OAAOC,OAAOC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACJ;AACxC;AAEA,OAAO,SAASK,cAAcL,KAAU;IACtC,IAAID,oBAAoBC,WAAW,mBAAmB;QACpD,OAAO;IACT;IAEA,MAAME,YAAYD,OAAOK,cAAc,CAACN;IAExC;;;;;;;;GAQC,GACD,OAAOE,cAAc,QAAQA,UAAUK,cAAc,CAAC;AACxD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/is-thenable.js b/e-commerce/node_modules/next/dist/esm/shared/lib/is-thenable.js new file mode 100644 index 0000000000000000000000000000000000000000..4469a4ec5043602166c8794bfba62789581b696e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/is-thenable.js @@ -0,0 +1,10 @@ +/** + * Check to see if a value is Thenable. + * + * @param promise the maybe-thenable value + * @returns true if the value is thenable + */ export function isThenable(promise) { + return promise !== null && typeof promise === 'object' && 'then' in promise && typeof promise.then === 'function'; +} + +//# sourceMappingURL=is-thenable.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/is-thenable.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/is-thenable.js.map new file mode 100644 index 0000000000000000000000000000000000000000..eb879f54b2fa42e720279140e31aea7f9a2f9bff --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/is-thenable.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/is-thenable.ts"],"sourcesContent":["/**\n * Check to see if a value is Thenable.\n *\n * @param promise the maybe-thenable value\n * @returns true if the value is thenable\n */\nexport function isThenable<T = unknown>(\n promise: Promise<T> | T\n): promise is Promise<T> {\n return (\n promise !== null &&\n typeof promise === 'object' &&\n 'then' in promise &&\n typeof promise.then === 'function'\n )\n}\n"],"names":["isThenable","promise","then"],"mappings":"AAAA;;;;;CAKC,GACD,OAAO,SAASA,WACdC,OAAuB;IAEvB,OACEA,YAAY,QACZ,OAAOA,YAAY,YACnB,UAAUA,WACV,OAAOA,QAAQC,IAAI,KAAK;AAE5B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/isomorphic/path.d.ts b/e-commerce/node_modules/next/dist/esm/shared/lib/isomorphic/path.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..74050d397f4d2774aa36d60c984d8de0fb1d56f1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/isomorphic/path.d.ts @@ -0,0 +1 @@ +export { default } from 'path' diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/isomorphic/path.js b/e-commerce/node_modules/next/dist/esm/shared/lib/isomorphic/path.js new file mode 100644 index 0000000000000000000000000000000000000000..fdb924778e9cc4d7f29e16081e49c62ce923bc10 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/isomorphic/path.js @@ -0,0 +1,13 @@ +/** + * This module is for next.js server internal usage of path module. + * It will use native path module for nodejs runtime. + * It will use path-browserify polyfill for edge runtime. + */ let path; +if (process.env.NEXT_RUNTIME === 'edge') { + path = require('next/dist/compiled/path-browserify'); +} else { + path = require('path'); +} +module.exports = path; + +//# sourceMappingURL=path.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/isomorphic/path.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/isomorphic/path.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ce230a06eaf992de77fbccb5479a56dc3bb3335a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/isomorphic/path.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/isomorphic/path.js"],"sourcesContent":["/**\n * This module is for next.js server internal usage of path module.\n * It will use native path module for nodejs runtime.\n * It will use path-browserify polyfill for edge runtime.\n */\nlet path\n\nif (process.env.NEXT_RUNTIME === 'edge') {\n path = require('next/dist/compiled/path-browserify')\n} else {\n path = require('path')\n}\n\nmodule.exports = path\n"],"names":["path","process","env","NEXT_RUNTIME","require","module","exports"],"mappings":"AAAA;;;;CAIC,GACD,IAAIA;AAEJ,IAAIC,QAAQC,GAAG,CAACC,YAAY,KAAK,QAAQ;IACvCH,OAAOI,QAAQ;AACjB,OAAO;IACLJ,OAAOI,QAAQ;AACjB;AAEAC,OAAOC,OAAO,GAAGN","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/bailout-to-csr.js b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/bailout-to-csr.js new file mode 100644 index 0000000000000000000000000000000000000000..8eaee432a03066e4f427b070b746e080088b7dc6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/bailout-to-csr.js @@ -0,0 +1,15 @@ +// This has to be a shared module which is shared between client component error boundary and dynamic component +const BAILOUT_TO_CSR = 'BAILOUT_TO_CLIENT_SIDE_RENDERING'; +/** An error that should be thrown when we want to bail out to client-side rendering. */ export class BailoutToCSRError extends Error { + constructor(reason){ + super(`Bail out to client-side rendering: ${reason}`), this.reason = reason, this.digest = BAILOUT_TO_CSR; + } +} +/** Checks if a passed argument is an error that is thrown if we want to bail out to client-side rendering. */ export function isBailoutToCSRError(err) { + if (typeof err !== 'object' || err === null || !('digest' in err)) { + return false; + } + return err.digest === BAILOUT_TO_CSR; +} + +//# sourceMappingURL=bailout-to-csr.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/bailout-to-csr.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/bailout-to-csr.js.map new file mode 100644 index 0000000000000000000000000000000000000000..98bcdd398002641bcf81ace069b41a445a8ee2d9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/bailout-to-csr.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/lazy-dynamic/bailout-to-csr.ts"],"sourcesContent":["// This has to be a shared module which is shared between client component error boundary and dynamic component\nconst BAILOUT_TO_CSR = 'BAILOUT_TO_CLIENT_SIDE_RENDERING'\n\n/** An error that should be thrown when we want to bail out to client-side rendering. */\nexport class BailoutToCSRError extends Error {\n public readonly digest = BAILOUT_TO_CSR\n\n constructor(public readonly reason: string) {\n super(`Bail out to client-side rendering: ${reason}`)\n }\n}\n\n/** Checks if a passed argument is an error that is thrown if we want to bail out to client-side rendering. */\nexport function isBailoutToCSRError(err: unknown): err is BailoutToCSRError {\n if (typeof err !== 'object' || err === null || !('digest' in err)) {\n return false\n }\n\n return err.digest === BAILOUT_TO_CSR\n}\n"],"names":["BAILOUT_TO_CSR","BailoutToCSRError","Error","constructor","reason","digest","isBailoutToCSRError","err"],"mappings":"AAAA,+GAA+G;AAC/G,MAAMA,iBAAiB;AAEvB,sFAAsF,GACtF,OAAO,MAAMC,0BAA0BC;IAGrCC,YAAY,AAAgBC,MAAc,CAAE;QAC1C,KAAK,CAAC,CAAC,mCAAmC,EAAEA,QAAQ,QAD1BA,SAAAA,aAFZC,SAASL;IAIzB;AACF;AAEA,4GAA4G,GAC5G,OAAO,SAASM,oBAAoBC,GAAY;IAC9C,IAAI,OAAOA,QAAQ,YAAYA,QAAQ,QAAQ,CAAE,CAAA,YAAYA,GAAE,GAAI;QACjE,OAAO;IACT;IAEA,OAAOA,IAAIF,MAAM,KAAKL;AACxB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/dynamic-bailout-to-csr.js b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/dynamic-bailout-to-csr.js new file mode 100644 index 0000000000000000000000000000000000000000..ac0195ca762feec897819f130515d2474021a586 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/dynamic-bailout-to-csr.js @@ -0,0 +1,22 @@ +'use client'; +import { use } from 'react'; +import { browser } from 'react-dom'; +import { BailoutToCSRError } from './bailout-to-csr'; +import { createReactBrowserBailoutReason } from './react-browser-bailout'; +const NEXT_DYNAMIC_BAILOUT_REASON = 'next/dynamic'; +const getNextDynamicBailoutReason = createReactBrowserBailoutReason.bind(null, NEXT_DYNAMIC_BAILOUT_REASON); +/** + * Signals during server rendering that this subtree should be client-rendered. + */ export function BailoutToCSRForNextDynamic({ children }) { + if (process.env.__NEXT_EXPERIMENTAL_REACT_BROWSER_BAILOUT) { + // @ts-expect-error TODO: Update @types/react-dom to include the reason argument. + use(browser(getNextDynamicBailoutReason)); + return children; + } + if (typeof window === 'undefined') { + throw new BailoutToCSRError(NEXT_DYNAMIC_BAILOUT_REASON); + } + return children; +} + +//# sourceMappingURL=dynamic-bailout-to-csr.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/dynamic-bailout-to-csr.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/dynamic-bailout-to-csr.js.map new file mode 100644 index 0000000000000000000000000000000000000000..9c3c33165664b38bb6594ddcabbdb734c28a0241 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/dynamic-bailout-to-csr.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/lazy-dynamic/dynamic-bailout-to-csr.tsx"],"sourcesContent":["'use client'\n\nimport { use, type ReactElement } from 'react'\nimport { browser } from 'react-dom'\nimport { BailoutToCSRError } from './bailout-to-csr'\nimport { createReactBrowserBailoutReason } from './react-browser-bailout'\n\ninterface BailoutToCSRForNextDynamicProps {\n children: ReactElement\n}\n\nconst NEXT_DYNAMIC_BAILOUT_REASON = 'next/dynamic'\nconst getNextDynamicBailoutReason = createReactBrowserBailoutReason.bind(\n null,\n NEXT_DYNAMIC_BAILOUT_REASON\n)\n\n/**\n * Signals during server rendering that this subtree should be client-rendered.\n */\nexport function BailoutToCSRForNextDynamic({\n children,\n}: BailoutToCSRForNextDynamicProps) {\n if (process.env.__NEXT_EXPERIMENTAL_REACT_BROWSER_BAILOUT) {\n // @ts-expect-error TODO: Update @types/react-dom to include the reason argument.\n use(browser(getNextDynamicBailoutReason))\n return children\n }\n\n if (typeof window === 'undefined') {\n throw new BailoutToCSRError(NEXT_DYNAMIC_BAILOUT_REASON)\n }\n\n return children\n}\n"],"names":["use","browser","BailoutToCSRError","createReactBrowserBailoutReason","NEXT_DYNAMIC_BAILOUT_REASON","getNextDynamicBailoutReason","bind","BailoutToCSRForNextDynamic","children","process","env","__NEXT_EXPERIMENTAL_REACT_BROWSER_BAILOUT","window"],"mappings":"AAAA;AAEA,SAASA,GAAG,QAA2B,QAAO;AAC9C,SAASC,OAAO,QAAQ,YAAW;AACnC,SAASC,iBAAiB,QAAQ,mBAAkB;AACpD,SAASC,+BAA+B,QAAQ,0BAAyB;AAMzE,MAAMC,8BAA8B;AACpC,MAAMC,8BAA8BF,gCAAgCG,IAAI,CACtE,MACAF;AAGF;;CAEC,GACD,OAAO,SAASG,2BAA2B,EACzCC,QAAQ,EACwB;IAChC,IAAIC,QAAQC,GAAG,CAACC,yCAAyC,EAAE;QACzD,iFAAiF;QACjFX,IAAIC,QAAQI;QACZ,OAAOG;IACT;IAEA,IAAI,OAAOI,WAAW,aAAa;QACjC,MAAM,IAAIV,kBAAkBE;IAC9B;IAEA,OAAOI;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/loadable.js b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/loadable.js new file mode 100644 index 0000000000000000000000000000000000000000..317e5e3bbf7ca9f245894733c1ff6ef5975068b1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/loadable.js @@ -0,0 +1,68 @@ +import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; +import { Suspense, Fragment, lazy } from 'react'; +import { BailoutToCSRForNextDynamic } from './dynamic-bailout-to-csr'; +import { PreloadChunks } from './preload-chunks'; +// Normalize loader to return the module as form { default: Component } for `React.lazy`. +// Also for backward compatible since next/dynamic allows to resolve a component directly with loader +// Client component reference proxy need to be converted to a module. +function convertModule(mod) { + // Check "default" prop before accessing it, as it could be client reference proxy that could break it reference. + // Cases: + // mod: { default: Component } + // mod: Component + // mod: { default: proxy(Component) } + // mod: proxy(Component) + const hasDefault = mod && 'default' in mod; + return { + default: hasDefault ? mod.default : mod + }; +} +const defaultOptions = { + loader: ()=>Promise.resolve(convertModule(()=>null)), + loading: null, + ssr: true +}; +function Loadable(options) { + const opts = { + ...defaultOptions, + ...options + }; + const Lazy = /*#__PURE__*/ lazy(()=>opts.loader().then(convertModule)); + const Loading = opts.loading; + function LoadableComponent(props) { + const fallbackElement = Loading ? /*#__PURE__*/ _jsx(Loading, { + isLoading: true, + pastDelay: true, + error: null + }) : null; + // If it's non-SSR or provided a loading component, wrap it in a suspense boundary + const hasSuspenseBoundary = !opts.ssr || !!opts.loading; + const Wrap = hasSuspenseBoundary ? Suspense : Fragment; + const wrapProps = hasSuspenseBoundary ? { + fallback: fallbackElement + } : {}; + const children = opts.ssr ? /*#__PURE__*/ _jsxs(_Fragment, { + children: [ + typeof window === 'undefined' ? /*#__PURE__*/ _jsx(PreloadChunks, { + moduleIds: opts.modules + }) : null, + /*#__PURE__*/ _jsx(Lazy, { + ...props + }) + ] + }) : /*#__PURE__*/ _jsx(BailoutToCSRForNextDynamic, { + children: /*#__PURE__*/ _jsx(Lazy, { + ...props + }) + }); + return /*#__PURE__*/ _jsx(Wrap, { + ...wrapProps, + children: children + }); + } + LoadableComponent.displayName = 'LoadableComponent'; + return LoadableComponent; +} +export default Loadable; + +//# sourceMappingURL=loadable.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/loadable.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/loadable.js.map new file mode 100644 index 0000000000000000000000000000000000000000..469c279ff34f0cd034b712603ef37878da1e0860 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/loadable.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/lazy-dynamic/loadable.tsx"],"sourcesContent":["import { Suspense, Fragment, lazy } from 'react'\nimport { BailoutToCSRForNextDynamic } from './dynamic-bailout-to-csr'\nimport type { ComponentModule } from './types'\nimport { PreloadChunks } from './preload-chunks'\n\n// Normalize loader to return the module as form { default: Component } for `React.lazy`.\n// Also for backward compatible since next/dynamic allows to resolve a component directly with loader\n// Client component reference proxy need to be converted to a module.\nfunction convertModule<P>(\n mod: React.ComponentType<P> | ComponentModule<P> | undefined\n): {\n default: React.ComponentType<P>\n} {\n // Check \"default\" prop before accessing it, as it could be client reference proxy that could break it reference.\n // Cases:\n // mod: { default: Component }\n // mod: Component\n // mod: { default: proxy(Component) }\n // mod: proxy(Component)\n const hasDefault = mod && 'default' in mod\n return {\n default: hasDefault\n ? (mod as ComponentModule<P>).default\n : (mod as React.ComponentType<P>),\n }\n}\n\nconst defaultOptions = {\n loader: () => Promise.resolve(convertModule(() => null)),\n loading: null,\n ssr: true,\n}\n\ninterface LoadableOptions {\n loader?: () => Promise<React.ComponentType<any> | ComponentModule<any>>\n loading?: React.ComponentType<any> | null\n ssr?: boolean\n modules?: string[]\n}\n\nfunction Loadable(options: LoadableOptions) {\n const opts = { ...defaultOptions, ...options }\n const Lazy = lazy(() => opts.loader().then(convertModule))\n const Loading = opts.loading\n\n function LoadableComponent(props: any) {\n const fallbackElement = Loading ? (\n <Loading isLoading={true} pastDelay={true} error={null} />\n ) : null\n\n // If it's non-SSR or provided a loading component, wrap it in a suspense boundary\n const hasSuspenseBoundary = !opts.ssr || !!opts.loading\n const Wrap = hasSuspenseBoundary ? Suspense : Fragment\n const wrapProps = hasSuspenseBoundary ? { fallback: fallbackElement } : {}\n const children = opts.ssr ? (\n <>\n {/* During SSR, we need to preload the CSS from the dynamic component to avoid flash of unstyled content */}\n {typeof window === 'undefined' ? (\n <PreloadChunks moduleIds={opts.modules} />\n ) : null}\n <Lazy {...props} />\n </>\n ) : (\n <BailoutToCSRForNextDynamic>\n <Lazy {...props} />\n </BailoutToCSRForNextDynamic>\n )\n\n return <Wrap {...wrapProps}>{children}</Wrap>\n }\n\n LoadableComponent.displayName = 'LoadableComponent'\n\n return LoadableComponent\n}\n\nexport default Loadable\n"],"names":["Suspense","Fragment","lazy","BailoutToCSRForNextDynamic","PreloadChunks","convertModule","mod","hasDefault","default","defaultOptions","loader","Promise","resolve","loading","ssr","Loadable","options","opts","Lazy","then","Loading","LoadableComponent","props","fallbackElement","isLoading","pastDelay","error","hasSuspenseBoundary","Wrap","wrapProps","fallback","children","window","moduleIds","modules","displayName"],"mappings":";AAAA,SAASA,QAAQ,EAAEC,QAAQ,EAAEC,IAAI,QAAQ,QAAO;AAChD,SAASC,0BAA0B,QAAQ,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AAQ","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/preload-chunks.js b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/preload-chunks.js new file mode 100644 index 0000000000000000000000000000000000000000..64e26a70957a257b6d1b883806a746238fdbd94a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/preload-chunks.js @@ -0,0 +1,60 @@ +'use client'; +import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime"; +import { preload } from 'react-dom'; +import { workAsyncStorage } from '../../../server/app-render/work-async-storage.external'; +import { encodeURIPath } from '../encode-uri-path'; +import { getAssetTokenQuery } from '../deployment-id'; +export function PreloadChunks({ moduleIds }) { + // Early return in client compilation and only load requestStore on server side + if (typeof window !== 'undefined') { + return null; + } + const workStore = workAsyncStorage.getStore(); + if (workStore === undefined) { + return null; + } + const allFiles = []; + // Search the current dynamic call unique key id in react loadable manifest, + // and find the corresponding CSS files to preload + if (workStore.reactLoadableManifest && moduleIds) { + const manifest = workStore.reactLoadableManifest; + for (const key of moduleIds){ + if (!manifest[key]) continue; + const chunks = manifest[key].files; + allFiles.push(...chunks); + } + } + if (allFiles.length === 0) { + return null; + } + const query = getAssetTokenQuery(); + return /*#__PURE__*/ _jsx(_Fragment, { + children: allFiles.map((chunk)=>{ + const href = `${workStore.assetPrefix}/_next/${encodeURIPath(chunk)}${query}`; + const isCss = chunk.endsWith('.css'); + // If it's stylesheet we use `precedence` o help hoist with React Float. + // For stylesheets we actually need to render the CSS because nothing else is going to do it so it needs to be part of the component tree. + // The `preload` for stylesheet is not optional. + if (isCss) { + return /*#__PURE__*/ _jsx("link", { + // @ts-ignore + precedence: "dynamic", + href: href, + rel: "stylesheet", + as: "style", + nonce: workStore.nonce + }, chunk); + } else { + // If it's script we use ReactDOM.preload to preload the resources + preload(href, { + as: 'script', + fetchPriority: 'low', + nonce: workStore.nonce + }); + return null; + } + }) + }); +} + +//# sourceMappingURL=preload-chunks.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/preload-chunks.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/preload-chunks.js.map new file mode 100644 index 0000000000000000000000000000000000000000..af05e9eaf3691cc05a5a516b901781d083fb7793 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/preload-chunks.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/lazy-dynamic/preload-chunks.tsx"],"sourcesContent":["'use client'\n\nimport { preload } from 'react-dom'\n\nimport { workAsyncStorage } from '../../../server/app-render/work-async-storage.external'\nimport { encodeURIPath } from '../encode-uri-path'\nimport { getAssetTokenQuery } from '../deployment-id'\n\nexport function PreloadChunks({\n moduleIds,\n}: {\n moduleIds: string[] | undefined\n}) {\n // Early return in client compilation and only load requestStore on server side\n if (typeof window !== 'undefined') {\n return null\n }\n\n const workStore = workAsyncStorage.getStore()\n if (workStore === undefined) {\n return null\n }\n\n const allFiles = []\n\n // Search the current dynamic call unique key id in react loadable manifest,\n // and find the corresponding CSS files to preload\n if (workStore.reactLoadableManifest && moduleIds) {\n const manifest = workStore.reactLoadableManifest\n for (const key of moduleIds) {\n if (!manifest[key]) continue\n const chunks = manifest[key].files\n allFiles.push(...chunks)\n }\n }\n\n if (allFiles.length === 0) {\n return null\n }\n\n const query = getAssetTokenQuery()\n\n return (\n <>\n {allFiles.map((chunk) => {\n const href = `${workStore.assetPrefix}/_next/${encodeURIPath(chunk)}${query}`\n const isCss = chunk.endsWith('.css')\n // If it's stylesheet we use `precedence` o help hoist with React Float.\n // For stylesheets we actually need to render the CSS because nothing else is going to do it so it needs to be part of the component tree.\n // The `preload` for stylesheet is not optional.\n if (isCss) {\n return (\n <link\n key={chunk}\n // @ts-ignore\n precedence=\"dynamic\"\n href={href}\n rel=\"stylesheet\"\n as=\"style\"\n nonce={workStore.nonce}\n />\n )\n } else {\n // If it's script we use ReactDOM.preload to preload the resources\n preload(href, {\n as: 'script',\n fetchPriority: 'low',\n nonce: workStore.nonce,\n })\n return null\n }\n })}\n </>\n )\n}\n"],"names":["preload","workAsyncStorage","encodeURIPath","getAssetTokenQuery","PreloadChunks","moduleIds","window","workStore","getStore","undefined","allFiles","reactLoadableManifest","manifest","key","chunks","files","push","length","query","map","chunk","href","assetPrefix","isCss","endsWith","link","precedence","rel","as","nonce","fetchPriority"],"mappings":"AAAA;;AAEA,SAASA,OAAO,QAAQ,YAAW;AAEnC,SAASC,gBAAgB,QAAQ,yDAAwD;AACzF,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,kBAAkB,QAAQ,mBAAkB;AAErD,OAAO,SAASC,cAAc,EAC5BC,SAAS,EAGV;IACC,+EAA+E;IAC/E,IAAI,OAAOC,WAAW,aAAa;QACjC,OAAO;IACT;IAEA,MAAMC,YAAYN,iBAAiBO,QAAQ;IAC3C,IAAID,cAAcE,WAAW;QAC3B,OAAO;IACT;IAEA,MAAMC,WAAW,EAAE;IAEnB,4EAA4E;IAC5E,kDAAkD;IAClD,IAAIH,UAAUI,qBAAqB,IAAIN,WAAW;QAChD,MAAMO,WAAWL,UAAUI,qBAAqB;QAChD,KAAK,MAAME,OAAOR,UAAW;YAC3B,IAAI,CAACO,QAAQ,CAACC,IAAI,EAAE;YACpB,MAAMC,SAASF,QAAQ,CAACC,IAAI,CAACE,KAAK;YAClCL,SAASM,IAAI,IAAIF;QACnB;IACF;IAEA,IAAIJ,SAASO,MAAM,KAAK,GAAG;QACzB,OAAO;IACT;IAEA,MAAMC,QAAQf;IAEd,qBACE;kBACGO,SAASS,GAAG,CAAC,CAACC;YACb,MAAMC,OAAO,GAAGd,UAAUe,WAAW,CAAC,OAAO,EAAEpB,cAAckB,SAASF,OAAO;YAC7E,MAAMK,QAAQH,MAAMI,QAAQ,CAAC;YAC7B,wEAAwE;YACxE,0IAA0I;YAC1I,gDAAgD;YAChD,IAAID,OAAO;gBACT,qBACE,KAACE;oBAEC,aAAa;oBACbC,YAAW;oBACXL,MAAMA;oBACNM,KAAI;oBACJC,IAAG;oBACHC,OAAOtB,UAAUsB,KAAK;mBANjBT;YASX,OAAO;gBACL,kEAAkE;gBAClEpB,QAAQqB,MAAM;oBACZO,IAAI;oBACJE,eAAe;oBACfD,OAAOtB,UAAUsB,KAAK;gBACxB;gBACA,OAAO;YACT;QACF;;AAGN","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/react-browser-bailout.js b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/react-browser-bailout.js new file mode 100644 index 0000000000000000000000000000000000000000..667676690ef377c2fc88ec0a3c12ab1b13e01441 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/react-browser-bailout.js @@ -0,0 +1,19 @@ +// This module is bundled separately into user code and the precompiled App +// Router runtime. Use the global symbol registry so both copies recognize the +// same browser bailout reason. +const REACT_BROWSER_BAILOUT_REASON = Symbol.for('next.browser-bailout-reason'); +export function createReactBrowserBailoutReason(reason) { + return { + $$typeof: REACT_BROWSER_BAILOUT_REASON, + reason + }; +} +export function getReactBrowserBailoutReason(error) { + const cause = error?.cause; + return cause?.$$typeof === REACT_BROWSER_BAILOUT_REASON ? cause.reason : undefined; +} +export function isNextBrowserBailoutError(error) { + return getReactBrowserBailoutReason(error) !== undefined; +} + +//# sourceMappingURL=react-browser-bailout.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/react-browser-bailout.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/react-browser-bailout.js.map new file mode 100644 index 0000000000000000000000000000000000000000..491d7c1c9374038c6fee94ec9b8eaed2ba8e3c7a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/react-browser-bailout.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/lazy-dynamic/react-browser-bailout.ts"],"sourcesContent":["// This module is bundled separately into user code and the precompiled App\n// Router runtime. Use the global symbol registry so both copies recognize the\n// same browser bailout reason.\nconst REACT_BROWSER_BAILOUT_REASON = Symbol.for('next.browser-bailout-reason')\n\ntype ReactBrowserBailoutReason = {\n $$typeof: symbol\n reason: string\n}\n\nexport function createReactBrowserBailoutReason(\n reason: string\n): ReactBrowserBailoutReason {\n return {\n $$typeof: REACT_BROWSER_BAILOUT_REASON,\n reason,\n }\n}\n\nexport function getReactBrowserBailoutReason(\n error: unknown\n): string | undefined {\n const cause = (error as Error)?.cause as ReactBrowserBailoutReason | undefined\n\n return cause?.$$typeof === REACT_BROWSER_BAILOUT_REASON\n ? cause.reason\n : undefined\n}\n\nexport function isNextBrowserBailoutError(error: unknown): boolean {\n return getReactBrowserBailoutReason(error) !== undefined\n}\n"],"names":["REACT_BROWSER_BAILOUT_REASON","Symbol","for","createReactBrowserBailoutReason","reason","$$typeof","getReactBrowserBailoutReason","error","cause","undefined","isNextBrowserBailoutError"],"mappings":"AAAA,2EAA2E;AAC3E,8EAA8E;AAC9E,+BAA+B;AAC/B,MAAMA,+BAA+BC,OAAOC,GAAG,CAAC;AAOhD,OAAO,SAASC,gCACdC,MAAc;IAEd,OAAO;QACLC,UAAUL;QACVI;IACF;AACF;AAEA,OAAO,SAASE,6BACdC,KAAc;IAEd,MAAMC,QAASD,OAAiBC;IAEhC,OAAOA,OAAOH,aAAaL,+BACvBQ,MAAMJ,MAAM,GACZK;AACN;AAEA,OAAO,SAASC,0BAA0BH,KAAc;IACtD,OAAOD,6BAA6BC,WAAWE;AACjD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/types.js b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/types.js new file mode 100644 index 0000000000000000000000000000000000000000..71d3002375c021de8e09dbfb6ce8af55cd2a5a82 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/types.js @@ -0,0 +1,3 @@ +export { }; + +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/types.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c7ff07c417d3569ee554a47d3655d8a06e396fef --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/lazy-dynamic/types.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/lazy-dynamic/types.ts"],"sourcesContent":["export type ComponentModule<P = {}> = { default: React.ComponentType<P> }\n\nexport declare type LoaderComponent<P = {}> = Promise<\n React.ComponentType<P> | ComponentModule<P>\n>\n\nexport declare type Loader<P = {}> = () => LoaderComponent<P>\n\nexport type LoadableGeneratedOptions = {\n modules?: string[]\n}\n\nexport type DynamicOptionsLoadingProps = {\n error?: Error | null\n isLoading?: boolean\n pastDelay?: boolean\n retry?: () => void\n timedOut?: boolean\n}\n"],"names":[],"mappings":"AAYA,WAMC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/loadable-context.shared-runtime.js b/e-commerce/node_modules/next/dist/esm/shared/lib/loadable-context.shared-runtime.js new file mode 100644 index 0000000000000000000000000000000000000000..28f0b378745298d069f92e2642af5e3452507393 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/loadable-context.shared-runtime.js @@ -0,0 +1,8 @@ +'use client'; +import React from 'react'; +export const LoadableContext = React.createContext(null); +if (process.env.NODE_ENV !== 'production') { + LoadableContext.displayName = 'LoadableContext'; +} + +//# sourceMappingURL=loadable-context.shared-runtime.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/loadable-context.shared-runtime.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/loadable-context.shared-runtime.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c194349f97a9a6abb3f39319d153f76b053d5b58 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/loadable-context.shared-runtime.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/loadable-context.shared-runtime.ts"],"sourcesContent":["'use client'\n\nimport React from 'react'\n\ntype CaptureFn = (moduleName: string) => void\n\nexport const LoadableContext = React.createContext<CaptureFn | null>(null)\n\nif (process.env.NODE_ENV !== 'production') {\n LoadableContext.displayName = 'LoadableContext'\n}\n"],"names":["React","LoadableContext","createContext","process","env","NODE_ENV","displayName"],"mappings":"AAAA;AAEA,OAAOA,WAAW,QAAO;AAIzB,OAAO,MAAMC,kBAAkBD,MAAME,aAAa,CAAmB,MAAK;AAE1E,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzCJ,gBAAgBK,WAAW,GAAG;AAChC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/loadable.shared-runtime.js b/e-commerce/node_modules/next/dist/esm/shared/lib/loadable.shared-runtime.js new file mode 100644 index 0000000000000000000000000000000000000000..2fb1875f908602aab153767f11a5dfc28cdf4360 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/loadable.shared-runtime.js @@ -0,0 +1,235 @@ +// TODO: Remove use of `any` type. +/** +@copyright (c) 2017-present James Kyle <me@thejameskyle.com> + MIT License + Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE +*/ // https://github.com/jamiebuilds/react-loadable/blob/v5.5.0/src/index.js +// Modified to be compatible with webpack 4 / Next.js +import React from 'react'; +import { LoadableContext } from './loadable-context.shared-runtime'; +function resolve(obj) { + return obj && obj.default ? obj.default : obj; +} +const ALL_INITIALIZERS = []; +const READY_INITIALIZERS = []; +let initialized = false; +function load(loader) { + let promise = loader(); + let state = { + loading: true, + loaded: null, + error: null + }; + state.promise = promise.then((loaded)=>{ + state.loading = false; + state.loaded = loaded; + return loaded; + }).catch((err)=>{ + state.loading = false; + state.error = err; + throw err; + }); + return state; +} +function createLoadableComponent(loadFn, options) { + let opts = Object.assign({ + loader: null, + loading: null, + delay: 200, + timeout: null, + webpack: null, + modules: null + }, options); + /** @type LoadableSubscription */ let subscription = null; + function init() { + if (!subscription) { + const sub = new LoadableSubscription(loadFn, opts); + subscription = { + getCurrentValue: sub.getCurrentValue.bind(sub), + subscribe: sub.subscribe.bind(sub), + retry: sub.retry.bind(sub), + promise: sub.promise.bind(sub) + }; + } + return subscription.promise(); + } + // Server only + if (typeof window === 'undefined') { + ALL_INITIALIZERS.push(init); + } + // Client only + if (!initialized && typeof window !== 'undefined') { + // require.resolveWeak check is needed for environments that don't have it available like Jest + const moduleIds = opts.webpack && typeof require.resolveWeak === 'function' ? opts.webpack() : opts.modules; + if (moduleIds) { + READY_INITIALIZERS.push((ids)=>{ + for (const moduleId of moduleIds){ + if (ids.includes(moduleId)) { + return init(); + } + } + }); + } + } + function useLoadableModule() { + init(); + const context = React.useContext(LoadableContext); + if (context && Array.isArray(opts.modules)) { + opts.modules.forEach((moduleName)=>{ + context(moduleName); + }); + } + } + function LoadableComponent(props, ref) { + useLoadableModule(); + const state = React.useSyncExternalStore(subscription.subscribe, subscription.getCurrentValue, subscription.getCurrentValue); + React.useImperativeHandle(ref, ()=>({ + retry: subscription.retry + }), []); + return React.useMemo(()=>{ + if (state.loading || state.error) { + return /*#__PURE__*/ React.createElement(opts.loading, { + isLoading: state.loading, + pastDelay: state.pastDelay, + timedOut: state.timedOut, + error: state.error, + retry: subscription.retry + }); + } else if (state.loaded) { + return /*#__PURE__*/ React.createElement(resolve(state.loaded), props); + } else { + return null; + } + }, [ + props, + state + ]); + } + LoadableComponent.preload = ()=>init(); + LoadableComponent.displayName = 'LoadableComponent'; + return /*#__PURE__*/ React.forwardRef(LoadableComponent); +} +class LoadableSubscription { + constructor(loadFn, opts){ + this._loadFn = loadFn; + this._opts = opts; + this._callbacks = new Set(); + this._delay = null; + this._timeout = null; + this.retry(); + } + promise() { + return this._res.promise; + } + retry() { + this._clearTimeouts(); + this._res = this._loadFn(this._opts.loader); + this._state = { + pastDelay: false, + timedOut: false + }; + const { _res: res, _opts: opts } = this; + if (res.loading) { + if (typeof opts.delay === 'number') { + if (opts.delay === 0) { + this._state.pastDelay = true; + } else { + this._delay = setTimeout(()=>{ + this._update({ + pastDelay: true + }); + }, opts.delay); + } + } + if (typeof opts.timeout === 'number') { + this._timeout = setTimeout(()=>{ + this._update({ + timedOut: true + }); + }, opts.timeout); + } + } + this._res.promise.then(()=>{ + this._update({}); + this._clearTimeouts(); + }).catch((_err)=>{ + this._update({}); + this._clearTimeouts(); + }); + this._update({}); + } + _update(partial) { + this._state = { + ...this._state, + error: this._res.error, + loaded: this._res.loaded, + loading: this._res.loading, + ...partial + }; + this._callbacks.forEach((callback)=>callback()); + } + _clearTimeouts() { + clearTimeout(this._delay); + clearTimeout(this._timeout); + } + getCurrentValue() { + return this._state; + } + subscribe(callback) { + this._callbacks.add(callback); + return ()=>{ + this._callbacks.delete(callback); + }; + } +} +function Loadable(opts) { + return createLoadableComponent(load, opts); +} +function flushInitializers(initializers, ids) { + let promises = []; + while(initializers.length){ + let init = initializers.pop(); + promises.push(init(ids)); + } + return Promise.all(promises).then(()=>{ + if (initializers.length) { + return flushInitializers(initializers, ids); + } + }); +} +Loadable.preloadAll = ()=>{ + return new Promise((resolveInitializers, reject)=>{ + flushInitializers(ALL_INITIALIZERS).then(resolveInitializers, reject); + }); +}; +Loadable.preloadReady = (ids = [])=>{ + return new Promise((resolvePreload)=>{ + const res = ()=>{ + initialized = true; + return resolvePreload(); + }; + // We always will resolve, errors should be handled within loading UIs. + flushInitializers(READY_INITIALIZERS, ids).then(res, res); + }); +}; +if (typeof window !== 'undefined') { + window.__NEXT_PRELOADREADY = Loadable.preloadReady; +} +export default Loadable; + +//# sourceMappingURL=loadable.shared-runtime.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/loadable.shared-runtime.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/loadable.shared-runtime.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b70c962822560466ea1e6f8aafa2856804b63f61 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/loadable.shared-runtime.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/loadable.shared-runtime.tsx"],"sourcesContent":["// TODO: Remove use of `any` type.\n/**\n@copyright (c) 2017-present James Kyle <me@thejameskyle.com>\n MIT License\n Permission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n The above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE\n*/\n// https://github.com/jamiebuilds/react-loadable/blob/v5.5.0/src/index.js\n// Modified to be compatible with webpack 4 / Next.js\n\nimport React from 'react'\nimport { LoadableContext } from './loadable-context.shared-runtime'\n\nfunction resolve(obj: any) {\n return obj && obj.default ? obj.default : obj\n}\n\nconst ALL_INITIALIZERS: any[] = []\nconst READY_INITIALIZERS: any[] = []\nlet initialized = false\n\nfunction load(loader: any) {\n let promise = loader()\n\n let state: any = {\n loading: true,\n loaded: null,\n error: null,\n }\n\n state.promise = promise\n .then((loaded: any) => {\n state.loading = false\n state.loaded = loaded\n return loaded\n })\n .catch((err: any) => {\n state.loading = false\n state.error = err\n throw err\n })\n\n return state\n}\n\nfunction createLoadableComponent(loadFn: any, options: any) {\n let opts = Object.assign(\n {\n loader: null,\n loading: null,\n delay: 200,\n timeout: null,\n webpack: null,\n modules: null,\n },\n options\n )\n\n /** @type LoadableSubscription */\n let subscription: any = null\n function init() {\n if (!subscription) {\n const sub = new LoadableSubscription(loadFn, opts)\n subscription = {\n getCurrentValue: sub.getCurrentValue.bind(sub),\n subscribe: sub.subscribe.bind(sub),\n retry: sub.retry.bind(sub),\n promise: sub.promise.bind(sub),\n }\n }\n return subscription.promise()\n }\n\n // Server only\n if (typeof window === 'undefined') {\n ALL_INITIALIZERS.push(init)\n }\n\n // Client only\n if (!initialized && typeof window !== 'undefined') {\n // require.resolveWeak check is needed for environments that don't have it available like Jest\n const moduleIds =\n opts.webpack && typeof (require as any).resolveWeak === 'function'\n ? opts.webpack()\n : opts.modules\n if (moduleIds) {\n READY_INITIALIZERS.push((ids: any) => {\n for (const moduleId of moduleIds) {\n if (ids.includes(moduleId)) {\n return init()\n }\n }\n })\n }\n }\n\n function useLoadableModule() {\n init()\n\n const context = React.useContext(LoadableContext)\n if (context && Array.isArray(opts.modules)) {\n opts.modules.forEach((moduleName: any) => {\n context(moduleName)\n })\n }\n }\n\n function LoadableComponent(props: any, ref: any) {\n useLoadableModule()\n\n const state = (React as any).useSyncExternalStore(\n subscription.subscribe,\n subscription.getCurrentValue,\n subscription.getCurrentValue\n )\n\n React.useImperativeHandle(\n ref,\n () => ({\n retry: subscription.retry,\n }),\n []\n )\n\n return React.useMemo(() => {\n if (state.loading || state.error) {\n return React.createElement(opts.loading, {\n isLoading: state.loading,\n pastDelay: state.pastDelay,\n timedOut: state.timedOut,\n error: state.error,\n retry: subscription.retry,\n })\n } else if (state.loaded) {\n return React.createElement(resolve(state.loaded), props)\n } else {\n return null\n }\n }, [props, state])\n }\n\n LoadableComponent.preload = () => init()\n LoadableComponent.displayName = 'LoadableComponent'\n\n return React.forwardRef(LoadableComponent)\n}\n\nclass LoadableSubscription {\n _loadFn: any\n _opts: any\n _callbacks: any\n _delay: any\n _timeout: any\n _res: any\n _state: any\n constructor(loadFn: any, opts: any) {\n this._loadFn = loadFn\n this._opts = opts\n this._callbacks = new Set()\n this._delay = null\n this._timeout = null\n\n this.retry()\n }\n\n promise() {\n return this._res.promise\n }\n\n retry() {\n this._clearTimeouts()\n this._res = this._loadFn(this._opts.loader)\n\n this._state = {\n pastDelay: false,\n timedOut: false,\n }\n\n const { _res: res, _opts: opts } = this\n\n if (res.loading) {\n if (typeof opts.delay === 'number') {\n if (opts.delay === 0) {\n this._state.pastDelay = true\n } else {\n this._delay = setTimeout(() => {\n this._update({\n pastDelay: true,\n })\n }, opts.delay)\n }\n }\n\n if (typeof opts.timeout === 'number') {\n this._timeout = setTimeout(() => {\n this._update({ timedOut: true })\n }, opts.timeout)\n }\n }\n\n this._res.promise\n .then(() => {\n this._update({})\n this._clearTimeouts()\n })\n .catch((_err: any) => {\n this._update({})\n this._clearTimeouts()\n })\n this._update({})\n }\n\n _update(partial: any) {\n this._state = {\n ...this._state,\n error: this._res.error,\n loaded: this._res.loaded,\n loading: this._res.loading,\n ...partial,\n }\n this._callbacks.forEach((callback: any) => callback())\n }\n\n _clearTimeouts() {\n clearTimeout(this._delay)\n clearTimeout(this._timeout)\n }\n\n getCurrentValue() {\n return this._state\n }\n\n subscribe(callback: any) {\n this._callbacks.add(callback)\n return () => {\n this._callbacks.delete(callback)\n }\n }\n}\n\nfunction Loadable(opts: any) {\n return createLoadableComponent(load, opts)\n}\n\nfunction flushInitializers(initializers: any, ids?: any): any {\n let promises = []\n\n while (initializers.length) {\n let init = initializers.pop()\n promises.push(init(ids))\n }\n\n return Promise.all(promises).then(() => {\n if (initializers.length) {\n return flushInitializers(initializers, ids)\n }\n })\n}\n\nLoadable.preloadAll = () => {\n return new Promise((resolveInitializers, reject) => {\n flushInitializers(ALL_INITIALIZERS).then(resolveInitializers, reject)\n })\n}\n\nLoadable.preloadReady = (ids: (string | number)[] = []): Promise<void> => {\n return new Promise<void>((resolvePreload) => {\n const res = () => {\n initialized = true\n return resolvePreload()\n }\n // We always will resolve, errors should be handled within loading UIs.\n flushInitializers(READY_INITIALIZERS, ids).then(res, res)\n })\n}\n\ndeclare global {\n interface Window {\n __NEXT_PRELOADREADY?: (ids?: (string | number)[]) => Promise<void>\n }\n}\n\nif (typeof window !== 'undefined') {\n window.__NEXT_PRELOADREADY = Loadable.preloadReady\n}\n\nexport default Loadable\n"],"names":["React","LoadableContext","resolve","obj","default","ALL_INITIALIZERS","READY_INITIALIZERS","initialized","load","loader","promise","state","loading","loaded","error","then","catch","err","createLoadableComponent","loadFn","options","opts","Object","assign","delay","timeout","webpack","modules","subscription","init","sub","LoadableSubscription","getCurrentValue","bind","subscribe","retry","window","push","moduleIds","require","resolveWeak","ids","moduleId","includes","useLoadableModule","context","useContext","Array","isArray","forEach","moduleName","LoadableComponent","props","ref","useSyncExternalStore","useImperativeHandle","useMemo","createElement","isLoading","pastDelay","timedOut","preload","displayName","forwardRef","constructor","_loadFn","_opts","_callbacks","Set","_delay","_timeout","_res","_clearTimeouts","_state","res","setTimeout","_update","_err","partial","callback","clearTimeout","add","delete","Loadable","flushInitializers","initializers","promises","length","pop","Promise","all","preloadAll","resolveInitializers","reject","preloadReady","resolvePreload","__NEXT_PRELOADREADY"],"mappings":"AAAA,kCAAkC;AAClC;;;;;;;;;;;;;;;;;;;AAmBA,GACA,yEAAyE;AACzE,qDAAqD;AAErD,OAAOA,WAAW,QAAO;AACzB,SAASC,eAAe,QAAQ,oCAAmC;AAEnE,SAASC,QAAQC,GAAQ;IACvB,OAAOA,OAAOA,IAAIC,OAAO,GAAGD,IAAIC,OAAO,GAAGD;AAC5C;AAEA,MAAME,mBAA0B,EAAE;AAClC,MAAMC,qBAA4B,EAAE;AACpC,IAAIC,cAAc;AAElB,SAASC,KAAKC,MAAW;IACvB,IAAIC,UAAUD;IAEd,IAAIE,QAAa;QACfC,SAAS;QACTC,QAAQ;QACRC,OAAO;IACT;IAEAH,MAAMD,OAAO,GAAGA,QACbK,IAAI,CAAC,CAACF;QACLF,MAAMC,OAAO,GAAG;QAChBD,MAAME,MAAM,GAAGA;QACf,OAAOA;IACT,GACCG,KAAK,CAAC,CAACC;QACNN,MAAMC,OAAO,GAAG;QAChBD,MAAMG,KAAK,GAAGG;QACd,MAAMA;IACR;IAEF,OAAON;AACT;AAEA,SAASO,wBAAwBC,MAAW,EAAEC,OAAY;IACxD,IAAIC,OAAOC,OAAOC,MAAM,CACtB;QACEd,QAAQ;QACRG,SAAS;QACTY,OAAO;QACPC,SAAS;QACTC,SAAS;QACTC,SAAS;IACX,GACAP;IAGF,+BAA+B,GAC/B,IAAIQ,eAAoB;IACxB,SAASC;QACP,IAAI,CAACD,cAAc;YACjB,MAAME,MAAM,IAAIC,qBAAqBZ,QAAQE;YAC7CO,eAAe;gBACbI,iBAAiBF,IAAIE,eAAe,CAACC,IAAI,CAACH;gBAC1CI,WAAWJ,IAAII,SAAS,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5C,GAAS;IACrD,IAAI6C,WAAW,EAAE;IAEjB,MAAOD,aAAaE,MAAM,CAAE;QAC1B,IAAI1D,OAAOwD,aAAaG,GAAG;QAC3BF,SAASjD,IAAI,CAACR,KAAKY;IACrB;IAEA,OAAOgD,QAAQC,GAAG,CAACJ,UAAUvE,IAAI,CAAC;QAChC,IAAIsE,aAAaE,MAAM,EAAE;YACvB,OAAOH,kBAAkBC,cAAc5C;QACzC;IACF;AACF;AAEA0C,SAASQ,UAAU,GAAG;IACpB,OAAO,IAAIF,QAAQ,CAACG,qBAAqBC;QACvCT,kBAAkB/E,kBAAkBU,IAAI,CAAC6E,qBAAqBC;IAChE;AACF;AAEAV,SAASW,YAAY,GAAG,CAACrD,MAA2B,EAAE;IACpD,OAAO,IAAIgD,QAAc,CAACM;QACxB,MAAMrB,MAAM;YACVnE,cAAc;YACd,OAAOwF;QACT;QACA,uEAAuE;QACvEX,kBAAkB9E,oBAAoBmC,KAAK1B,IAAI,CAAC2D,KAAKA;IACvD;AACF;AAQA,IAAI,OAAOtC,WAAW,aAAa;IACjCA,OAAO4D,mBAAmB,GAAGb,SAASW,YAAY;AACpD;AAEA,eAAeX,SAAQ","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/magic-identifier.js b/e-commerce/node_modules/next/dist/esm/shared/lib/magic-identifier.js new file mode 100644 index 0000000000000000000000000000000000000000..3ccd57d7a38371f5cc12b302bdca63cdde4aef86 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/magic-identifier.js @@ -0,0 +1,179 @@ +function decodeHex(hexStr) { + if (hexStr.trim() === '') { + throw new Error("can't decode empty hex"); + } + const num = parseInt(hexStr, 16); + if (isNaN(num)) { + throw new Error(`invalid hex: \`${hexStr}\``); + } + return String.fromCodePoint(num); +} +const DECODE_REGEX = /^__TURBOPACK__([a-zA-Z0-9_$]+)__$/; +export function decodeMagicIdentifier(identifier) { + const matches = identifier.match(DECODE_REGEX); + if (!matches) { + return identifier; + } + const inner = matches[1]; + let output = ''; + let mode = 0; + let buffer = ''; + for(let i = 0; i < inner.length; i++){ + const char = inner[i]; + if (mode === 0) { + if (char === '_') { + mode = 1; + } else if (char === '$') { + mode = 2; + } else { + output += char; + } + } else if (mode === 1) { + if (char === '_') { + output += ' '; + mode = 0; + } else if (char === '$') { + output += '_'; + mode = 2; + } else { + output += char; + mode = 0; + } + } else if (mode === 2) { + if (buffer.length === 2) { + output += decodeHex(buffer); + buffer = ''; + } + if (char === '_') { + if (buffer !== '') { + throw new Error(`invalid hex: \`${buffer}\``); + } + mode = 3; + } else if (char === '$') { + if (buffer !== '') { + throw new Error(`invalid hex: \`${buffer}\``); + } + mode = 0; + } else { + buffer += char; + } + } else if (mode === 3) { + if (char === '_') { + throw new Error(`invalid hex: \`${buffer + char}\``); + } else if (char === '$') { + output += decodeHex(buffer); + buffer = ''; + mode = 0; + } else { + buffer += char; + } + } + } + return output; +} +export const MAGIC_IDENTIFIER_REGEX = /__TURBOPACK__[a-zA-Z0-9_$]+__/g; +/** + * Cleans up module IDs by removing implementation details. + * - Replaces [project] with . + * - Removes content in brackets [], parentheses (), and angle brackets <> + */ export function deobfuscateModuleId(moduleId) { + return moduleId// Replace [project] with . + .replace(/\[project\]/g, '.')// Remove content in square brackets (e.g. [app-rsc]) + .replace(/\s\[([^\]]*)\]/g, '')// Remove content in parentheses (e.g. (ecmascript)) + .replace(/\s\(([^)]*)\)/g, '')// Remove content in angle brackets (e.g. <locals>) + .replace(/\s<([^>]*)>/g, '')// Clean up any extra whitespace + .trim(); +} +/** + * Removes the free call wrapper pattern (0, expr) from expressions. + * This is a JavaScript pattern to call a function without binding 'this', + * but it's noise for developers reading error messages. + */ export function removeFreeCallWrapper(text) { + // Match (0, <ident>.<ident>) patterns anywhere in the text the beginning + // Overzealous: accept any non-whitespace member expression after the dot. + // TODO: Fix https://linear.app/vercel/issue/NEXT-4875 to allow using unicode property escapes + return text.replace(/\(0\s*,\s*(__TURBOPACK__[a-zA-Z0-9_$]+__\.[^\s)]+)\)/g, '$1'); +} +/** + * Deobfuscates text and returns an array of discriminated parts. + * Each part is a tuple of [type, string] where type is either 'raw' (unchanged text) + * or 'deobfuscated' (a magic identifier that was decoded). + * + * This is useful when you need to process or display deobfuscated and raw text differently. + */ export function deobfuscateTextParts(text) { + // First, remove free call wrappers + const withoutFreeCall = removeFreeCallWrapper(text); + const parts = []; + let lastIndex = 0; + // Create a new regex instance for global matching + const regex = new RegExp(MAGIC_IDENTIFIER_REGEX.source, 'g'); + for(let match = regex.exec(withoutFreeCall); match !== null; match = regex.exec(withoutFreeCall)){ + const matchStart = match.index; + const matchEnd = regex.lastIndex; + const ident = match[0]; + // Add raw text before this match (if any) + if (matchStart > lastIndex) { + const rawText = withoutFreeCall.substring(lastIndex, matchStart); + parts.push([ + 'raw', + rawText + ]); + } + // Process and add the deobfuscated part + try { + const decoded = decodeMagicIdentifier(ident); + // If it was a magic identifier, clean up the module ID + if (decoded !== ident) { + // Check if this is an "imported module" reference + const importedModuleMatch = decoded.match(/^imported module (.+)$/); + if (importedModuleMatch) { + // Clean the entire module path (which includes [app-rsc], etc.) + const modulePathWithMetadata = importedModuleMatch[1]; + const cleaned = deobfuscateModuleId(modulePathWithMetadata); + parts.push([ + 'deobfuscated', + `{imported module ${cleaned}}` + ]); + } else { + const cleaned = deobfuscateModuleId(decoded); + parts.push([ + 'deobfuscated', + `{${cleaned}}` + ]); + } + } else { + // Not actually a magic identifier, treat as raw + parts.push([ + 'raw', + ident + ]); + } + } catch (e) { + parts.push([ + 'deobfuscated', + `{${ident} (decoding failed: ${e})}` + ]); + } + lastIndex = matchEnd; + } + // Add any remaining raw text after the last match + if (lastIndex < withoutFreeCall.length) { + const rawText = withoutFreeCall.substring(lastIndex); + parts.push([ + 'raw', + rawText + ]); + } + return parts; +} +/** + * Deobfuscates text by: + * 1. Decoding magic identifiers + * 2. Cleaning up module IDs + * 3. Removing free call wrappers + */ export function deobfuscateText(text) { + const parts = deobfuscateTextParts(text); + return parts.map((part)=>part[1]).join(''); +} + +//# sourceMappingURL=magic-identifier.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/magic-identifier.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/magic-identifier.js.map new file mode 100644 index 0000000000000000000000000000000000000000..2d4c358ccd2bebe2af293d36354d9470b3dbbdca --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/magic-identifier.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/magic-identifier.ts"],"sourcesContent":["function decodeHex(hexStr: string): string {\n if (hexStr.trim() === '') {\n throw new Error(\"can't decode empty hex\")\n }\n\n const num = parseInt(hexStr, 16)\n if (isNaN(num)) {\n throw new Error(`invalid hex: \\`${hexStr}\\``)\n }\n\n return String.fromCodePoint(num)\n}\n\nconst enum Mode {\n Text,\n Underscore,\n Hex,\n LongHex,\n}\n\nconst DECODE_REGEX = /^__TURBOPACK__([a-zA-Z0-9_$]+)__$/\n\nexport function decodeMagicIdentifier(identifier: string): string {\n const matches = identifier.match(DECODE_REGEX)\n if (!matches) {\n return identifier\n }\n\n const inner = matches[1]\n\n let output = ''\n\n let mode: Mode = Mode.Text\n let buffer = ''\n for (let i = 0; i < inner.length; i++) {\n const char = inner[i]\n\n if (mode === Mode.Text) {\n if (char === '_') {\n mode = Mode.Underscore\n } else if (char === '$') {\n mode = Mode.Hex\n } else {\n output += char\n }\n } else if (mode === Mode.Underscore) {\n if (char === '_') {\n output += ' '\n mode = Mode.Text\n } else if (char === '$') {\n output += '_'\n mode = Mode.Hex\n } else {\n output += char\n mode = Mode.Text\n }\n } else if (mode === Mode.Hex) {\n if (buffer.length === 2) {\n output += decodeHex(buffer)\n buffer = ''\n }\n\n if (char === '_') {\n if (buffer !== '') {\n throw new Error(`invalid hex: \\`${buffer}\\``)\n }\n\n mode = Mode.LongHex\n } else if (char === '$') {\n if (buffer !== '') {\n throw new Error(`invalid hex: \\`${buffer}\\``)\n }\n\n mode = Mode.Text\n } else {\n buffer += char\n }\n } else if (mode === Mode.LongHex) {\n if (char === '_') {\n throw new Error(`invalid hex: \\`${buffer + char}\\``)\n } else if (char === '$') {\n output += decodeHex(buffer)\n buffer = ''\n\n mode = Mode.Text\n } else {\n buffer += char\n }\n }\n }\n\n return output\n}\n\nexport const MAGIC_IDENTIFIER_REGEX = /__TURBOPACK__[a-zA-Z0-9_$]+__/g\n\n/**\n * Cleans up module IDs by removing implementation details.\n * - Replaces [project] with .\n * - Removes content in brackets [], parentheses (), and angle brackets <>\n */\nexport function deobfuscateModuleId(moduleId: string): string {\n return (\n moduleId\n // Replace [project] with .\n .replace(/\\[project\\]/g, '.')\n // Remove content in square brackets (e.g. [app-rsc])\n .replace(/\\s\\[([^\\]]*)\\]/g, '')\n // Remove content in parentheses (e.g. (ecmascript))\n .replace(/\\s\\(([^)]*)\\)/g, '')\n // Remove content in angle brackets (e.g. <locals>)\n .replace(/\\s<([^>]*)>/g, '')\n // Clean up any extra whitespace\n .trim()\n )\n}\n\n/**\n * Removes the free call wrapper pattern (0, expr) from expressions.\n * This is a JavaScript pattern to call a function without binding 'this',\n * but it's noise for developers reading error messages.\n */\nexport function removeFreeCallWrapper(text: string): string {\n // Match (0, <ident>.<ident>) patterns anywhere in the text the beginning\n // Overzealous: accept any non-whitespace member expression after the dot.\n // TODO: Fix https://linear.app/vercel/issue/NEXT-4875 to allow using unicode property escapes\n return text.replace(\n /\\(0\\s*,\\s*(__TURBOPACK__[a-zA-Z0-9_$]+__\\.[^\\s)]+)\\)/g,\n '$1'\n )\n}\n\nexport type TextPartType = 'raw' | 'deobfuscated'\n\n/**\n * Deobfuscates text and returns an array of discriminated parts.\n * Each part is a tuple of [type, string] where type is either 'raw' (unchanged text)\n * or 'deobfuscated' (a magic identifier that was decoded).\n *\n * This is useful when you need to process or display deobfuscated and raw text differently.\n */\nexport function deobfuscateTextParts(\n text: string\n): Array<[TextPartType, string]> {\n // First, remove free call wrappers\n const withoutFreeCall = removeFreeCallWrapper(text)\n\n const parts: Array<[TextPartType, string]> = []\n let lastIndex = 0\n\n // Create a new regex instance for global matching\n const regex = new RegExp(MAGIC_IDENTIFIER_REGEX.source, 'g')\n\n for (\n let match = regex.exec(withoutFreeCall);\n match !== null;\n match = regex.exec(withoutFreeCall)\n ) {\n const matchStart = match.index\n const matchEnd = regex.lastIndex\n const ident = match[0]\n\n // Add raw text before this match (if any)\n if (matchStart > lastIndex) {\n const rawText = withoutFreeCall.substring(lastIndex, matchStart)\n parts.push(['raw', rawText])\n }\n\n // Process and add the deobfuscated part\n try {\n const decoded = decodeMagicIdentifier(ident)\n // If it was a magic identifier, clean up the module ID\n if (decoded !== ident) {\n // Check if this is an \"imported module\" reference\n const importedModuleMatch = decoded.match(/^imported module (.+)$/)\n if (importedModuleMatch) {\n // Clean the entire module path (which includes [app-rsc], etc.)\n const modulePathWithMetadata = importedModuleMatch[1]\n const cleaned = deobfuscateModuleId(modulePathWithMetadata)\n parts.push(['deobfuscated', `{imported module ${cleaned}}`])\n } else {\n const cleaned = deobfuscateModuleId(decoded)\n parts.push(['deobfuscated', `{${cleaned}}`])\n }\n } else {\n // Not actually a magic identifier, treat as raw\n parts.push(['raw', ident])\n }\n } catch (e) {\n parts.push(['deobfuscated', `{${ident} (decoding failed: ${e})}`])\n }\n\n lastIndex = matchEnd\n }\n\n // Add any remaining raw text after the last match\n if (lastIndex < withoutFreeCall.length) {\n const rawText = withoutFreeCall.substring(lastIndex)\n parts.push(['raw', rawText])\n }\n\n return parts\n}\n\n/**\n * Deobfuscates text by:\n * 1. Decoding magic identifiers\n * 2. Cleaning up module IDs\n * 3. Removing free call wrappers\n */\nexport function deobfuscateText(text: string): string {\n const parts = deobfuscateTextParts(text)\n return parts.map((part) => part[1]).join('')\n}\n"],"names":["decodeHex","hexStr","trim","Error","num","parseInt","isNaN","String","fromCodePoint","DECODE_REGEX","decodeMagicIdentifier","identifier","matches","match","inner","output","mode","buffer","i","length","char","MAGIC_IDENTIFIER_REGEX","deobfuscateModuleId","moduleId","replace","removeFreeCallWrapper","text","deobfuscateTextParts","withoutFreeCall","parts","lastIndex","regex","RegExp","source","exec","matchStart","index","matchEnd","ident","rawText","substring","push","decoded","importedModuleMatch","modulePathWithMetadata","cleaned","e","deobfuscateText","map","part","join"],"mappings":"AAAA,SAASA,UAAUC,MAAc;IAC/B,IAAIA,OAAOC,IAAI,OAAO,IAAI;QACxB,MAAM,IAAIC,MAAM;IAClB;IAEA,MAAMC,MAAMC,SAASJ,QAAQ;IAC7B,IAAIK,MAAMF,MAAM;QACd,MAAM,IAAID,MAAM,CAAC,eAAe,EAAEF,OAAO,EAAE,CAAC;IAC9C;IAEA,OAAOM,OAAOC,aAAa,CAACJ;AAC9B;AASA,MAAMK,eAAe;AAErB,OAAO,SAASC,sBAAsBC,UAAkB;IACtD,MAAMC,UAAUD,WAAWE,KAAK,CAACJ;IACjC,IAAI,CAACG,SAAS;QACZ,OAAOD;IACT;IAEA,MAAMG,QAAQF,OAAO,CAAC,EAAE;IAExB,IAAIG,SAAS;IAEb,IAAIC;IACJ,IAAIC,SAAS;IACb,IAAK,IAAIC,IAAI,GAAGA,IAAIJ,MAAMK,MAAM,EAAED,IAAK;QACrC,MAAME,OAAON,KAAK,CAACI,EAAE;QAErB,IAAIF,YAAoB;YACtB,IAAII,SAAS,KAAK;gBAChBJ;YACF,OAAO,IAAII,SAAS,KAAK;gBACvBJ;YACF,OAAO;gBACLD,UAAUK;YACZ;QACF,OAAO,IAAIJ,YAA0B;YACnC,IAAII,SAAS,KAAK;gBAChBL,UAAU;gBACVC;YACF,OAAO,IAAII,SAAS,KAAK;gBACvBL,UAAU;gBACVC;YACF,OAAO;gBACLD,UAAUK;gBACVJ;YACF;QACF,OAAO,IAAIA,YAAmB;YAC5B,IAAIC,OAAOE,MAAM,KAAK,GAAG;gBACvBJ,UAAUf,UAAUiB;gBACpBA,SAAS;YACX;YAEA,IAAIG,SAAS,KAAK;gBAChB,IAAIH,WAAW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T;AAEA;;;;;CAKC,GACD,OAAO,SAASkB,gBAAgBrB,IAAY;IAC1C,MAAMG,QAAQF,qBAAqBD;IACnC,OAAOG,MAAMmB,GAAG,CAAC,CAACC,OAASA,IAAI,CAAC,EAAE,EAAEC,IAAI,CAAC;AAC3C","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/match-local-pattern.js b/e-commerce/node_modules/next/dist/esm/shared/lib/match-local-pattern.js new file mode 100644 index 0000000000000000000000000000000000000000..3b6e95f92e69db8f1eafb7bb3cbbc8560aaf3ffc --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/match-local-pattern.js @@ -0,0 +1,25 @@ +import { makeRe } from 'next/dist/compiled/picomatch'; +// Modifying this function should also modify writeImagesManifest() +export function matchLocalPattern(pattern, url) { + if (pattern.search !== undefined) { + if (pattern.search !== url.search) { + return false; + } + } + if (!makeRe(pattern.pathname ?? '**', { + dot: true + }).test(url.pathname)) { + return false; + } + return true; +} +export function hasLocalMatch(localPatterns, urlPathAndQuery) { + if (!localPatterns) { + // if the user didn't define "localPatterns", we allow all local images + return true; + } + const url = new URL(urlPathAndQuery, 'http://n'); + return localPatterns.some((p)=>matchLocalPattern(p, url)); +} + +//# sourceMappingURL=match-local-pattern.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/match-local-pattern.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/match-local-pattern.js.map new file mode 100644 index 0000000000000000000000000000000000000000..9983541effcf959cffacecd45144a806dbc2bef2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/match-local-pattern.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/match-local-pattern.ts"],"sourcesContent":["import type { LocalPattern } from './image-config'\nimport { makeRe } from 'next/dist/compiled/picomatch'\n\n// Modifying this function should also modify writeImagesManifest()\nexport function matchLocalPattern(pattern: LocalPattern, url: URL): boolean {\n if (pattern.search !== undefined) {\n if (pattern.search !== url.search) {\n return false\n }\n }\n\n if (!makeRe(pattern.pathname ?? '**', { dot: true }).test(url.pathname)) {\n return false\n }\n\n return true\n}\n\nexport function hasLocalMatch(\n localPatterns: LocalPattern[] | undefined,\n urlPathAndQuery: string\n): boolean {\n if (!localPatterns) {\n // if the user didn't define \"localPatterns\", we allow all local images\n return true\n }\n const url = new URL(urlPathAndQuery, 'http://n')\n return localPatterns.some((p) => matchLocalPattern(p, url))\n}\n"],"names":["makeRe","matchLocalPattern","pattern","url","search","undefined","pathname","dot","test","hasLocalMatch","localPatterns","urlPathAndQuery","URL","some","p"],"mappings":"AACA,SAASA,MAAM,QAAQ,+BAA8B;AAErD,mEAAmE;AACnE,OAAO,SAASC,kBAAkBC,OAAqB,EAAEC,GAAQ;IAC/D,IAAID,QAAQE,MAAM,KAAKC,WAAW;QAChC,IAAIH,QAAQE,MAAM,KAAKD,IAAIC,MAAM,EAAE;YACjC,OAAO;QACT;IACF;IAEA,IAAI,CAACJ,OAAOE,QAAQI,QAAQ,IAAI,MAAM;QAAEC,KAAK;IAAK,GAAGC,IAAI,CAACL,IAAIG,QAAQ,GAAG;QACvE,OAAO;IACT;IAEA,OAAO;AACT;AAEA,OAAO,SAASG,cACdC,aAAyC,EACzCC,eAAuB;IAEvB,IAAI,CAACD,eAAe;QAClB,uEAAuE;QACvE,OAAO;IACT;IACA,MAAMP,MAAM,IAAIS,IAAID,iBAAiB;IACrC,OAAOD,cAAcG,IAAI,CAAC,CAACC,IAAMb,kBAAkBa,GAAGX;AACxD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/match-remote-pattern.js b/e-commerce/node_modules/next/dist/esm/shared/lib/match-remote-pattern.js new file mode 100644 index 0000000000000000000000000000000000000000..dab85b5e80db12d2db4c40e6ce1731232e81afa1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/match-remote-pattern.js @@ -0,0 +1,38 @@ +import { makeRe } from 'next/dist/compiled/picomatch'; +// Modifying this function should also modify writeImagesManifest() +export function matchRemotePattern(pattern, url) { + if (pattern.protocol !== undefined) { + if (pattern.protocol.replace(/:$/, '') !== url.protocol.replace(/:$/, '')) { + return false; + } + } + if (pattern.port !== undefined) { + if (pattern.port !== url.port) { + return false; + } + } + if (pattern.hostname === undefined) { + throw new Error(`Pattern should define hostname but found\n${JSON.stringify(pattern)}`); + } else { + if (!makeRe(pattern.hostname).test(url.hostname)) { + return false; + } + } + if (pattern.search !== undefined) { + if (pattern.search !== url.search) { + return false; + } + } + // Should be the same as writeImagesManifest() + if (!makeRe(pattern.pathname ?? '**', { + dot: true + }).test(url.pathname)) { + return false; + } + return true; +} +export function hasRemoteMatch(domains, remotePatterns, url) { + return domains.some((domain)=>url.hostname === domain) || remotePatterns.some((p)=>matchRemotePattern(p, url)); +} + +//# sourceMappingURL=match-remote-pattern.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/match-remote-pattern.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/match-remote-pattern.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b82b97db45762cc11f0c08ede5a16cf736852109 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/match-remote-pattern.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/match-remote-pattern.ts"],"sourcesContent":["import type { RemotePattern } from './image-config'\nimport { makeRe } from 'next/dist/compiled/picomatch'\n\n// Modifying this function should also modify writeImagesManifest()\nexport function matchRemotePattern(\n pattern: RemotePattern | URL,\n url: URL\n): boolean {\n if (pattern.protocol !== undefined) {\n if (pattern.protocol.replace(/:$/, '') !== url.protocol.replace(/:$/, '')) {\n return false\n }\n }\n if (pattern.port !== undefined) {\n if (pattern.port !== url.port) {\n return false\n }\n }\n\n if (pattern.hostname === undefined) {\n throw new Error(\n `Pattern should define hostname but found\\n${JSON.stringify(pattern)}`\n )\n } else {\n if (!makeRe(pattern.hostname).test(url.hostname)) {\n return false\n }\n }\n\n if (pattern.search !== undefined) {\n if (pattern.search !== url.search) {\n return false\n }\n }\n\n // Should be the same as writeImagesManifest()\n if (!makeRe(pattern.pathname ?? '**', { dot: true }).test(url.pathname)) {\n return false\n }\n\n return true\n}\n\nexport function hasRemoteMatch(\n domains: string[],\n remotePatterns: Array<RemotePattern | URL>,\n url: URL\n): boolean {\n return (\n domains.some((domain) => url.hostname === domain) ||\n remotePatterns.some((p) => matchRemotePattern(p, url))\n )\n}\n"],"names":["makeRe","matchRemotePattern","pattern","url","protocol","undefined","replace","port","hostname","Error","JSON","stringify","test","search","pathname","dot","hasRemoteMatch","domains","remotePatterns","some","domain","p"],"mappings":"AACA,SAASA,MAAM,QAAQ,+BAA8B;AAErD,mEAAmE;AACnE,OAAO,SAASC,mBACdC,OAA4B,EAC5BC,GAAQ;IAER,IAAID,QAAQE,QAAQ,KAAKC,WAAW;QAClC,IAAIH,QAAQE,QAAQ,CAACE,OAAO,CAAC,MAAM,QAAQH,IAAIC,QAAQ,CAACE,OAAO,CAAC,MAAM,KAAK;YACzE,OAAO;QACT;IACF;IACA,IAAIJ,QAAQK,IAAI,KAAKF,WAAW;QAC9B,IAAIH,QAAQK,IAAI,KAAKJ,IAAII,IAAI,EAAE;YAC7B,OAAO;QACT;IACF;IAEA,IAAIL,QAAQM,QAAQ,KAAKH,WAAW;QAClC,MAAM,IAAII,MACR,CAAC,0CAA0C,EAAEC,KAAKC,SAAS,CAACT,UAAU;IAE1E,OAAO;QACL,IAAI,CAACF,OAAOE,QAAQM,QAAQ,EAAEI,IAAI,CAACT,IAAIK,QAAQ,GAAG;YAChD,OAAO;QACT;IACF;IAEA,IAAIN,QAAQW,MAAM,KAAKR,WAAW;QAChC,IAAIH,QAAQW,MAAM,KAAKV,IAAIU,MAAM,EAAE;YACjC,OAAO;QACT;IACF;IAEA,8CAA8C;IAC9C,IAAI,CAACb,OAAOE,QAAQY,QAAQ,IAAI,MAAM;QAAEC,KAAK;IAAK,GAAGH,IAAI,CAACT,IAAIW,QAAQ,GAAG;QACvE,OAAO;IACT;IAEA,OAAO;AACT;AAEA,OAAO,SAASE,eACdC,OAAiB,EACjBC,cAA0C,EAC1Cf,GAAQ;IAER,OACEc,QAAQE,IAAI,CAAC,CAACC,SAAWjB,IAAIK,QAAQ,KAAKY,WAC1CF,eAAeC,IAAI,CAAC,CAACE,IAAMpB,mBAAmBoB,GAAGlB;AAErD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/mcp-error-types.js b/e-commerce/node_modules/next/dist/esm/shared/lib/mcp-error-types.js new file mode 100644 index 0000000000000000000000000000000000000000..d6fc513aa828f57d845e98b100c0edb628b2618d --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/mcp-error-types.js @@ -0,0 +1,3 @@ +export { }; + +//# sourceMappingURL=mcp-error-types.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/mcp-error-types.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/mcp-error-types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b2335dcb75e86a5d5bab35602a14790e9418a1bc --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/mcp-error-types.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/mcp-error-types.ts"],"sourcesContent":["import type { OverlayState } from '../../next-devtools/dev-overlay/shared'\n\nexport interface OverlayStateWithUrl {\n url: string\n errorState: OverlayState | null\n}\n\nexport interface McpErrorStateResponse {\n event: string\n requestId: string\n errorState: OverlayState | null\n url: string\n}\n"],"names":[],"mappings":"AAOA,WAKC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/mcp-page-metadata-types.js b/e-commerce/node_modules/next/dist/esm/shared/lib/mcp-page-metadata-types.js new file mode 100644 index 0000000000000000000000000000000000000000..9ab25f006092f57ad32e110e532f1f7d4a6f0cb4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/mcp-page-metadata-types.js @@ -0,0 +1,3 @@ +export { }; + +//# sourceMappingURL=mcp-page-metadata-types.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/mcp-page-metadata-types.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/mcp-page-metadata-types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d9a870baa7a17294dd04a964da7f615d0c4d254c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/mcp-page-metadata-types.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/mcp-page-metadata-types.ts"],"sourcesContent":["import type { SegmentTrieNode } from '../../next-devtools/dev-overlay/segment-explorer-trie'\n\nexport type SegmentTrieData = {\n segmentTrie: SegmentTrieNode | null\n routerType: 'app' | 'pages'\n}\n\nexport type PageSegment = {\n type: string\n pagePath: string\n boundaryType: string | null\n}\n\nexport type PageMetadata = {\n segments: PageSegment[]\n routerType: 'app' | 'pages'\n}\n\nexport type PageMetadataWithUrl = {\n url: string\n metadata: PageMetadata | null\n}\n\nexport interface McpPageMetadataResponse {\n event: string\n requestId: string\n segmentTrieData: SegmentTrieData | null\n url: string\n}\n"],"names":[],"mappings":"AAuBA,WAKC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/mitt.js b/e-commerce/node_modules/next/dist/esm/shared/lib/mitt.js new file mode 100644 index 0000000000000000000000000000000000000000..835206eedc4d473b14092e95513a18c48512cba8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/mitt.js @@ -0,0 +1,36 @@ +/* +MIT License + +Copyright (c) Jason Miller (https://jasonformat.com/) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ // This file is based on https://github.com/developit/mitt/blob/v1.1.3/src/index.js +// It's been edited for the needs of this script +// See the LICENSE at the top of the file +export default function mitt() { + const all = Object.create(null); + return { + on (type, handler) { + ; + (all[type] || (all[type] = [])).push(handler); + }, + off (type, handler) { + if (all[type]) { + all[type].splice(all[type].indexOf(handler) >>> 0, 1); + } + }, + emit (type, ...evts) { + // eslint-disable-next-line array-callback-return + ; + (all[type] || []).slice().map((handler)=>{ + handler(...evts); + }); + } + }; +} + +//# sourceMappingURL=mitt.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/mitt.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/mitt.js.map new file mode 100644 index 0000000000000000000000000000000000000000..906d017f0e7715cb86b85e4def99a93f2d8df3c5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/mitt.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/mitt.ts"],"sourcesContent":["/*\nMIT License\n\nCopyright (c) Jason Miller (https://jasonformat.com/)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n// This file is based on https://github.com/developit/mitt/blob/v1.1.3/src/index.js\n// It's been edited for the needs of this script\n// See the LICENSE at the top of the file\n\ntype Handler = (...evts: any[]) => void\n\nexport type MittEmitter<T> = {\n on(type: T, handler: Handler): void\n off(type: T, handler: Handler): void\n emit(type: T, ...evts: any[]): void\n}\n\nexport default function mitt(): MittEmitter<string> {\n const all: { [s: string]: Handler[] } = Object.create(null)\n\n return {\n on(type: string, handler: Handler) {\n ;(all[type] || (all[type] = [])).push(handler)\n },\n\n off(type: string, handler: Handler) {\n if (all[type]) {\n all[type].splice(all[type].indexOf(handler) >>> 0, 1)\n }\n },\n\n emit(type: string, ...evts: any[]) {\n // eslint-disable-next-line array-callback-return\n ;(all[type] || []).slice().map((handler: Handler) => {\n handler(...evts)\n })\n },\n }\n}\n"],"names":["mitt","all","Object","create","on","type","handler","push","off","splice","indexOf","emit","evts","slice","map"],"mappings":"AAAA;;;;;;;;;;AAUA,GAEA,mFAAmF;AACnF,gDAAgD;AAChD,yCAAyC;AAUzC,eAAe,SAASA;IACtB,MAAMC,MAAkCC,OAAOC,MAAM,CAAC;IAEtD,OAAO;QACLC,IAAGC,IAAY,EAAEC,OAAgB;;YAC7BL,CAAAA,GAAG,CAACI,KAAK,IAAKJ,CAAAA,GAAG,CAACI,KAAK,GAAG,EAAE,AAAD,CAAC,EAAGE,IAAI,CAACD;QACxC;QAEAE,KAAIH,IAAY,EAAEC,OAAgB;YAChC,IAAIL,GAAG,CAACI,KAAK,EAAE;gBACbJ,GAAG,CAACI,KAAK,CAACI,MAAM,CAACR,GAAG,CAACI,KAAK,CAACK,OAAO,CAACJ,aAAa,GAAG;YACrD;QACF;QAEAK,MAAKN,IAAY,EAAE,GAAGO,IAAW;YAC/B,iDAAiD;;YAC/CX,CAAAA,GAAG,CAACI,KAAK,IAAI,EAAE,AAAD,EAAGQ,KAAK,GAAGC,GAAG,CAAC,CAACR;gBAC9BA,WAAWM;YACb;QACF;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/modern-browserslist-target.d.ts b/e-commerce/node_modules/next/dist/esm/shared/lib/modern-browserslist-target.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..805502ef23d91b5b89f018a83f35c02ca8cb349c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/modern-browserslist-target.d.ts @@ -0,0 +1,2 @@ +declare const MODERN_BROWSERSLIST_TARGET: Array<string> +export default MODERN_BROWSERSLIST_TARGET diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/modern-browserslist-target.js b/e-commerce/node_modules/next/dist/esm/shared/lib/modern-browserslist-target.js new file mode 100644 index 0000000000000000000000000000000000000000..a310a7bee3d458dd4cc43cea3e2d96987d147627 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/modern-browserslist-target.js @@ -0,0 +1,14 @@ +// Note: This file is JS because it's used by the taskfile-swc.js file, which is JS. +// Keep file changes in sync with the corresponding `.d.ts` files. +/** + * These are the minimum browser versions that we consider "modern" and thus compile for by default. + * This list was generated using `pnpm browserslist "baseline widely available"` on 2025-10-01. + */ const MODERN_BROWSERSLIST_TARGET = [ + 'chrome 111', + 'edge 111', + 'firefox 111', + 'safari 16.4' +]; +module.exports = MODERN_BROWSERSLIST_TARGET; + +//# sourceMappingURL=modern-browserslist-target.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/modern-browserslist-target.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/modern-browserslist-target.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6cdb9fce2530a9911474c3b1a0c343b52352ce03 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/modern-browserslist-target.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/modern-browserslist-target.js"],"sourcesContent":["// Note: This file is JS because it's used by the taskfile-swc.js file, which is JS.\n// Keep file changes in sync with the corresponding `.d.ts` files.\n\n/**\n * These are the minimum browser versions that we consider \"modern\" and thus compile for by default.\n * This list was generated using `pnpm browserslist \"baseline widely available\"` on 2025-10-01.\n */\nconst MODERN_BROWSERSLIST_TARGET = [\n 'chrome 111',\n 'edge 111',\n 'firefox 111',\n 'safari 16.4',\n]\n\nmodule.exports = MODERN_BROWSERSLIST_TARGET\n"],"names":["MODERN_BROWSERSLIST_TARGET","module","exports"],"mappings":"AAAA,oFAAoF;AACpF,kEAAkE;AAElE;;;CAGC,GACD,MAAMA,6BAA6B;IACjC;IACA;IACA;IACA;CACD;AAEDC,OAAOC,OAAO,GAAGF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/no-fallback-error.external.js b/e-commerce/node_modules/next/dist/esm/shared/lib/no-fallback-error.external.js new file mode 100644 index 0000000000000000000000000000000000000000..233c788fff474a085fa0317d61edb4b0326c26f1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/no-fallback-error.external.js @@ -0,0 +1,8 @@ +export class NoFallbackError extends Error { + constructor(){ + super(); + this.message = 'Internal: NoFallbackError'; + } +} + +//# sourceMappingURL=no-fallback-error.external.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/no-fallback-error.external.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/no-fallback-error.external.js.map new file mode 100644 index 0000000000000000000000000000000000000000..642bab35e64723f35f52f078332baaf440e8944c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/no-fallback-error.external.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/no-fallback-error.external.ts"],"sourcesContent":["export class NoFallbackError extends Error {\n constructor() {\n super()\n this.message = 'Internal: NoFallbackError'\n }\n}\n"],"names":["NoFallbackError","Error","constructor","message"],"mappings":"AAAA,OAAO,MAAMA,wBAAwBC;IACnCC,aAAc;QACZ,KAAK;QACL,IAAI,CAACC,OAAO,GAAG;IACjB;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/normalized-asset-prefix.js b/e-commerce/node_modules/next/dist/esm/shared/lib/normalized-asset-prefix.js new file mode 100644 index 0000000000000000000000000000000000000000..4eb51d72d0ff0b3e2b4f192a582121d2e41b7c5a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/normalized-asset-prefix.js @@ -0,0 +1,18 @@ +export function normalizedAssetPrefix(assetPrefix) { + // remove all leading slashes and trailing slashes + const escapedAssetPrefix = assetPrefix?.replace(/^\/+|\/+$/g, '') || false; + // if an assetPrefix was '/', we return empty string + // because it could be an unnecessary trailing slash + if (!escapedAssetPrefix) { + return ''; + } + if (URL.canParse(escapedAssetPrefix)) { + const url = new URL(escapedAssetPrefix).toString(); + return url.endsWith('/') ? url.slice(0, -1) : url; + } + // assuming assetPrefix here is a pathname-style, + // restore the leading slash + return `/${escapedAssetPrefix}`; +} + +//# sourceMappingURL=normalized-asset-prefix.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/normalized-asset-prefix.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/normalized-asset-prefix.js.map new file mode 100644 index 0000000000000000000000000000000000000000..dde89863f917d17a92dc01c0e9223e3abde9d7f0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/normalized-asset-prefix.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/normalized-asset-prefix.ts"],"sourcesContent":["export function normalizedAssetPrefix(assetPrefix: string | undefined): string {\n // remove all leading slashes and trailing slashes\n const escapedAssetPrefix = assetPrefix?.replace(/^\\/+|\\/+$/g, '') || false\n\n // if an assetPrefix was '/', we return empty string\n // because it could be an unnecessary trailing slash\n if (!escapedAssetPrefix) {\n return ''\n }\n\n if (URL.canParse(escapedAssetPrefix)) {\n const url = new URL(escapedAssetPrefix).toString()\n return url.endsWith('/') ? url.slice(0, -1) : url\n }\n\n // assuming assetPrefix here is a pathname-style,\n // restore the leading slash\n return `/${escapedAssetPrefix}`\n}\n"],"names":["normalizedAssetPrefix","assetPrefix","escapedAssetPrefix","replace","URL","canParse","url","toString","endsWith","slice"],"mappings":"AAAA,OAAO,SAASA,sBAAsBC,WAA+B;IACnE,kDAAkD;IAClD,MAAMC,qBAAqBD,aAAaE,QAAQ,cAAc,OAAO;IAErE,oDAAoD;IACpD,oDAAoD;IACpD,IAAI,CAACD,oBAAoB;QACvB,OAAO;IACT;IAEA,IAAIE,IAAIC,QAAQ,CAACH,qBAAqB;QACpC,MAAMI,MAAM,IAAIF,IAAIF,oBAAoBK,QAAQ;QAChD,OAAOD,IAAIE,QAAQ,CAAC,OAAOF,IAAIG,KAAK,CAAC,GAAG,CAAC,KAAKH;IAChD;IAEA,iDAAiD;IACjD,4BAA4B;IAC5B,OAAO,CAAC,CAAC,EAAEJ,oBAAoB;AACjC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/absolute-path-to-page.js b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/absolute-path-to-page.js new file mode 100644 index 0000000000000000000000000000000000000000..268428ad72b8a1bef6e70d6c8e2471d893796556 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/absolute-path-to-page.js @@ -0,0 +1,29 @@ +import { ensureLeadingSlash } from './ensure-leading-slash'; +import { normalizePathSep } from './normalize-path-sep'; +import path from '../isomorphic/path'; +import { removePagePathTail } from './remove-page-path-tail'; +import { normalizeMetadataRoute } from '../../../lib/metadata/get-metadata-route'; +/** + * Given the absolute path to the pages folder, an absolute file path for a + * page and the page extensions, this function will return the page path + * relative to the pages folder. It doesn't consider index tail. Example: + * - `/Users/rick/my-project/pages/foo/bar/baz.js` -> `/foo/bar/baz` + * + * It also handles special metadata routes mapping. Example: + * - `/Users/rick/my-project/app/sitemap.js` -> `/sitemap/route` + * + * @param filepath Absolute path to the page. + * @param opts.dir Absolute path to the pages/app folder. + * @param opts.extensions Extensions allowed for the page. + * @param opts.keepIndex When true the trailing `index` kept in the path. + * @param opts.pagesType Whether the page is in the pages or app directory. + */ export function absolutePathToPage(pagePath, options) { + const isAppDir = options.pagesType === 'app'; + const page = removePagePathTail(normalizePathSep(ensureLeadingSlash(path.relative(options.dir, pagePath))), { + extensions: options.extensions, + keepIndex: options.keepIndex + }); + return isAppDir ? normalizeMetadataRoute(page) : page; +} + +//# sourceMappingURL=absolute-path-to-page.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/absolute-path-to-page.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/absolute-path-to-page.js.map new file mode 100644 index 0000000000000000000000000000000000000000..9d9785f15b5dc171b234fa3232f55909e4d77e92 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/absolute-path-to-page.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/page-path/absolute-path-to-page.ts"],"sourcesContent":["import { ensureLeadingSlash } from './ensure-leading-slash'\nimport { normalizePathSep } from './normalize-path-sep'\nimport path from '../isomorphic/path'\nimport { removePagePathTail } from './remove-page-path-tail'\nimport { normalizeMetadataRoute } from '../../../lib/metadata/get-metadata-route'\nimport type { PAGE_TYPES } from '../../../lib/page-types'\n\n/**\n * Given the absolute path to the pages folder, an absolute file path for a\n * page and the page extensions, this function will return the page path\n * relative to the pages folder. It doesn't consider index tail. Example:\n * - `/Users/rick/my-project/pages/foo/bar/baz.js` -> `/foo/bar/baz`\n *\n * It also handles special metadata routes mapping. Example:\n * - `/Users/rick/my-project/app/sitemap.js` -> `/sitemap/route`\n *\n * @param filepath Absolute path to the page.\n * @param opts.dir Absolute path to the pages/app folder.\n * @param opts.extensions Extensions allowed for the page.\n * @param opts.keepIndex When true the trailing `index` kept in the path.\n * @param opts.pagesType Whether the page is in the pages or app directory.\n */\nexport function absolutePathToPage(\n pagePath: string,\n options: {\n extensions: string[] | readonly string[]\n keepIndex: boolean\n dir: string\n pagesType: PAGE_TYPES\n }\n) {\n const isAppDir = options.pagesType === 'app'\n const page = removePagePathTail(\n normalizePathSep(ensureLeadingSlash(path.relative(options.dir, pagePath))),\n {\n extensions: options.extensions,\n keepIndex: options.keepIndex,\n }\n )\n return isAppDir ? normalizeMetadataRoute(page) : page\n}\n"],"names":["ensureLeadingSlash","normalizePathSep","path","removePagePathTail","normalizeMetadataRoute","absolutePathToPage","pagePath","options","isAppDir","pagesType","page","relative","dir","extensions","keepIndex"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,yBAAwB;AAC3D,SAASC,gBAAgB,QAAQ,uBAAsB;AACvD,OAAOC,UAAU,qBAAoB;AACrC,SAASC,kBAAkB,QAAQ,0BAAyB;AAC5D,SAASC,sBAAsB,QAAQ,2CAA0C;AAGjF;;;;;;;;;;;;;;CAcC,GACD,OAAO,SAASC,mBACdC,QAAgB,EAChBC,OAKC;IAED,MAAMC,WAAWD,QAAQE,SAAS,KAAK;IACvC,MAAMC,OAAOP,mBACXF,iBAAiBD,mBAAmBE,KAAKS,QAAQ,CAACJ,QAAQK,GAAG,EAAEN,aAC/D;QACEO,YAAYN,QAAQM,UAAU;QAC9BC,WAAWP,QAAQO,SAAS;IAC9B;IAEF,OAAON,WAAWJ,uBAAuBM,QAAQA;AACnD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/denormalize-app-path.js b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/denormalize-app-path.js new file mode 100644 index 0000000000000000000000000000000000000000..cd112d2c8bb5c4d24d742c1abd876119254a3bdf --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/denormalize-app-path.js @@ -0,0 +1,9 @@ +export function denormalizeAppPagePath(page) { + // `/` is normalized to `/index` + if (page === '/index') { + return '/'; + } + return page; +} + +//# sourceMappingURL=denormalize-app-path.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/denormalize-app-path.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/denormalize-app-path.js.map new file mode 100644 index 0000000000000000000000000000000000000000..8fc8711bd013a3f39db8cbfc398e8f2e8a5af995 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/denormalize-app-path.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/page-path/denormalize-app-path.ts"],"sourcesContent":["export function denormalizeAppPagePath(page: string): string {\n // `/` is normalized to `/index`\n if (page === '/index') {\n return '/'\n }\n\n return page\n}\n"],"names":["denormalizeAppPagePath","page"],"mappings":"AAAA,OAAO,SAASA,uBAAuBC,IAAY;IACjD,gCAAgC;IAChC,IAAIA,SAAS,UAAU;QACrB,OAAO;IACT;IAEA,OAAOA;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/denormalize-page-path.js b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/denormalize-page-path.js new file mode 100644 index 0000000000000000000000000000000000000000..dfcc12a5302d8224d966441d56ad1774013c1b11 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/denormalize-page-path.js @@ -0,0 +1,15 @@ +import { isDynamicRoute } from '../router/utils'; +import { normalizePathSep } from './normalize-path-sep'; +/** + * Performs the opposite transformation of `normalizePagePath`. Note that + * this function is not idempotent either in cases where there are multiple + * leading `/index` for the page. Examples: + * - `/index` -> `/` + * - `/index/foo` -> `/foo` + * - `/index/index` -> `/index` + */ export function denormalizePagePath(page) { + let _page = normalizePathSep(page); + return _page.startsWith('/index/') && !isDynamicRoute(_page) ? _page.slice(6) : _page !== '/index' ? _page : '/'; +} + +//# sourceMappingURL=denormalize-page-path.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/denormalize-page-path.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/denormalize-page-path.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f2d67e44bf3f8ed0ff1c1327f15c16d4d3579471 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/denormalize-page-path.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/page-path/denormalize-page-path.ts"],"sourcesContent":["import { isDynamicRoute } from '../router/utils'\nimport { normalizePathSep } from './normalize-path-sep'\n\n/**\n * Performs the opposite transformation of `normalizePagePath`. Note that\n * this function is not idempotent either in cases where there are multiple\n * leading `/index` for the page. Examples:\n * - `/index` -> `/`\n * - `/index/foo` -> `/foo`\n * - `/index/index` -> `/index`\n */\nexport function denormalizePagePath(page: string) {\n let _page = normalizePathSep(page)\n return _page.startsWith('/index/') && !isDynamicRoute(_page)\n ? _page.slice(6)\n : _page !== '/index'\n ? _page\n : '/'\n}\n"],"names":["isDynamicRoute","normalizePathSep","denormalizePagePath","page","_page","startsWith","slice"],"mappings":"AAAA,SAASA,cAAc,QAAQ,kBAAiB;AAChD,SAASC,gBAAgB,QAAQ,uBAAsB;AAEvD;;;;;;;CAOC,GACD,OAAO,SAASC,oBAAoBC,IAAY;IAC9C,IAAIC,QAAQH,iBAAiBE;IAC7B,OAAOC,MAAMC,UAAU,CAAC,cAAc,CAACL,eAAeI,SAClDA,MAAME,KAAK,CAAC,KACZF,UAAU,WACRA,QACA;AACR","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/ensure-leading-slash.js b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/ensure-leading-slash.js new file mode 100644 index 0000000000000000000000000000000000000000..3e5281eefadeab025935c75432ede6896a187284 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/ensure-leading-slash.js @@ -0,0 +1,8 @@ +/** + * For a given page path, this function ensures that there is a leading slash. + * If there is not a leading slash, one is added, otherwise it is noop. + */ export function ensureLeadingSlash(path) { + return path.startsWith('/') ? path : `/${path}`; +} + +//# sourceMappingURL=ensure-leading-slash.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/ensure-leading-slash.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/ensure-leading-slash.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3faa7fd69ef8e93834614b952b8648c3bc43da47 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/ensure-leading-slash.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/page-path/ensure-leading-slash.ts"],"sourcesContent":["/**\n * For a given page path, this function ensures that there is a leading slash.\n * If there is not a leading slash, one is added, otherwise it is noop.\n */\nexport function ensureLeadingSlash(path: string) {\n return path.startsWith('/') ? path : `/${path}`\n}\n"],"names":["ensureLeadingSlash","path","startsWith"],"mappings":"AAAA;;;CAGC,GACD,OAAO,SAASA,mBAAmBC,IAAY;IAC7C,OAAOA,KAAKC,UAAU,CAAC,OAAOD,OAAO,CAAC,CAAC,EAAEA,MAAM;AACjD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/get-page-paths.js b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/get-page-paths.js new file mode 100644 index 0000000000000000000000000000000000000000..1c36e4e2cc25181c03882771ac4f0d85b411aae5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/get-page-paths.js @@ -0,0 +1,40 @@ +import { denormalizePagePath } from './denormalize-page-path'; +import path from '../isomorphic/path'; +/** + * Calculate all possible pagePaths for a given normalized pagePath along with + * allowed extensions. This can be used to check which one of the files exists + * and to debug inspected locations. + * + * For pages, map `/route` to [`/route.[ext]`, `/route/index.[ext]`] + * For app paths, map `/route/page` to [`/route/page.[ext]`] or `/route/route` + * to [`/route/route.[ext]`] + * + * @param normalizedPagePath Normalized page path (it will denormalize). + * @param extensions Allowed extensions. + */ export function getPagePaths(normalizedPagePath, extensions, isAppDir) { + const page = denormalizePagePath(normalizedPagePath); + let prefixes; + if (isAppDir) { + prefixes = [ + page + ]; + } else if (normalizedPagePath.endsWith('/index')) { + prefixes = [ + path.join(page, 'index') + ]; + } else { + prefixes = [ + page, + path.join(page, 'index') + ]; + } + const paths = []; + for (const extension of extensions){ + for (const prefix of prefixes){ + paths.push(`${prefix}.${extension}`); + } + } + return paths; +} + +//# sourceMappingURL=get-page-paths.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/get-page-paths.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/get-page-paths.js.map new file mode 100644 index 0000000000000000000000000000000000000000..8459d18c7f9ec8186ebcddee58a8f1966ac3ed13 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/get-page-paths.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/page-path/get-page-paths.ts"],"sourcesContent":["import { denormalizePagePath } from './denormalize-page-path'\nimport path from '../isomorphic/path'\n\n/**\n * Calculate all possible pagePaths for a given normalized pagePath along with\n * allowed extensions. This can be used to check which one of the files exists\n * and to debug inspected locations.\n *\n * For pages, map `/route` to [`/route.[ext]`, `/route/index.[ext]`]\n * For app paths, map `/route/page` to [`/route/page.[ext]`] or `/route/route`\n * to [`/route/route.[ext]`]\n *\n * @param normalizedPagePath Normalized page path (it will denormalize).\n * @param extensions Allowed extensions.\n */\nexport function getPagePaths(\n normalizedPagePath: string,\n extensions: string[],\n isAppDir: boolean\n) {\n const page = denormalizePagePath(normalizedPagePath)\n\n let prefixes: string[]\n if (isAppDir) {\n prefixes = [page]\n } else if (normalizedPagePath.endsWith('/index')) {\n prefixes = [path.join(page, 'index')]\n } else {\n prefixes = [page, path.join(page, 'index')]\n }\n\n const paths: string[] = []\n for (const extension of extensions) {\n for (const prefix of prefixes) {\n paths.push(`${prefix}.${extension}`)\n }\n }\n\n return paths\n}\n"],"names":["denormalizePagePath","path","getPagePaths","normalizedPagePath","extensions","isAppDir","page","prefixes","endsWith","join","paths","extension","prefix","push"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,0BAAyB;AAC7D,OAAOC,UAAU,qBAAoB;AAErC;;;;;;;;;;;CAWC,GACD,OAAO,SAASC,aACdC,kBAA0B,EAC1BC,UAAoB,EACpBC,QAAiB;IAEjB,MAAMC,OAAON,oBAAoBG;IAEjC,IAAII;IACJ,IAAIF,UAAU;QACZE,WAAW;YAACD;SAAK;IACnB,OAAO,IAAIH,mBAAmBK,QAAQ,CAAC,WAAW;QAChDD,WAAW;YAACN,KAAKQ,IAAI,CAACH,MAAM;SAAS;IACvC,OAAO;QACLC,WAAW;YAACD;YAAML,KAAKQ,IAAI,CAACH,MAAM;SAAS;IAC7C;IAEA,MAAMI,QAAkB,EAAE;IAC1B,KAAK,MAAMC,aAAaP,WAAY;QAClC,KAAK,MAAMQ,UAAUL,SAAU;YAC7BG,MAAMG,IAAI,CAAC,GAAGD,OAAO,CAAC,EAAED,WAAW;QACrC;IACF;IAEA,OAAOD;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/normalize-data-path.js b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/normalize-data-path.js new file mode 100644 index 0000000000000000000000000000000000000000..92fb8fc513dda66edc0add76af309cff9a59b219 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/normalize-data-path.js @@ -0,0 +1,15 @@ +import { pathHasPrefix } from '../router/utils/path-has-prefix'; +/** + * strip _next/data/<build-id>/ prefix and .json suffix + */ export function normalizeDataPath(pathname) { + if (!pathHasPrefix(pathname || '/', '/_next/data')) { + return pathname; + } + pathname = pathname.replace(/\/_next\/data\/[^/]{1,}/, '').replace(/\.json$/, ''); + if (pathname === '/index') { + return '/'; + } + return pathname; +} + +//# sourceMappingURL=normalize-data-path.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/normalize-data-path.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/normalize-data-path.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6bbcb370581a2b1683817224549dc87f7eef3f63 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/normalize-data-path.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/page-path/normalize-data-path.ts"],"sourcesContent":["import { pathHasPrefix } from '../router/utils/path-has-prefix'\n\n/**\n * strip _next/data/<build-id>/ prefix and .json suffix\n */\nexport function normalizeDataPath(pathname: string) {\n if (!pathHasPrefix(pathname || '/', '/_next/data')) {\n return pathname\n }\n pathname = pathname\n .replace(/\\/_next\\/data\\/[^/]{1,}/, '')\n .replace(/\\.json$/, '')\n\n if (pathname === '/index') {\n return '/'\n }\n return pathname\n}\n"],"names":["pathHasPrefix","normalizeDataPath","pathname","replace"],"mappings":"AAAA,SAASA,aAAa,QAAQ,kCAAiC;AAE/D;;CAEC,GACD,OAAO,SAASC,kBAAkBC,QAAgB;IAChD,IAAI,CAACF,cAAcE,YAAY,KAAK,gBAAgB;QAClD,OAAOA;IACT;IACAA,WAAWA,SACRC,OAAO,CAAC,2BAA2B,IACnCA,OAAO,CAAC,WAAW;IAEtB,IAAID,aAAa,UAAU;QACzB,OAAO;IACT;IACA,OAAOA;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/normalize-page-path.js b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/normalize-page-path.js new file mode 100644 index 0000000000000000000000000000000000000000..9418a85781db5bb7382006759e3641f88347c977 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/normalize-page-path.js @@ -0,0 +1,24 @@ +import { ensureLeadingSlash } from './ensure-leading-slash'; +import { isDynamicRoute } from '../router/utils'; +import { NormalizeError } from '../utils'; +/** + * Takes a page and transforms it into its file counterpart ensuring that the + * output is normalized. Note this function is not idempotent because a page + * `/index` can be referencing `/index/index.js` and `/index/index` could be + * referencing `/index/index/index.js`. Examples: + * - `/` -> `/index` + * - `/index/foo` -> `/index/index/foo` + * - `/index` -> `/index/index` + */ export function normalizePagePath(page) { + const normalized = /^\/index(\/|$)/.test(page) && !isDynamicRoute(page) ? `/index${page}` : page === '/' ? '/index' : ensureLeadingSlash(page); + if (process.env.NEXT_RUNTIME !== 'edge') { + const { posix } = require('path'); + const resolvedPage = posix.normalize(normalized); + if (resolvedPage !== normalized) { + throw new NormalizeError(`Requested and resolved page mismatch: ${normalized} ${resolvedPage}`); + } + } + return normalized; +} + +//# sourceMappingURL=normalize-page-path.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/normalize-page-path.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/normalize-page-path.js.map new file mode 100644 index 0000000000000000000000000000000000000000..63a570c599bfa41d6557bb1840e74469b2856119 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/normalize-page-path.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/page-path/normalize-page-path.ts"],"sourcesContent":["import { ensureLeadingSlash } from './ensure-leading-slash'\nimport { isDynamicRoute } from '../router/utils'\nimport { NormalizeError } from '../utils'\n\n/**\n * Takes a page and transforms it into its file counterpart ensuring that the\n * output is normalized. Note this function is not idempotent because a page\n * `/index` can be referencing `/index/index.js` and `/index/index` could be\n * referencing `/index/index/index.js`. Examples:\n * - `/` -> `/index`\n * - `/index/foo` -> `/index/index/foo`\n * - `/index` -> `/index/index`\n */\nexport function normalizePagePath(page: string): string {\n const normalized =\n /^\\/index(\\/|$)/.test(page) && !isDynamicRoute(page)\n ? `/index${page}`\n : page === '/'\n ? '/index'\n : ensureLeadingSlash(page)\n\n if (process.env.NEXT_RUNTIME !== 'edge') {\n const { posix } = require('path') as typeof import('path')\n const resolvedPage = posix.normalize(normalized)\n if (resolvedPage !== normalized) {\n throw new NormalizeError(\n `Requested and resolved page mismatch: ${normalized} ${resolvedPage}`\n )\n }\n }\n\n return normalized\n}\n"],"names":["ensureLeadingSlash","isDynamicRoute","NormalizeError","normalizePagePath","page","normalized","test","process","env","NEXT_RUNTIME","posix","require","resolvedPage","normalize"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,yBAAwB;AAC3D,SAASC,cAAc,QAAQ,kBAAiB;AAChD,SAASC,cAAc,QAAQ,WAAU;AAEzC;;;;;;;;CAQC,GACD,OAAO,SAASC,kBAAkBC,IAAY;IAC5C,MAAMC,aACJ,iBAAiBC,IAAI,CAACF,SAAS,CAACH,eAAeG,QAC3C,CAAC,MAAM,EAAEA,MAAM,GACfA,SAAS,MACP,WACAJ,mBAAmBI;IAE3B,IAAIG,QAAQC,GAAG,CAACC,YAAY,KAAK,QAAQ;QACvC,MAAM,EAAEC,KAAK,EAAE,GAAGC,QAAQ;QAC1B,MAAMC,eAAeF,MAAMG,SAAS,CAACR;QACrC,IAAIO,iBAAiBP,YAAY;YAC/B,MAAM,IAAIH,eACR,CAAC,sCAAsC,EAAEG,WAAW,CAAC,EAAEO,cAAc;QAEzE;IACF;IAEA,OAAOP;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/normalize-path-sep.js b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/normalize-path-sep.js new file mode 100644 index 0000000000000000000000000000000000000000..7b646996b0274837e9e2e35258bc1eaf933b9c6c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/normalize-path-sep.js @@ -0,0 +1,9 @@ +/** + * For a given page path, this function ensures that there is no backslash + * escaping slashes in the path. Example: + * - `foo\/bar\/baz` -> `foo/bar/baz` + */ export function normalizePathSep(path) { + return path.replace(/\\/g, '/'); +} + +//# sourceMappingURL=normalize-path-sep.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/normalize-path-sep.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/normalize-path-sep.js.map new file mode 100644 index 0000000000000000000000000000000000000000..48fe105984d5dab587735cbde8df5cd5422bca83 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/normalize-path-sep.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/page-path/normalize-path-sep.ts"],"sourcesContent":["/**\n * For a given page path, this function ensures that there is no backslash\n * escaping slashes in the path. Example:\n * - `foo\\/bar\\/baz` -> `foo/bar/baz`\n */\nexport function normalizePathSep(path: string): string {\n return path.replace(/\\\\/g, '/')\n}\n"],"names":["normalizePathSep","path","replace"],"mappings":"AAAA;;;;CAIC,GACD,OAAO,SAASA,iBAAiBC,IAAY;IAC3C,OAAOA,KAAKC,OAAO,CAAC,OAAO;AAC7B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/remove-page-path-tail.js b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/remove-page-path-tail.js new file mode 100644 index 0000000000000000000000000000000000000000..2135c7e43eccd84ae34aabcae4a828d4adaeec6b --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/remove-page-path-tail.js @@ -0,0 +1,20 @@ +import { normalizePathSep } from './normalize-path-sep'; +/** + * Removes the file extension for a page and the trailing `index` if it exists + * making sure to not return an empty string. The page head is not touched + * and returned as it is passed. Examples: + * - `/foo/bar/baz/index.js` -> `/foo/bar/baz` + * - `/foo/bar/baz.js` -> `/foo/bar/baz` + * + * @param pagePath A page to a page file (absolute or relative) + * @param options.extensions Extensions allowed for the page. + * @param options.keepIndex When true the trailing `index` is _not_ removed. + */ export function removePagePathTail(pagePath, options) { + pagePath = normalizePathSep(pagePath).replace(new RegExp(`\\.+(?:${options.extensions.join('|')})$`), ''); + if (options.keepIndex !== true) { + pagePath = pagePath.replace(/\/index$/, '') || '/'; + } + return pagePath; +} + +//# sourceMappingURL=remove-page-path-tail.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/remove-page-path-tail.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/remove-page-path-tail.js.map new file mode 100644 index 0000000000000000000000000000000000000000..562067f87f6de405b8d66535b04c3936d6eb56ef --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/page-path/remove-page-path-tail.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/page-path/remove-page-path-tail.ts"],"sourcesContent":["import { normalizePathSep } from './normalize-path-sep'\n\n/**\n * Removes the file extension for a page and the trailing `index` if it exists\n * making sure to not return an empty string. The page head is not touched\n * and returned as it is passed. Examples:\n * - `/foo/bar/baz/index.js` -> `/foo/bar/baz`\n * - `/foo/bar/baz.js` -> `/foo/bar/baz`\n *\n * @param pagePath A page to a page file (absolute or relative)\n * @param options.extensions Extensions allowed for the page.\n * @param options.keepIndex When true the trailing `index` is _not_ removed.\n */\nexport function removePagePathTail(\n pagePath: string,\n options: {\n extensions: ReadonlyArray<string>\n keepIndex?: boolean\n }\n) {\n pagePath = normalizePathSep(pagePath).replace(\n new RegExp(`\\\\.+(?:${options.extensions.join('|')})$`),\n ''\n )\n\n if (options.keepIndex !== true) {\n pagePath = pagePath.replace(/\\/index$/, '') || '/'\n }\n\n return pagePath\n}\n"],"names":["normalizePathSep","removePagePathTail","pagePath","options","replace","RegExp","extensions","join","keepIndex"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,uBAAsB;AAEvD;;;;;;;;;;CAUC,GACD,OAAO,SAASC,mBACdC,QAAgB,EAChBC,OAGC;IAEDD,WAAWF,iBAAiBE,UAAUE,OAAO,CAC3C,IAAIC,OAAO,CAAC,OAAO,EAAEF,QAAQG,UAAU,CAACC,IAAI,CAAC,KAAK,EAAE,CAAC,GACrD;IAGF,IAAIJ,QAAQK,SAAS,KAAK,MAAM;QAC9BN,WAAWA,SAASE,OAAO,CAAC,YAAY,OAAO;IACjD;IAEA,OAAOF;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/promise-with-resolvers.js b/e-commerce/node_modules/next/dist/esm/shared/lib/promise-with-resolvers.js new file mode 100644 index 0000000000000000000000000000000000000000..336e082b4d0519642cc242238476c51cad94d1ae --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/promise-with-resolvers.js @@ -0,0 +1,16 @@ +export function createPromiseWithResolvers() { + // Shim of Stage 4 Promise.withResolvers proposal + let resolve; + let reject; + const promise = new Promise((res, rej)=>{ + resolve = res; + reject = rej; + }); + return { + resolve: resolve, + reject: reject, + promise + }; +} + +//# sourceMappingURL=promise-with-resolvers.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/promise-with-resolvers.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/promise-with-resolvers.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6150b952b85f9b0986aae727d4fa94952b48c4f7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/promise-with-resolvers.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/promise-with-resolvers.ts"],"sourcesContent":["export function createPromiseWithResolvers<T>(): PromiseWithResolvers<T> {\n // Shim of Stage 4 Promise.withResolvers proposal\n let resolve: (value: T | PromiseLike<T>) => void\n let reject: (reason: any) => void\n const promise = new Promise<T>((res, rej) => {\n resolve = res\n reject = rej\n })\n return { resolve: resolve!, reject: reject!, promise }\n}\n"],"names":["createPromiseWithResolvers","resolve","reject","promise","Promise","res","rej"],"mappings":"AAAA,OAAO,SAASA;IACd,iDAAiD;IACjD,IAAIC;IACJ,IAAIC;IACJ,MAAMC,UAAU,IAAIC,QAAW,CAACC,KAAKC;QACnCL,UAAUI;QACVH,SAASI;IACX;IACA,OAAO;QAAEL,SAASA;QAAUC,QAAQA;QAASC;IAAQ;AACvD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/request-insights.js b/e-commerce/node_modules/next/dist/esm/shared/lib/request-insights.js new file mode 100644 index 0000000000000000000000000000000000000000..131c1c0d14bc38efbd1f313e0eae2aa54cdf3a1f --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/request-insights.js @@ -0,0 +1,8 @@ +export function getRequestInsightKind(insight) { + return insight.kind ?? 'request'; +} +export function getRequestInsightKey(insight) { + return `${getRequestInsightKind(insight)}:${insight.requestId}`; +} + +//# sourceMappingURL=request-insights.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/request-insights.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/request-insights.js.map new file mode 100644 index 0000000000000000000000000000000000000000..078d3d144334296b048d386aef2d8dc33b8c6680 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/request-insights.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/request-insights.ts"],"sourcesContent":["export type RequestInsightKind = 'request' | 'instant-insights'\n\nexport type RequestInsightIdentity = {\n requestId: string\n kind?: RequestInsightKind\n}\n\nexport function getRequestInsightKind(\n insight: Pick<RequestInsightIdentity, 'kind'>\n): RequestInsightKind {\n return insight.kind ?? 'request'\n}\n\nexport function getRequestInsightKey(insight: RequestInsightIdentity): string {\n return `${getRequestInsightKind(insight)}:${insight.requestId}`\n}\n"],"names":["getRequestInsightKind","insight","kind","getRequestInsightKey","requestId"],"mappings":"AAOA,OAAO,SAASA,sBACdC,OAA6C;IAE7C,OAAOA,QAAQC,IAAI,IAAI;AACzB;AAEA,OAAO,SAASC,qBAAqBF,OAA+B;IAClE,OAAO,GAAGD,sBAAsBC,SAAS,CAAC,EAAEA,QAAQG,SAAS,EAAE;AACjE","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router-context.shared-runtime.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router-context.shared-runtime.js new file mode 100644 index 0000000000000000000000000000000000000000..4ee4945598f48657f16a081c2b2f09a44090d21d --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router-context.shared-runtime.js @@ -0,0 +1,7 @@ +import React from 'react'; +export const RouterContext = React.createContext(null); +if (process.env.NODE_ENV !== 'production') { + RouterContext.displayName = 'RouterContext'; +} + +//# sourceMappingURL=router-context.shared-runtime.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router-context.shared-runtime.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router-context.shared-runtime.js.map new file mode 100644 index 0000000000000000000000000000000000000000..12e5ef2507e5674a8fcdaaf8652617279be32525 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router-context.shared-runtime.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/router-context.shared-runtime.ts"],"sourcesContent":["import React from 'react'\nimport type { NextRouter } from './router/router'\n\nexport const RouterContext = React.createContext<NextRouter | null>(null)\n\nif (process.env.NODE_ENV !== 'production') {\n RouterContext.displayName = 'RouterContext'\n}\n"],"names":["React","RouterContext","createContext","process","env","NODE_ENV","displayName"],"mappings":"AAAA,OAAOA,WAAW,QAAO;AAGzB,OAAO,MAAMC,gBAAgBD,MAAME,aAAa,CAAoB,MAAK;AAEzE,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzCJ,cAAcK,WAAW,GAAG;AAC9B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/adapters.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/adapters.js new file mode 100644 index 0000000000000000000000000000000000000000..94cb141d0524a0b38738657b8fe44bc82b316dc9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/adapters.js @@ -0,0 +1,113 @@ +import { jsx as _jsx } from "react/jsx-runtime"; +import React, { useMemo, useRef } from 'react'; +import { PathnameContext } from '../hooks-client-context.shared-runtime'; +import { isDynamicRoute } from './utils'; +import { asPathToSearchParams } from './utils/as-path-to-search-params'; +import { getRouteRegex } from './utils/route-regex'; +/** It adapts a Pages Router (`NextRouter`) to the App Router Instance. */ export function adaptForAppRouterInstance(pagesRouter) { + return { + back () { + pagesRouter.back(); + }, + forward () { + pagesRouter.forward(); + }, + refresh () { + pagesRouter.reload(); + }, + hmrRefresh () {}, + push (href, { scroll } = {}) { + void pagesRouter.push(href, undefined, { + scroll + }); + }, + replace (href, { scroll } = {}) { + void pagesRouter.replace(href, undefined, { + scroll + }); + }, + prefetch (href) { + void pagesRouter.prefetch(href); + }, + // The bfcacheId concept is App Router-only. Surfaced as a stable + // placeholder so consumers using this adapter don't crash. + bfcacheId: '0' + }; +} +/** + * adaptForSearchParams transforms the ParsedURLQuery into URLSearchParams. + * + * @param router the router that contains the query. + * @returns the search params in the URLSearchParams format + */ export function adaptForSearchParams(router) { + if (!router.isReady || !router.query) { + return new URLSearchParams(); + } + return asPathToSearchParams(router.asPath); +} +export function adaptForPathParams(router) { + if (!router.isReady || !router.query) { + return null; + } + const pathParams = {}; + const routeRegex = getRouteRegex(router.pathname); + const keys = Object.keys(routeRegex.groups); + for (const key of keys){ + pathParams[key] = router.query[key]; + } + return pathParams; +} +export function PathnameContextProviderAdapter({ children, router, ...props }) { + const ref = useRef(props.isAutoExport); + const value = useMemo(()=>{ + // isAutoExport is only ever `true` on the first render from the server, + // so reset it to `false` after we read it for the first time as `true`. If + // we don't use the value, then we don't need it. + const isAutoExport = ref.current; + if (isAutoExport) { + ref.current = false; + } + // When the route is a dynamic route, we need to do more processing to + // determine if we need to stop showing the pathname. + if (isDynamicRoute(router.pathname)) { + // When the router is rendering the fallback page, it can't possibly know + // the path, so return `null` here. Read more about fallback pages over + // at: + // https://nextjs.org/docs/api-reference/data-fetching/get-static-paths#fallback-pages + if (router.isFallback) { + return null; + } + // When `isAutoExport` is true, meaning this is a page page has been + // automatically statically optimized, and the router is not ready, then + // we can't know the pathname yet. Read more about automatic static + // optimization at: + // https://nextjs.org/docs/advanced-features/automatic-static-optimization + if (isAutoExport && !router.isReady) { + return null; + } + } + // The `router.asPath` contains the pathname seen by the browser (including + // any query strings), so it should have that stripped. Read more about the + // `asPath` option over at: + // https://nextjs.org/docs/api-reference/next/router#router-object + let url; + try { + url = new URL(router.asPath, 'http://f'); + } catch (_) { + // fallback to / for invalid asPath values e.g. // + return '/'; + } + return url.pathname; + }, [ + router.asPath, + router.isFallback, + router.isReady, + router.pathname + ]); + return /*#__PURE__*/ _jsx(PathnameContext.Provider, { + value: value, + children: children + }); +} + +//# sourceMappingURL=adapters.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/adapters.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/adapters.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f605dd1055f55ee32a8fd9e4a9e23b3faf427177 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/adapters.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/router/adapters.tsx"],"sourcesContent":["import type { AppRouterInstance } from '../app-router-context.shared-runtime'\nimport type { Params } from '../../../server/request/params'\nimport type { NextRouter } from './router'\n\nimport React, { useMemo, useRef } from 'react'\nimport { PathnameContext } from '../hooks-client-context.shared-runtime'\nimport { isDynamicRoute } from './utils'\nimport { asPathToSearchParams } from './utils/as-path-to-search-params'\nimport { getRouteRegex } from './utils/route-regex'\n\n/** It adapts a Pages Router (`NextRouter`) to the App Router Instance. */\nexport function adaptForAppRouterInstance(\n pagesRouter: NextRouter\n): AppRouterInstance {\n return {\n back() {\n pagesRouter.back()\n },\n forward() {\n pagesRouter.forward()\n },\n refresh() {\n pagesRouter.reload()\n },\n hmrRefresh() {},\n push(href, { scroll } = {}) {\n void pagesRouter.push(href, undefined, { scroll })\n },\n replace(href, { scroll } = {}) {\n void pagesRouter.replace(href, undefined, { scroll })\n },\n prefetch(href) {\n void pagesRouter.prefetch(href)\n },\n // The bfcacheId concept is App Router-only. Surfaced as a stable\n // placeholder so consumers using this adapter don't crash.\n bfcacheId: '0',\n }\n}\n\n/**\n * adaptForSearchParams transforms the ParsedURLQuery into URLSearchParams.\n *\n * @param router the router that contains the query.\n * @returns the search params in the URLSearchParams format\n */\nexport function adaptForSearchParams(\n router: Pick<NextRouter, 'isReady' | 'query' | 'asPath'>\n): URLSearchParams {\n if (!router.isReady || !router.query) {\n return new URLSearchParams()\n }\n\n return asPathToSearchParams(router.asPath)\n}\n\nexport function adaptForPathParams(\n router: Pick<NextRouter, 'isReady' | 'pathname' | 'query' | 'asPath'>\n): Params | null {\n if (!router.isReady || !router.query) {\n return null\n }\n const pathParams: Params = {}\n const routeRegex = getRouteRegex(router.pathname)\n const keys = Object.keys(routeRegex.groups)\n for (const key of keys) {\n pathParams[key] = router.query[key]!\n }\n return pathParams\n}\n\nexport function PathnameContextProviderAdapter({\n children,\n router,\n ...props\n}: React.PropsWithChildren<{\n router: Pick<NextRouter, 'pathname' | 'asPath' | 'isReady' | 'isFallback'>\n isAutoExport: boolean\n}>) {\n const ref = useRef(props.isAutoExport)\n const value = useMemo(() => {\n // isAutoExport is only ever `true` on the first render from the server,\n // so reset it to `false` after we read it for the first time as `true`. If\n // we don't use the value, then we don't need it.\n const isAutoExport = ref.current\n if (isAutoExport) {\n ref.current = false\n }\n\n // When the route is a dynamic route, we need to do more processing to\n // determine if we need to stop showing the pathname.\n if (isDynamicRoute(router.pathname)) {\n // When the router is rendering the fallback page, it can't possibly know\n // the path, so return `null` here. Read more about fallback pages over\n // at:\n // https://nextjs.org/docs/api-reference/data-fetching/get-static-paths#fallback-pages\n if (router.isFallback) {\n return null\n }\n\n // When `isAutoExport` is true, meaning this is a page page has been\n // automatically statically optimized, and the router is not ready, then\n // we can't know the pathname yet. Read more about automatic static\n // optimization at:\n // https://nextjs.org/docs/advanced-features/automatic-static-optimization\n if (isAutoExport && !router.isReady) {\n return null\n }\n }\n\n // The `router.asPath` contains the pathname seen by the browser (including\n // any query strings), so it should have that stripped. Read more about the\n // `asPath` option over at:\n // https://nextjs.org/docs/api-reference/next/router#router-object\n let url: URL\n try {\n url = new URL(router.asPath, 'http://f')\n } catch (_) {\n // fallback to / for invalid asPath values e.g. //\n return '/'\n }\n\n return url.pathname\n }, [router.asPath, router.isFallback, router.isReady, router.pathname])\n\n return (\n <PathnameContext.Provider value={value}>\n {children}\n </PathnameContext.Provider>\n )\n}\n"],"names":["React","useMemo","useRef","PathnameContext","isDynamicRoute","asPathToSearchParams","getRouteRegex","adaptForAppRouterInstance","pagesRouter","back","forward","refresh","reload","hmrRefresh","push","href","scroll","undefined","replace","prefetch","bfcacheId","adaptForSearchParams","router","isReady","query","URLSearchParams","asPath","adaptForPathParams","pathParams","routeRegex","pathname","keys","Object","groups","key","PathnameContextProviderAdapter","children","props","ref","isAutoExport","value","current","isFallback","url","URL","_","Provider"],"mappings":";AAIA,OAAOA,SAASC,OAAO,EAAEC,MAAM,QAAQ,QAAO;AAC9C,SAASC,eAAe,QAAQ,yCAAwC;AACxE,SAASC,cAAc,QAAQ,UAAS;AACxC,SAASC,oBAAoB,QAAQ,mCAAkC;AACvE,SAASC,aAAa,QAAQ,sBAAqB;AAEnD,wEAAwE,GACxE,OAAO,SAASC,0BACdC,WAAuB;IAEvB,OAAO;QACLC;YACED,YAAYC,IAAI;QAClB;QACAC;YACEF,YAAYE,OAAO;QACrB;QACAC;YACEH,YAAYI,MAAM;QACpB;QACAC,eAAc;QACdC,MAAKC,IAAI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AAyE;YACzE,uEAAuE;YACvE,MAAM;YACN,sFAAsF;YACtF,IAAIR,OAAOoB,UAAU,EAAE;gBACrB,OAAO;YACT;YAEA,oEAAoE;YACpE,wEAAwE;YACxE,mEAAmE;YACnE,mBAAmB;YACnB,0EAA0E;YAC1E,IAAIH,gBAAgB,CAACjB,OAAOC,OAAO,EAAE;gBACnC,OAAO;YACT;QACF;QAEA,2EAA2E;QAC3E,2EAA2E;QAC3E,2BAA2B;QAC3B,kEAAkE;QAClE,IAAIoB;QACJ,IAAI;YACFA,MAAM,IAAIC,IAAItB,OAAOI,MAAM,EAAE;QAC/B,EAAE,OAAOmB,GAAG;YACV,kDAAkD;YAClD,OAAO;QACT;QAEA,OAAOF,IAAIb,QAAQ;IACrB,GAAG;QAACR,OAAOI,MAAM;QAAEJ,OAAOoB,UAAU;QAAEpB,OAAOC,OAAO;QAAED,OAAOQ,QAAQ;KAAC;IAEtE,qBACE,KAAC3B,gBAAgB2C,QAAQ;QAACN,OAAOA;kBAC9BJ;;AAGP","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/router.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/router.js new file mode 100644 index 0000000000000000000000000000000000000000..e873bf218f57d0c28a324d6764793090d8450389 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/router.js @@ -0,0 +1,1824 @@ +import { removeTrailingSlash } from './utils/remove-trailing-slash'; +import { getClientBuildManifest, isAssetError, markAssetError } from '../../../client/route-loader'; +import { handleClientScriptLoad } from '../../../client/script'; +import isError, { getProperError } from '../../../lib/is-error'; +import { denormalizePagePath } from '../page-path/denormalize-page-path'; +import { normalizeLocalePath } from '../i18n/normalize-locale-path'; +import mitt from '../mitt'; +import { getLocationOrigin, getURL, loadGetInitialProps, ST } from '../utils'; +import { isDynamicRoute } from './utils/is-dynamic'; +import { parseRelativeUrl } from './utils/parse-relative-url'; +import { getRouteMatcher } from './utils/route-matcher'; +import { getRouteRegex } from './utils/route-regex'; +import { hasDynamicFilterCandidate } from './utils/dynamic-filter-pattern'; +import { formatWithValidation } from './utils/format-url'; +import { detectDomainLocale } from '../../../client/detect-domain-locale'; +import { parsePath } from './utils/parse-path'; +import { addLocale } from '../../../client/add-locale'; +import { removeLocale } from '../../../client/remove-locale'; +import { removeBasePath } from '../../../client/remove-base-path'; +import { addBasePath } from '../../../client/add-base-path'; +import { hasBasePath } from '../../../client/has-base-path'; +import { resolveHref } from '../../../client/resolve-href'; +import { isAPIRoute } from '../../../lib/is-api-route'; +import { getNextPathnameInfo } from './utils/get-next-pathname-info'; +import { formatNextPathnameInfo } from './utils/format-next-pathname-info'; +import { compareRouterStates } from './utils/compare-states'; +import { isLocalURL } from './utils/is-local-url'; +import { isBot } from './utils/is-bot'; +import { omit } from './utils/omit'; +import { interpolateAs } from './utils/interpolate-as'; +import { disableSmoothScrollDuringRouteTransition } from './utils/disable-smooth-scroll'; +import { MATCHED_PATH_HEADER, NEXT_NAV_DEPLOYMENT_ID_HEADER } from '../../../lib/constants'; +import { getDeploymentId } from '../deployment-id'; +import { isJavaScriptURLString } from '../../../client/lib/javascript-url'; +let resolveRewrites; +if (process.env.__NEXT_HAS_REWRITES) { + resolveRewrites = require('./utils/resolve-rewrites').default; +} +function buildCancellationError() { + return Object.assign(new Error('Route Cancelled'), { + cancelled: true + }); +} +export async function matchesMiddleware(options) { + const matchers = await Promise.resolve(options.router.pageLoader.getMiddleware()); + if (!matchers) return false; + const { pathname: asPathname } = parsePath(options.asPath); + // remove basePath first since path prefix has to be in the order of `/${basePath}/${locale}` + const cleanedAs = hasBasePath(asPathname) ? removeBasePath(asPathname) : asPathname; + const asWithBasePathAndLocale = addBasePath(addLocale(cleanedAs, options.locale)); + // Check only path match on client. Matching "has" should be done on server + // where we can access more info such as headers, HttpOnly cookie, etc. + return matchers.some((m)=>new RegExp(m.regexp).test(asWithBasePathAndLocale)); +} +function stripOrigin(url) { + const origin = getLocationOrigin(); + return url.startsWith(origin) ? url.substring(origin.length) : url; +} +function prepareUrlAs(router, url, as) { + // If url and as provided as an object representation, + // we'll format them into the string version here. + let [resolvedHref, resolvedAs] = resolveHref(router, url, true); + const origin = getLocationOrigin(); + const hrefWasAbsolute = resolvedHref.startsWith(origin); + const asWasAbsolute = resolvedAs && resolvedAs.startsWith(origin); + resolvedHref = stripOrigin(resolvedHref); + resolvedAs = resolvedAs ? stripOrigin(resolvedAs) : resolvedAs; + const preparedUrl = hrefWasAbsolute ? resolvedHref : addBasePath(resolvedHref); + const preparedAs = as ? stripOrigin(resolveHref(router, as)) : resolvedAs || resolvedHref; + return { + url: preparedUrl, + as: asWasAbsolute ? preparedAs : addBasePath(preparedAs) + }; +} +/** + * Key under which `prefetch()` stores the `{ __appRouter: true }` marker in + * `router.components` and under which `change()` looks it up again. + * + * The client router filter (`_bfl`) is evaluated against the `as` path, so the + * marker has to be keyed by the `as` path as well. Keying it by the `href` + * pathname is only equivalent while `href` and `as` are the same URL. When + * they differ (for example the "route as modal" pattern where `href` stays on + * the current page and `as` shows a pretty URL) a filter match on `as` would + * otherwise mark the pages route behind `href` as an App Router path and + * break every later navigation to that route. + * + * `as` is expected without the `basePath`, which is what both call sites + * hold: `prefetch()` receives it that way from `next/link` and `change()` + * strips it before computing `cleanedAs`. Stripping it again here would turn + * a route that merely starts with the `basePath` (for example the app route + * `/docs` with `basePath: '/docs'`) into `/` and poison the index page. + * + * The key also carries the effective locale, mirroring how `_bfl` evaluates + * `addLocale(as, locale)` against the filter. A match for a French-only + * redirect at `/fr/legacy` must not mark the English `/legacy` page. + * + * Returns `null` when `as` is not a local URL (for example `mailto:` or a + * different origin). Such an `as` can never be an App Router path, and + * `change()` reports it as an invalid `href`/`as` pair further down. + */ function getAppRouterMarkerKey(router, as, locale) { + if (!isLocalURL(as)) { + return null; + } + let { pathname } = parseRelativeUrl(as); + let effectiveLocale = locale || router.locale; + if (process.env.__NEXT_I18N_SUPPORT) { + const localePathResult = normalizeLocalePath(pathname, router.locales); + pathname = localePathResult.pathname; + effectiveLocale = localePathResult.detectedLocale || effectiveLocale; + } + return removeTrailingSlash(addLocale(removeTrailingSlash(pathname), effectiveLocale)); +} +function resolveDynamicRoute(pathname, pages) { + const cleanPathname = removeTrailingSlash(denormalizePagePath(pathname)); + if (cleanPathname === '/404' || cleanPathname === '/_error') { + return pathname; + } + // handle resolving href for dynamic routes + if (!pages.includes(cleanPathname)) { + // eslint-disable-next-line array-callback-return + pages.some((page)=>{ + if (isDynamicRoute(page) && getRouteRegex(page).re.test(cleanPathname)) { + pathname = page; + return true; + } + }); + } + return removeTrailingSlash(pathname); +} +function getMiddlewareData(source, response, options) { + const nextConfig = { + basePath: options.router.basePath, + i18n: { + locales: options.router.locales + }, + trailingSlash: Boolean(process.env.__NEXT_TRAILING_SLASH) + }; + const rewriteHeader = response.headers.get('x-nextjs-rewrite'); + let rewriteTarget = rewriteHeader || response.headers.get('x-nextjs-matched-path'); + const matchedPath = response.headers.get(MATCHED_PATH_HEADER); + if (matchedPath && !rewriteTarget && !matchedPath.includes('__next_data_catchall') && !matchedPath.includes('/_error') && !matchedPath.includes('/404')) { + // leverage x-matched-path to detect next.config.js rewrites + rewriteTarget = matchedPath; + } + if (rewriteTarget) { + if (rewriteTarget.startsWith('/') || process.env.__NEXT_EXTERNAL_MIDDLEWARE_REWRITE_RESOLVE) { + const parsedRewriteTarget = parseRelativeUrl(rewriteTarget); + const pathnameInfo = getNextPathnameInfo(parsedRewriteTarget.pathname, { + nextConfig, + parseData: true + }); + let fsPathname = removeTrailingSlash(pathnameInfo.pathname); + return Promise.all([ + options.router.pageLoader.getPageList(), + getClientBuildManifest() + ]).then(([pages, { __rewrites: rewrites }])=>{ + let as = addLocale(pathnameInfo.pathname, pathnameInfo.locale); + if (isDynamicRoute(as) || !rewriteHeader && pages.includes(normalizeLocalePath(removeBasePath(as), options.router.locales).pathname)) { + const parsedSource = getNextPathnameInfo(parseRelativeUrl(source).pathname, { + // Pass basePath (and trailingSlash) so the basePath prefix is + // stripped before the `_next/data/` check, but omit `i18n` so the + // locale prefix is preserved here — the rewrite resolver below + // handles the locale-prefixed `as`. + nextConfig: { + basePath: nextConfig.basePath, + trailingSlash: nextConfig.trailingSlash + }, + parseData: true + }); + as = addBasePath(parsedSource.pathname); + parsedRewriteTarget.pathname = as; + } + if (process.env.__NEXT_HAS_REWRITES) { + const result = resolveRewrites(as, pages, rewrites, parsedRewriteTarget.query, (path)=>resolveDynamicRoute(path, pages), options.router.locales); + if (result.matchedPage) { + parsedRewriteTarget.pathname = result.parsedAs.pathname; + as = parsedRewriteTarget.pathname; + Object.assign(parsedRewriteTarget.query, result.parsedAs.query); + } + } else if (!pages.includes(fsPathname)) { + const resolvedPathname = resolveDynamicRoute(fsPathname, pages); + if (resolvedPathname !== fsPathname) { + fsPathname = resolvedPathname; + } + } + const resolvedHref = !pages.includes(fsPathname) ? resolveDynamicRoute(normalizeLocalePath(removeBasePath(parsedRewriteTarget.pathname), options.router.locales).pathname, pages) : fsPathname; + if (isDynamicRoute(resolvedHref)) { + const matches = getRouteMatcher(getRouteRegex(resolvedHref))(as); + Object.assign(parsedRewriteTarget.query, matches || {}); + } + return { + type: 'rewrite', + parsedAs: parsedRewriteTarget, + resolvedHref + }; + }); + } + const src = parsePath(source); + const pathname = formatNextPathnameInfo({ + ...getNextPathnameInfo(src.pathname, { + nextConfig, + parseData: true + }), + defaultLocale: options.router.defaultLocale, + buildId: '' + }); + return Promise.resolve({ + type: 'redirect-external', + destination: `${pathname}${src.query}${src.hash}` + }); + } + const redirectTarget = response.headers.get('x-nextjs-redirect'); + if (redirectTarget) { + if (redirectTarget.startsWith('/')) { + const src = parsePath(redirectTarget); + const pathname = formatNextPathnameInfo({ + ...getNextPathnameInfo(src.pathname, { + nextConfig, + parseData: true + }), + defaultLocale: options.router.defaultLocale, + buildId: '' + }); + return Promise.resolve({ + type: 'redirect-internal', + newAs: `${pathname}${src.query}${src.hash}`, + newUrl: `${pathname}${src.query}${src.hash}` + }); + } + return Promise.resolve({ + type: 'redirect-external', + destination: redirectTarget + }); + } + return Promise.resolve({ + type: 'next' + }); +} +async function withMiddlewareEffects(options) { + const matches = await matchesMiddleware(options); + if (!matches || !options.fetchData) { + return null; + } + const data = await options.fetchData(); + const effect = await getMiddlewareData(data.dataHref, data.response, options); + return { + dataHref: data.dataHref, + json: data.json, + response: data.response, + text: data.text, + cacheKey: data.cacheKey, + effect + }; +} +const manualScrollRestoration = process.env.__NEXT_SCROLL_RESTORATION && typeof window !== 'undefined' && 'scrollRestoration' in window.history && !!function() { + try { + let v = '__next'; + return sessionStorage.setItem(v, v), sessionStorage.removeItem(v), true; + } catch (n) {} +}(); +const SSG_DATA_NOT_FOUND = Symbol('SSG_DATA_NOT_FOUND'); +function fetchRetry(url, attempts, options) { + return fetch(url, { + // Cookies are required to be present for Next.js' SSG "Preview Mode". + // Cookies may also be required for `getServerSideProps`. + // + // > `fetch` won’t send cookies, unless you set the credentials init + // > option. + // https://developer.mozilla.org/docs/Web/API/Fetch_API/Using_Fetch + // + // > For maximum browser compatibility when it comes to sending & + // > receiving cookies, always supply the `credentials: 'same-origin'` + // > option instead of relying on the default. + // https://github.com/github/fetch#caveats + credentials: 'same-origin', + method: options.method || 'GET', + headers: Object.assign({}, options.headers, { + 'x-nextjs-data': '1' + }) + }).then((response)=>{ + return !response.ok && attempts > 1 && response.status >= 500 ? fetchRetry(url, attempts - 1, options) : response; + }); +} +function tryToParseAsJSON(text) { + try { + return JSON.parse(text); + } catch (error) { + return null; + } +} +function fetchNextData({ dataHref, inflightCache, isPrefetch, hasMiddleware, isServerRender, parseJSON, persistCache, isBackground, unstable_skipClientCache }) { + const { href: cacheKey } = new URL(dataHref, window.location.href); + const deploymentId = getDeploymentId(); + const getData = (params)=>fetchRetry(dataHref, isServerRender ? 3 : 1, { + headers: Object.assign({}, isPrefetch ? { + purpose: 'prefetch' + } : {}, isPrefetch && hasMiddleware ? { + 'x-middleware-prefetch': '1' + } : {}, deploymentId ? { + 'x-deployment-id': deploymentId + } : {}), + method: params?.method ?? 'GET' + }).then((response)=>{ + if (response.ok && params?.method === 'HEAD') { + return { + dataHref, + response, + text: '', + json: {}, + cacheKey + }; + } + return response.text().then((text)=>{ + if (!response.ok) { + /** + * When the data response is a redirect because of a middleware + * we do not consider it an error. The headers must bring the + * mapped location. + * TODO: Change the status code in the handler. + */ if (hasMiddleware && [ + 301, + 302, + 307, + 308 + ].includes(response.status)) { + return { + dataHref, + response, + text, + json: {}, + cacheKey + }; + } + if (response.status === 404) { + if (tryToParseAsJSON(text)?.notFound) { + return { + dataHref, + json: { + notFound: SSG_DATA_NOT_FOUND + }, + response, + text, + cacheKey + }; + } + } + const error = new Error(`Failed to load static props`); + /** + * We should only trigger a server-side transition if this was + * caused on a client-side transition. Otherwise, we'd get into + * an infinite loop. + */ if (!isServerRender) { + markAssetError(error); + } + throw error; + } + let dplResponseHeader = response.headers.get(NEXT_NAV_DEPLOYMENT_ID_HEADER); + if (dplResponseHeader != null && dplResponseHeader !== deploymentId) { + // When not found, or we want to force a MPA navigation because of Skew Protection + const error = new Error(`Loaded static props were from an outdated deployment, forcing a hard reload`); + /** + * We should only trigger a server-side transition if this was + * caused on a client-side transition. Otherwise, we'd get into + * an infinite loop. + */ if (!isServerRender) { + markAssetError(error); + } + throw error; + } + return { + dataHref, + json: parseJSON ? tryToParseAsJSON(text) : null, + response, + text, + cacheKey + }; + }); + }).then((data)=>{ + if (!persistCache || process.env.NODE_ENV !== 'production' || data.response.headers.get('x-middleware-cache') === 'no-cache') { + delete inflightCache[cacheKey]; + } + return data; + }).catch((err)=>{ + if (!unstable_skipClientCache) { + delete inflightCache[cacheKey]; + } + if (// chrome + err.message === 'Failed to fetch' || // firefox + err.message === 'NetworkError when attempting to fetch resource.' || // safari + err.message === 'Load failed') { + markAssetError(err); + } + throw err; + }); + // when skipping client cache we wait to update + // inflight cache until successful data response + // this allows racing click event with fetching newer data + // without blocking navigation when stale data is available + if (unstable_skipClientCache && persistCache) { + return getData({}).then((data)=>{ + if (data.response.headers.get('x-middleware-cache') !== 'no-cache') { + // only update cache if not marked as no-cache + inflightCache[cacheKey] = Promise.resolve(data); + } + return data; + }); + } + if (inflightCache[cacheKey] !== undefined) { + return inflightCache[cacheKey]; + } + return inflightCache[cacheKey] = getData(isBackground ? { + method: 'HEAD' + } : {}); +} +export function createKey() { + return Math.random().toString(36).slice(2, 10); +} +function handleHardNavigation({ url, router }) { + // ensure we don't trigger a hard navigation to the same + // URL as this can end up with an infinite refresh + if (url === addBasePath(addLocale(router.asPath, router.locale))) { + throw new Error(`Invariant: attempted to hard navigate to the same URL ${url} ${location.href}`); + } + window.location.href = url; +} +const getCancelledHandler = ({ route, router })=>{ + let cancelled = false; + const cancel = router.clc = ()=>{ + cancelled = true; + }; + const handleCancelled = ()=>{ + if (cancelled) { + const error = new Error(`Abort fetching component for route: "${route}"`); + error.cancelled = true; + throw error; + } + if (cancel === router.clc) { + router.clc = null; + } + }; + return handleCancelled; +}; +export default class Router { + static{ + this.events = mitt(); + } + constructor(pathname, query, as, { initialProps, pageLoader, App, wrapApp, Component, err, subscription, isFallback, locale, locales, defaultLocale, domainLocales, isPreview }){ + // Server Data Cache (full data requests) + this.sdc = {}; + // Server Background Cache (HEAD requests) + this.sbc = {}; + this.isFirstPopStateEvent = true; + this._key = createKey(); + this.onPopState = (e)=>{ + const { isFirstPopStateEvent } = this; + this.isFirstPopStateEvent = false; + const state = e.state; + if (!state) { + // We get state as undefined for two reasons. + // 1. With older safari (< 8) and older chrome (< 34) + // 2. When the URL changed with # + // + // In the both cases, we don't need to proceed and change the route. + // (as it's already changed) + // But we can simply replace the state with the new changes. + // Actually, for (1) we don't need to nothing. But it's hard to detect that event. + // So, doing the following for (1) does no harm. + const { pathname, query } = this; + this.changeState('replaceState', formatWithValidation({ + pathname: addBasePath(pathname), + query + }), getURL()); + return; + } + // __NA is used to identify if the history entry can be handled by the app-router. + if (state.__NA) { + window.location.reload(); + return; + } + if (!state.__N) { + return; + } + // Safari fires popstateevent when reopening the browser. + if (isFirstPopStateEvent && this.locale === state.options.locale && state.as === this.asPath) { + return; + } + let forcedScroll; + const { url, as, options, key } = state; + if (process.env.__NEXT_SCROLL_RESTORATION) { + if (manualScrollRestoration) { + if (this._key !== key) { + // Snapshot current scroll position: + try { + sessionStorage.setItem('__next_scroll_' + this._key, JSON.stringify({ + x: self.pageXOffset, + y: self.pageYOffset + })); + } catch {} + // Restore old scroll position: + try { + const v = sessionStorage.getItem('__next_scroll_' + key); + forcedScroll = JSON.parse(v); + } catch { + forcedScroll = { + x: 0, + y: 0 + }; + } + } + } + } + this._key = key; + const { pathname } = parseRelativeUrl(url); + // Make sure we don't re-render on initial load, + // can be caused by navigating back from an external site + if (this.isSsr && as === addBasePath(this.asPath) && pathname === addBasePath(this.pathname)) { + return; + } + // If the downstream application returns falsy, return. + // They will then be responsible for handling the event. + if (this._bps && !this._bps(state)) { + return; + } + this.change('replaceState', url, as, Object.assign({}, options, { + shallow: options.shallow && this._shallow, + locale: options.locale || this.defaultLocale, + // @ts-ignore internal value not exposed on types + _h: 0 + }), forcedScroll); + }; + // represents the current component key + const route = removeTrailingSlash(pathname); + // set up the component cache (by route keys) + this.components = {}; + // We should not keep the cache, if there's an error + // Otherwise, this cause issues when when going back and + // come again to the errored page. + if (pathname !== '/_error') { + this.components[route] = { + Component, + initial: true, + props: initialProps, + err, + __N_SSG: initialProps && initialProps.__N_SSG, + __N_SSP: initialProps && initialProps.__N_SSP + }; + } + this.components['/_app'] = { + Component: App, + styleSheets: [] + }; + // Backwards compat for Router.router.events + // TODO: Should be remove the following major version as it was never documented + this.events = Router.events; + this.pageLoader = pageLoader; + // if auto prerendered and dynamic route wait to update asPath + // until after mount to prevent hydration mismatch + const autoExportDynamic = isDynamicRoute(pathname) && self.__NEXT_DATA__.autoExport; + this.basePath = process.env.__NEXT_ROUTER_BASEPATH || ''; + this.sub = subscription; + this.clc = null; + this._wrapApp = wrapApp; + // make sure to ignore extra popState in safari on navigating + // back from external site + this.isSsr = true; + this.isLocaleDomain = false; + this.isReady = !!(self.__NEXT_DATA__.gssp || self.__NEXT_DATA__.gip || self.__NEXT_DATA__.isExperimentalCompile || self.__NEXT_DATA__.appGip && !self.__NEXT_DATA__.gsp || !autoExportDynamic && !self.location.search && !process.env.__NEXT_HAS_REWRITES); + if (process.env.__NEXT_I18N_SUPPORT) { + this.locales = locales; + this.defaultLocale = defaultLocale; + this.domainLocales = domainLocales; + this.isLocaleDomain = !!detectDomainLocale(domainLocales, self.location.hostname); + } + this.state = { + route, + pathname, + query, + asPath: autoExportDynamic ? pathname : as, + isPreview: !!isPreview, + locale: process.env.__NEXT_I18N_SUPPORT ? locale : undefined, + isFallback + }; + this._initialMatchesMiddlewarePromise = Promise.resolve(false); + if (typeof window !== 'undefined') { + // make sure "as" doesn't start with double slashes or else it can + // throw an error as it's considered invalid + if (!as.startsWith('//')) { + // in order for `e.state` to work on the `onpopstate` event + // we have to register the initial route upon initialization + const options = { + locale + }; + const asPath = getURL(); + this._initialMatchesMiddlewarePromise = matchesMiddleware({ + router: this, + locale, + asPath + }).then((matches)=>{ + // if middleware matches we leave resolving to the change function + // as the server needs to resolve for correct priority + ; + options._shouldResolveHref = as !== pathname; + this.changeState('replaceState', matches ? asPath : formatWithValidation({ + pathname: addBasePath(pathname), + query + }), asPath, options); + return matches; + }); + } + window.addEventListener('popstate', this.onPopState); + // enable custom scroll restoration handling when available + // otherwise fallback to browser's default handling + if (process.env.__NEXT_SCROLL_RESTORATION) { + if (manualScrollRestoration) { + window.history.scrollRestoration = 'manual'; + } + } + } + } + reload() { + window.location.reload(); + } + /** + * Go back in history + */ back() { + window.history.back(); + } + /** + * Go forward in history + */ forward() { + window.history.forward(); + } + /** + * Performs a `pushState` with arguments + * @param url of the route + * @param as masks `url` for the browser + * @param options object you can define `shallow` and other options + */ push(url, as, options = {}) { + if (isJavaScriptURLString(url.toString()) || as && isJavaScriptURLString(as.toString())) { + throw new Error('Next.js has blocked a javascript: URL as a security precaution.'); + } + if (process.env.__NEXT_SCROLL_RESTORATION) { + // TODO: remove in the future when we update history before route change + // is complete, as the popstate event should handle this capture. + if (manualScrollRestoration) { + try { + // Snapshot scroll position right before navigating to a new page: + sessionStorage.setItem('__next_scroll_' + this._key, JSON.stringify({ + x: self.pageXOffset, + y: self.pageYOffset + })); + } catch {} + } + } + ; + ({ url, as } = prepareUrlAs(this, url, as)); + return this.change('pushState', url, as, options); + } + /** + * Performs a `replaceState` with arguments + * @param url of the route + * @param as masks `url` for the browser + * @param options object you can define `shallow` and other options + */ replace(url, as, options = {}) { + if (isJavaScriptURLString(url.toString()) || as && isJavaScriptURLString(as.toString())) { + throw new Error('Next.js has blocked a javascript: URL as a security precaution.'); + } + ; + ({ url, as } = prepareUrlAs(this, url, as)); + return this.change('replaceState', url, as, options); + } + async _bfl(as, resolvedAs, locale, skipNavigate) { + if (process.env.__NEXT_CLIENT_ROUTER_FILTER_ENABLED) { + if (!this._bfl_s && !this._bfl_d) { + const { BloomFilter } = require('../../lib/bloom-filter'); + let staticFilterData; + let dynamicFilterData; + try { + ; + ({ __routerFilterStatic: staticFilterData, __routerFilterDynamic: dynamicFilterData } = await getClientBuildManifest()); + } catch (err) { + // failed to load build manifest hard navigate + // to be safe + console.error(err); + if (skipNavigate) { + return true; + } + handleHardNavigation({ + url: addBasePath(addLocale(as, locale || this.locale, this.defaultLocale)), + router: this + }); + return new Promise(()=>{}); + } + const routerFilterSValue = process.env.__NEXT_CLIENT_ROUTER_S_FILTER; + if (!staticFilterData && routerFilterSValue) { + staticFilterData = routerFilterSValue ? routerFilterSValue : undefined; + } + const routerFilterDValue = process.env.__NEXT_CLIENT_ROUTER_D_FILTER; + if (!dynamicFilterData && routerFilterDValue) { + dynamicFilterData = routerFilterDValue ? routerFilterDValue : undefined; + } + if (staticFilterData?.numHashes) { + this._bfl_s = new BloomFilter(staticFilterData.numItems, staticFilterData.errorRate); + this._bfl_s.import(staticFilterData); + } + if (dynamicFilterData?.numHashes) { + this._bfl_d = new BloomFilter(dynamicFilterData.numItems, dynamicFilterData.errorRate); + this._bfl_d.import(dynamicFilterData); + } + } + let matchesBflStatic = false; + let matchesBflDynamic = false; + const pathsToCheck = [ + { + as + }, + { + as: resolvedAs + } + ]; + for (const { as: curAs, allowMatchCurrent } of pathsToCheck){ + if (curAs) { + const asNoSlash = removeTrailingSlash(new URL(curAs, 'http://n').pathname); + const asNoSlashLocale = addBasePath(addLocale(asNoSlash, locale || this.locale)); + if (allowMatchCurrent || asNoSlash !== removeTrailingSlash(new URL(this.asPath, 'http://n').pathname)) { + matchesBflStatic = matchesBflStatic || !!this._bfl_s?.contains(asNoSlash) || !!this._bfl_s?.contains(asNoSlashLocale); + for (const normalizedAS of [ + asNoSlash, + asNoSlashLocale + ]){ + // if any sub-path of as matches a dynamic filter path + // it should be hard navigated + const curAsParts = normalizedAS.split('/'); + for(let i = 0; !matchesBflDynamic && i < curAsParts.length + 1; i++){ + const currentPart = curAsParts.slice(0, i).join('/'); + if (currentPart && this._bfl_d?.contains(currentPart)) { + matchesBflDynamic = true; + break; + } + } + } + // if the client router filter is matched then we trigger + // a hard navigation + if (matchesBflStatic || matchesBflDynamic) { + if (skipNavigate) { + return true; + } + handleHardNavigation({ + url: addBasePath(addLocale(as, locale || this.locale, this.defaultLocale)), + router: this + }); + return new Promise(()=>{}); + } + } + } + } + } + return false; + } + async change(method, url, as, options, forcedScroll) { + if (!isLocalURL(url)) { + handleHardNavigation({ + url, + router: this + }); + return false; + } + // WARNING: `_h` is an internal option for handing Next.js client-side + // hydration. Your app should _never_ use this property. It may change at + // any time without notice. + const isQueryUpdating = options._h === 1; + if (!isQueryUpdating && !options.shallow) { + await this._bfl(as, undefined, options.locale); + } + let shouldResolveHref = isQueryUpdating || options._shouldResolveHref || parsePath(url).pathname === parsePath(as).pathname; + const nextState = { + ...this.state + }; + // for static pages with query params in the URL we delay + // marking the router ready until after the query is updated + // or a navigation has occurred + const readyStateChange = this.isReady !== true; + this.isReady = true; + const isSsr = this.isSsr; + if (!isQueryUpdating) { + this.isSsr = false; + } + // if a route transition is already in progress before + // the query updating is triggered ignore query updating + if (isQueryUpdating && this.clc) { + return false; + } + const prevLocale = nextState.locale; + if (process.env.__NEXT_I18N_SUPPORT) { + nextState.locale = options.locale === false ? this.defaultLocale : options.locale || nextState.locale; + if (typeof options.locale === 'undefined') { + options.locale = nextState.locale; + } + const parsedAs = parseRelativeUrl(hasBasePath(as) ? removeBasePath(as) : as); + const localePathResult = normalizeLocalePath(parsedAs.pathname, this.locales); + if (localePathResult.detectedLocale) { + nextState.locale = localePathResult.detectedLocale; + parsedAs.pathname = addBasePath(parsedAs.pathname); + as = formatWithValidation(parsedAs); + url = addBasePath(normalizeLocalePath(hasBasePath(url) ? removeBasePath(url) : url, this.locales).pathname); + } + let didNavigate = false; + // we need to wrap this in the env check again since regenerator runtime + // moves this on its own due to the return + if (process.env.__NEXT_I18N_SUPPORT) { + // if the locale isn't configured hard navigate to show 404 page + if (!this.locales?.includes(nextState.locale)) { + parsedAs.pathname = addLocale(parsedAs.pathname, nextState.locale); + handleHardNavigation({ + url: formatWithValidation(parsedAs), + router: this + }); + // this was previously a return but was removed in favor + // of better dead code elimination with regenerator runtime + didNavigate = true; + } + } + const detectedDomain = detectDomainLocale(this.domainLocales, undefined, nextState.locale); + // we need to wrap this in the env check again since regenerator runtime + // moves this on its own due to the return + if (process.env.__NEXT_I18N_SUPPORT) { + // if we are navigating to a domain locale ensure we redirect to the + // correct domain + if (!didNavigate && detectedDomain && this.isLocaleDomain && self.location.hostname !== detectedDomain.domain) { + const asNoBasePath = removeBasePath(as); + handleHardNavigation({ + url: `http${detectedDomain.http ? '' : 's'}://${detectedDomain.domain}${addBasePath(`${nextState.locale === detectedDomain.defaultLocale ? '' : `/${nextState.locale}`}${asNoBasePath === '/' ? '' : asNoBasePath}` || '/')}`, + router: this + }); + // this was previously a return but was removed in favor + // of better dead code elimination with regenerator runtime + didNavigate = true; + } + } + if (didNavigate) { + return new Promise(()=>{}); + } + } + // marking route changes as a navigation start entry + if (ST) { + performance.mark('routeChange'); + } + const { shallow = false, scroll = true } = options; + const routeProps = { + shallow + }; + if (this._inFlightRoute && this.clc) { + if (!isSsr) { + Router.events.emit('routeChangeError', buildCancellationError(), this._inFlightRoute, routeProps); + } + this.clc(); + this.clc = null; + } + as = addBasePath(addLocale(hasBasePath(as) ? removeBasePath(as) : as, options.locale, this.defaultLocale)); + const cleanedAs = removeLocale(hasBasePath(as) ? removeBasePath(as) : as, nextState.locale); + this._inFlightRoute = as; + const localeChange = prevLocale !== nextState.locale; + // If the url change is only related to a hash change + // We should not proceed. We should only change the state. + if (!isQueryUpdating && this.onlyAHashChange(cleanedAs) && !localeChange) { + nextState.asPath = cleanedAs; + Router.events.emit('hashChangeStart', as, routeProps); + // TODO: do we need the resolved href when only a hash change? + this.changeState(method, url, as, { + ...options, + scroll: false + }); + if (scroll) { + this.scrollToHash(cleanedAs); + } + try { + await this.set(nextState, this.components[nextState.route], null); + } catch (err) { + if (isError(err) && err.cancelled) { + Router.events.emit('routeChangeError', err, cleanedAs, routeProps); + } + throw err; + } + Router.events.emit('hashChangeComplete', as, routeProps); + return true; + } + let parsed = parseRelativeUrl(url); + let { pathname, query } = parsed; + // The build manifest needs to be loaded before auto-static dynamic pages + // get their query parameters to allow ensuring they can be parsed properly + // when rewritten to + let pages, rewrites; + try { + ; + [pages, { __rewrites: rewrites }] = await Promise.all([ + this.pageLoader.getPageList(), + getClientBuildManifest(), + this.pageLoader.getMiddleware() + ]); + } catch (err) { + // If we fail to resolve the page list or client-build manifest, we must + // do a server-side transition: + handleHardNavigation({ + url: as, + router: this + }); + return false; + } + // If asked to change the current URL we should reload the current page + // (not location.reload() but reload getInitialProps and other Next.js stuffs) + // We also need to set the method = replaceState always + // as this should not go into the history (That's how browsers work) + // We should compare the new asPath to the current asPath, not the url + if (!this.urlIsNew(cleanedAs) && !localeChange) { + method = 'replaceState'; + } + // we need to resolve the as value using rewrites for dynamic SSG + // pages to allow building the data URL correctly + let resolvedAs = as; + // url and as should always be prefixed with basePath by this + // point by either next/link or router.push/replace so strip the + // basePath from the pathname to match the pages dir 1-to-1 + pathname = pathname ? removeTrailingSlash(removeBasePath(pathname)) : pathname; + let route = removeTrailingSlash(pathname); + const parsedAsPathname = as.startsWith('/') && parseRelativeUrl(as).pathname; + // if we detected the `as` path as app route during prefetching + // trigger hard navigation. The marker is keyed by the `as` path, but a + // marker can also sit under the href route when both paths share a + // pages route (`pages/modal.js` next to `app/modal/[id]/page.js`). + // Check both so `getRouteInfo()` never reads a marker as component data. + const appRouterMarkerKey = getAppRouterMarkerKey(this, cleanedAs, nextState.locale); + if (appRouterMarkerKey !== null && this.components[appRouterMarkerKey]?.__appRouter || this.components[route]?.__appRouter) { + handleHardNavigation({ + url: as, + router: this + }); + return new Promise(()=>{}); + } + const isMiddlewareRewrite = !!(parsedAsPathname && route !== parsedAsPathname && (!isDynamicRoute(route) || !getRouteMatcher(getRouteRegex(route))(parsedAsPathname))); + // we don't attempt resolve asPath when we need to execute + // middleware as the resolving will occur server-side + const isMiddlewareMatch = !options.shallow && await matchesMiddleware({ + asPath: as, + locale: nextState.locale, + router: this + }); + if (isQueryUpdating && isMiddlewareMatch) { + shouldResolveHref = false; + } + if (shouldResolveHref && pathname !== '/_error') { + ; + options._shouldResolveHref = true; + if (process.env.__NEXT_HAS_REWRITES && as.startsWith('/')) { + const rewritesResult = resolveRewrites(addBasePath(addLocale(cleanedAs, nextState.locale), true), pages, rewrites, query, (p)=>resolveDynamicRoute(p, pages), this.locales); + if (rewritesResult.externalDest) { + handleHardNavigation({ + url: as, + router: this + }); + return true; + } + if (!isMiddlewareMatch) { + resolvedAs = rewritesResult.asPath; + } + if (rewritesResult.matchedPage && rewritesResult.resolvedHref) { + // if this directly matches a page we need to update the href to + // allow the correct page chunk to be loaded + pathname = rewritesResult.resolvedHref; + parsed.pathname = addBasePath(pathname); + if (!isMiddlewareMatch) { + url = formatWithValidation(parsed); + } + } + } else { + parsed.pathname = resolveDynamicRoute(pathname, pages); + if (parsed.pathname !== pathname) { + pathname = parsed.pathname; + parsed.pathname = addBasePath(pathname); + if (!isMiddlewareMatch) { + url = formatWithValidation(parsed); + } + } + } + } + // The pages client router resolves a navigation against pages routes only. + // When it resolves to a dynamic pages route, an app route that begins with + // a dynamic segment may be more specific and own this path on the server + // (e.g. `/en/about` resolves to the pages route `/[locale]/[category]`, but + // the app route `/[locale]/about` should win). Such app routes have no + // static prefix for the early `_bfl` check, so reconstruct the candidate + // patterns from the resolved route and hard navigate when one is in the + // dynamic filter. + if (!isQueryUpdating && !options.shallow && process.env.__NEXT_CLIENT_ROUTER_FILTER_ENABLED && this._bfl_d && isDynamicRoute(pathname)) { + const concretePathname = removeTrailingSlash(parseRelativeUrl(cleanedAs).pathname); + const isShadowedByAppRoute = hasDynamicFilterCandidate(pathname, concretePathname, (candidate)=>!!this._bfl_d?.contains(candidate)); + if (isShadowedByAppRoute) { + handleHardNavigation({ + url: as, + router: this + }); + return new Promise(()=>{}); + } + } + if (!isLocalURL(as)) { + if (process.env.NODE_ENV !== 'production') { + throw new Error(`Invalid href: "${url}" and as: "${as}", received relative href and external as` + `\nSee more info: https://nextjs.org/docs/messages/invalid-relative-url-external-as`); + } + handleHardNavigation({ + url: as, + router: this + }); + return false; + } + resolvedAs = removeLocale(removeBasePath(resolvedAs), nextState.locale); + route = removeTrailingSlash(pathname); + // A config rewrite can resolve `href` to another pages route after the + // marker guard above ran. That route can hold a marker from an earlier + // prefetch, so check it again before `getRouteInfo()` reads the cache. + if (this.components[route]?.__appRouter) { + handleHardNavigation({ + url: as, + router: this + }); + return new Promise(()=>{}); + } + let routeMatch = false; + if (isDynamicRoute(route)) { + const parsedAs = parseRelativeUrl(resolvedAs); + const asPathname = parsedAs.pathname; + const routeRegex = getRouteRegex(route); + routeMatch = getRouteMatcher(routeRegex)(asPathname); + const shouldInterpolate = route === asPathname; + const interpolatedAs = shouldInterpolate ? interpolateAs(route, asPathname, query) : {}; + if (!routeMatch || shouldInterpolate && !interpolatedAs.result) { + const missingParams = Object.keys(routeRegex.groups).filter((param)=>!query[param] && !routeRegex.groups[param].optional); + if (missingParams.length > 0 && !isMiddlewareMatch) { + if (process.env.NODE_ENV !== 'production') { + console.warn(`${shouldInterpolate ? `Interpolating href` : `Mismatching \`as\` and \`href\``} failed to manually provide ` + `the params: ${missingParams.join(', ')} in the \`href\`'s \`query\``); + } + throw new Error((shouldInterpolate ? `The provided \`href\` (${url}) value is missing query values (${missingParams.join(', ')}) to be interpolated properly. ` : `The provided \`as\` value (${asPathname}) is incompatible with the \`href\` value (${route}). `) + `Read more: https://nextjs.org/docs/messages/${shouldInterpolate ? 'href-interpolation-failed' : 'incompatible-href-as'}`); + } + } else if (shouldInterpolate) { + as = formatWithValidation(Object.assign({}, parsedAs, { + pathname: interpolatedAs.result, + query: omit(query, interpolatedAs.params) + })); + } else { + // Merge params into `query`, overwriting any specified in search + Object.assign(query, routeMatch); + } + } + if (!isQueryUpdating) { + Router.events.emit('routeChangeStart', as, routeProps); + } + const isErrorRoute = this.pathname === '/404' || this.pathname === '/_error'; + try { + let routeInfo = await this.getRouteInfo({ + route, + pathname, + query, + as, + resolvedAs, + routeProps, + locale: nextState.locale, + isPreview: nextState.isPreview, + hasMiddleware: isMiddlewareMatch, + unstable_skipClientCache: options.unstable_skipClientCache, + isQueryUpdating: isQueryUpdating && !this.isFallback, + isMiddlewareRewrite + }); + if (!isQueryUpdating && !options.shallow) { + await this._bfl(as, 'resolvedAs' in routeInfo ? routeInfo.resolvedAs : undefined, nextState.locale); + } + if ('route' in routeInfo && isMiddlewareMatch) { + pathname = routeInfo.route || route; + route = pathname; + if (!routeProps.shallow) { + query = Object.assign({}, routeInfo.query || {}, query); + } + const cleanedParsedPathname = hasBasePath(parsed.pathname) ? removeBasePath(parsed.pathname) : parsed.pathname; + if (routeMatch && pathname !== cleanedParsedPathname) { + Object.keys(routeMatch).forEach((key)=>{ + if (routeMatch && query[key] === routeMatch[key]) { + delete query[key]; + } + }); + } + if (isDynamicRoute(pathname)) { + const prefixedAs = !routeProps.shallow && routeInfo.resolvedAs ? routeInfo.resolvedAs : addBasePath(addLocale(new URL(as, location.href).pathname, nextState.locale), true); + let rewriteAs = prefixedAs; + if (hasBasePath(rewriteAs)) { + rewriteAs = removeBasePath(rewriteAs); + } + if (process.env.__NEXT_I18N_SUPPORT) { + const localeResult = normalizeLocalePath(rewriteAs, this.locales); + nextState.locale = localeResult.detectedLocale || nextState.locale; + rewriteAs = localeResult.pathname; + } + const routeRegex = getRouteRegex(pathname); + const curRouteMatch = getRouteMatcher(routeRegex)(new URL(rewriteAs, location.href).pathname); + if (curRouteMatch) { + Object.assign(query, curRouteMatch); + } + } + } + // If the routeInfo brings a redirect we simply apply it. + if ('type' in routeInfo) { + if (routeInfo.type === 'redirect-internal') { + return this.change(method, routeInfo.newUrl, routeInfo.newAs, options); + } else { + handleHardNavigation({ + url: routeInfo.destination, + router: this + }); + return new Promise(()=>{}); + } + } + const component = routeInfo.Component; + if (component && component.unstable_scriptLoader) { + const scripts = [].concat(component.unstable_scriptLoader()); + scripts.forEach((script)=>{ + handleClientScriptLoad(script.props); + }); + } + // handle redirect on client-transition + if ((routeInfo.__N_SSG || routeInfo.__N_SSP) && routeInfo.props) { + if (routeInfo.props.pageProps && routeInfo.props.pageProps.__N_REDIRECT) { + // Use the destination from redirect without adding locale + options.locale = false; + const destination = routeInfo.props.pageProps.__N_REDIRECT; + // check if destination is internal (resolves to a page) and attempt + // client-navigation if it is falling back to hard navigation if + // it's not + if (destination.startsWith('/') && routeInfo.props.pageProps.__N_REDIRECT_BASE_PATH !== false) { + const parsedHref = parseRelativeUrl(destination); + parsedHref.pathname = resolveDynamicRoute(parsedHref.pathname, pages); + const { url: newUrl, as: newAs } = prepareUrlAs(this, destination, destination); + return this.change(method, newUrl, newAs, options); + } + handleHardNavigation({ + url: destination, + router: this + }); + return new Promise(()=>{}); + } + nextState.isPreview = !!routeInfo.props.__N_PREVIEW; + // handle SSG data 404 + if (routeInfo.props.notFound === SSG_DATA_NOT_FOUND) { + let notFoundRoute; + try { + await this.fetchComponent('/404'); + notFoundRoute = '/404'; + } catch (_) { + notFoundRoute = '/_error'; + } + routeInfo = await this.getRouteInfo({ + route: notFoundRoute, + pathname: notFoundRoute, + query, + as, + resolvedAs, + routeProps: { + shallow: false + }, + locale: nextState.locale, + isPreview: nextState.isPreview, + isNotFound: true + }); + if ('type' in routeInfo) { + throw new Error(`Unexpected middleware effect on /404`); + } + } + } + if (isQueryUpdating && this.pathname === '/_error' && self.__NEXT_DATA__.props?.pageProps?.statusCode === 500 && routeInfo.props?.pageProps) { + // ensure statusCode is still correct for static 500 page + // when updating query information + routeInfo.props.pageProps.statusCode = 500; + } + // shallow routing is only allowed for same page URL changes. + const isValidShallowRoute = options.shallow && nextState.route === (routeInfo.route ?? route); + const shouldScroll = options.scroll ?? (!isQueryUpdating && !isValidShallowRoute); + const resetScroll = shouldScroll ? { + x: 0, + y: 0 + } : null; + const upcomingScrollState = forcedScroll ?? resetScroll; + // the new state that the router gonna set + const upcomingRouterState = { + ...nextState, + route, + pathname, + query, + asPath: cleanedAs, + isFallback: false + }; + // When the page being rendered is the 404 page, we should only update the + // query parameters. Route changes here might add the basePath when it + // wasn't originally present. This is also why this block is before the + // below `changeState` call which updates the browser's history (changing + // the URL). + if (isQueryUpdating && isErrorRoute) { + routeInfo = await this.getRouteInfo({ + route: this.pathname, + pathname: this.pathname, + query, + as, + resolvedAs, + routeProps: { + shallow: false + }, + locale: nextState.locale, + isPreview: nextState.isPreview, + isQueryUpdating: isQueryUpdating && !this.isFallback + }); + if ('type' in routeInfo) { + throw new Error(`Unexpected middleware effect on ${this.pathname}`); + } + if (this.pathname === '/_error' && self.__NEXT_DATA__.props?.pageProps?.statusCode === 500 && routeInfo.props?.pageProps) { + // ensure statusCode is still correct for static 500 page + // when updating query information + routeInfo.props.pageProps.statusCode = 500; + } + try { + await this.set(upcomingRouterState, routeInfo, upcomingScrollState); + } catch (err) { + if (isError(err) && err.cancelled) { + Router.events.emit('routeChangeError', err, cleanedAs, routeProps); + } + throw err; + } + return true; + } + Router.events.emit('beforeHistoryChange', as, routeProps); + this.changeState(method, url, as, options); + // for query updates we can skip it if the state is unchanged and we don't + // need to scroll + // https://github.com/vercel/next.js/issues/37139 + const canSkipUpdating = isQueryUpdating && !upcomingScrollState && !readyStateChange && !localeChange && compareRouterStates(upcomingRouterState, this.state); + if (!canSkipUpdating) { + try { + await this.set(upcomingRouterState, routeInfo, upcomingScrollState); + } catch (e) { + if (e.cancelled) routeInfo.error = routeInfo.error || e; + else throw e; + } + if (routeInfo.error) { + if (!isQueryUpdating) { + Router.events.emit('routeChangeError', routeInfo.error, cleanedAs, routeProps); + } + throw routeInfo.error; + } + if (process.env.__NEXT_I18N_SUPPORT) { + if (nextState.locale) { + document.documentElement.lang = nextState.locale; + } + } + if (!isQueryUpdating) { + Router.events.emit('routeChangeComplete', as, routeProps); + } + // A hash mark # is the optional last part of a URL + const hashRegex = /#.+$/; + if (shouldScroll && hashRegex.test(as)) { + this.scrollToHash(as); + } + } + return true; + } catch (err) { + if (isError(err) && err.cancelled) { + return false; + } + throw err; + } + } + changeState(method, url, as, options = {}) { + if (process.env.NODE_ENV !== 'production') { + if (typeof window.history === 'undefined') { + console.error(`Warning: window.history is not available.`); + return; + } + if (typeof window.history[method] === 'undefined') { + console.error(`Warning: window.history.${method} is not available`); + return; + } + } + if (method !== 'pushState' || getURL() !== as) { + this._shallow = options.shallow; + window.history[method]({ + url, + as, + options, + __N: true, + key: this._key = method !== 'pushState' ? this._key : createKey() + }, // Most browsers currently ignores this parameter, although they may use it in the future. + // Passing the empty string here should be safe against future changes to the method. + // https://developer.mozilla.org/docs/Web/API/History/replaceState + '', as); + } + } + async handleRouteInfoError(err, pathname, query, as, routeProps, loadErrorFail) { + if (err.cancelled) { + // bubble up cancellation errors + throw err; + } + if (isAssetError(err) || loadErrorFail) { + Router.events.emit('routeChangeError', err, as, routeProps); + // If we can't load the page it could be one of following reasons + // 1. Page doesn't exists + // 2. Page does exist in a different zone + // 3. Internal error while loading the page + // So, doing a hard reload is the proper way to deal with this. + handleHardNavigation({ + url: as, + router: this + }); + // Changing the URL doesn't block executing the current code path. + // So let's throw a cancellation error stop the routing logic. + throw buildCancellationError(); + } + console.error(err); + try { + let props; + const { page: Component, styleSheets } = await this.fetchComponent('/_error'); + const routeInfo = { + props, + Component, + styleSheets, + err, + error: err + }; + if (!routeInfo.props) { + try { + routeInfo.props = await this.getInitialProps(Component, { + err, + pathname, + query + }); + } catch (gipErr) { + console.error('Error in error page `getInitialProps`: ', gipErr); + routeInfo.props = {}; + } + } + return routeInfo; + } catch (routeInfoErr) { + return this.handleRouteInfoError(isError(routeInfoErr) ? routeInfoErr : new Error(routeInfoErr + ''), pathname, query, as, routeProps, true); + } + } + async getRouteInfo({ route: requestedRoute, pathname, query, as, resolvedAs, routeProps, locale, hasMiddleware, isPreview, unstable_skipClientCache, isQueryUpdating, isMiddlewareRewrite, isNotFound }) { + /** + * This `route` binding can change if there's a rewrite + * so we keep a reference to the original requested route + * so we can store the cache for it and avoid re-requesting every time + * for shallow routing purposes. + */ let route = requestedRoute; + try { + let existingInfo = this.components[route]; + // `prefetch()` stores a `{ __appRouter: true }` marker in + // `this.components` when the client router filter matches a path. That + // marker is not route info: it has no `Component` and no `props`, so + // rendering it crashes `_app`. Treat it as a cache miss and fetch the + // route info again; `change()` is responsible for the hard navigation. + if (existingInfo && existingInfo.__appRouter) { + existingInfo = undefined; + } + if (routeProps.shallow && existingInfo && this.route === route) { + return existingInfo; + } + const handleCancelled = getCancelledHandler({ + route, + router: this + }); + if (hasMiddleware) { + existingInfo = undefined; + } + let cachedRouteInfo = existingInfo && !('initial' in existingInfo) && process.env.NODE_ENV !== 'development' ? existingInfo : undefined; + const isBackground = isQueryUpdating; + const fetchNextDataParams = { + dataHref: this.pageLoader.getDataHref({ + href: formatWithValidation({ + pathname, + query + }), + skipInterpolation: true, + asPath: isNotFound ? '/404' : resolvedAs, + locale + }), + hasMiddleware: true, + isServerRender: this.isSsr, + parseJSON: true, + inflightCache: isBackground ? this.sbc : this.sdc, + persistCache: !isPreview, + isPrefetch: false, + unstable_skipClientCache, + isBackground + }; + let data = isQueryUpdating && !isMiddlewareRewrite ? null : await withMiddlewareEffects({ + fetchData: ()=>fetchNextData(fetchNextDataParams), + asPath: isNotFound ? '/404' : resolvedAs, + locale: locale, + router: this + }).catch((err)=>{ + // we don't hard error during query updating + // as it's un-necessary and doesn't need to be fatal + // unless it is a fallback route and the props can't + // be loaded + if (isQueryUpdating) { + return null; + } + throw err; + }); + // when rendering error routes we don't apply middleware + // effects + if (data && (pathname === '/_error' || pathname === '/404')) { + data.effect = undefined; + } + if (isQueryUpdating) { + if (!data) { + data = { + json: self.__NEXT_DATA__.props + }; + } else { + data.json = self.__NEXT_DATA__.props; + } + } + handleCancelled(); + if (data?.effect?.type === 'redirect-internal' || data?.effect?.type === 'redirect-external') { + return data.effect; + } + if (data?.effect?.type === 'rewrite') { + const resolvedRoute = removeTrailingSlash(data.effect.resolvedHref); + const pages = await this.pageLoader.getPageList(); + // during query updating the page must match although during + // client-transition a redirect that doesn't match a page + // can be returned and this should trigger a hard navigation + // which is valid for incremental migration + if (!isQueryUpdating || pages.includes(resolvedRoute)) { + route = resolvedRoute; + pathname = data.effect.resolvedHref; + query = { + ...query, + ...data.effect.parsedAs.query + }; + resolvedAs = removeBasePath(normalizeLocalePath(data.effect.parsedAs.pathname, this.locales).pathname); + // Check again the cache with the new destination. + existingInfo = this.components[route]; + if (existingInfo && existingInfo.__appRouter) { + existingInfo = undefined; + } + if (routeProps.shallow && existingInfo && this.route === route && !hasMiddleware) { + // If we have a match with the current route due to rewrite, + // we can copy the existing information to the rewritten one. + // Then, we return the information along with the matched route. + return { + ...existingInfo, + route + }; + } + } + } + if (isAPIRoute(route)) { + handleHardNavigation({ + url: as, + router: this + }); + return new Promise(()=>{}); + } + const routeInfo = cachedRouteInfo || await this.fetchComponent(route).then((res)=>({ + Component: res.page, + styleSheets: res.styleSheets, + __N_SSG: res.mod.__N_SSG, + __N_SSP: res.mod.__N_SSP + })); + if (process.env.NODE_ENV !== 'production') { + const { isValidElementType } = require('next/dist/compiled/react-is'); + if (!isValidElementType(routeInfo.Component)) { + throw new Error(`The default export is not a React Component in page: "${pathname}"`); + } + } + const wasBailedPrefetch = data?.response?.headers.get('x-middleware-skip'); + const shouldFetchData = routeInfo.__N_SSG || routeInfo.__N_SSP; + // For non-SSG prefetches that bailed before sending data + // we clear the cache to fetch full response + if (wasBailedPrefetch && data?.dataHref) { + delete this.sdc[data.dataHref]; + } + const { props, cacheKey } = await this._getData(async ()=>{ + if (shouldFetchData) { + if (data?.json && !wasBailedPrefetch) { + return { + cacheKey: data.cacheKey, + props: data.json + }; + } + const dataHref = data?.dataHref ? data.dataHref : this.pageLoader.getDataHref({ + href: formatWithValidation({ + pathname, + query + }), + asPath: resolvedAs, + locale + }); + const fetched = await fetchNextData({ + dataHref, + isServerRender: this.isSsr, + parseJSON: true, + inflightCache: wasBailedPrefetch ? {} : this.sdc, + persistCache: !isPreview, + isPrefetch: false, + unstable_skipClientCache + }); + return { + cacheKey: fetched.cacheKey, + props: fetched.json || {} + }; + } + return { + headers: {}, + props: await this.getInitialProps(routeInfo.Component, // we provide AppTree later so this needs to be `any` + { + pathname, + query, + asPath: as, + locale, + locales: this.locales, + defaultLocale: this.defaultLocale + }) + }; + }); + // Only bust the data cache for SSP routes although + // middleware can skip cache per request with + // x-middleware-cache: no-cache as well + if (routeInfo.__N_SSP && fetchNextDataParams.dataHref && cacheKey) { + delete this.sdc[cacheKey]; + } + // we kick off a HEAD request in the background + // when a non-prefetch request is made to signal revalidation + if (!this.isPreview && routeInfo.__N_SSG && process.env.NODE_ENV !== 'development' && !isQueryUpdating) { + fetchNextData(Object.assign({}, fetchNextDataParams, { + isBackground: true, + persistCache: false, + inflightCache: this.sbc + })).catch(()=>{}); + } + props.pageProps = Object.assign({}, props.pageProps); + routeInfo.props = props; + routeInfo.route = route; + routeInfo.query = query; + routeInfo.resolvedAs = resolvedAs; + this.components[route] = routeInfo; + return routeInfo; + } catch (err) { + return this.handleRouteInfoError(getProperError(err), pathname, query, as, routeProps); + } + } + set(state, data, resetScroll) { + this.state = state; + return this.sub(data, this.components['/_app'].Component, resetScroll); + } + /** + * Callback to execute before replacing router state + * @param cb callback to be executed + */ beforePopState(cb) { + this._bps = cb; + } + onlyAHashChange(as) { + if (!this.asPath) return false; + const [oldUrlNoHash, oldHash] = this.asPath.split('#', 2); + const [newUrlNoHash, newHash] = as.split('#', 2); + // Makes sure we scroll to the provided hash if the url/hash are the same + if (newHash && oldUrlNoHash === newUrlNoHash && oldHash === newHash) { + return true; + } + // If the urls are change, there's more than a hash change + if (oldUrlNoHash !== newUrlNoHash) { + return false; + } + // If the hash has changed, then it's a hash only change. + // This check is necessary to handle both the enter and + // leave hash === '' cases. The identity case falls through + // and is treated as a next reload. + return oldHash !== newHash; + } + scrollToHash(as) { + const [, hash = ''] = as.split('#', 2); + disableSmoothScrollDuringRouteTransition(()=>{ + // Scroll to top if the hash is just `#` with no value or `#top` + // To mirror browsers + if (hash === '' || hash === 'top') { + window.scrollTo(0, 0); + return; + } + // Decode hash to make non-latin anchor works. + const rawHash = decodeURIComponent(hash); + // First we check if the element by id is found + const idEl = document.getElementById(rawHash); + if (idEl) { + idEl.scrollIntoView(); + return; + } + // If there's no element with the id, we check the `name` property + // To mirror browsers + const nameEl = document.getElementsByName(rawHash)[0]; + if (nameEl) { + nameEl.scrollIntoView(); + } + }, { + onlyHashChange: this.onlyAHashChange(as) + }); + } + urlIsNew(asPath) { + return this.asPath !== asPath; + } + /** + * Prefetch page code, you may wait for the data during page rendering. + * This feature only works in production! + * @param url the href of prefetched page + * @param asPath the as path of the prefetched page + */ async prefetch(url, asPath = url, options = {}) { + // Prefetch is not supported in development mode because it would trigger on-demand-entries + if (process.env.NODE_ENV !== 'production') { + return; + } + if (typeof window !== 'undefined' && isBot(window.navigator.userAgent)) { + // No prefetches for bots that render the link since they are typically navigating + // links via the equivalent of a hard navigation and hence never utilize these + // prefetches. + return; + } + let parsed = parseRelativeUrl(url); + let { pathname, query } = parsed; + const originalPathname = pathname; + if (process.env.__NEXT_I18N_SUPPORT) { + if (options.locale === false) { + pathname = normalizeLocalePath(pathname, this.locales).pathname; + parsed.pathname = pathname; + url = formatWithValidation(parsed); + let parsedAs = parseRelativeUrl(asPath); + const localePathResult = normalizeLocalePath(parsedAs.pathname, this.locales); + parsedAs.pathname = localePathResult.pathname; + options.locale = localePathResult.detectedLocale || this.defaultLocale; + asPath = formatWithValidation(parsedAs); + } + } + const pages = await this.pageLoader.getPageList(); + let resolvedAs = asPath; + const locale = typeof options.locale !== 'undefined' ? options.locale || undefined : this.locale; + const isMiddlewareMatch = await matchesMiddleware({ + asPath: asPath, + locale: locale, + router: this + }); + if (process.env.__NEXT_HAS_REWRITES && asPath.startsWith('/')) { + let rewrites; + ({ __rewrites: rewrites } = await getClientBuildManifest()); + const rewritesResult = resolveRewrites(addBasePath(addLocale(asPath, this.locale), true), pages, rewrites, parsed.query, (p)=>resolveDynamicRoute(p, pages), this.locales); + if (rewritesResult.externalDest) { + return; + } + if (!isMiddlewareMatch) { + resolvedAs = removeLocale(removeBasePath(rewritesResult.asPath), this.locale); + } + if (rewritesResult.matchedPage && rewritesResult.resolvedHref) { + // if this directly matches a page we need to update the href to + // allow the correct page chunk to be loaded + pathname = rewritesResult.resolvedHref; + parsed.pathname = pathname; + if (!isMiddlewareMatch) { + url = formatWithValidation(parsed); + } + } + } + parsed.pathname = resolveDynamicRoute(parsed.pathname, pages); + if (isDynamicRoute(parsed.pathname)) { + pathname = parsed.pathname; + parsed.pathname = pathname; + Object.assign(query, getRouteMatcher(getRouteRegex(parsed.pathname))(parsePath(asPath).pathname) || {}); + if (!isMiddlewareMatch) { + url = formatWithValidation(parsed); + } + } + const data = process.env.__NEXT_MIDDLEWARE_PREFETCH === 'strict' ? null : await withMiddlewareEffects({ + fetchData: ()=>fetchNextData({ + dataHref: this.pageLoader.getDataHref({ + href: formatWithValidation({ + pathname: originalPathname, + query + }), + skipInterpolation: true, + asPath: resolvedAs, + locale + }), + hasMiddleware: true, + isServerRender: false, + parseJSON: true, + inflightCache: this.sdc, + persistCache: !this.isPreview, + isPrefetch: true + }), + asPath: asPath, + locale: locale, + router: this + }); + /** + * If there was a rewrite we apply the effects of the rewrite on the + * current parameters for the prefetch. + */ if (data?.effect.type === 'rewrite') { + parsed.pathname = data.effect.resolvedHref; + pathname = data.effect.resolvedHref; + query = { + ...query, + ...data.effect.parsedAs.query + }; + resolvedAs = data.effect.parsedAs.pathname; + url = formatWithValidation(parsed); + } + /** + * If there is a redirect to an external destination then we don't have + * to prefetch content as it will be unused. + */ if (data?.effect.type === 'redirect-external') { + return; + } + const route = removeTrailingSlash(pathname); + if (await this._bfl(asPath, resolvedAs, options.locale, true)) { + const appRouterMarkerKey = getAppRouterMarkerKey(this, asPath, options.locale); + // A loaded pages route in the cache is ground truth: the page behind + // this key exists and was rendered. This is the case when the current + // page was reached through a rewrite and the canonical URL is + // prefetched, or when a prefetch is still in flight while a navigation + // stores the same route. Replacing that entry with the marker would + // break hash-only changes and shallow navigations, which render the + // cached entry of the current route directly. Non-shallow navigations + // consult the client router filter themselves, so they do not depend + // on the marker to hard navigate. + if (appRouterMarkerKey !== null && this.components[appRouterMarkerKey] === undefined) { + this.components[appRouterMarkerKey] = { + __appRouter: true + }; + } + } + await Promise.all([ + this.pageLoader._isSsg(route).then((isSsg)=>{ + return isSsg ? fetchNextData({ + dataHref: data?.json ? data?.dataHref : this.pageLoader.getDataHref({ + href: url, + asPath: resolvedAs, + locale: locale + }), + isServerRender: false, + parseJSON: true, + inflightCache: this.sdc, + persistCache: !this.isPreview, + isPrefetch: true, + unstable_skipClientCache: options.unstable_skipClientCache || options.priority && !!process.env.__NEXT_OPTIMISTIC_CLIENT_CACHE + }).then(()=>false).catch(()=>false) : false; + }), + this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](route) + ]); + } + async fetchComponent(route) { + const handleCancelled = getCancelledHandler({ + route, + router: this + }); + try { + const componentResult = await this.pageLoader.loadPage(route); + handleCancelled(); + return componentResult; + } catch (err) { + handleCancelled(); + throw err; + } + } + _getData(fn) { + let cancelled = false; + const cancel = ()=>{ + cancelled = true; + }; + this.clc = cancel; + return fn().then((data)=>{ + if (cancel === this.clc) { + this.clc = null; + } + if (cancelled) { + const err = new Error('Loading initial props cancelled'); + err.cancelled = true; + throw err; + } + return data; + }); + } + getInitialProps(Component, ctx) { + const { Component: App } = this.components['/_app']; + const AppTree = this._wrapApp(App); + ctx.AppTree = AppTree; + return loadGetInitialProps(App, { + AppTree, + Component, + router: this, + ctx + }); + } + get route() { + return this.state.route; + } + get pathname() { + return this.state.pathname; + } + get query() { + return this.state.query; + } + get asPath() { + return this.state.asPath; + } + get locale() { + return this.state.locale; + } + get isFallback() { + return this.state.isFallback; + } + get isPreview() { + return this.state.isPreview; + } +} + +//# sourceMappingURL=router.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/router.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/router.js.map new file mode 100644 index 0000000000000000000000000000000000000000..acaef3a5c7cc87be8df7ba3b6d08b31636940cdd --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/router.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/router/router.ts"],"sourcesContent":["import type { ComponentType } from 'react'\nimport type { DomainLocale } from '../../../server/config'\nimport type { MittEmitter } from '../mitt'\nimport type { ParsedUrlQuery } from 'querystring'\nimport type { RouterEvent } from '../../../client/router'\nimport type { StyleSheetTuple } from '../../../client/page-loader'\nimport type { UrlObject } from 'url'\nimport type PageLoader from '../../../client/page-loader'\nimport type { AppContextType, NextPageContext, NEXT_DATA } from '../utils'\nimport { removeTrailingSlash } from './utils/remove-trailing-slash'\nimport {\n getClientBuildManifest,\n isAssetError,\n markAssetError,\n} from '../../../client/route-loader'\nimport { handleClientScriptLoad } from '../../../client/script'\nimport isError, { getProperError } from '../../../lib/is-error'\nimport { denormalizePagePath } from '../page-path/denormalize-page-path'\nimport { normalizeLocalePath } from '../i18n/normalize-locale-path'\nimport mitt from '../mitt'\nimport { getLocationOrigin, getURL, loadGetInitialProps, ST } from '../utils'\nimport { isDynamicRoute } from './utils/is-dynamic'\nimport { parseRelativeUrl } from './utils/parse-relative-url'\nimport { getRouteMatcher } from './utils/route-matcher'\nimport { getRouteRegex } from './utils/route-regex'\nimport { hasDynamicFilterCandidate } from './utils/dynamic-filter-pattern'\nimport { formatWithValidation } from './utils/format-url'\nimport { detectDomainLocale } from '../../../client/detect-domain-locale'\nimport { parsePath } from './utils/parse-path'\nimport { addLocale } from '../../../client/add-locale'\nimport { removeLocale } from '../../../client/remove-locale'\nimport { removeBasePath } from '../../../client/remove-base-path'\nimport { addBasePath } from '../../../client/add-base-path'\nimport { hasBasePath } from '../../../client/has-base-path'\nimport { resolveHref } from '../../../client/resolve-href'\nimport { isAPIRoute } from '../../../lib/is-api-route'\nimport { getNextPathnameInfo } from './utils/get-next-pathname-info'\nimport { formatNextPathnameInfo } from './utils/format-next-pathname-info'\nimport { compareRouterStates } from './utils/compare-states'\nimport { isLocalURL } from './utils/is-local-url'\nimport { isBot } from './utils/is-bot'\nimport { omit } from './utils/omit'\nimport { interpolateAs } from './utils/interpolate-as'\nimport { disableSmoothScrollDuringRouteTransition } from './utils/disable-smooth-scroll'\nimport type { Params } from '../../../server/request/params'\nimport {\n MATCHED_PATH_HEADER,\n NEXT_NAV_DEPLOYMENT_ID_HEADER,\n} from '../../../lib/constants'\nimport { getDeploymentId } from '../deployment-id'\nimport { isJavaScriptURLString } from '../../../client/lib/javascript-url'\n\nlet resolveRewrites: typeof import('./utils/resolve-rewrites').default\nif (process.env.__NEXT_HAS_REWRITES) {\n resolveRewrites = (\n require('./utils/resolve-rewrites') as typeof import('./utils/resolve-rewrites')\n ).default\n}\n\ndeclare global {\n interface Window {\n /* prod */\n __NEXT_DATA__: NEXT_DATA\n }\n}\n\ninterface RouteProperties {\n shallow: boolean\n}\n\ninterface TransitionOptions {\n shallow?: boolean\n locale?: string | false\n scroll?: boolean\n unstable_skipClientCache?: boolean\n}\n\ninterface NextHistoryState {\n url: string\n as: string\n options: TransitionOptions\n}\n\nexport type HistoryState =\n | null\n | { __NA: true; __N?: false }\n | { __N: false; __NA?: false }\n | ({ __NA?: false; __N: true; key: string } & NextHistoryState)\n\nfunction buildCancellationError() {\n return Object.assign(new Error('Route Cancelled'), {\n cancelled: true,\n })\n}\n\ninterface MiddlewareEffectParams<T extends FetchDataOutput> {\n fetchData?: () => Promise<T>\n locale?: string\n asPath: string\n router: Router\n}\n\nexport async function matchesMiddleware<T extends FetchDataOutput>(\n options: MiddlewareEffectParams<T>\n): Promise<boolean> {\n const matchers = await Promise.resolve(\n options.router.pageLoader.getMiddleware()\n )\n if (!matchers) return false\n\n const { pathname: asPathname } = parsePath(options.asPath)\n // remove basePath first since path prefix has to be in the order of `/${basePath}/${locale}`\n const cleanedAs = hasBasePath(asPathname)\n ? removeBasePath(asPathname)\n : asPathname\n const asWithBasePathAndLocale = addBasePath(\n addLocale(cleanedAs, options.locale)\n )\n\n // Check only path match on client. Matching \"has\" should be done on server\n // where we can access more info such as headers, HttpOnly cookie, etc.\n return matchers.some((m) =>\n new RegExp(m.regexp).test(asWithBasePathAndLocale)\n )\n}\n\nfunction stripOrigin(url: string) {\n const origin = getLocationOrigin()\n\n return url.startsWith(origin) ? url.substring(origin.length) : url\n}\n\nfunction prepareUrlAs(router: NextRouter, url: Url, as?: Url) {\n // If url and as provided as an object representation,\n // we'll format them into the string version here.\n let [resolvedHref, resolvedAs] = resolveHref(router, url, true)\n const origin = getLocationOrigin()\n const hrefWasAbsolute = resolvedHref.startsWith(origin)\n const asWasAbsolute = resolvedAs && resolvedAs.startsWith(origin)\n\n resolvedHref = stripOrigin(resolvedHref)\n resolvedAs = resolvedAs ? stripOrigin(resolvedAs) : resolvedAs\n\n const preparedUrl = hrefWasAbsolute ? resolvedHref : addBasePath(resolvedHref)\n const preparedAs = as\n ? stripOrigin(resolveHref(router, as))\n : resolvedAs || resolvedHref\n\n return {\n url: preparedUrl,\n as: asWasAbsolute ? preparedAs : addBasePath(preparedAs),\n }\n}\n\n/**\n * Key under which `prefetch()` stores the `{ __appRouter: true }` marker in\n * `router.components` and under which `change()` looks it up again.\n *\n * The client router filter (`_bfl`) is evaluated against the `as` path, so the\n * marker has to be keyed by the `as` path as well. Keying it by the `href`\n * pathname is only equivalent while `href` and `as` are the same URL. When\n * they differ (for example the \"route as modal\" pattern where `href` stays on\n * the current page and `as` shows a pretty URL) a filter match on `as` would\n * otherwise mark the pages route behind `href` as an App Router path and\n * break every later navigation to that route.\n *\n * `as` is expected without the `basePath`, which is what both call sites\n * hold: `prefetch()` receives it that way from `next/link` and `change()`\n * strips it before computing `cleanedAs`. Stripping it again here would turn\n * a route that merely starts with the `basePath` (for example the app route\n * `/docs` with `basePath: '/docs'`) into `/` and poison the index page.\n *\n * The key also carries the effective locale, mirroring how `_bfl` evaluates\n * `addLocale(as, locale)` against the filter. A match for a French-only\n * redirect at `/fr/legacy` must not mark the English `/legacy` page.\n *\n * Returns `null` when `as` is not a local URL (for example `mailto:` or a\n * different origin). Such an `as` can never be an App Router path, and\n * `change()` reports it as an invalid `href`/`as` pair further down.\n */\nfunction getAppRouterMarkerKey(\n router: Router,\n as: string,\n locale: string | false | undefined\n): string | null {\n if (!isLocalURL(as)) {\n return null\n }\n\n let { pathname } = parseRelativeUrl(as)\n let effectiveLocale = locale || router.locale\n\n if (process.env.__NEXT_I18N_SUPPORT) {\n const localePathResult = normalizeLocalePath(pathname, router.locales)\n pathname = localePathResult.pathname\n effectiveLocale = localePathResult.detectedLocale || effectiveLocale\n }\n\n return removeTrailingSlash(\n addLocale(removeTrailingSlash(pathname), effectiveLocale)\n )\n}\n\nfunction resolveDynamicRoute(pathname: string, pages: string[]) {\n const cleanPathname = removeTrailingSlash(denormalizePagePath(pathname))\n if (cleanPathname === '/404' || cleanPathname === '/_error') {\n return pathname\n }\n\n // handle resolving href for dynamic routes\n if (!pages.includes(cleanPathname)) {\n // eslint-disable-next-line array-callback-return\n pages.some((page) => {\n if (isDynamicRoute(page) && getRouteRegex(page).re.test(cleanPathname)) {\n pathname = page\n return true\n }\n })\n }\n return removeTrailingSlash(pathname)\n}\n\nfunction getMiddlewareData<T extends FetchDataOutput>(\n source: string,\n response: Response,\n options: MiddlewareEffectParams<T>\n) {\n const nextConfig = {\n basePath: options.router.basePath,\n i18n: { locales: options.router.locales },\n trailingSlash: Boolean(process.env.__NEXT_TRAILING_SLASH),\n }\n const rewriteHeader = response.headers.get('x-nextjs-rewrite')\n\n let rewriteTarget =\n rewriteHeader || response.headers.get('x-nextjs-matched-path')\n\n const matchedPath = response.headers.get(MATCHED_PATH_HEADER)\n\n if (\n matchedPath &&\n !rewriteTarget &&\n !matchedPath.includes('__next_data_catchall') &&\n !matchedPath.includes('/_error') &&\n !matchedPath.includes('/404')\n ) {\n // leverage x-matched-path to detect next.config.js rewrites\n rewriteTarget = matchedPath\n }\n\n if (rewriteTarget) {\n if (\n rewriteTarget.startsWith('/') ||\n process.env.__NEXT_EXTERNAL_MIDDLEWARE_REWRITE_RESOLVE\n ) {\n const parsedRewriteTarget = parseRelativeUrl(rewriteTarget)\n const pathnameInfo = getNextPathnameInfo(parsedRewriteTarget.pathname, {\n nextConfig,\n parseData: true,\n })\n\n let fsPathname = removeTrailingSlash(pathnameInfo.pathname)\n return Promise.all([\n options.router.pageLoader.getPageList(),\n getClientBuildManifest(),\n ]).then(([pages, { __rewrites: rewrites }]: any) => {\n let as = addLocale(pathnameInfo.pathname, pathnameInfo.locale)\n\n if (\n isDynamicRoute(as) ||\n (!rewriteHeader &&\n pages.includes(\n normalizeLocalePath(removeBasePath(as), options.router.locales)\n .pathname\n ))\n ) {\n const parsedSource = getNextPathnameInfo(\n parseRelativeUrl(source).pathname,\n {\n // Pass basePath (and trailingSlash) so the basePath prefix is\n // stripped before the `_next/data/` check, but omit `i18n` so the\n // locale prefix is preserved here — the rewrite resolver below\n // handles the locale-prefixed `as`.\n nextConfig: {\n basePath: nextConfig.basePath,\n trailingSlash: nextConfig.trailingSlash,\n },\n parseData: true,\n }\n )\n\n as = addBasePath(parsedSource.pathname)\n parsedRewriteTarget.pathname = as\n }\n\n if (process.env.__NEXT_HAS_REWRITES) {\n const result = resolveRewrites(\n as,\n pages,\n rewrites,\n parsedRewriteTarget.query,\n (path: string) => resolveDynamicRoute(path, pages),\n options.router.locales\n )\n\n if (result.matchedPage) {\n parsedRewriteTarget.pathname = result.parsedAs.pathname\n as = parsedRewriteTarget.pathname\n Object.assign(parsedRewriteTarget.query, result.parsedAs.query)\n }\n } else if (!pages.includes(fsPathname)) {\n const resolvedPathname = resolveDynamicRoute(fsPathname, pages)\n\n if (resolvedPathname !== fsPathname) {\n fsPathname = resolvedPathname\n }\n }\n\n const resolvedHref = !pages.includes(fsPathname)\n ? resolveDynamicRoute(\n normalizeLocalePath(\n removeBasePath(parsedRewriteTarget.pathname),\n options.router.locales\n ).pathname,\n pages\n )\n : fsPathname\n\n if (isDynamicRoute(resolvedHref)) {\n const matches = getRouteMatcher(getRouteRegex(resolvedHref))(as)\n Object.assign(parsedRewriteTarget.query, matches || {})\n }\n\n return {\n type: 'rewrite' as const,\n parsedAs: parsedRewriteTarget,\n resolvedHref,\n }\n })\n }\n const src = parsePath(source)\n const pathname = formatNextPathnameInfo({\n ...getNextPathnameInfo(src.pathname, { nextConfig, parseData: true }),\n defaultLocale: options.router.defaultLocale,\n buildId: '',\n })\n\n return Promise.resolve({\n type: 'redirect-external' as const,\n destination: `${pathname}${src.query}${src.hash}`,\n })\n }\n\n const redirectTarget = response.headers.get('x-nextjs-redirect')\n\n if (redirectTarget) {\n if (redirectTarget.startsWith('/')) {\n const src = parsePath(redirectTarget)\n const pathname = formatNextPathnameInfo({\n ...getNextPathnameInfo(src.pathname, { nextConfig, parseData: true }),\n defaultLocale: options.router.defaultLocale,\n buildId: '',\n })\n\n return Promise.resolve({\n type: 'redirect-internal' as const,\n newAs: `${pathname}${src.query}${src.hash}`,\n newUrl: `${pathname}${src.query}${src.hash}`,\n })\n }\n\n return Promise.resolve({\n type: 'redirect-external' as const,\n destination: redirectTarget,\n })\n }\n\n return Promise.resolve({ type: 'next' as const })\n}\n\ninterface WithMiddlewareEffectsOutput extends FetchDataOutput {\n effect: Awaited<ReturnType<typeof getMiddlewareData>>\n}\n\nasync function withMiddlewareEffects<T extends FetchDataOutput>(\n options: MiddlewareEffectParams<T>\n): Promise<WithMiddlewareEffectsOutput | null> {\n const matches = await matchesMiddleware(options)\n if (!matches || !options.fetchData) {\n return null\n }\n\n const data = await options.fetchData()\n\n const effect = await getMiddlewareData(data.dataHref, data.response, options)\n\n return {\n dataHref: data.dataHref,\n json: data.json,\n response: data.response,\n text: data.text,\n cacheKey: data.cacheKey,\n effect,\n }\n}\n\nexport type Url = UrlObject | string\n\nexport type BaseRouter = {\n route: string\n pathname: string\n query: ParsedUrlQuery\n asPath: string\n basePath: string\n locale?: string | undefined\n locales?: readonly string[] | undefined\n defaultLocale?: string | undefined\n domainLocales?: readonly DomainLocale[] | undefined\n isLocaleDomain: boolean\n}\n\nexport type NextRouter = BaseRouter &\n Pick<\n Router,\n | 'push'\n | 'replace'\n | 'reload'\n | 'back'\n | 'forward'\n | 'prefetch'\n | 'beforePopState'\n | 'events'\n | 'isFallback'\n | 'isReady'\n | 'isPreview'\n >\n\nexport type PrefetchOptions = {\n priority?: boolean\n locale?: string | false\n unstable_skipClientCache?: boolean\n}\n\nexport type PrivateRouteInfo =\n | (Omit<CompletePrivateRouteInfo, 'styleSheets'> & { initial: true })\n | CompletePrivateRouteInfo\n\nexport type CompletePrivateRouteInfo = {\n Component: ComponentType\n styleSheets: StyleSheetTuple[]\n __N_SSG?: boolean\n __N_SSP?: boolean\n props?: Record<string, any>\n err?: Error\n error?: any\n route?: string\n resolvedAs?: string\n query?: ParsedUrlQuery\n}\n\nexport type AppProps = Pick<CompletePrivateRouteInfo, 'Component' | 'err'> & {\n router: Router\n} & Record<string, any>\nexport type AppComponent = ComponentType<AppProps>\n\ntype Subscription = (\n data: PrivateRouteInfo,\n App: AppComponent,\n resetScroll: { x: number; y: number } | null\n) => Promise<void>\n\ntype BeforePopStateCallback = (state: NextHistoryState) => boolean\n\ntype ComponentLoadCancel = (() => void) | null\n\ntype HistoryMethod = 'replaceState' | 'pushState'\n\nconst manualScrollRestoration =\n process.env.__NEXT_SCROLL_RESTORATION &&\n typeof window !== 'undefined' &&\n 'scrollRestoration' in window.history &&\n !!(function () {\n try {\n let v = '__next'\n return (sessionStorage.setItem(v, v), sessionStorage.removeItem(v), true)\n } catch (n) {}\n })()\n\nconst SSG_DATA_NOT_FOUND = Symbol('SSG_DATA_NOT_FOUND')\n\nfunction fetchRetry(\n url: string,\n attempts: number,\n options: Pick<RequestInit, 'method' | 'headers'>\n): Promise<Response> {\n return fetch(url, {\n // Cookies are required to be present for Next.js' SSG \"Preview Mode\".\n // Cookies may also be required for `getServerSideProps`.\n //\n // > `fetch` won’t send cookies, unless you set the credentials init\n // > option.\n // https://developer.mozilla.org/docs/Web/API/Fetch_API/Using_Fetch\n //\n // > For maximum browser compatibility when it comes to sending &\n // > receiving cookies, always supply the `credentials: 'same-origin'`\n // > option instead of relying on the default.\n // https://github.com/github/fetch#caveats\n credentials: 'same-origin',\n method: options.method || 'GET',\n headers: Object.assign({}, options.headers, {\n 'x-nextjs-data': '1',\n }),\n }).then((response) => {\n return !response.ok && attempts > 1 && response.status >= 500\n ? fetchRetry(url, attempts - 1, options)\n : response\n })\n}\n\ninterface FetchDataOutput {\n dataHref: string\n json: Record<string, any> | null\n response: Response\n text: string\n cacheKey: string\n}\n\ninterface FetchNextDataParams {\n dataHref: string\n isServerRender: boolean\n parseJSON: boolean | undefined\n hasMiddleware?: boolean\n inflightCache: NextDataCache\n persistCache: boolean\n isPrefetch: boolean\n isBackground?: boolean\n unstable_skipClientCache?: boolean\n}\n\nfunction tryToParseAsJSON(text: string) {\n try {\n return JSON.parse(text)\n } catch (error) {\n return null\n }\n}\n\nfunction fetchNextData({\n dataHref,\n inflightCache,\n isPrefetch,\n hasMiddleware,\n isServerRender,\n parseJSON,\n persistCache,\n isBackground,\n unstable_skipClientCache,\n}: FetchNextDataParams): Promise<FetchDataOutput> {\n const { href: cacheKey } = new URL(dataHref, window.location.href)\n const deploymentId = getDeploymentId()\n const getData = (params?: { method?: 'HEAD' | 'GET' }) =>\n fetchRetry(dataHref, isServerRender ? 3 : 1, {\n headers: Object.assign(\n {} as HeadersInit,\n isPrefetch ? { purpose: 'prefetch' } : {},\n isPrefetch && hasMiddleware ? { 'x-middleware-prefetch': '1' } : {},\n deploymentId ? { 'x-deployment-id': deploymentId } : {}\n ),\n method: params?.method ?? 'GET',\n })\n .then((response) => {\n if (response.ok && params?.method === 'HEAD') {\n return { dataHref, response, text: '', json: {}, cacheKey }\n }\n\n return response.text().then((text) => {\n if (!response.ok) {\n /**\n * When the data response is a redirect because of a middleware\n * we do not consider it an error. The headers must bring the\n * mapped location.\n * TODO: Change the status code in the handler.\n */\n if (\n hasMiddleware &&\n [301, 302, 307, 308].includes(response.status)\n ) {\n return { dataHref, response, text, json: {}, cacheKey }\n }\n\n if (response.status === 404) {\n if (tryToParseAsJSON(text)?.notFound) {\n return {\n dataHref,\n json: { notFound: SSG_DATA_NOT_FOUND },\n response,\n text,\n cacheKey,\n }\n }\n }\n\n const error = new Error(`Failed to load static props`)\n\n /**\n * We should only trigger a server-side transition if this was\n * caused on a client-side transition. Otherwise, we'd get into\n * an infinite loop.\n */\n if (!isServerRender) {\n markAssetError(error)\n }\n\n throw error\n }\n\n let dplResponseHeader = response.headers.get(\n NEXT_NAV_DEPLOYMENT_ID_HEADER\n )\n if (dplResponseHeader != null && dplResponseHeader !== deploymentId) {\n // When not found, or we want to force a MPA navigation because of Skew Protection\n const error = new Error(\n `Loaded static props were from an outdated deployment, forcing a hard reload`\n )\n /**\n * We should only trigger a server-side transition if this was\n * caused on a client-side transition. Otherwise, we'd get into\n * an infinite loop.\n */\n if (!isServerRender) {\n markAssetError(error)\n }\n throw error\n }\n\n return {\n dataHref,\n json: parseJSON ? tryToParseAsJSON(text) : null,\n response,\n text,\n cacheKey,\n }\n })\n })\n .then((data) => {\n if (\n !persistCache ||\n process.env.NODE_ENV !== 'production' ||\n data.response.headers.get('x-middleware-cache') === 'no-cache'\n ) {\n delete inflightCache[cacheKey]\n }\n return data\n })\n .catch((err) => {\n if (!unstable_skipClientCache) {\n delete inflightCache[cacheKey]\n }\n if (\n // chrome\n err.message === 'Failed to fetch' ||\n // firefox\n err.message === 'NetworkError when attempting to fetch resource.' ||\n // safari\n err.message === 'Load failed'\n ) {\n markAssetError(err)\n }\n throw err\n })\n\n // when skipping client cache we wait to update\n // inflight cache until successful data response\n // this allows racing click event with fetching newer data\n // without blocking navigation when stale data is available\n if (unstable_skipClientCache && persistCache) {\n return getData({}).then((data) => {\n if (data.response.headers.get('x-middleware-cache') !== 'no-cache') {\n // only update cache if not marked as no-cache\n inflightCache[cacheKey] = Promise.resolve(data)\n }\n\n return data\n })\n }\n\n if (inflightCache[cacheKey] !== undefined) {\n return inflightCache[cacheKey]\n }\n return (inflightCache[cacheKey] = getData(\n isBackground ? { method: 'HEAD' } : {}\n ))\n}\n\ninterface NextDataCache {\n [asPath: string]: Promise<FetchDataOutput>\n}\n\nexport function createKey() {\n return Math.random().toString(36).slice(2, 10)\n}\n\nfunction handleHardNavigation({\n url,\n router,\n}: {\n url: string\n router: Router\n}) {\n // ensure we don't trigger a hard navigation to the same\n // URL as this can end up with an infinite refresh\n if (url === addBasePath(addLocale(router.asPath, router.locale))) {\n throw new Error(\n `Invariant: attempted to hard navigate to the same URL ${url} ${location.href}`\n )\n }\n window.location.href = url\n}\n\nconst getCancelledHandler = ({\n route,\n router,\n}: {\n route: string\n router: Router\n}) => {\n let cancelled = false\n const cancel = (router.clc = () => {\n cancelled = true\n })\n\n const handleCancelled = () => {\n if (cancelled) {\n const error: any = new Error(\n `Abort fetching component for route: \"${route}\"`\n )\n error.cancelled = true\n throw error\n }\n\n if (cancel === router.clc) {\n router.clc = null\n }\n }\n return handleCancelled\n}\n\nexport default class Router implements BaseRouter {\n basePath: string\n\n /**\n * Map of all components loaded in `Router`\n */\n components: { [pathname: string]: PrivateRouteInfo }\n // Server Data Cache (full data requests)\n sdc: NextDataCache = {}\n // Server Background Cache (HEAD requests)\n sbc: NextDataCache = {}\n\n sub: Subscription\n clc: ComponentLoadCancel\n pageLoader: PageLoader\n _bps: BeforePopStateCallback | undefined\n events: MittEmitter<RouterEvent>\n _wrapApp: (App: AppComponent) => any\n isSsr: boolean\n _inFlightRoute?: string | undefined\n _shallow?: boolean | undefined\n locales?: readonly string[] | undefined\n defaultLocale?: string | undefined\n domainLocales?: readonly DomainLocale[] | undefined\n isReady: boolean\n isLocaleDomain: boolean\n isFirstPopStateEvent = true\n _initialMatchesMiddlewarePromise: Promise<boolean>\n // static entries filter\n _bfl_s?: import('../../lib/bloom-filter').BloomFilter\n // dynamic entires filter\n _bfl_d?: import('../../lib/bloom-filter').BloomFilter\n\n private state: Readonly<{\n route: string\n pathname: string\n query: ParsedUrlQuery\n asPath: string\n locale: string | undefined\n isFallback: boolean\n isPreview: boolean\n }>\n\n private _key: string = createKey()\n\n static events: MittEmitter<RouterEvent> = mitt()\n\n constructor(\n pathname: string,\n query: ParsedUrlQuery,\n as: string,\n {\n initialProps,\n pageLoader,\n App,\n wrapApp,\n Component,\n err,\n subscription,\n isFallback,\n locale,\n locales,\n defaultLocale,\n domainLocales,\n isPreview,\n }: {\n subscription: Subscription\n initialProps: any\n pageLoader: any\n Component: ComponentType\n App: AppComponent\n wrapApp: (WrapAppComponent: AppComponent) => any\n err?: Error\n isFallback: boolean\n locale?: string\n locales?: readonly string[]\n defaultLocale?: string\n domainLocales?: readonly DomainLocale[]\n isPreview?: boolean\n }\n ) {\n // represents the current component key\n const route = removeTrailingSlash(pathname)\n\n // set up the component cache (by route keys)\n this.components = {}\n // We should not keep the cache, if there's an error\n // Otherwise, this cause issues when when going back and\n // come again to the errored page.\n if (pathname !== '/_error') {\n this.components[route] = {\n Component,\n initial: true,\n props: initialProps,\n err,\n __N_SSG: initialProps && initialProps.__N_SSG,\n __N_SSP: initialProps && initialProps.__N_SSP,\n }\n }\n\n this.components['/_app'] = {\n Component: App as ComponentType,\n styleSheets: [\n /* /_app does not need its stylesheets managed */\n ],\n }\n\n // Backwards compat for Router.router.events\n // TODO: Should be remove the following major version as it was never documented\n this.events = Router.events\n\n this.pageLoader = pageLoader\n // if auto prerendered and dynamic route wait to update asPath\n // until after mount to prevent hydration mismatch\n const autoExportDynamic =\n isDynamicRoute(pathname) && self.__NEXT_DATA__.autoExport\n\n this.basePath = process.env.__NEXT_ROUTER_BASEPATH || ''\n this.sub = subscription\n this.clc = null\n this._wrapApp = wrapApp\n // make sure to ignore extra popState in safari on navigating\n // back from external site\n this.isSsr = true\n this.isLocaleDomain = false\n this.isReady = !!(\n self.__NEXT_DATA__.gssp ||\n self.__NEXT_DATA__.gip ||\n self.__NEXT_DATA__.isExperimentalCompile ||\n (self.__NEXT_DATA__.appGip && !self.__NEXT_DATA__.gsp) ||\n (!autoExportDynamic &&\n !self.location.search &&\n !process.env.__NEXT_HAS_REWRITES)\n )\n\n if (process.env.__NEXT_I18N_SUPPORT) {\n this.locales = locales\n this.defaultLocale = defaultLocale\n this.domainLocales = domainLocales\n this.isLocaleDomain = !!detectDomainLocale(\n domainLocales,\n self.location.hostname\n )\n }\n\n this.state = {\n route,\n pathname,\n query,\n asPath: autoExportDynamic ? pathname : as,\n isPreview: !!isPreview,\n locale: process.env.__NEXT_I18N_SUPPORT ? locale : undefined,\n isFallback,\n }\n\n this._initialMatchesMiddlewarePromise = Promise.resolve(false)\n\n if (typeof window !== 'undefined') {\n // make sure \"as\" doesn't start with double slashes or else it can\n // throw an error as it's considered invalid\n if (!as.startsWith('//')) {\n // in order for `e.state` to work on the `onpopstate` event\n // we have to register the initial route upon initialization\n const options: TransitionOptions = { locale }\n const asPath = getURL()\n\n this._initialMatchesMiddlewarePromise = matchesMiddleware({\n router: this,\n locale,\n asPath,\n }).then((matches) => {\n // if middleware matches we leave resolving to the change function\n // as the server needs to resolve for correct priority\n ;(options as any)._shouldResolveHref = as !== pathname\n\n this.changeState(\n 'replaceState',\n matches\n ? asPath\n : formatWithValidation({\n pathname: addBasePath(pathname),\n query,\n }),\n asPath,\n options\n )\n return matches\n })\n }\n\n window.addEventListener('popstate', this.onPopState)\n\n // enable custom scroll restoration handling when available\n // otherwise fallback to browser's default handling\n if (process.env.__NEXT_SCROLL_RESTORATION) {\n if (manualScrollRestoration) {\n window.history.scrollRestoration = 'manual'\n }\n }\n }\n }\n\n onPopState = (e: PopStateEvent): void => {\n const { isFirstPopStateEvent } = this\n this.isFirstPopStateEvent = false\n\n const state = e.state as HistoryState\n\n if (!state) {\n // We get state as undefined for two reasons.\n // 1. With older safari (< 8) and older chrome (< 34)\n // 2. When the URL changed with #\n //\n // In the both cases, we don't need to proceed and change the route.\n // (as it's already changed)\n // But we can simply replace the state with the new changes.\n // Actually, for (1) we don't need to nothing. But it's hard to detect that event.\n // So, doing the following for (1) does no harm.\n const { pathname, query } = this\n this.changeState(\n 'replaceState',\n formatWithValidation({ pathname: addBasePath(pathname), query }),\n getURL()\n )\n return\n }\n\n // __NA is used to identify if the history entry can be handled by the app-router.\n if (state.__NA) {\n window.location.reload()\n return\n }\n\n if (!state.__N) {\n return\n }\n\n // Safari fires popstateevent when reopening the browser.\n if (\n isFirstPopStateEvent &&\n this.locale === state.options.locale &&\n state.as === this.asPath\n ) {\n return\n }\n\n let forcedScroll: { x: number; y: number } | undefined\n const { url, as, options, key } = state\n if (process.env.__NEXT_SCROLL_RESTORATION) {\n if (manualScrollRestoration) {\n if (this._key !== key) {\n // Snapshot current scroll position:\n try {\n sessionStorage.setItem(\n '__next_scroll_' + this._key,\n JSON.stringify({ x: self.pageXOffset, y: self.pageYOffset })\n )\n } catch {}\n\n // Restore old scroll position:\n try {\n const v = sessionStorage.getItem('__next_scroll_' + key)\n forcedScroll = JSON.parse(v!)\n } catch {\n forcedScroll = { x: 0, y: 0 }\n }\n }\n }\n }\n this._key = key\n\n const { pathname } = parseRelativeUrl(url)\n\n // Make sure we don't re-render on initial load,\n // can be caused by navigating back from an external site\n if (\n this.isSsr &&\n as === addBasePath(this.asPath) &&\n pathname === addBasePath(this.pathname)\n ) {\n return\n }\n\n // If the downstream application returns falsy, return.\n // They will then be responsible for handling the event.\n if (this._bps && !this._bps(state)) {\n return\n }\n\n this.change(\n 'replaceState',\n url,\n as,\n Object.assign<{}, TransitionOptions, TransitionOptions>({}, options, {\n shallow: options.shallow && this._shallow,\n locale: options.locale || this.defaultLocale,\n // @ts-ignore internal value not exposed on types\n _h: 0,\n }),\n forcedScroll\n )\n }\n\n reload(): void {\n window.location.reload()\n }\n\n /**\n * Go back in history\n */\n back() {\n window.history.back()\n }\n\n /**\n * Go forward in history\n */\n forward() {\n window.history.forward()\n }\n\n /**\n * Performs a `pushState` with arguments\n * @param url of the route\n * @param as masks `url` for the browser\n * @param options object you can define `shallow` and other options\n */\n push(url: Url, as?: Url, options: TransitionOptions = {}) {\n if (\n isJavaScriptURLString(url.toString()) ||\n (as && isJavaScriptURLString(as.toString()))\n ) {\n throw new Error(\n 'Next.js has blocked a javascript: URL as a security precaution.'\n )\n }\n if (process.env.__NEXT_SCROLL_RESTORATION) {\n // TODO: remove in the future when we update history before route change\n // is complete, as the popstate event should handle this capture.\n if (manualScrollRestoration) {\n try {\n // Snapshot scroll position right before navigating to a new page:\n sessionStorage.setItem(\n '__next_scroll_' + this._key,\n JSON.stringify({ x: self.pageXOffset, y: self.pageYOffset })\n )\n } catch {}\n }\n }\n ;({ url, as } = prepareUrlAs(this, url, as))\n return this.change('pushState', url, as, options)\n }\n\n /**\n * Performs a `replaceState` with arguments\n * @param url of the route\n * @param as masks `url` for the browser\n * @param options object you can define `shallow` and other options\n */\n replace(url: Url, as?: Url, options: TransitionOptions = {}) {\n if (\n isJavaScriptURLString(url.toString()) ||\n (as && isJavaScriptURLString(as.toString()))\n ) {\n throw new Error(\n 'Next.js has blocked a javascript: URL as a security precaution.'\n )\n }\n ;({ url, as } = prepareUrlAs(this, url, as))\n return this.change('replaceState', url, as, options)\n }\n\n async _bfl(\n as: string,\n resolvedAs?: string,\n locale?: string | false,\n skipNavigate?: boolean\n ) {\n if (process.env.__NEXT_CLIENT_ROUTER_FILTER_ENABLED) {\n if (!this._bfl_s && !this._bfl_d) {\n const { BloomFilter } =\n require('../../lib/bloom-filter') as typeof import('../../lib/bloom-filter')\n\n type Filter = ReturnType<\n import('../../lib/bloom-filter').BloomFilter['export']\n >\n let staticFilterData: Filter | undefined\n let dynamicFilterData: Filter | undefined\n\n try {\n ;({\n __routerFilterStatic: staticFilterData,\n __routerFilterDynamic: dynamicFilterData,\n } = (await getClientBuildManifest()) as any as {\n __routerFilterStatic?: Filter\n __routerFilterDynamic?: Filter\n })\n } catch (err) {\n // failed to load build manifest hard navigate\n // to be safe\n console.error(err)\n if (skipNavigate) {\n return true\n }\n handleHardNavigation({\n url: addBasePath(\n addLocale(as, locale || this.locale, this.defaultLocale)\n ),\n router: this,\n })\n return new Promise(() => {})\n }\n\n const routerFilterSValue: Filter | false = process.env\n .__NEXT_CLIENT_ROUTER_S_FILTER as any\n\n if (!staticFilterData && routerFilterSValue) {\n staticFilterData = routerFilterSValue ? routerFilterSValue : undefined\n }\n\n const routerFilterDValue: Filter | false = process.env\n .__NEXT_CLIENT_ROUTER_D_FILTER as any\n\n if (!dynamicFilterData && routerFilterDValue) {\n dynamicFilterData = routerFilterDValue\n ? routerFilterDValue\n : undefined\n }\n\n if (staticFilterData?.numHashes) {\n this._bfl_s = new BloomFilter(\n staticFilterData.numItems,\n staticFilterData.errorRate\n )\n this._bfl_s.import(staticFilterData)\n }\n\n if (dynamicFilterData?.numHashes) {\n this._bfl_d = new BloomFilter(\n dynamicFilterData.numItems,\n dynamicFilterData.errorRate\n )\n this._bfl_d.import(dynamicFilterData)\n }\n }\n\n let matchesBflStatic = false\n let matchesBflDynamic = false\n const pathsToCheck: Array<{ as?: string; allowMatchCurrent?: boolean }> =\n [{ as }, { as: resolvedAs }]\n\n for (const { as: curAs, allowMatchCurrent } of pathsToCheck) {\n if (curAs) {\n const asNoSlash = removeTrailingSlash(\n new URL(curAs, 'http://n').pathname\n )\n const asNoSlashLocale = addBasePath(\n addLocale(asNoSlash, locale || this.locale)\n )\n\n if (\n allowMatchCurrent ||\n asNoSlash !==\n removeTrailingSlash(new URL(this.asPath, 'http://n').pathname)\n ) {\n matchesBflStatic =\n matchesBflStatic ||\n !!this._bfl_s?.contains(asNoSlash) ||\n !!this._bfl_s?.contains(asNoSlashLocale)\n\n for (const normalizedAS of [asNoSlash, asNoSlashLocale]) {\n // if any sub-path of as matches a dynamic filter path\n // it should be hard navigated\n const curAsParts = normalizedAS.split('/')\n for (\n let i = 0;\n !matchesBflDynamic && i < curAsParts.length + 1;\n i++\n ) {\n const currentPart = curAsParts.slice(0, i).join('/')\n if (currentPart && this._bfl_d?.contains(currentPart)) {\n matchesBflDynamic = true\n break\n }\n }\n }\n\n // if the client router filter is matched then we trigger\n // a hard navigation\n if (matchesBflStatic || matchesBflDynamic) {\n if (skipNavigate) {\n return true\n }\n handleHardNavigation({\n url: addBasePath(\n addLocale(as, locale || this.locale, this.defaultLocale)\n ),\n router: this,\n })\n return new Promise(() => {})\n }\n }\n }\n }\n }\n return false\n }\n\n private async change(\n method: HistoryMethod,\n url: string,\n as: string,\n options: TransitionOptions,\n forcedScroll?: { x: number; y: number }\n ): Promise<boolean> {\n if (!isLocalURL(url)) {\n handleHardNavigation({ url, router: this })\n return false\n }\n // WARNING: `_h` is an internal option for handing Next.js client-side\n // hydration. Your app should _never_ use this property. It may change at\n // any time without notice.\n const isQueryUpdating = (options as any)._h === 1\n\n if (!isQueryUpdating && !options.shallow) {\n await this._bfl(as, undefined, options.locale)\n }\n\n let shouldResolveHref =\n isQueryUpdating ||\n (options as any)._shouldResolveHref ||\n parsePath(url).pathname === parsePath(as).pathname\n\n const nextState = {\n ...this.state,\n }\n\n // for static pages with query params in the URL we delay\n // marking the router ready until after the query is updated\n // or a navigation has occurred\n const readyStateChange = this.isReady !== true\n this.isReady = true\n const isSsr = this.isSsr\n\n if (!isQueryUpdating) {\n this.isSsr = false\n }\n\n // if a route transition is already in progress before\n // the query updating is triggered ignore query updating\n if (isQueryUpdating && this.clc) {\n return false\n }\n\n const prevLocale = nextState.locale\n\n if (process.env.__NEXT_I18N_SUPPORT) {\n nextState.locale =\n options.locale === false\n ? this.defaultLocale\n : options.locale || nextState.locale\n\n if (typeof options.locale === 'undefined') {\n options.locale = nextState.locale\n }\n\n const parsedAs = parseRelativeUrl(\n hasBasePath(as) ? removeBasePath(as) : as\n )\n const localePathResult = normalizeLocalePath(\n parsedAs.pathname,\n this.locales\n )\n\n if (localePathResult.detectedLocale) {\n nextState.locale = localePathResult.detectedLocale\n parsedAs.pathname = addBasePath(parsedAs.pathname)\n as = formatWithValidation(parsedAs)\n url = addBasePath(\n normalizeLocalePath(\n hasBasePath(url) ? removeBasePath(url) : url,\n this.locales\n ).pathname\n )\n }\n let didNavigate = false\n\n // we need to wrap this in the env check again since regenerator runtime\n // moves this on its own due to the return\n if (process.env.__NEXT_I18N_SUPPORT) {\n // if the locale isn't configured hard navigate to show 404 page\n if (!this.locales?.includes(nextState.locale!)) {\n parsedAs.pathname = addLocale(parsedAs.pathname, nextState.locale)\n handleHardNavigation({\n url: formatWithValidation(parsedAs),\n router: this,\n })\n // this was previously a return but was removed in favor\n // of better dead code elimination with regenerator runtime\n didNavigate = true\n }\n }\n\n const detectedDomain = detectDomainLocale(\n this.domainLocales,\n undefined,\n nextState.locale\n )\n\n // we need to wrap this in the env check again since regenerator runtime\n // moves this on its own due to the return\n if (process.env.__NEXT_I18N_SUPPORT) {\n // if we are navigating to a domain locale ensure we redirect to the\n // correct domain\n if (\n !didNavigate &&\n detectedDomain &&\n this.isLocaleDomain &&\n self.location.hostname !== detectedDomain.domain\n ) {\n const asNoBasePath = removeBasePath(as)\n handleHardNavigation({\n url: `http${detectedDomain.http ? '' : 's'}://${\n detectedDomain.domain\n }${addBasePath(\n `${\n nextState.locale === detectedDomain.defaultLocale\n ? ''\n : `/${nextState.locale}`\n }${asNoBasePath === '/' ? '' : asNoBasePath}` || '/'\n )}`,\n router: this,\n })\n // this was previously a return but was removed in favor\n // of better dead code elimination with regenerator runtime\n didNavigate = true\n }\n }\n\n if (didNavigate) {\n return new Promise(() => {})\n }\n }\n\n // marking route changes as a navigation start entry\n if (ST) {\n performance.mark('routeChange')\n }\n\n const { shallow = false, scroll = true } = options\n const routeProps = { shallow }\n\n if (this._inFlightRoute && this.clc) {\n if (!isSsr) {\n Router.events.emit(\n 'routeChangeError',\n buildCancellationError(),\n this._inFlightRoute,\n routeProps\n )\n }\n this.clc()\n this.clc = null\n }\n\n as = addBasePath(\n addLocale(\n hasBasePath(as) ? removeBasePath(as) : as,\n options.locale,\n this.defaultLocale\n )\n )\n const cleanedAs = removeLocale(\n hasBasePath(as) ? removeBasePath(as) : as,\n nextState.locale\n )\n this._inFlightRoute = as\n\n const localeChange = prevLocale !== nextState.locale\n\n // If the url change is only related to a hash change\n // We should not proceed. We should only change the state.\n if (!isQueryUpdating && this.onlyAHashChange(cleanedAs) && !localeChange) {\n nextState.asPath = cleanedAs\n Router.events.emit('hashChangeStart', as, routeProps)\n // TODO: do we need the resolved href when only a hash change?\n this.changeState(method, url, as, {\n ...options,\n scroll: false,\n })\n if (scroll) {\n this.scrollToHash(cleanedAs)\n }\n try {\n await this.set(nextState, this.components[nextState.route], null)\n } catch (err) {\n if (isError(err) && err.cancelled) {\n Router.events.emit('routeChangeError', err, cleanedAs, routeProps)\n }\n throw err\n }\n\n Router.events.emit('hashChangeComplete', as, routeProps)\n return true\n }\n\n let parsed = parseRelativeUrl(url)\n let { pathname, query } = parsed\n\n // The build manifest needs to be loaded before auto-static dynamic pages\n // get their query parameters to allow ensuring they can be parsed properly\n // when rewritten to\n let pages: string[], rewrites: any\n try {\n ;[pages, { __rewrites: rewrites }] = await Promise.all([\n this.pageLoader.getPageList(),\n getClientBuildManifest(),\n this.pageLoader.getMiddleware(),\n ])\n } catch (err) {\n // If we fail to resolve the page list or client-build manifest, we must\n // do a server-side transition:\n handleHardNavigation({ url: as, router: this })\n return false\n }\n\n // If asked to change the current URL we should reload the current page\n // (not location.reload() but reload getInitialProps and other Next.js stuffs)\n // We also need to set the method = replaceState always\n // as this should not go into the history (That's how browsers work)\n // We should compare the new asPath to the current asPath, not the url\n if (!this.urlIsNew(cleanedAs) && !localeChange) {\n method = 'replaceState'\n }\n\n // we need to resolve the as value using rewrites for dynamic SSG\n // pages to allow building the data URL correctly\n let resolvedAs = as\n\n // url and as should always be prefixed with basePath by this\n // point by either next/link or router.push/replace so strip the\n // basePath from the pathname to match the pages dir 1-to-1\n pathname = pathname\n ? removeTrailingSlash(removeBasePath(pathname))\n : pathname\n\n let route = removeTrailingSlash(pathname)\n const parsedAsPathname = as.startsWith('/') && parseRelativeUrl(as).pathname\n\n // if we detected the `as` path as app route during prefetching\n // trigger hard navigation. The marker is keyed by the `as` path, but a\n // marker can also sit under the href route when both paths share a\n // pages route (`pages/modal.js` next to `app/modal/[id]/page.js`).\n // Check both so `getRouteInfo()` never reads a marker as component data.\n const appRouterMarkerKey = getAppRouterMarkerKey(\n this,\n cleanedAs,\n nextState.locale\n )\n if (\n (appRouterMarkerKey !== null &&\n (this.components[appRouterMarkerKey] as any)?.__appRouter) ||\n (this.components[route] as any)?.__appRouter\n ) {\n handleHardNavigation({ url: as, router: this })\n return new Promise(() => {})\n }\n\n const isMiddlewareRewrite = !!(\n parsedAsPathname &&\n route !== parsedAsPathname &&\n (!isDynamicRoute(route) ||\n !getRouteMatcher(getRouteRegex(route))(parsedAsPathname))\n )\n\n // we don't attempt resolve asPath when we need to execute\n // middleware as the resolving will occur server-side\n const isMiddlewareMatch =\n !options.shallow &&\n (await matchesMiddleware({\n asPath: as,\n locale: nextState.locale,\n router: this,\n }))\n\n if (isQueryUpdating && isMiddlewareMatch) {\n shouldResolveHref = false\n }\n\n if (shouldResolveHref && pathname !== '/_error') {\n ;(options as any)._shouldResolveHref = true\n\n if (process.env.__NEXT_HAS_REWRITES && as.startsWith('/')) {\n const rewritesResult = resolveRewrites(\n addBasePath(addLocale(cleanedAs, nextState.locale), true),\n pages,\n rewrites,\n query,\n (p: string) => resolveDynamicRoute(p, pages),\n this.locales\n )\n\n if (rewritesResult.externalDest) {\n handleHardNavigation({ url: as, router: this })\n return true\n }\n if (!isMiddlewareMatch) {\n resolvedAs = rewritesResult.asPath\n }\n\n if (rewritesResult.matchedPage && rewritesResult.resolvedHref) {\n // if this directly matches a page we need to update the href to\n // allow the correct page chunk to be loaded\n pathname = rewritesResult.resolvedHref\n parsed.pathname = addBasePath(pathname)\n\n if (!isMiddlewareMatch) {\n url = formatWithValidation(parsed)\n }\n }\n } else {\n parsed.pathname = resolveDynamicRoute(pathname, pages)\n\n if (parsed.pathname !== pathname) {\n pathname = parsed.pathname\n parsed.pathname = addBasePath(pathname)\n\n if (!isMiddlewareMatch) {\n url = formatWithValidation(parsed)\n }\n }\n }\n }\n\n // The pages client router resolves a navigation against pages routes only.\n // When it resolves to a dynamic pages route, an app route that begins with\n // a dynamic segment may be more specific and own this path on the server\n // (e.g. `/en/about` resolves to the pages route `/[locale]/[category]`, but\n // the app route `/[locale]/about` should win). Such app routes have no\n // static prefix for the early `_bfl` check, so reconstruct the candidate\n // patterns from the resolved route and hard navigate when one is in the\n // dynamic filter.\n if (\n !isQueryUpdating &&\n !options.shallow &&\n process.env.__NEXT_CLIENT_ROUTER_FILTER_ENABLED &&\n this._bfl_d &&\n isDynamicRoute(pathname)\n ) {\n const concretePathname = removeTrailingSlash(\n parseRelativeUrl(cleanedAs).pathname\n )\n const isShadowedByAppRoute = hasDynamicFilterCandidate(\n pathname,\n concretePathname,\n (candidate) => !!this._bfl_d?.contains(candidate)\n )\n\n if (isShadowedByAppRoute) {\n handleHardNavigation({ url: as, router: this })\n return new Promise(() => {})\n }\n }\n\n if (!isLocalURL(as)) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `Invalid href: \"${url}\" and as: \"${as}\", received relative href and external as` +\n `\\nSee more info: https://nextjs.org/docs/messages/invalid-relative-url-external-as`\n )\n }\n handleHardNavigation({ url: as, router: this })\n return false\n }\n\n resolvedAs = removeLocale(removeBasePath(resolvedAs), nextState.locale)\n\n route = removeTrailingSlash(pathname)\n\n // A config rewrite can resolve `href` to another pages route after the\n // marker guard above ran. That route can hold a marker from an earlier\n // prefetch, so check it again before `getRouteInfo()` reads the cache.\n if ((this.components[route] as any)?.__appRouter) {\n handleHardNavigation({ url: as, router: this })\n return new Promise(() => {})\n }\n\n let routeMatch: Params | false = false\n\n if (isDynamicRoute(route)) {\n const parsedAs = parseRelativeUrl(resolvedAs)\n const asPathname = parsedAs.pathname\n\n const routeRegex = getRouteRegex(route)\n routeMatch = getRouteMatcher(routeRegex)(asPathname)\n const shouldInterpolate = route === asPathname\n const interpolatedAs = shouldInterpolate\n ? interpolateAs(route, asPathname, query)\n : ({} as { result: undefined; params: undefined })\n\n if (!routeMatch || (shouldInterpolate && !interpolatedAs.result)) {\n const missingParams = Object.keys(routeRegex.groups).filter(\n (param) => !query[param] && !routeRegex.groups[param].optional\n )\n\n if (missingParams.length > 0 && !isMiddlewareMatch) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `${\n shouldInterpolate\n ? `Interpolating href`\n : `Mismatching \\`as\\` and \\`href\\``\n } failed to manually provide ` +\n `the params: ${missingParams.join(\n ', '\n )} in the \\`href\\`'s \\`query\\``\n )\n }\n\n throw new Error(\n (shouldInterpolate\n ? `The provided \\`href\\` (${url}) value is missing query values (${missingParams.join(\n ', '\n )}) to be interpolated properly. `\n : `The provided \\`as\\` value (${asPathname}) is incompatible with the \\`href\\` value (${route}). `) +\n `Read more: https://nextjs.org/docs/messages/${\n shouldInterpolate\n ? 'href-interpolation-failed'\n : 'incompatible-href-as'\n }`\n )\n }\n } else if (shouldInterpolate) {\n as = formatWithValidation(\n Object.assign({}, parsedAs, {\n pathname: interpolatedAs.result,\n query: omit(query, interpolatedAs.params!),\n })\n )\n } else {\n // Merge params into `query`, overwriting any specified in search\n Object.assign(query, routeMatch)\n }\n }\n\n if (!isQueryUpdating) {\n Router.events.emit('routeChangeStart', as, routeProps)\n }\n\n const isErrorRoute = this.pathname === '/404' || this.pathname === '/_error'\n\n try {\n let routeInfo = await this.getRouteInfo({\n route,\n pathname,\n query,\n as,\n resolvedAs,\n routeProps,\n locale: nextState.locale,\n isPreview: nextState.isPreview,\n hasMiddleware: isMiddlewareMatch,\n unstable_skipClientCache: options.unstable_skipClientCache,\n isQueryUpdating: isQueryUpdating && !this.isFallback,\n isMiddlewareRewrite,\n })\n\n if (!isQueryUpdating && !options.shallow) {\n await this._bfl(\n as,\n 'resolvedAs' in routeInfo ? routeInfo.resolvedAs : undefined,\n nextState.locale\n )\n }\n\n if ('route' in routeInfo && isMiddlewareMatch) {\n pathname = routeInfo.route || route\n route = pathname\n\n if (!routeProps.shallow) {\n query = Object.assign({}, routeInfo.query || {}, query)\n }\n\n const cleanedParsedPathname = hasBasePath(parsed.pathname)\n ? removeBasePath(parsed.pathname)\n : parsed.pathname\n\n if (routeMatch && pathname !== cleanedParsedPathname) {\n Object.keys(routeMatch).forEach((key) => {\n if (routeMatch && query[key] === routeMatch[key]) {\n delete query[key]\n }\n })\n }\n\n if (isDynamicRoute(pathname)) {\n const prefixedAs =\n !routeProps.shallow && routeInfo.resolvedAs\n ? routeInfo.resolvedAs\n : addBasePath(\n addLocale(\n new URL(as, location.href).pathname,\n nextState.locale\n ),\n true\n )\n\n let rewriteAs = prefixedAs\n\n if (hasBasePath(rewriteAs)) {\n rewriteAs = removeBasePath(rewriteAs)\n }\n\n if (process.env.__NEXT_I18N_SUPPORT) {\n const localeResult = normalizeLocalePath(rewriteAs, this.locales)\n nextState.locale = localeResult.detectedLocale || nextState.locale\n rewriteAs = localeResult.pathname\n }\n const routeRegex = getRouteRegex(pathname)\n const curRouteMatch = getRouteMatcher(routeRegex)(\n new URL(rewriteAs, location.href).pathname\n )\n\n if (curRouteMatch) {\n Object.assign(query, curRouteMatch)\n }\n }\n }\n\n // If the routeInfo brings a redirect we simply apply it.\n if ('type' in routeInfo) {\n if (routeInfo.type === 'redirect-internal') {\n return this.change(method, routeInfo.newUrl, routeInfo.newAs, options)\n } else {\n handleHardNavigation({ url: routeInfo.destination, router: this })\n return new Promise(() => {})\n }\n }\n\n const component: any = routeInfo.Component\n if (component && component.unstable_scriptLoader) {\n const scripts = [].concat(component.unstable_scriptLoader())\n\n scripts.forEach((script: any) => {\n handleClientScriptLoad(script.props)\n })\n }\n\n // handle redirect on client-transition\n if ((routeInfo.__N_SSG || routeInfo.__N_SSP) && routeInfo.props) {\n if (\n routeInfo.props.pageProps &&\n routeInfo.props.pageProps.__N_REDIRECT\n ) {\n // Use the destination from redirect without adding locale\n options.locale = false\n\n const destination = routeInfo.props.pageProps.__N_REDIRECT\n\n // check if destination is internal (resolves to a page) and attempt\n // client-navigation if it is falling back to hard navigation if\n // it's not\n if (\n destination.startsWith('/') &&\n routeInfo.props.pageProps.__N_REDIRECT_BASE_PATH !== false\n ) {\n const parsedHref = parseRelativeUrl(destination)\n parsedHref.pathname = resolveDynamicRoute(\n parsedHref.pathname,\n pages\n )\n\n const { url: newUrl, as: newAs } = prepareUrlAs(\n this,\n destination,\n destination\n )\n return this.change(method, newUrl, newAs, options)\n }\n handleHardNavigation({ url: destination, router: this })\n return new Promise(() => {})\n }\n\n nextState.isPreview = !!routeInfo.props.__N_PREVIEW\n\n // handle SSG data 404\n if (routeInfo.props.notFound === SSG_DATA_NOT_FOUND) {\n let notFoundRoute\n\n try {\n await this.fetchComponent('/404')\n notFoundRoute = '/404'\n } catch (_) {\n notFoundRoute = '/_error'\n }\n\n routeInfo = await this.getRouteInfo({\n route: notFoundRoute,\n pathname: notFoundRoute,\n query,\n as,\n resolvedAs,\n routeProps: { shallow: false },\n locale: nextState.locale,\n isPreview: nextState.isPreview,\n isNotFound: true,\n })\n\n if ('type' in routeInfo) {\n throw new Error(`Unexpected middleware effect on /404`)\n }\n }\n }\n\n if (\n isQueryUpdating &&\n this.pathname === '/_error' &&\n self.__NEXT_DATA__.props?.pageProps?.statusCode === 500 &&\n routeInfo.props?.pageProps\n ) {\n // ensure statusCode is still correct for static 500 page\n // when updating query information\n routeInfo.props.pageProps.statusCode = 500\n }\n\n // shallow routing is only allowed for same page URL changes.\n const isValidShallowRoute =\n options.shallow && nextState.route === (routeInfo.route ?? route)\n\n const shouldScroll =\n options.scroll ?? (!isQueryUpdating && !isValidShallowRoute)\n const resetScroll = shouldScroll ? { x: 0, y: 0 } : null\n const upcomingScrollState = forcedScroll ?? resetScroll\n\n // the new state that the router gonna set\n const upcomingRouterState = {\n ...nextState,\n route,\n pathname,\n query,\n asPath: cleanedAs,\n isFallback: false,\n }\n\n // When the page being rendered is the 404 page, we should only update the\n // query parameters. Route changes here might add the basePath when it\n // wasn't originally present. This is also why this block is before the\n // below `changeState` call which updates the browser's history (changing\n // the URL).\n if (isQueryUpdating && isErrorRoute) {\n routeInfo = await this.getRouteInfo({\n route: this.pathname,\n pathname: this.pathname,\n query,\n as,\n resolvedAs,\n routeProps: { shallow: false },\n locale: nextState.locale,\n isPreview: nextState.isPreview,\n isQueryUpdating: isQueryUpdating && !this.isFallback,\n })\n\n if ('type' in routeInfo) {\n throw new Error(`Unexpected middleware effect on ${this.pathname}`)\n }\n\n if (\n this.pathname === '/_error' &&\n self.__NEXT_DATA__.props?.pageProps?.statusCode === 500 &&\n routeInfo.props?.pageProps\n ) {\n // ensure statusCode is still correct for static 500 page\n // when updating query information\n routeInfo.props.pageProps.statusCode = 500\n }\n\n try {\n await this.set(upcomingRouterState, routeInfo, upcomingScrollState)\n } catch (err) {\n if (isError(err) && err.cancelled) {\n Router.events.emit('routeChangeError', err, cleanedAs, routeProps)\n }\n throw err\n }\n\n return true\n }\n\n Router.events.emit('beforeHistoryChange', as, routeProps)\n this.changeState(method, url, as, options)\n\n // for query updates we can skip it if the state is unchanged and we don't\n // need to scroll\n // https://github.com/vercel/next.js/issues/37139\n const canSkipUpdating =\n isQueryUpdating &&\n !upcomingScrollState &&\n !readyStateChange &&\n !localeChange &&\n compareRouterStates(upcomingRouterState, this.state)\n\n if (!canSkipUpdating) {\n try {\n await this.set(upcomingRouterState, routeInfo, upcomingScrollState)\n } catch (e: any) {\n if (e.cancelled) routeInfo.error = routeInfo.error || e\n else throw e\n }\n\n if (routeInfo.error) {\n if (!isQueryUpdating) {\n Router.events.emit(\n 'routeChangeError',\n routeInfo.error,\n cleanedAs,\n routeProps\n )\n }\n\n throw routeInfo.error\n }\n\n if (process.env.__NEXT_I18N_SUPPORT) {\n if (nextState.locale) {\n document.documentElement.lang = nextState.locale\n }\n }\n\n if (!isQueryUpdating) {\n Router.events.emit('routeChangeComplete', as, routeProps)\n }\n\n // A hash mark # is the optional last part of a URL\n const hashRegex = /#.+$/\n if (shouldScroll && hashRegex.test(as)) {\n this.scrollToHash(as)\n }\n }\n\n return true\n } catch (err) {\n if (isError(err) && err.cancelled) {\n return false\n }\n throw err\n }\n }\n\n changeState(\n method: HistoryMethod,\n url: string,\n as: string,\n options: TransitionOptions = {}\n ): void {\n if (process.env.NODE_ENV !== 'production') {\n if (typeof window.history === 'undefined') {\n console.error(`Warning: window.history is not available.`)\n return\n }\n\n if (typeof window.history[method] === 'undefined') {\n console.error(`Warning: window.history.${method} is not available`)\n return\n }\n }\n\n if (method !== 'pushState' || getURL() !== as) {\n this._shallow = options.shallow\n window.history[method](\n {\n url,\n as,\n options,\n __N: true,\n key: (this._key = method !== 'pushState' ? this._key : createKey()),\n } as HistoryState,\n // Most browsers currently ignores this parameter, although they may use it in the future.\n // Passing the empty string here should be safe against future changes to the method.\n // https://developer.mozilla.org/docs/Web/API/History/replaceState\n '',\n as\n )\n }\n }\n\n async handleRouteInfoError(\n err: Error & { code?: any; cancelled?: boolean },\n pathname: string,\n query: ParsedUrlQuery,\n as: string,\n routeProps: RouteProperties,\n loadErrorFail?: boolean\n ): Promise<CompletePrivateRouteInfo> {\n if (err.cancelled) {\n // bubble up cancellation errors\n throw err\n }\n\n if (isAssetError(err) || loadErrorFail) {\n Router.events.emit('routeChangeError', err, as, routeProps)\n\n // If we can't load the page it could be one of following reasons\n // 1. Page doesn't exists\n // 2. Page does exist in a different zone\n // 3. Internal error while loading the page\n\n // So, doing a hard reload is the proper way to deal with this.\n handleHardNavigation({\n url: as,\n router: this,\n })\n\n // Changing the URL doesn't block executing the current code path.\n // So let's throw a cancellation error stop the routing logic.\n throw buildCancellationError()\n }\n\n console.error(err)\n\n try {\n let props: Record<string, any> | undefined\n const { page: Component, styleSheets } =\n await this.fetchComponent('/_error')\n\n const routeInfo: CompletePrivateRouteInfo = {\n props,\n Component,\n styleSheets,\n err,\n error: err,\n }\n\n if (!routeInfo.props) {\n try {\n routeInfo.props = await this.getInitialProps(Component, {\n err,\n pathname,\n query,\n } as any)\n } catch (gipErr) {\n console.error('Error in error page `getInitialProps`: ', gipErr)\n routeInfo.props = {}\n }\n }\n\n return routeInfo\n } catch (routeInfoErr) {\n return this.handleRouteInfoError(\n isError(routeInfoErr) ? routeInfoErr : new Error(routeInfoErr + ''),\n pathname,\n query,\n as,\n routeProps,\n true\n )\n }\n }\n\n async getRouteInfo({\n route: requestedRoute,\n pathname,\n query,\n as,\n resolvedAs,\n routeProps,\n locale,\n hasMiddleware,\n isPreview,\n unstable_skipClientCache,\n isQueryUpdating,\n isMiddlewareRewrite,\n isNotFound,\n }: {\n route: string\n pathname: string\n query: ParsedUrlQuery\n as: string\n resolvedAs: string\n hasMiddleware?: boolean\n routeProps: RouteProperties\n locale: string | undefined\n isPreview: boolean\n unstable_skipClientCache?: boolean\n isQueryUpdating?: boolean\n isMiddlewareRewrite?: boolean\n isNotFound?: boolean\n }) {\n /**\n * This `route` binding can change if there's a rewrite\n * so we keep a reference to the original requested route\n * so we can store the cache for it and avoid re-requesting every time\n * for shallow routing purposes.\n */\n let route = requestedRoute\n\n try {\n let existingInfo: PrivateRouteInfo | undefined = this.components[route]\n\n // `prefetch()` stores a `{ __appRouter: true }` marker in\n // `this.components` when the client router filter matches a path. That\n // marker is not route info: it has no `Component` and no `props`, so\n // rendering it crashes `_app`. Treat it as a cache miss and fetch the\n // route info again; `change()` is responsible for the hard navigation.\n if (existingInfo && (existingInfo as any).__appRouter) {\n existingInfo = undefined\n }\n\n if (routeProps.shallow && existingInfo && this.route === route) {\n return existingInfo\n }\n\n const handleCancelled = getCancelledHandler({ route, router: this })\n\n if (hasMiddleware) {\n existingInfo = undefined\n }\n\n let cachedRouteInfo =\n existingInfo &&\n !('initial' in existingInfo) &&\n process.env.NODE_ENV !== 'development'\n ? existingInfo\n : undefined\n\n const isBackground = isQueryUpdating\n const fetchNextDataParams: FetchNextDataParams = {\n dataHref: this.pageLoader.getDataHref({\n href: formatWithValidation({ pathname, query }),\n skipInterpolation: true,\n asPath: isNotFound ? '/404' : resolvedAs,\n locale,\n }),\n hasMiddleware: true,\n isServerRender: this.isSsr,\n parseJSON: true,\n inflightCache: isBackground ? this.sbc : this.sdc,\n persistCache: !isPreview,\n isPrefetch: false,\n unstable_skipClientCache,\n isBackground,\n }\n\n let data:\n | WithMiddlewareEffectsOutput\n | (Pick<WithMiddlewareEffectsOutput, 'json'> &\n Omit<Partial<WithMiddlewareEffectsOutput>, 'json'>)\n | null =\n isQueryUpdating && !isMiddlewareRewrite\n ? null\n : await withMiddlewareEffects({\n fetchData: () => fetchNextData(fetchNextDataParams),\n asPath: isNotFound ? '/404' : resolvedAs,\n locale: locale,\n router: this,\n }).catch((err) => {\n // we don't hard error during query updating\n // as it's un-necessary and doesn't need to be fatal\n // unless it is a fallback route and the props can't\n // be loaded\n if (isQueryUpdating) {\n return null\n }\n throw err\n })\n\n // when rendering error routes we don't apply middleware\n // effects\n if (data && (pathname === '/_error' || pathname === '/404')) {\n data.effect = undefined\n }\n\n if (isQueryUpdating) {\n if (!data) {\n data = { json: self.__NEXT_DATA__.props }\n } else {\n data.json = self.__NEXT_DATA__.props\n }\n }\n\n handleCancelled()\n\n if (\n data?.effect?.type === 'redirect-internal' ||\n data?.effect?.type === 'redirect-external'\n ) {\n return data.effect\n }\n\n if (data?.effect?.type === 'rewrite') {\n const resolvedRoute = removeTrailingSlash(data.effect.resolvedHref)\n const pages = await this.pageLoader.getPageList()\n\n // during query updating the page must match although during\n // client-transition a redirect that doesn't match a page\n // can be returned and this should trigger a hard navigation\n // which is valid for incremental migration\n if (!isQueryUpdating || pages.includes(resolvedRoute)) {\n route = resolvedRoute\n pathname = data.effect.resolvedHref\n query = { ...query, ...data.effect.parsedAs.query }\n resolvedAs = removeBasePath(\n normalizeLocalePath(data.effect.parsedAs.pathname, this.locales)\n .pathname\n )\n\n // Check again the cache with the new destination.\n existingInfo = this.components[route]\n if (existingInfo && (existingInfo as any).__appRouter) {\n existingInfo = undefined\n }\n if (\n routeProps.shallow &&\n existingInfo &&\n this.route === route &&\n !hasMiddleware\n ) {\n // If we have a match with the current route due to rewrite,\n // we can copy the existing information to the rewritten one.\n // Then, we return the information along with the matched route.\n return { ...existingInfo, route }\n }\n }\n }\n\n if (isAPIRoute(route)) {\n handleHardNavigation({ url: as, router: this })\n return new Promise<never>(() => {})\n }\n\n const routeInfo =\n cachedRouteInfo ||\n (await this.fetchComponent(route).then<CompletePrivateRouteInfo>(\n (res) => ({\n Component: res.page,\n styleSheets: res.styleSheets,\n __N_SSG: res.mod.__N_SSG,\n __N_SSP: res.mod.__N_SSP,\n })\n ))\n\n if (process.env.NODE_ENV !== 'production') {\n const { isValidElementType } =\n require('next/dist/compiled/react-is') as typeof import('next/dist/compiled/react-is')\n if (!isValidElementType(routeInfo.Component)) {\n throw new Error(\n `The default export is not a React Component in page: \"${pathname}\"`\n )\n }\n }\n const wasBailedPrefetch = data?.response?.headers.get('x-middleware-skip')\n\n const shouldFetchData = routeInfo.__N_SSG || routeInfo.__N_SSP\n\n // For non-SSG prefetches that bailed before sending data\n // we clear the cache to fetch full response\n if (wasBailedPrefetch && data?.dataHref) {\n delete this.sdc[data.dataHref]\n }\n\n const { props, cacheKey } = await this._getData(async () => {\n if (shouldFetchData) {\n if (data?.json && !wasBailedPrefetch) {\n return { cacheKey: data.cacheKey, props: data.json }\n }\n\n const dataHref = data?.dataHref\n ? data.dataHref\n : this.pageLoader.getDataHref({\n href: formatWithValidation({ pathname, query }),\n asPath: resolvedAs,\n locale,\n })\n\n const fetched = await fetchNextData({\n dataHref,\n isServerRender: this.isSsr,\n parseJSON: true,\n inflightCache: wasBailedPrefetch ? {} : this.sdc,\n persistCache: !isPreview,\n isPrefetch: false,\n unstable_skipClientCache,\n })\n\n return {\n cacheKey: fetched.cacheKey,\n props: fetched.json || {},\n }\n }\n\n return {\n headers: {},\n props: await this.getInitialProps(\n routeInfo.Component,\n // we provide AppTree later so this needs to be `any`\n {\n pathname,\n query,\n asPath: as,\n locale,\n locales: this.locales,\n defaultLocale: this.defaultLocale,\n } as any\n ),\n }\n })\n\n // Only bust the data cache for SSP routes although\n // middleware can skip cache per request with\n // x-middleware-cache: no-cache as well\n if (routeInfo.__N_SSP && fetchNextDataParams.dataHref && cacheKey) {\n delete this.sdc[cacheKey]\n }\n\n // we kick off a HEAD request in the background\n // when a non-prefetch request is made to signal revalidation\n if (\n !this.isPreview &&\n routeInfo.__N_SSG &&\n process.env.NODE_ENV !== 'development' &&\n !isQueryUpdating\n ) {\n fetchNextData(\n Object.assign({}, fetchNextDataParams, {\n isBackground: true,\n persistCache: false,\n inflightCache: this.sbc,\n })\n ).catch(() => {})\n }\n\n props.pageProps = Object.assign({}, props.pageProps)\n routeInfo.props = props\n routeInfo.route = route\n routeInfo.query = query\n routeInfo.resolvedAs = resolvedAs\n this.components[route] = routeInfo\n\n return routeInfo\n } catch (err) {\n return this.handleRouteInfoError(\n getProperError(err),\n pathname,\n query,\n as,\n routeProps\n )\n }\n }\n\n private set(\n state: typeof this.state,\n data: PrivateRouteInfo,\n resetScroll: { x: number; y: number } | null\n ): Promise<void> {\n this.state = state\n\n return this.sub(\n data,\n this.components['/_app'].Component as AppComponent,\n resetScroll\n )\n }\n\n /**\n * Callback to execute before replacing router state\n * @param cb callback to be executed\n */\n beforePopState(cb: BeforePopStateCallback) {\n this._bps = cb\n }\n\n onlyAHashChange(as: string): boolean {\n if (!this.asPath) return false\n const [oldUrlNoHash, oldHash] = this.asPath.split('#', 2)\n const [newUrlNoHash, newHash] = as.split('#', 2)\n\n // Makes sure we scroll to the provided hash if the url/hash are the same\n if (newHash && oldUrlNoHash === newUrlNoHash && oldHash === newHash) {\n return true\n }\n\n // If the urls are change, there's more than a hash change\n if (oldUrlNoHash !== newUrlNoHash) {\n return false\n }\n\n // If the hash has changed, then it's a hash only change.\n // This check is necessary to handle both the enter and\n // leave hash === '' cases. The identity case falls through\n // and is treated as a next reload.\n return oldHash !== newHash\n }\n\n scrollToHash(as: string): void {\n const [, hash = ''] = as.split('#', 2)\n\n disableSmoothScrollDuringRouteTransition(\n () => {\n // Scroll to top if the hash is just `#` with no value or `#top`\n // To mirror browsers\n if (hash === '' || hash === 'top') {\n window.scrollTo(0, 0)\n return\n }\n\n // Decode hash to make non-latin anchor works.\n const rawHash = decodeURIComponent(hash)\n // First we check if the element by id is found\n const idEl = document.getElementById(rawHash)\n if (idEl) {\n idEl.scrollIntoView()\n return\n }\n // If there's no element with the id, we check the `name` property\n // To mirror browsers\n const nameEl = document.getElementsByName(rawHash)[0]\n if (nameEl) {\n nameEl.scrollIntoView()\n }\n },\n {\n onlyHashChange: this.onlyAHashChange(as),\n }\n )\n }\n\n urlIsNew(asPath: string): boolean {\n return this.asPath !== asPath\n }\n\n /**\n * Prefetch page code, you may wait for the data during page rendering.\n * This feature only works in production!\n * @param url the href of prefetched page\n * @param asPath the as path of the prefetched page\n */\n async prefetch(\n url: string,\n asPath: string = url,\n options: PrefetchOptions = {}\n ): Promise<void> {\n // Prefetch is not supported in development mode because it would trigger on-demand-entries\n if (process.env.NODE_ENV !== 'production') {\n return\n }\n\n if (typeof window !== 'undefined' && isBot(window.navigator.userAgent)) {\n // No prefetches for bots that render the link since they are typically navigating\n // links via the equivalent of a hard navigation and hence never utilize these\n // prefetches.\n return\n }\n let parsed = parseRelativeUrl(url)\n\n let { pathname, query } = parsed\n const originalPathname = pathname\n\n if (process.env.__NEXT_I18N_SUPPORT) {\n if (options.locale === false) {\n pathname = normalizeLocalePath!(pathname, this.locales).pathname\n parsed.pathname = pathname\n url = formatWithValidation(parsed)\n\n let parsedAs = parseRelativeUrl(asPath)\n const localePathResult = normalizeLocalePath!(\n parsedAs.pathname,\n this.locales\n )\n parsedAs.pathname = localePathResult.pathname\n options.locale = localePathResult.detectedLocale || this.defaultLocale\n asPath = formatWithValidation(parsedAs)\n }\n }\n\n const pages = await this.pageLoader.getPageList()\n let resolvedAs = asPath\n\n const locale =\n typeof options.locale !== 'undefined'\n ? options.locale || undefined\n : this.locale\n\n const isMiddlewareMatch = await matchesMiddleware({\n asPath: asPath,\n locale: locale,\n router: this,\n })\n\n if (process.env.__NEXT_HAS_REWRITES && asPath.startsWith('/')) {\n let rewrites: any\n ;({ __rewrites: rewrites } = await getClientBuildManifest())\n\n const rewritesResult = resolveRewrites(\n addBasePath(addLocale(asPath, this.locale), true),\n pages,\n rewrites,\n parsed.query,\n (p: string) => resolveDynamicRoute(p, pages),\n this.locales\n )\n\n if (rewritesResult.externalDest) {\n return\n }\n\n if (!isMiddlewareMatch) {\n resolvedAs = removeLocale(\n removeBasePath(rewritesResult.asPath),\n this.locale\n )\n }\n\n if (rewritesResult.matchedPage && rewritesResult.resolvedHref) {\n // if this directly matches a page we need to update the href to\n // allow the correct page chunk to be loaded\n pathname = rewritesResult.resolvedHref\n parsed.pathname = pathname\n\n if (!isMiddlewareMatch) {\n url = formatWithValidation(parsed)\n }\n }\n }\n parsed.pathname = resolveDynamicRoute(parsed.pathname, pages)\n\n if (isDynamicRoute(parsed.pathname)) {\n pathname = parsed.pathname\n parsed.pathname = pathname\n Object.assign(\n query,\n getRouteMatcher(getRouteRegex(parsed.pathname))(\n parsePath(asPath).pathname\n ) || {}\n )\n\n if (!isMiddlewareMatch) {\n url = formatWithValidation(parsed)\n }\n }\n\n const data =\n process.env.__NEXT_MIDDLEWARE_PREFETCH === 'strict'\n ? null\n : await withMiddlewareEffects({\n fetchData: () =>\n fetchNextData({\n dataHref: this.pageLoader.getDataHref({\n href: formatWithValidation({\n pathname: originalPathname,\n query,\n }),\n skipInterpolation: true,\n asPath: resolvedAs,\n locale,\n }),\n hasMiddleware: true,\n isServerRender: false,\n parseJSON: true,\n inflightCache: this.sdc,\n persistCache: !this.isPreview,\n isPrefetch: true,\n }),\n asPath: asPath,\n locale: locale,\n router: this,\n })\n\n /**\n * If there was a rewrite we apply the effects of the rewrite on the\n * current parameters for the prefetch.\n */\n if (data?.effect.type === 'rewrite') {\n parsed.pathname = data.effect.resolvedHref\n pathname = data.effect.resolvedHref\n query = { ...query, ...data.effect.parsedAs.query }\n resolvedAs = data.effect.parsedAs.pathname\n url = formatWithValidation(parsed)\n }\n\n /**\n * If there is a redirect to an external destination then we don't have\n * to prefetch content as it will be unused.\n */\n if (data?.effect.type === 'redirect-external') {\n return\n }\n\n const route = removeTrailingSlash(pathname)\n\n if (await this._bfl(asPath, resolvedAs, options.locale, true)) {\n const appRouterMarkerKey = getAppRouterMarkerKey(\n this,\n asPath,\n options.locale\n )\n // A loaded pages route in the cache is ground truth: the page behind\n // this key exists and was rendered. This is the case when the current\n // page was reached through a rewrite and the canonical URL is\n // prefetched, or when a prefetch is still in flight while a navigation\n // stores the same route. Replacing that entry with the marker would\n // break hash-only changes and shallow navigations, which render the\n // cached entry of the current route directly. Non-shallow navigations\n // consult the client router filter themselves, so they do not depend\n // on the marker to hard navigate.\n if (\n appRouterMarkerKey !== null &&\n this.components[appRouterMarkerKey] === undefined\n ) {\n this.components[appRouterMarkerKey] = { __appRouter: true } as any\n }\n }\n\n await Promise.all([\n this.pageLoader._isSsg(route).then((isSsg) => {\n return isSsg\n ? fetchNextData({\n dataHref: data?.json\n ? data?.dataHref\n : this.pageLoader.getDataHref({\n href: url,\n asPath: resolvedAs,\n locale: locale,\n }),\n isServerRender: false,\n parseJSON: true,\n inflightCache: this.sdc,\n persistCache: !this.isPreview,\n isPrefetch: true,\n unstable_skipClientCache:\n options.unstable_skipClientCache ||\n (options.priority &&\n !!process.env.__NEXT_OPTIMISTIC_CLIENT_CACHE),\n })\n .then(() => false)\n .catch(() => false)\n : false\n }),\n this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](route),\n ])\n }\n\n async fetchComponent(route: string) {\n const handleCancelled = getCancelledHandler({ route, router: this })\n\n try {\n const componentResult = await this.pageLoader.loadPage(route)\n handleCancelled()\n\n return componentResult\n } catch (err) {\n handleCancelled()\n throw err\n }\n }\n\n _getData<T>(fn: () => Promise<T>): Promise<T> {\n let cancelled = false\n const cancel = () => {\n cancelled = true\n }\n this.clc = cancel\n return fn().then((data) => {\n if (cancel === this.clc) {\n this.clc = null\n }\n\n if (cancelled) {\n const err: any = new Error('Loading initial props cancelled')\n err.cancelled = true\n throw err\n }\n\n return data\n })\n }\n\n getInitialProps(\n Component: ComponentType,\n ctx: NextPageContext\n ): Promise<Record<string, any>> {\n const { Component: App } = this.components['/_app']\n const AppTree = this._wrapApp(App as AppComponent)\n ctx.AppTree = AppTree\n return loadGetInitialProps<AppContextType<Router>>(App, {\n AppTree,\n Component,\n router: this,\n ctx,\n })\n }\n\n get route(): string {\n return this.state.route\n }\n\n get pathname(): string {\n return this.state.pathname\n }\n\n get query(): ParsedUrlQuery {\n return this.state.query\n }\n\n get asPath(): string {\n return this.state.asPath\n }\n\n get locale(): string | undefined {\n return this.state.locale\n }\n\n get isFallback(): boolean {\n return this.state.isFallback\n }\n\n get isPreview(): boolean {\n return this.state.isPreview\n }\n}\n"],"names":["removeTrailingSlash","getClientBuildManifest","isAssetError","markAssetError","handleClientScriptLoad","isError","getProperError","denormalizePagePath","normalizeLocalePath","mitt","getLocationOrigin","getURL","loadGetInitialProps","ST","isDynamicRoute","parseRelativeUrl","getRouteMatcher","getRouteRegex","hasDynamicFilterCandidate","formatWithValidation","detectDomainLocale","parsePath","addLocale","removeLocale","removeBasePath","addBasePath","hasBasePath","resolveHref","isAPIRoute","getNextPathnameInfo","formatNextPathnameInfo","compareRouterStates","isLocalURL","isBot","omit","interpolateAs","disableSmoothScrollDuringRouteTransition","MATCHED_PATH_HEADER","NEXT_NAV_DEPLOYMENT_ID_HEADER","getDeploymentId","isJavaScriptURLString","resolveRewrites","process","env","__NEXT_HAS_REWRITES","require","default","buildCancellationError","Object","assign","Error","cancelled","matchesMiddleware","options","matchers","Promise","resolve","router","pageLoader","getMiddleware","pathname","asPathname","asPath","cleanedAs","asWithBasePathAndLocale","locale","some","m","RegExp","regexp","test","stripOrigin","url","origin","startsWith","substring","length","prepareUrlAs","as","resolvedHref","resolvedAs","hrefWasAbsolute","asWasAbsolute","preparedUrl","preparedAs","getAppRouterMarkerKey","effectiveLocale","__NEXT_I18N_SUPPORT","localePathResult","locales","detectedLocale","resolveDynamicRoute","pages","cleanPathname","includes","page","re","getMiddlewareData","source","response","nextConfig","basePath","i18n","trailingSlash","Boolean","__NEXT_TRAILING_SLASH","rewriteHeader","headers","get","rewriteTarget","matchedPath","__NEXT_EXTERNAL_MIDDLEWARE_REWRITE_RESOLVE","parsedRewriteTarget","pathnameInfo","parseData","fsPathname","all","getPageList","then","__rewrites","rewrites","parsedSource","result","query","path","matchedPage","parsedAs","resolvedPathname","matches","type","src","defaultLocale","buildId","destination","hash","redirectTarget","newAs","newUrl","withMiddlewareEffects","fetchData","data","effect","dataHref","json","text","cacheKey","manualScrollRestoration","__NEXT_SCROLL_RESTORATION","window","history","v","sessionStorage","setItem","removeItem","n","SSG_DATA_NOT_FOUND","Symbol","fetchRetry","attempts","fetch","credentials","method","ok","status","tryToParseAsJSON","JSON","parse","error","fetchNextData","inflightCache","isPrefetch","hasMiddleware","isServerRender","parseJSON","persistCache","isBackground","unstable_skipClientCache","href","URL","location","deploymentId","getData","params","purpose","notFound","dplResponseHeader","NODE_ENV","catch","err","message","undefined","createKey","Math","random","toString","slice","handleHardNavigation","getCancelledHandler","route","cancel","clc","handleCancelled","Router","events","constructor","initialProps","App","wrapApp","Component","subscription","isFallback","domainLocales","isPreview","sdc","sbc","isFirstPopStateEvent","_key","onPopState","e","state","changeState","__NA","reload","__N","forcedScroll","key","stringify","x","self","pageXOffset","y","pageYOffset","getItem","isSsr","_bps","change","shallow","_shallow","_h","components","initial","props","__N_SSG","__N_SSP","styleSheets","autoExportDynamic","__NEXT_DATA__","autoExport","__NEXT_ROUTER_BASEPATH","sub","_wrapApp","isLocaleDomain","isReady","gssp","gip","isExperimentalCompile","appGip","gsp","search","hostname","_initialMatchesMiddlewarePromise","_shouldResolveHref","addEventListener","scrollRestoration","back","forward","push","replace","_bfl","skipNavigate","__NEXT_CLIENT_ROUTER_FILTER_ENABLED","_bfl_s","_bfl_d","BloomFilter","staticFilterData","dynamicFilterData","__routerFilterStatic","__routerFilterDynamic","console","routerFilterSValue","__NEXT_CLIENT_ROUTER_S_FILTER","routerFilterDValue","__NEXT_CLIENT_ROUTER_D_FILTER","numHashes","numItems","errorRate","import","matchesBflStatic","matchesBflDynamic","pathsToCheck","curAs","allowMatchCurrent","asNoSlash","asNoSlashLocale","contains","normalizedAS","curAsParts","split","i","currentPart","join","isQueryUpdating","shouldResolveHref","nextState","readyStateChange","prevLocale","didNavigate","detectedDomain","domain","asNoBasePath","http","performance","mark","scroll","routeProps","_inFlightRoute","emit","localeChange","onlyAHashChange","scrollToHash","set","parsed","urlIsNew","parsedAsPathname","appRouterMarkerKey","__appRouter","isMiddlewareRewrite","isMiddlewareMatch","rewritesResult","p","externalDest","concretePathname","isShadowedByAppRoute","candidate","routeMatch","routeRegex","shouldInterpolate","interpolatedAs","missingParams","keys","groups","filter","param","optional","warn","isErrorRoute","routeInfo","getRouteInfo","cleanedParsedPathname","forEach","prefixedAs","rewriteAs","localeResult","curRouteMatch","component","unstable_scriptLoader","scripts","concat","script","pageProps","__N_REDIRECT","__N_REDIRECT_BASE_PATH","parsedHref","__N_PREVIEW","notFoundRoute","fetchComponent","_","isNotFound","statusCode","isValidShallowRoute","shouldScroll","resetScroll","upcomingScrollState","upcomingRouterState","canSkipUpdating","document","documentElement","lang","hashRegex","handleRouteInfoError","loadErrorFail","getInitialProps","gipErr","routeInfoErr","requestedRoute","existingInfo","cachedRouteInfo","fetchNextDataParams","getDataHref","skipInterpolation","resolvedRoute","res","mod","isValidElementType","wasBailedPrefetch","shouldFetchData","_getData","fetched","beforePopState","cb","oldUrlNoHash","oldHash","newUrlNoHash","newHash","scrollTo","rawHash","decodeURIComponent","idEl","getElementById","scrollIntoView","nameEl","getElementsByName","onlyHashChange","prefetch","navigator","userAgent","originalPathname","__NEXT_MIDDLEWARE_PREFETCH","_isSsg","isSsg","priority","__NEXT_OPTIMISTIC_CLIENT_CACHE","componentResult","loadPage","fn","ctx","AppTree"],"mappings":"AASA,SAASA,mBAAmB,QAAQ,gCAA+B;AACnE,SACEC,sBAAsB,EACtBC,YAAY,EACZC,cAAc,QACT,+BAA8B;AACrC,SAASC,sBAAsB,QAAQ,yBAAwB;AAC/D,OAAOC,WAAWC,cAAc,QAAQ,wBAAuB;AAC/D,SAASC,mBAAmB,QAAQ,qCAAoC;AACxE,SAASC,mBAAmB,QAAQ,gCAA+B;AACnE,OAAOC,UAAU,UAAS;AAC1B,SAASC,iBAAiB,EAAEC,MAAM,EAAEC,mBAAmB,EAAEC,EAAE,QAAQ,WAAU;AAC7E,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,gBAAgB,QAAQ,6BAA4B;AAC7D,SAASC,eAAe,QAAQ,wBAAuB;AACvD,SAASC,aAAa,QAAQ,sBAAqB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QAC9B2N,IAAIC,OAAO,GAAGA;QACd,OAAO9Z,oBAA4CkM,KAAK;YACtD4N;YACA1N;YACAvJ,QAAQ,IAAI;YACZgX;QACF;IACF;IAEA,IAAInO,QAAgB;QAClB,OAAO,IAAI,CAACqB,KAAK,CAACrB,KAAK;IACzB;IAEA,IAAI1I,WAAmB;QACrB,OAAO,IAAI,CAAC+J,KAAK,CAAC/J,QAAQ;IAC5B;IAEA,IAAI+D,QAAwB;QAC1B,OAAO,IAAI,CAACgG,KAAK,CAAChG,KAAK;IACzB;IAEA,IAAI7D,SAAiB;QACnB,OAAO,IAAI,CAAC6J,KAAK,CAAC7J,MAAM;IAC1B;IAEA,IAAIG,SAA6B;QAC/B,OAAO,IAAI,CAAC0J,KAAK,CAAC1J,MAAM;IAC1B;IAEA,IAAIiJ,aAAsB;QACxB,OAAO,IAAI,CAACS,KAAK,CAACT,UAAU;IAC9B;IAEA,IAAIE,YAAqB;QACvB,OAAO,IAAI,CAACO,KAAK,CAACP,SAAS;IAC7B;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/routes/app.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/routes/app.js new file mode 100644 index 0000000000000000000000000000000000000000..b130e9fda75336f996f166e2c96b9e2a0d6c27c4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/routes/app.js @@ -0,0 +1,120 @@ +import { InvariantError } from '../../invariant-error'; +import { getSegmentParam } from '../utils/get-segment-param'; +import { INTERCEPTION_ROUTE_MARKERS } from '../utils/interception-routes'; +function normalizeEncodedDynamicPlaceholder(segment) { + if (!/%5b|%5d/i.test(segment)) { + return segment; + } + try { + const decodedSegment = decodeURIComponent(segment); + return getSegmentParam(decodedSegment) ? decodedSegment : segment; + } catch { + return segment; + } +} +export function parseAppRouteSegment(segment) { + if (segment === '') { + return null; + } + // Check if the segment starts with an interception marker + const interceptionMarker = INTERCEPTION_ROUTE_MARKERS.find((m)=>segment.startsWith(m)); + const param = getSegmentParam(segment); + if (param) { + return { + type: 'dynamic', + name: segment, + param, + interceptionMarker + }; + } else if (segment.startsWith('(') && segment.endsWith(')')) { + return { + type: 'route-group', + name: segment, + interceptionMarker + }; + } else if (segment.startsWith('@')) { + return { + type: 'parallel-route', + name: segment, + interceptionMarker + }; + } else { + return { + type: 'static', + name: segment, + interceptionMarker + }; + } +} +export function isNormalizedAppRoute(route) { + return route.normalized; +} +export function isInterceptionAppRoute(route) { + return route.interceptionMarker !== undefined && route.interceptingRoute !== undefined && route.interceptedRoute !== undefined; +} +// Bitmask for which non-URL segment types to allow during parsing. +// By default, route groups and parallel routes are rejected because +// they should have been stripped by normalizeAppPath. These flags +// let callers opt in to allowing specific types. +const OnlyRoutableSegments = /* */ 0; +const AllowParallelSegments = /* */ 1; +const AllowGroupSegments = /* */ 2; +function parseAppRouteImpl(pathname, allowedTypes) { + const pathnameSegments = pathname.split('/').filter(Boolean); + // Build segments array with static and dynamic segments + const segments = []; + // Parse if this is an interception route. + let interceptionMarker; + let interceptingRoute; + let interceptedRoute; + for (const segment of pathnameSegments){ + const normalizedSegment = normalizeEncodedDynamicPlaceholder(segment); + // Parse the segment into an AppSegment. + const appSegment = parseAppRouteSegment(normalizedSegment); + if (!appSegment) { + continue; + } + if (appSegment.type === 'route-group' && !(allowedTypes & AllowGroupSegments)) { + throw new InvariantError(`${pathname} is being parsed as a normalized route, but it has a route group segment.`); + } + if (appSegment.type === 'parallel-route' && !(allowedTypes & AllowParallelSegments)) { + throw new InvariantError(`${pathname} is being parsed as a normalized route, but it has a parallel route segment.`); + } + segments.push(appSegment); + if (appSegment.interceptionMarker) { + const parts = pathname.split(appSegment.interceptionMarker); + if (parts.length !== 2) { + throw new Error(`Invalid interception route: ${pathname}`); + } + interceptingRoute = parseAppRouteImpl(parts[0], allowedTypes); + interceptedRoute = parseAppRouteImpl(parts[1], allowedTypes); + interceptionMarker = appSegment.interceptionMarker; + } + } + const dynamicSegments = segments.filter((segment)=>segment.type === 'dynamic'); + return { + normalized: allowedTypes === OnlyRoutableSegments, + pathname, + segments, + dynamicSegments, + interceptionMarker, + interceptingRoute, + interceptedRoute + }; +} +/** + * Parse an app route that has been fully normalized (no @slot or () + * group segments). Throws if either is present. + */ export function parseNormalizedAppRoute(pathname) { + return parseAppRouteImpl(pathname, OnlyRoutableSegments); +} +/** + * Parse an app route that may contain @slot segments but not () + * group segments. Slot segments are preserved as parallel-route + * type segments so callers can distinguish routes in different + * parallel slots. + */ export function parseAppRouteWithSlots(pathname) { + return parseAppRouteImpl(pathname, AllowParallelSegments); +} + +//# sourceMappingURL=app.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/routes/app.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/routes/app.js.map new file mode 100644 index 0000000000000000000000000000000000000000..21a03245fa0326ec9dce7bb2a29d299535ce3b4d --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/routes/app.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/routes/app.ts"],"sourcesContent":["import { InvariantError } from '../../invariant-error'\nimport { getSegmentParam, type SegmentParam } from '../utils/get-segment-param'\nimport {\n INTERCEPTION_ROUTE_MARKERS,\n type InterceptionMarker,\n} from '../utils/interception-routes'\n\nexport type RouteGroupAppRouteSegment = {\n type: 'route-group'\n name: string\n\n /**\n * If present, this segment has an interception marker prefixing it.\n */\n interceptionMarker?: InterceptionMarker\n}\n\nexport type ParallelRouteAppRouteSegment = {\n type: 'parallel-route'\n name: string\n\n /**\n * If present, this segment has an interception marker prefixing it.\n */\n interceptionMarker?: InterceptionMarker\n}\n\nexport type StaticAppRouteSegment = {\n type: 'static'\n name: string\n\n /**\n * If present, this segment has an interception marker prefixing it.\n */\n interceptionMarker?: InterceptionMarker\n}\n\nexport type DynamicAppRouteSegment = {\n type: 'dynamic'\n name: string\n param: SegmentParam\n\n /**\n * If present, this segment has an interception marker prefixing it.\n */\n interceptionMarker?: InterceptionMarker\n}\n\n/**\n * Represents a single segment in a route path.\n * Can be either static (e.g., \"blog\") or dynamic (e.g., \"[slug]\").\n */\nexport type AppRouteSegment =\n | StaticAppRouteSegment\n | DynamicAppRouteSegment\n | RouteGroupAppRouteSegment\n | ParallelRouteAppRouteSegment\n\nexport type NormalizedAppRouteSegment =\n | StaticAppRouteSegment\n | DynamicAppRouteSegment\n\nfunction normalizeEncodedDynamicPlaceholder(segment: string): string {\n if (!/%5b|%5d/i.test(segment)) {\n return segment\n }\n\n try {\n const decodedSegment = decodeURIComponent(segment)\n return getSegmentParam(decodedSegment) ? decodedSegment : segment\n } catch {\n return segment\n }\n}\n\nexport function parseAppRouteSegment(segment: string): AppRouteSegment | null {\n if (segment === '') {\n return null\n }\n\n // Check if the segment starts with an interception marker\n const interceptionMarker = INTERCEPTION_ROUTE_MARKERS.find((m) =>\n segment.startsWith(m)\n )\n\n const param = getSegmentParam(segment)\n if (param) {\n return {\n type: 'dynamic',\n name: segment,\n param,\n interceptionMarker,\n }\n } else if (segment.startsWith('(') && segment.endsWith(')')) {\n return {\n type: 'route-group',\n name: segment,\n interceptionMarker,\n }\n } else if (segment.startsWith('@')) {\n return {\n type: 'parallel-route',\n name: segment,\n interceptionMarker,\n }\n } else {\n return {\n type: 'static',\n name: segment,\n interceptionMarker,\n }\n }\n}\n\nexport type AppRoute = {\n normalized: boolean\n pathname: string\n segments: AppRouteSegment[]\n dynamicSegments: DynamicAppRouteSegment[]\n interceptionMarker: InterceptionMarker | undefined\n interceptingRoute: AppRoute | undefined\n interceptedRoute: AppRoute | undefined\n}\n\nexport type NormalizedAppRoute = Omit<AppRoute, 'normalized' | 'segments'> & {\n normalized: true\n segments: NormalizedAppRouteSegment[]\n}\n\nexport function isNormalizedAppRoute(\n route: InterceptionAppRoute\n): route is NormalizedInterceptionAppRoute\nexport function isNormalizedAppRoute(\n route: AppRoute | InterceptionAppRoute\n): route is NormalizedAppRoute {\n return route.normalized\n}\n\nexport type InterceptionAppRoute = Omit<\n AppRoute,\n 'interceptionMarker' | 'interceptingRoute' | 'interceptedRoute'\n> & {\n interceptionMarker: InterceptionMarker\n interceptingRoute: AppRoute\n interceptedRoute: AppRoute\n}\n\nexport type NormalizedInterceptionAppRoute = Omit<\n InterceptionAppRoute,\n | 'normalized'\n | 'segments'\n | 'interceptionMarker'\n | 'interceptingRoute'\n | 'interceptedRoute'\n> & {\n normalized: true\n segments: NormalizedAppRouteSegment[]\n interceptionMarker: InterceptionMarker\n interceptingRoute: NormalizedAppRoute\n interceptedRoute: NormalizedAppRoute\n}\n\nexport function isInterceptionAppRoute(\n route: NormalizedAppRoute\n): route is NormalizedInterceptionAppRoute\nexport function isInterceptionAppRoute(\n route: AppRoute\n): route is InterceptionAppRoute {\n return (\n route.interceptionMarker !== undefined &&\n route.interceptingRoute !== undefined &&\n route.interceptedRoute !== undefined\n )\n}\n\n// Bitmask for which non-URL segment types to allow during parsing.\n// By default, route groups and parallel routes are rejected because\n// they should have been stripped by normalizeAppPath. These flags\n// let callers opt in to allowing specific types.\nconst OnlyRoutableSegments = /* */ 0b00\nconst AllowParallelSegments = /* */ 0b01\nconst AllowGroupSegments = /* */ 0b10\n\nfunction parseAppRouteImpl(\n pathname: string,\n allowedTypes: number\n): AppRoute | NormalizedAppRoute {\n const pathnameSegments = pathname.split('/').filter(Boolean)\n\n // Build segments array with static and dynamic segments\n const segments: AppRouteSegment[] = []\n\n // Parse if this is an interception route.\n let interceptionMarker: InterceptionMarker | undefined\n let interceptingRoute: AppRoute | NormalizedAppRoute | undefined\n let interceptedRoute: AppRoute | NormalizedAppRoute | undefined\n\n for (const segment of pathnameSegments) {\n const normalizedSegment = normalizeEncodedDynamicPlaceholder(segment)\n\n // Parse the segment into an AppSegment.\n const appSegment = parseAppRouteSegment(normalizedSegment)\n if (!appSegment) {\n continue\n }\n\n if (\n appSegment.type === 'route-group' &&\n !(allowedTypes & AllowGroupSegments)\n ) {\n throw new InvariantError(\n `${pathname} is being parsed as a normalized route, but it has a route group segment.`\n )\n }\n\n if (\n appSegment.type === 'parallel-route' &&\n !(allowedTypes & AllowParallelSegments)\n ) {\n throw new InvariantError(\n `${pathname} is being parsed as a normalized route, but it has a parallel route segment.`\n )\n }\n\n segments.push(appSegment)\n\n if (appSegment.interceptionMarker) {\n const parts = pathname.split(appSegment.interceptionMarker)\n if (parts.length !== 2) {\n throw new Error(`Invalid interception route: ${pathname}`)\n }\n\n interceptingRoute = parseAppRouteImpl(parts[0], allowedTypes)\n interceptedRoute = parseAppRouteImpl(parts[1], allowedTypes)\n interceptionMarker = appSegment.interceptionMarker\n }\n }\n\n const dynamicSegments = segments.filter(\n (segment) => segment.type === 'dynamic'\n )\n\n return {\n normalized: allowedTypes === OnlyRoutableSegments,\n pathname,\n segments,\n dynamicSegments,\n interceptionMarker,\n interceptingRoute,\n interceptedRoute,\n }\n}\n\n/**\n * Parse an app route that has been fully normalized (no @slot or ()\n * group segments). Throws if either is present.\n */\nexport function parseNormalizedAppRoute(pathname: string): NormalizedAppRoute {\n return parseAppRouteImpl(pathname, OnlyRoutableSegments) as NormalizedAppRoute\n}\n\n/**\n * Parse an app route that may contain @slot segments but not ()\n * group segments. Slot segments are preserved as parallel-route\n * type segments so callers can distinguish routes in different\n * parallel slots.\n */\nexport function parseAppRouteWithSlots(pathname: string): AppRoute {\n return parseAppRouteImpl(pathname, AllowParallelSegments) as AppRoute\n}\n"],"names":["InvariantError","getSegmentParam","INTERCEPTION_ROUTE_MARKERS","normalizeEncodedDynamicPlaceholder","segment","test","decodedSegment","decodeURIComponent","parseAppRouteSegment","interceptionMarker","find","m","startsWith","param","type","name","endsWith","isNormalizedAppRoute","route","normalized","isInterceptionAppRoute","undefined","interceptingRoute","interceptedRoute","OnlyRoutableSegments","AllowParallelSegments","AllowGroupSegments","parseAppRouteImpl","pathname","allowedTypes","pathnameSegments","split","filter","Boolean","segments","normalizedSegment","appSegment","push","parts","length","Error","dynamicSegments","parseNormalizedAppRoute","parseAppRoute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AwBd,QAAgB;IACtD,OAAOD,kBAAkBC,UAAUJ;AACrC;AAEA;;;;;CAKC,GACD,OAAO,SAASmB,uBAAuBf,QAAgB;IACrD,OAAOD,kBAAkBC,UAAUH;AACrC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/add-locale.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/add-locale.js new file mode 100644 index 0000000000000000000000000000000000000000..96265bbb6ced4123bc7631e6c0cf4911f9ca355a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/add-locale.js @@ -0,0 +1,22 @@ +import { addPathPrefix } from './add-path-prefix'; +import { pathHasPrefix } from './path-has-prefix'; +/** + * For a given path and a locale, if the locale is given, it will prefix the + * locale. The path shouldn't be an API path. If a default locale is given the + * prefix will be omitted if the locale is already the default locale. + */ export function addLocale(path, locale, defaultLocale, ignorePrefix) { + // If no locale was given or the locale is the default locale, we don't need + // to prefix the path. + if (!locale || locale === defaultLocale) return path; + const lower = path.toLowerCase(); + // If the path is an API path or the path already has the locale prefix, we + // don't need to prefix the path. + if (!ignorePrefix) { + if (pathHasPrefix(lower, '/api')) return path; + if (pathHasPrefix(lower, `/${locale.toLowerCase()}`)) return path; + } + // Add the locale prefix to the path. + return addPathPrefix(path, `/${locale}`); +} + +//# sourceMappingURL=add-locale.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/add-locale.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/add-locale.js.map new file mode 100644 index 0000000000000000000000000000000000000000..cd60ef6437d8cc73dfb072f98a9eef1fe3c81668 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/add-locale.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/add-locale.ts"],"sourcesContent":["import { addPathPrefix } from './add-path-prefix'\nimport { pathHasPrefix } from './path-has-prefix'\n\n/**\n * For a given path and a locale, if the locale is given, it will prefix the\n * locale. The path shouldn't be an API path. If a default locale is given the\n * prefix will be omitted if the locale is already the default locale.\n */\nexport function addLocale(\n path: string,\n locale?: string | false,\n defaultLocale?: string,\n ignorePrefix?: boolean\n) {\n // If no locale was given or the locale is the default locale, we don't need\n // to prefix the path.\n if (!locale || locale === defaultLocale) return path\n\n const lower = path.toLowerCase()\n\n // If the path is an API path or the path already has the locale prefix, we\n // don't need to prefix the path.\n if (!ignorePrefix) {\n if (pathHasPrefix(lower, '/api')) return path\n if (pathHasPrefix(lower, `/${locale.toLowerCase()}`)) return path\n }\n\n // Add the locale prefix to the path.\n return addPathPrefix(path, `/${locale}`)\n}\n"],"names":["addPathPrefix","pathHasPrefix","addLocale","path","locale","defaultLocale","ignorePrefix","lower","toLowerCase"],"mappings":"AAAA,SAASA,aAAa,QAAQ,oBAAmB;AACjD,SAASC,aAAa,QAAQ,oBAAmB;AAEjD;;;;CAIC,GACD,OAAO,SAASC,UACdC,IAAY,EACZC,MAAuB,EACvBC,aAAsB,EACtBC,YAAsB;IAEtB,4EAA4E;IAC5E,sBAAsB;IACtB,IAAI,CAACF,UAAUA,WAAWC,eAAe,OAAOF;IAEhD,MAAMI,QAAQJ,KAAKK,WAAW;IAE9B,2EAA2E;IAC3E,iCAAiC;IACjC,IAAI,CAACF,cAAc;QACjB,IAAIL,cAAcM,OAAO,SAAS,OAAOJ;QACzC,IAAIF,cAAcM,OAAO,CAAC,CAAC,EAAEH,OAAOI,WAAW,IAAI,GAAG,OAAOL;IAC/D;IAEA,qCAAqC;IACrC,OAAOH,cAAcG,MAAM,CAAC,CAAC,EAAEC,QAAQ;AACzC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/add-path-prefix.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/add-path-prefix.js new file mode 100644 index 0000000000000000000000000000000000000000..8d5d85ab910c2481aa0c22bd0a1aa4a6878e87ab --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/add-path-prefix.js @@ -0,0 +1,13 @@ +import { parsePath } from './parse-path'; +/** + * Adds the provided prefix to the given path. It first ensures that the path + * is indeed starting with a slash. + */ export function addPathPrefix(path, prefix) { + if (!path.startsWith('/') || !prefix) { + return path; + } + const { pathname, query, hash } = parsePath(path); + return `${prefix}${pathname}${query}${hash}`; +} + +//# sourceMappingURL=add-path-prefix.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/add-path-prefix.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/add-path-prefix.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f56a1847d76240331818c3568fe54b7b655f705d --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/add-path-prefix.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/add-path-prefix.ts"],"sourcesContent":["import { parsePath } from './parse-path'\n\n/**\n * Adds the provided prefix to the given path. It first ensures that the path\n * is indeed starting with a slash.\n */\nexport function addPathPrefix(path: string, prefix?: string) {\n if (!path.startsWith('/') || !prefix) {\n return path\n }\n\n const { pathname, query, hash } = parsePath(path)\n return `${prefix}${pathname}${query}${hash}`\n}\n"],"names":["parsePath","addPathPrefix","path","prefix","startsWith","pathname","query","hash"],"mappings":"AAAA,SAASA,SAAS,QAAQ,eAAc;AAExC;;;CAGC,GACD,OAAO,SAASC,cAAcC,IAAY,EAAEC,MAAe;IACzD,IAAI,CAACD,KAAKE,UAAU,CAAC,QAAQ,CAACD,QAAQ;QACpC,OAAOD;IACT;IAEA,MAAM,EAAEG,QAAQ,EAAEC,KAAK,EAAEC,IAAI,EAAE,GAAGP,UAAUE;IAC5C,OAAO,GAAGC,SAASE,WAAWC,QAAQC,MAAM;AAC9C","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/add-path-suffix.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/add-path-suffix.js new file mode 100644 index 0000000000000000000000000000000000000000..d8139f4449702c0027acbb1065e046a916ca2026 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/add-path-suffix.js @@ -0,0 +1,14 @@ +import { parsePath } from './parse-path'; +/** + * Similarly to `addPathPrefix`, this function adds a suffix at the end on the + * provided path. It also works only for paths ensuring the argument starts + * with a slash. + */ export function addPathSuffix(path, suffix) { + if (!path.startsWith('/') || !suffix) { + return path; + } + const { pathname, query, hash } = parsePath(path); + return `${pathname}${suffix}${query}${hash}`; +} + +//# sourceMappingURL=add-path-suffix.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/add-path-suffix.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/add-path-suffix.js.map new file mode 100644 index 0000000000000000000000000000000000000000..30e696fe1d0fe48c20cd873982c0ca94ab4b72b4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/add-path-suffix.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/add-path-suffix.ts"],"sourcesContent":["import { parsePath } from './parse-path'\n\n/**\n * Similarly to `addPathPrefix`, this function adds a suffix at the end on the\n * provided path. It also works only for paths ensuring the argument starts\n * with a slash.\n */\nexport function addPathSuffix(path: string, suffix?: string) {\n if (!path.startsWith('/') || !suffix) {\n return path\n }\n\n const { pathname, query, hash } = parsePath(path)\n return `${pathname}${suffix}${query}${hash}`\n}\n"],"names":["parsePath","addPathSuffix","path","suffix","startsWith","pathname","query","hash"],"mappings":"AAAA,SAASA,SAAS,QAAQ,eAAc;AAExC;;;;CAIC,GACD,OAAO,SAASC,cAAcC,IAAY,EAAEC,MAAe;IACzD,IAAI,CAACD,KAAKE,UAAU,CAAC,QAAQ,CAACD,QAAQ;QACpC,OAAOD;IACT;IAEA,MAAM,EAAEG,QAAQ,EAAEC,KAAK,EAAEC,IAAI,EAAE,GAAGP,UAAUE;IAC5C,OAAO,GAAGG,WAAWF,SAASG,QAAQC,MAAM;AAC9C","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/app-paths.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/app-paths.js new file mode 100644 index 0000000000000000000000000000000000000000..b3a322b608f293f3e571732f57b7b8833002c886 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/app-paths.js @@ -0,0 +1,88 @@ +import { ensureLeadingSlash } from '../../page-path/ensure-leading-slash'; +import { isGroupSegment } from '../../segment'; +/** + * Normalizes an app route so it represents the actual request path. Essentially + * performing the following transformations: + * + * - `/(dashboard)/user/[id]/page` to `/user/[id]` + * - `/(dashboard)/account/page` to `/account` + * - `/user/[id]/page` to `/user/[id]` + * - `/account/page` to `/account` + * - `/page` to `/` + * - `/(dashboard)/user/[id]/route` to `/user/[id]` + * - `/(dashboard)/account/route` to `/account` + * - `/user/[id]/route` to `/user/[id]` + * - `/account/route` to `/account` + * - `/route` to `/` + * - `/` to `/` + * + * @param route the app route to normalize + * @returns the normalized pathname + */ export function normalizeAppPath(route) { + return ensureLeadingSlash(route.split('/').reduce((pathname, segment, index, segments)=>{ + // Empty segments are ignored. + if (!segment) { + return pathname; + } + // Groups are ignored. + if (isGroupSegment(segment)) { + return pathname; + } + // Parallel segments are ignored. + if (segment[0] === '@') { + return pathname; + } + // The last segment (if it's a leaf) should be ignored. + if ((segment === 'page' || segment === 'route') && index === segments.length - 1) { + return pathname; + } + return `${pathname}/${segment}`; + }, '')); +} +/** + * Comparator for sorting app paths so that parallel slot paths (containing + * `/@`) come before the children/root page path. This keeps the direct + * children/root page last so it can be selected as the canonical entry. + * + * Without this, route group prefixes like `(group)` (char code 0x28) sort + * before `@` (0x40), causing the children page to sort first instead of last + * and leading to a manifest mismatch / 404 in webpack dev mode. + */ export function compareAppPaths(a, b) { + const aHasSlot = a.includes('/@'); + const bHasSlot = b.includes('/@'); + if (aHasSlot && !bHasSlot) return -1; + if (!aHasSlot && bHasSlot) return 1; + return a.localeCompare(b); +} +function normalizeAppPageEntryPathname(appPath) { + // Webpack app entries preserve escaped underscore segments as `%5F`, while + // normalized request pathnames expose the decoded `_` segment. + return normalizeAppPath(appPath).replace(/%5F/g, '_'); +} +/** + * Selects the app path that owns the compiled entry for a normalized route. + * Catch-all normalization can add app paths from other routes, so only direct + * paths are candidates. Among those, compareAppPaths deterministically prefers + * the children/root page, or a stable slot when the route only has slots. + */ export function selectAppPageEntry(pathname, appPaths, normalizePathname = normalizeAppPageEntryPathname) { + let entry; + for (const appPath of appPaths){ + if (normalizePathname(appPath) !== pathname) continue; + if (entry === undefined || compareAppPaths(entry, appPath) < 0) { + entry = appPath; + } + } + if (entry === undefined) { + throw new Error(`Invariant: no direct app page entry found for ${pathname}`); + } + return entry; +} +/** + * Strips the `.rsc` extension if it's in the pathname. + * Since this function is used on full urls it checks `?` for searchParams handling. + */ export function normalizeRscURL(url) { + return url.replace(/\.rsc($|\?)/, // $1 ensures `?` is preserved + '$1'); +} + +//# sourceMappingURL=app-paths.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/app-paths.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/app-paths.js.map new file mode 100644 index 0000000000000000000000000000000000000000..29e69649c88afaebc1a461dda0f0c7c18ac5c5d2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/app-paths.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/app-paths.ts"],"sourcesContent":["import { ensureLeadingSlash } from '../../page-path/ensure-leading-slash'\nimport { isGroupSegment } from '../../segment'\n\n/**\n * Normalizes an app route so it represents the actual request path. Essentially\n * performing the following transformations:\n *\n * - `/(dashboard)/user/[id]/page` to `/user/[id]`\n * - `/(dashboard)/account/page` to `/account`\n * - `/user/[id]/page` to `/user/[id]`\n * - `/account/page` to `/account`\n * - `/page` to `/`\n * - `/(dashboard)/user/[id]/route` to `/user/[id]`\n * - `/(dashboard)/account/route` to `/account`\n * - `/user/[id]/route` to `/user/[id]`\n * - `/account/route` to `/account`\n * - `/route` to `/`\n * - `/` to `/`\n *\n * @param route the app route to normalize\n * @returns the normalized pathname\n */\nexport function normalizeAppPath(route: string) {\n return ensureLeadingSlash(\n route.split('/').reduce((pathname, segment, index, segments) => {\n // Empty segments are ignored.\n if (!segment) {\n return pathname\n }\n\n // Groups are ignored.\n if (isGroupSegment(segment)) {\n return pathname\n }\n\n // Parallel segments are ignored.\n if (segment[0] === '@') {\n return pathname\n }\n\n // The last segment (if it's a leaf) should be ignored.\n if (\n (segment === 'page' || segment === 'route') &&\n index === segments.length - 1\n ) {\n return pathname\n }\n\n return `${pathname}/${segment}`\n }, '')\n )\n}\n\n/**\n * Comparator for sorting app paths so that parallel slot paths (containing\n * `/@`) come before the children/root page path. This keeps the direct\n * children/root page last so it can be selected as the canonical entry.\n *\n * Without this, route group prefixes like `(group)` (char code 0x28) sort\n * before `@` (0x40), causing the children page to sort first instead of last\n * and leading to a manifest mismatch / 404 in webpack dev mode.\n */\nexport function compareAppPaths(a: string, b: string): number {\n const aHasSlot = a.includes('/@')\n const bHasSlot = b.includes('/@')\n if (aHasSlot && !bHasSlot) return -1\n if (!aHasSlot && bHasSlot) return 1\n return a.localeCompare(b)\n}\n\nfunction normalizeAppPageEntryPathname(appPath: string): string {\n // Webpack app entries preserve escaped underscore segments as `%5F`, while\n // normalized request pathnames expose the decoded `_` segment.\n return normalizeAppPath(appPath).replace(/%5F/g, '_')\n}\n\n/**\n * Selects the app path that owns the compiled entry for a normalized route.\n * Catch-all normalization can add app paths from other routes, so only direct\n * paths are candidates. Among those, compareAppPaths deterministically prefers\n * the children/root page, or a stable slot when the route only has slots.\n */\nexport function selectAppPageEntry(\n pathname: string,\n appPaths: readonly string[],\n normalizePathname: (appPath: string) => string = normalizeAppPageEntryPathname\n): string {\n let entry: string | undefined\n\n for (const appPath of appPaths) {\n if (normalizePathname(appPath) !== pathname) continue\n\n if (entry === undefined || compareAppPaths(entry, appPath) < 0) {\n entry = appPath\n }\n }\n\n if (entry === undefined) {\n throw new Error(`Invariant: no direct app page entry found for ${pathname}`)\n }\n\n return entry\n}\n\n/**\n * Strips the `.rsc` extension if it's in the pathname.\n * Since this function is used on full urls it checks `?` for searchParams handling.\n */\nexport function normalizeRscURL(url: string) {\n return url.replace(\n /\\.rsc($|\\?)/,\n // $1 ensures `?` is preserved\n '$1'\n )\n}\n"],"names":["ensureLeadingSlash","isGroupSegment","normalizeAppPath","route","split","reduce","pathname","segment","index","segments","length","compareAppPaths","a","b","aHasSlot","includes","bHasSlot","localeCompare","normalizeAppPageEntryPathname","appPath","replace","selectAppPageEntry","appPaths","normalizePathname","entry","undefined","Error","normalizeRscURL","url"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,uCAAsC;AACzE,SAASC,cAAc,QAAQ,gBAAe;AAE9C;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,SAASC,iBAAiBC,KAAa;IAC5C,OAAOH,mBACLG,MAAMC,KAAK,CAAC,KAAKC,MAAM,CAAC,CAACC,UAAUC,SAASC,OAAOC;QACjD,8BAA8B;QAC9B,IAAI,CAACF,SAAS;YACZ,OAAOD;QACT;QAEA,sBAAsB;QACtB,IAAIL,eAAeM,UAAU;YAC3B,OAAOD;QACT;QAEA,iCAAiC;QACjC,IAAIC,OAAO,CAAC,EAAE,KAAK,KAAK;YACtB,OAAOD;QACT;QAEA,uDAAuD;QACvD,IACE,AAACC,CAAAA,YAAY,UAAUA,YAAY,OAAM,KACzCC,UAAUC,SAASC,MAAM,GAAG,GAC5B;YACA,OAAOJ;QACT;QAEA,OAAO,GAAGA,SAAS,CAAC,EAAEC,SAAS;IACjC,GAAG;AAEP;AAEA;;;;;;;;CAQC,GACD,OAAO,SAASI,gBAAgBC,CAAS,EAAEC,CAAS;IAClD,MAAMC,WAAWF,EAAEG,QAAQ,CAAC;IAC5B,MAAMC,WAAWH,EAAEE,QAAQ,CAAC;IAC5B,IAAID,YAAY,CAACE,UAAU,OAAO,CAAC;IACnC,IAAI,CAACF,YAAYE,UAAU,OAAO;IAClC,OAAOJ,EAAEK,aAAa,CAACJ;AACzB;AAEA,SAASK,8BAA8BC,OAAe;IACpD,2EAA2E;IAC3E,+DAA+D;IAC/D,OAAOjB,iBAAiBiB,SAASC,OAAO,CAAC,QAAQ;AACnD;AAEA;;;;;CAKC,GACD,OAAO,SAASC,mBACdf,QAAgB,EAChBgB,QAA2B,EAC3BC,oBAAiDL,6BAA6B;IAE9E,IAAIM;IAEJ,KAAK,MAAML,WAAWG,SAAU;QAC9B,IAAIC,kBAAkBJ,aAAab,UAAU;QAE7C,IAAIkB,UAAUC,aAAad,gBAAgBa,OAAOL,WAAW,GAAG;YAC9DK,QAAQL;QACV;IACF;IAEA,IAAIK,UAAUC,WAAW;QACvB,MAAM,IAAIC,MAAM,CAAC,8CAA8C,EAAEpB,UAAU;IAC7E;IAEA,OAAOkB;AACT;AAEA;;;CAGC,GACD,OAAO,SAASG,gBAAgBC,GAAW;IACzC,OAAOA,IAAIR,OAAO,CAChB,eACA,8BAA8B;IAC9B;AAEJ","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/as-path-to-search-params.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/as-path-to-search-params.js new file mode 100644 index 0000000000000000000000000000000000000000..89cf173441f1e6b4089da5f31d73ba0598d9ac70 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/as-path-to-search-params.js @@ -0,0 +1,7 @@ +// Convert router.asPath to a URLSearchParams object +// example: /dynamic/[slug]?foo=bar -> { foo: 'bar' } +export function asPathToSearchParams(asPath) { + return new URL(asPath, 'http://n').searchParams; +} + +//# sourceMappingURL=as-path-to-search-params.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/as-path-to-search-params.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/as-path-to-search-params.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6e340dee92a389ec1601b2748c55275864e42b02 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/as-path-to-search-params.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/as-path-to-search-params.ts"],"sourcesContent":["// Convert router.asPath to a URLSearchParams object\n// example: /dynamic/[slug]?foo=bar -> { foo: 'bar' }\nexport function asPathToSearchParams(asPath: string): URLSearchParams {\n return new URL(asPath, 'http://n').searchParams\n}\n"],"names":["asPathToSearchParams","asPath","URL","searchParams"],"mappings":"AAAA,oDAAoD;AACpD,qDAAqD;AACrD,OAAO,SAASA,qBAAqBC,MAAc;IACjD,OAAO,IAAIC,IAAID,QAAQ,YAAYE,YAAY;AACjD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/cache-busting-search-param.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/cache-busting-search-param.js new file mode 100644 index 0000000000000000000000000000000000000000..38be27490f72a8bbfae5a882ec64e5a10167fe6c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/cache-busting-search-param.js @@ -0,0 +1,48 @@ +import { hexHash } from '../../hash'; +const CACHE_BUSTING_SEARCH_PARAM_DIGEST_BYTES = 12; +const textEncoder = new TextEncoder(); +function encodeCacheBustingSearchParam(bytes) { + let binary = ''; + for(let i = 0; i < bytes.length; i++){ + binary += String.fromCharCode(bytes[i]); + } + return btoa(binary).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, ''); +} +function normalizeCacheBustingInput(value) { + if (value === undefined) { + return '0'; + } + return Array.isArray(value) ? value.join(',') : value; +} +function createCacheBustingSearchParamInput(prefetchHeader, segmentPrefetchHeader, stateTreeHeader, nextUrlHeader) { + if ((prefetchHeader === undefined || prefetchHeader === '0') && segmentPrefetchHeader === undefined && stateTreeHeader === undefined && nextUrlHeader === undefined) { + return null; + } + return [ + prefetchHeader ?? '0', + normalizeCacheBustingInput(segmentPrefetchHeader), + normalizeCacheBustingInput(stateTreeHeader), + normalizeCacheBustingInput(nextUrlHeader) + ].join(','); +} +async function computeCacheBustingSearchParamFromInput(input) { + // Truncate SHA-256 to 96 bits to keep `_rsc` compact + const digest = await globalThis.crypto.subtle.digest('SHA-256', textEncoder.encode(input)); + return encodeCacheBustingSearchParam(new Uint8Array(digest).subarray(0, CACHE_BUSTING_SEARCH_PARAM_DIGEST_BYTES)); +} +export async function computeCacheBustingSearchParam(prefetchHeader, segmentPrefetchHeader, stateTreeHeader, nextUrlHeader) { + const input = createCacheBustingSearchParamInput(prefetchHeader, segmentPrefetchHeader, stateTreeHeader, nextUrlHeader); + if (input === null) { + return ''; + } + return computeCacheBustingSearchParamFromInput(input); +} +export function computeLegacyCacheBustingSearchParam(prefetchHeader, segmentPrefetchHeader, stateTreeHeader, nextUrlHeader) { + const input = createCacheBustingSearchParamInput(prefetchHeader, segmentPrefetchHeader, stateTreeHeader, nextUrlHeader); + if (input === null) { + return ''; + } + return hexHash(input); +} + +//# sourceMappingURL=cache-busting-search-param.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/cache-busting-search-param.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/cache-busting-search-param.js.map new file mode 100644 index 0000000000000000000000000000000000000000..29aa87d93bd4beaf42596f2e3ef0df670d8cac1e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/cache-busting-search-param.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/cache-busting-search-param.ts"],"sourcesContent":["import { hexHash } from '../../hash'\n\nconst CACHE_BUSTING_SEARCH_PARAM_DIGEST_BYTES = 12\nconst textEncoder = new TextEncoder()\n\nfunction encodeCacheBustingSearchParam(bytes: Uint8Array): string {\n let binary = ''\n for (let i = 0; i < bytes.length; i++) {\n binary += String.fromCharCode(bytes[i])\n }\n\n return btoa(binary).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '')\n}\n\nfunction normalizeCacheBustingInput(\n value: string | string[] | undefined\n): string {\n if (value === undefined) {\n return '0'\n }\n return Array.isArray(value) ? value.join(',') : value\n}\n\nfunction createCacheBustingSearchParamInput(\n prefetchHeader: '1' | '2' | '3' | '0' | undefined,\n segmentPrefetchHeader: string | string[] | undefined,\n stateTreeHeader: string | string[] | undefined,\n nextUrlHeader: string | string[] | undefined\n): string | null {\n if (\n (prefetchHeader === undefined || prefetchHeader === '0') &&\n segmentPrefetchHeader === undefined &&\n stateTreeHeader === undefined &&\n nextUrlHeader === undefined\n ) {\n return null\n }\n\n return [\n prefetchHeader ?? '0',\n normalizeCacheBustingInput(segmentPrefetchHeader),\n normalizeCacheBustingInput(stateTreeHeader),\n normalizeCacheBustingInput(nextUrlHeader),\n ].join(',')\n}\n\nasync function computeCacheBustingSearchParamFromInput(\n input: string\n): Promise<string> {\n // Truncate SHA-256 to 96 bits to keep `_rsc` compact\n const digest = await globalThis.crypto.subtle.digest(\n 'SHA-256',\n textEncoder.encode(input)\n )\n return encodeCacheBustingSearchParam(\n new Uint8Array(digest).subarray(0, CACHE_BUSTING_SEARCH_PARAM_DIGEST_BYTES)\n )\n}\n\nexport async function computeCacheBustingSearchParam(\n prefetchHeader: '1' | '2' | '3' | '0' | undefined,\n segmentPrefetchHeader: string | string[] | undefined,\n stateTreeHeader: string | string[] | undefined,\n nextUrlHeader: string | string[] | undefined\n): Promise<string> {\n const input = createCacheBustingSearchParamInput(\n prefetchHeader,\n segmentPrefetchHeader,\n stateTreeHeader,\n nextUrlHeader\n )\n if (input === null) {\n return ''\n }\n\n return computeCacheBustingSearchParamFromInput(input)\n}\n\nexport function computeLegacyCacheBustingSearchParam(\n prefetchHeader: '1' | '2' | '3' | '0' | undefined,\n segmentPrefetchHeader: string | string[] | undefined,\n stateTreeHeader: string | string[] | undefined,\n nextUrlHeader: string | string[] | undefined\n): string {\n const input = createCacheBustingSearchParamInput(\n prefetchHeader,\n segmentPrefetchHeader,\n stateTreeHeader,\n nextUrlHeader\n )\n if (input === null) {\n return ''\n }\n\n return hexHash(input)\n}\n"],"names":["hexHash","CACHE_BUSTING_SEARCH_PARAM_DIGEST_BYTES","textEncoder","TextEncoder","encodeCacheBustingSearchParam","bytes","binary","i","length","String","fromCharCode","btoa","replace","normalizeCacheBustingInput","value","undefined","Array","isArray","join","createCacheBustingSearchParamInput","prefetchHeader","segmentPrefetchHeader","stateTreeHeader","nextUrlHeader","computeCacheBustingSearchParamFromInput","input","digest","globalThis","crypto","subtle","encode","Uint8Array","subarray","computeCacheBustingSearchParam","computeLegacyCacheBustingSearchParam"],"mappings":"AAAA,SAASA,OAAO,QAAQ,aAAY;AAEpC,MAAMC,0CAA0C;AAChD,MAAMC,cAAc,IAAIC;AAExB,SAASC,8BAA8BC,KAAiB;IACtD,IAAIC,SAAS;IACb,IAAK,IAAIC,IAAI,GAAGA,IAAIF,MAAMG,MAAM,EAAED,IAAK;QACrCD,UAAUG,OAAOC,YAAY,CAACL,KAAK,CAACE,EAAE;IACxC;IAEA,OAAOI,KAAKL,QAAQM,OAAO,CAAC,OAAO,KAAKA,OAAO,CAAC,OAAO,KAAKA,OAAO,CAAC,OAAO;AAC7E;AAEA,SAASC,2BACPC,KAAoC;IAEpC,IAAIA,UAAUC,WAAW;QACvB,OAAO;IACT;IACA,OAAOC,MAAMC,OAAO,CAACH,SAASA,MAAMI,IAAI,CAAC,OAAOJ;AAClD;AAEA,SAASK,mCACPC,cAAiD,EACjDC,qBAAoD,EACpDC,eAA8C,EAC9CC,aAA4C;IAE5C,IACE,AAACH,CAAAA,mBAAmBL,aAAaK,mBAAmB,GAAE,KACtDC,0BAA0BN,aAC1BO,oBAAoBP,aACpBQ,kBAAkBR,WAClB;QACA,OAAO;IACT;IAEA,OAAO;QACLK,kBAAkB;QAClBP,2BAA2BQ;QAC3BR,2BAA2BS;QAC3BT,2BAA2BU;KAC5B,CAACL,IAAI,CAAC;AACT;AAEA,eAAeM,wCACbC,KAAa;IAEb,qDAAqD;IACrD,MAAMC,SAAS,MAAMC,WAAWC,MAAM,CAACC,MAAM,CAACH,MAAM,CAClD,WACAxB,YAAY4B,MAAM,CAACL;IAErB,OAAOrB,8BACL,IAAI2B,WAAWL,QAAQM,QAAQ,CAAC,GAAG/B;AAEvC;AAEA,OAAO,eAAegC,+BACpBb,cAAiD,EACjDC,qBAAoD,EACpDC,eAA8C,EAC9CC,aAA4C;IAE5C,MAAME,QAAQN,mCACZC,gBACAC,uBACAC,iBACAC;IAEF,IAAIE,UAAU,MAAM;QAClB,OAAO;IACT;IAEA,OAAOD,wCAAwCC;AACjD;AAEA,OAAO,SAASS,qCACdd,cAAiD,EACjDC,qBAAoD,EACpDC,eAA8C,EAC9CC,aAA4C;IAE5C,MAAME,QAAQN,mCACZC,gBACAC,uBACAC,iBACAC;IAEF,IAAIE,UAAU,MAAM;QAClB,OAAO;IACT;IAEA,OAAOzB,QAAQyB;AACjB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/compare-states.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/compare-states.js new file mode 100644 index 0000000000000000000000000000000000000000..ed31a2b8d48e5b393f9de65a3725569bc05eeb6e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/compare-states.js @@ -0,0 +1,24 @@ +export function compareRouterStates(a, b) { + const stateKeys = Object.keys(a); + if (stateKeys.length !== Object.keys(b).length) return false; + for(let i = stateKeys.length; i--;){ + const key = stateKeys[i]; + if (key === 'query') { + const queryKeys = Object.keys(a.query); + if (queryKeys.length !== Object.keys(b.query).length) { + return false; + } + for(let j = queryKeys.length; j--;){ + const queryKey = queryKeys[j]; + if (!b.query.hasOwnProperty(queryKey) || a.query[queryKey] !== b.query[queryKey]) { + return false; + } + } + } else if (!b.hasOwnProperty(key) || a[key] !== b[key]) { + return false; + } + } + return true; +} + +//# sourceMappingURL=compare-states.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/compare-states.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/compare-states.js.map new file mode 100644 index 0000000000000000000000000000000000000000..837cc2f2828c8e5ec32a539bf526290023ea9460 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/compare-states.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/compare-states.ts"],"sourcesContent":["import type { default as Router } from '../router'\n\nexport function compareRouterStates(a: Router['state'], b: Router['state']) {\n const stateKeys = Object.keys(a)\n if (stateKeys.length !== Object.keys(b).length) return false\n\n for (let i = stateKeys.length; i--; ) {\n const key = stateKeys[i]\n if (key === 'query') {\n const queryKeys = Object.keys(a.query)\n if (queryKeys.length !== Object.keys(b.query).length) {\n return false\n }\n for (let j = queryKeys.length; j--; ) {\n const queryKey = queryKeys[j]\n if (\n !b.query.hasOwnProperty(queryKey) ||\n a.query[queryKey] !== b.query[queryKey]\n ) {\n return false\n }\n }\n } else if (\n !b.hasOwnProperty(key) ||\n a[key as keyof Router['state']] !== b[key as keyof Router['state']]\n ) {\n return false\n }\n }\n\n return true\n}\n"],"names":["compareRouterStates","a","b","stateKeys","Object","keys","length","i","key","queryKeys","query","j","queryKey","hasOwnProperty"],"mappings":"AAEA,OAAO,SAASA,oBAAoBC,CAAkB,EAAEC,CAAkB;IACxE,MAAMC,YAAYC,OAAOC,IAAI,CAACJ;IAC9B,IAAIE,UAAUG,MAAM,KAAKF,OAAOC,IAAI,CAACH,GAAGI,MAAM,EAAE,OAAO;IAEvD,IAAK,IAAIC,IAAIJ,UAAUG,MAAM,EAAEC,KAAO;QACpC,MAAMC,MAAML,SAAS,CAACI,EAAE;QACxB,IAAIC,QAAQ,SAAS;YACnB,MAAMC,YAAYL,OAAOC,IAAI,CAACJ,EAAES,KAAK;YACrC,IAAID,UAAUH,MAAM,KAAKF,OAAOC,IAAI,CAACH,EAAEQ,KAAK,EAAEJ,MAAM,EAAE;gBACpD,OAAO;YACT;YACA,IAAK,IAAIK,IAAIF,UAAUH,MAAM,EAAEK,KAAO;gBACpC,MAAMC,WAAWH,SAAS,CAACE,EAAE;gBAC7B,IACE,CAACT,EAAEQ,KAAK,CAACG,cAAc,CAACD,aACxBX,EAAES,KAAK,CAACE,SAAS,KAAKV,EAAEQ,KAAK,CAACE,SAAS,EACvC;oBACA,OAAO;gBACT;YACF;QACF,OAAO,IACL,CAACV,EAAEW,cAAc,CAACL,QAClBP,CAAC,CAACO,IAA6B,KAAKN,CAAC,CAACM,IAA6B,EACnE;YACA,OAAO;QACT;IACF;IAEA,OAAO;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/disable-smooth-scroll.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/disable-smooth-scroll.js new file mode 100644 index 0000000000000000000000000000000000000000..6684ce068715e89b7cb6611e9c87f7685b221c92 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/disable-smooth-scroll.js @@ -0,0 +1,36 @@ +/** + * Run function with `scroll-behavior: auto` applied to `<html/>`. + * This css change will be reverted after the function finishes. + */ export function disableSmoothScrollDuringRouteTransition(fn, options = {}) { + // if only the hash is changed, we don't need to disable smooth scrolling + // we only care to prevent smooth scrolling when navigating to a new page to avoid jarring UX + if (options.onlyHashChange) { + fn(); + return; + } + const htmlElement = document.documentElement; + const hasDataAttribute = htmlElement.dataset.scrollBehavior === 'smooth'; + if (!hasDataAttribute) { + // Warn if smooth scrolling is detected but no data attribute is present + if (process.env.NODE_ENV === 'development' && getComputedStyle(htmlElement).scrollBehavior === 'smooth') { + const { warnOnce } = require('../../utils/warn-once'); + warnOnce('Detected `scroll-behavior: smooth` on the `<html>` element. To disable smooth scrolling during route transitions, ' + 'add `data-scroll-behavior="smooth"` to your <html> element. ' + 'Learn more: https://nextjs.org/docs/messages/missing-data-scroll-behavior'); + } + // No smooth scrolling configured, run directly without style manipulation + fn(); + return; + } + // Proceed with temporarily disabling smooth scrolling + const existing = htmlElement.style.scrollBehavior; + htmlElement.style.scrollBehavior = 'auto'; + if (!options.dontForceLayout) { + // In Chrome-based browsers we need to force reflow before calling `scrollTo`. + // Otherwise it will not pickup the change in scrollBehavior + // More info here: https://github.com/vercel/next.js/issues/40719#issuecomment-1336248042 + htmlElement.getClientRects(); + } + fn(); + htmlElement.style.scrollBehavior = existing; +} + +//# sourceMappingURL=disable-smooth-scroll.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/disable-smooth-scroll.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/disable-smooth-scroll.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e25481c2885cc7870df395fc5f991d2ad67cd02b --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/disable-smooth-scroll.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/disable-smooth-scroll.ts"],"sourcesContent":["/**\n * Run function with `scroll-behavior: auto` applied to `<html/>`.\n * This css change will be reverted after the function finishes.\n */\nexport function disableSmoothScrollDuringRouteTransition(\n fn: () => void,\n options: { dontForceLayout?: boolean; onlyHashChange?: boolean } = {}\n) {\n // if only the hash is changed, we don't need to disable smooth scrolling\n // we only care to prevent smooth scrolling when navigating to a new page to avoid jarring UX\n if (options.onlyHashChange) {\n fn()\n return\n }\n\n const htmlElement = document.documentElement\n const hasDataAttribute = htmlElement.dataset.scrollBehavior === 'smooth'\n\n if (!hasDataAttribute) {\n // Warn if smooth scrolling is detected but no data attribute is present\n if (\n process.env.NODE_ENV === 'development' &&\n getComputedStyle(htmlElement).scrollBehavior === 'smooth'\n ) {\n const { warnOnce } =\n require('../../utils/warn-once') as typeof import('../../utils/warn-once')\n warnOnce(\n 'Detected `scroll-behavior: smooth` on the `<html>` element. To disable smooth scrolling during route transitions, ' +\n 'add `data-scroll-behavior=\"smooth\"` to your <html> element. ' +\n 'Learn more: https://nextjs.org/docs/messages/missing-data-scroll-behavior'\n )\n }\n // No smooth scrolling configured, run directly without style manipulation\n fn()\n return\n }\n\n // Proceed with temporarily disabling smooth scrolling\n const existing = htmlElement.style.scrollBehavior\n htmlElement.style.scrollBehavior = 'auto'\n if (!options.dontForceLayout) {\n // In Chrome-based browsers we need to force reflow before calling `scrollTo`.\n // Otherwise it will not pickup the change in scrollBehavior\n // More info here: https://github.com/vercel/next.js/issues/40719#issuecomment-1336248042\n htmlElement.getClientRects()\n }\n fn()\n htmlElement.style.scrollBehavior = existing\n}\n"],"names":["disableSmoothScrollDuringRouteTransition","fn","options","onlyHashChange","htmlElement","document","documentElement","hasDataAttribute","dataset","scrollBehavior","process","env","NODE_ENV","getComputedStyle","warnOnce","require","existing","style","dontForceLayout","getClientRects"],"mappings":"AAAA;;;CAGC,GACD,OAAO,SAASA,yCACdC,EAAc,EACdC,UAAmE,CAAC,CAAC;IAErE,yEAAyE;IACzE,6FAA6F;IAC7F,IAAIA,QAAQC,cAAc,EAAE;QAC1BF;QACA;IACF;IAEA,MAAMG,cAAcC,SAASC,eAAe;IAC5C,MAAMC,mBAAmBH,YAAYI,OAAO,CAACC,cAAc,KAAK;IAEhE,IAAI,CAACF,kBAAkB;QACrB,wEAAwE;QACxE,IACEG,QAAQC,GAAG,CAACC,QAAQ,KAAK,iBACzBC,iBAAiBT,aAAaK,cAAc,KAAK,UACjD;YACA,MAAM,EAAEK,QAAQ,EAAE,GAChBC,QAAQ;YACVD,SACE,uHACE,iEACA;QAEN;QACA,0EAA0E;QAC1Eb;QACA;IACF;IAEA,sDAAsD;IACtD,MAAMe,WAAWZ,YAAYa,KAAK,CAACR,cAAc;IACjDL,YAAYa,KAAK,CAACR,cAAc,GAAG;IACnC,IAAI,CAACP,QAAQgB,eAAe,EAAE;QAC5B,8EAA8E;QAC9E,4DAA4D;QAC5D,yFAAyF;QACzFd,YAAYe,cAAc;IAC5B;IACAlB;IACAG,YAAYa,KAAK,CAACR,cAAc,GAAGO;AACrC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/dynamic-filter-pattern.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/dynamic-filter-pattern.js new file mode 100644 index 0000000000000000000000000000000000000000..e91e82d8abea50f9e08d7ee9254d28b62f4c3b17 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/dynamic-filter-pattern.js @@ -0,0 +1,87 @@ +// The client router filter handles app routes that begin with a dynamic segment +// (e.g. `/[locale]/about`). Such routes have no static prefix to anchor the +// prefix-based dynamic filter on, so the build-time producer +// (`createClientRouterFilter`) stores them as a normalized pattern with dynamic +// segments replaced by the placeholder token below, and the pages router +// reconstructs matching candidates from the route it resolved a navigation to. +/** + * A token that can never collide with a real path segment (dynamic segments are + * always `[name]`, `[...name]`, or `[[...name]]`, and static segments never + * equal `[]`). Shared with the builder's `normalizeRouteToFilterPattern`. + */ export const DYNAMIC_FILTER_PLACEHOLDER = '[]'; +/** + * Beyond this many dynamic segments the 2^n candidate set is skipped. Real + * routes never approach this; the cap only guards against pathological input. + */ const MAX_DYNAMIC_SEGMENTS = 8; +/** + * Test whether any app route that could shadow the resolved pages route passes + * `test` (typically a dynamic-filter membership check). An app route can only + * win over a matching pages route by turning some of that route's dynamic + * positions into static segments, so we enumerate keeping each such position + * either literal (static in the app route) or a placeholder (still dynamic in + * the app route) and return as soon as one passes. + * + * A static route segment pins its position to that literal; every other + * concrete position is dynamic and thus a candidate for a placeholder. That + * includes the tail a trailing catch-all (`[...slug]`/`[[...slug]]`) absorbs, + * which is why a catch-all route legitimately has fewer segments than the path + * it matched. + * + * Order is irrelevant: any match means the path is shadowed, and resolution is + * handed to the server via a hard navigation regardless of which candidate + * matched. + */ export function hasDynamicFilterCandidate(routePattern, concretePathname, test) { + const routeSegments = routePattern.split('/'); + const concreteSegments = concretePathname.split('/'); + const lastSegment = routeSegments[routeSegments.length - 1] ?? ''; + const hasCatchAll = lastSegment.startsWith('[...') || lastSegment.startsWith('[[...'); + // A non-catch-all route always has the same segment count as the path it + // matched; a mismatch there means the inputs don't line up. A catch-all route + // legitimately differs because its final param absorbs the remaining + // segments. + if (!hasCatchAll && routeSegments.length !== concreteSegments.length) { + return false; + } + // Collect the concrete positions that are dynamic in the matched route: any + // position without a static route segment (a dynamic param, or one absorbed + // by the trailing catch-all). + const dynamicIndices = []; + for(let i = 1; i < concreteSegments.length; i++){ + // An empty concrete segment is not a real path segment (splitting `/` + // yields a trailing `''`). A trailing optional catch-all matches it by + // absorbing nothing, so it must not be treated as a dynamic position: + // otherwise `/` would reconstruct the `/[]` candidate and spuriously match + // a root-level dynamic app route such as `/[lang]`, which does not own `/`. + if (concreteSegments[i] === '') { + continue; + } + const routeSegment = routeSegments[i]; + const isStaticSegment = routeSegment !== undefined && !routeSegment.startsWith('['); + if (!isStaticSegment) { + dynamicIndices.push(i); + } + } + if (dynamicIndices.length === 0 || dynamicIndices.length > MAX_DYNAMIC_SEGMENTS) { + return false; + } + // Enumerate the keep-literal/placeholder combinations as a bitmask over those + // positions (a set bit keeps the concrete value, an unset bit is a + // placeholder). The all-literal combination is skipped: a fully concrete path + // is a static route, already covered by the static filter and the early + // prefix check, so it can never appear in the dynamic filter as a pattern. + const allLiteral = (1 << dynamicIndices.length) - 1; + for(let mask = 0; mask < allLiteral; mask++){ + const segments = concreteSegments.slice(); + for(let bit = 0; bit < dynamicIndices.length; bit++){ + if ((mask & 1 << bit) === 0) { + segments[dynamicIndices[bit]] = DYNAMIC_FILTER_PLACEHOLDER; + } + } + if (test(segments.join('/'))) { + return true; + } + } + return false; +} + +//# sourceMappingURL=dynamic-filter-pattern.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/dynamic-filter-pattern.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/dynamic-filter-pattern.js.map new file mode 100644 index 0000000000000000000000000000000000000000..38ead75f83fb772b98a9533b9f4ed25f8921ec2c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/dynamic-filter-pattern.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/dynamic-filter-pattern.ts"],"sourcesContent":["// The client router filter handles app routes that begin with a dynamic segment\n// (e.g. `/[locale]/about`). Such routes have no static prefix to anchor the\n// prefix-based dynamic filter on, so the build-time producer\n// (`createClientRouterFilter`) stores them as a normalized pattern with dynamic\n// segments replaced by the placeholder token below, and the pages router\n// reconstructs matching candidates from the route it resolved a navigation to.\n\n/**\n * A token that can never collide with a real path segment (dynamic segments are\n * always `[name]`, `[...name]`, or `[[...name]]`, and static segments never\n * equal `[]`). Shared with the builder's `normalizeRouteToFilterPattern`.\n */\nexport const DYNAMIC_FILTER_PLACEHOLDER = '[]'\n\n/**\n * Beyond this many dynamic segments the 2^n candidate set is skipped. Real\n * routes never approach this; the cap only guards against pathological input.\n */\nconst MAX_DYNAMIC_SEGMENTS = 8\n\n/**\n * Test whether any app route that could shadow the resolved pages route passes\n * `test` (typically a dynamic-filter membership check). An app route can only\n * win over a matching pages route by turning some of that route's dynamic\n * positions into static segments, so we enumerate keeping each such position\n * either literal (static in the app route) or a placeholder (still dynamic in\n * the app route) and return as soon as one passes.\n *\n * A static route segment pins its position to that literal; every other\n * concrete position is dynamic and thus a candidate for a placeholder. That\n * includes the tail a trailing catch-all (`[...slug]`/`[[...slug]]`) absorbs,\n * which is why a catch-all route legitimately has fewer segments than the path\n * it matched.\n *\n * Order is irrelevant: any match means the path is shadowed, and resolution is\n * handed to the server via a hard navigation regardless of which candidate\n * matched.\n */\nexport function hasDynamicFilterCandidate(\n routePattern: string,\n concretePathname: string,\n test: (candidate: string) => boolean\n): boolean {\n const routeSegments = routePattern.split('/')\n const concreteSegments = concretePathname.split('/')\n\n const lastSegment = routeSegments[routeSegments.length - 1] ?? ''\n const hasCatchAll =\n lastSegment.startsWith('[...') || lastSegment.startsWith('[[...')\n\n // A non-catch-all route always has the same segment count as the path it\n // matched; a mismatch there means the inputs don't line up. A catch-all route\n // legitimately differs because its final param absorbs the remaining\n // segments.\n if (!hasCatchAll && routeSegments.length !== concreteSegments.length) {\n return false\n }\n\n // Collect the concrete positions that are dynamic in the matched route: any\n // position without a static route segment (a dynamic param, or one absorbed\n // by the trailing catch-all).\n const dynamicIndices: number[] = []\n for (let i = 1; i < concreteSegments.length; i++) {\n // An empty concrete segment is not a real path segment (splitting `/`\n // yields a trailing `''`). A trailing optional catch-all matches it by\n // absorbing nothing, so it must not be treated as a dynamic position:\n // otherwise `/` would reconstruct the `/[]` candidate and spuriously match\n // a root-level dynamic app route such as `/[lang]`, which does not own `/`.\n if (concreteSegments[i] === '') {\n continue\n }\n const routeSegment = routeSegments[i]\n const isStaticSegment =\n routeSegment !== undefined && !routeSegment.startsWith('[')\n if (!isStaticSegment) {\n dynamicIndices.push(i)\n }\n }\n\n if (\n dynamicIndices.length === 0 ||\n dynamicIndices.length > MAX_DYNAMIC_SEGMENTS\n ) {\n return false\n }\n\n // Enumerate the keep-literal/placeholder combinations as a bitmask over those\n // positions (a set bit keeps the concrete value, an unset bit is a\n // placeholder). The all-literal combination is skipped: a fully concrete path\n // is a static route, already covered by the static filter and the early\n // prefix check, so it can never appear in the dynamic filter as a pattern.\n const allLiteral = (1 << dynamicIndices.length) - 1\n for (let mask = 0; mask < allLiteral; mask++) {\n const segments = concreteSegments.slice()\n for (let bit = 0; bit < dynamicIndices.length; bit++) {\n if ((mask & (1 << bit)) === 0) {\n segments[dynamicIndices[bit]] = DYNAMIC_FILTER_PLACEHOLDER\n }\n }\n if (test(segments.join('/'))) {\n return true\n }\n }\n\n return false\n}\n"],"names":["DYNAMIC_FILTER_PLACEHOLDER","MAX_DYNAMIC_SEGMENTS","hasDynamicFilterCandidate","routePattern","concretePathname","test","routeSegments","split","concreteSegments","lastSegment","length","hasCatchAll","startsWith","dynamicIndices","i","routeSegment","isStaticSegment","undefined","push","allLiteral","mask","segments","slice","bit","join"],"mappings":"AAAA,gFAAgF;AAChF,4EAA4E;AAC5E,6DAA6D;AAC7D,gFAAgF;AAChF,yEAAyE;AACzE,+EAA+E;AAE/E;;;;CAIC,GACD,OAAO,MAAMA,6BAA6B,KAAI;AAE9C;;;CAGC,GACD,MAAMC,uBAAuB;AAE7B;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,SAASC,0BACdC,YAAoB,EACpBC,gBAAwB,EACxBC,IAAoC;IAEpC,MAAMC,gBAAgBH,aAAaI,KAAK,CAAC;IACzC,MAAMC,mBAAmBJ,iBAAiBG,KAAK,CAAC;IAEhD,MAAME,cAAcH,aAAa,CAACA,cAAcI,MAAM,GAAG,EAAE,IAAI;IAC/D,MAAMC,cACJF,YAAYG,UAAU,CAAC,WAAWH,YAAYG,UAAU,CAAC;IAE3D,yEAAyE;IACzE,8EAA8E;IAC9E,qEAAqE;IACrE,YAAY;IACZ,IAAI,CAACD,eAAeL,cAAcI,MAAM,KAAKF,iBAAiBE,MAAM,EAAE;QACpE,OAAO;IACT;IAEA,4EAA4E;IAC5E,4EAA4E;IAC5E,8BAA8B;IAC9B,MAAMG,iBAA2B,EAAE;IACnC,IAAK,IAAIC,IAAI,GAAGA,IAAIN,iBAAiBE,MAAM,EAAEI,IAAK;QAChD,sEAAsE;QACtE,uEAAuE;QACvE,sEAAsE;QACtE,2EAA2E;QAC3E,4EAA4E;QAC5E,IAAIN,gBAAgB,CAACM,EAAE,KAAK,IAAI;YAC9B;QACF;QACA,MAAMC,eAAeT,aAAa,CAACQ,EAAE;QACrC,MAAME,kBACJD,iBAAiBE,aAAa,CAACF,aAAaH,UAAU,CAAC;QACzD,IAAI,CAACI,iBAAiB;YACpBH,eAAeK,IAAI,CAACJ;QACtB;IACF;IAEA,IACED,eAAeH,MAAM,KAAK,KAC1BG,eAAeH,MAAM,GAAGT,sBACxB;QACA,OAAO;IACT;IAEA,8EAA8E;IAC9E,mEAAmE;IACnE,8EAA8E;IAC9E,wEAAwE;IACxE,2EAA2E;IAC3E,MAAMkB,aAAa,AAAC,CAAA,KAAKN,eAAeH,MAAM,AAAD,IAAK;IAClD,IAAK,IAAIU,OAAO,GAAGA,OAAOD,YAAYC,OAAQ;QAC5C,MAAMC,WAAWb,iBAAiBc,KAAK;QACvC,IAAK,IAAIC,MAAM,GAAGA,MAAMV,eAAeH,MAAM,EAAEa,MAAO;YACpD,IAAI,AAACH,CAAAA,OAAQ,KAAKG,GAAG,MAAO,GAAG;gBAC7BF,QAAQ,CAACR,cAAc,CAACU,IAAI,CAAC,GAAGvB;YAClC;QACF;QACA,IAAIK,KAAKgB,SAASG,IAAI,CAAC,OAAO;YAC5B,OAAO;QACT;IACF;IAEA,OAAO;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/escape-path-delimiters.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/escape-path-delimiters.js new file mode 100644 index 0000000000000000000000000000000000000000..93197f1cae1d9f2d8856bbd6a92a3372c86f43b2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/escape-path-delimiters.js @@ -0,0 +1,6 @@ +// escape delimiters used by path-to-regexp +export default function escapePathDelimiters(segment, escapeEncoded) { + return segment.replace(new RegExp(`([/#?\\\\]${escapeEncoded ? '|%(2f|23|3f|5c)' : ''})`, 'gi'), (char)=>encodeURIComponent(char)); +} + +//# sourceMappingURL=escape-path-delimiters.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/escape-path-delimiters.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/escape-path-delimiters.js.map new file mode 100644 index 0000000000000000000000000000000000000000..52dc4e813a6bb878c2ebf240f48ed7cf06aa1abd --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/escape-path-delimiters.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/escape-path-delimiters.ts"],"sourcesContent":["// escape delimiters used by path-to-regexp\nexport default function escapePathDelimiters(\n segment: string,\n escapeEncoded?: boolean\n): string {\n return segment.replace(\n new RegExp(`([/#?\\\\\\\\]${escapeEncoded ? '|%(2f|23|3f|5c)' : ''})`, 'gi'),\n (char: string) => encodeURIComponent(char)\n )\n}\n"],"names":["escapePathDelimiters","segment","escapeEncoded","replace","RegExp","char","encodeURIComponent"],"mappings":"AAAA,2CAA2C;AAC3C,eAAe,SAASA,qBACtBC,OAAe,EACfC,aAAuB;IAEvB,OAAOD,QAAQE,OAAO,CACpB,IAAIC,OAAO,CAAC,UAAU,EAAEF,gBAAgB,oBAAoB,GAAG,CAAC,CAAC,EAAE,OACnE,CAACG,OAAiBC,mBAAmBD;AAEzC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/format-next-pathname-info.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/format-next-pathname-info.js new file mode 100644 index 0000000000000000000000000000000000000000..dca3540a0ed65cd755612590bb26b2cc25788872 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/format-next-pathname-info.js @@ -0,0 +1,17 @@ +import { removeTrailingSlash } from './remove-trailing-slash'; +import { addPathPrefix } from './add-path-prefix'; +import { addPathSuffix } from './add-path-suffix'; +import { addLocale } from './add-locale'; +export function formatNextPathnameInfo(info) { + let pathname = addLocale(info.pathname, info.locale, info.buildId ? undefined : info.defaultLocale, info.ignorePrefix); + if (info.buildId || !info.trailingSlash) { + pathname = removeTrailingSlash(pathname); + } + if (info.buildId) { + pathname = addPathSuffix(addPathPrefix(pathname, `/_next/data/${info.buildId}`), info.pathname === '/' ? 'index.json' : '.json'); + } + pathname = addPathPrefix(pathname, info.basePath); + return !info.buildId && info.trailingSlash ? !pathname.endsWith('/') ? addPathSuffix(pathname, '/') : pathname : removeTrailingSlash(pathname); +} + +//# sourceMappingURL=format-next-pathname-info.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/format-next-pathname-info.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/format-next-pathname-info.js.map new file mode 100644 index 0000000000000000000000000000000000000000..66d7a33c15509f0884301c424afd2fef9a9dca36 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/format-next-pathname-info.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/format-next-pathname-info.ts"],"sourcesContent":["import type { NextPathnameInfo } from './get-next-pathname-info'\nimport { removeTrailingSlash } from './remove-trailing-slash'\nimport { addPathPrefix } from './add-path-prefix'\nimport { addPathSuffix } from './add-path-suffix'\nimport { addLocale } from './add-locale'\n\ninterface ExtendedInfo extends NextPathnameInfo {\n defaultLocale?: string\n ignorePrefix?: boolean\n}\n\nexport function formatNextPathnameInfo(info: ExtendedInfo) {\n let pathname = addLocale(\n info.pathname,\n info.locale,\n info.buildId ? undefined : info.defaultLocale,\n info.ignorePrefix\n )\n\n if (info.buildId || !info.trailingSlash) {\n pathname = removeTrailingSlash(pathname)\n }\n\n if (info.buildId) {\n pathname = addPathSuffix(\n addPathPrefix(pathname, `/_next/data/${info.buildId}`),\n info.pathname === '/' ? 'index.json' : '.json'\n )\n }\n\n pathname = addPathPrefix(pathname, info.basePath)\n return !info.buildId && info.trailingSlash\n ? !pathname.endsWith('/')\n ? addPathSuffix(pathname, '/')\n : pathname\n : removeTrailingSlash(pathname)\n}\n"],"names":["removeTrailingSlash","addPathPrefix","addPathSuffix","addLocale","formatNextPathnameInfo","info","pathname","locale","buildId","undefined","defaultLocale","ignorePrefix","trailingSlash","basePath","endsWith"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,0BAAyB;AAC7D,SAASC,aAAa,QAAQ,oBAAmB;AACjD,SAASC,aAAa,QAAQ,oBAAmB;AACjD,SAASC,SAAS,QAAQ,eAAc;AAOxC,OAAO,SAASC,uBAAuBC,IAAkB;IACvD,IAAIC,WAAWH,UACbE,KAAKC,QAAQ,EACbD,KAAKE,MAAM,EACXF,KAAKG,OAAO,GAAGC,YAAYJ,KAAKK,aAAa,EAC7CL,KAAKM,YAAY;IAGnB,IAAIN,KAAKG,OAAO,IAAI,CAACH,KAAKO,aAAa,EAAE;QACvCN,WAAWN,oBAAoBM;IACjC;IAEA,IAAID,KAAKG,OAAO,EAAE;QAChBF,WAAWJ,cACTD,cAAcK,UAAU,CAAC,YAAY,EAAED,KAAKG,OAAO,EAAE,GACrDH,KAAKC,QAAQ,KAAK,MAAM,eAAe;IAE3C;IAEAA,WAAWL,cAAcK,UAAUD,KAAKQ,QAAQ;IAChD,OAAO,CAACR,KAAKG,OAAO,IAAIH,KAAKO,aAAa,GACtC,CAACN,SAASQ,QAAQ,CAAC,OACjBZ,cAAcI,UAAU,OACxBA,WACFN,oBAAoBM;AAC1B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/format-url.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/format-url.js new file mode 100644 index 0000000000000000000000000000000000000000..ee8f114ee8fd139d2384616aa34952970a0a3ddf --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/format-url.js @@ -0,0 +1,84 @@ +// Format function modified from nodejs +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +import * as querystring from './querystring'; +const slashedProtocols = /https?|ftp|gopher|file/; +export function formatUrl(urlObj) { + let { auth, hostname } = urlObj; + let protocol = urlObj.protocol || ''; + let pathname = urlObj.pathname || ''; + let hash = urlObj.hash || ''; + let query = urlObj.query || ''; + let host = false; + auth = auth ? encodeURIComponent(auth).replace(/%3A/i, ':') + '@' : ''; + if (urlObj.host) { + host = auth + urlObj.host; + } else if (hostname) { + host = auth + (~hostname.indexOf(':') ? `[${hostname}]` : hostname); + if (urlObj.port) { + host += ':' + urlObj.port; + } + } + if (query && typeof query === 'object') { + query = String(querystring.urlQueryToSearchParams(query)); + } + let search = urlObj.search || query && `?${query}` || ''; + if (protocol && !protocol.endsWith(':')) protocol += ':'; + if (urlObj.slashes || (!protocol || slashedProtocols.test(protocol)) && host !== false) { + host = '//' + (host || ''); + if (pathname && pathname[0] !== '/') pathname = '/' + pathname; + } else if (!host) { + host = ''; + } + if (hash && hash[0] !== '#') hash = '#' + hash; + if (search && search[0] !== '?') search = '?' + search; + pathname = pathname.replace(/[?#]/g, encodeURIComponent); + search = search.replace('#', '%23'); + return `${protocol}${host}${pathname}${search}${hash}`; +} +export const urlObjectKeys = [ + 'auth', + 'hash', + 'host', + 'hostname', + 'href', + 'path', + 'pathname', + 'port', + 'protocol', + 'query', + 'search', + 'slashes' +]; +export function formatWithValidation(url) { + if (process.env.NODE_ENV === 'development') { + if (url !== null && typeof url === 'object') { + Object.keys(url).forEach((key)=>{ + if (!urlObjectKeys.includes(key)) { + console.warn(`Unknown key passed via urlObject into url.format: ${key}`); + } + }); + } + } + return formatUrl(url); +} + +//# sourceMappingURL=format-url.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/format-url.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/format-url.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6297a08fa308ef56aa79c97b1e4d0b2782b1f937 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/format-url.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/format-url.ts"],"sourcesContent":["// Format function modified from nodejs\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nimport type { UrlObject } from 'url'\nimport type { ParsedUrlQuery } from 'querystring'\nimport * as querystring from './querystring'\n\nconst slashedProtocols = /https?|ftp|gopher|file/\n\nexport function formatUrl(urlObj: UrlObject) {\n let { auth, hostname } = urlObj\n let protocol = urlObj.protocol || ''\n let pathname = urlObj.pathname || ''\n let hash = urlObj.hash || ''\n let query = urlObj.query || ''\n let host: string | false = false\n\n auth = auth ? encodeURIComponent(auth).replace(/%3A/i, ':') + '@' : ''\n\n if (urlObj.host) {\n host = auth + urlObj.host\n } else if (hostname) {\n host = auth + (~hostname.indexOf(':') ? `[${hostname}]` : hostname)\n if (urlObj.port) {\n host += ':' + urlObj.port\n }\n }\n\n if (query && typeof query === 'object') {\n query = String(querystring.urlQueryToSearchParams(query as ParsedUrlQuery))\n }\n\n let search = urlObj.search || (query && `?${query}`) || ''\n\n if (protocol && !protocol.endsWith(':')) protocol += ':'\n\n if (\n urlObj.slashes ||\n ((!protocol || slashedProtocols.test(protocol)) && host !== false)\n ) {\n host = '//' + (host || '')\n if (pathname && pathname[0] !== '/') pathname = '/' + pathname\n } else if (!host) {\n host = ''\n }\n\n if (hash && hash[0] !== '#') hash = '#' + hash\n if (search && search[0] !== '?') search = '?' + search\n\n pathname = pathname.replace(/[?#]/g, encodeURIComponent)\n search = search.replace('#', '%23')\n\n return `${protocol}${host}${pathname}${search}${hash}`\n}\n\nexport const urlObjectKeys = [\n 'auth',\n 'hash',\n 'host',\n 'hostname',\n 'href',\n 'path',\n 'pathname',\n 'port',\n 'protocol',\n 'query',\n 'search',\n 'slashes',\n]\n\nexport function formatWithValidation(url: UrlObject): string {\n if (process.env.NODE_ENV === 'development') {\n if (url !== null && typeof url === 'object') {\n Object.keys(url).forEach((key) => {\n if (!urlObjectKeys.includes(key)) {\n console.warn(\n `Unknown key passed via urlObject into url.format: ${key}`\n )\n }\n })\n }\n }\n\n return formatUrl(url)\n}\n"],"names":["querystring","slashedProtocols","formatUrl","urlObj","auth","hostname","protocol","pathname","hash","query","host","encodeURIComponent","replace","indexOf","port","String","urlQueryToSearchParams","search","endsWith","slashes","test","urlObjectKeys","formatWithValidation","url","process","env","NODE_ENV","Object","keys","forEach","key","includes","console","warn"],"mappings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,IACb,AAAC,CAAA,CAACb,YAAYL,iBAAiBmB,IAAI,CAACd,SAAQ,KAAMI,SAAS,OAC5D;QACAA,OAAO,OAAQA,CAAAA,QAAQ,EAAC;QACxB,IAAIH,YAAYA,QAAQ,CAAC,EAAE,KAAK,KAAKA,WAAW,MAAMA;IACxD,OAAO,IAAI,CAACG,MAAM;QAChBA,OAAO;IACT;IAEA,IAAIF,QAAQA,IAAI,CAAC,EAAE,KAAK,KAAKA,OAAO,MAAMA;IAC1C,IAAIS,UAAUA,MAAM,CAAC,EAAE,KAAK,KAAKA,SAAS,MAAMA;IAEhDV,WAAWA,SAASK,OAAO,CAAC,SAASD;IACrCM,SAASA,OAAOL,OAAO,CAAC,KAAK;IAE7B,OAAO,GAAGN,WAAWI,OAAOH,WAAWU,SAAST,MAAM;AACxD;AAEA,OAAO,MAAMa,gBAAgB;IAC3B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED,OAAO,SAASC,qBAAqBC,GAAc;IACjD,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1C,IAAIH,QAAQ,QAAQ,OAAOA,QAAQ,UAAU;YAC3CI,OAAOC,IAAI,CAACL,KAAKM,OAAO,CAAC,CAACC;gBACxB,IAAI,CAACT,cAAcU,QAAQ,CAACD,MAAM;oBAChCE,QAAQC,IAAI,CACV,CAAC,kDAAkD,EAAEH,KAAK;gBAE9D;YACF;QACF;IACF;IAEA,OAAO5B,UAAUqB;AACnB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-asset-path-from-route.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-asset-path-from-route.js new file mode 100644 index 0000000000000000000000000000000000000000..3767edde26238cdc795c7d3600b89e69898b1ff2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-asset-path-from-route.js @@ -0,0 +1,8 @@ +// Translates a logical route into its pages asset path (relative from a common prefix) +// "asset path" being its javascript file, data file, prerendered html,... +export default function getAssetPathFromRoute(route, ext = '') { + const path = route === '/' ? '/index' : /^\/index(\/|$)/.test(route) ? `/index${route}` : route; + return path + ext; +} + +//# sourceMappingURL=get-asset-path-from-route.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-asset-path-from-route.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-asset-path-from-route.js.map new file mode 100644 index 0000000000000000000000000000000000000000..51b00ac1872548eee41601d2284d11b34f8df30d --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-asset-path-from-route.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/get-asset-path-from-route.ts"],"sourcesContent":["// Translates a logical route into its pages asset path (relative from a common prefix)\n// \"asset path\" being its javascript file, data file, prerendered html,...\nexport default function getAssetPathFromRoute(\n route: string,\n ext: string = ''\n): string {\n const path =\n route === '/'\n ? '/index'\n : /^\\/index(\\/|$)/.test(route)\n ? `/index${route}`\n : route\n return path + ext\n}\n"],"names":["getAssetPathFromRoute","route","ext","path","test"],"mappings":"AAAA,uFAAuF;AACvF,0EAA0E;AAC1E,eAAe,SAASA,sBACtBC,KAAa,EACbC,MAAc,EAAE;IAEhB,MAAMC,OACJF,UAAU,MACN,WACA,iBAAiBG,IAAI,CAACH,SACpB,CAAC,MAAM,EAAEA,OAAO,GAChBA;IACR,OAAOE,OAAOD;AAChB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-dynamic-param.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-dynamic-param.js new file mode 100644 index 0000000000000000000000000000000000000000..46d7aacefe968e01a9e1906313f257427b9ab506 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-dynamic-param.js @@ -0,0 +1,171 @@ +import { InvariantError } from '../../invariant-error'; +import { parseLoaderTree } from './parse-loader-tree'; +import { parseNormalizedAppRoute, parseAppRouteSegment } from '../routes/app'; +import { resolveParamValue } from './resolve-param-value'; +/** + * Gets the value of a param from the params object. This correctly handles the + * case where the param is a fallback route param and encodes the resulting + * value. + * + * @param interpolatedParams - The params object. + * @param segmentKey - The key of the segment. + * @param fallbackRouteParams - The fallback route params. + * @returns The value of the param. + */ function getParamValue(interpolatedParams, segmentKey, fallbackRouteParams) { + let value = interpolatedParams[segmentKey]; + if (fallbackRouteParams?.has(segmentKey)) { + // We know that the fallback route params has the segment key because we + // checked that above. + const placeholder = fallbackRouteParams.get(segmentKey); + value = placeholder; + } else if (Array.isArray(value)) { + value = value.map((i)=>encodeURIComponent(i)); + } else if (typeof value === 'string') { + value = encodeURIComponent(value); + } + return value; +} +export function interpolateParallelRouteParams(loaderTree, params, pagePath, fallbackRouteParams) { + const interpolated = structuredClone(params); + // Stack-based traversal with depth tracking + const stack = [ + { + tree: loaderTree, + depth: 0 + } + ]; + // Parse the route from the provided page path. + const route = parseNormalizedAppRoute(pagePath); + while(stack.length > 0){ + const { tree, depth } = stack.pop(); + const { segment, parallelRoutes } = parseLoaderTree(tree); + const appSegment = parseAppRouteSegment(segment); + if (appSegment?.type === 'dynamic' && !interpolated.hasOwnProperty(appSegment.param.paramName) && // If the param is in the fallback route params, we don't need to + // interpolate it because it's already marked as being unknown. + !fallbackRouteParams?.has(appSegment.param.paramName)) { + const { paramName, paramType } = appSegment.param; + const paramValue = resolveParamValue(paramName, paramType, depth, route, interpolated); + if (paramValue !== undefined) { + interpolated[paramName] = paramValue; + } else if (paramType !== 'optional-catchall') { + throw new InvariantError(`Could not resolve param value for segment: ${paramName}`); + } + } + // Calculate next depth - increment if this is not a route group and not empty + let nextDepth = depth; + if (appSegment && appSegment.type !== 'route-group' && appSegment.type !== 'parallel-route') { + nextDepth++; + } + // Add all parallel routes to the stack for processing + for (const parallelRoute of Object.values(parallelRoutes)){ + stack.push({ + tree: parallelRoute, + depth: nextDepth + }); + } + } + return interpolated; +} +/** + * + * Shared logic on client and server for creating a dynamic param value. + * + * This code needs to be shared with the client so it can extract dynamic route + * params from the URL without a server request. + * + * Because everything in this module is sent to the client, we should aim to + * keep this code as simple as possible. The special case handling for catchall + * and optional is, alas, unfortunate. + */ export function getDynamicParam(interpolatedParams, segmentKey, dynamicParamType, fallbackRouteParams, staticSiblings) { + let value = getParamValue(interpolatedParams, segmentKey, fallbackRouteParams); + // handle the case where an optional catchall does not have a value, + // e.g. `/dashboard/[[...slug]]` when requesting `/dashboard` + if (!value || value.length === 0) { + if (dynamicParamType === 'oc') { + return { + param: segmentKey, + value: null, + type: dynamicParamType, + treeSegment: [ + segmentKey, + '', + dynamicParamType, + staticSiblings + ] + }; + } + throw new InvariantError(`Missing value for segment key: "${segmentKey}" with dynamic param type: ${dynamicParamType}`); + } + const paramCacheKey = Array.isArray(value) ? value.join('/') : value; + return { + param: segmentKey, + // The value that is passed to user code. + value, + // The value that is rendered in the router tree. + // TODO: If the number of static siblings exceeds some threshold (e.g., + // dozens or hundreds), consider sending a Bloom filter instead of the full + // array to reduce payload size. The client would then use the Bloom filter + // to check membership with a small false positive rate. + treeSegment: [ + segmentKey, + paramCacheKey, + dynamicParamType, + staticSiblings + ], + type: dynamicParamType + }; +} +/** + * Regular expression pattern used to match route parameters. + * Matches both single parameters and parameter groups. + * Examples: + * - `[[...slug]]` matches parameter group with key 'slug', repeat: true, optional: true + * - `[...slug]` matches parameter group with key 'slug', repeat: true, optional: false + * - `[[foo]]` matches parameter with key 'foo', repeat: false, optional: true + * - `[bar]` matches parameter with key 'bar', repeat: false, optional: false + */ export const PARAMETER_PATTERN = /^([^[]*)\[((?:\[[^\]]*\])|[^\]]+)\](.*)$/; +/** + * Parses a given parameter from a route to a data structure that can be used + * to generate the parametrized route. + * Examples: + * - `[[...slug]]` -> `{ key: 'slug', repeat: true, optional: true }` + * - `[...slug]` -> `{ key: 'slug', repeat: true, optional: false }` + * - `[[foo]]` -> `{ key: 'foo', repeat: false, optional: true }` + * - `[bar]` -> `{ key: 'bar', repeat: false, optional: false }` + * - `fizz` -> `{ key: 'fizz', repeat: false, optional: false }` + * @param param - The parameter to parse. + * @returns The parsed parameter as a data structure. + */ export function parseParameter(param) { + const match = param.match(PARAMETER_PATTERN); + if (!match) { + return parseMatchedParameter(param); + } + return parseMatchedParameter(match[2]); +} +/** + * Parses a matched parameter from the PARAMETER_PATTERN regex to a data structure that can be used + * to generate the parametrized route. + * Examples: + * - `[...slug]` -> `{ key: 'slug', repeat: true, optional: true }` + * - `...slug` -> `{ key: 'slug', repeat: true, optional: false }` + * - `[foo]` -> `{ key: 'foo', repeat: false, optional: true }` + * - `bar` -> `{ key: 'bar', repeat: false, optional: false }` + * @param param - The matched parameter to parse. + * @returns The parsed parameter as a data structure. + */ export function parseMatchedParameter(param) { + const optional = param.startsWith('[') && param.endsWith(']'); + if (optional) { + param = param.slice(1, -1); + } + const repeat = param.startsWith('...'); + if (repeat) { + param = param.slice(3); + } + return { + key: param, + repeat, + optional + }; +} + +//# sourceMappingURL=get-dynamic-param.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-dynamic-param.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-dynamic-param.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a8c8c42000abe05d3dee1010beabe577cba4d495 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-dynamic-param.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/get-dynamic-param.ts"],"sourcesContent":["import type { DynamicParam } from '../../../../server/app-render/app-render'\nimport type { LoaderTree } from '../../../../server/lib/app-dir-module'\nimport type { OpaqueFallbackRouteParams } from '../../../../server/request/fallback-params'\nimport type { Params } from '../../../../server/request/params'\nimport type { DynamicParamTypesShort } from '../../app-router-types'\nimport { InvariantError } from '../../invariant-error'\nimport { parseLoaderTree } from './parse-loader-tree'\nimport { parseNormalizedAppRoute, parseAppRouteSegment } from '../routes/app'\nimport { resolveParamValue } from './resolve-param-value'\n\n/**\n * Gets the value of a param from the params object. This correctly handles the\n * case where the param is a fallback route param and encodes the resulting\n * value.\n *\n * @param interpolatedParams - The params object.\n * @param segmentKey - The key of the segment.\n * @param fallbackRouteParams - The fallback route params.\n * @returns The value of the param.\n */\nfunction getParamValue(\n interpolatedParams: Params,\n segmentKey: string,\n fallbackRouteParams: OpaqueFallbackRouteParams | null\n) {\n let value = interpolatedParams[segmentKey]\n\n if (fallbackRouteParams?.has(segmentKey)) {\n // We know that the fallback route params has the segment key because we\n // checked that above.\n const placeholder = fallbackRouteParams.get(segmentKey)!\n value = placeholder\n } else if (Array.isArray(value)) {\n value = value.map((i) => encodeURIComponent(i))\n } else if (typeof value === 'string') {\n value = encodeURIComponent(value)\n }\n\n return value\n}\n\nexport function interpolateParallelRouteParams(\n loaderTree: LoaderTree,\n params: Params,\n pagePath: string,\n fallbackRouteParams: OpaqueFallbackRouteParams | null\n): Params {\n const interpolated = structuredClone(params)\n\n // Stack-based traversal with depth tracking\n const stack: Array<{ tree: LoaderTree; depth: number }> = [\n { tree: loaderTree, depth: 0 },\n ]\n\n // Parse the route from the provided page path.\n const route = parseNormalizedAppRoute(pagePath)\n\n while (stack.length > 0) {\n const { tree, depth } = stack.pop()!\n const { segment, parallelRoutes } = parseLoaderTree(tree)\n\n const appSegment = parseAppRouteSegment(segment)\n\n if (\n appSegment?.type === 'dynamic' &&\n !interpolated.hasOwnProperty(appSegment.param.paramName) &&\n // If the param is in the fallback route params, we don't need to\n // interpolate it because it's already marked as being unknown.\n !fallbackRouteParams?.has(appSegment.param.paramName)\n ) {\n const { paramName, paramType } = appSegment.param\n\n const paramValue = resolveParamValue(\n paramName,\n paramType,\n depth,\n route,\n interpolated\n )\n\n if (paramValue !== undefined) {\n interpolated[paramName] = paramValue\n } else if (paramType !== 'optional-catchall') {\n throw new InvariantError(\n `Could not resolve param value for segment: ${paramName}`\n )\n }\n }\n\n // Calculate next depth - increment if this is not a route group and not empty\n let nextDepth = depth\n if (\n appSegment &&\n appSegment.type !== 'route-group' &&\n appSegment.type !== 'parallel-route'\n ) {\n nextDepth++\n }\n\n // Add all parallel routes to the stack for processing\n for (const parallelRoute of Object.values(parallelRoutes)) {\n stack.push({ tree: parallelRoute, depth: nextDepth })\n }\n }\n\n return interpolated\n}\n\n/**\n *\n * Shared logic on client and server for creating a dynamic param value.\n *\n * This code needs to be shared with the client so it can extract dynamic route\n * params from the URL without a server request.\n *\n * Because everything in this module is sent to the client, we should aim to\n * keep this code as simple as possible. The special case handling for catchall\n * and optional is, alas, unfortunate.\n */\nexport function getDynamicParam(\n interpolatedParams: Params,\n segmentKey: string,\n dynamicParamType: DynamicParamTypesShort,\n fallbackRouteParams: OpaqueFallbackRouteParams | null,\n staticSiblings: readonly string[] | null\n): DynamicParam {\n let value: string | string[] | undefined = getParamValue(\n interpolatedParams,\n segmentKey,\n fallbackRouteParams\n )\n\n // handle the case where an optional catchall does not have a value,\n // e.g. `/dashboard/[[...slug]]` when requesting `/dashboard`\n if (!value || value.length === 0) {\n if (dynamicParamType === 'oc') {\n return {\n param: segmentKey,\n value: null,\n type: dynamicParamType,\n treeSegment: [segmentKey, '', dynamicParamType, staticSiblings],\n }\n }\n\n throw new InvariantError(\n `Missing value for segment key: \"${segmentKey}\" with dynamic param type: ${dynamicParamType}`\n )\n }\n\n const paramCacheKey = Array.isArray(value) ? value.join('/') : value\n\n return {\n param: segmentKey,\n // The value that is passed to user code.\n value,\n // The value that is rendered in the router tree.\n // TODO: If the number of static siblings exceeds some threshold (e.g.,\n // dozens or hundreds), consider sending a Bloom filter instead of the full\n // array to reduce payload size. The client would then use the Bloom filter\n // to check membership with a small false positive rate.\n treeSegment: [segmentKey, paramCacheKey, dynamicParamType, staticSiblings],\n type: dynamicParamType,\n }\n}\n\n/**\n * Regular expression pattern used to match route parameters.\n * Matches both single parameters and parameter groups.\n * Examples:\n * - `[[...slug]]` matches parameter group with key 'slug', repeat: true, optional: true\n * - `[...slug]` matches parameter group with key 'slug', repeat: true, optional: false\n * - `[[foo]]` matches parameter with key 'foo', repeat: false, optional: true\n * - `[bar]` matches parameter with key 'bar', repeat: false, optional: false\n */\nexport const PARAMETER_PATTERN = /^([^[]*)\\[((?:\\[[^\\]]*\\])|[^\\]]+)\\](.*)$/\n\n/**\n * Parses a given parameter from a route to a data structure that can be used\n * to generate the parametrized route.\n * Examples:\n * - `[[...slug]]` -> `{ key: 'slug', repeat: true, optional: true }`\n * - `[...slug]` -> `{ key: 'slug', repeat: true, optional: false }`\n * - `[[foo]]` -> `{ key: 'foo', repeat: false, optional: true }`\n * - `[bar]` -> `{ key: 'bar', repeat: false, optional: false }`\n * - `fizz` -> `{ key: 'fizz', repeat: false, optional: false }`\n * @param param - The parameter to parse.\n * @returns The parsed parameter as a data structure.\n */\nexport function parseParameter(param: string) {\n const match = param.match(PARAMETER_PATTERN)\n\n if (!match) {\n return parseMatchedParameter(param)\n }\n\n return parseMatchedParameter(match[2])\n}\n\n/**\n * Parses a matched parameter from the PARAMETER_PATTERN regex to a data structure that can be used\n * to generate the parametrized route.\n * Examples:\n * - `[...slug]` -> `{ key: 'slug', repeat: true, optional: true }`\n * - `...slug` -> `{ key: 'slug', repeat: true, optional: false }`\n * - `[foo]` -> `{ key: 'foo', repeat: false, optional: true }`\n * - `bar` -> `{ key: 'bar', repeat: false, optional: false }`\n * @param param - The matched parameter to parse.\n * @returns The parsed parameter as a data structure.\n */\nexport function parseMatchedParameter(param: string) {\n const optional = param.startsWith('[') && param.endsWith(']')\n if (optional) {\n param = param.slice(1, -1)\n }\n const repeat = param.startsWith('...')\n if (repeat) {\n param = param.slice(3)\n }\n return { key: param, repeat, optional }\n}\n"],"names":["InvariantError","parseLoaderTree","parseNormalizedAppRoute","parseAppRouteSegment","resolveParamValue","getParamValue","interpolatedParams","segmentKey","fallbackRouteParams","value","has","placeholder","get","Array","isArray","map","i","encodeURIComponent","interpolateParallelRouteParams","loaderTree","params","pagePath","interpolated","structuredClone","stack","tree","depth","route","length","pop","segment","parallelRoutes","appSegment","type","hasOwnProperty","param","paramName","paramType","paramValue","undefined","nextDepth","parallelRoute","Object","values","push","getDynamicParam","dynamicParamType","staticSiblings","treeSegment","paramCacheKey","join","PARAMETER_PATTERN","parseParameter","match","parseMatchedParameter","optional","startsWith","endsWith","slice","repeat","key"],"mappings":"AAKA,SAASA,cAAc,QAAQ,wBAAuB;AACtD,SAASC,eAAe,QAAQ,sBAAqB;AACrD,SAASC,uBAAuB,EAAEC,oBAAoB,QAAQ,gBAAe;AAC7E,SAASC,iBAAiB,QAAQ,wBAAuB;AAEzD;;;;;;;;;CASC,GACD,SAASC,cACPC,kBAA0B,EAC1BC,UAAkB,EAClBC,mBAAqD;IAErD,IAAIC,QAAQH,kBAAkB,CAACC,WAAW;IAE1C,IAAIC,qBAAqBE,IAAIH,aAAa;QACxC,wEAAwE;QACxE,sBAAsB;QACtB,MAAMI,cAAcH,oBAAoBI,GAAG,CAACL;QAC5CE,QAAQE;IACV,OAAO,IAAIE,MAAMC,OAAO,CAACL,QAAQ;QAC/BA,QAAQA,MAAMM,GAAG,CAAC,CAACC,IAAMC,mBAAmBD;IAC9C,OAAO,IAAI,OAAOP,UAAU,UAAU;QACpCA,QAAQQ,mBAAmBR;IAC7B;IAEA,OAAOA;AACT;AAEA,OAAO,SAASS,+BACdC,UAAsB,EACtBC,MAAc,EACdC,QAAgB,EAChBb,mBAAqD;IAErD,MAAMc,eAAeC,gBAAgBH;IAErC,4CAA4C;IAC5C,MAAMI,QAAoD;QACxD;YAAEC,MAAMN;YAAYO,OAAO;QAAE;KAC9B;IAED,+CAA+C;IAC/C,MAAMC,QAAQzB,wBAAwBmB;IAEtC,MAAOG,MAAMI,MAAM,GAAG,EAAG;QACvB,MAAM,EAAEH,IAAI,EAAEC,KAAK,EAAE,GAAGF,MAAMK,GAAG;QACjC,MAAM,EAAEC,OAAO,EAAEC,cAAc,EA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C,gCAAgC,EAAEO,WAAW,2BAA2B,EAAEuC,kBAAkB;IAEjG;IAEA,MAAMG,gBAAgBpC,MAAMC,OAAO,CAACL,SAASA,MAAMyC,IAAI,CAAC,OAAOzC;IAE/D,OAAO;QACL0B,OAAO5B;QACP,yCAAyC;QACzCE;QACA,iDAAiD;QACjD,uEAAuE;QACvE,2EAA2E;QAC3E,2EAA2E;QAC3E,wDAAwD;QACxDuC,aAAa;YAACzC;YAAY0C;YAAeH;YAAkBC;SAAe;QAC1Ed,MAAMa;IACR;AACF;AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMK,oBAAoB,2CAA0C;AAE3E;;;;;;;;;;;CAWC,GACD,OAAO,SAASC,eAAejB,KAAa;IAC1C,MAAMkB,QAAQlB,MAAMkB,KAAK,CAACF;IAE1B,IAAI,CAACE,OAAO;QACV,OAAOC,sBAAsBnB;IAC/B;IAEA,OAAOmB,sBAAsBD,KAAK,CAAC,EAAE;AACvC;AAEA;;;;;;;;;;CAUC,GACD,OAAO,SAASC,sBAAsBnB,KAAa;IACjD,MAAMoB,WAAWpB,MAAMqB,UAAU,CAAC,QAAQrB,MAAMsB,QAAQ,CAAC;IACzD,IAAIF,UAAU;QACZpB,QAAQA,MAAMuB,KAAK,CAAC,GAAG,CAAC;IAC1B;IACA,MAAMC,SAASxB,MAAMqB,UAAU,CAAC;IAChC,IAAIG,QAAQ;QACVxB,QAAQA,MAAMuB,KAAK,CAAC;IACtB;IACA,OAAO;QAAEE,KAAKzB;QAAOwB;QAAQJ;IAAS;AACxC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-next-pathname-info.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-next-pathname-info.js new file mode 100644 index 0000000000000000000000000000000000000000..6ec85439b2f57d81ac3c834c3f21044a04c49fb3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-next-pathname-info.js @@ -0,0 +1,42 @@ +import { normalizeLocalePath } from '../../i18n/normalize-locale-path'; +import { removePathPrefix } from './remove-path-prefix'; +import { pathHasPrefix } from './path-has-prefix'; +export function getNextPathnameInfo(pathname, options) { + const { basePath, i18n, trailingSlash } = options.nextConfig ?? {}; + const info = { + pathname, + trailingSlash: pathname !== '/' ? pathname.endsWith('/') : trailingSlash + }; + if (basePath && pathHasPrefix(info.pathname, basePath)) { + info.pathname = removePathPrefix(info.pathname, basePath); + info.basePath = basePath; + } + let pathnameNoDataPrefix = info.pathname; + if (info.pathname.startsWith('/_next/data/') && info.pathname.endsWith('.json')) { + const paths = info.pathname.replace(/^\/_next\/data\//, '').replace(/\.json$/, '').split('/'); + const buildId = paths[0]; + info.buildId = buildId; + pathnameNoDataPrefix = paths[1] !== 'index' ? `/${paths.slice(1).join('/')}` : '/'; + // update pathname with normalized if enabled although + // we use normalized to populate locale info still + if (options.parseData === true) { + info.pathname = pathnameNoDataPrefix; + } + } + // If provided, use the locale route normalizer to detect the locale instead + // of the function below. + if (i18n) { + let result = options.i18nProvider ? options.i18nProvider.analyze(info.pathname) : normalizeLocalePath(info.pathname, i18n.locales); + info.locale = result.detectedLocale; + info.pathname = result.pathname ?? info.pathname; + if (!result.detectedLocale && info.buildId) { + result = options.i18nProvider ? options.i18nProvider.analyze(pathnameNoDataPrefix) : normalizeLocalePath(pathnameNoDataPrefix, i18n.locales); + if (result.detectedLocale) { + info.locale = result.detectedLocale; + } + } + } + return info; +} + +//# sourceMappingURL=get-next-pathname-info.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-next-pathname-info.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-next-pathname-info.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a8375c02d9a6114122e0b547cb3b37a27e859fc6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-next-pathname-info.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/get-next-pathname-info.ts"],"sourcesContent":["import { normalizeLocalePath } from '../../i18n/normalize-locale-path'\nimport { removePathPrefix } from './remove-path-prefix'\nimport { pathHasPrefix } from './path-has-prefix'\nimport type { I18NProvider } from '../../../../server/lib/i18n-provider'\n\nexport interface NextPathnameInfo {\n /**\n * The base path in case the pathname included it.\n */\n basePath?: string\n /**\n * The buildId for when the parsed URL is a data URL. Parsing it can be\n * disabled with the `parseData` option.\n */\n buildId?: string\n /**\n * If there was a locale in the pathname, this will hold its value.\n */\n locale?: string\n /**\n * The processed pathname without a base path, locale, or data URL elements\n * when parsing it is enabled.\n */\n pathname: string\n /**\n * A boolean telling if the pathname had a trailingSlash. This can be only\n * true if trailingSlash is enabled.\n */\n trailingSlash?: boolean\n}\n\ninterface Options {\n /**\n * When passed to true, this function will also parse Nextjs data URLs.\n */\n parseData?: boolean\n /**\n * A partial of the Next.js configuration to parse the URL.\n */\n nextConfig?: {\n basePath?: string\n i18n?: { locales?: readonly string[] } | null\n trailingSlash?: boolean\n }\n\n /**\n * If provided, this normalizer will be used to detect the locale instead of\n * the default locale detection.\n */\n i18nProvider?: I18NProvider\n}\n\nexport function getNextPathnameInfo(\n pathname: string,\n options: Options\n): NextPathnameInfo {\n const { basePath, i18n, trailingSlash } = options.nextConfig ?? {}\n const info: NextPathnameInfo = {\n pathname,\n trailingSlash: pathname !== '/' ? pathname.endsWith('/') : trailingSlash,\n }\n\n if (basePath && pathHasPrefix(info.pathname, basePath)) {\n info.pathname = removePathPrefix(info.pathname, basePath)\n info.basePath = basePath\n }\n let pathnameNoDataPrefix = info.pathname\n\n if (\n info.pathname.startsWith('/_next/data/') &&\n info.pathname.endsWith('.json')\n ) {\n const paths = info.pathname\n .replace(/^\\/_next\\/data\\//, '')\n .replace(/\\.json$/, '')\n .split('/')\n\n const buildId = paths[0]\n info.buildId = buildId\n pathnameNoDataPrefix =\n paths[1] !== 'index' ? `/${paths.slice(1).join('/')}` : '/'\n\n // update pathname with normalized if enabled although\n // we use normalized to populate locale info still\n if (options.parseData === true) {\n info.pathname = pathnameNoDataPrefix\n }\n }\n\n // If provided, use the locale route normalizer to detect the locale instead\n // of the function below.\n if (i18n) {\n let result = options.i18nProvider\n ? options.i18nProvider.analyze(info.pathname)\n : normalizeLocalePath(info.pathname, i18n.locales)\n\n info.locale = result.detectedLocale\n info.pathname = result.pathname ?? info.pathname\n\n if (!result.detectedLocale && info.buildId) {\n result = options.i18nProvider\n ? options.i18nProvider.analyze(pathnameNoDataPrefix)\n : normalizeLocalePath(pathnameNoDataPrefix, i18n.locales)\n\n if (result.detectedLocale) {\n info.locale = result.detectedLocale\n }\n }\n }\n return info\n}\n"],"names":["normalizeLocalePath","removePathPrefix","pathHasPrefix","getNextPathnameInfo","pathname","options","basePath","i18n","trailingSlash","nextConfig","info","endsWith","pathnameNoDataPrefix","startsWith","paths","replace","split","buildId","slice","join","parseData","result","i18nProvider","analyze","locales","locale","detectedLocale"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,mCAAkC;AACtE,SAASC,gBAAgB,QAAQ,uBAAsB;AACvD,SAASC,aAAa,QAAQ,oBAAmB;AAkDjD,OAAO,SAASC,oBACdC,QAAgB,EAChBC,OAAgB;IAEhB,MAAM,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,aAAa,EAAE,GAAGH,QAAQI,UAAU,IAAI,CAAC;IACjE,MAAMC,OAAyB;QAC7BN;QACAI,eAAeJ,aAAa,MAAMA,SAASO,QAAQ,CAAC,OAAOH;IAC7D;IAEA,IAAIF,YAAYJ,cAAcQ,KAAKN,QAAQ,EAAEE,WAAW;QACtDI,KAAKN,QAAQ,GAAGH,iBAAiBS,KAAKN,QAAQ,EAAEE;QAChDI,KAAKJ,QAAQ,GAAGA;IAClB;IACA,IAAIM,uBAAuBF,KAAKN,QAAQ;IAExC,IACEM,KAAKN,QAAQ,CAACS,UAAU,CAAC,mBACzBH,KAAKN,QAAQ,CAACO,QAAQ,CAAC,UACvB;QACA,MAAMG,QAAQJ,KAAKN,QAAQ,CACxBW,OAAO,CAAC,oBAAoB,IAC5BA,OAAO,CAAC,WAAW,IACnBC,KAAK,CAAC;QAET,MAAMC,UAAUH,KAAK,CAAC,EAAE;QACxBJ,KAAKO,OAAO,GAAGA;QACfL,uBACEE,KAAK,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,EAAEA,MAAMI,KAAK,CAAC,GAAGC,IAAI,CAAC,MAAM,GAAG;QAE1D,sDAAsD;QACtD,kDAAkD;QAClD,IAAId,QAAQe,SAAS,KAAK,MAAM;YAC9BV,KAAKN,QAAQ,GAAGQ;QAClB;IACF;IAEA,4EAA4E;IAC5E,yBAAyB;IACzB,IAAIL,MAAM;QACR,IAAIc,SAAShB,QAAQiB,YAAY,GAC7BjB,QAAQiB,YAAY,CAACC,OAAO,CAACb,KAAKN,QAAQ,IAC1CJ,oBAAoBU,KAAKN,QAAQ,EAAEG,KAAKiB,OAAO;QAEnDd,KAAKe,MAAM,GAAGJ,OAAOK,cAAc;QACnChB,KAAKN,QAAQ,GAAGiB,OAAOjB,QAAQ,IAAIM,KAAKN,QAAQ;QAEhD,IAAI,CAACiB,OAAOK,cAAc,IAAIhB,KAAKO,OAAO,EAAE;YAC1CI,SAAShB,QAAQiB,YAAY,GACzBjB,QAAQiB,YAAY,CAACC,OAAO,CAACX,wBAC7BZ,oBAAoBY,sBAAsBL,KAAKiB,OAAO;YAE1D,IAAIH,OAAOK,cAAc,EAAE;gBACzBhB,KAAKe,MAAM,GAAGJ,OAAOK,cAAc;YACrC;QACF;IACF;IACA,OAAOhB;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-route-from-asset-path.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-route-from-asset-path.js new file mode 100644 index 0000000000000000000000000000000000000000..f3750ad191932326511af786ff785ae949c5e326 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-route-from-asset-path.js @@ -0,0 +1,15 @@ +// Translate a pages asset path (relative from a common prefix) back into its logical route +import { isDynamicRoute } from './is-dynamic'; +// "asset path" being its javascript file, data file, prerendered html,... +export default function getRouteFromAssetPath(assetPath, ext = '') { + assetPath = assetPath.replace(/\\/g, '/'); + assetPath = ext && assetPath.endsWith(ext) ? assetPath.slice(0, -ext.length) : assetPath; + if (assetPath.startsWith('/index/') && !isDynamicRoute(assetPath)) { + assetPath = assetPath.slice(6); + } else if (assetPath === '/index') { + assetPath = '/'; + } + return assetPath; +} + +//# sourceMappingURL=get-route-from-asset-path.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-route-from-asset-path.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-route-from-asset-path.js.map new file mode 100644 index 0000000000000000000000000000000000000000..5b090b4451f6b449f2f4cb24af6f9c4ee28aa2b1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-route-from-asset-path.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/get-route-from-asset-path.ts"],"sourcesContent":["// Translate a pages asset path (relative from a common prefix) back into its logical route\n\nimport { isDynamicRoute } from './is-dynamic'\n\n// \"asset path\" being its javascript file, data file, prerendered html,...\nexport default function getRouteFromAssetPath(\n assetPath: string,\n ext: string = ''\n): string {\n assetPath = assetPath.replace(/\\\\/g, '/')\n assetPath =\n ext && assetPath.endsWith(ext) ? assetPath.slice(0, -ext.length) : assetPath\n if (assetPath.startsWith('/index/') && !isDynamicRoute(assetPath)) {\n assetPath = assetPath.slice(6)\n } else if (assetPath === '/index') {\n assetPath = '/'\n }\n return assetPath\n}\n"],"names":["isDynamicRoute","getRouteFromAssetPath","assetPath","ext","replace","endsWith","slice","length","startsWith"],"mappings":"AAAA,2FAA2F;AAE3F,SAASA,cAAc,QAAQ,eAAc;AAE7C,0EAA0E;AAC1E,eAAe,SAASC,sBACtBC,SAAiB,EACjBC,MAAc,EAAE;IAEhBD,YAAYA,UAAUE,OAAO,CAAC,OAAO;IACrCF,YACEC,OAAOD,UAAUG,QAAQ,CAACF,OAAOD,UAAUI,KAAK,CAAC,GAAG,CAACH,IAAII,MAAM,IAAIL;IACrE,IAAIA,UAAUM,UAAU,CAAC,cAAc,CAACR,eAAeE,YAAY;QACjEA,YAAYA,UAAUI,KAAK,CAAC;IAC9B,OAAO,IAAIJ,cAAc,UAAU;QACjCA,YAAY;IACd;IACA,OAAOA;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-segment-param.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-segment-param.js new file mode 100644 index 0000000000000000000000000000000000000000..c3dde16cd77c9d874855d9ecb1ea9545e1f79589 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-segment-param.js @@ -0,0 +1,66 @@ +import { INTERCEPTION_ROUTE_MARKERS } from './interception-routes'; +/** + * Parse dynamic route segment to type of parameter + */ export function getSegmentParam(segment) { + const interceptionMarker = INTERCEPTION_ROUTE_MARKERS.find((marker)=>segment.startsWith(marker)); + // if an interception marker is part of the path segment, we need to jump ahead + // to the relevant portion for param parsing + if (interceptionMarker) { + segment = segment.slice(interceptionMarker.length); + } + if (segment.startsWith('[[...') && segment.endsWith(']]')) { + return { + // TODO-APP: Optional catchall does not currently work with parallel routes, + // so for now aren't handling a potential interception marker. + paramType: 'optional-catchall', + paramName: segment.slice(5, -2) + }; + } + if (segment.startsWith('[...') && segment.endsWith(']')) { + return { + paramType: interceptionMarker ? `catchall-intercepted-${interceptionMarker}` : 'catchall', + paramName: segment.slice(4, -1) + }; + } + if (segment.startsWith('[') && segment.endsWith(']')) { + return { + paramType: interceptionMarker ? `dynamic-intercepted-${interceptionMarker}` : 'dynamic', + paramName: segment.slice(1, -1) + }; + } + return null; +} +export function isCatchAll(type) { + return type === 'catchall' || type === 'catchall-intercepted-(..)(..)' || type === 'catchall-intercepted-(.)' || type === 'catchall-intercepted-(..)' || type === 'catchall-intercepted-(...)' || type === 'optional-catchall'; +} +export function getParamProperties(paramType) { + let repeat = false; + let optional = false; + switch(paramType){ + case 'catchall': + case 'catchall-intercepted-(..)(..)': + case 'catchall-intercepted-(.)': + case 'catchall-intercepted-(..)': + case 'catchall-intercepted-(...)': + repeat = true; + break; + case 'optional-catchall': + repeat = true; + optional = true; + break; + case 'dynamic': + case 'dynamic-intercepted-(..)(..)': + case 'dynamic-intercepted-(.)': + case 'dynamic-intercepted-(..)': + case 'dynamic-intercepted-(...)': + break; + default: + paramType; + } + return { + repeat, + optional + }; +} + +//# sourceMappingURL=get-segment-param.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-segment-param.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-segment-param.js.map new file mode 100644 index 0000000000000000000000000000000000000000..eb5e35a7f0bb74c00304f2bc623859a62a02d1ff --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/get-segment-param.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/get-segment-param.tsx"],"sourcesContent":["import { INTERCEPTION_ROUTE_MARKERS } from './interception-routes'\nimport type { DynamicParamTypes } from '../../app-router-types'\n\nexport type SegmentParam = {\n paramName: string\n paramType: DynamicParamTypes\n}\n\n/**\n * Parse dynamic route segment to type of parameter\n */\nexport function getSegmentParam(segment: string): SegmentParam | null {\n const interceptionMarker = INTERCEPTION_ROUTE_MARKERS.find((marker) =>\n segment.startsWith(marker)\n )\n\n // if an interception marker is part of the path segment, we need to jump ahead\n // to the relevant portion for param parsing\n if (interceptionMarker) {\n segment = segment.slice(interceptionMarker.length)\n }\n\n if (segment.startsWith('[[...') && segment.endsWith(']]')) {\n return {\n // TODO-APP: Optional catchall does not currently work with parallel routes,\n // so for now aren't handling a potential interception marker.\n paramType: 'optional-catchall',\n paramName: segment.slice(5, -2),\n }\n }\n\n if (segment.startsWith('[...') && segment.endsWith(']')) {\n return {\n paramType: interceptionMarker\n ? `catchall-intercepted-${interceptionMarker}`\n : 'catchall',\n paramName: segment.slice(4, -1),\n }\n }\n\n if (segment.startsWith('[') && segment.endsWith(']')) {\n return {\n paramType: interceptionMarker\n ? `dynamic-intercepted-${interceptionMarker}`\n : 'dynamic',\n paramName: segment.slice(1, -1),\n }\n }\n\n return null\n}\n\nexport function isCatchAll(\n type: DynamicParamTypes\n): type is\n | 'catchall'\n | 'catchall-intercepted-(..)(..)'\n | 'catchall-intercepted-(.)'\n | 'catchall-intercepted-(..)'\n | 'catchall-intercepted-(...)'\n | 'optional-catchall' {\n return (\n type === 'catchall' ||\n type === 'catchall-intercepted-(..)(..)' ||\n type === 'catchall-intercepted-(.)' ||\n type === 'catchall-intercepted-(..)' ||\n type === 'catchall-intercepted-(...)' ||\n type === 'optional-catchall'\n )\n}\n\nexport function getParamProperties(paramType: DynamicParamTypes): {\n repeat: boolean\n optional: boolean\n} {\n let repeat = false\n let optional = false\n\n switch (paramType) {\n case 'catchall':\n case 'catchall-intercepted-(..)(..)':\n case 'catchall-intercepted-(.)':\n case 'catchall-intercepted-(..)':\n case 'catchall-intercepted-(...)':\n repeat = true\n break\n case 'optional-catchall':\n repeat = true\n optional = true\n break\n case 'dynamic':\n case 'dynamic-intercepted-(..)(..)':\n case 'dynamic-intercepted-(.)':\n case 'dynamic-intercepted-(..)':\n case 'dynamic-intercepted-(...)':\n break\n default:\n paramType satisfies never\n }\n\n return { repeat, optional }\n}\n"],"names":["INTERCEPTION_ROUTE_MARKERS","getSegmentParam","segment","interceptionMarker","find","marker","startsWith","slice","length","endsWith","paramType","paramName","isCatchAll","type","getParamProperties","repeat","optional"],"mappings":"AAAA,SAASA,0BAA0B,QAAQ,wBAAuB;AAQlE;;CAEC,GACD,OAAO,SAASC,gBAAgBC,OAAe;IAC7C,MAAMC,qBAAqBH,2BAA2BI,IAAI,CAAC,CAACC,SAC1DH,QAAQI,UAAU,CAACD;IAGrB,+EAA+E;IAC/E,4CAA4C;IAC5C,IAAIF,oBAAoB;QACtBD,UAAUA,QAAQK,KAAK,CAACJ,mBAAmBK,MAAM;IACnD;IAEA,IAAIN,QAAQI,UAAU,CAAC,YAAYJ,QAAQO,QAAQ,CAAC,OAAO;QACzD,OAAO;YACL,4EAA4E;YAC5E,8DAA8D;YAC9DC,WAAW;YACXC,WAAWT,QAAQK,KAAK,CAAC,GAAG,CAAC;QAC/B;IACF;IAEA,IAAIL,QAAQI,UAAU,CAAC,WAAWJ,QAAQO,QAAQ,CAAC,MAAM;QACvD,OAAO;YACLC,WAAWP,qBACP,CAAC,qBAAqB,EAAEA,oBAAoB,GAC5C;YACJQ,WAAWT,QAAQK,KAAK,CAAC,GAAG,CAAC;QAC/B;IACF;IAEA,IAAIL,QAAQI,UAAU,CAAC,QAAQJ,QAAQO,QAAQ,CAAC,MAAM;QACpD,OAAO;YACLC,WAAWP,qBACP,CAAC,oBAAoB,EAAEA,oBAAoB,GAC3C;YACJQ,WAAWT,QAAQK,KAAK,CAAC,GAAG,CAAC;QAC/B;IACF;IAEA,OAAO;AACT;AAEA,OAAO,SAASK,WACdC,IAAuB;IAQvB,OACEA,SAAS,cACTA,SAAS,mCACTA,SAAS,8BACTA,SAAS,+BACTA,SAAS,gCACTA,SAAS;AAEb;AAEA,OAAO,SAASC,mBAAmBJ,SAA4B;IAI7D,IAAIK,SAAS;IACb,IAAIC,WAAW;IAEf,OAAQN;QACN,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;YACHK,SAAS;YACT;QACF,KAAK;YACHA,SAAS;YACTC,WAAW;YACX;QACF,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;YACH;QACF;YACEN;IACJ;IAEA,OAAO;QAAEK;QAAQC;IAAS;AAC5B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/html-bots.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/html-bots.js new file mode 100644 index 0000000000000000000000000000000000000000..84c3aadc1f41c7632e0ce8ad443928f266cdb58e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/html-bots.js @@ -0,0 +1,7 @@ +// This regex contains the bots that we need to do a blocking render for and can't safely stream the response +// due to how they parse the DOM. For example, they might explicitly check for metadata in the `head` tag, so we can't stream metadata tags after the `head` was sent. +// Note: The pattern [\w-]+-Google captures all Google crawlers with "-Google" suffix (e.g., Mediapartners-Google, AdsBot-Google, Storebot-Google) +// as well as crawlers starting with "Google-" (e.g., Google-PageRenderer, Google-InspectionTool) +export const HTML_LIMITED_BOT_UA_RE = /[\w-]+-Google|Google-[\w-]+|Chrome-Lighthouse|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Yeti|googleweblight/i; + +//# sourceMappingURL=html-bots.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/html-bots.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/html-bots.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a6e02ccb390fd5a6669e7df5a510dbbf6486745b --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/html-bots.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/html-bots.ts"],"sourcesContent":["// This regex contains the bots that we need to do a blocking render for and can't safely stream the response\n// due to how they parse the DOM. For example, they might explicitly check for metadata in the `head` tag, so we can't stream metadata tags after the `head` was sent.\n// Note: The pattern [\\w-]+-Google captures all Google crawlers with \"-Google\" suffix (e.g., Mediapartners-Google, AdsBot-Google, Storebot-Google)\n// as well as crawlers starting with \"Google-\" (e.g., Google-PageRenderer, Google-InspectionTool)\nexport const HTML_LIMITED_BOT_UA_RE =\n /[\\w-]+-Google|Google-[\\w-]+|Chrome-Lighthouse|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Yeti|googleweblight/i\n"],"names":["HTML_LIMITED_BOT_UA_RE"],"mappings":"AAAA,6GAA6G;AAC7G,sKAAsK;AACtK,kJAAkJ;AAClJ,iGAAiG;AACjG,OAAO,MAAMA,yBACX,sTAAqT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/index.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/index.js new file mode 100644 index 0000000000000000000000000000000000000000..4ad2363a1968891deaf89813bbe262b3dbf1f46a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/index.js @@ -0,0 +1,4 @@ +export { getSortedRoutes, getSortedRouteObjects } from './sorted-routes'; +export { isDynamicRoute } from './is-dynamic'; + +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/index.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..84126e53334f73902a0869f8649a9204cde9e8e6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/index.ts"],"sourcesContent":["export { getSortedRoutes, getSortedRouteObjects } from './sorted-routes'\nexport { isDynamicRoute } from './is-dynamic'\n"],"names":["getSortedRoutes","getSortedRouteObjects","isDynamicRoute"],"mappings":"AAAA,SAASA,eAAe,EAAEC,qBAAqB,QAAQ,kBAAiB;AACxE,SAASC,cAAc,QAAQ,eAAc","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/interception-prefix-from-param-type.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/interception-prefix-from-param-type.js new file mode 100644 index 0000000000000000000000000000000000000000..91cf196ee64b2cba7e968f92b460c952d78a5d3b --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/interception-prefix-from-param-type.js @@ -0,0 +1,23 @@ +export function interceptionPrefixFromParamType(paramType) { + switch(paramType){ + case 'catchall-intercepted-(..)(..)': + case 'dynamic-intercepted-(..)(..)': + return '(..)(..)'; + case 'catchall-intercepted-(.)': + case 'dynamic-intercepted-(.)': + return '(.)'; + case 'catchall-intercepted-(..)': + case 'dynamic-intercepted-(..)': + return '(..)'; + case 'catchall-intercepted-(...)': + case 'dynamic-intercepted-(...)': + return '(...)'; + case 'catchall': + case 'dynamic': + case 'optional-catchall': + default: + return null; + } +} + +//# sourceMappingURL=interception-prefix-from-param-type.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/interception-prefix-from-param-type.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/interception-prefix-from-param-type.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6ae710876adb85ac4f832d82a83fb99db711a9dd --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/interception-prefix-from-param-type.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/interception-prefix-from-param-type.ts"],"sourcesContent":["import type { DynamicParamTypes } from '../../app-router-types'\n\nexport function interceptionPrefixFromParamType(\n paramType: DynamicParamTypes\n): string | null {\n switch (paramType) {\n case 'catchall-intercepted-(..)(..)':\n case 'dynamic-intercepted-(..)(..)':\n return '(..)(..)'\n case 'catchall-intercepted-(.)':\n case 'dynamic-intercepted-(.)':\n return '(.)'\n case 'catchall-intercepted-(..)':\n case 'dynamic-intercepted-(..)':\n return '(..)'\n case 'catchall-intercepted-(...)':\n case 'dynamic-intercepted-(...)':\n return '(...)'\n case 'catchall':\n case 'dynamic':\n case 'optional-catchall':\n default:\n return null\n }\n}\n"],"names":["interceptionPrefixFromParamType","paramType"],"mappings":"AAEA,OAAO,SAASA,gCACdC,SAA4B;IAE5B,OAAQA;QACN,KAAK;QACL,KAAK;YACH,OAAO;QACT,KAAK;QACL,KAAK;YACH,OAAO;QACT,KAAK;QACL,KAAK;YACH,OAAO;QACT,KAAK;QACL,KAAK;YACH,OAAO;QACT,KAAK;QACL,KAAK;QACL,KAAK;QACL;YACE,OAAO;IACX;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/interception-routes.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/interception-routes.js new file mode 100644 index 0000000000000000000000000000000000000000..6a7291d062c0223243ea594ce41bc2729876b179 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/interception-routes.js @@ -0,0 +1,127 @@ +import { normalizeAppPath } from './app-paths'; +// order matters here, the first match will be used +export const INTERCEPTION_ROUTE_MARKERS = [ + '(..)(..)', + '(.)', + '(..)', + '(...)' +]; +function parseRoutePattern(route) { + const segments = route.split('/').filter(Boolean); + const tail = segments.at(-1); + const isOptionalCatchAll = tail !== undefined && tail.startsWith('[[...') && tail.endsWith(']]'); + const isCatchAll = tail !== undefined && tail.startsWith('[...') && tail.endsWith(']'); + const unbounded = isOptionalCatchAll || isCatchAll; + const prefixSegments = unbounded ? segments.slice(0, -1) : segments; + return { + prefix: prefixSegments.map((segment)=>segment.startsWith('[') && segment.endsWith(']') ? null : segment), + minLength: prefixSegments.length + (isCatchAll && !isOptionalCatchAll ? 1 : 0), + unbounded + }; +} +function acceptsLength(pattern, length) { + return pattern.unbounded ? length >= pattern.minLength : length === pattern.minLength; +} +function prefixCovers(canonical, intercepted) { + return canonical.prefix.every((canonicalSegment, index)=>{ + if (canonicalSegment === null) return true; + const interceptedSegment = intercepted.prefix[index]; + return interceptedSegment !== undefined && interceptedSegment !== null && canonicalSegment === interceptedSegment; + }); +} +function patternCoversAtLength(canonical, intercepted, length) { + return acceptsLength(canonical, length) && acceptsLength(intercepted, length) && prefixCovers(canonical, intercepted); +} +/** Returns whether ordinary route patterns cover every URL in `route`. */ function isRoutePatternCovered(route, ordinaryRoutes) { + const intercepted = parseRoutePattern(route); + if (!intercepted.unbounded) { + return ordinaryRoutes.some((pattern)=>patternCoversAtLength(pattern, intercepted, intercepted.minLength)); + } + let unboundedCoverageStart = Infinity; + for (const pattern of ordinaryRoutes){ + if (pattern.unbounded && prefixCovers(pattern, intercepted)) { + unboundedCoverageStart = Math.min(unboundedCoverageStart, Math.max(intercepted.minLength, pattern.minLength)); + } + } + if (unboundedCoverageStart === Infinity) return false; + // An optional or required catchall can have its shorter paths covered by + // fixed routes before another catchall takes over the remaining suffix. + for(let length = intercepted.minLength; length < unboundedCoverageStart; length++){ + if (!ordinaryRoutes.some((pattern)=>patternCoversAtLength(pattern, intercepted, length))) { + return false; + } + } + return true; +} +export function isInterceptionRouteAppPath(path) { + // TODO-APP: add more serious validation + return path.split('/').find((segment)=>INTERCEPTION_ROUTE_MARKERS.find((m)=>segment.startsWith(m))) !== undefined; +} +export function extractInterceptionRouteInformation(path) { + let interceptingRoute; + let marker; + let interceptedRoute; + for (const segment of path.split('/')){ + marker = INTERCEPTION_ROUTE_MARKERS.find((m)=>segment.startsWith(m)); + if (marker) { + ; + [interceptingRoute, interceptedRoute] = path.split(marker, 2); + break; + } + } + if (!interceptingRoute || !marker || !interceptedRoute) { + throw new Error(`Invalid interception route: ${path}. Must be in the format /<intercepting route>/(..|...|..)(..)/<intercepted route>`); + } + interceptingRoute = normalizeAppPath(interceptingRoute) // normalize the path, e.g. /(blog)/feed -> /feed + ; + switch(marker){ + case '(.)': + // (.) indicates that we should match with sibling routes, so we just need to append the intercepted route to the intercepting route + if (interceptingRoute === '/') { + interceptedRoute = `/${interceptedRoute}`; + } else { + interceptedRoute = interceptingRoute + '/' + interceptedRoute; + } + break; + case '(..)': + // (..) indicates that we should match at one level up, so we need to remove the last segment of the intercepting route + if (interceptingRoute === '/') { + throw new Error(`Invalid interception route: ${path}. Cannot use (..) marker at the root level, use (.) instead.`); + } + interceptedRoute = interceptingRoute.split('/').slice(0, -1).concat(interceptedRoute).join('/'); + break; + case '(...)': + // (...) will match the route segment in the root directory, so we need to use the root directory to prepend the intercepted route + interceptedRoute = '/' + interceptedRoute; + break; + case '(..)(..)': + // (..)(..) indicates that we should match at two levels up, so we need to remove the last two segments of the intercepting route + const splitInterceptingRoute = interceptingRoute.split('/'); + if (splitInterceptingRoute.length <= 2) { + throw new Error(`Invalid interception route: ${path}. Cannot use (..)(..) marker at the root level or one level up.`); + } + interceptedRoute = splitInterceptingRoute.slice(0, -2).concat(interceptedRoute).join('/'); + break; + default: + throw new Error('Invariant: unexpected marker'); + } + return { + interceptingRoute, + interceptedRoute + }; +} +/** + * Finds interception matchers that cannot be loaded as an ordinary request. + * + * This must run after catch-all normalization and pruning so `appPaths` + * contains the final matcher set rather than every possible matcher candidate. + */ export function findMissingCanonicalInterceptionRoutes(appPaths) { + const canonicalRoutes = Object.keys(appPaths).filter((route)=>!isInterceptionRouteAppPath(route)); + const canonicalRoutePatterns = canonicalRoutes.map(parseRoutePattern); + return Object.keys(appPaths).filter(isInterceptionRouteAppPath).map((interceptionRoute)=>({ + interceptionRoute, + canonicalRoute: extractInterceptionRouteInformation(interceptionRoute).interceptedRoute + })).filter(({ canonicalRoute })=>!isRoutePatternCovered(canonicalRoute, canonicalRoutePatterns)).sort((a, b)=>a.interceptionRoute.localeCompare(b.interceptionRoute)); +} + +//# sourceMappingURL=interception-routes.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/interception-routes.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/interception-routes.js.map new file mode 100644 index 0000000000000000000000000000000000000000..229715eb24b57775aa14b03a49c5e898125496e4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/interception-routes.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/interception-routes.ts"],"sourcesContent":["import { normalizeAppPath } from './app-paths'\n\n// order matters here, the first match will be used\nexport const INTERCEPTION_ROUTE_MARKERS = [\n '(..)(..)',\n '(.)',\n '(..)',\n '(...)',\n] as const\n\nexport type InterceptionMarker = (typeof INTERCEPTION_ROUTE_MARKERS)[number]\n\nexport type MissingCanonicalInterceptionRoute = {\n interceptionRoute: string\n canonicalRoute: string\n}\n\ntype RoutePattern = {\n prefix: Array<string | null>\n minLength: number\n unbounded: boolean\n}\n\nfunction parseRoutePattern(route: string): RoutePattern {\n const segments = route.split('/').filter(Boolean)\n const tail = segments.at(-1)\n const isOptionalCatchAll =\n tail !== undefined && tail.startsWith('[[...') && tail.endsWith(']]')\n const isCatchAll =\n tail !== undefined && tail.startsWith('[...') && tail.endsWith(']')\n const unbounded = isOptionalCatchAll || isCatchAll\n const prefixSegments = unbounded ? segments.slice(0, -1) : segments\n\n return {\n prefix: prefixSegments.map((segment) =>\n segment.startsWith('[') && segment.endsWith(']') ? null : segment\n ),\n minLength:\n prefixSegments.length + (isCatchAll && !isOptionalCatchAll ? 1 : 0),\n unbounded,\n }\n}\n\nfunction acceptsLength(pattern: RoutePattern, length: number): boolean {\n return pattern.unbounded\n ? length >= pattern.minLength\n : length === pattern.minLength\n}\n\nfunction prefixCovers(\n canonical: RoutePattern,\n intercepted: RoutePattern\n): boolean {\n return canonical.prefix.every((canonicalSegment, index) => {\n if (canonicalSegment === null) return true\n\n const interceptedSegment = intercepted.prefix[index]\n return (\n interceptedSegment !== undefined &&\n interceptedSegment !== null &&\n canonicalSegment === interceptedSegment\n )\n })\n}\n\nfunction patternCoversAtLength(\n canonical: RoutePattern,\n intercepted: RoutePattern,\n length: number\n): boolean {\n return (\n acceptsLength(canonical, length) &&\n acceptsLength(intercepted, length) &&\n prefixCovers(canonical, intercepted)\n )\n}\n\n/** Returns whether ordinary route patterns cover every URL in `route`. */\nfunction isRoutePatternCovered(route: string, ordinaryRoutes: RoutePattern[]) {\n const intercepted = parseRoutePattern(route)\n\n if (!intercepted.unbounded) {\n return ordinaryRoutes.some((pattern) =>\n patternCoversAtLength(pattern, intercepted, intercepted.minLength)\n )\n }\n\n let unboundedCoverageStart = Infinity\n for (const pattern of ordinaryRoutes) {\n if (pattern.unbounded && prefixCovers(pattern, intercepted)) {\n unboundedCoverageStart = Math.min(\n unboundedCoverageStart,\n Math.max(intercepted.minLength, pattern.minLength)\n )\n }\n }\n\n if (unboundedCoverageStart === Infinity) return false\n\n // An optional or required catchall can have its shorter paths covered by\n // fixed routes before another catchall takes over the remaining suffix.\n for (\n let length = intercepted.minLength;\n length < unboundedCoverageStart;\n length++\n ) {\n if (\n !ordinaryRoutes.some((pattern) =>\n patternCoversAtLength(pattern, intercepted, length)\n )\n ) {\n return false\n }\n }\n\n return true\n}\n\nexport function isInterceptionRouteAppPath(path: string): boolean {\n // TODO-APP: add more serious validation\n return (\n path\n .split('/')\n .find((segment) =>\n INTERCEPTION_ROUTE_MARKERS.find((m) => segment.startsWith(m))\n ) !== undefined\n )\n}\n\ntype InterceptionRouteInformation = {\n /**\n * The intercepting route. This is the route that is being intercepted or the\n * route that the user was coming from. This is matched by the Next-Url\n * header.\n */\n interceptingRoute: string\n\n /**\n * The intercepted route. This is the route that is being intercepted or the\n * route that the user is going to. This is matched by the request pathname.\n */\n interceptedRoute: string\n}\n\nexport function extractInterceptionRouteInformation(\n path: string\n): InterceptionRouteInformation {\n let interceptingRoute: string | undefined\n let marker: (typeof INTERCEPTION_ROUTE_MARKERS)[number] | undefined\n let interceptedRoute: string | undefined\n\n for (const segment of path.split('/')) {\n marker = INTERCEPTION_ROUTE_MARKERS.find((m) => segment.startsWith(m))\n if (marker) {\n ;[interceptingRoute, interceptedRoute] = path.split(marker, 2)\n break\n }\n }\n\n if (!interceptingRoute || !marker || !interceptedRoute) {\n throw new Error(\n `Invalid interception route: ${path}. Must be in the format /<intercepting route>/(..|...|..)(..)/<intercepted route>`\n )\n }\n\n interceptingRoute = normalizeAppPath(interceptingRoute) // normalize the path, e.g. /(blog)/feed -> /feed\n\n switch (marker) {\n case '(.)':\n // (.) indicates that we should match with sibling routes, so we just need to append the intercepted route to the intercepting route\n if (interceptingRoute === '/') {\n interceptedRoute = `/${interceptedRoute}`\n } else {\n interceptedRoute = interceptingRoute + '/' + interceptedRoute\n }\n break\n case '(..)':\n // (..) indicates that we should match at one level up, so we need to remove the last segment of the intercepting route\n if (interceptingRoute === '/') {\n throw new Error(\n `Invalid interception route: ${path}. Cannot use (..) marker at the root level, use (.) instead.`\n )\n }\n interceptedRoute = interceptingRoute\n .split('/')\n .slice(0, -1)\n .concat(interceptedRoute)\n .join('/')\n break\n case '(...)':\n // (...) will match the route segment in the root directory, so we need to use the root directory to prepend the intercepted route\n interceptedRoute = '/' + interceptedRoute\n break\n case '(..)(..)':\n // (..)(..) indicates that we should match at two levels up, so we need to remove the last two segments of the intercepting route\n\n const splitInterceptingRoute = interceptingRoute.split('/')\n if (splitInterceptingRoute.length <= 2) {\n throw new Error(\n `Invalid interception route: ${path}. Cannot use (..)(..) marker at the root level or one level up.`\n )\n }\n\n interceptedRoute = splitInterceptingRoute\n .slice(0, -2)\n .concat(interceptedRoute)\n .join('/')\n break\n default:\n throw new Error('Invariant: unexpected marker')\n }\n\n return { interceptingRoute, interceptedRoute }\n}\n\n/**\n * Finds interception matchers that cannot be loaded as an ordinary request.\n *\n * This must run after catch-all normalization and pruning so `appPaths`\n * contains the final matcher set rather than every possible matcher candidate.\n */\nexport function findMissingCanonicalInterceptionRoutes(\n appPaths: Record<string, string[]>\n): MissingCanonicalInterceptionRoute[] {\n const canonicalRoutes = Object.keys(appPaths).filter(\n (route) => !isInterceptionRouteAppPath(route)\n )\n const canonicalRoutePatterns = canonicalRoutes.map(parseRoutePattern)\n\n return Object.keys(appPaths)\n .filter(isInterceptionRouteAppPath)\n .map((interceptionRoute) => ({\n interceptionRoute,\n canonicalRoute:\n extractInterceptionRouteInformation(interceptionRoute).interceptedRoute,\n }))\n .filter(\n ({ canonicalRoute }) =>\n !isRoutePatternCovered(canonicalRoute, canonicalRoutePatterns)\n )\n .sort((a, b) => a.interceptionRoute.localeCompare(b.interceptionRoute))\n}\n"],"names":["normalizeAppPath","INTERCEPTION_ROUTE_MARKERS","parseRoutePattern","route","segments","split","filter","Boolean","tail","at","isOptionalCatchAll","undefined","startsWith","endsWith","isCatchAll","unbounded","prefixSegments","slice","prefix","map","segment","minLength","length","acceptsLength","pattern","prefixCovers","canonical","intercepted","every","canonicalSegment","index","interceptedSegment","patternCoversAtLength","isRoutePatternCovered","ordinaryRoutes","some","unboundedCoverageStart","Infinity","Math","min","max","isInterceptionRouteAppPath","path","find","m","extractInterceptionRouteInformation","interceptingRoute","marker","interceptedRoute","Error","concat","join","splitInterceptingRoute","findMissingCanonicalInterceptionRoutes","appPaths","canonicalRoutes","Object","keys","canonicalRoutePatterns","interceptionRoute","canonicalRoute","sort","a","b","localeCompare"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,cAAa;AAE9C,mDAAmD;AACnD,OAAO,MAAMC,6BAA6B;IACxC;IACA;IACA;IACA;CACD,CAAS;AAeV,SAASC,kBAAkBC,KAAa;IACtC,MAAMC,WAAWD,MAAME,KAAK,CAAC,KAAKC,MAAM,CAACC;IACzC,MAAMC,OAAOJ,SAASK,EAAE,CAAC,CAAC;IAC1B,MAAMC,qBACJF,SAASG,aAAaH,KAAKI,UAAU,CAAC,YAAYJ,KAAKK,QAAQ,CAAC;IAClE,MAAMC,aACJN,SAASG,aAAaH,KAAKI,UAAU,CAAC,WAAWJ,KAAKK,QAAQ,CAAC;IACjE,MAAME,YAAYL,sBAAsBI;IACxC,MAAME,iBAAiBD,YAAYX,SAASa,KAAK,CAAC,GAAG,CAAC,KAAKb;IAE3D,OAAO;QACLc,QAAQF,e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R;QACF,KAAK;YACH,kIAAkI;YAClIH,mBAAmB,MAAMA;YACzB;QACF,KAAK;YACH,iIAAiI;YAEjI,MAAMI,yBAAyBN,kBAAkBzC,KAAK,CAAC;YACvD,IAAI+C,uBAAuB9B,MAAM,IAAI,GAAG;gBACtC,MAAM,IAAI2B,MACR,CAAC,4BAA4B,EAAEP,KAAK,+DAA+D,CAAC;YAExG;YAEAM,mBAAmBI,uBAChBnC,KAAK,CAAC,GAAG,CAAC,GACViC,MAAM,CAACF,kBACPG,IAAI,CAAC;YACR;QACF;YACE,MAAM,IAAIF,MAAM;IACpB;IAEA,OAAO;QAAEH;QAAmBE;IAAiB;AAC/C;AAEA;;;;;CAKC,GACD,OAAO,SAASK,uCACdC,QAAkC;IAElC,MAAMC,kBAAkBC,OAAOC,IAAI,CAACH,UAAUhD,MAAM,CAClD,CAACH,QAAU,CAACsC,2BAA2BtC;IAEzC,MAAMuD,yBAAyBH,gBAAgBpC,GAAG,CAACjB;IAEnD,OAAOsD,OAAOC,IAAI,CAACH,UAChBhD,MAAM,CAACmC,4BACPtB,GAAG,CAAC,CAACwC,oBAAuB,CAAA;YAC3BA;YACAC,gBACEf,oCAAoCc,mBAAmBX,gBAAgB;QAC3E,CAAA,GACC1C,MAAM,CACL,CAAC,EAAEsD,cAAc,EAAE,GACjB,CAAC3B,sBAAsB2B,gBAAgBF,yBAE1CG,IAAI,CAAC,CAACC,GAAGC,IAAMD,EAAEH,iBAAiB,CAACK,aAAa,CAACD,EAAEJ,iBAAiB;AACzE","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/interpolate-as.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/interpolate-as.js new file mode 100644 index 0000000000000000000000000000000000000000..7656b6aaed44878faafa026c1b2d0b29a97fc51d --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/interpolate-as.js @@ -0,0 +1,43 @@ +import { getRouteMatcher } from './route-matcher'; +import { getRouteRegex } from './route-regex'; +export function interpolateAs(route, asPathname, query) { + let interpolatedRoute = ''; + const dynamicRegex = getRouteRegex(route); + const dynamicGroups = dynamicRegex.groups; + const dynamicMatches = // Try to match the dynamic route against the asPath + (asPathname !== route ? getRouteMatcher(dynamicRegex)(asPathname) : '') || // Fall back to reading the values from the href + // TODO: should this take priority; also need to change in the router. + query; + interpolatedRoute = route; + const params = Object.keys(dynamicGroups); + if (!params.every((param)=>{ + let value = dynamicMatches[param] || ''; + const { repeat, optional } = dynamicGroups[param]; + // support single-level catch-all + // TODO: more robust handling for user-error (passing `/`) + let replaced = `[${repeat ? '...' : ''}${param}]`; + if (optional) { + replaced = `${!value ? '/' : ''}[${replaced}]`; + } + if (repeat && !Array.isArray(value)) value = [ + value + ]; + return (optional || param in dynamicMatches) && // Interpolate group into data URL if present + (interpolatedRoute = interpolatedRoute.replace(replaced, repeat ? value.map(// these values should be fully encoded instead of just + // path delimiter escaped since they are being inserted + // into the URL and we expect URL encoded segments + // when parsing dynamic route params + (segment)=>encodeURIComponent(segment)).join('/') : encodeURIComponent(value)) || '/'); + })) { + interpolatedRoute = '' // did not satisfy all requirements + ; + // n.b. We ignore this error because we handle warning for this case in + // development in the `<Link>` component directly. + } + return { + params, + result: interpolatedRoute + }; +} + +//# sourceMappingURL=interpolate-as.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/interpolate-as.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/interpolate-as.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c6f5fa22530e475183c68bc1f6614319dade488e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/interpolate-as.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/interpolate-as.ts"],"sourcesContent":["import type { ParsedUrlQuery } from 'querystring'\n\nimport { getRouteMatcher } from './route-matcher'\nimport { getRouteRegex } from './route-regex'\n\nexport function interpolateAs(\n route: string,\n asPathname: string,\n query: ParsedUrlQuery\n) {\n let interpolatedRoute = ''\n\n const dynamicRegex = getRouteRegex(route)\n const dynamicGroups = dynamicRegex.groups\n const dynamicMatches =\n // Try to match the dynamic route against the asPath\n (asPathname !== route ? getRouteMatcher(dynamicRegex)(asPathname) : '') ||\n // Fall back to reading the values from the href\n // TODO: should this take priority; also need to change in the router.\n query\n\n interpolatedRoute = route\n const params = Object.keys(dynamicGroups)\n\n if (\n !params.every((param) => {\n let value = dynamicMatches[param] || ''\n const { repeat, optional } = dynamicGroups[param]\n\n // support single-level catch-all\n // TODO: more robust handling for user-error (passing `/`)\n let replaced = `[${repeat ? '...' : ''}${param}]`\n if (optional) {\n replaced = `${!value ? '/' : ''}[${replaced}]`\n }\n if (repeat && !Array.isArray(value)) value = [value]\n\n return (\n (optional || param in dynamicMatches) &&\n // Interpolate group into data URL if present\n (interpolatedRoute =\n interpolatedRoute!.replace(\n replaced,\n repeat\n ? (value as string[])\n .map(\n // these values should be fully encoded instead of just\n // path delimiter escaped since they are being inserted\n // into the URL and we expect URL encoded segments\n // when parsing dynamic route params\n (segment) => encodeURIComponent(segment)\n )\n .join('/')\n : encodeURIComponent(value as string)\n ) || '/')\n )\n })\n ) {\n interpolatedRoute = '' // did not satisfy all requirements\n\n // n.b. We ignore this error because we handle warning for this case in\n // development in the `<Link>` component directly.\n }\n return {\n params,\n result: interpolatedRoute,\n }\n}\n"],"names":["getRouteMatcher","getRouteRegex","interpolateAs","route","asPathname","query","interpolatedRoute","dynamicRegex","dynamicGroups","groups","dynamicMatches","params","Object","keys","every","param","value","repeat","optional","replaced","Array","isArray","replace","map","segment","encodeURIComponent","join","result"],"mappings":"AAEA,SAASA,eAAe,QAAQ,kBAAiB;AACjD,SAASC,aAAa,QAAQ,gBAAe;AAE7C,OAAO,SAASC,cACdC,KAAa,EACbC,UAAkB,EAClBC,KAAqB;IAErB,IAAIC,oBAAoB;IAExB,MAAMC,eAAeN,cAAcE;IACnC,MAAMK,gBAAgBD,aAAaE,MAAM;IACzC,MAAMC,iBAEJ,AADA,oDAAoD;IACnDN,CAAAA,eAAeD,QAAQH,gBAAgBO,cAAcH,cAAc,EAAC,KACrE,gDAAgD;IAChD,sEAAsE;IACtEC;IAEFC,oBAAoBH;IACpB,MAAMQ,SAASC,OAAOC,IAAI,CAACL;IAE3B,IACE,CAACG,OAAOG,KAAK,CAAC,CAACC;QACb,IAAIC,QAAQN,cAAc,CAACK,MAAM,IAAI;QACrC,MAAM,EAAEE,MAAM,EAAEC,QAAQ,EAAE,GAAGV,aAAa,CAACO,MAAM;QAEjD,iCAAiC;QACjC,0DAA0D;QAC1D,IAAII,WAAW,CAAC,CAAC,EAAEF,SAAS,QAAQ,KAAKF,MAAM,CAAC,CAAC;QACjD,IAAIG,UAAU;YACZC,WAAW,GAAG,CAACH,QAAQ,MAAM,GAAG,CAAC,EAAEG,SAAS,CAAC,CAAC;QAChD;QACA,IAAIF,UAAU,CAACG,MAAMC,OAAO,CAACL,QAAQA,QAAQ;YAACA;SAAM;QAEpD,OACE,AAACE,CAAAA,YAAYH,SAASL,cAAa,KACnC,6CAA6C;QAC5CJ,CAAAA,oBACCA,kBAAmBgB,OAAO,CACxBH,UACAF,SACI,AAACD,MACEO,GAAG,CACF,uDAAuD;QACvD,uDAAuD;QACvD,kDAAkD;QAClD,oCAAoC;QACpC,CAACC,UAAYC,mBAAmBD,UAEjCE,IAAI,CAAC,OACRD,mBAAmBT,WACpB,GAAE;IAEb,IACA;QACAV,oBAAoB,GAAG,mCAAmC;;IAE1D,uEAAuE;IACvE,kDAAkD;IACpD;IACA,OAAO;QACLK;QACAgB,QAAQrB;IACV;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/is-bot.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/is-bot.js new file mode 100644 index 0000000000000000000000000000000000000000..e640bdd51d80379de48475b531b656a37091e394 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/is-bot.js @@ -0,0 +1,28 @@ +import { HTML_LIMITED_BOT_UA_RE } from './html-bots'; +// Bot crawler that will spin up a headless browser and execute JS. +// Only the main Googlebot search crawler executes JavaScript, not other Google crawlers. +// x-ref: https://developers.google.com/search/docs/crawling-indexing/google-common-crawlers +// This regex specifically matches "Googlebot" but NOT "Mediapartners-Google", "AdsBot-Google", etc. +const HEADLESS_BROWSER_BOT_UA_RE = /Googlebot(?!-)|Googlebot$/i; +export const HTML_LIMITED_BOT_UA_RE_STRING = HTML_LIMITED_BOT_UA_RE.source; +export { HTML_LIMITED_BOT_UA_RE }; +function isDomBotUA(userAgent) { + return HEADLESS_BROWSER_BOT_UA_RE.test(userAgent); +} +function isHtmlLimitedBotUA(userAgent) { + return HTML_LIMITED_BOT_UA_RE.test(userAgent); +} +export function isBot(userAgent) { + return isDomBotUA(userAgent) || isHtmlLimitedBotUA(userAgent); +} +export function getBotType(userAgent) { + if (isDomBotUA(userAgent)) { + return 'dom'; + } + if (isHtmlLimitedBotUA(userAgent)) { + return 'html'; + } + return undefined; +} + +//# sourceMappingURL=is-bot.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/is-bot.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/is-bot.js.map new file mode 100644 index 0000000000000000000000000000000000000000..974c624805e23967e74bef3a6e059994ea22e710 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/is-bot.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/is-bot.ts"],"sourcesContent":["import { HTML_LIMITED_BOT_UA_RE } from './html-bots'\n\n// Bot crawler that will spin up a headless browser and execute JS.\n// Only the main Googlebot search crawler executes JavaScript, not other Google crawlers.\n// x-ref: https://developers.google.com/search/docs/crawling-indexing/google-common-crawlers\n// This regex specifically matches \"Googlebot\" but NOT \"Mediapartners-Google\", \"AdsBot-Google\", etc.\nconst HEADLESS_BROWSER_BOT_UA_RE = /Googlebot(?!-)|Googlebot$/i\n\nexport const HTML_LIMITED_BOT_UA_RE_STRING = HTML_LIMITED_BOT_UA_RE.source\n\nexport { HTML_LIMITED_BOT_UA_RE }\n\nfunction isDomBotUA(userAgent: string) {\n return HEADLESS_BROWSER_BOT_UA_RE.test(userAgent)\n}\n\nfunction isHtmlLimitedBotUA(userAgent: string) {\n return HTML_LIMITED_BOT_UA_RE.test(userAgent)\n}\n\nexport function isBot(userAgent: string): boolean {\n return isDomBotUA(userAgent) || isHtmlLimitedBotUA(userAgent)\n}\n\nexport function getBotType(userAgent: string): 'dom' | 'html' | undefined {\n if (isDomBotUA(userAgent)) {\n return 'dom'\n }\n if (isHtmlLimitedBotUA(userAgent)) {\n return 'html'\n }\n return undefined\n}\n"],"names":["HTML_LIMITED_BOT_UA_RE","HEADLESS_BROWSER_BOT_UA_RE","HTML_LIMITED_BOT_UA_RE_STRING","source","isDomBotUA","userAgent","test","isHtmlLimitedBotUA","isBot","getBotType","undefined"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,cAAa;AAEpD,mEAAmE;AACnE,yFAAyF;AACzF,4FAA4F;AAC5F,oGAAoG;AACpG,MAAMC,6BAA6B;AAEnC,OAAO,MAAMC,gCAAgCF,uBAAuBG,MAAM,CAAA;AAE1E,SAASH,sBAAsB,GAAE;AAEjC,SAASI,WAAWC,SAAiB;IACnC,OAAOJ,2BAA2BK,IAAI,CAACD;AACzC;AAEA,SAASE,mBAAmBF,SAAiB;IAC3C,OAAOL,uBAAuBM,IAAI,CAACD;AACrC;AAEA,OAAO,SAASG,MAAMH,SAAiB;IACrC,OAAOD,WAAWC,cAAcE,mBAAmBF;AACrD;AAEA,OAAO,SAASI,WAAWJ,SAAiB;IAC1C,IAAID,WAAWC,YAAY;QACzB,OAAO;IACT;IACA,IAAIE,mBAAmBF,YAAY;QACjC,OAAO;IACT;IACA,OAAOK;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/is-dynamic.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/is-dynamic.js new file mode 100644 index 0000000000000000000000000000000000000000..cd3361f13fbfcb4ca18d2ba948dcf2be8c8ccdd4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/is-dynamic.js @@ -0,0 +1,22 @@ +import { extractInterceptionRouteInformation, isInterceptionRouteAppPath } from './interception-routes'; +// Identify /.*[param].*/ in route string +const TEST_ROUTE = /\/[^/]*\[[^/]+\][^/]*(?=\/|$)/; +// Identify /[param]/ in route string +const TEST_STRICT_ROUTE = /\/\[[^/]+\](?=\/|$)/; +/** + * Check if a route is dynamic. + * + * @param route - The route to check. + * @param strict - Whether to use strict mode which prohibits segments with prefixes/suffixes (default: true). + * @returns Whether the route is dynamic. + */ export function isDynamicRoute(route, strict = true) { + if (isInterceptionRouteAppPath(route)) { + route = extractInterceptionRouteInformation(route).interceptedRoute; + } + if (strict) { + return TEST_STRICT_ROUTE.test(route); + } + return TEST_ROUTE.test(route); +} + +//# sourceMappingURL=is-dynamic.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/is-dynamic.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/is-dynamic.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d8f6a6a9323d272acfdfe05f259d430e091f74fa --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/is-dynamic.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/is-dynamic.ts"],"sourcesContent":["import {\n extractInterceptionRouteInformation,\n isInterceptionRouteAppPath,\n} from './interception-routes'\n\n// Identify /.*[param].*/ in route string\nconst TEST_ROUTE = /\\/[^/]*\\[[^/]+\\][^/]*(?=\\/|$)/\n\n// Identify /[param]/ in route string\nconst TEST_STRICT_ROUTE = /\\/\\[[^/]+\\](?=\\/|$)/\n\n/**\n * Check if a route is dynamic.\n *\n * @param route - The route to check.\n * @param strict - Whether to use strict mode which prohibits segments with prefixes/suffixes (default: true).\n * @returns Whether the route is dynamic.\n */\nexport function isDynamicRoute(route: string, strict: boolean = true): boolean {\n if (isInterceptionRouteAppPath(route)) {\n route = extractInterceptionRouteInformation(route).interceptedRoute\n }\n\n if (strict) {\n return TEST_STRICT_ROUTE.test(route)\n }\n\n return TEST_ROUTE.test(route)\n}\n"],"names":["extractInterceptionRouteInformation","isInterceptionRouteAppPath","TEST_ROUTE","TEST_STRICT_ROUTE","isDynamicRoute","route","strict","interceptedRoute","test"],"mappings":"AAAA,SACEA,mCAAmC,EACnCC,0BAA0B,QACrB,wBAAuB;AAE9B,yCAAyC;AACzC,MAAMC,aAAa;AAEnB,qCAAqC;AACrC,MAAMC,oBAAoB;AAE1B;;;;;;CAMC,GACD,OAAO,SAASC,eAAeC,KAAa,EAAEC,SAAkB,IAAI;IAClE,IAAIL,2BAA2BI,QAAQ;QACrCA,QAAQL,oCAAoCK,OAAOE,gBAAgB;IACrE;IAEA,IAAID,QAAQ;QACV,OAAOH,kBAAkBK,IAAI,CAACH;IAChC;IAEA,OAAOH,WAAWM,IAAI,CAACH;AACzB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/is-local-url.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/is-local-url.js new file mode 100644 index 0000000000000000000000000000000000000000..1f1ca95999eaae031e0ba01cab8e8f77c5690bd7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/is-local-url.js @@ -0,0 +1,18 @@ +import { isAbsoluteUrl, getLocationOrigin } from '../../utils'; +import { hasBasePath } from '../../../../client/has-base-path'; +/** + * Detects whether a given url is routable by the Next.js router (browser only). + */ export function isLocalURL(url) { + // prevent a hydration mismatch on href for url with anchor refs + if (!isAbsoluteUrl(url)) return true; + try { + // absolute urls can be local if they are on the same origin + const locationOrigin = getLocationOrigin(); + const resolved = new URL(url, locationOrigin); + return resolved.origin === locationOrigin && hasBasePath(resolved.pathname); + } catch (_) { + return false; + } +} + +//# sourceMappingURL=is-local-url.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/is-local-url.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/is-local-url.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ed3d087b795f8c7fefbf99ad489a44d1a8887917 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/is-local-url.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/is-local-url.ts"],"sourcesContent":["import { isAbsoluteUrl, getLocationOrigin } from '../../utils'\nimport { hasBasePath } from '../../../../client/has-base-path'\n\n/**\n * Detects whether a given url is routable by the Next.js router (browser only).\n */\nexport function isLocalURL(url: string): boolean {\n // prevent a hydration mismatch on href for url with anchor refs\n if (!isAbsoluteUrl(url)) return true\n try {\n // absolute urls can be local if they are on the same origin\n const locationOrigin = getLocationOrigin()\n const resolved = new URL(url, locationOrigin)\n return resolved.origin === locationOrigin && hasBasePath(resolved.pathname)\n } catch (_) {\n return false\n }\n}\n"],"names":["isAbsoluteUrl","getLocationOrigin","hasBasePath","isLocalURL","url","locationOrigin","resolved","URL","origin","pathname","_"],"mappings":"AAAA,SAASA,aAAa,EAAEC,iBAAiB,QAAQ,cAAa;AAC9D,SAASC,WAAW,QAAQ,mCAAkC;AAE9D;;CAEC,GACD,OAAO,SAASC,WAAWC,GAAW;IACpC,gEAAgE;IAChE,IAAI,CAACJ,cAAcI,MAAM,OAAO;IAChC,IAAI;QACF,4DAA4D;QAC5D,MAAMC,iBAAiBJ;QACvB,MAAMK,WAAW,IAAIC,IAAIH,KAAKC;QAC9B,OAAOC,SAASE,MAAM,KAAKH,kBAAkBH,YAAYI,SAASG,QAAQ;IAC5E,EAAE,OAAOC,GAAG;QACV,OAAO;IACT;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/middleware-route-matcher.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/middleware-route-matcher.js new file mode 100644 index 0000000000000000000000000000000000000000..ac86b4fcd87b24d0646b1067c3d0e8ebb53dd3b2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/middleware-route-matcher.js @@ -0,0 +1,21 @@ +import { matchHas } from './prepare-destination'; +export function getMiddlewareRouteMatcher(matchers) { + return (pathname, req, query)=>{ + for (const matcher of matchers){ + const routeMatch = new RegExp(matcher.regexp).exec(pathname); + if (!routeMatch) { + continue; + } + if (matcher.has || matcher.missing) { + const hasParams = matchHas(req, query, matcher.has, matcher.missing); + if (!hasParams) { + continue; + } + } + return true; + } + return false; + }; +} + +//# sourceMappingURL=middleware-route-matcher.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/middleware-route-matcher.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/middleware-route-matcher.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d704570f0d93de49d12dab7c722d76ef6a09b936 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/middleware-route-matcher.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/middleware-route-matcher.ts"],"sourcesContent":["import type { BaseNextRequest } from '../../../../server/base-http'\nimport type { ProxyMatcher } from '../../../../build/analysis/get-page-static-info'\nimport type { Params } from '../../../../server/request/params'\nimport { matchHas } from './prepare-destination'\n\nexport interface MiddlewareRouteMatch {\n (\n pathname: string | null | undefined,\n request: BaseNextRequest,\n query: Params\n ): boolean\n}\n\nexport function getMiddlewareRouteMatcher(\n matchers: ProxyMatcher[]\n): MiddlewareRouteMatch {\n return (\n pathname: string | null | undefined,\n req: BaseNextRequest,\n query: Params\n ) => {\n for (const matcher of matchers) {\n const routeMatch = new RegExp(matcher.regexp).exec(pathname!)\n if (!routeMatch) {\n continue\n }\n\n if (matcher.has || matcher.missing) {\n const hasParams = matchHas(req, query, matcher.has, matcher.missing)\n if (!hasParams) {\n continue\n }\n }\n\n return true\n }\n\n return false\n }\n}\n"],"names":["matchHas","getMiddlewareRouteMatcher","matchers","pathname","req","query","matcher","routeMatch","RegExp","regexp","exec","has","missing","hasParams"],"mappings":"AAGA,SAASA,QAAQ,QAAQ,wBAAuB;AAUhD,OAAO,SAASC,0BACdC,QAAwB;IAExB,OAAO,CACLC,UACAC,KACAC;QAEA,KAAK,MAAMC,WAAWJ,SAAU;YAC9B,MAAMK,aAAa,IAAIC,OAAOF,QAAQG,MAAM,EAAEC,IAAI,CAACP;YACnD,IAAI,CAACI,YAAY;gBACf;YACF;YAEA,IAAID,QAAQK,GAAG,IAAIL,QAAQM,OAAO,EAAE;gBAClC,MAAMC,YAAYb,SAASI,KAAKC,OAAOC,QAAQK,GAAG,EAAEL,QAAQM,OAAO;gBACnE,IAAI,CAACC,WAAW;oBACd;gBACF;YACF;YAEA,OAAO;QACT;QAEA,OAAO;IACT;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/omit.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/omit.js new file mode 100644 index 0000000000000000000000000000000000000000..235ddfbc0a9c39f9a737fa5843b80c55e277a915 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/omit.js @@ -0,0 +1,11 @@ +export function omit(object, keys) { + const omitted = {}; + Object.keys(object).forEach((key)=>{ + if (!keys.includes(key)) { + omitted[key] = object[key]; + } + }); + return omitted; +} + +//# sourceMappingURL=omit.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/omit.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/omit.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c0be37917322f6094b4b8f5c47068d59d12f9bd7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/omit.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/omit.ts"],"sourcesContent":["export function omit<T extends { [key: string]: unknown }, K extends keyof T>(\n object: T,\n keys: K[]\n): Omit<T, K> {\n const omitted: { [key: string]: unknown } = {}\n Object.keys(object).forEach((key) => {\n if (!keys.includes(key as K)) {\n omitted[key] = object[key]\n }\n })\n return omitted as Omit<T, K>\n}\n"],"names":["omit","object","keys","omitted","Object","forEach","key","includes"],"mappings":"AAAA,OAAO,SAASA,KACdC,MAAS,EACTC,IAAS;IAET,MAAMC,UAAsC,CAAC;IAC7CC,OAAOF,IAAI,CAACD,QAAQI,OAAO,CAAC,CAACC;QAC3B,IAAI,CAACJ,KAAKK,QAAQ,CAACD,MAAW;YAC5BH,OAAO,CAACG,IAAI,GAAGL,MAAM,CAACK,IAAI;QAC5B;IACF;IACA,OAAOH;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-loader-tree.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-loader-tree.js new file mode 100644 index 0000000000000000000000000000000000000000..143bacf2e968a3f34bd47bb83b0caf58a6bec742 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-loader-tree.js @@ -0,0 +1,20 @@ +import { DEFAULT_SEGMENT_KEY } from '../../segment'; +export function parseLoaderTree(tree) { + const [segment, parallelRoutes, modules, staticSiblings] = tree; + const { layout, template } = modules; + let { page } = modules; + // a __DEFAULT__ segment means that this route didn't match any of the + // segments in the route, so we should use the default page + page = segment === DEFAULT_SEGMENT_KEY ? modules.defaultPage : page; + const conventionPath = layout?.[1] || template?.[1] || page?.[1]; + return { + page, + segment, + modules, + /* it can be either layout / template / page */ conventionPath, + parallelRoutes, + staticSiblings + }; +} + +//# sourceMappingURL=parse-loader-tree.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-loader-tree.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-loader-tree.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1b224bcb486764fa12c58e37c03bee2b0bd62613 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-loader-tree.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/parse-loader-tree.ts"],"sourcesContent":["import { DEFAULT_SEGMENT_KEY } from '../../segment'\nimport type { LoaderTree } from '../../../../server/lib/app-dir-module'\n\nexport function parseLoaderTree(tree: LoaderTree) {\n const [segment, parallelRoutes, modules, staticSiblings] = tree\n const { layout, template } = modules\n let { page } = modules\n // a __DEFAULT__ segment means that this route didn't match any of the\n // segments in the route, so we should use the default page\n page = segment === DEFAULT_SEGMENT_KEY ? modules.defaultPage : page\n\n const conventionPath = layout?.[1] || template?.[1] || page?.[1]\n\n return {\n page,\n segment,\n modules,\n /* it can be either layout / template / page */\n conventionPath,\n parallelRoutes,\n staticSiblings,\n }\n}\n"],"names":["DEFAULT_SEGMENT_KEY","parseLoaderTree","tree","segment","parallelRoutes","modules","staticSiblings","layout","template","page","defaultPage","conventionPath"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,gBAAe;AAGnD,OAAO,SAASC,gBAAgBC,IAAgB;IAC9C,MAAM,CAACC,SAASC,gBAAgBC,SAASC,eAAe,GAAGJ;IAC3D,MAAM,EAAEK,MAAM,EAAEC,QAAQ,EAAE,GAAGH;IAC7B,IAAI,EAAEI,IAAI,EAAE,GAAGJ;IACf,sEAAsE;IACtE,2DAA2D;IAC3DI,OAAON,YAAYH,sBAAsBK,QAAQK,WAAW,GAAGD;IAE/D,MAAME,iBAAiBJ,QAAQ,CAAC,EAAE,IAAIC,UAAU,CAAC,EAAE,IAAIC,MAAM,CAAC,EAAE;IAEhE,OAAO;QACLA;QACAN;QACAE;QACA,6CAA6C,GAC7CM;QACAP;QACAE;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-path.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-path.js new file mode 100644 index 0000000000000000000000000000000000000000..9bf9b4216133a32cdb38b00e4b0c9ad7ca4b8c72 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-path.js @@ -0,0 +1,23 @@ +/** + * Given a path this function will find the pathname, query and hash and return + * them. This is useful to parse full paths on the client side. + * @param path A path to parse e.g. /foo/bar?id=1#hash + */ export function parsePath(path) { + const hashIndex = path.indexOf('#'); + const queryIndex = path.indexOf('?'); + const hasQuery = queryIndex > -1 && (hashIndex < 0 || queryIndex < hashIndex); + if (hasQuery || hashIndex > -1) { + return { + pathname: path.substring(0, hasQuery ? queryIndex : hashIndex), + query: hasQuery ? path.substring(queryIndex, hashIndex > -1 ? hashIndex : undefined) : '', + hash: hashIndex > -1 ? path.slice(hashIndex) : '' + }; + } + return { + pathname: path, + query: '', + hash: '' + }; +} + +//# sourceMappingURL=parse-path.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-path.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-path.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0981a672772e687726047b0a01c325e6e9f17216 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-path.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/parse-path.ts"],"sourcesContent":["/**\n * Given a path this function will find the pathname, query and hash and return\n * them. This is useful to parse full paths on the client side.\n * @param path A path to parse e.g. /foo/bar?id=1#hash\n */\nexport function parsePath(path: string) {\n const hashIndex = path.indexOf('#')\n const queryIndex = path.indexOf('?')\n const hasQuery = queryIndex > -1 && (hashIndex < 0 || queryIndex < hashIndex)\n\n if (hasQuery || hashIndex > -1) {\n return {\n pathname: path.substring(0, hasQuery ? queryIndex : hashIndex),\n query: hasQuery\n ? path.substring(queryIndex, hashIndex > -1 ? hashIndex : undefined)\n : '',\n hash: hashIndex > -1 ? path.slice(hashIndex) : '',\n }\n }\n\n return { pathname: path, query: '', hash: '' }\n}\n"],"names":["parsePath","path","hashIndex","indexOf","queryIndex","hasQuery","pathname","substring","query","undefined","hash","slice"],"mappings":"AAAA;;;;CAIC,GACD,OAAO,SAASA,UAAUC,IAAY;IACpC,MAAMC,YAAYD,KAAKE,OAAO,CAAC;IAC/B,MAAMC,aAAaH,KAAKE,OAAO,CAAC;IAChC,MAAME,WAAWD,aAAa,CAAC,KAAMF,CAAAA,YAAY,KAAKE,aAAaF,SAAQ;IAE3E,IAAIG,YAAYH,YAAY,CAAC,GAAG;QAC9B,OAAO;YACLI,UAAUL,KAAKM,SAAS,CAAC,GAAGF,WAAWD,aAAaF;YACpDM,OAAOH,WACHJ,KAAKM,SAAS,CAACH,YAAYF,YAAY,CAAC,IAAIA,YAAYO,aACxD;YACJC,MAAMR,YAAY,CAAC,IAAID,KAAKU,KAAK,CAACT,aAAa;QACjD;IACF;IAEA,OAAO;QAAEI,UAAUL;QAAMO,OAAO;QAAIE,MAAM;IAAG;AAC/C","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-relative-url.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-relative-url.js new file mode 100644 index 0000000000000000000000000000000000000000..b3410f5d5c6fad9a9223e121a0748b3ed49a7311 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-relative-url.js @@ -0,0 +1,29 @@ +import { getLocationOrigin } from '../../utils'; +import { searchParamsToUrlQuery } from './querystring'; +export function parseRelativeUrl(url, base, parseQuery = true) { + const globalBase = new URL(typeof window === 'undefined' ? 'http://n' : getLocationOrigin()); + const resolvedBase = base ? new URL(base, globalBase) : url.startsWith('.') ? new URL(typeof window === 'undefined' ? 'http://n' : window.location.href) : globalBase; + const { pathname, searchParams, search, hash, href, origin } = url.startsWith('/') ? // See https://nodejs.org/api/http.html#messageurl + // Not using `origin` to support other protocols + new URL(`${resolvedBase.protocol}//${resolvedBase.host}${url}`) : new URL(url, resolvedBase); + if (origin !== globalBase.origin) { + throw new Error(`invariant: invalid relative URL, router received ${url}`); + } + return { + auth: null, + host: null, + hostname: null, + pathname, + port: null, + protocol: null, + query: parseQuery ? searchParamsToUrlQuery(searchParams) : undefined, + search, + hash, + href: href.slice(origin.length), + // We don't know for relative URLs at this point since we set a custom, internal + // base that isn't surfaced to users. + slashes: null + }; +} + +//# sourceMappingURL=parse-relative-url.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-relative-url.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-relative-url.js.map new file mode 100644 index 0000000000000000000000000000000000000000..30689adc756c4fa318a71a44186897ebc7120def --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-relative-url.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/parse-relative-url.ts"],"sourcesContent":["import type { ParsedUrlQuery } from 'querystring'\nimport { getLocationOrigin } from '../../utils'\nimport { searchParamsToUrlQuery } from './querystring'\n\nexport interface ParsedRelativeUrl {\n auth: string | null\n hash: string\n host: string | null\n hostname: string | null\n href: string\n pathname: string\n port: string | null\n protocol: string | null\n query: ParsedUrlQuery\n search: string\n slashes: null\n}\n\n/**\n * Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative\n * (e.g. `./hello`) then at least base must be.\n * Absolute urls are rejected with one exception, in the browser, absolute urls that are on\n * the current origin will be parsed as relative\n */\nexport function parseRelativeUrl(\n url: string,\n base?: string,\n parseQuery?: true\n): ParsedRelativeUrl\nexport function parseRelativeUrl(\n url: string,\n base: string | undefined,\n parseQuery: false\n): Omit<ParsedRelativeUrl, 'query'>\nexport function parseRelativeUrl(\n url: string,\n base?: string,\n parseQuery = true\n): ParsedRelativeUrl | Omit<ParsedRelativeUrl, 'query'> {\n const globalBase = new URL(\n typeof window === 'undefined' ? 'http://n' : getLocationOrigin()\n )\n\n const resolvedBase = base\n ? new URL(base, globalBase)\n : url.startsWith('.')\n ? new URL(\n typeof window === 'undefined' ? 'http://n' : window.location.href\n )\n : globalBase\n\n const { pathname, searchParams, search, hash, href, origin } = url.startsWith(\n '/'\n )\n ? // 'http://localhost:3000///' would be received as '///' in Node.js' IncomingMessage\n // See https://nodejs.org/api/http.html#messageurl\n // Not using `origin` to support other protocols\n new URL(`${resolvedBase.protocol}//${resolvedBase.host}${url}`)\n : new URL(url, resolvedBase)\n\n if (origin !== globalBase.origin) {\n throw new Error(`invariant: invalid relative URL, router received ${url}`)\n }\n\n return {\n auth: null,\n host: null,\n hostname: null,\n pathname,\n port: null,\n protocol: null,\n query: parseQuery ? searchParamsToUrlQuery(searchParams) : undefined,\n search,\n hash,\n href: href.slice(origin.length),\n // We don't know for relative URLs at this point since we set a custom, internal\n // base that isn't surfaced to users.\n slashes: null,\n }\n}\n"],"names":["getLocationOrigin","searchParamsToUrlQuery","parseRelativeUrl","url","base","parseQuery","globalBase","URL","window","resolvedBase","startsWith","location","href","pathname","searchParams","search","hash","origin","protocol","host","Error","auth","hostname","port","query","undefined","slice","length","slashes"],"mappings":"AACA,SAASA,iBAAiB,QAAQ,cAAa;AAC/C,SAASC,sBAAsB,QAAQ,gBAAe;AAgCtD,OAAO,SAASC,iBACdC,GAAW,EACXC,IAAa,EACbC,aAAa,IAAI;IAEjB,MAAMC,aAAa,IAAIC,IACrB,OAAOC,WAAW,cAAc,aAAaR;IAG/C,MAAMS,eAAeL,OACjB,IAAIG,IAAIH,MAAME,cACdH,IAAIO,UAAU,CAAC,OACb,IAAIH,IACF,OAAOC,WAAW,cAAc,aAAaA,OAAOG,QAAQ,CAACC,IAAI,IAEnEN;IAEN,MAAM,EAAEO,QAAQ,EAAEC,YAAY,EAAEC,MAAM,EAAEC,IAAI,EAAEJ,IAAI,EAAEK,MAAM,EAAE,GAAGd,IAAIO,UAAU,CAC3E,OAGE,kDAAkD;IAClD,gDAAgD;IAChD,IAAIH,IAAI,GAAGE,aAAaS,QAAQ,CAAC,EAAE,EAAET,aAAaU,IAAI,GAAGhB,KAAK,IAC9D,IAAII,IAAIJ,KAAKM;IAEjB,IAAIQ,WAAWX,WAAWW,MAAM,EAAE;QAChC,MAAM,IAAIG,MAAM,CAAC,iDAAiD,EAAEjB,KAAK;IAC3E;IAEA,OAAO;QACLkB,MAAM;QACNF,MAAM;QACNG,UAAU;QACVT;QACAU,MAAM;QACNL,UAAU;QACVM,OAAOnB,aAAaJ,uBAAuBa,gBAAgBW;QAC3DV;QACAC;QACAJ,MAAMA,KAAKc,KAAK,CAACT,OAAOU,MAAM;QAC9B,gFAAgF;QAChF,qCAAqC;QACrCC,SAAS;IACX;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-url.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-url.js new file mode 100644 index 0000000000000000000000000000000000000000..f70cbc30f167948f1dc2c22039488a1b0e18e813 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-url.js @@ -0,0 +1,28 @@ +import { searchParamsToUrlQuery } from './querystring'; +import { parseRelativeUrl } from './parse-relative-url'; +export function parseUrl(url) { + if (url.startsWith('/')) { + return parseRelativeUrl(url); + } + const parsedURL = new URL(url); + const username = parsedURL.username; + const password = parsedURL.password; + const auth = username ? password ? `${username}:${password}` : username : null; + const pathname = parsedURL.pathname; + const search = parsedURL.search; + return { + auth, + hash: parsedURL.hash, + hostname: parsedURL.hostname, + href: parsedURL.href, + pathname, + port: parsedURL.port, + protocol: parsedURL.protocol, + query: searchParamsToUrlQuery(parsedURL.searchParams), + search, + origin: parsedURL.origin, + slashes: parsedURL.href.slice(parsedURL.protocol.length, parsedURL.protocol.length + 2) === '//' + }; +} + +//# sourceMappingURL=parse-url.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-url.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-url.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ed6f32fe793218c64b6abc8982812bfe901b657d --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/parse-url.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/parse-url.ts"],"sourcesContent":["import type { ParsedUrlQuery } from 'querystring'\n\nimport { searchParamsToUrlQuery } from './querystring'\nimport { parseRelativeUrl } from './parse-relative-url'\n\nexport interface ParsedUrl {\n auth: string | null\n hash: string\n hostname: string | null\n href: string\n origin?: string | null\n pathname: string\n port: string | null\n protocol: string | null\n query: ParsedUrlQuery\n search: string\n slashes: boolean | null\n}\n\nexport function parseUrl(url: string): ParsedUrl {\n if (url.startsWith('/')) {\n return parseRelativeUrl(url)\n }\n\n const parsedURL = new URL(url)\n const username = parsedURL.username\n const password = parsedURL.password\n const auth = username\n ? password\n ? `${username}:${password}`\n : username\n : null\n const pathname = parsedURL.pathname\n const search = parsedURL.search\n return {\n auth,\n hash: parsedURL.hash,\n hostname: parsedURL.hostname,\n href: parsedURL.href,\n pathname,\n port: parsedURL.port,\n protocol: parsedURL.protocol,\n query: searchParamsToUrlQuery(parsedURL.searchParams),\n search,\n origin: parsedURL.origin,\n slashes:\n parsedURL.href.slice(\n parsedURL.protocol.length,\n parsedURL.protocol.length + 2\n ) === '//',\n }\n}\n"],"names":["searchParamsToUrlQuery","parseRelativeUrl","parseUrl","url","startsWith","parsedURL","URL","username","password","auth","pathname","search","hash","hostname","href","port","protocol","query","searchParams","origin","slashes","slice","length"],"mappings":"AAEA,SAASA,sBAAsB,QAAQ,gBAAe;AACtD,SAASC,gBAAgB,QAAQ,uBAAsB;AAgBvD,OAAO,SAASC,SAASC,GAAW;IAClC,IAAIA,IAAIC,UAAU,CAAC,MAAM;QACvB,OAAOH,iBAAiBE;IAC1B;IAEA,MAAME,YAAY,IAAIC,IAAIH;IAC1B,MAAMI,WAAWF,UAAUE,QAAQ;IACnC,MAAMC,WAAWH,UAAUG,QAAQ;IACnC,MAAMC,OAAOF,WACTC,WACE,GAAGD,SAAS,CAAC,EAAEC,UAAU,GACzBD,WACF;IACJ,MAAMG,WAAWL,UAAUK,QAAQ;IACnC,MAAMC,SAASN,UAAUM,MAAM;IAC/B,OAAO;QACLF;QACAG,MAAMP,UAAUO,IAAI;QACpBC,UAAUR,UAAUQ,QAAQ;QAC5BC,MAAMT,UAAUS,IAAI;QACpBJ;QACAK,MAAMV,UAAUU,IAAI;QACpBC,UAAUX,UAAUW,QAAQ;QAC5BC,OAAOjB,uBAAuBK,UAAUa,YAAY;QACpDP;QACAQ,QAAQd,UAAUc,MAAM;QACxBC,SACEf,UAAUS,IAAI,CAACO,KAAK,CAClBhB,UAAUW,QAAQ,CAACM,MAAM,EACzBjB,UAAUW,QAAQ,CAACM,MAAM,GAAG,OACxB;IACV;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/path-has-prefix.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/path-has-prefix.js new file mode 100644 index 0000000000000000000000000000000000000000..4d174c11fcf589454c930e847049c7ddbe5bdb7f --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/path-has-prefix.js @@ -0,0 +1,16 @@ +import { parsePath } from './parse-path'; +/** + * Checks if a given path starts with a given prefix. It ensures it matches + * exactly without containing extra chars. e.g. prefix /docs should replace + * for /docs, /docs/, /docs/a but not /docsss + * @param path The path to check. + * @param prefix The prefix to check against. + */ export function pathHasPrefix(path, prefix) { + if (typeof path !== 'string') { + return false; + } + const { pathname } = parsePath(path); + return pathname === prefix || pathname.startsWith(prefix + '/'); +} + +//# sourceMappingURL=path-has-prefix.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/path-has-prefix.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/path-has-prefix.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6073b64593e849f0c0302ebdcf0c7318fcf9fd0b --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/path-has-prefix.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/path-has-prefix.ts"],"sourcesContent":["import { parsePath } from './parse-path'\n\n/**\n * Checks if a given path starts with a given prefix. It ensures it matches\n * exactly without containing extra chars. e.g. prefix /docs should replace\n * for /docs, /docs/, /docs/a but not /docsss\n * @param path The path to check.\n * @param prefix The prefix to check against.\n */\nexport function pathHasPrefix(path: string, prefix: string) {\n if (typeof path !== 'string') {\n return false\n }\n\n const { pathname } = parsePath(path)\n return pathname === prefix || pathname.startsWith(prefix + '/')\n}\n"],"names":["parsePath","pathHasPrefix","path","prefix","pathname","startsWith"],"mappings":"AAAA,SAASA,SAAS,QAAQ,eAAc;AAExC;;;;;;CAMC,GACD,OAAO,SAASC,cAAcC,IAAY,EAAEC,MAAc;IACxD,IAAI,OAAOD,SAAS,UAAU;QAC5B,OAAO;IACT;IAEA,MAAM,EAAEE,QAAQ,EAAE,GAAGJ,UAAUE;IAC/B,OAAOE,aAAaD,UAAUC,SAASC,UAAU,CAACF,SAAS;AAC7D","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/path-match.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/path-match.js new file mode 100644 index 0000000000000000000000000000000000000000..2fa9830810a7521816146849de03cf752280a832 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/path-match.js @@ -0,0 +1,44 @@ +import { regexpToFunction } from 'next/dist/compiled/path-to-regexp'; +import { pathToRegexp } from 'next/dist/compiled/path-to-regexp'; +/** + * Generates a path matcher function for a given path and options based on + * path-to-regexp. By default the match will be case insensitive, non strict + * and delimited by `/`. + */ export function getPathMatch(path, options) { + const keys = []; + const regexp = pathToRegexp(path, keys, { + delimiter: '/', + sensitive: typeof options?.sensitive === 'boolean' ? options.sensitive : false, + strict: options?.strict + }); + const matcher = regexpToFunction(options?.regexModifier ? new RegExp(options.regexModifier(regexp.source), regexp.flags) : regexp, keys); + /** + * A matcher function that will check if a given pathname matches the path + * given in the builder function. When the path does not match it will return + * `false` but if it does it will return an object with the matched params + * merged with the params provided in the second argument. + */ return (pathname, params)=>{ + // If no pathname is provided it's not a match. + if (typeof pathname !== 'string') return false; + const match = matcher(pathname); + // If the path did not match `false` will be returned. + if (!match) return false; + /** + * If unnamed params are not allowed they must be removed from + * the matched parameters. path-to-regexp uses "string" for named and + * "number" for unnamed parameters. + */ if (options?.removeUnnamedParams) { + for (const key of keys){ + if (typeof key.name === 'number') { + delete match.params[key.name]; + } + } + } + return { + ...params, + ...match.params + }; + }; +} + +//# sourceMappingURL=path-match.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/path-match.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/path-match.js.map new file mode 100644 index 0000000000000000000000000000000000000000..64e512667d9684760d715fcd77c0ee48a31f71eb --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/path-match.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/path-match.ts"],"sourcesContent":["import type { Key } from 'next/dist/compiled/path-to-regexp'\nimport { regexpToFunction } from 'next/dist/compiled/path-to-regexp'\nimport { pathToRegexp } from 'next/dist/compiled/path-to-regexp'\n\ninterface Options {\n /**\n * A transformer function that will be applied to the regexp generated\n * from the provided path and path-to-regexp.\n */\n regexModifier?: (regex: string) => string\n /**\n * When true the function will remove all unnamed parameters\n * from the matched parameters.\n */\n removeUnnamedParams?: boolean\n /**\n * When true the regexp won't allow an optional trailing delimiter\n * to match.\n */\n strict?: boolean\n\n /**\n * When true the matcher will be case-sensitive, defaults to false\n */\n sensitive?: boolean\n}\n\nexport type PatchMatcher = (\n pathname: string,\n params?: Record<string, any>\n) => Record<string, any> | false\n\n/**\n * Generates a path matcher function for a given path and options based on\n * path-to-regexp. By default the match will be case insensitive, non strict\n * and delimited by `/`.\n */\nexport function getPathMatch(path: string, options?: Options): PatchMatcher {\n const keys: Key[] = []\n const regexp = pathToRegexp(path, keys, {\n delimiter: '/',\n sensitive:\n typeof options?.sensitive === 'boolean' ? options.sensitive : false,\n strict: options?.strict,\n })\n\n const matcher = regexpToFunction<Record<string, any>>(\n options?.regexModifier\n ? new RegExp(options.regexModifier(regexp.source), regexp.flags)\n : regexp,\n keys\n )\n\n /**\n * A matcher function that will check if a given pathname matches the path\n * given in the builder function. When the path does not match it will return\n * `false` but if it does it will return an object with the matched params\n * merged with the params provided in the second argument.\n */\n return (pathname, params) => {\n // If no pathname is provided it's not a match.\n if (typeof pathname !== 'string') return false\n\n const match = matcher(pathname)\n\n // If the path did not match `false` will be returned.\n if (!match) return false\n\n /**\n * If unnamed params are not allowed they must be removed from\n * the matched parameters. path-to-regexp uses \"string\" for named and\n * \"number\" for unnamed parameters.\n */\n if (options?.removeUnnamedParams) {\n for (const key of keys) {\n if (typeof key.name === 'number') {\n delete match.params[key.name]\n }\n }\n }\n\n return { ...params, ...match.params }\n }\n}\n"],"names":["regexpToFunction","pathToRegexp","getPathMatch","path","options","keys","regexp","delimiter","sensitive","strict","matcher","regexModifier","RegExp","source","flags","pathname","params","match","removeUnnamedParams","key","name"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,oCAAmC;AACpE,SAASC,YAAY,QAAQ,oCAAmC;AA8BhE;;;;CAIC,GACD,OAAO,SAASC,aAAaC,IAAY,EAAEC,OAAiB;IAC1D,MAAMC,OAAc,EAAE;IACtB,MAAMC,SAASL,aAAaE,MAAME,MAAM;QACtCE,WAAW;QACXC,WACE,OAAOJ,SAASI,cAAc,YAAYJ,QAAQI,SAAS,GAAG;QAChEC,QAAQL,SAASK;IACnB;IAEA,MAAMC,UAAUV,iBACdI,SAASO,gBACL,IAAIC,OAAOR,QAAQO,aAAa,CAACL,OAAOO,MAAM,GAAGP,OAAOQ,KAAK,IAC7DR,QACJD;IAGF;;;;;GAKC,GACD,OAAO,CAACU,UAAUC;QAChB,+CAA+C;QAC/C,IAAI,OAAOD,aAAa,UAAU,OAAO;QAEzC,MAAME,QAAQP,QAAQK;QAEtB,sDAAsD;QACtD,IAAI,CAACE,OAAO,OAAO;QAEnB;;;;KAIC,GACD,IAAIb,SAASc,qBAAqB;YAChC,KAAK,MAAMC,OAAOd,KAAM;gBACtB,IAAI,OAAOc,IAAIC,IAAI,KAAK,UAAU;oBAChC,OAAOH,MAAMD,MAAM,CAACG,IAAIC,IAAI,CAAC;gBAC/B;YACF;QACF;QAEA,OAAO;YAAE,GAAGJ,MAAM;YAAE,GAAGC,MAAMD,MAAM;QAAC;IACtC;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/prepare-destination.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/prepare-destination.js new file mode 100644 index 0000000000000000000000000000000000000000..cf886a7b74f75df1654c5491d991c8884bafdc8f --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/prepare-destination.js @@ -0,0 +1,259 @@ +import { escapeStringRegexp } from '../../escape-regexp'; +import { parseUrl } from './parse-url'; +import { INTERCEPTION_ROUTE_MARKERS, isInterceptionRouteAppPath } from './interception-routes'; +import { getCookieParser } from '../../../../server/api-utils/get-cookie-parser'; +import { safePathToRegexp, safeCompile } from './route-match-utils'; +/** + * Ensure only a-zA-Z are used for param names for proper interpolating + * with path-to-regexp + */ function getSafeParamName(paramName) { + let newParamName = ''; + for(let i = 0; i < paramName.length; i++){ + const charCode = paramName.charCodeAt(i); + if (charCode > 64 && charCode < 91 || // A-Z + charCode > 96 && charCode < 123 // a-z + ) { + newParamName += paramName[i]; + } + } + return newParamName; +} +function escapeSegment(str, segmentName) { + return str.replace(new RegExp(`:${escapeStringRegexp(segmentName)}`, 'g'), `__ESC_COLON_${segmentName}`); +} +function unescapeSegments(str) { + return str.replace(/__ESC_COLON_/gi, ':'); +} +export function matchHas(req, query, has = [], missing = []) { + const params = {}; + const hasMatch = (hasItem)=>{ + let value; + let key = hasItem.key; + switch(hasItem.type){ + case 'header': + { + key = key.toLowerCase(); + value = req.headers[key]; + break; + } + case 'cookie': + { + if ('cookies' in req) { + value = req.cookies[hasItem.key]; + } else { + const cookies = getCookieParser(req.headers)(); + value = cookies[hasItem.key]; + } + break; + } + case 'query': + { + value = query[key]; + break; + } + case 'host': + { + const { host } = req?.headers || {}; + // remove port from host if present + const hostname = host?.split(':', 1)[0].toLowerCase(); + value = hostname; + break; + } + default: + { + break; + } + } + if (!hasItem.value && value) { + params[getSafeParamName(key)] = value; + return true; + } else if (value) { + const matcher = new RegExp(`^${hasItem.value}$`); + const matches = Array.isArray(value) ? value.slice(-1)[0].match(matcher) : value.match(matcher); + if (matches) { + if (Array.isArray(matches)) { + if (matches.groups) { + Object.keys(matches.groups).forEach((groupKey)=>{ + params[groupKey] = matches.groups[groupKey]; + }); + } else if (hasItem.type === 'host' && matches[0]) { + params.host = matches[0]; + } + } + return true; + } + } + return false; + }; + const allMatch = has.every((item)=>hasMatch(item)) && !missing.some((item)=>hasMatch(item)); + if (allMatch) { + return params; + } + return false; +} +export function compileNonPath(value, params) { + if (!value.includes(':')) { + return value; + } + for (const key of Object.keys(params)){ + if (value.includes(`:${key}`)) { + value = value.replace(new RegExp(`:${key}\\*`, 'g'), `:${key}--ESCAPED_PARAM_ASTERISKS`).replace(new RegExp(`:${key}\\?`, 'g'), `:${key}--ESCAPED_PARAM_QUESTION`).replace(new RegExp(`:${key}\\+`, 'g'), `:${key}--ESCAPED_PARAM_PLUS`).replace(new RegExp(`:${key}(?!\\w)`, 'g'), `--ESCAPED_PARAM_COLON${key}`); + } + } + value = value.replace(/(:|\*|\?|\+|\(|\)|\{|\})/g, '\\$1').replace(/--ESCAPED_PARAM_PLUS/g, '+').replace(/--ESCAPED_PARAM_COLON/g, ':').replace(/--ESCAPED_PARAM_QUESTION/g, '?').replace(/--ESCAPED_PARAM_ASTERISKS/g, '*'); + // the value needs to start with a forward-slash to be compiled + // correctly + return safeCompile(`/${value}`, { + validate: false + })(params).slice(1); +} +export function parseDestination(args) { + let escaped = args.destination; + for (const param of Object.keys({ + ...args.params, + ...args.query + })){ + if (!param) continue; + escaped = escapeSegment(escaped, param); + } + const parsed = parseUrl(escaped); + let pathname = parsed.pathname; + if (pathname) { + pathname = unescapeSegments(pathname); + } + let href = parsed.href; + if (href) { + href = unescapeSegments(href); + } + let hostname = parsed.hostname; + if (hostname) { + hostname = unescapeSegments(hostname); + } + let hash = parsed.hash; + if (hash) { + hash = unescapeSegments(hash); + } + let search = parsed.search; + if (search) { + search = unescapeSegments(search); + } + let origin = parsed.origin; + if (origin) { + origin = unescapeSegments(origin); + } + return { + ...parsed, + pathname, + hostname, + href, + hash, + search, + origin + }; +} +export function prepareDestination(args) { + const parsedDestination = parseDestination(args); + const { hostname: destHostname, query: destQuery, search: destSearch } = parsedDestination; + // The following code assumes that the pathname here includes the hash if it's + // present. + let destPath = parsedDestination.pathname; + if (parsedDestination.hash) { + destPath = `${destPath}${parsedDestination.hash}`; + } + const destParams = []; + const destPathParamKeys = []; + safePathToRegexp(destPath, destPathParamKeys); + for (const key of destPathParamKeys){ + destParams.push(key.name); + } + if (destHostname) { + const destHostnameParamKeys = []; + safePathToRegexp(destHostname, destHostnameParamKeys); + for (const key of destHostnameParamKeys){ + destParams.push(key.name); + } + } + const destPathCompiler = safeCompile(destPath, // we don't validate while compiling the destination since we should + // have already validated before we got to this point and validating + // breaks compiling destinations with named pattern params from the source + // e.g. /something:hello(.*) -> /another/:hello is broken with validation + // since compile validation is meant for reversing and not for inserting + // params from a separate path-regex into another + { + validate: false + }); + let destHostnameCompiler; + if (destHostname) { + destHostnameCompiler = safeCompile(destHostname, { + validate: false, + encode: encodeURIComponent + }); + } + // update any params in query values + for (const [key, strOrArray] of Object.entries(destQuery)){ + // the value needs to start with a forward-slash to be compiled + // correctly + if (Array.isArray(strOrArray)) { + destQuery[key] = strOrArray.map((value)=>compileNonPath(unescapeSegments(value), args.params)); + } else if (typeof strOrArray === 'string') { + destQuery[key] = compileNonPath(unescapeSegments(strOrArray), args.params); + } + } + // add path params to query if it's not a redirect and not + // already defined in destination query or path + let paramKeys = Object.keys(args.params).filter((name)=>name !== 'nextInternalLocale'); + if (args.appendParamsToQuery && !paramKeys.some((key)=>destParams.includes(key))) { + for (const key of paramKeys){ + if (!(key in destQuery)) { + destQuery[key] = args.params[key]; + } + } + } + let newUrl; + // The compiler also that the interception route marker is an unnamed param, hence '0', + // so we need to add it to the params object. + if (isInterceptionRouteAppPath(destPath)) { + for (const segment of destPath.split('/')){ + const marker = INTERCEPTION_ROUTE_MARKERS.find((m)=>segment.startsWith(m)); + if (marker) { + if (marker === '(..)(..)') { + args.params['0'] = '(..)'; + args.params['1'] = '(..)'; + } else { + args.params['0'] = marker; + } + break; + } + } + } + try { + newUrl = destPathCompiler(args.params); + const [pathname, hash] = newUrl.split('#', 2); + if (destHostnameCompiler) { + parsedDestination.hostname = destHostnameCompiler(args.params); + } + parsedDestination.pathname = pathname; + parsedDestination.hash = `${hash ? '#' : ''}${hash || ''}`; + parsedDestination.search = destSearch ? compileNonPath(destSearch, args.params) : ''; + } catch (err) { + if (err.message.match(/Expected .*? to not repeat, but got an array/)) { + throw new Error(`To use a multi-match in the destination you must add \`*\` at the end of the param name to signify it should repeat. https://nextjs.org/docs/messages/invalid-multi-match`); + } + throw err; + } + // Query merge order lowest priority to highest + // 1. initial URL query values + // 2. path segment values + // 3. destination specified query values + parsedDestination.query = { + ...args.query, + ...parsedDestination.query + }; + return { + newUrl, + destQuery, + parsedDestination + }; +} + +//# sourceMappingURL=prepare-destination.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/prepare-destination.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/prepare-destination.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a2d864adbff6b5bf707a00bf4d252c67ef13f144 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/prepare-destination.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/prepare-destination.ts"],"sourcesContent":["import type { IncomingMessage } from 'http'\nimport type { Key } from 'next/dist/compiled/path-to-regexp'\nimport type { NextParsedUrlQuery } from '../../../../server/request-meta'\nimport type { RouteHas } from '../../../../lib/load-custom-routes'\nimport type { BaseNextRequest } from '../../../../server/base-http'\n\nimport { escapeStringRegexp } from '../../escape-regexp'\nimport { parseUrl, type ParsedUrl } from './parse-url'\nimport {\n INTERCEPTION_ROUTE_MARKERS,\n isInterceptionRouteAppPath,\n} from './interception-routes'\nimport { getCookieParser } from '../../../../server/api-utils/get-cookie-parser'\nimport type { Params } from '../../../../server/request/params'\nimport { safePathToRegexp, safeCompile } from './route-match-utils'\n\n/**\n * Ensure only a-zA-Z are used for param names for proper interpolating\n * with path-to-regexp\n */\nfunction getSafeParamName(paramName: string) {\n let newParamName = ''\n\n for (let i = 0; i < paramName.length; i++) {\n const charCode = paramName.charCodeAt(i)\n\n if (\n (charCode > 64 && charCode < 91) || // A-Z\n (charCode > 96 && charCode < 123) // a-z\n ) {\n newParamName += paramName[i]\n }\n }\n return newParamName\n}\n\nfunction escapeSegment(str: string, segmentName: string) {\n return str.replace(\n new RegExp(`:${escapeStringRegexp(segmentName)}`, 'g'),\n `__ESC_COLON_${segmentName}`\n )\n}\n\nfunction unescapeSegments(str: string) {\n return str.replace(/__ESC_COLON_/gi, ':')\n}\n\nexport function matchHas(\n req: BaseNextRequest | IncomingMessage,\n query: Params,\n has: RouteHas[] = [],\n missing: RouteHas[] = []\n): false | Params {\n const params: Params = {}\n\n const hasMatch = (hasItem: RouteHas) => {\n let value\n let key = hasItem.key\n\n switch (hasItem.type) {\n case 'header': {\n key = key!.toLowerCase()\n value = req.headers[key] as string\n break\n }\n case 'cookie': {\n if ('cookies' in req) {\n value = req.cookies[hasItem.key]\n } else {\n const cookies = getCookieParser(req.headers)()\n value = cookies[hasItem.key]\n }\n\n break\n }\n case 'query': {\n value = query[key!]\n break\n }\n case 'host': {\n const { host } = req?.headers || {}\n // remove port from host if present\n const hostname = host?.split(':', 1)[0].toLowerCase()\n value = hostname\n break\n }\n default: {\n break\n }\n }\n\n if (!hasItem.value && value) {\n params[getSafeParamName(key!)] = value\n return true\n } else if (value) {\n const matcher = new RegExp(`^${hasItem.value}$`)\n const matches = Array.isArray(value)\n ? value.slice(-1)[0].match(matcher)\n : value.match(matcher)\n\n if (matches) {\n if (Array.isArray(matches)) {\n if (matches.groups) {\n Object.keys(matches.groups).forEach((groupKey) => {\n params[groupKey] = matches.groups![groupKey]\n })\n } else if (hasItem.type === 'host' && matches[0]) {\n params.host = matches[0]\n }\n }\n return true\n }\n }\n return false\n }\n\n const allMatch =\n has.every((item) => hasMatch(item)) &&\n !missing.some((item) => hasMatch(item))\n\n if (allMatch) {\n return params\n }\n return false\n}\n\nexport function compileNonPath(value: string, params: Params): string {\n if (!value.includes(':')) {\n return value\n }\n\n for (const key of Object.keys(params)) {\n if (value.includes(`:${key}`)) {\n value = value\n .replace(\n new RegExp(`:${key}\\\\*`, 'g'),\n `:${key}--ESCAPED_PARAM_ASTERISKS`\n )\n .replace(\n new RegExp(`:${key}\\\\?`, 'g'),\n `:${key}--ESCAPED_PARAM_QUESTION`\n )\n .replace(new RegExp(`:${key}\\\\+`, 'g'), `:${key}--ESCAPED_PARAM_PLUS`)\n .replace(\n new RegExp(`:${key}(?!\\\\w)`, 'g'),\n `--ESCAPED_PARAM_COLON${key}`\n )\n }\n }\n value = value\n .replace(/(:|\\*|\\?|\\+|\\(|\\)|\\{|\\})/g, '\\\\$1')\n .replace(/--ESCAPED_PARAM_PLUS/g, '+')\n .replace(/--ESCAPED_PARAM_COLON/g, ':')\n .replace(/--ESCAPED_PARAM_QUESTION/g, '?')\n .replace(/--ESCAPED_PARAM_ASTERISKS/g, '*')\n\n // the value needs to start with a forward-slash to be compiled\n // correctly\n return safeCompile(`/${value}`, { validate: false })(params).slice(1)\n}\n\nexport function parseDestination(args: {\n destination: string\n params: Readonly<Params>\n query: Readonly<NextParsedUrlQuery>\n}): ParsedUrl {\n let escaped = args.destination\n for (const param of Object.keys({ ...args.params, ...args.query })) {\n if (!param) continue\n\n escaped = escapeSegment(escaped, param)\n }\n\n const parsed = parseUrl(escaped)\n\n let pathname = parsed.pathname\n if (pathname) {\n pathname = unescapeSegments(pathname)\n }\n\n let href = parsed.href\n if (href) {\n href = unescapeSegments(href)\n }\n\n let hostname = parsed.hostname\n if (hostname) {\n hostname = unescapeSegments(hostname)\n }\n\n let hash = parsed.hash\n if (hash) {\n hash = unescapeSegments(hash)\n }\n\n let search = parsed.search\n if (search) {\n search = unescapeSegments(search)\n }\n\n let origin = parsed.origin\n if (origin) {\n origin = unescapeSegments(origin)\n }\n\n return {\n ...parsed,\n pathname,\n hostname,\n href,\n hash,\n search,\n origin,\n }\n}\n\nexport function prepareDestination(args: {\n appendParamsToQuery: boolean\n destination: string\n params: Params\n query: NextParsedUrlQuery\n}) {\n const parsedDestination = parseDestination(args)\n\n const {\n hostname: destHostname,\n query: destQuery,\n search: destSearch,\n } = parsedDestination\n\n // The following code assumes that the pathname here includes the hash if it's\n // present.\n let destPath = parsedDestination.pathname\n if (parsedDestination.hash) {\n destPath = `${destPath}${parsedDestination.hash}`\n }\n\n const destParams: (string | number)[] = []\n\n const destPathParamKeys: Key[] = []\n safePathToRegexp(destPath, destPathParamKeys)\n for (const key of destPathParamKeys) {\n destParams.push(key.name)\n }\n\n if (destHostname) {\n const destHostnameParamKeys: Key[] = []\n safePathToRegexp(destHostname, destHostnameParamKeys)\n for (const key of destHostnameParamKeys) {\n destParams.push(key.name)\n }\n }\n\n const destPathCompiler = safeCompile(\n destPath,\n // we don't validate while compiling the destination since we should\n // have already validated before we got to this point and validating\n // breaks compiling destinations with named pattern params from the source\n // e.g. /something:hello(.*) -> /another/:hello is broken with validation\n // since compile validation is meant for reversing and not for inserting\n // params from a separate path-regex into another\n { validate: false }\n )\n\n let destHostnameCompiler\n if (destHostname) {\n destHostnameCompiler = safeCompile(destHostname, {\n validate: false,\n encode: encodeURIComponent,\n })\n }\n\n // update any params in query values\n for (const [key, strOrArray] of Object.entries(destQuery)) {\n // the value needs to start with a forward-slash to be compiled\n // correctly\n if (Array.isArray(strOrArray)) {\n destQuery[key] = strOrArray.map((value) =>\n compileNonPath(unescapeSegments(value), args.params)\n )\n } else if (typeof strOrArray === 'string') {\n destQuery[key] = compileNonPath(unescapeSegments(strOrArray), args.params)\n }\n }\n\n // add path params to query if it's not a redirect and not\n // already defined in destination query or path\n let paramKeys = Object.keys(args.params).filter(\n (name) => name !== 'nextInternalLocale'\n )\n\n if (\n args.appendParamsToQuery &&\n !paramKeys.some((key) => destParams.includes(key))\n ) {\n for (const key of paramKeys) {\n if (!(key in destQuery)) {\n destQuery[key] = args.params[key]\n }\n }\n }\n\n let newUrl\n\n // The compiler also that the interception route marker is an unnamed param, hence '0',\n // so we need to add it to the params object.\n if (isInterceptionRouteAppPath(destPath)) {\n for (const segment of destPath.split('/')) {\n const marker = INTERCEPTION_ROUTE_MARKERS.find((m) =>\n segment.startsWith(m)\n )\n if (marker) {\n if (marker === '(..)(..)') {\n args.params['0'] = '(..)'\n args.params['1'] = '(..)'\n } else {\n args.params['0'] = marker\n }\n break\n }\n }\n }\n\n try {\n newUrl = destPathCompiler(args.params)\n\n const [pathname, hash] = newUrl.split('#', 2)\n if (destHostnameCompiler) {\n parsedDestination.hostname = destHostnameCompiler(args.params)\n }\n parsedDestination.pathname = pathname\n parsedDestination.hash = `${hash ? '#' : ''}${hash || ''}`\n parsedDestination.search = destSearch\n ? compileNonPath(destSearch, args.params)\n : ''\n } catch (err: any) {\n if (err.message.match(/Expected .*? to not repeat, but got an array/)) {\n throw new Error(\n `To use a multi-match in the destination you must add \\`*\\` at the end of the param name to signify it should repeat. https://nextjs.org/docs/messages/invalid-multi-match`\n )\n }\n throw err\n }\n\n // Query merge order lowest priority to highest\n // 1. initial URL query values\n // 2. path segment values\n // 3. destination specified query values\n parsedDestination.query = {\n ...args.query,\n ...parsedDestination.query,\n }\n\n return {\n newUrl,\n destQuery,\n parsedDestination,\n }\n}\n"],"names":["escapeStringRegexp","parseUrl","INTERCEPTION_ROUTE_MARKERS","isInterceptionRouteAppPath","getCookieParser","safePathToRegexp","safeCompile","getSafeParamName","paramName","newParamName","i","length","charCode","charCodeAt","escapeSegment","str","segmentName","replace","RegExp","unescapeSegments","matchHas","req","query","has","missing","params","hasMatch","hasItem","value","key","type","toLowerCase","headers","cookies","host","hostname","split","matcher","matches","Array","isArray","slice","match","groups","Object","keys","forEach","groupKey","allMatch","every","item","some","compileNonPath","includes","validate","parseDestination","args","escaped","destination","param","parsed","pathname","href","hash","search","origin","prepareDestination","parsedDestination","destHostname","destQuery","destSearch","destPath","destParams","destPathParamKeys","push","name","destHostnameParamKeys","destPathCompiler","destHostnameCompiler","encode","encodeURIComponent","strOrArray","entries","map","paramKeys","filter","appendParamsToQuery","newUrl","segment","marker","find","m","startsWith","err","message","Error"],"mappings":"AAMA,SAASA,kBAAkB,QAAQ,sBAAqB;AACxD,SAASC,QAAQ,QAAwB,cAAa;AACtD,SACEC,0BAA0B,EAC1BC,0BAA0B,QACrB,wBAAuB;AAC9B,SAASC,eAAe,QAAQ,iDAAgD;AAEhF,SAASC,gBAAgB,EAAEC,WAAW,QAAQ,sBAAqB;AAEnE;;;CAGC,GACD,SAASC,iBAAiBC,SAAiB;IACzC,IAAIC,eAAe;IAEnB,IAAK,IAAIC,IAAI,GAAGA,IAAIF,UAAUG,MAAM,EAAED,IAAK;QACzC,MAAME,WAAWJ,UAAUK,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rB;gBACA;YACF;QACF;IACF;IAEA,IAAI;QACFF,SAASV,iBAAiBrB,KAAK/B,MAAM;QAErC,MAAM,CAACoC,UAAUE,KAAK,GAAGwB,OAAOnD,KAAK,CAAC,KAAK;QAC3C,IAAI0C,sBAAsB;YACxBX,kBAAkBhC,QAAQ,GAAG2C,qBAAqBtB,KAAK/B,MAAM;QAC/D;QACA0C,kBAAkBN,QAAQ,GAAGA;QAC7BM,kBAAkBJ,IAAI,GAAG,GAAGA,OAAO,MAAM,KAAKA,QAAQ,IAAI;QAC1DI,kBAAkBH,MAAM,GAAGM,aACvBlB,eAAekB,YAAYd,KAAK/B,MAAM,IACtC;IACN,EAAE,OAAOoE,KAAU;QACjB,IAAIA,IAAIC,OAAO,CAACpD,KAAK,CAAC,iDAAiD;YACrE,MAAM,IAAIqD,MACR,CAAC,yKAAyK,CAAC;QAE/K;QACA,MAAMF;IACR;IAEA,+CAA+C;IAC/C,8BAA8B;IAC9B,yBAAyB;IACzB,wCAAwC;IACxC1B,kBAAkB7C,KAAK,GAAG;QACxB,GAAGkC,KAAKlC,KAAK;QACb,GAAG6C,kBAAkB7C,KAAK;IAC5B;IAEA,OAAO;QACLiE;QACAlB;QACAF;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/querystring.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/querystring.js new file mode 100644 index 0000000000000000000000000000000000000000..8c8f19c74e1da4498d01b9ecac4620ea36f8c2f1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/querystring.js @@ -0,0 +1,80 @@ +export function getRenderedSearch(query) { + // Inlined implementation of querystring.encode, which is not available in + // the Edge runtime. + const pairs = []; + for(const key in query){ + const value = query[key]; + if (value == null) continue; + if (Array.isArray(value)) { + for (const v of value){ + pairs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(v))}`); + } + } else { + pairs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`); + } + } + // The result should match the format of a web URL's `search` property, since + // this is the format that's stored in the App Router state. + // TODO: We're a bit inconsistent about this. The x-nextjs-rewritten-query + // header omits the leading question mark. Should refactor to always do + // that instead. + if (pairs.length === 0) { + // If the search string is empty, return an empty string. + return ''; + } + // Prepend '?' to the search params string. + return '?' + pairs.join('&'); +} +export function searchParamsToUrlQuery(searchParams) { + const query = {}; + for (const [key, value] of searchParams.entries()){ + const existing = query[key]; + if (typeof existing === 'undefined') { + query[key] = value; + } else if (Array.isArray(existing)) { + existing.push(value); + } else { + query[key] = [ + existing, + value + ]; + } + } + return query; +} +function stringifyUrlQueryParam(param) { + if (typeof param === 'string') { + return param; + } + if (typeof param === 'number' && !isNaN(param) || typeof param === 'boolean') { + return String(param); + } else { + return ''; + } +} +export function urlQueryToSearchParams(query) { + const searchParams = new URLSearchParams(); + for (const [key, value] of Object.entries(query)){ + if (Array.isArray(value)) { + for (const item of value){ + searchParams.append(key, stringifyUrlQueryParam(item)); + } + } else { + searchParams.set(key, stringifyUrlQueryParam(value)); + } + } + return searchParams; +} +export function assign(target, ...searchParamsList) { + for (const searchParams of searchParamsList){ + for (const key of searchParams.keys()){ + target.delete(key); + } + for (const [key, value] of searchParams.entries()){ + target.append(key, value); + } + } + return target; +} + +//# sourceMappingURL=querystring.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/querystring.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/querystring.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ea454077307e03753980d24a8008a16679b8eca7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/querystring.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/querystring.ts"],"sourcesContent":["import type { ParsedUrlQuery } from 'querystring'\n\nexport function getRenderedSearch(query: ParsedUrlQuery): string {\n // Inlined implementation of querystring.encode, which is not available in\n // the Edge runtime.\n const pairs = []\n for (const key in query) {\n const value = query[key]\n if (value == null) continue\n if (Array.isArray(value)) {\n for (const v of value) {\n pairs.push(\n `${encodeURIComponent(key)}=${encodeURIComponent(String(v))}`\n )\n }\n } else {\n pairs.push(\n `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`\n )\n }\n }\n\n // The result should match the format of a web URL's `search` property, since\n // this is the format that's stored in the App Router state.\n // TODO: We're a bit inconsistent about this. The x-nextjs-rewritten-query\n // header omits the leading question mark. Should refactor to always do\n // that instead.\n if (pairs.length === 0) {\n // If the search string is empty, return an empty string.\n return ''\n }\n // Prepend '?' to the search params string.\n return '?' + pairs.join('&')\n}\n\nexport function searchParamsToUrlQuery(\n searchParams: URLSearchParams\n): ParsedUrlQuery {\n const query: ParsedUrlQuery = {}\n for (const [key, value] of searchParams.entries()) {\n const existing = query[key]\n if (typeof existing === 'undefined') {\n query[key] = value\n } else if (Array.isArray(existing)) {\n existing.push(value)\n } else {\n query[key] = [existing, value]\n }\n }\n return query\n}\n\nfunction stringifyUrlQueryParam(param: unknown): string {\n if (typeof param === 'string') {\n return param\n }\n\n if (\n (typeof param === 'number' && !isNaN(param)) ||\n typeof param === 'boolean'\n ) {\n return String(param)\n } else {\n return ''\n }\n}\n\nexport function urlQueryToSearchParams(query: ParsedUrlQuery): URLSearchParams {\n const searchParams = new URLSearchParams()\n for (const [key, value] of Object.entries(query)) {\n if (Array.isArray(value)) {\n for (const item of value) {\n searchParams.append(key, stringifyUrlQueryParam(item))\n }\n } else {\n searchParams.set(key, stringifyUrlQueryParam(value))\n }\n }\n return searchParams\n}\n\nexport function assign(\n target: URLSearchParams,\n ...searchParamsList: URLSearchParams[]\n): URLSearchParams {\n for (const searchParams of searchParamsList) {\n for (const key of searchParams.keys()) {\n target.delete(key)\n }\n\n for (const [key, value] of searchParams.entries()) {\n target.append(key, value)\n }\n }\n\n return target\n}\n"],"names":["getRenderedSearch","query","pairs","key","value","Array","isArray","v","push","encodeURIComponent","String","length","join","searchParamsToUrlQuery","searchParams","entries","existing","stringifyUrlQueryParam","param","isNaN","urlQueryToSearchParams","URLSearchParams","Object","item","append","set","assign","target","searchParamsList","keys","delete"],"mappings":"AAEA,OAAO,SAASA,kBAAkBC,KAAqB;IACrD,0EAA0E;IAC1E,oBAAoB;IACpB,MAAMC,QAAQ,EAAE;IAChB,IAAK,MAAMC,OAAOF,MAAO;QACvB,MAAMG,QAAQH,KAAK,CAACE,IAAI;QACxB,IAAIC,SAAS,MAAM;QACnB,IAAIC,MAAMC,OAAO,CAACF,QAAQ;YACxB,KAAK,MAAMG,KAAKH,MAAO;gBACrBF,MAAMM,IAAI,CACR,GAAGC,mBAAmBN,KAAK,CAAC,EAAEM,mBAAmBC,OAAOH,KAAK;YAEjE;QACF,OAAO;YACLL,MAAMM,IAAI,CACR,GAAGC,mBAAmBN,KAAK,CAAC,EAAEM,mBAAmBC,OAAON,SAAS;QAErE;IACF;IAEA,6EAA6E;IAC7E,4DAA4D;IAC5D,0EAA0E;IAC1E,uEAAuE;IACvE,gBAAgB;IAChB,IAAIF,MAAMS,MAAM,KAAK,GAAG;QACtB,yDAAyD;QACzD,OAAO;IACT;IACA,2CAA2C;IAC3C,OAAO,MAAMT,MAAMU,IAAI,CAAC;AAC1B;AAEA,OAAO,SAASC,uBACdC,YAA6B;IAE7B,MAAMb,QAAwB,CAAC;IAC/B,KAAK,MAAM,CAACE,KAAKC,MAAM,IAAIU,aAAaC,OAAO,GAAI;QACjD,MAAMC,WAAWf,KAAK,CAACE,IAAI;QAC3B,IAAI,OAAOa,aAAa,aAAa;YACnCf,KAAK,CAACE,IAAI,GAAGC;QACf,OAAO,IAAIC,MAAMC,OAAO,CAACU,WAAW;YAClCA,SAASR,IAAI,CAACJ;QAChB,OAAO;YACLH,KAAK,CAACE,IAAI,GAAG;gBAACa;gBAAUZ;aAAM;QAChC;IACF;IACA,OAAOH;AACT;AAEA,SAASgB,uBAAuBC,KAAc;IAC5C,IAAI,OAAOA,UAAU,UAAU;QAC7B,OAAOA;IACT;IAEA,IACE,AAAC,OAAOA,UAAU,YAAY,CAACC,MAAMD,UACrC,OAAOA,UAAU,WACjB;QACA,OAAOR,OAAOQ;IAChB,OAAO;QACL,OAAO;IACT;AACF;AAEA,OAAO,SAASE,uBAAuBnB,KAAqB;IAC1D,MAAMa,eAAe,IAAIO;IACzB,KAAK,MAAM,CAAClB,KAAKC,MAAM,IAAIkB,OAAOP,OAAO,CAACd,OAAQ;QAChD,IAAII,MAAMC,OAAO,CAACF,QAAQ;YACxB,KAAK,MAAMmB,QAAQnB,MAAO;gBACxBU,aAAaU,MAAM,CAACrB,KAAKc,uBAAuBM;YAClD;QACF,OAAO;YACLT,aAAaW,GAAG,CAACtB,KAAKc,uBAAuBb;QAC/C;IACF;IACA,OAAOU;AACT;AAEA,OAAO,SAASY,OACdC,MAAuB,EACvB,GAAGC,gBAAmC;IAEtC,KAAK,MAAMd,gBAAgBc,iBAAkB;QAC3C,KAAK,MAAMzB,OAAOW,aAAae,IAAI,GAAI;YACrCF,OAAOG,MAAM,CAAC3B;QAChB;QAEA,KAAK,MAAM,CAACA,KAAKC,MAAM,IAAIU,aAAaC,OAAO,GAAI;YACjDY,OAAOH,MAAM,CAACrB,KAAKC;QACrB;IACF;IAEA,OAAOuB;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/relativize-url.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/relativize-url.js new file mode 100644 index 0000000000000000000000000000000000000000..024626c45e1633d87e726bbc14b2f9ce8996bafd --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/relativize-url.js @@ -0,0 +1,22 @@ +/** + * The result of parsing a URL relative to a base URL. + */ export function parseRelativeURL(url, base) { + const baseURL = typeof base === 'string' ? new URL(base) : base; + const relative = new URL(url, base); + // The URL is relative if the origin is the same as the base URL. + const isRelative = relative.origin === baseURL.origin; + return { + url: isRelative ? relative.toString().slice(baseURL.origin.length) : relative.toString(), + isRelative + }; +} +/** + * Given a URL as a string and a base URL it will make the URL relative + * if the parsed protocol and host is the same as the one in the base + * URL. Otherwise it returns the same URL string. + */ export function getRelativeURL(url, base) { + const relative = parseRelativeURL(url, base); + return relative.url; +} + +//# sourceMappingURL=relativize-url.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/relativize-url.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/relativize-url.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0ce00c90890c79bc89defcd06e276b1be35fc6b6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/relativize-url.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/relativize-url.ts"],"sourcesContent":["/**\n * The result of parsing a URL relative to a base URL.\n */\nexport type RelativeURL = {\n /**\n * The relative URL. Either a URL including the origin or a relative URL.\n */\n url: string\n\n /**\n * Whether the URL is relative to the base URL.\n */\n isRelative: boolean\n}\n\nexport function parseRelativeURL(\n url: string | URL,\n base: string | URL\n): RelativeURL {\n const baseURL = typeof base === 'string' ? new URL(base) : base\n const relative = new URL(url, base)\n\n // The URL is relative if the origin is the same as the base URL.\n const isRelative = relative.origin === baseURL.origin\n\n return {\n url: isRelative\n ? relative.toString().slice(baseURL.origin.length)\n : relative.toString(),\n isRelative,\n }\n}\n\n/**\n * Given a URL as a string and a base URL it will make the URL relative\n * if the parsed protocol and host is the same as the one in the base\n * URL. Otherwise it returns the same URL string.\n */\nexport function getRelativeURL(url: string | URL, base: string | URL): string {\n const relative = parseRelativeURL(url, base)\n return relative.url\n}\n"],"names":["parseRelativeURL","url","base","baseURL","URL","relative","isRelative","origin","toString","slice","length","getRelativeURL"],"mappings":"AAAA;;CAEC,GAaD,OAAO,SAASA,iBACdC,GAAiB,EACjBC,IAAkB;IAElB,MAAMC,UAAU,OAAOD,SAAS,WAAW,IAAIE,IAAIF,QAAQA;IAC3D,MAAMG,WAAW,IAAID,IAAIH,KAAKC;IAE9B,iEAAiE;IACjE,MAAMI,aAAaD,SAASE,MAAM,KAAKJ,QAAQI,MAAM;IAErD,OAAO;QACLN,KAAKK,aACDD,SAASG,QAAQ,GAAGC,KAAK,CAACN,QAAQI,MAAM,CAACG,MAAM,IAC/CL,SAASG,QAAQ;QACrBF;IACF;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASK,eAAeV,GAAiB,EAAEC,IAAkB;IAClE,MAAMG,WAAWL,iBAAiBC,KAAKC;IACvC,OAAOG,SAASJ,GAAG;AACrB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/remove-path-prefix.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/remove-path-prefix.js new file mode 100644 index 0000000000000000000000000000000000000000..9cd59f8ce6eb7590d4218dc5efc6b3fdc9196547 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/remove-path-prefix.js @@ -0,0 +1,36 @@ +import { pathHasPrefix } from './path-has-prefix'; +/** + * Given a path and a prefix it will remove the prefix when it exists in the + * given path. It ensures it matches exactly without containing extra chars + * and if the prefix is not there it will be noop. + * + * @param path The path to remove the prefix from. + * @param prefix The prefix to be removed. + */ export function removePathPrefix(path, prefix) { + // If the path doesn't start with the prefix we can return it as is. This + // protects us from situations where the prefix is a substring of the path + // prefix such as: + // + // For prefix: /blog + // + // /blog -> true + // /blog/ -> true + // /blog/1 -> true + // /blogging -> false + // /blogging/ -> false + // /blogging/1 -> false + if (!pathHasPrefix(path, prefix)) { + return path; + } + // Remove the prefix from the path via slicing. + const withoutPrefix = path.slice(prefix.length); + // If the path without the prefix starts with a `/` we can return it as is. + if (withoutPrefix.startsWith('/')) { + return withoutPrefix; + } + // If the path without the prefix doesn't start with a `/` we need to add it + // back to the path to make sure it's a valid path. + return `/${withoutPrefix}`; +} + +//# sourceMappingURL=remove-path-prefix.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/remove-path-prefix.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/remove-path-prefix.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ac7e3e97580c4e186325ebcb62821fe979ceb647 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/remove-path-prefix.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/remove-path-prefix.ts"],"sourcesContent":["import { pathHasPrefix } from './path-has-prefix'\n\n/**\n * Given a path and a prefix it will remove the prefix when it exists in the\n * given path. It ensures it matches exactly without containing extra chars\n * and if the prefix is not there it will be noop.\n *\n * @param path The path to remove the prefix from.\n * @param prefix The prefix to be removed.\n */\nexport function removePathPrefix(path: string, prefix: string): string {\n // If the path doesn't start with the prefix we can return it as is. This\n // protects us from situations where the prefix is a substring of the path\n // prefix such as:\n //\n // For prefix: /blog\n //\n // /blog -> true\n // /blog/ -> true\n // /blog/1 -> true\n // /blogging -> false\n // /blogging/ -> false\n // /blogging/1 -> false\n if (!pathHasPrefix(path, prefix)) {\n return path\n }\n\n // Remove the prefix from the path via slicing.\n const withoutPrefix = path.slice(prefix.length)\n\n // If the path without the prefix starts with a `/` we can return it as is.\n if (withoutPrefix.startsWith('/')) {\n return withoutPrefix\n }\n\n // If the path without the prefix doesn't start with a `/` we need to add it\n // back to the path to make sure it's a valid path.\n return `/${withoutPrefix}`\n}\n"],"names":["pathHasPrefix","removePathPrefix","path","prefix","withoutPrefix","slice","length","startsWith"],"mappings":"AAAA,SAASA,aAAa,QAAQ,oBAAmB;AAEjD;;;;;;;CAOC,GACD,OAAO,SAASC,iBAAiBC,IAAY,EAAEC,MAAc;IAC3D,yEAAyE;IACzE,0EAA0E;IAC1E,kBAAkB;IAClB,EAAE;IACF,oBAAoB;IACpB,EAAE;IACF,kBAAkB;IAClB,mBAAmB;IACnB,oBAAoB;IACpB,uBAAuB;IACvB,wBAAwB;IACxB,yBAAyB;IACzB,IAAI,CAACH,cAAcE,MAAMC,SAAS;QAChC,OAAOD;IACT;IAEA,+CAA+C;IAC/C,MAAME,gBAAgBF,KAAKG,KAAK,CAACF,OAAOG,MAAM;IAE9C,2EAA2E;IAC3E,IAAIF,cAAcG,UAAU,CAAC,MAAM;QACjC,OAAOH;IACT;IAEA,4EAA4E;IAC5E,mDAAmD;IACnD,OAAO,CAAC,CAAC,EAAEA,eAAe;AAC5B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/remove-trailing-slash.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/remove-trailing-slash.js new file mode 100644 index 0000000000000000000000000000000000000000..5bf842751e827f2b8c935f513ed195e8e597fa69 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/remove-trailing-slash.js @@ -0,0 +1,12 @@ +/** + * Removes the trailing slash for a given route or page path. Examples: + * - `/foo/bar/` -> `/foo/bar` + * - `/foo/bar` -> `/foo/bar` + * + * Uses charCodeAt (47 === '/') instead of regex to avoid the overhead of + * compiling and executing a RegExp on every call (~3-5x faster). + */ export function removeTrailingSlash(route) { + return route.charCodeAt(route.length - 1) === 47 && route.length > 1 ? route.slice(0, -1) : route; +} + +//# sourceMappingURL=remove-trailing-slash.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/remove-trailing-slash.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/remove-trailing-slash.js.map new file mode 100644 index 0000000000000000000000000000000000000000..34e088604612947f2c2ca003f923c63897ca8e81 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/remove-trailing-slash.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/remove-trailing-slash.ts"],"sourcesContent":["/**\n * Removes the trailing slash for a given route or page path. Examples:\n * - `/foo/bar/` -> `/foo/bar`\n * - `/foo/bar` -> `/foo/bar`\n *\n * Uses charCodeAt (47 === '/') instead of regex to avoid the overhead of\n * compiling and executing a RegExp on every call (~3-5x faster).\n */\nexport function removeTrailingSlash(route: string) {\n return route.charCodeAt(route.length - 1) === 47 && route.length > 1\n ? route.slice(0, -1)\n : route\n}\n"],"names":["removeTrailingSlash","route","charCodeAt","length","slice"],"mappings":"AAAA;;;;;;;CAOC,GACD,OAAO,SAASA,oBAAoBC,KAAa;IAC/C,OAAOA,MAAMC,UAAU,CAACD,MAAME,MAAM,GAAG,OAAO,MAAMF,MAAME,MAAM,GAAG,IAC/DF,MAAMG,KAAK,CAAC,GAAG,CAAC,KAChBH;AACN","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/resolve-param-value.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/resolve-param-value.js new file mode 100644 index 0000000000000000000000000000000000000000..0832187b0d6b0ef7afb967f293eff6e942d24f5a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/resolve-param-value.js @@ -0,0 +1,114 @@ +import { InvariantError } from '../../invariant-error'; +import { interceptionPrefixFromParamType } from './interception-prefix-from-param-type'; +/** + * Extracts the param value from a path segment, handling interception markers + * based on the expected param type. + * + * @param pathSegment - The path segment to extract the value from + * @param params - The current params object for resolving dynamic param references + * @param paramType - The expected param type which may include interception marker info + * @returns The extracted param value + */ function getParamValueFromSegment(pathSegment, params, paramType) { + // If the segment is dynamic, resolve it from the params object + if (pathSegment.type === 'dynamic') { + return params[pathSegment.param.paramName]; + } + // If the paramType indicates this is an intercepted param, strip the marker + // that matches the interception marker in the param type + const interceptionPrefix = interceptionPrefixFromParamType(paramType); + if (interceptionPrefix === pathSegment.interceptionMarker) { + return pathSegment.name.replace(pathSegment.interceptionMarker, ''); + } + // For static segments, use the name + return pathSegment.name; +} +/** + * Resolves a route parameter value from the route segments at the given depth. + * This shared logic is used by both extractPathnameRouteParamSegmentsFromLoaderTree + * and resolveRouteParamsFromTree. + * + * @param paramName - The parameter name to resolve + * @param paramType - The parameter type (dynamic, catchall, etc.) + * @param depth - The current depth in the route tree + * @param route - The normalized route containing segments + * @param params - The current params object (used to resolve embedded param references) + * @param options - Configuration options + * @returns The resolved parameter value, or undefined if it cannot be resolved + */ export function resolveParamValue(paramName, paramType, depth, route, params) { + switch(paramType){ + case 'catchall': + case 'optional-catchall': + case 'catchall-intercepted-(..)(..)': + case 'catchall-intercepted-(.)': + case 'catchall-intercepted-(..)': + case 'catchall-intercepted-(...)': + // For catchall routes, derive from pathname using depth to determine + // which segments to use + const processedSegments = []; + // Process segments to handle any embedded dynamic params + for(let index = depth; index < route.segments.length; index++){ + const pathSegment = route.segments[index]; + if (pathSegment.type === 'static') { + let value = pathSegment.name; + // For intercepted catch-all params, strip the marker from the first segment + const interceptionPrefix = interceptionPrefixFromParamType(paramType); + if (interceptionPrefix && index === depth && interceptionPrefix === pathSegment.interceptionMarker) { + // Strip the interception marker from the value + value = value.replace(pathSegment.interceptionMarker, ''); + } + processedSegments.push(value); + } else { + // If the segment is a param placeholder, check if we have its value + if (!params.hasOwnProperty(pathSegment.param.paramName)) { + // If the segment is an optional catchall, we can break out of the + // loop because it's optional! + if (pathSegment.param.paramType === 'optional-catchall') { + break; + } + // Unknown param placeholder in pathname - can't derive full value + return undefined; + } + // If the segment matches a param, use the param value + // We don't encode values here as that's handled during retrieval. + const paramValue = params[pathSegment.param.paramName]; + if (Array.isArray(paramValue)) { + processedSegments.push(...paramValue); + } else { + processedSegments.push(paramValue); + } + } + } + if (processedSegments.length > 0) { + return processedSegments; + } else if (paramType === 'optional-catchall') { + return undefined; + } else { + // We shouldn't be able to match a catchall segment without any path + // segments if it's not an optional catchall + throw new InvariantError(`Unexpected empty path segments match for a route "${route.pathname}" with param "${paramName}" of type "${paramType}"`); + } + case 'dynamic': + case 'dynamic-intercepted-(..)(..)': + case 'dynamic-intercepted-(.)': + case 'dynamic-intercepted-(..)': + case 'dynamic-intercepted-(...)': + // For regular dynamic parameters, take the segment at this depth + if (depth < route.segments.length) { + const pathSegment = route.segments[depth]; + // Check if the segment at this depth is a placeholder for an unknown param + if (pathSegment.type === 'dynamic' && !params.hasOwnProperty(pathSegment.param.paramName)) { + // The segment is a placeholder like [category] and we don't have the value + return undefined; + } + // If the segment matches a param, use the param value from params object + // Otherwise it's a static segment, just use it directly + // We don't encode values here as that's handled during retrieval + return getParamValueFromSegment(pathSegment, params, paramType); + } + return undefined; + default: + paramType; + } +} + +//# sourceMappingURL=resolve-param-value.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/resolve-param-value.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/resolve-param-value.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7663270a1a1db2f9b401c611847c1266c498ab70 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/resolve-param-value.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/resolve-param-value.ts"],"sourcesContent":["import type { Params } from '../../../../server/request/params'\nimport type { DynamicParamTypes } from '../../app-router-types'\nimport { InvariantError } from '../../invariant-error'\nimport type {\n NormalizedAppRoute,\n NormalizedAppRouteSegment,\n} from '../routes/app'\nimport { interceptionPrefixFromParamType } from './interception-prefix-from-param-type'\n\n/**\n * Extracts the param value from a path segment, handling interception markers\n * based on the expected param type.\n *\n * @param pathSegment - The path segment to extract the value from\n * @param params - The current params object for resolving dynamic param references\n * @param paramType - The expected param type which may include interception marker info\n * @returns The extracted param value\n */\nfunction getParamValueFromSegment(\n pathSegment: NormalizedAppRouteSegment,\n params: Params,\n paramType: DynamicParamTypes\n): string {\n // If the segment is dynamic, resolve it from the params object\n if (pathSegment.type === 'dynamic') {\n return params[pathSegment.param.paramName] as string\n }\n\n // If the paramType indicates this is an intercepted param, strip the marker\n // that matches the interception marker in the param type\n const interceptionPrefix = interceptionPrefixFromParamType(paramType)\n if (interceptionPrefix === pathSegment.interceptionMarker) {\n return pathSegment.name.replace(pathSegment.interceptionMarker, '')\n }\n\n // For static segments, use the name\n return pathSegment.name\n}\n\n/**\n * Resolves a route parameter value from the route segments at the given depth.\n * This shared logic is used by both extractPathnameRouteParamSegmentsFromLoaderTree\n * and resolveRouteParamsFromTree.\n *\n * @param paramName - The parameter name to resolve\n * @param paramType - The parameter type (dynamic, catchall, etc.)\n * @param depth - The current depth in the route tree\n * @param route - The normalized route containing segments\n * @param params - The current params object (used to resolve embedded param references)\n * @param options - Configuration options\n * @returns The resolved parameter value, or undefined if it cannot be resolved\n */\nexport function resolveParamValue(\n paramName: string,\n paramType: DynamicParamTypes,\n depth: number,\n route: NormalizedAppRoute,\n params: Params\n): string | string[] | undefined {\n switch (paramType) {\n case 'catchall':\n case 'optional-catchall':\n case 'catchall-intercepted-(..)(..)':\n case 'catchall-intercepted-(.)':\n case 'catchall-intercepted-(..)':\n case 'catchall-intercepted-(...)':\n // For catchall routes, derive from pathname using depth to determine\n // which segments to use\n const processedSegments: string[] = []\n\n // Process segments to handle any embedded dynamic params\n for (let index = depth; index < route.segments.length; index++) {\n const pathSegment = route.segments[index]\n\n if (pathSegment.type === 'static') {\n let value = pathSegment.name\n\n // For intercepted catch-all params, strip the marker from the first segment\n const interceptionPrefix = interceptionPrefixFromParamType(paramType)\n if (\n interceptionPrefix &&\n index === depth &&\n interceptionPrefix === pathSegment.interceptionMarker\n ) {\n // Strip the interception marker from the value\n value = value.replace(pathSegment.interceptionMarker, '')\n }\n\n processedSegments.push(value)\n } else {\n // If the segment is a param placeholder, check if we have its value\n if (!params.hasOwnProperty(pathSegment.param.paramName)) {\n // If the segment is an optional catchall, we can break out of the\n // loop because it's optional!\n if (pathSegment.param.paramType === 'optional-catchall') {\n break\n }\n\n // Unknown param placeholder in pathname - can't derive full value\n return undefined\n }\n\n // If the segment matches a param, use the param value\n // We don't encode values here as that's handled during retrieval.\n const paramValue = params[pathSegment.param.paramName]\n if (Array.isArray(paramValue)) {\n processedSegments.push(...paramValue)\n } else {\n processedSegments.push(paramValue as string)\n }\n }\n }\n\n if (processedSegments.length > 0) {\n return processedSegments\n } else if (paramType === 'optional-catchall') {\n return undefined\n } else {\n // We shouldn't be able to match a catchall segment without any path\n // segments if it's not an optional catchall\n throw new InvariantError(\n `Unexpected empty path segments match for a route \"${route.pathname}\" with param \"${paramName}\" of type \"${paramType}\"`\n )\n }\n case 'dynamic':\n case 'dynamic-intercepted-(..)(..)':\n case 'dynamic-intercepted-(.)':\n case 'dynamic-intercepted-(..)':\n case 'dynamic-intercepted-(...)':\n // For regular dynamic parameters, take the segment at this depth\n if (depth < route.segments.length) {\n const pathSegment = route.segments[depth]\n\n // Check if the segment at this depth is a placeholder for an unknown param\n if (\n pathSegment.type === 'dynamic' &&\n !params.hasOwnProperty(pathSegment.param.paramName)\n ) {\n // The segment is a placeholder like [category] and we don't have the value\n return undefined\n }\n\n // If the segment matches a param, use the param value from params object\n // Otherwise it's a static segment, just use it directly\n // We don't encode values here as that's handled during retrieval\n return getParamValueFromSegment(pathSegment, params, paramType)\n }\n\n return undefined\n\n default:\n paramType satisfies never\n }\n}\n"],"names":["InvariantError","interceptionPrefixFromParamType","getParamValueFromSegment","pathSegment","params","paramType","type","param","paramName","interceptionPrefix","interceptionMarker","name","replace","resolveParamValue","depth","route","processedSegments","index","segments","length","value","push","hasOwnProperty","undefined","paramValue","Array","isArray","pathname"],"mappings":"AAEA,SAASA,cAAc,QAAQ,wBAAuB;AAKtD,SAASC,+BAA+B,QAAQ,wCAAuC;AAEvF;;;;;;;;CAQC,GACD,SAASC,yBACPC,WAAsC,EACtCC,MAAc,EACdC,SAA4B;IAE5B,+DAA+D;IAC/D,IAAIF,YAAYG,IAAI,KAAK,WAAW;QAClC,OAAOF,MAAM,CAACD,YAAYI,KAAK,CAACC,SAAS,CAAC;IAC5C;IAEA,4EAA4E;IAC5E,yDAAyD;IACzD,MAAMC,qBAAqBR,gCAAgCI;IAC3D,IAAII,uBAAuBN,YAAYO,kBAAkB,EAAE;Q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,OAAO;wBACLR,kBAAkBK,IAAI,CAACG;oBACzB;gBACF;YACF;YAEA,IAAIR,kBAAkBG,MAAM,GAAG,GAAG;gBAChC,OAAOH;YACT,OAAO,IAAIX,cAAc,qBAAqB;gBAC5C,OAAOkB;YACT,OAAO;gBACL,oEAAoE;gBACpE,4CAA4C;gBAC5C,MAAM,IAAIvB,eACR,CAAC,kDAAkD,EAAEe,MAAMY,QAAQ,CAAC,cAAc,EAAEnB,UAAU,WAAW,EAAEH,UAAU,CAAC,CAAC;YAE3H;QACF,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;YACH,iEAAiE;YACjE,IAAIS,QAAQC,MAAMG,QAAQ,CAACC,MAAM,EAAE;gBACjC,MAAMhB,cAAcY,MAAMG,QAAQ,CAACJ,MAAM;gBAEzC,2EAA2E;gBAC3E,IACEX,YAAYG,IAAI,KAAK,aACrB,CAACF,OAAOkB,cAAc,CAACnB,YAAYI,KAAK,CAACC,SAAS,GAClD;oBACA,2EAA2E;oBAC3E,OAAOe;gBACT;gBAEA,yEAAyE;gBACzE,wDAAwD;gBACxD,iEAAiE;gBACjE,OAAOrB,yBAAyBC,aAAaC,QAAQC;YACvD;YAEA,OAAOkB;QAET;YACElB;IACJ;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/resolve-rewrites.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/resolve-rewrites.js new file mode 100644 index 0000000000000000000000000000000000000000..7f1a67f2c1188bc931712836a77dbc13de237e2f --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/resolve-rewrites.js @@ -0,0 +1,108 @@ +import { getPathMatch } from './path-match'; +import { matchHas, prepareDestination } from './prepare-destination'; +import { removeTrailingSlash } from './remove-trailing-slash'; +import { normalizeLocalePath } from '../../i18n/normalize-locale-path'; +import { removeBasePath } from '../../../../client/remove-base-path'; +import { parseRelativeUrl } from './parse-relative-url'; +export default function resolveRewrites(asPath, pages, rewrites, query, resolveHref, locales) { + let matchedPage = false; + let externalDest = false; + let parsedAs = parseRelativeUrl(asPath); + let fsPathname = removeTrailingSlash(normalizeLocalePath(removeBasePath(parsedAs.pathname), locales).pathname); + let resolvedHref; + const handleRewrite = (rewrite)=>{ + const matcher = getPathMatch(rewrite.source + (process.env.__NEXT_TRAILING_SLASH ? '(/)?' : ''), { + removeUnnamedParams: true, + strict: true + }); + let params = matcher(parsedAs.pathname); + if ((rewrite.has || rewrite.missing) && params) { + const hasParams = matchHas({ + headers: { + host: document.location.hostname, + 'user-agent': navigator.userAgent + }, + cookies: document.cookie.split('; ').reduce((acc, item)=>{ + const [key, ...value] = item.split('='); + acc[key] = value.join('='); + return acc; + }, {}) + }, parsedAs.query, rewrite.has, rewrite.missing); + if (hasParams) { + Object.assign(params, hasParams); + } else { + params = false; + } + } + if (params) { + if (!rewrite.destination) { + // this is a proxied rewrite which isn't handled on the client + externalDest = true; + return true; + } + const destRes = prepareDestination({ + appendParamsToQuery: true, + destination: rewrite.destination, + params: params, + query: query + }); + parsedAs = destRes.parsedDestination; + asPath = destRes.newUrl; + Object.assign(query, destRes.parsedDestination.query); + fsPathname = removeTrailingSlash(normalizeLocalePath(removeBasePath(asPath), locales).pathname); + if (pages.includes(fsPathname)) { + // check if we now match a page as this means we are done + // resolving the rewrites + matchedPage = true; + resolvedHref = fsPathname; + return true; + } + // check if we match a dynamic-route, if so we break the rewrites chain + resolvedHref = resolveHref(fsPathname); + if (resolvedHref !== asPath && pages.includes(resolvedHref)) { + matchedPage = true; + return true; + } + } + }; + let finished = false; + for(let i = 0; i < rewrites.beforeFiles.length; i++){ + // we don't end after match in beforeFiles to allow + // continuing through all beforeFiles rewrites + handleRewrite(rewrites.beforeFiles[i]); + } + matchedPage = pages.includes(fsPathname); + if (!matchedPage) { + if (!finished) { + for(let i = 0; i < rewrites.afterFiles.length; i++){ + if (handleRewrite(rewrites.afterFiles[i])) { + finished = true; + break; + } + } + } + // check dynamic route before processing fallback rewrites + if (!finished) { + resolvedHref = resolveHref(fsPathname); + matchedPage = pages.includes(resolvedHref); + finished = matchedPage; + } + if (!finished) { + for(let i = 0; i < rewrites.fallback.length; i++){ + if (handleRewrite(rewrites.fallback[i])) { + finished = true; + break; + } + } + } + } + return { + asPath, + parsedAs, + matchedPage, + resolvedHref, + externalDest + }; +} + +//# sourceMappingURL=resolve-rewrites.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/resolve-rewrites.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/resolve-rewrites.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a7c9ec4519affd9fc7b3cf95682b5aa95634abe8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/resolve-rewrites.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/resolve-rewrites.ts"],"sourcesContent":["import type { ParsedUrlQuery } from 'querystring'\nimport type { Rewrite } from '../../../../lib/load-custom-routes'\nimport { getPathMatch } from './path-match'\nimport { matchHas, prepareDestination } from './prepare-destination'\nimport { removeTrailingSlash } from './remove-trailing-slash'\nimport { normalizeLocalePath } from '../../i18n/normalize-locale-path'\nimport { removeBasePath } from '../../../../client/remove-base-path'\nimport { parseRelativeUrl, type ParsedRelativeUrl } from './parse-relative-url'\nimport type { ParsedUrl } from './parse-url'\n\ntype ParsedAs = ParsedRelativeUrl | ParsedUrl\nexport default function resolveRewrites(\n asPath: string,\n pages: string[],\n rewrites: {\n beforeFiles: Rewrite[]\n afterFiles: Rewrite[]\n fallback: Rewrite[]\n },\n query: ParsedUrlQuery,\n resolveHref: (path: string) => string,\n locales?: readonly string[]\n): {\n matchedPage: boolean\n parsedAs: ParsedAs\n asPath: string\n resolvedHref?: string\n externalDest?: boolean\n} {\n let matchedPage = false\n let externalDest = false\n let parsedAs: ParsedAs = parseRelativeUrl(asPath)\n let fsPathname = removeTrailingSlash(\n normalizeLocalePath(removeBasePath(parsedAs.pathname), locales).pathname\n )\n let resolvedHref\n\n const handleRewrite = (rewrite: Rewrite) => {\n const matcher = getPathMatch(\n rewrite.source + (process.env.__NEXT_TRAILING_SLASH ? '(/)?' : ''),\n {\n removeUnnamedParams: true,\n strict: true,\n }\n )\n\n let params = matcher(parsedAs.pathname)\n\n if ((rewrite.has || rewrite.missing) && params) {\n const hasParams = matchHas(\n {\n headers: {\n host: document.location.hostname,\n 'user-agent': navigator.userAgent,\n },\n cookies: document.cookie\n .split('; ')\n .reduce<Record<string, string>>((acc, item) => {\n const [key, ...value] = item.split('=')\n acc[key] = value.join('=')\n return acc\n }, {}),\n } as any,\n parsedAs.query,\n rewrite.has,\n rewrite.missing\n )\n\n if (hasParams) {\n Object.assign(params, hasParams)\n } else {\n params = false\n }\n }\n\n if (params) {\n if (!rewrite.destination) {\n // this is a proxied rewrite which isn't handled on the client\n externalDest = true\n return true\n }\n const destRes = prepareDestination({\n appendParamsToQuery: true,\n destination: rewrite.destination,\n params: params,\n query: query,\n })\n parsedAs = destRes.parsedDestination\n asPath = destRes.newUrl\n Object.assign(query, destRes.parsedDestination.query)\n\n fsPathname = removeTrailingSlash(\n normalizeLocalePath(removeBasePath(asPath), locales).pathname\n )\n\n if (pages.includes(fsPathname)) {\n // check if we now match a page as this means we are done\n // resolving the rewrites\n matchedPage = true\n resolvedHref = fsPathname\n return true\n }\n\n // check if we match a dynamic-route, if so we break the rewrites chain\n resolvedHref = resolveHref(fsPathname)\n\n if (resolvedHref !== asPath && pages.includes(resolvedHref)) {\n matchedPage = true\n return true\n }\n }\n }\n let finished = false\n\n for (let i = 0; i < rewrites.beforeFiles.length; i++) {\n // we don't end after match in beforeFiles to allow\n // continuing through all beforeFiles rewrites\n handleRewrite(rewrites.beforeFiles[i])\n }\n matchedPage = pages.includes(fsPathname)\n\n if (!matchedPage) {\n if (!finished) {\n for (let i = 0; i < rewrites.afterFiles.length; i++) {\n if (handleRewrite(rewrites.afterFiles[i])) {\n finished = true\n break\n }\n }\n }\n\n // check dynamic route before processing fallback rewrites\n if (!finished) {\n resolvedHref = resolveHref(fsPathname)\n matchedPage = pages.includes(resolvedHref)\n finished = matchedPage\n }\n\n if (!finished) {\n for (let i = 0; i < rewrites.fallback.length; i++) {\n if (handleRewrite(rewrites.fallback[i])) {\n finished = true\n break\n }\n }\n }\n }\n\n return {\n asPath,\n parsedAs,\n matchedPage,\n resolvedHref,\n externalDest,\n }\n}\n"],"names":["getPathMatch","matchHas","prepareDestination","removeTrailingSlash","normalizeLocalePath","removeBasePath","parseRelativeUrl","resolveRewrites","asPath","pages","rewrites","query","resolveHref","locales","matchedPage","externalDest","parsedAs","fsPathname","pathname","resolvedHref","handleRewrite","rewrite","matcher","source","process","env","__NEXT_TRAILING_SLASH","removeUnnamedParams","strict","params","has","missing","hasParams","headers","host","document","location","hostname","navigator","userAgent","cookies","cookie","split","reduce","acc","item","key","value","join","Object","assign","destination","destRes","appendParamsToQuery","parsedDestination","newUrl","includes","finished","i","beforeFiles","length","afterFiles","fallback"],"mappings":"AAEA,SAASA,YAAY,QAAQ,eAAc;AAC3C,SAASC,QAAQ,EAAEC,kBAAkB,QAAQ,wBAAuB;AACpE,SAASC,mBAAmB,QAAQ,0BAAyB;AAC7D,SAASC,mBAAmB,QAAQ,mCAAkC;AACtE,SAASC,cAAc,QAAQ,sCAAqC;AACpE,SAASC,gBAAgB,QAAgC,uBAAsB;AAI/E,eAAe,SAASC,gBACtBC,MAAc,EACdC,KAAe,EACfC,QAIC,EACDC,KAAqB,EACrBC,WAAqC,EACrCC,OAA2B;IAQ3B,IAAIC,cAAc;IAClB,IAAIC,eAAe;IACnB,IAAIC,WAAqBV,iBAAiBE;IAC1C,IAAIS,aAAad,oBACfC,oBAAoBC,eAAeW,SAASE,QAAQ,GAAGL,SAASK,QAAQ;IAE1E,IAAIC;IAEJ,MAAMC,gBAAgB,CAACC;QACrB,MAAMC,UAAUtB,aACdqB,QAAQE,MAAM,GAAIC,CA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,OAAO;YACT;YAEA,uEAAuE;YACvEE,eAAeP,YAAYK;YAE3B,IAAIE,iBAAiBX,UAAUC,MAAM+C,QAAQ,CAACrC,eAAe;gBAC3DL,cAAc;gBACd,OAAO;YACT;QACF;IACF;IACA,IAAI2C,WAAW;IAEf,IAAK,IAAIC,IAAI,GAAGA,IAAIhD,SAASiD,WAAW,CAACC,MAAM,EAAEF,IAAK;QACpD,mDAAmD;QACnD,8CAA8C;QAC9CtC,cAAcV,SAASiD,WAAW,CAACD,EAAE;IACvC;IACA5C,cAAcL,MAAM+C,QAAQ,CAACvC;IAE7B,IAAI,CAACH,aAAa;QAChB,IAAI,CAAC2C,UAAU;YACb,IAAK,IAAIC,IAAI,GAAGA,IAAIhD,SAASmD,UAAU,CAACD,MAAM,EAAEF,IAAK;gBACnD,IAAItC,cAAcV,SAASmD,UAAU,CAACH,EAAE,GAAG;oBACzCD,WAAW;oBACX;gBACF;YACF;QACF;QAEA,0DAA0D;QAC1D,IAAI,CAACA,UAAU;YACbtC,eAAeP,YAAYK;YAC3BH,cAAcL,MAAM+C,QAAQ,CAACrC;YAC7BsC,WAAW3C;QACb;QAEA,IAAI,CAAC2C,UAAU;YACb,IAAK,IAAIC,IAAI,GAAGA,IAAIhD,SAASoD,QAAQ,CAACF,MAAM,EAAEF,IAAK;gBACjD,IAAItC,cAAcV,SAASoD,QAAQ,CAACJ,EAAE,GAAG;oBACvCD,WAAW;oBACX;gBACF;YACF;QACF;IACF;IAEA,OAAO;QACLjD;QACAQ;QACAF;QACAK;QACAJ;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/route-match-utils.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/route-match-utils.js new file mode 100644 index 0000000000000000000000000000000000000000..04d53c6db081117d17d0f687567586276e5ac087 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/route-match-utils.js @@ -0,0 +1,96 @@ +/** + * Client-safe utilities for route matching that don't import server-side + * utilities to avoid bundling issues with Turbopack + */ import { pathToRegexp, compile, regexpToFunction } from 'next/dist/compiled/path-to-regexp'; +import { hasAdjacentParameterIssues, normalizeAdjacentParameters, stripParameterSeparators, stripNormalizedSeparators } from '../../../../lib/route-pattern-normalizer'; +/** + * Client-safe wrapper around pathToRegexp that handles path-to-regexp 6.3.0+ validation errors. + * This includes both "Can not repeat without prefix/suffix" and "Must have text between parameters" errors. + */ export function safePathToRegexp(route, keys, options) { + if (typeof route !== 'string') { + return pathToRegexp(route, keys, options); + } + // Check if normalization is needed and cache the result + const needsNormalization = hasAdjacentParameterIssues(route); + const routeToUse = needsNormalization ? normalizeAdjacentParameters(route) : route; + try { + return pathToRegexp(routeToUse, keys, options); + } catch (error) { + // Only try normalization if we haven't already normalized + if (!needsNormalization) { + try { + const normalizedRoute = normalizeAdjacentParameters(route); + return pathToRegexp(normalizedRoute, keys, options); + } catch (retryError) { + // If that doesn't work, fall back to original error + throw error; + } + } + throw error; + } +} +/** + * Client-safe wrapper around compile that handles path-to-regexp 6.3.0+ validation errors. + * No server-side error reporting to avoid bundling issues. + * When normalization is applied, the returned compiler function automatically strips + * the internal separator from the output URL. + */ export function safeCompile(route, options) { + // Check if normalization is needed and cache the result + const needsNormalization = hasAdjacentParameterIssues(route); + const routeToUse = needsNormalization ? normalizeAdjacentParameters(route) : route; + try { + const compiler = compile(routeToUse, options); + // If we normalized the route, wrap the compiler to strip separators from output + // The normalization inserts _NEXTSEP_ as a literal string in the pattern to satisfy + // path-to-regexp validation, but we don't want it in the final compiled URL + if (needsNormalization) { + return (params)=>{ + return stripNormalizedSeparators(compiler(params)); + }; + } + return compiler; + } catch (error) { + // Only try normalization if we haven't already normalized + if (!needsNormalization) { + try { + const normalizedRoute = normalizeAdjacentParameters(route); + const compiler = compile(normalizedRoute, options); + // Wrap the compiler to strip separators from output + return (params)=>{ + return stripNormalizedSeparators(compiler(params)); + }; + } catch (retryError) { + // If that doesn't work, fall back to original error + throw error; + } + } + throw error; + } +} +/** + * Client-safe wrapper around regexpToFunction that automatically cleans parameters. + */ export function safeRegexpToFunction(regexp, keys) { + const originalMatcher = regexpToFunction(regexp, keys || []); + return (pathname)=>{ + const result = originalMatcher(pathname); + if (!result) return false; + // Clean parameters before returning + return { + ...result, + params: stripParameterSeparators(result.params) + }; + }; +} +/** + * Safe wrapper for route matcher functions that automatically cleans parameters. + * This is client-safe and doesn't import path-to-regexp. + */ export function safeRouteMatcher(matcherFn) { + return (pathname)=>{ + const result = matcherFn(pathname); + if (!result) return false; + // Clean parameters before returning + return stripParameterSeparators(result); + }; +} + +//# sourceMappingURL=route-match-utils.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/route-match-utils.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/route-match-utils.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3a10d37a07d5263b91d7f997858344ea5c6287b2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/route-match-utils.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/route-match-utils.ts"],"sourcesContent":["/**\n * Client-safe utilities for route matching that don't import server-side\n * utilities to avoid bundling issues with Turbopack\n */\n\nimport type {\n Key,\n TokensToRegexpOptions,\n ParseOptions,\n TokensToFunctionOptions,\n} from 'next/dist/compiled/path-to-regexp'\nimport {\n pathToRegexp,\n compile,\n regexpToFunction,\n} from 'next/dist/compiled/path-to-regexp'\nimport {\n hasAdjacentParameterIssues,\n normalizeAdjacentParameters,\n stripParameterSeparators,\n stripNormalizedSeparators,\n} from '../../../../lib/route-pattern-normalizer'\n\n/**\n * Client-safe wrapper around pathToRegexp that handles path-to-regexp 6.3.0+ validation errors.\n * This includes both \"Can not repeat without prefix/suffix\" and \"Must have text between parameters\" errors.\n */\nexport function safePathToRegexp(\n route: string | RegExp | Array<string | RegExp>,\n keys?: Key[],\n options?: TokensToRegexpOptions & ParseOptions\n): RegExp {\n if (typeof route !== 'string') {\n return pathToRegexp(route, keys, options)\n }\n\n // Check if normalization is needed and cache the result\n const needsNormalization = hasAdjacentParameterIssues(route)\n const routeToUse = needsNormalization\n ? normalizeAdjacentParameters(route)\n : route\n\n try {\n return pathToRegexp(routeToUse, keys, options)\n } catch (error) {\n // Only try normalization if we haven't already normalized\n if (!needsNormalization) {\n try {\n const normalizedRoute = normalizeAdjacentParameters(route)\n return pathToRegexp(normalizedRoute, keys, options)\n } catch (retryError) {\n // If that doesn't work, fall back to original error\n throw error\n }\n }\n throw error\n }\n}\n\n/**\n * Client-safe wrapper around compile that handles path-to-regexp 6.3.0+ validation errors.\n * No server-side error reporting to avoid bundling issues.\n * When normalization is applied, the returned compiler function automatically strips\n * the internal separator from the output URL.\n */\nexport function safeCompile(\n route: string,\n options?: TokensToFunctionOptions & ParseOptions\n) {\n // Check if normalization is needed and cache the result\n const needsNormalization = hasAdjacentParameterIssues(route)\n const routeToUse = needsNormalization\n ? normalizeAdjacentParameters(route)\n : route\n\n try {\n const compiler = compile(routeToUse, options)\n\n // If we normalized the route, wrap the compiler to strip separators from output\n // The normalization inserts _NEXTSEP_ as a literal string in the pattern to satisfy\n // path-to-regexp validation, but we don't want it in the final compiled URL\n if (needsNormalization) {\n return (params: any) => {\n return stripNormalizedSeparators(compiler(params))\n }\n }\n\n return compiler\n } catch (error) {\n // Only try normalization if we haven't already normalized\n if (!needsNormalization) {\n try {\n const normalizedRoute = normalizeAdjacentParameters(route)\n const compiler = compile(normalizedRoute, options)\n\n // Wrap the compiler to strip separators from output\n return (params: any) => {\n return stripNormalizedSeparators(compiler(params))\n }\n } catch (retryError) {\n // If that doesn't work, fall back to original error\n throw error\n }\n }\n throw error\n }\n}\n\n/**\n * Client-safe wrapper around regexpToFunction that automatically cleans parameters.\n */\nexport function safeRegexpToFunction<\n T extends Record<string, any> = Record<string, any>,\n>(regexp: RegExp, keys?: Key[]): (pathname: string) => { params: T } | false {\n const originalMatcher = regexpToFunction<T>(regexp, keys || [])\n\n return (pathname: string) => {\n const result = originalMatcher(pathname)\n if (!result) return false\n\n // Clean parameters before returning\n return {\n ...result,\n params: stripParameterSeparators(result.params as any) as T,\n }\n }\n}\n\n/**\n * Safe wrapper for route matcher functions that automatically cleans parameters.\n * This is client-safe and doesn't import path-to-regexp.\n */\nexport function safeRouteMatcher<T extends Record<string, any>>(\n matcherFn: (pathname: string) => false | T\n): (pathname: string) => false | T {\n return (pathname: string) => {\n const result = matcherFn(pathname)\n if (!result) return false\n\n // Clean parameters before returning\n return stripParameterSeparators(result) as T\n }\n}\n"],"names":["pathToRegexp","compile","regexpToFunction","hasAdjacentParameterIssues","normalizeAdjacentParameters","stripParameterSeparators","stripNormalizedSeparators","safePathToRegexp","route","keys","options","needsNormalization","routeToUse","error","normalizedRoute","retryError","safeCompile","compiler","params","safeRegexpToFunction","regexp","originalMatcher","pathname","result","safeRouteMatcher","matcherFn"],"mappings":"AAAA;;;CAGC,GAQD,SACEA,YAAY,EACZC,OAAO,EACPC,gBAAgB,QACX,oCAAmC;AAC1C,SACEC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,wBAAwB,EACxBC,yBAAyB,QACpB,2CAA0C;AAEjD;;;CAGC,GACD,OAAO,SAASC,iBACdC,KAA+C,EAC/CC,IAAY,EACZC,OAA8C;IAE9C,IAAI,OAAOF,UAAU,UAAU;QAC7B,OAAOR,aAAaQ,OAAOC,MAAMC;IACnC;IAEA,wDAAwD;IACxD,MAAMC,qBAAqBR,2BAA2BK;IACtD,MAAMI,aAAaD,qBACfP,4BAA4BI,SAC5BA;IAEJ,IAAI;QACF,OAAOR,aAAaY,YAAYH,MAAMC;IACxC,EAAE,OAAOG,OAAO;QACd,0DAA0D;QAC1D,IAAI,CAACF,oBAAoB;YACvB,IAAI;gBACF,MAAMG,kBAAkBV,4BAA4BI;gBACpD,OAAOR,aAAac,iBAAiBL,MAAMC;YAC7C,EAAE,OAAOK,YAAY;gBACnB,oDAAoD;gBACpD,MAAMF;YACR;QACF;QACA,MAAMA;IACR;AACF;AAEA;;;;;CAKC,GACD,OAAO,SAASG,YACdR,KAAa,EACbE,OAAgD;IAEhD,wDAAwD;IACxD,MAAMC,qBAAqBR,2BAA2BK;IACtD,MAAMI,aAAaD,qBACfP,4BAA4BI,SAC5BA;IAEJ,IAAI;QACF,MAAMS,WAAWhB,QAAQW,YAAYF;QAErC,gFAAgF;QAChF,oFAAoF;QACpF,4EAA4E;QAC5E,IAAIC,oBAAoB;YACtB,OAAO,CAACO;gBACN,OAAOZ,0BAA0BW,SAASC;YAC5C;QACF;QAEA,OAAOD;IACT,EAAE,OAAOJ,OAAO;QACd,0DAA0D;QAC1D,IAAI,CAACF,oBAAoB;YACvB,IAAI;gBACF,MAAMG,kBAAkBV,4BAA4BI;gBACpD,MAAMS,WAAWhB,QAAQa,iBAAiBJ;gBAE1C,oDAAoD;gBACpD,OAAO,CAACQ;oBACN,OAAOZ,0BAA0BW,SAASC;gBAC5C;YACF,EAAE,OAAOH,YAAY;gBACnB,oDAAoD;gBACpD,MAAMF;YACR;QACF;QACA,MAAMA;IACR;AACF;AAEA;;CAEC,GACD,OAAO,SAASM,qBAEdC,MAAc,EAAEX,IAAY;IAC5B,MAAMY,kBAAkBnB,iBAAoBkB,QAAQX,QAAQ,EAAE;IAE9D,OAAO,CAACa;QACN,MAAMC,SAASF,gBAAgBC;QAC/B,IAAI,CAACC,QAAQ,OAAO;QAEpB,oCAAoC;QACpC,OAAO;YACL,GAAGA,MAAM;YACTL,QAAQb,yBAAyBkB,OAAOL,MAAM;QAChD;IACF;AACF;AAEA;;;CAGC,GACD,OAAO,SAASM,iBACdC,SAA0C;IAE1C,OAAO,CAACH;QACN,MAAMC,SAASE,UAAUH;QACzB,IAAI,CAACC,QAAQ,OAAO;QAEpB,oCAAoC;QACpC,OAAOlB,yBAAyBkB;IAClC;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/route-matcher.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/route-matcher.js new file mode 100644 index 0000000000000000000000000000000000000000..cd79102c6f1a218b0d31512983c714ba158ba7b6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/route-matcher.js @@ -0,0 +1,31 @@ +import { DecodeError } from '../../utils'; +import { safeRouteMatcher } from './route-match-utils'; +export function getRouteMatcher({ re, groups }) { + const rawMatcher = (pathname)=>{ + const routeMatch = re.exec(pathname); + if (!routeMatch) return false; + const decode = (param)=>{ + try { + return decodeURIComponent(param); + } catch { + throw new DecodeError('failed to decode param'); + } + }; + const params = {}; + for (const [key, group] of Object.entries(groups)){ + const match = routeMatch[group.pos]; + if (match !== undefined) { + if (group.repeat) { + params[key] = match.split('/').map((entry)=>decode(entry)); + } else { + params[key] = decode(match); + } + } + } + return params; + }; + // Wrap with safe matcher to handle parameter cleaning + return safeRouteMatcher(rawMatcher); +} + +//# sourceMappingURL=route-matcher.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/route-matcher.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/route-matcher.js.map new file mode 100644 index 0000000000000000000000000000000000000000..8e29667bfdffeb64b7630b6d4dcf2f13c5f21e52 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/route-matcher.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/route-matcher.ts"],"sourcesContent":["import type { Group } from './route-regex'\nimport { DecodeError } from '../../utils'\nimport type { Params } from '../../../../server/request/params'\nimport { safeRouteMatcher } from './route-match-utils'\n\nexport interface RouteMatchFn {\n (pathname: string): false | Params\n}\n\ntype RouteMatcherOptions = {\n // We only use the exec method of the RegExp object. This helps us avoid using\n // type assertions that the passed in properties are of the correct type.\n re: Pick<RegExp, 'exec'>\n groups: Record<string, Group>\n}\n\nexport function getRouteMatcher({\n re,\n groups,\n}: RouteMatcherOptions): RouteMatchFn {\n const rawMatcher = (pathname: string) => {\n const routeMatch = re.exec(pathname)\n if (!routeMatch) return false\n\n const decode = (param: string) => {\n try {\n return decodeURIComponent(param)\n } catch {\n throw new DecodeError('failed to decode param')\n }\n }\n\n const params: Params = {}\n for (const [key, group] of Object.entries(groups)) {\n const match = routeMatch[group.pos]\n if (match !== undefined) {\n if (group.repeat) {\n params[key] = match.split('/').map((entry) => decode(entry))\n } else {\n params[key] = decode(match)\n }\n }\n }\n\n return params\n }\n\n // Wrap with safe matcher to handle parameter cleaning\n return safeRouteMatcher(rawMatcher)\n}\n"],"names":["DecodeError","safeRouteMatcher","getRouteMatcher","re","groups","rawMatcher","pathname","routeMatch","exec","decode","param","decodeURIComponent","params","key","group","Object","entries","match","pos","undefined","repeat","split","map","entry"],"mappings":"AACA,SAASA,WAAW,QAAQ,cAAa;AAEzC,SAASC,gBAAgB,QAAQ,sBAAqB;AAatD,OAAO,SAASC,gBAAgB,EAC9BC,EAAE,EACFC,MAAM,EACc;IACpB,MAAMC,aAAa,CAACC;QAClB,MAAMC,aAAaJ,GAAGK,IAAI,CAACF;QAC3B,IAAI,CAACC,YAAY,OAAO;QAExB,MAAME,SAAS,CAACC;YACd,IAAI;gBACF,OAAOC,mBAAmBD;YAC5B,EAAE,OAAM;gBACN,MAAM,IAAIV,YAAY;YACxB;QACF;QAEA,MAAMY,SAAiB,CAAC;QACxB,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACZ,QAAS;YACjD,MAAMa,QAAQV,UAAU,CAACO,MAAMI,GAAG,CAAC;YACnC,IAAID,UAAUE,WAAW;gBACvB,IAAIL,MAAMM,MAAM,EAAE;oBAChBR,MAAM,CAACC,IAAI,GAAGI,MAAMI,KAAK,CAAC,KAAKC,GAAG,CAAC,CAACC,QAAUd,OAAOc;gBACvD,OAAO;oBACLX,MAAM,CAACC,IAAI,GAAGJ,OAAOQ;gBACvB;YACF;QACF;QAEA,OAAOL;IACT;IAEA,sDAAsD;IACtD,OAAOX,iBAAiBI;AAC1B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/route-regex.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/route-regex.js new file mode 100644 index 0000000000000000000000000000000000000000..8c5eb305d16748800e69d565166a6fdae34fa230 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/route-regex.js @@ -0,0 +1,244 @@ +import { NEXT_INTERCEPTION_MARKER_PREFIX, NEXT_QUERY_PARAM_PREFIX } from '../../../../lib/constants'; +import { INTERCEPTION_ROUTE_MARKERS } from './interception-routes'; +import { escapeStringRegexp } from '../../escape-regexp'; +import { removeTrailingSlash } from './remove-trailing-slash'; +import { PARAMETER_PATTERN, parseMatchedParameter } from './get-dynamic-param'; +function getParametrizedRoute(route, includeSuffix, includePrefix) { + const groups = {}; + let groupIndex = 1; + const segments = []; + for (const segment of removeTrailingSlash(route).slice(1).split('/')){ + const markerMatch = INTERCEPTION_ROUTE_MARKERS.find((m)=>segment.startsWith(m)); + const paramMatches = segment.match(PARAMETER_PATTERN) // Check for parameters + ; + if (markerMatch && paramMatches && paramMatches[2]) { + const { key, optional, repeat } = parseMatchedParameter(paramMatches[2]); + groups[key] = { + pos: groupIndex++, + repeat, + optional + }; + segments.push(`/${escapeStringRegexp(markerMatch)}([^/]+?)`); + } else if (paramMatches && paramMatches[2]) { + const { key, repeat, optional } = parseMatchedParameter(paramMatches[2]); + groups[key] = { + pos: groupIndex++, + repeat, + optional + }; + if (includePrefix && paramMatches[1]) { + segments.push(`/${escapeStringRegexp(paramMatches[1])}`); + } + let s = repeat ? optional ? '(?:/(.+?))?' : '/(.+?)' : '/([^/]+?)'; + // Remove the leading slash if includePrefix already added it. + if (includePrefix && paramMatches[1]) { + s = s.substring(1); + } + segments.push(s); + } else { + segments.push(`/${escapeStringRegexp(segment)}`); + } + // If there's a suffix, add it to the segments if it's enabled. + if (includeSuffix && paramMatches && paramMatches[3]) { + segments.push(escapeStringRegexp(paramMatches[3])); + } + } + return { + parameterizedRoute: segments.join(''), + groups + }; +} +/** + * From a normalized route this function generates a regular expression and + * a corresponding groups object intended to be used to store matching groups + * from the regular expression. + */ export function getRouteRegex(normalizedRoute, { includeSuffix = false, includePrefix = false, excludeOptionalTrailingSlash = false } = {}) { + const { parameterizedRoute, groups } = getParametrizedRoute(normalizedRoute, includeSuffix, includePrefix); + let re = parameterizedRoute; + if (!excludeOptionalTrailingSlash) { + re += '(?:/)?'; + } + return { + re: new RegExp(`^${re}$`), + groups: groups + }; +} +/** + * Builds a function to generate a minimal routeKey using only a-z and minimal + * number of characters. + */ function buildGetSafeRouteKey() { + let i = 0; + return ()=>{ + let routeKey = ''; + let j = ++i; + while(j > 0){ + routeKey += String.fromCharCode(97 + (j - 1) % 26); + j = Math.floor((j - 1) / 26); + } + return routeKey; + }; +} +function getSafeKeyFromSegment({ interceptionMarker, getSafeRouteKey, segment, routeKeys, keyPrefix, backreferenceDuplicateKeys }) { + const { key, optional, repeat } = parseMatchedParameter(segment); + // replace any non-word characters since they can break + // the named regex + let cleanedKey = key.replace(/\W/g, ''); + if (keyPrefix) { + cleanedKey = `${keyPrefix}${cleanedKey}`; + } + let invalidKey = false; + // check if the key is still invalid and fallback to using a known + // safe key + if (cleanedKey.length === 0 || cleanedKey.length > 30) { + invalidKey = true; + } + if (!isNaN(parseInt(cleanedKey.slice(0, 1)))) { + invalidKey = true; + } + if (invalidKey) { + cleanedKey = getSafeRouteKey(); + } + const duplicateKey = cleanedKey in routeKeys; + if (keyPrefix) { + routeKeys[cleanedKey] = `${keyPrefix}${key}`; + } else { + routeKeys[cleanedKey] = key; + } + // if the segment has an interception marker, make sure that's part of the regex pattern + // this is to ensure that the route with the interception marker doesn't incorrectly match + // the non-intercepted route (ie /app/(.)[username] should not match /app/[username]) + const interceptionPrefix = interceptionMarker ? escapeStringRegexp(interceptionMarker) : ''; + let pattern; + if (duplicateKey && backreferenceDuplicateKeys) { + // Use a backreference to the key to ensure that the key is the same value + // in each of the placeholders. + pattern = `\\k<${cleanedKey}>`; + } else if (repeat) { + pattern = `(?<${cleanedKey}>.+?)`; + } else { + pattern = `(?<${cleanedKey}>[^/]+?)`; + } + return { + key, + pattern: optional ? `(?:/${interceptionPrefix}${pattern})?` : `/${interceptionPrefix}${pattern}`, + cleanedKey: cleanedKey, + optional, + repeat + }; +} +function getNamedParametrizedRoute(route, prefixRouteKeys, includeSuffix, includePrefix, backreferenceDuplicateKeys, reference = { + names: {}, + intercepted: {} +}) { + const getSafeRouteKey = buildGetSafeRouteKey(); + const routeKeys = {}; + const segments = []; + const inverseParts = []; + // Ensure we don't mutate the original reference object. + reference = structuredClone(reference); + for (const segment of removeTrailingSlash(route).slice(1).split('/')){ + const hasInterceptionMarker = INTERCEPTION_ROUTE_MARKERS.some((m)=>segment.startsWith(m)); + const paramMatches = segment.match(PARAMETER_PATTERN) // Check for parameters + ; + const interceptionMarker = hasInterceptionMarker ? paramMatches?.[1] : undefined; + let keyPrefix; + if (interceptionMarker && paramMatches?.[2]) { + keyPrefix = prefixRouteKeys ? NEXT_INTERCEPTION_MARKER_PREFIX : undefined; + reference.intercepted[paramMatches[2]] = interceptionMarker; + } else if (paramMatches?.[2] && reference.intercepted[paramMatches[2]]) { + keyPrefix = prefixRouteKeys ? NEXT_INTERCEPTION_MARKER_PREFIX : undefined; + } else { + keyPrefix = prefixRouteKeys ? NEXT_QUERY_PARAM_PREFIX : undefined; + } + if (interceptionMarker && paramMatches && paramMatches[2]) { + // If there's an interception marker, add it to the segments. + const { key, pattern, cleanedKey, repeat, optional } = getSafeKeyFromSegment({ + getSafeRouteKey, + interceptionMarker, + segment: paramMatches[2], + routeKeys, + keyPrefix, + backreferenceDuplicateKeys + }); + segments.push(pattern); + inverseParts.push(`/${paramMatches[1]}:${reference.names[key] ?? cleanedKey}${repeat ? optional ? '*' : '+' : ''}`); + reference.names[key] ??= cleanedKey; + } else if (paramMatches && paramMatches[2]) { + // If there's a prefix, add it to the segments if it's enabled. + if (includePrefix && paramMatches[1]) { + segments.push(`/${escapeStringRegexp(paramMatches[1])}`); + inverseParts.push(`/${paramMatches[1]}`); + } + const { key, pattern, cleanedKey, repeat, optional } = getSafeKeyFromSegment({ + getSafeRouteKey, + segment: paramMatches[2], + routeKeys, + keyPrefix, + backreferenceDuplicateKeys + }); + // Remove the leading slash if includePrefix already added it. + let s = pattern; + if (includePrefix && paramMatches[1]) { + s = s.substring(1); + } + segments.push(s); + inverseParts.push(`/:${reference.names[key] ?? cleanedKey}${repeat ? optional ? '*' : '+' : ''}`); + reference.names[key] ??= cleanedKey; + } else { + segments.push(`/${escapeStringRegexp(segment)}`); + inverseParts.push(`/${segment}`); + } + // If there's a suffix, add it to the segments if it's enabled. + if (includeSuffix && paramMatches && paramMatches[3]) { + segments.push(escapeStringRegexp(paramMatches[3])); + inverseParts.push(paramMatches[3]); + } + } + return { + namedParameterizedRoute: segments.join(''), + routeKeys, + pathToRegexpPattern: inverseParts.join(''), + reference + }; +} +/** + * This function extends `getRouteRegex` generating also a named regexp where + * each group is named along with a routeKeys object that indexes the assigned + * named group with its corresponding key. When the routeKeys need to be + * prefixed to uniquely identify internally the "prefixRouteKey" arg should + * be "true" currently this is only the case when creating the routes-manifest + * during the build + */ export function getNamedRouteRegex(normalizedRoute, options) { + const result = getNamedParametrizedRoute(normalizedRoute, options.prefixRouteKeys, options.includeSuffix ?? false, options.includePrefix ?? false, options.backreferenceDuplicateKeys ?? false, options.reference); + let namedRegex = result.namedParameterizedRoute; + if (!options.excludeOptionalTrailingSlash) { + namedRegex += '(?:/)?'; + } + return { + ...getRouteRegex(normalizedRoute, options), + namedRegex: `^${namedRegex}$`, + routeKeys: result.routeKeys, + pathToRegexpPattern: result.pathToRegexpPattern, + reference: result.reference + }; +} +/** + * Generates a named regexp. + * This is intended to be using for build time only. + */ export function getNamedMiddlewareRegex(normalizedRoute, options) { + const { parameterizedRoute } = getParametrizedRoute(normalizedRoute, false, false); + const { catchAll = true } = options; + if (parameterizedRoute === '/') { + let catchAllRegex = catchAll ? '.*' : ''; + return { + namedRegex: `^/${catchAllRegex}$` + }; + } + const { namedParameterizedRoute } = getNamedParametrizedRoute(normalizedRoute, false, false, false, false, undefined); + let catchAllGroupedRegex = catchAll ? '(?:(/.*)?)' : ''; + return { + namedRegex: `^${namedParameterizedRoute}${catchAllGroupedRegex}$` + }; +} + +//# sourceMappingURL=route-regex.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/route-regex.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/route-regex.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b2e5aaceb15082ceca22dc657df6d8c331ed9433 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/route-regex.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/route-regex.ts"],"sourcesContent":["import {\n NEXT_INTERCEPTION_MARKER_PREFIX,\n NEXT_QUERY_PARAM_PREFIX,\n} from '../../../../lib/constants'\nimport { INTERCEPTION_ROUTE_MARKERS } from './interception-routes'\nimport { escapeStringRegexp } from '../../escape-regexp'\nimport { removeTrailingSlash } from './remove-trailing-slash'\nimport { PARAMETER_PATTERN, parseMatchedParameter } from './get-dynamic-param'\n\nexport interface Group {\n pos: number\n repeat: boolean\n optional: boolean\n}\n\nexport interface RouteRegex {\n groups: { [groupName: string]: Group }\n re: RegExp\n}\n\nexport type RegexReference = {\n names: Record<string, string>\n intercepted: Record<string, string>\n}\n\ntype GetNamedRouteRegexOptions = {\n /**\n * Whether to prefix the route keys with the NEXT_INTERCEPTION_MARKER_PREFIX\n * or NEXT_QUERY_PARAM_PREFIX. This is only relevant when creating the\n * routes-manifest during the build.\n */\n prefixRouteKeys: boolean\n\n /**\n * Whether to include the suffix in the route regex. This means that when you\n * have something like `/[...slug].json` the `.json` part will be included\n * in the regex, yielding `/(.*).json` as the regex.\n */\n includeSuffix?: boolean\n\n /**\n * Whether to include the prefix in the route regex. This means that when you\n * have something like `/[...slug].json` the `/` part will be included\n * in the regex, yielding `^/(.*).json$` as the regex.\n *\n * Note that interception markers will already be included without the need\n */\n includePrefix?: boolean\n\n /**\n * Whether to exclude the optional trailing slash from the route regex.\n */\n excludeOptionalTrailingSlash?: boolean\n\n /**\n * Whether to backtrack duplicate keys. This is only relevant when creating\n * the routes-manifest during the build.\n */\n backreferenceDuplicateKeys?: boolean\n\n /**\n * If provided, this will be used as the reference for the dynamic parameter\n * keys instead of generating them in context. This is currently only used for\n * interception routes.\n */\n reference?: RegexReference\n}\n\ntype GetRouteRegexOptions = {\n /**\n * Whether to include extra parts in the route regex. This means that when you\n * have something like `/[...slug].json` the `.json` part will be included\n * in the regex, yielding `/(.*).json` as the regex.\n */\n includeSuffix?: boolean\n\n /**\n * Whether to include the prefix in the route regex. This means that when you\n * have something like `/[...slug].json` the `/` part will be included\n * in the regex, yielding `^/(.*).json$` as the regex.\n *\n * Note that interception markers will already be included without the need\n * of adding this option.\n */\n includePrefix?: boolean\n\n /**\n * Whether to exclude the optional trailing slash from the route regex.\n */\n excludeOptionalTrailingSlash?: boolean\n}\n\nfunction getParametrizedRoute(\n route: string,\n includeSuffix: boolean,\n includePrefix: boolean\n) {\n const groups: { [groupName: string]: Group } = {}\n let groupIndex = 1\n\n const segments: string[] = []\n for (const segment of removeTrailingSlash(route).slice(1).split('/')) {\n const markerMatch = INTERCEPTION_ROUTE_MARKERS.find((m) =>\n segment.startsWith(m)\n )\n const paramMatches = segment.match(PARAMETER_PATTERN) // Check for parameters\n\n if (markerMatch && paramMatches && paramMatches[2]) {\n const { key, optional, repeat } = parseMatchedParameter(paramMatches[2])\n groups[key] = { pos: groupIndex++, repeat, optional }\n segments.push(`/${escapeStringRegexp(markerMatch)}([^/]+?)`)\n } else if (paramMatches && paramMatches[2]) {\n const { key, repeat, optional } = parseMatchedParameter(paramMatches[2])\n groups[key] = { pos: groupIndex++, repeat, optional }\n\n if (includePrefix && paramMatches[1]) {\n segments.push(`/${escapeStringRegexp(paramMatches[1])}`)\n }\n\n let s = repeat ? (optional ? '(?:/(.+?))?' : '/(.+?)') : '/([^/]+?)'\n\n // Remove the leading slash if includePrefix already added it.\n if (includePrefix && paramMatches[1]) {\n s = s.substring(1)\n }\n\n segments.push(s)\n } else {\n segments.push(`/${escapeStringRegexp(segment)}`)\n }\n\n // If there's a suffix, add it to the segments if it's enabled.\n if (includeSuffix && paramMatches && paramMatches[3]) {\n segments.push(escapeStringRegexp(paramMatches[3]))\n }\n }\n\n return {\n parameterizedRoute: segments.join(''),\n groups,\n }\n}\n\n/**\n * From a normalized route this function generates a regular expression and\n * a corresponding groups object intended to be used to store matching groups\n * from the regular expression.\n */\nexport function getRouteRegex(\n normalizedRoute: string,\n {\n includeSuffix = false,\n includePrefix = false,\n excludeOptionalTrailingSlash = false,\n }: GetRouteRegexOptions = {}\n): RouteRegex {\n const { parameterizedRoute, groups } = getParametrizedRoute(\n normalizedRoute,\n includeSuffix,\n includePrefix\n )\n\n let re = parameterizedRoute\n if (!excludeOptionalTrailingSlash) {\n re += '(?:/)?'\n }\n\n return {\n re: new RegExp(`^${re}$`),\n groups: groups,\n }\n}\n\n/**\n * Builds a function to generate a minimal routeKey using only a-z and minimal\n * number of characters.\n */\nfunction buildGetSafeRouteKey() {\n let i = 0\n\n return () => {\n let routeKey = ''\n let j = ++i\n while (j > 0) {\n routeKey += String.fromCharCode(97 + ((j - 1) % 26))\n j = Math.floor((j - 1) / 26)\n }\n return routeKey\n }\n}\n\nfunction getSafeKeyFromSegment({\n interceptionMarker,\n getSafeRouteKey,\n segment,\n routeKeys,\n keyPrefix,\n backreferenceDuplicateKeys,\n}: {\n interceptionMarker?: string\n getSafeRouteKey: () => string\n segment: string\n routeKeys: Record<string, string>\n keyPrefix?: string\n backreferenceDuplicateKeys: boolean\n}) {\n const { key, optional, repeat } = parseMatchedParameter(segment)\n\n // replace any non-word characters since they can break\n // the named regex\n let cleanedKey = key.replace(/\\W/g, '')\n\n if (keyPrefix) {\n cleanedKey = `${keyPrefix}${cleanedKey}`\n }\n let invalidKey = false\n\n // check if the key is still invalid and fallback to using a known\n // safe key\n if (cleanedKey.length === 0 || cleanedKey.length > 30) {\n invalidKey = true\n }\n if (!isNaN(parseInt(cleanedKey.slice(0, 1)))) {\n invalidKey = true\n }\n\n if (invalidKey) {\n cleanedKey = getSafeRouteKey()\n }\n\n const duplicateKey = cleanedKey in routeKeys\n\n if (keyPrefix) {\n routeKeys[cleanedKey] = `${keyPrefix}${key}`\n } else {\n routeKeys[cleanedKey] = key\n }\n\n // if the segment has an interception marker, make sure that's part of the regex pattern\n // this is to ensure that the route with the interception marker doesn't incorrectly match\n // the non-intercepted route (ie /app/(.)[username] should not match /app/[username])\n const interceptionPrefix = interceptionMarker\n ? escapeStringRegexp(interceptionMarker)\n : ''\n\n let pattern: string\n if (duplicateKey && backreferenceDuplicateKeys) {\n // Use a backreference to the key to ensure that the key is the same value\n // in each of the placeholders.\n pattern = `\\\\k<${cleanedKey}>`\n } else if (repeat) {\n pattern = `(?<${cleanedKey}>.+?)`\n } else {\n pattern = `(?<${cleanedKey}>[^/]+?)`\n }\n\n return {\n key,\n pattern: optional\n ? `(?:/${interceptionPrefix}${pattern})?`\n : `/${interceptionPrefix}${pattern}`,\n cleanedKey: cleanedKey,\n optional,\n repeat,\n }\n}\n\nfunction getNamedParametrizedRoute(\n route: string,\n prefixRouteKeys: boolean,\n includeSuffix: boolean,\n includePrefix: boolean,\n backreferenceDuplicateKeys: boolean,\n reference: RegexReference = { names: {}, intercepted: {} }\n) {\n const getSafeRouteKey = buildGetSafeRouteKey()\n const routeKeys: { [named: string]: string } = {}\n\n const segments: string[] = []\n const inverseParts: string[] = []\n\n // Ensure we don't mutate the original reference object.\n reference = structuredClone(reference)\n\n for (const segment of removeTrailingSlash(route).slice(1).split('/')) {\n const hasInterceptionMarker = INTERCEPTION_ROUTE_MARKERS.some((m) =>\n segment.startsWith(m)\n )\n\n const paramMatches = segment.match(PARAMETER_PATTERN) // Check for parameters\n\n const interceptionMarker = hasInterceptionMarker\n ? paramMatches?.[1]\n : undefined\n\n let keyPrefix: string | undefined\n if (interceptionMarker && paramMatches?.[2]) {\n keyPrefix = prefixRouteKeys ? NEXT_INTERCEPTION_MARKER_PREFIX : undefined\n reference.intercepted[paramMatches[2]] = interceptionMarker\n } else if (paramMatches?.[2] && reference.intercepted[paramMatches[2]]) {\n keyPrefix = prefixRouteKeys ? NEXT_INTERCEPTION_MARKER_PREFIX : undefined\n } else {\n keyPrefix = prefixRouteKeys ? NEXT_QUERY_PARAM_PREFIX : undefined\n }\n\n if (interceptionMarker && paramMatches && paramMatches[2]) {\n // If there's an interception marker, add it to the segments.\n const { key, pattern, cleanedKey, repeat, optional } =\n getSafeKeyFromSegment({\n getSafeRouteKey,\n interceptionMarker,\n segment: paramMatches[2],\n routeKeys,\n keyPrefix,\n backreferenceDuplicateKeys,\n })\n\n segments.push(pattern)\n inverseParts.push(\n `/${paramMatches[1]}:${reference.names[key] ?? cleanedKey}${repeat ? (optional ? '*' : '+') : ''}`\n )\n reference.names[key] ??= cleanedKey\n } else if (paramMatches && paramMatches[2]) {\n // If there's a prefix, add it to the segments if it's enabled.\n if (includePrefix && paramMatches[1]) {\n segments.push(`/${escapeStringRegexp(paramMatches[1])}`)\n inverseParts.push(`/${paramMatches[1]}`)\n }\n\n const { key, pattern, cleanedKey, repeat, optional } =\n getSafeKeyFromSegment({\n getSafeRouteKey,\n segment: paramMatches[2],\n routeKeys,\n keyPrefix,\n backreferenceDuplicateKeys,\n })\n\n // Remove the leading slash if includePrefix already added it.\n let s = pattern\n if (includePrefix && paramMatches[1]) {\n s = s.substring(1)\n }\n\n segments.push(s)\n inverseParts.push(\n `/:${reference.names[key] ?? cleanedKey}${repeat ? (optional ? '*' : '+') : ''}`\n )\n reference.names[key] ??= cleanedKey\n } else {\n segments.push(`/${escapeStringRegexp(segment)}`)\n inverseParts.push(`/${segment}`)\n }\n\n // If there's a suffix, add it to the segments if it's enabled.\n if (includeSuffix && paramMatches && paramMatches[3]) {\n segments.push(escapeStringRegexp(paramMatches[3]))\n inverseParts.push(paramMatches[3])\n }\n }\n\n return {\n namedParameterizedRoute: segments.join(''),\n routeKeys,\n pathToRegexpPattern: inverseParts.join(''),\n reference,\n }\n}\n\n/**\n * This function extends `getRouteRegex` generating also a named regexp where\n * each group is named along with a routeKeys object that indexes the assigned\n * named group with its corresponding key. When the routeKeys need to be\n * prefixed to uniquely identify internally the \"prefixRouteKey\" arg should\n * be \"true\" currently this is only the case when creating the routes-manifest\n * during the build\n */\nexport function getNamedRouteRegex(\n normalizedRoute: string,\n options: GetNamedRouteRegexOptions\n) {\n const result = getNamedParametrizedRoute(\n normalizedRoute,\n options.prefixRouteKeys,\n options.includeSuffix ?? false,\n options.includePrefix ?? false,\n options.backreferenceDuplicateKeys ?? false,\n options.reference\n )\n\n let namedRegex = result.namedParameterizedRoute\n if (!options.excludeOptionalTrailingSlash) {\n namedRegex += '(?:/)?'\n }\n\n return {\n ...getRouteRegex(normalizedRoute, options),\n namedRegex: `^${namedRegex}$`,\n routeKeys: result.routeKeys,\n pathToRegexpPattern: result.pathToRegexpPattern,\n reference: result.reference,\n }\n}\n\n/**\n * Generates a named regexp.\n * This is intended to be using for build time only.\n */\nexport function getNamedMiddlewareRegex(\n normalizedRoute: string,\n options: {\n catchAll?: boolean\n }\n) {\n const { parameterizedRoute } = getParametrizedRoute(\n normalizedRoute,\n false,\n false\n )\n const { catchAll = true } = options\n if (parameterizedRoute === '/') {\n let catchAllRegex = catchAll ? '.*' : ''\n return {\n namedRegex: `^/${catchAllRegex}$`,\n }\n }\n\n const { namedParameterizedRoute } = getNamedParametrizedRoute(\n normalizedRoute,\n false,\n false,\n false,\n false,\n undefined\n )\n let catchAllGroupedRegex = catchAll ? '(?:(/.*)?)' : ''\n return {\n namedRegex: `^${namedParameterizedRoute}${catchAllGroupedRegex}$`,\n }\n}\n"],"names":["NEXT_INTERCEPTION_MARKER_PREFIX","NEXT_QUERY_PARAM_PREFIX","INTERCEPTION_ROUTE_MARKERS","escapeStringRegexp","removeTrailingSlash","PARAMETER_PATTERN","parseMatchedParameter","getParametrizedRoute","route","includeSuffix","includePrefix","groups","groupIndex","segments","segment","slice","split","markerMatch","find","m","startsWith","paramMatches","match","key","optional","repeat","pos","push","s","substring","parameterizedRoute","join","getRouteRegex","normalizedRoute","excludeOptionalTrailingSlash","re","RegExp","buildGetSafeRouteKey","i","routeKey","j","String","fromCharCode","Math","floor","getSafeKeyFromSegment","interceptionMarker","getSafeRouteKey","routeKeys","keyPrefix","backreferenceDuplicateKeys","cleanedKey","replace","invalidKey","length","isNaN","parseInt","duplicateKey","interceptionPrefix","pattern","getNamedParametrizedRoute","prefixRouteKeys","reference","names","intercepted","inverseParts","structuredClone","hasInterceptionMarker","some","undefined","namedParameterizedRoute","pathToRegexpPattern","getNamedRouteRegex","options","result","namedRegex","getNamedMiddlewareRegex","catchAll","catchAllRegex","catchAllGroupedRegex"],"mappings":"AAAA,SACEA,+BAA+B,EAC/BC,uBAAuB,QAClB,4BAA2B;AAClC,SAASC,0BAA0B,QAAQ,wBAAuB;AAClE,SAASC,kBAAkB,QAAQ,sBAAqB;AACxD,SAASC,mBAAmB,QAAQ,0BAAyB;AAC7D,SAASC,iBAAiB,EAAEC,qBAAqB,QAAQ,sBAAqB;AAqF9E,SAASC,qBACPC,KAAa,EACbC,aAAsB,EACtBC,aAAsB;IAEtB,MAAMC,SAAyC,CAAC;IAChD,IAAIC,aAAa;IAEjB,MAAMC,WAAqB,EAAE;IAC7B,KAAK,MAAMC,WAAWV,oBAAoBI,OAAOO,KAAK,CAAC,GAAGC,KAAK,CAAC,KAAM;QACpE,MAAMC,cAAcf,2BAA2BgB,IAAI,CAAC,CAACC,IACnDL,QAAQM,UAAU,CAACD;QAErB,MAAME,eAAeP,QAAQQ,KAAK,CAACjB,mBAAmB,uBAAuB;;QAE7E,IAAIY,eAAeI,gBAAgBA,YAAY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,SAAS;IAC7B;AACF;AAEA;;;CAGC,GACD,OAAO,SAASc,wBACd3C,eAAuB,EACvBwC,OAEC;IAED,MAAM,EAAE3C,kBAAkB,EAAE,GAAGvB,qBAC7B0B,iBACA,OACA;IAEF,MAAM,EAAE4C,WAAW,IAAI,EAAE,GAAGJ;IAC5B,IAAI3C,uBAAuB,KAAK;QAC9B,IAAIgD,gBAAgBD,WAAW,OAAO;QACtC,OAAO;YACLF,YAAY,CAAC,EAAE,EAAEG,cAAc,CAAC,CAAC;QACnC;IACF;IAEA,MAAM,EAAER,uBAAuB,EAAE,GAAGV,0BAClC3B,iBACA,OACA,OACA,OACA,OACAoC;IAEF,IAAIU,uBAAuBF,WAAW,eAAe;IACrD,OAAO;QACLF,YAAY,CAAC,CAAC,EAAEL,0BAA0BS,qBAAqB,CAAC,CAAC;IACnE;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/sortable-routes.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/sortable-routes.js new file mode 100644 index 0000000000000000000000000000000000000000..682be3936ecbf604bebdcb978ad1aa4b51a62ebc --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/sortable-routes.js @@ -0,0 +1,213 @@ +/** + * A route that can be sorted by specificity. + */ /** + * Determines the specificity of a route segment for sorting purposes. + * + * In Next.js routing, more specific routes should match before less specific ones. + * This function returns a numeric value where lower numbers indicate higher specificity. + * + * Specificity order (most to least specific): + * 1. Static segments (e.g., "about", "api") - return 0 + * 2. Dynamic segments (e.g., "[id]", "[slug]") - return 1 + * 3. Catch-all segments (e.g., "[...slug]") - return 2 + * 4. Optional catch-all segments (e.g., "[[...slug]]") - return 3 + * + * @param segment - A single path segment (e.g., "api", "[id]", "[...slug]") + * @returns A numeric specificity value (0-3, where 0 is most specific) + */ export function getSegmentSpecificity(segment) { + // Static segments are most specific - they match exactly one path + if (!segment.includes('[')) { + return 0; + } + // Optional catch-all [[...param]] is least specific - matches zero or more segments + if (segment.startsWith('[[...') && segment.endsWith(']]')) { + return 3; + } + // Catch-all [...param] is less specific - matches one or more segments + if (segment.startsWith('[...') && segment.endsWith(']')) { + return 2; + } + // Regular dynamic [param] is more specific than catch-all - matches exactly one segment + if (segment.startsWith('[') && segment.endsWith(']')) { + return 1; + } + // Default to static (fallback case) + return 0; +} +/** + * Compares two route paths using a depth-first traversal approach. + * + * This function implements a deterministic comparison that sorts routes by specificity: + * 1. More specific routes come first (fewer dynamic segments) + * 2. Shorter routes are more specific than longer ones + * 3. Routes with same specificity are sorted lexicographically + * + * The comparison is done segment by segment, left to right, similar to how + * you would traverse a route tree in depth-first order. + * + * @param pathA - First route path to compare (e.g., "/api/users/[id]") + * @param pathB - Second route path to compare (e.g., "/api/[...slug]") + * @returns Negative if pathA is more specific, positive if pathB is more specific, 0 if equal + */ export function compareRouteSegments(pathA, pathB) { + // Split paths into segments, removing empty strings from leading/trailing slashes + const segmentsA = pathA.split('/').filter(Boolean); + const segmentsB = pathB.split('/').filter(Boolean); + // Compare segment by segment up to the length of the longer path + const maxLength = Math.max(segmentsA.length, segmentsB.length); + for(let i = 0; i < maxLength; i++){ + const segA = segmentsA[i] || ''; + const segB = segmentsB[i] || ''; + // Handle length differences: shorter routes are MORE specific + // Example: "/api" is more specific than "/api/users" + if (!segA && segB) return -1 // pathA is shorter, so more specific + ; + if (segA && !segB) return 1 // pathB is shorter, so more specific + ; + if (!segA && !segB) return 0 // Both paths ended, they're equal + ; + // Compare segment specificity using our specificity scoring + const specificityA = getSegmentSpecificity(segA); + const specificityB = getSegmentSpecificity(segB); + // Lower specificity number = more specific route + // Example: "api" (0) vs "[slug]" (1) - "api" wins + if (specificityA !== specificityB) { + return specificityA - specificityB; + } + // If segments have same specificity, compare lexicographically for determinism + // Example: "[id]" vs "[slug]" - "[id]" comes first alphabetically + if (segA !== segB) { + return segA.localeCompare(segB); + } + // Segments are identical, continue to next segment + } + // All segments compared equally + return 0; +} +/** + * Compares two complete routes for sorting purposes. + * + * Routes are compared with a two-tier priority system: + * 1. Primary: Compare by source path specificity + * 2. Secondary: If sources are equal, compare by page path specificity + * + * This ensures that routes are primarily organized by their source patterns, + * with page-specific variations grouped together. + * + * @param a - First route to compare + * @param b - Second route to compare + * @returns Negative if route a should come first, positive if route b should come first, 0 if equal + */ function compareSortableRoutes(a, b) { + // First compare by source specificity - this is the primary sorting criterion + // Source represents the original route pattern and takes precedence + const sourceResult = compareRouteSegments(a.sourcePage, b.sourcePage); + if (sourceResult !== 0) return sourceResult; + // If sources are identical, compare by page specificity as a tiebreaker + // Page represents the final rendered route and provides secondary ordering + return compareRouteSegments(a.page, b.page); +} +/** + * Sorts an array of routes by specificity using a deterministic depth-first traversal approach. + * + * This function implements Next.js route matching priority where more specific routes + * should be matched before less specific ones. The sorting is deterministic and stable, + * meaning identical inputs will always produce identical outputs. + * + * Sorting criteria (in order of priority): + * 1. Source path specificity (primary) + * 2. Page path specificity (secondary) + * 3. Lexicographic ordering (tertiary, for determinism) + * + * Examples of specificity order: + * - "/api/users" (static) comes before "/api/[slug]" (dynamic) + * - "/api/[id]" (dynamic) comes before "/api/[...slug]" (catch-all) + * - "/api/[...slug]" (catch-all) comes before "/api/[[...slug]]" (optional catch-all) + * + * @param routes - Array of routes to sort + * @returns New sorted array (does not mutate input) + */ export function sortSortableRoutes(routes) { + // Because sort is always in-place, we need to create a shallow copy to avoid + // mutating the input array. + return [ + ...routes + ].sort(compareSortableRoutes); +} +/** + * Sorts an array of pages by specificity using a deterministic depth-first + * traversal approach. + * + * @param pages - Array of pages to sort + * @returns New sorted array (does not mutate input) + */ export function sortPages(pages) { + // Because sort is always in-place, we need to create a shallow copy to avoid + // mutating the input array. + return [ + ...pages + ].sort(compareRouteSegments); +} +/** + * Sorts an object by specificity of the keys using a deterministic depth-first traversal approach. + * + * @param obj - object of pages to sort + * @returns New sorted object (does not mutate input) + */ export function sortPagesObject(obj) { + // Because sort is always in-place, we need to create a shallow copy to avoid + // mutating the input. + return Object.keys(obj).sort(compareRouteSegments).reduce((acc, key)=>{ + acc[key] = obj[key]; + return acc; + }, {}); +} +/** + * Sorts an array of objects by sourcePage and page using a deterministic + * depth-first traversal approach. + * + * @param objects - Array of objects to sort + * @param getter - Function to get the sourcePage and page from an object + * @returns New sorted array (does not mutate input) + */ export function sortSortableRouteObjects(objects, getter) { + // Create a SortableRoute for each object. + const routes = []; + for (const object of objects){ + const route = getter(object); + routes.push({ + ...route, + object + }); + } + // In-place sort the SortableRoutes. + routes.sort(compareSortableRoutes); + // Map the sorted SortableRoutes back to the original objects. + return routes.map(({ object })=>object); +} +/** + * Sorts an array of objects by page using a deterministic depth-first traversal + * approach. + * + * @param objects - Array of objects to sort + * @param getter - Function to get the page from an object + * @returns New sorted array (does not mutate input) + */ export function sortPageObjects(objects, getter) { + const indexes = {}; + const pages = new Set(); + for(let i = 0; i < objects.length; i++){ + const object = objects[i]; + const page = getter(object); + indexes[page]?.push(i) || (indexes[page] = [ + i + ]); + pages.add(page); + } + // Sort the unique pages. + const sortedPages = Array.from(pages).sort(compareRouteSegments); + // Map the sorted pages back to the original objects. + return sortedPages.reduce((sortedObjects, page)=>{ + // Add all objects for this page to the sorted array. + for (const i of indexes[page]){ + sortedObjects.push(objects[i]); + } + // Return the sorted array. + return sortedObjects; + }, []); +} + +//# sourceMappingURL=sortable-routes.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/sortable-routes.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/sortable-routes.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f138b4067cef026a2f410bf08d8df1fe5ce980b3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/sortable-routes.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/sortable-routes.ts"],"sourcesContent":["/**\n * A route that can be sorted by specificity.\n */\nexport type SortableRoute = {\n /**\n * The source page of the route. This represents the original page that's on\n * disk. For example, the `app/[lang]/[...rest]/page.tsx` would have a source\n * page of '/[lang]/[...rest]'.\n */\n readonly sourcePage: string\n\n /**\n * The page of the route. This represents the final rendered route. For\n * example, the `app/[lang]/[...rest]/page.tsx` that was rendered with a lang\n * value of `en` would have a page of '/en/[...rest]'.\n */\n readonly page: string\n}\n\n/**\n * Determines the specificity of a route segment for sorting purposes.\n *\n * In Next.js routing, more specific routes should match before less specific ones.\n * This function returns a numeric value where lower numbers indicate higher specificity.\n *\n * Specificity order (most to least specific):\n * 1. Static segments (e.g., \"about\", \"api\") - return 0\n * 2. Dynamic segments (e.g., \"[id]\", \"[slug]\") - return 1\n * 3. Catch-all segments (e.g., \"[...slug]\") - return 2\n * 4. Optional catch-all segments (e.g., \"[[...slug]]\") - return 3\n *\n * @param segment - A single path segment (e.g., \"api\", \"[id]\", \"[...slug]\")\n * @returns A numeric specificity value (0-3, where 0 is most specific)\n */\nexport function getSegmentSpecificity(segment: string): number {\n // Static segments are most specific - they match exactly one path\n if (!segment.includes('[')) {\n return 0\n }\n\n // Optional catch-all [[...param]] is least specific - matches zero or more segments\n if (segment.startsWith('[[...') && segment.endsWith(']]')) {\n return 3\n }\n\n // Catch-all [...param] is less specific - matches one or more segments\n if (segment.startsWith('[...') && segment.endsWith(']')) {\n return 2\n }\n\n // Regular dynamic [param] is more specific than catch-all - matches exactly one segment\n if (segment.startsWith('[') && segment.endsWith(']')) {\n return 1\n }\n\n // Default to static (fallback case)\n return 0\n}\n\n/**\n * Compares two route paths using a depth-first traversal approach.\n *\n * This function implements a deterministic comparison that sorts routes by specificity:\n * 1. More specific routes come first (fewer dynamic segments)\n * 2. Shorter routes are more specific than longer ones\n * 3. Routes with same specificity are sorted lexicographically\n *\n * The comparison is done segment by segment, left to right, similar to how\n * you would traverse a route tree in depth-first order.\n *\n * @param pathA - First route path to compare (e.g., \"/api/users/[id]\")\n * @param pathB - Second route path to compare (e.g., \"/api/[...slug]\")\n * @returns Negative if pathA is more specific, positive if pathB is more specific, 0 if equal\n */\nexport function compareRouteSegments(pathA: string, pathB: string): number {\n // Split paths into segments, removing empty strings from leading/trailing slashes\n const segmentsA = pathA.split('/').filter(Boolean)\n const segmentsB = pathB.split('/').filter(Boolean)\n\n // Compare segment by segment up to the length of the longer path\n const maxLength = Math.max(segmentsA.length, segmentsB.length)\n\n for (let i = 0; i < maxLength; i++) {\n const segA = segmentsA[i] || ''\n const segB = segmentsB[i] || ''\n\n // Handle length differences: shorter routes are MORE specific\n // Example: \"/api\" is more specific than \"/api/users\"\n if (!segA && segB) return -1 // pathA is shorter, so more specific\n if (segA && !segB) return 1 // pathB is shorter, so more specific\n if (!segA && !segB) return 0 // Both paths ended, they're equal\n\n // Compare segment specificity using our specificity scoring\n const specificityA = getSegmentSpecificity(segA)\n const specificityB = getSegmentSpecificity(segB)\n\n // Lower specificity number = more specific route\n // Example: \"api\" (0) vs \"[slug]\" (1) - \"api\" wins\n if (specificityA !== specificityB) {\n return specificityA - specificityB\n }\n\n // If segments have same specificity, compare lexicographically for determinism\n // Example: \"[id]\" vs \"[slug]\" - \"[id]\" comes first alphabetically\n if (segA !== segB) {\n return segA.localeCompare(segB)\n }\n\n // Segments are identical, continue to next segment\n }\n\n // All segments compared equally\n return 0\n}\n\n/**\n * Compares two complete routes for sorting purposes.\n *\n * Routes are compared with a two-tier priority system:\n * 1. Primary: Compare by source path specificity\n * 2. Secondary: If sources are equal, compare by page path specificity\n *\n * This ensures that routes are primarily organized by their source patterns,\n * with page-specific variations grouped together.\n *\n * @param a - First route to compare\n * @param b - Second route to compare\n * @returns Negative if route a should come first, positive if route b should come first, 0 if equal\n */\nfunction compareSortableRoutes(a: SortableRoute, b: SortableRoute): number {\n // First compare by source specificity - this is the primary sorting criterion\n // Source represents the original route pattern and takes precedence\n const sourceResult = compareRouteSegments(a.sourcePage, b.sourcePage)\n if (sourceResult !== 0) return sourceResult\n\n // If sources are identical, compare by page specificity as a tiebreaker\n // Page represents the final rendered route and provides secondary ordering\n return compareRouteSegments(a.page, b.page)\n}\n\n/**\n * Sorts an array of routes by specificity using a deterministic depth-first traversal approach.\n *\n * This function implements Next.js route matching priority where more specific routes\n * should be matched before less specific ones. The sorting is deterministic and stable,\n * meaning identical inputs will always produce identical outputs.\n *\n * Sorting criteria (in order of priority):\n * 1. Source path specificity (primary)\n * 2. Page path specificity (secondary)\n * 3. Lexicographic ordering (tertiary, for determinism)\n *\n * Examples of specificity order:\n * - \"/api/users\" (static) comes before \"/api/[slug]\" (dynamic)\n * - \"/api/[id]\" (dynamic) comes before \"/api/[...slug]\" (catch-all)\n * - \"/api/[...slug]\" (catch-all) comes before \"/api/[[...slug]]\" (optional catch-all)\n *\n * @param routes - Array of routes to sort\n * @returns New sorted array (does not mutate input)\n */\nexport function sortSortableRoutes(\n routes: readonly SortableRoute[]\n): readonly SortableRoute[] {\n // Because sort is always in-place, we need to create a shallow copy to avoid\n // mutating the input array.\n return [...routes].sort(compareSortableRoutes)\n}\n\n/**\n * Sorts an array of pages by specificity using a deterministic depth-first\n * traversal approach.\n *\n * @param pages - Array of pages to sort\n * @returns New sorted array (does not mutate input)\n */\nexport function sortPages(pages: readonly string[]): readonly string[] {\n // Because sort is always in-place, we need to create a shallow copy to avoid\n // mutating the input array.\n return [...pages].sort(compareRouteSegments)\n}\n\n/**\n * Sorts an object by specificity of the keys using a deterministic depth-first traversal approach.\n *\n * @param obj - object of pages to sort\n * @returns New sorted object (does not mutate input)\n */\nexport function sortPagesObject<T>(\n obj: Readonly<Record<string, T>>\n): Record<string, T> {\n // Because sort is always in-place, we need to create a shallow copy to avoid\n // mutating the input.\n return Object.keys(obj)\n .sort(compareRouteSegments)\n .reduce(\n (acc, key) => {\n acc[key] = obj[key]\n return acc\n },\n {} as Record<string, T>\n )\n}\n\n/**\n * Sorts an array of objects by sourcePage and page using a deterministic\n * depth-first traversal approach.\n *\n * @param objects - Array of objects to sort\n * @param getter - Function to get the sourcePage and page from an object\n * @returns New sorted array (does not mutate input)\n */\nexport function sortSortableRouteObjects<T>(\n objects: readonly T[],\n getter: (object: T) => SortableRoute\n): readonly T[] {\n // Create a SortableRoute for each object.\n const routes: Array<SortableRoute & { object: T }> = []\n for (const object of objects) {\n const route = getter(object)\n routes.push({ ...route, object })\n }\n\n // In-place sort the SortableRoutes.\n routes.sort(compareSortableRoutes)\n\n // Map the sorted SortableRoutes back to the original objects.\n return routes.map(({ object }) => object)\n}\n\n/**\n * Sorts an array of objects by page using a deterministic depth-first traversal\n * approach.\n *\n * @param objects - Array of objects to sort\n * @param getter - Function to get the page from an object\n * @returns New sorted array (does not mutate input)\n */\nexport function sortPageObjects<T>(\n objects: readonly T[],\n getter: (object: T) => string\n): readonly T[] {\n const indexes: Record<string, number[]> = {}\n const pages: Set<string> = new Set()\n for (let i = 0; i < objects.length; i++) {\n const object = objects[i]\n const page = getter(object)\n indexes[page]?.push(i) || (indexes[page] = [i])\n pages.add(page)\n }\n\n // Sort the unique pages.\n const sortedPages = Array.from(pages).sort(compareRouteSegments)\n\n // Map the sorted pages back to the original objects.\n return sortedPages.reduce<T[]>((sortedObjects, page) => {\n // Add all objects for this page to the sorted array.\n for (const i of indexes[page]) {\n sortedObjects.push(objects[i])\n }\n\n // Return the sorted array.\n return sortedObjects\n }, [])\n}\n"],"names":["getSegmentSpecificity","segment","includes","startsWith","endsWith","compareRouteSegments","pathA","pathB","segmentsA","split","filter","Boolean","segmentsB","maxLength","Math","max","length","i","segA","segB","specificityA","specificityB","localeCompare","compareSortableRoutes","a","b","sourceResult","sourcePage","page","sortSortableRoutes","routes","sort","sortPages","pages","sortPagesObject","obj","Object","keys","reduce","acc","key","sortSortableRouteObjects","objects","getter","object","route","push","map","sortPageObjects","indexes","Set","add","sortedPages","Array","from","sortedObjects"],"mappings":"AAAA;;CAEC,GAiBD;;;;;;;;;;;;;;CAcC,GACD,OAAO,SAASA,sBAAsBC,OAAe;IACnD,kEAAkE;IAClE,IAAI,CAACA,QAAQC,QAAQ,CAAC,MAAM;QAC1B,OAAO;IACT;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AKA;AACpC;AAEA;;;;;;;CAOC,GACD,OAAO,SAASI,gBACdN,OAAqB,EACrBC,MAA6B;IAE7B,MAAMM,UAAoC,CAAC;IAC3C,MAAMhB,QAAqB,IAAIiB;IAC/B,IAAK,IAAIjC,IAAI,GAAGA,IAAIyB,QAAQ1B,MAAM,EAAEC,IAAK;QACvC,MAAM2B,SAASF,OAAO,CAACzB,EAAE;QACzB,MAAMW,OAAOe,OAAOC;QACpBK,OAAO,CAACrB,KAAK,EAAEkB,KAAK7B,MAAOgC,CAAAA,OAAO,CAACrB,KAAK,GAAG;YAACX;SAAE,AAAD;QAC7CgB,MAAMkB,GAAG,CAACvB;IACZ;IAEA,yBAAyB;IACzB,MAAMwB,cAAcC,MAAMC,IAAI,CAACrB,OAAOF,IAAI,CAAC1B;IAE3C,qDAAqD;IACrD,OAAO+C,YAAYd,MAAM,CAAM,CAACiB,eAAe3B;QAC7C,qDAAqD;QACrD,KAAK,MAAMX,KAAKgC,OAAO,CAACrB,KAAK,CAAE;YAC7B2B,cAAcT,IAAI,CAACJ,OAAO,CAACzB,EAAE;QAC/B;QAEA,2BAA2B;QAC3B,OAAOsC;IACT,GAAG,EAAE;AACP","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/sorted-routes.js b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/sorted-routes.js new file mode 100644 index 0000000000000000000000000000000000000000..63e650e8a16154fcf0c54efc935a68924c06fdcb --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/sorted-routes.js @@ -0,0 +1,182 @@ +class UrlNode { + insert(urlPath) { + this._insert(urlPath.split('/').filter(Boolean), [], false); + } + smoosh() { + return this._smoosh(); + } + _smoosh(prefix = '/') { + const childrenPaths = [ + ...this.children.keys() + ].sort(); + if (this.slugName !== null) { + childrenPaths.splice(childrenPaths.indexOf('[]'), 1); + } + if (this.restSlugName !== null) { + childrenPaths.splice(childrenPaths.indexOf('[...]'), 1); + } + if (this.optionalRestSlugName !== null) { + childrenPaths.splice(childrenPaths.indexOf('[[...]]'), 1); + } + const routes = childrenPaths.map((c)=>this.children.get(c)._smoosh(`${prefix}${c}/`)).reduce((prev, curr)=>[ + ...prev, + ...curr + ], []); + if (this.slugName !== null) { + routes.push(...this.children.get('[]')._smoosh(`${prefix}[${this.slugName}]/`)); + } + if (!this.placeholder) { + const r = prefix === '/' ? '/' : prefix.slice(0, -1); + if (this.optionalRestSlugName != null) { + throw new Error(`You cannot define a route with the same specificity as a optional catch-all route ("${r}" and "${r}[[...${this.optionalRestSlugName}]]").`); + } + routes.unshift(r); + } + if (this.restSlugName !== null) { + routes.push(...this.children.get('[...]')._smoosh(`${prefix}[...${this.restSlugName}]/`)); + } + if (this.optionalRestSlugName !== null) { + routes.push(...this.children.get('[[...]]')._smoosh(`${prefix}[[...${this.optionalRestSlugName}]]/`)); + } + return routes; + } + _insert(urlPaths, slugNames, isCatchAll) { + if (urlPaths.length === 0) { + this.placeholder = false; + return; + } + if (isCatchAll) { + throw new Error(`Catch-all must be the last part of the URL.`); + } + // The next segment in the urlPaths list + let nextSegment = urlPaths[0]; + // Check if the segment matches `[something]` + if (nextSegment.startsWith('[') && nextSegment.endsWith(']')) { + // Strip `[` and `]`, leaving only `something` + let segmentName = nextSegment.slice(1, -1); + let isOptional = false; + if (segmentName.startsWith('[') && segmentName.endsWith(']')) { + // Strip optional `[` and `]`, leaving only `something` + segmentName = segmentName.slice(1, -1); + isOptional = true; + } + if (segmentName.startsWith('…')) { + throw new Error(`Detected a three-dot character ('…') at ('${segmentName}'). Did you mean ('...')?`); + } + if (segmentName.startsWith('...')) { + // Strip `...`, leaving only `something` + segmentName = segmentName.substring(3); + isCatchAll = true; + } + if (segmentName.startsWith('[') || segmentName.endsWith(']')) { + throw new Error(`Segment names may not start or end with extra brackets ('${segmentName}').`); + } + if (segmentName.startsWith('.')) { + throw new Error(`Segment names may not start with erroneous periods ('${segmentName}').`); + } + function handleSlug(previousSlug, nextSlug) { + if (previousSlug !== null) { + // If the specific segment already has a slug but the slug is not `something` + // This prevents collisions like: + // pages/[post]/index.js + // pages/[id]/index.js + // Because currently multiple dynamic params on the same segment level are not supported + if (previousSlug !== nextSlug) { + // TODO: This error seems to be confusing for users, needs an error link, the description can be based on above comment. + throw new Error(`You cannot use different slug names for the same dynamic path ('${previousSlug}' !== '${nextSlug}').`); + } + } + slugNames.forEach((slug)=>{ + if (slug === nextSlug) { + throw new Error(`You cannot have the same slug name "${nextSlug}" repeat within a single dynamic path`); + } + if (slug.replace(/\W/g, '') === nextSegment.replace(/\W/g, '')) { + throw new Error(`You cannot have the slug names "${slug}" and "${nextSlug}" differ only by non-word symbols within a single dynamic path`); + } + }); + slugNames.push(nextSlug); + } + if (isCatchAll) { + if (isOptional) { + if (this.restSlugName != null) { + throw new Error(`You cannot use both an required and optional catch-all route at the same level ("[...${this.restSlugName}]" and "${urlPaths[0]}" ).`); + } + handleSlug(this.optionalRestSlugName, segmentName); + // slugName is kept as it can only be one particular slugName + this.optionalRestSlugName = segmentName; + // nextSegment is overwritten to [[...]] so that it can later be sorted specifically + nextSegment = '[[...]]'; + } else { + if (this.optionalRestSlugName != null) { + throw new Error(`You cannot use both an optional and required catch-all route at the same level ("[[...${this.optionalRestSlugName}]]" and "${urlPaths[0]}").`); + } + handleSlug(this.restSlugName, segmentName); + // slugName is kept as it can only be one particular slugName + this.restSlugName = segmentName; + // nextSegment is overwritten to [...] so that it can later be sorted specifically + nextSegment = '[...]'; + } + } else { + if (isOptional) { + throw new Error(`Optional route parameters are not yet supported ("${urlPaths[0]}").`); + } + handleSlug(this.slugName, segmentName); + // slugName is kept as it can only be one particular slugName + this.slugName = segmentName; + // nextSegment is overwritten to [] so that it can later be sorted specifically + nextSegment = '[]'; + } + } + // If this UrlNode doesn't have the nextSegment yet we create a new child UrlNode + if (!this.children.has(nextSegment)) { + this.children.set(nextSegment, new UrlNode()); + } + this.children.get(nextSegment)._insert(urlPaths.slice(1), slugNames, isCatchAll); + } + constructor(){ + this.placeholder = true; + this.children = new Map(); + this.slugName = null; + this.restSlugName = null; + this.optionalRestSlugName = null; + } +} +/** + * @deprecated Use `sortSortableRoutes` or `sortPages` instead. + */ export function getSortedRoutes(normalizedPages) { + // First the UrlNode is created, and every UrlNode can have only 1 dynamic segment + // Eg you can't have pages/[post]/abc.js and pages/[hello]/something-else.js + // Only 1 dynamic segment per nesting level + // So in the case that is test/e2e/dynamic-routing it'll be this: + // pages/[post]/comments.js + // pages/blog/[post]/comment/[id].js + // Both are fine because `pages/[post]` and `pages/blog` are on the same level + // So in this case `UrlNode` created here has `this.slugName === 'post'` + // And since your PR passed through `slugName` as an array basically it'd including it in too many possibilities + // Instead what has to be passed through is the upwards path's dynamic names + const root = new UrlNode(); + // Here the `root` gets injected multiple paths, and insert will break them up into sublevels + normalizedPages.forEach((pagePath)=>root.insert(pagePath)); + // Smoosh will then sort those sublevels up to the point where you get the correct route definition priority + return root.smoosh(); +} +/** + * @deprecated Use `sortSortableRouteObjects` or `sortPageObjects` instead. + */ export function getSortedRouteObjects(objects, getter) { + // We're assuming here that all the pathnames are unique, that way we can + // sort the list and use the index as the key. + const indexes = {}; + const pathnames = []; + for(let i = 0; i < objects.length; i++){ + const pathname = getter(objects[i]); + indexes[pathname] = i; + pathnames[i] = pathname; + } + // Sort the pathnames. + const sorted = getSortedRoutes(pathnames); + // Map the sorted pathnames back to the original objects using the new sorted + // index. + return sorted.map((pathname)=>objects[indexes[pathname]]); +} + +//# sourceMappingURL=sorted-routes.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/sorted-routes.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/sorted-routes.js.map new file mode 100644 index 0000000000000000000000000000000000000000..2750a2a6bb8ff04ae15e488e6a7183b1a3b406e1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/router/utils/sorted-routes.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../../src/shared/lib/router/utils/sorted-routes.ts"],"sourcesContent":["class UrlNode {\n placeholder: boolean = true\n children: Map<string, UrlNode> = new Map()\n slugName: string | null = null\n restSlugName: string | null = null\n optionalRestSlugName: string | null = null\n\n insert(urlPath: string): void {\n this._insert(urlPath.split('/').filter(Boolean), [], false)\n }\n\n smoosh(): string[] {\n return this._smoosh()\n }\n\n private _smoosh(prefix: string = '/'): string[] {\n const childrenPaths = [...this.children.keys()].sort()\n if (this.slugName !== null) {\n childrenPaths.splice(childrenPaths.indexOf('[]'), 1)\n }\n if (this.restSlugName !== null) {\n childrenPaths.splice(childrenPaths.indexOf('[...]'), 1)\n }\n if (this.optionalRestSlugName !== null) {\n childrenPaths.splice(childrenPaths.indexOf('[[...]]'), 1)\n }\n\n const routes = childrenPaths\n .map((c) => this.children.get(c)!._smoosh(`${prefix}${c}/`))\n .reduce((prev, curr) => [...prev, ...curr], [])\n\n if (this.slugName !== null) {\n routes.push(\n ...this.children.get('[]')!._smoosh(`${prefix}[${this.slugName}]/`)\n )\n }\n\n if (!this.placeholder) {\n const r = prefix === '/' ? '/' : prefix.slice(0, -1)\n if (this.optionalRestSlugName != null) {\n throw new Error(\n `You cannot define a route with the same specificity as a optional catch-all route (\"${r}\" and \"${r}[[...${this.optionalRestSlugName}]]\").`\n )\n }\n\n routes.unshift(r)\n }\n\n if (this.restSlugName !== null) {\n routes.push(\n ...this.children\n .get('[...]')!\n ._smoosh(`${prefix}[...${this.restSlugName}]/`)\n )\n }\n\n if (this.optionalRestSlugName !== null) {\n routes.push(\n ...this.children\n .get('[[...]]')!\n ._smoosh(`${prefix}[[...${this.optionalRestSlugName}]]/`)\n )\n }\n\n return routes\n }\n\n private _insert(\n urlPaths: string[],\n slugNames: string[],\n isCatchAll: boolean\n ): void {\n if (urlPaths.length === 0) {\n this.placeholder = false\n return\n }\n\n if (isCatchAll) {\n throw new Error(`Catch-all must be the last part of the URL.`)\n }\n\n // The next segment in the urlPaths list\n let nextSegment = urlPaths[0]\n\n // Check if the segment matches `[something]`\n if (nextSegment.startsWith('[') && nextSegment.endsWith(']')) {\n // Strip `[` and `]`, leaving only `something`\n let segmentName = nextSegment.slice(1, -1)\n\n let isOptional = false\n if (segmentName.startsWith('[') && segmentName.endsWith(']')) {\n // Strip optional `[` and `]`, leaving only `something`\n segmentName = segmentName.slice(1, -1)\n isOptional = true\n }\n\n if (segmentName.startsWith('…')) {\n throw new Error(\n `Detected a three-dot character ('…') at ('${segmentName}'). Did you mean ('...')?`\n )\n }\n\n if (segmentName.startsWith('...')) {\n // Strip `...`, leaving only `something`\n segmentName = segmentName.substring(3)\n isCatchAll = true\n }\n\n if (segmentName.startsWith('[') || segmentName.endsWith(']')) {\n throw new Error(\n `Segment names may not start or end with extra brackets ('${segmentName}').`\n )\n }\n\n if (segmentName.startsWith('.')) {\n throw new Error(\n `Segment names may not start with erroneous periods ('${segmentName}').`\n )\n }\n\n function handleSlug(previousSlug: string | null, nextSlug: string) {\n if (previousSlug !== null) {\n // If the specific segment already has a slug but the slug is not `something`\n // This prevents collisions like:\n // pages/[post]/index.js\n // pages/[id]/index.js\n // Because currently multiple dynamic params on the same segment level are not supported\n if (previousSlug !== nextSlug) {\n // TODO: This error seems to be confusing for users, needs an error link, the description can be based on above comment.\n throw new Error(\n `You cannot use different slug names for the same dynamic path ('${previousSlug}' !== '${nextSlug}').`\n )\n }\n }\n\n slugNames.forEach((slug) => {\n if (slug === nextSlug) {\n throw new Error(\n `You cannot have the same slug name \"${nextSlug}\" repeat within a single dynamic path`\n )\n }\n\n if (slug.replace(/\\W/g, '') === nextSegment.replace(/\\W/g, '')) {\n throw new Error(\n `You cannot have the slug names \"${slug}\" and \"${nextSlug}\" differ only by non-word symbols within a single dynamic path`\n )\n }\n })\n\n slugNames.push(nextSlug)\n }\n\n if (isCatchAll) {\n if (isOptional) {\n if (this.restSlugName != null) {\n throw new Error(\n `You cannot use both an required and optional catch-all route at the same level (\"[...${this.restSlugName}]\" and \"${urlPaths[0]}\" ).`\n )\n }\n\n handleSlug(this.optionalRestSlugName, segmentName)\n // slugName is kept as it can only be one particular slugName\n this.optionalRestSlugName = segmentName\n // nextSegment is overwritten to [[...]] so that it can later be sorted specifically\n nextSegment = '[[...]]'\n } else {\n if (this.optionalRestSlugName != null) {\n throw new Error(\n `You cannot use both an optional and required catch-all route at the same level (\"[[...${this.optionalRestSlugName}]]\" and \"${urlPaths[0]}\").`\n )\n }\n\n handleSlug(this.restSlugName, segmentName)\n // slugName is kept as it can only be one particular slugName\n this.restSlugName = segmentName\n // nextSegment is overwritten to [...] so that it can later be sorted specifically\n nextSegment = '[...]'\n }\n } else {\n if (isOptional) {\n throw new Error(\n `Optional route parameters are not yet supported (\"${urlPaths[0]}\").`\n )\n }\n handleSlug(this.slugName, segmentName)\n // slugName is kept as it can only be one particular slugName\n this.slugName = segmentName\n // nextSegment is overwritten to [] so that it can later be sorted specifically\n nextSegment = '[]'\n }\n }\n\n // If this UrlNode doesn't have the nextSegment yet we create a new child UrlNode\n if (!this.children.has(nextSegment)) {\n this.children.set(nextSegment, new UrlNode())\n }\n\n this.children\n .get(nextSegment)!\n ._insert(urlPaths.slice(1), slugNames, isCatchAll)\n }\n}\n\n/**\n * @deprecated Use `sortSortableRoutes` or `sortPages` instead.\n */\nexport function getSortedRoutes(\n normalizedPages: ReadonlyArray<string>\n): string[] {\n // First the UrlNode is created, and every UrlNode can have only 1 dynamic segment\n // Eg you can't have pages/[post]/abc.js and pages/[hello]/something-else.js\n // Only 1 dynamic segment per nesting level\n\n // So in the case that is test/e2e/dynamic-routing it'll be this:\n // pages/[post]/comments.js\n // pages/blog/[post]/comment/[id].js\n // Both are fine because `pages/[post]` and `pages/blog` are on the same level\n // So in this case `UrlNode` created here has `this.slugName === 'post'`\n // And since your PR passed through `slugName` as an array basically it'd including it in too many possibilities\n // Instead what has to be passed through is the upwards path's dynamic names\n const root = new UrlNode()\n\n // Here the `root` gets injected multiple paths, and insert will break them up into sublevels\n normalizedPages.forEach((pagePath) => root.insert(pagePath))\n // Smoosh will then sort those sublevels up to the point where you get the correct route definition priority\n return root.smoosh()\n}\n\n/**\n * @deprecated Use `sortSortableRouteObjects` or `sortPageObjects` instead.\n */\nexport function getSortedRouteObjects<T>(\n objects: T[],\n getter: (obj: T) => string\n): T[] {\n // We're assuming here that all the pathnames are unique, that way we can\n // sort the list and use the index as the key.\n const indexes: Record<string, number> = {}\n const pathnames: string[] = []\n for (let i = 0; i < objects.length; i++) {\n const pathname = getter(objects[i])\n indexes[pathname] = i\n pathnames[i] = pathname\n }\n\n // Sort the pathnames.\n const sorted = getSortedRoutes(pathnames)\n\n // Map the sorted pathnames back to the original objects using the new sorted\n // index.\n return sorted.map((pathname) => objects[indexes[pathname]])\n}\n"],"names":["UrlNode","insert","urlPath","_insert","split","filter","Boolean","smoosh","_smoosh","prefix","childrenPaths","children","keys","sort","slugName","splice","indexOf","restSlugName","optionalRestSlugName","routes","map","c","get","reduce","prev","curr","push","placeholder","r","slice","Error","unshift","urlPaths","slugNames","isCatchAll","length","nextSegment","startsWith","endsWith","segmentName","isOptional","substring","handleSlug","previousSlug","nextSlug","forEach","slug","replace","has","set","Map","getSortedRoutes","normalizedPages","root","pagePath","getSortedRouteObjects","objects","getter","indexes","pathnames","i","pathname","sorted"],"mappings":"AAAA,MAAMA;IAOJC,OAAOC,OAAe,EAAQ;QAC5B,IAAI,CAACC,OAAO,CAACD,QAAQE,KAAK,CAAC,KAAKC,MAAM,CAACC,UAAU,EAAE,EAAE;IACvD;IAEAC,SAAmB;QACjB,OAAO,IAAI,CAACC,OAAO;IACrB;IAEQA,QAAQC,SAAiB,GAAG,EAAY;QAC9C,MAAMC,gBAAgB;eAAI,IAAI,CAACC,QAAQ,CAACC,IAAI;SAAG,CAACC,IAAI;QACpD,IAAI,IAAI,CAACC,QAAQ,KAAK,MAAM;YAC1BJ,cAAcK,MAAM,CAACL,cAAcM,OAAO,CAAC,OAAO;QACpD;QACA,IAAI,IAAI,CAACC,YAAY,KAAK,MAAM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AACC,EAAE,GAAGC;IACjB;IAEA,sBAAsB;IACtB,MAAMC,SAASX,gBAAgBQ;IAE/B,6EAA6E;IAC7E,SAAS;IACT,OAAOG,OAAO1C,GAAG,CAAC,CAACyC,WAAaL,OAAO,CAACE,OAAO,CAACG,SAAS,CAAC;AAC5D","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/rsc-transport.js b/e-commerce/node_modules/next/dist/esm/shared/lib/rsc-transport.js new file mode 100644 index 0000000000000000000000000000000000000000..55725290f15376dc616eac03e54cc0c5d90051aa --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/rsc-transport.js @@ -0,0 +1,104 @@ +import { PAGE_SEGMENT_KEY } from './segment'; +/** + * Creates the data for a skipped segment: a null `r` marks the position as + * acknowledged by the response, with no output attached (see the note on + * TransportSegmentData). Used by producers for the segments along the path + * from the root down to the rendered subtrees. + */ export function createSkippedSegmentData() { + return { + r: null, + p: true, + v: null + }; +} +/** + * Reads a late-resolving value from a fully-buffered Flight decode via the + * thenable's status. Flight sets `status`/`value` on a row's promise once + * its bytes are processed, and a buffered decode processes every byte + * synchronously, so any row that made it into the payload is readable + * without awaiting. Returns `unresolvedValue` for a row that is pending or + * absent in this decode — e.g. one whose fulfillment landed past a + * truncated shell decode's boundary; that's what scopes a response's + * late-resolving signals to the payload being decoded. Returns + * `rejectedValue` (defaults to `unresolvedValue`) for a rejected row — an + * aborted render errors rows that were still pending when it happened. + * + * Shared by client and server: the client reads buffered prefetch + * responses; the server (collect-segment-data) reads the buffered page + * payload it re-serializes into per-segment responses. + */ export function readFulfilledValue(valueFromServer, unresolvedValue, rejectedValue = unresolvedValue) { + const thenable = valueFromServer; + // Force Flight to unwrap a received-but-not-yet-settled row. + thenable.then(noop, noop); + switch(thenable.status){ + case 'fulfilled': + return thenable.value; + case 'rejected': + return rejectedValue; + // No status yet: the row is still pending, or absent from this decode. + case undefined: + default: + return unresolvedValue; + } +} +const noop = ()=>{}; +/** + * Converts a segment's client/server-internal representation to its wire + * representation. + */ export function segmentToTransportSegment(segment) { + if (typeof segment === 'string') { + return segment; + } + return { + n: segment[0], + t: segment[2], + k: segment[1], + s: segment[3] + }; +} +/** + * Converts a segment's wire representation to the client/server-internal + * `Segment` type. + */ export function transportSegmentToSegment(transportSegment) { + if (typeof transportSegment === 'string') { + return transportSegment; + } + return [ + transportSegment.n, + // `k` may be null when the client is expected to parse the param value + // from the URL (per-segment prefetch responses). Callers that need the + // real value resolve it from the rendered pathname instead of using this + // function (see resolveTransportSegment in decode-server-response); the + // remaining callers are value-insensitive (segment request keys, which + // never include param values) or only see concrete keys. + transportSegment.k ?? '', + transportSegment.t, + transportSegment.s + ]; +} +/** + * Derives a FlightRouterState from a transport tree. Used where the client + * needs a router-state representation of a full response (e.g. the initial + * hydration payload). Render output (`d`) is not carried over. + */ export function transportNodeToFlightRouterState(node, renderedSearch) { + const parallelRoutes = {}; + const children = node.c; + if (children !== undefined) { + for (const [parallelRouteKey, childNode] of children){ + parallelRoutes[parallelRouteKey] = transportNodeToFlightRouterState(childNode, renderedSearch); + } + } + const flightRouterState = [ + transportSegmentToSegment(node.s), + parallelRoutes + ]; + if (node.h !== undefined) { + flightRouterState[4] = node.h; + } + if (flightRouterState[0] === PAGE_SEGMENT_KEY) { + flightRouterState[5] = renderedSearch; + } + return flightRouterState; +} + +//# sourceMappingURL=rsc-transport.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/rsc-transport.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/rsc-transport.js.map new file mode 100644 index 0000000000000000000000000000000000000000..93063a9c348c365fe34b2365d922ccbc7324c13a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/rsc-transport.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/rsc-transport.ts"],"sourcesContent":["import { PAGE_SEGMENT_KEY } from './segment'\n/**\n * The transport format for RSC responses.\n *\n * Every type in this module is prefixed with `Transport` to distinguish the\n * wire format from client-local types (`Segment`, `RouteTree`, `CacheNode`,\n * `FlightRouterState`). Client code converts out of Transport types at the\n * decode boundary and never stores them.\n *\n * A response carries a single tree, anchored at the root segment, where each\n * node has both its identity and (optionally) its render output. Partial\n * responses are expressed per node: the convention across the format is that\n * absence means \"nothing here\" — an omitted `d` means the segment was not\n * rendered as part of the response, an omitted slot key means the response\n * carries no information about that slot.\n */\n\nimport type React from 'react'\nimport type {\n DynamicParamTypesShort,\n FlightRouterState,\n Segment,\n} from './app-router-types'\nimport type { VaryParamsIterable } from './segment-cache/vary-params-decoding'\n\n/**\n * Segment identity on the wire. A string for static segments; an object for\n * dynamic (parameterized) segments.\n *\n * Page segments are always `__PAGE__`. The search params are sent separately,\n * in the response's `q` field.\n */\nexport type TransportSegment = string | TransportDynamicSegment\n\nexport type TransportDynamicSegment = {\n /** name — the param name, e.g. 'id' for [id] */\n n: string\n /** type — dynamic param type */\n t: DynamicParamTypesShort\n /**\n * key — the param value / cache key. null when the client is expected to\n * parse the value from the URL itself, which keeps the response cacheable\n * across param values.\n */\n k: string | null\n /** siblings — static sibling segments at this URL level; null = unknown */\n s: readonly string[] | null\n}\n\n/**\n * Render output for a single segment. Grouped into one object so a node's\n * \"rendered vs skipped\" state is a single presence check. Also used for the\n * head (metadata/viewport), which is output without structure.\n *\n * `r` may be null: the segment was skipped — the response acknowledges its\n * position without rendering anything for it, e.g. a shared layout the\n * client is expected to already have. This is distinct from `d` being absent\n * on the node, which means the response makes no claim about the segment's\n * output at all (the client should fetch it lazily if it doesn't have it).\n */\nexport type TransportSegmentData = {\n /** rsc — the React node for this segment; null = skipped (not rendered) */\n r: React.ReactNode\n /**\n * isPartial — whether anything in the segment's output is not fully\n * resolved: dynamic holes, runtime holes, anything suspended.\n *\n * Navigation responses carry a plain boolean, known at render time. It is\n * a render-wide constant (isPossiblyPartialResponse in\n * create-component-tree.tsx), identical on every node and only\n * conservatively accurate, so the client resolves a boolean-form node's\n * actual partiality from the response-level signal instead (see\n * decodeTransportNode).\n *\n * Per-segment prefetch responses carry the rewindable promise encoding\n * instead: fulfilled = complete, pending forever = partial. Partiality is\n * only discovered there by probing the buffered prerender (a partial\n * segment's probe never resolves, the same way Flight encodes the holes\n * themselves), and the encoding must survive the client's shell\n * double-decode — the response buffer is decoded a second time truncated\n * at the shell byte boundary (`a`), and a fulfillment row that landed past\n * the boundary must read as \"partial\" in that decode. The promise form is\n * only ever read off a fully-buffered decode's thenable status.\n */\n p: boolean | Promise<void>\n /**\n * varyParams — an iterable of the route params this segment's output\n * depends on (one name per yield, deduped). Used by the client router to\n * determine cache key specificity: segments that only access certain\n * params can be reused across navigations where unaccessed params change.\n *\n * Does NOT include root params; those are emitted once at the response\n * level (`r` on the response wrapper) and unioned in by the consumer.\n *\n * - null: tracking was not enabled for this render (e.g., not a\n * prerender). Treat conservatively — assume all params vary.\n * - Drains to empty: segment accesses no params (e.g., client components,\n * or server components that don't read params). Can be shared across\n * all param values.\n * - Drains to non-empty: segment depends on those params. Can only be\n * reused when those specific params match.\n */\n v: VaryParamsIterable | null\n /**\n * staleTime in seconds — present only in per-segment prefetch responses,\n * where staleness is tracked per node. Navigation responses carry\n * staleness at the response level instead (the wrapper's `s` iterable or\n * the Next-Router-Stale-Time header).\n *\n * An async iterable rather than a plain number because the final value is\n * only known late in the stream, and the iterable form survives a\n * truncated/rewound shell decode (read via thenable status from the\n * buffered response). The client takes the last yielded value.\n */\n s?: AsyncIterable<number>\n}\n\n/**\n * Structure of a segment node, independent of whether render output\n * is attached. Shared by both response variants.\n */\ntype TransportNodeShape = {\n /** segment — identity */\n s: TransportSegment\n /** hints — PrefetchHint bitmask; omitted when zero or unknown */\n h?: number\n}\n\n/**\n * A node in a FULL response tree: every node carries data, and slot maps are\n * exhaustive. Produced by full renders: the initial document payload and\n * error payloads. \"Full\" means the response accounts for every node — there\n * is nothing for the client to fetch lazily. Data-level holes\n * (`d.p === true`) and skipped nodes (`d.r === null`) are still possible.\n */\nexport type FullTransportNode = TransportNodeShape & {\n /** data — always present in a full tree */\n d: TransportSegmentData\n /**\n * children — parallel routes; omitted for leaf segments. A Map rather\n * than a plain object because slot names are app-defined; with a plain\n * object, every distinct combination of slot names creates a different\n * hidden class, making keyed access megamorphic.\n */\n c?: Map<string, FullTransportNode>\n}\n\n/**\n * A node in a PARTIAL response tree: produced by navigations, refreshes, and\n * actions — anywhere the server diffs against client state or renders a\n * subset of the route.\n *\n * The client treats the response as an overlay over its current tree:\n *\n * - A node present in the tree is authoritative for that position's identity.\n * - `d` present: the response accounts for this segment. Its output is `d.r`,\n * which may be null when the segment was skipped — not rendered because\n * the client already has it (e.g. a shared layout).\n * - `d` omitted: the response makes no claim about this segment's output.\n * The client keeps what it has, or lazily fetches when it renders (e.g.\n * segments beneath a loading boundary in a non-PPR prefetch).\n * - A slot key omitted from `c` (or `c` omitted): on a skipped node\n * (`d.r === null`), the response carries no information about that slot\n * and the client keeps its subtree untouched. On any other node the\n * subtree is authoritative, so an omitted slot is simply absent.\n * - `h` omitted: on a skipped node, the client keeps its existing hints for\n * the segment; on any other node it means the hints are zero.\n *\n * The client's cache write descends through nodes with `d` omitted (see\n * writeTreeDataIntoCache), so data may appear at any depth below a no-claim\n * node — the identity spine of a per-segment prefetch response is the\n * canonical producer of that shape.\n */\nexport type PartialTransportNode = TransportNodeShape & {\n /** data — omitted when this segment was not rendered in this response */\n d?: TransportSegmentData\n /** children — omitted field or key = no information about those slots */\n c?: Map<string, PartialTransportNode>\n}\n\n/**\n * Shared type for code that walks either variant. Note: FullTransportNode is\n * structurally assignable to PartialTransportNode, so this union collapses\n * to PartialTransportNode for the type checker; the union spelling\n * documents intent.\n */\nexport type TransportNode = FullTransportNode | PartialTransportNode\n\n/**\n * The tree + head bundle of a response.\n */\nexport type FullTransportData = {\n /** tree */\n t: FullTransportNode\n /** head — always present and complete in a full response */\n h: TransportSegmentData\n}\n\nexport type PartialTransportData = {\n t: PartialTransportNode\n /** omitted = this response carries no head (e.g. router-state-only responses) */\n h?: TransportSegmentData\n}\n\nexport type TransportData = FullTransportData | PartialTransportData\n\n/**\n * Creates the data for a skipped segment: a null `r` marks the position as\n * acknowledged by the response, with no output attached (see the note on\n * TransportSegmentData). Used by producers for the segments along the path\n * from the root down to the rendered subtrees.\n */\nexport function createSkippedSegmentData(): TransportSegmentData {\n return { r: null, p: true, v: null }\n}\n\n/**\n * Reads a late-resolving value from a fully-buffered Flight decode via the\n * thenable's status. Flight sets `status`/`value` on a row's promise once\n * its bytes are processed, and a buffered decode processes every byte\n * synchronously, so any row that made it into the payload is readable\n * without awaiting. Returns `unresolvedValue` for a row that is pending or\n * absent in this decode — e.g. one whose fulfillment landed past a\n * truncated shell decode's boundary; that's what scopes a response's\n * late-resolving signals to the payload being decoded. Returns\n * `rejectedValue` (defaults to `unresolvedValue`) for a rejected row — an\n * aborted render errors rows that were still pending when it happened.\n *\n * Shared by client and server: the client reads buffered prefetch\n * responses; the server (collect-segment-data) reads the buffered page\n * payload it re-serializes into per-segment responses.\n */\nexport function readFulfilledValue<T, TFallback>(\n valueFromServer: PromiseLike<T>,\n unresolvedValue: TFallback,\n rejectedValue: T | TFallback = unresolvedValue\n): T | TFallback {\n const thenable = valueFromServer as PromiseLike<T> & {\n status?: string\n value?: T\n }\n // Force Flight to unwrap a received-but-not-yet-settled row.\n thenable.then(noop, noop)\n switch (thenable.status) {\n case 'fulfilled':\n return thenable.value as T\n case 'rejected':\n return rejectedValue\n // No status yet: the row is still pending, or absent from this decode.\n case undefined:\n default:\n return unresolvedValue\n }\n}\n\nconst noop = () => {}\n\n/**\n * Converts a segment's client/server-internal representation to its wire\n * representation.\n */\nexport function segmentToTransportSegment(segment: Segment): TransportSegment {\n if (typeof segment === 'string') {\n return segment\n }\n return {\n n: segment[0],\n t: segment[2],\n k: segment[1],\n s: segment[3],\n }\n}\n\n/**\n * Converts a segment's wire representation to the client/server-internal\n * `Segment` type.\n */\nexport function transportSegmentToSegment(\n transportSegment: TransportSegment\n): Segment {\n if (typeof transportSegment === 'string') {\n return transportSegment\n }\n return [\n transportSegment.n,\n // `k` may be null when the client is expected to parse the param value\n // from the URL (per-segment prefetch responses). Callers that need the\n // real value resolve it from the rendered pathname instead of using this\n // function (see resolveTransportSegment in decode-server-response); the\n // remaining callers are value-insensitive (segment request keys, which\n // never include param values) or only see concrete keys.\n transportSegment.k ?? '',\n transportSegment.t,\n transportSegment.s,\n ]\n}\n\n/**\n * Derives a FlightRouterState from a transport tree. Used where the client\n * needs a router-state representation of a full response (e.g. the initial\n * hydration payload). Render output (`d`) is not carried over.\n */\nexport function transportNodeToFlightRouterState(\n node: TransportNode,\n renderedSearch: string\n): FlightRouterState {\n const parallelRoutes: Record<string, FlightRouterState> = {}\n const children = node.c\n if (children !== undefined) {\n for (const [parallelRouteKey, childNode] of children) {\n parallelRoutes[parallelRouteKey] = transportNodeToFlightRouterState(\n childNode,\n renderedSearch\n )\n }\n }\n const flightRouterState: FlightRouterState = [\n transportSegmentToSegment(node.s),\n parallelRoutes,\n ]\n if (node.h !== undefined) {\n flightRouterState[4] = node.h\n }\n if (flightRouterState[0] === PAGE_SEGMENT_KEY) {\n flightRouterState[5] = renderedSearch\n }\n return flightRouterState\n}\n"],"names":["PAGE_SEGMENT_KEY","createSkippedSegmentData","r","p","v","readFulfilledValue","valueFromServer","unresolvedValue","rejectedValue","thenable","then","noop","status","value","undefined","segmentToTransportSegment","segment","n","t","k","s","transportSegmentToSegment","transportSegment","transportNodeToFlightRouterState","node","renderedSearch","parallelRoutes","children","c","parallelRouteKey","childNode","flightRouterState","h"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,YAAW;AA8M5C;;;;;CAKC,GACD,OAAO,SAASC;IACd,OAAO;QAAEC,GAAG;QAAMC,GAAG;QAAMC,GAAG;IAAK;AACrC;AAEA;;;;;;;;;;;;;;;CAeC,GACD,OAAO,SAASC,mBACdC,eAA+B,EAC/BC,eAA0B,EAC1BC,gBAA+BD,eAAe;IAE9C,MAAME,WAAWH;IAIjB,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;QAC7C+B,iBAAiB,CAAC,EAAE,GAAGN;IACzB;IACA,OAAOM;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/segment-cache/segment-value-encoding.js b/e-commerce/node_modules/next/dist/esm/shared/lib/segment-cache/segment-value-encoding.js new file mode 100644 index 0000000000000000000000000000000000000000..7f41bebd7f92ed2bcab2b4dcb7d9987cfd619a7e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/segment-cache/segment-value-encoding.js @@ -0,0 +1,52 @@ +export const ROOT_SEGMENT_REQUEST_KEY = ''; +export const HEAD_REQUEST_KEY = '/_head'; +export function createSegmentRequestKeyPart(segment) { + if (typeof segment === 'string') { + const safeName = // TODO: FlightRouterState encodes Not Found routes as "/_not-found". + // But params typically don't include the leading slash. We should use + // a different encoding to avoid this special case. + segment === '/_not-found' ? '_not-found' : encodeToFilesystemAndURLSafeString(segment); + // Since this is not a dynamic segment, it's fully encoded. It does not + // need to be "hydrated" with a param value. + return safeName; + } + const name = segment[0]; + const paramType = segment[2]; + const safeName = encodeToFilesystemAndURLSafeString(name); + const encodedName = '$' + paramType + '$' + safeName; + return encodedName; +} +export function appendSegmentRequestKeyPart(parentRequestKey, parallelRouteKey, childRequestKeyPart) { + // Aside from being filesystem safe, segment keys are also designed so that + // each segment and parallel route creates its own subdirectory. Roughly in + // the same shape as the source app directory. This is mostly just for easier + // debugging (you can open up the build folder and navigate the output); if + // we wanted to do we could just use a flat structure. + // Omit the parallel route key for children, since this is the most + // common case. Saves some bytes (and it's what the app directory does). + const slotKey = parallelRouteKey === 'children' ? childRequestKeyPart : `@${encodeToFilesystemAndURLSafeString(parallelRouteKey)}/${childRequestKeyPart}`; + return parentRequestKey + '/' + slotKey; +} +// Define a regex pattern to match the most common characters found in a route +// param. It excludes anything that might not be cross-platform filesystem +// compatible, like |. It does not need to be precise because the fallback is to +// just base64url-encode the whole parameter, which is fine; we just don't do it +// by default for compactness, and for easier debugging. +const simpleParamValueRegex = /^[a-zA-Z0-9\-_@]+$/; +function encodeToFilesystemAndURLSafeString(value) { + if (simpleParamValueRegex.test(value)) { + return value; + } + // If there are any unsafe characters, base64url-encode the entire value. + // We also add a ! prefix so it doesn't collide with the simple case. + const base64url = btoa(value).replace(/\+/g, '-') // Replace '+' with '-' + .replace(/\//g, '_') // Replace '/' with '_' + .replace(/=+$/, '') // Remove trailing '=' + ; + return '!' + base64url; +} +export function convertSegmentPathToStaticExportFilename(segmentPath) { + return `__next${segmentPath.replace(/\//g, '.')}.txt`; +} + +//# sourceMappingURL=segment-value-encoding.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/segment-cache/segment-value-encoding.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/segment-cache/segment-value-encoding.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a59261daec637b5f055bc5045771c316d7fe12e9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/segment-cache/segment-value-encoding.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/segment-cache/segment-value-encoding.ts"],"sourcesContent":["import type { Segment as FlightRouterStateSegment } from '../app-router-types'\n\n// TypeScript trick to simulate opaque types, like in Flow.\ntype Opaque<K, T> = T & { __brand: K }\n\nexport type SegmentRequestKeyPart = Opaque<'SegmentRequestKeyPart', string>\nexport type SegmentRequestKey = Opaque<'SegmentRequestKey', string>\n\nexport const ROOT_SEGMENT_REQUEST_KEY = '' as SegmentRequestKey\n\nexport const HEAD_REQUEST_KEY = '/_head' as SegmentRequestKey\n\nexport function createSegmentRequestKeyPart(\n segment: FlightRouterStateSegment\n): SegmentRequestKeyPart {\n if (typeof segment === 'string') {\n const safeName =\n // TODO: FlightRouterState encodes Not Found routes as \"/_not-found\".\n // But params typically don't include the leading slash. We should use\n // a different encoding to avoid this special case.\n segment === '/_not-found'\n ? '_not-found'\n : encodeToFilesystemAndURLSafeString(segment)\n // Since this is not a dynamic segment, it's fully encoded. It does not\n // need to be \"hydrated\" with a param value.\n return safeName as SegmentRequestKeyPart\n }\n\n const name = segment[0]\n const paramType = segment[2]\n const safeName = encodeToFilesystemAndURLSafeString(name)\n\n const encodedName = '$' + paramType + '$' + safeName\n return encodedName as SegmentRequestKeyPart\n}\n\nexport function appendSegmentRequestKeyPart(\n parentRequestKey: SegmentRequestKey,\n parallelRouteKey: string,\n childRequestKeyPart: SegmentRequestKeyPart\n): SegmentRequestKey {\n // Aside from being filesystem safe, segment keys are also designed so that\n // each segment and parallel route creates its own subdirectory. Roughly in\n // the same shape as the source app directory. This is mostly just for easier\n // debugging (you can open up the build folder and navigate the output); if\n // we wanted to do we could just use a flat structure.\n\n // Omit the parallel route key for children, since this is the most\n // common case. Saves some bytes (and it's what the app directory does).\n const slotKey =\n parallelRouteKey === 'children'\n ? childRequestKeyPart\n : `@${encodeToFilesystemAndURLSafeString(parallelRouteKey)}/${childRequestKeyPart}`\n return (parentRequestKey + '/' + slotKey) as SegmentRequestKey\n}\n\n// Define a regex pattern to match the most common characters found in a route\n// param. It excludes anything that might not be cross-platform filesystem\n// compatible, like |. It does not need to be precise because the fallback is to\n// just base64url-encode the whole parameter, which is fine; we just don't do it\n// by default for compactness, and for easier debugging.\nconst simpleParamValueRegex = /^[a-zA-Z0-9\\-_@]+$/\n\nfunction encodeToFilesystemAndURLSafeString(value: string) {\n if (simpleParamValueRegex.test(value)) {\n return value\n }\n // If there are any unsafe characters, base64url-encode the entire value.\n // We also add a ! prefix so it doesn't collide with the simple case.\n const base64url = btoa(value)\n .replace(/\\+/g, '-') // Replace '+' with '-'\n .replace(/\\//g, '_') // Replace '/' with '_'\n .replace(/=+$/, '') // Remove trailing '='\n return '!' + base64url\n}\n\nexport function convertSegmentPathToStaticExportFilename(\n segmentPath: string\n): string {\n return `__next${segmentPath.replace(/\\//g, '.')}.txt`\n}\n"],"names":["ROOT_SEGMENT_REQUEST_KEY","HEAD_REQUEST_KEY","createSegmentRequestKeyPart","segment","safeName","encodeToFilesystemAndURLSafeString","name","paramType","encodedName","appendSegmentRequestKeyPart","parentRequestKey","parallelRouteKey","childRequestKeyPart","slotKey","simpleParamValueRegex","value","test","base64url","btoa","replace","convertSegmentPathToStaticExportFilename","segmentPath"],"mappings":"AAQA,OAAO,MAAMA,2BAA2B,GAAuB;AAE/D,OAAO,MAAMC,mBAAmB,SAA6B;AAE7D,OAAO,SAASC,4BACdC,OAAiC;IAEjC,IAAI,OAAOA,YAAY,UAAU;QAC/B,MAAMC,WACJ,qEAAqE;QACrE,sEAAsE;QACtE,mDAAmD;QACnDD,YAAY,gBACR,eACAE,mCAAmCF;QACzC,uEAAuE;QACvE,4CAA4C;QAC5C,OAAOC;IACT;IAEA,MAAME,OAAOH,OAAO,CAAC,EAAE;IACvB,MAAMI,YAAYJ,OAAO,CAAC,EAAE;IAC5B,MAAMC,WAAWC,mCAAmCC;IAEpD,MAAME,cAAc,MAAMD,YAAY,MAAMH;IAC5C,OAAOI;AACT;AAEA,OAAO,SAASC,4BACdC,gBAAmC,EACnCC,gBAAwB,EACxBC,mBAA0C;IAE1C,2EAA2E;IAC3E,2EAA2E;IAC3E,6EAA6E;IAC7E,2EAA2E;IAC3E,sDAAsD;IAEtD,mEAAmE;IACnE,wEAAwE;IACxE,MAAMC,UACJF,qBAAqB,aACjBC,sBACA,CAAC,CAAC,EAAEP,mCAAmCM,kBAAkB,CAAC,EAAEC,qBAAqB;IACvF,OAAQF,mBAAmB,MAAMG;AACnC;AAEA,8EAA8E;AAC9E,0EAA0E;AAC1E,gFAAgF;AAChF,gFAAgF;AAChF,wDAAwD;AACxD,MAAMC,wBAAwB;AAE9B,SAAST,mCAAmCU,KAAa;IACvD,IAAID,sBAAsBE,IAAI,CAACD,QAAQ;QACrC,OAAOA;IACT;IACA,yEAAyE;IACzE,qEAAqE;IACrE,MAAME,YAAYC,KAAKH,OACpBI,OAAO,CAAC,OAAO,KAAK,uBAAuB;KAC3CA,OAAO,CAAC,OAAO,KAAK,uBAAuB;KAC3CA,OAAO,CAAC,OAAO,IAAI,sBAAsB;;IAC5C,OAAO,MAAMF;AACf;AAEA,OAAO,SAASG,yCACdC,WAAmB;IAEnB,OAAO,CAAC,MAAM,EAAEA,YAAYF,OAAO,CAAC,OAAO,KAAK,IAAI,CAAC;AACvD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/segment-cache/vary-params-decoding.js b/e-commerce/node_modules/next/dist/esm/shared/lib/segment-cache/vary-params-decoding.js new file mode 100644 index 0000000000000000000000000000000000000000..f536adf9dd8cc86c6d02a1e8189f77536a59c956 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/segment-cache/vary-params-decoding.js @@ -0,0 +1,91 @@ +/** + * Vary Params Decoding + * + * This module is shared between server and client. + */ import { readFulfilledValue } from '../rsc-transport'; +/** + * The vary path id for search params. Path params are identified by their + * name. Search params don't have a fixed set of names, so any access to them + * is reported under this one id, and the segment is keyed by the whole search + * string (see createVaryingSearchParams in app-render/vary-params.ts). + * + * It's a number so it can't collide with a param name. `app/[?]/page.tsx` is a + * valid route. + */ export const SEARCH_PARAMS_VARY_ID = 0; +/** + * Synchronously drains a vary params `AsyncIterable`, adding each yielded name + * to `target`. + * + * By the time this runs (on the client, or in collectSegmentData), the Flight + * stream has been fully buffered, so every yielded value is already + * materialized and can be read without awaiting: each iterator result is a + * Flight chunk whose settled state `readFulfilledValue` reads off the + * thenable's status. + * + * We add "every param yielded up to the point the stream suspends": a + * normally-closed iterable drains fully, while one left hanging (a sync-I/O + * abort, or a `close()` whose row hasn't flushed yet) drains to the prefix + * already in the stream. Both are correct — a segment's param accesses are all + * flushed as they happen during its render, so the prefix is exactly the set + * the response depends on. We therefore never need the terminating `done` row + * to be present; it's only stream hygiene. + */ function drainVaryParams(iterable, target) { + const iterator = iterable[Symbol.asyncIterator](); + while(true){ + const step = readFulfilledValue(iterator.next(), undefined); + if (step === undefined || step.done) { + // Either the stream suspended here — everything yielded before this + // point has already been added — or the iterable finished cleanly. + return; + } + target.add(step.value); + } +} +/** + * Converts a segment's (or the head's) vary params off the wire, at the + * decode boundary, unioning in the response-level root params. + * + * Root params are emitted once at the top level rather than folded into every + * segment by the server, so every decode recombines them here — building the + * merge into the decode means a caller can't forget it, and it's done in a + * single pass with no intermediate set. + * + * Returns null ("unknown", key on all params) unless BOTH iterables are + * present. A null/absent `iterable` means the segment's own tracking wasn't + * enabled (e.g. not a prerender). A null/absent `rootIterable` means root + * params weren't tracked — and since a segment's own iterable never includes + * root params (those are accessed in layouts above it), narrowing on the + * segment set alone would wrongly assume no root params were accessed. In + * either case we stay conservative. + * + * When both are present each is authoritative even when it drains to the empty + * set — a tracked segment that read no params, with no root params accessed, + * can be shared across all param values. + */ export function decodeVaryParams(iterable, rootIterable) { + if (iterable === null || iterable === undefined || rootIterable === null || rootIterable === undefined) { + return null; + } + const total = new Set(); + drainVaryParams(iterable, total); + drainVaryParams(rootIterable, total); + return createVaryParams(total); +} +/** + * Wraps an already-known set as a vary params source. Shaped like a settled + * Flight promise so readVaryParams can read it off the thenable's status. + */ export function createVaryParams(total) { + // TODO: Don't need to use a native promise. Just inline a thenable that + // immediately calls its listener. + const settled = Promise.resolve(total); + settled.status = 'fulfilled'; + settled.value = total; + return settled; +} +/** + * Reads the set from a vary params source. Null when it is not available; + * the reader assumes every param varies. + */ export function readVaryParams(varyParams) { + return readFulfilledValue(varyParams, null); +} + +//# sourceMappingURL=vary-params-decoding.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/segment-cache/vary-params-decoding.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/segment-cache/vary-params-decoding.js.map new file mode 100644 index 0000000000000000000000000000000000000000..636dcacea2056a5c7e2119eed9776a5200f7e066 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/segment-cache/vary-params-decoding.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/segment-cache/vary-params-decoding.ts"],"sourcesContent":["/**\n * Vary Params Decoding\n *\n * This module is shared between server and client.\n */\n\nimport { readFulfilledValue } from '../rsc-transport'\n\n/**\n * The vary path id for search params. Path params are identified by their\n * name. Search params don't have a fixed set of names, so any access to them\n * is reported under this one id, and the segment is keyed by the whole search\n * string (see createVaryingSearchParams in app-render/vary-params.ts).\n *\n * It's a number so it can't collide with a param name. `app/[?]/page.tsx` is a\n * valid route.\n */\nexport const SEARCH_PARAMS_VARY_ID = 0\n\n// Path param names, and SEARCH_PARAMS_VARY_ID for the search params.\nexport type VaryParamId = string | number\n\n/**\n * The params a piece of rendered output depends on — the ids of the vary path\n * nodes it read: path param names, and SEARCH_PARAMS_VARY_ID for the search\n * params — as the source that reports them rather than a snapshot of it.\n *\n * The wire iterables can only be drained from a fully-buffered response; they\n * are drained once at decode into an already-settled thenable, and read at the\n * point a decision needs the set (readVaryParams).\n */\nexport type VaryParams = PromiseLike<Set<VaryParamId>>\n\n/**\n * Vary params are serialized into the Flight stream as an\n * `AsyncIterable<VaryParamId>` that yields each accessed param id exactly once\n * (the server dedupes before emitting). Because each access is flushed into the\n * stream as it happens, there's no step at the end of the render that has to\n * run for the client to read anything. If a prerender is aborted by sync I/O,\n * the params yielded before the abort are already in the stream, and they're\n * exactly the params the partial response actually depends on.\n *\n * Root params are NOT included in a segment's own iterable. They're emitted\n * once at the top level of the response (as a separate iterable) and unioned in\n * by `decodeVaryParams`, because root params can be accessed at any point\n * during the render — folding them into every segment would otherwise require\n * a merge once the whole render is complete.\n */\nexport type VaryParamsIterable = AsyncIterable<VaryParamId>\n\n/**\n * Synchronously drains a vary params `AsyncIterable`, adding each yielded name\n * to `target`.\n *\n * By the time this runs (on the client, or in collectSegmentData), the Flight\n * stream has been fully buffered, so every yielded value is already\n * materialized and can be read without awaiting: each iterator result is a\n * Flight chunk whose settled state `readFulfilledValue` reads off the\n * thenable's status.\n *\n * We add \"every param yielded up to the point the stream suspends\": a\n * normally-closed iterable drains fully, while one left hanging (a sync-I/O\n * abort, or a `close()` whose row hasn't flushed yet) drains to the prefix\n * already in the stream. Both are correct — a segment's param accesses are all\n * flushed as they happen during its render, so the prefix is exactly the set\n * the response depends on. We therefore never need the terminating `done` row\n * to be present; it's only stream hygiene.\n */\nfunction drainVaryParams(\n iterable: VaryParamsIterable,\n target: Set<VaryParamId>\n): void {\n const iterator = iterable[Symbol.asyncIterator]()\n while (true) {\n const step = readFulfilledValue(iterator.next(), undefined)\n if (step === undefined || step.done) {\n // Either the stream suspended here — everything yielded before this\n // point has already been added — or the iterable finished cleanly.\n return\n }\n target.add(step.value)\n }\n}\n\n/**\n * Converts a segment's (or the head's) vary params off the wire, at the\n * decode boundary, unioning in the response-level root params.\n *\n * Root params are emitted once at the top level rather than folded into every\n * segment by the server, so every decode recombines them here — building the\n * merge into the decode means a caller can't forget it, and it's done in a\n * single pass with no intermediate set.\n *\n * Returns null (\"unknown\", key on all params) unless BOTH iterables are\n * present. A null/absent `iterable` means the segment's own tracking wasn't\n * enabled (e.g. not a prerender). A null/absent `rootIterable` means root\n * params weren't tracked — and since a segment's own iterable never includes\n * root params (those are accessed in layouts above it), narrowing on the\n * segment set alone would wrongly assume no root params were accessed. In\n * either case we stay conservative.\n *\n * When both are present each is authoritative even when it drains to the empty\n * set — a tracked segment that read no params, with no root params accessed,\n * can be shared across all param values.\n */\nexport function decodeVaryParams(\n iterable: VaryParamsIterable | null | undefined,\n rootIterable: VaryParamsIterable | null | undefined\n): VaryParams | null {\n if (\n iterable === null ||\n iterable === undefined ||\n rootIterable === null ||\n rootIterable === undefined\n ) {\n return null\n }\n const total: Set<VaryParamId> = new Set()\n drainVaryParams(iterable, total)\n drainVaryParams(rootIterable, total)\n return createVaryParams(total)\n}\n\n/**\n * Wraps an already-known set as a vary params source. Shaped like a settled\n * Flight promise so readVaryParams can read it off the thenable's status.\n */\nexport function createVaryParams(total: Set<VaryParamId>): VaryParams {\n // TODO: Don't need to use a native promise. Just inline a thenable that\n // immediately calls its listener.\n const settled = Promise.resolve(total) as Promise<Set<VaryParamId>> & {\n status: 'fulfilled'\n value: Set<VaryParamId>\n }\n settled.status = 'fulfilled'\n settled.value = total\n return settled\n}\n\n/**\n * Reads the set from a vary params source. Null when it is not available;\n * the reader assumes every param varies.\n */\nexport function readVaryParams(\n varyParams: VaryParams\n): Set<VaryParamId> | null {\n return readFulfilledValue(varyParams, null)\n}\n"],"names":["readFulfilledValue","SEARCH_PARAMS_VARY_ID","drainVaryParams","iterable","target","iterator","Symbol","asyncIterator","step","next","undefined","done","add","value","decodeVaryParams","rootIterable","total","Set","createVaryParams","settled","Promise","resolve","status","readVaryParams","varyParams"],"mappings":"AAAA;;;;CAIC,GAED,SAASA,kBAAkB,QAAQ,mBAAkB;AAErD;;;;;;;;CAQC,GACD,OAAO,MAAMC,wBAAwB,EAAC;AAiCtC;;;;;;;;;;;;;;;;;CAiBC,GACD,SAASC,gBACPC,QAA4B,EAC5BC,MAAwB;IAExB,MAAMC,WAAWF,QAAQ,CAACG,OAAOC,aAAa,CAAC;IAC/C,MAAO,KAAM;QACX,MAAMC,OAAOR,mBAAmBK,SAASI,IAAI,IAAIC;QACjD,IAAIF,SAASE,aAAaF,KAAKG,IAAI,EAAE;YACnC,oEAAoE;YACpE,mEAAmE;YACnE;QACF;QACAP,OAAOQ,GAAG,CAACJ,KAAKK,KAAK;IACvB;AACF;AAEA;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,OAAO,SAASC,iBACdX,QAA+C,EAC/CY,YAAmD;IAEnD,IACEZ,aAAa,QACbA,aAAaO,aACbK,iBAAiB,QACjBA,iBAAiBL,WACjB;QACA,OAAO;IACT;IACA,MAAMM,QAA0B,IAAIC;IACpCf,gBAAgBC,UAAUa;IAC1Bd,gBAAgBa,cAAcC;IAC9B,OAAOE,iBAAiBF;AAC1B;AAEA;;;CAGC,GACD,OAAO,SAASE,iBAAiBF,KAAuB;IACtD,wEAAwE;IACxE,kCAAkC;IAClC,MAAMG,UAAUC,QAAQC,OAAO,CAACL;IAIhCG,QAAQG,MAAM,GAAG;IACjBH,QAAQN,KAAK,GAAGG;IAChB,OAAOG;AACT;AAEA;;;CAGC,GACD,OAAO,SAASI,eACdC,UAAsB;IAEtB,OAAOxB,mBAAmBwB,YAAY;AACxC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/segment.js b/e-commerce/node_modules/next/dist/esm/shared/lib/segment.js new file mode 100644 index 0000000000000000000000000000000000000000..28c5ca3e19ff5835f3b3fffb37fe9ea152912739 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/segment.js @@ -0,0 +1,44 @@ +export function getSegmentValue(segment) { + return Array.isArray(segment) ? segment[1] : segment; +} +export function isGroupSegment(segment) { + // Use array[0] for performant purpose + return segment[0] === '(' && segment.endsWith(')'); +} +export function isParallelRouteSegment(segment) { + return segment.startsWith('@') && segment !== '@children'; +} +export function computeSelectedLayoutSegment(segments, parallelRouteKey) { + if (!segments || segments.length === 0) { + return null; + } + // For 'children', use first segment; for other parallel routes, use last segment + const rawSegment = parallelRouteKey === 'children' ? segments[0] : segments[segments.length - 1]; + // If the default slot is showing, return null since it's not technically "selected" (it's a fallback) + // Returning an internal value like `__DEFAULT__` would be confusing + return rawSegment === DEFAULT_SEGMENT_KEY ? null : rawSegment; +} +/** Get the canonical parameters from the current level to the leaf node. */ export function getSelectedLayoutSegmentPath(tree, parallelRouteKey, first = true, segmentPath = []) { + let node; + if (first) { + // Use the provided parallel route key on the first parallel route + node = tree[1][parallelRouteKey]; + } else { + // After first parallel route prefer children, if there's no children pick the first parallel route. + const parallelRoutes = tree[1]; + node = parallelRoutes.children ?? Object.values(parallelRoutes)[0]; + } + if (!node) return segmentPath; + const segment = node[0]; + let segmentValue = getSegmentValue(segment); + if (!segmentValue || segmentValue === PAGE_SEGMENT_KEY) { + return segmentPath; + } + segmentPath.push(segmentValue); + return getSelectedLayoutSegmentPath(node, parallelRouteKey, false, segmentPath); +} +export const PAGE_SEGMENT_KEY = '__PAGE__'; +export const DEFAULT_SEGMENT_KEY = '__DEFAULT__'; +export const NOT_FOUND_SEGMENT_KEY = '/_not-found'; + +//# sourceMappingURL=segment.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/segment.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/segment.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1e907d7c7b63d307a315b686902f07831ce05ca0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/segment.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/segment.ts"],"sourcesContent":["import type { FlightRouterState, Segment } from './app-router-types'\n\nexport function getSegmentValue(segment: Segment) {\n return Array.isArray(segment) ? segment[1] : segment\n}\n\nexport function isGroupSegment(segment: string) {\n // Use array[0] for performant purpose\n return segment[0] === '(' && segment.endsWith(')')\n}\n\nexport function isParallelRouteSegment(segment: string) {\n return segment.startsWith('@') && segment !== '@children'\n}\n\nexport function computeSelectedLayoutSegment(\n segments: string[] | null,\n parallelRouteKey: string\n): string | null {\n if (!segments || segments.length === 0) {\n return null\n }\n\n // For 'children', use first segment; for other parallel routes, use last segment\n const rawSegment =\n parallelRouteKey === 'children'\n ? segments[0]\n : segments[segments.length - 1]\n\n // If the default slot is showing, return null since it's not technically \"selected\" (it's a fallback)\n // Returning an internal value like `__DEFAULT__` would be confusing\n return rawSegment === DEFAULT_SEGMENT_KEY ? null : rawSegment\n}\n\n/** Get the canonical parameters from the current level to the leaf node. */\nexport function getSelectedLayoutSegmentPath(\n tree: FlightRouterState,\n parallelRouteKey: string,\n first = true,\n segmentPath: string[] = []\n): string[] {\n let node: FlightRouterState\n if (first) {\n // Use the provided parallel route key on the first parallel route\n node = tree[1][parallelRouteKey]\n } else {\n // After first parallel route prefer children, if there's no children pick the first parallel route.\n const parallelRoutes = tree[1]\n node = parallelRoutes.children ?? Object.values(parallelRoutes)[0]\n }\n\n if (!node) return segmentPath\n const segment = node[0]\n\n let segmentValue = getSegmentValue(segment)\n\n if (!segmentValue || segmentValue === PAGE_SEGMENT_KEY) {\n return segmentPath\n }\n\n segmentPath.push(segmentValue)\n\n return getSelectedLayoutSegmentPath(\n node,\n parallelRouteKey,\n false,\n segmentPath\n )\n}\n\nexport const PAGE_SEGMENT_KEY = '__PAGE__'\nexport const DEFAULT_SEGMENT_KEY = '__DEFAULT__'\nexport const NOT_FOUND_SEGMENT_KEY = '/_not-found'\n"],"names":["getSegmentValue","segment","Array","isArray","isGroupSegment","endsWith","isParallelRouteSegment","startsWith","computeSelectedLayoutSegment","segments","parallelRouteKey","length","rawSegment","DEFAULT_SEGMENT_KEY","getSelectedLayoutSegmentPath","tree","first","segmentPath","node","parallelRoutes","children","Object","values","segmentValue","PAGE_SEGMENT_KEY","push","NOT_FOUND_SEGMENT_KEY"],"mappings":"AAEA,OAAO,SAASA,gBAAgBC,OAAgB;IAC9C,OAAOC,MAAMC,OAAO,CAACF,WAAWA,OAAO,CAAC,EAAE,GAAGA;AAC/C;AAEA,OAAO,SAASG,eAAeH,OAAe;IAC5C,sCAAsC;IACtC,OAAOA,OAAO,CAAC,EAAE,KAAK,OAAOA,QAAQI,QAAQ,CAAC;AAChD;AAEA,OAAO,SAASC,uBAAuBL,OAAe;IACpD,OAAOA,QAAQM,UAAU,CAAC,QAAQN,YAAY;AAChD;AAEA,OAAO,SAASO,6BACdC,QAAyB,EACzBC,gBAAwB;IAExB,IAAI,CAACD,YAAYA,SAASE,MAAM,KAAK,GAAG;QACtC,OAAO;IACT;IAEA,iFAAiF;IACjF,MAAMC,aACJF,qBAAqB,aACjBD,QAAQ,CAAC,EAAE,GACXA,QAAQ,CAACA,SAASE,MAAM,GAAG,EAAE;IAEnC,sGAAsG;IACtG,oEAAoE;IACpE,OAAOC,eAAeC,sBAAsB,OAAOD;AACrD;AAEA,0EAA0E,GAC1E,OAAO,SAASE,6BACdC,IAAuB,EACvBL,gBAAwB,EACxBM,QAAQ,IAAI,EACZC,cAAwB,EAAE;IAE1B,IAAIC;IACJ,IAAIF,OAAO;QACT,kEAAkE;QAClEE,OAAOH,IAAI,CAAC,EAAE,CAACL,iBAAiB;IAClC,OAAO;QACL,oGAAoG;QACpG,MAAMS,iBAAiBJ,IAAI,CAAC,EAAE;QAC9BG,OAAOC,eAAeC,QAAQ,IAAIC,OAAOC,MAAM,CAACH,eAAe,CAAC,EAAE;IACpE;IAEA,IAAI,CAACD,MAAM,OAAOD;IAClB,MAAMhB,UAAUiB,IAAI,CAAC,EAAE;IAEvB,IAAIK,eAAevB,gBAAgBC;IAEnC,IAAI,CAACsB,gBAAgBA,iBAAiBC,kBAAkB;QACtD,OAAOP;IACT;IAEAA,YAAYQ,IAAI,CAACF;IAEjB,OAAOT,6BACLI,MACAR,kBACA,OACAO;AAEJ;AAEA,OAAO,MAAMO,mBAAmB,WAAU;AAC1C,OAAO,MAAMX,sBAAsB,cAAa;AAChD,OAAO,MAAMa,wBAAwB,cAAa","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/server-inserted-html.shared-runtime.js b/e-commerce/node_modules/next/dist/esm/shared/lib/server-inserted-html.shared-runtime.js new file mode 100644 index 0000000000000000000000000000000000000000..1c8cd8160fff7ca8bd723b268b645bc3ab9f2ca0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/server-inserted-html.shared-runtime.js @@ -0,0 +1,18 @@ +'use client'; +import React, { useContext } from 'react'; +// Use `React.createContext` to avoid errors from the RSC checks because +// it can't be imported directly in Server Components: +// +// import { createContext } from 'react' +// +// More info: https://github.com/vercel/next.js/pull/40686 +export const ServerInsertedHTMLContext = /*#__PURE__*/ React.createContext(null); +export function useServerInsertedHTML(callback) { + const addInsertedServerHTMLCallback = useContext(ServerInsertedHTMLContext); + // Should have no effects on client where there's no flush effects provider + if (addInsertedServerHTMLCallback) { + addInsertedServerHTMLCallback(callback); + } +} + +//# sourceMappingURL=server-inserted-html.shared-runtime.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/server-inserted-html.shared-runtime.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/server-inserted-html.shared-runtime.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7b12abe718eba7ef1c5b15688d7439489101a886 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/server-inserted-html.shared-runtime.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/server-inserted-html.shared-runtime.tsx"],"sourcesContent":["'use client'\n\nimport React, { useContext } from 'react'\n\nexport type ServerInsertedHTMLHook = (callbacks: () => React.ReactNode) => void\n\n// Use `React.createContext` to avoid errors from the RSC checks because\n// it can't be imported directly in Server Components:\n//\n// import { createContext } from 'react'\n//\n// More info: https://github.com/vercel/next.js/pull/40686\nexport const ServerInsertedHTMLContext =\n React.createContext<ServerInsertedHTMLHook | null>(null as any)\n\nexport function useServerInsertedHTML(callback: () => React.ReactNode): void {\n const addInsertedServerHTMLCallback = useContext(ServerInsertedHTMLContext)\n // Should have no effects on client where there's no flush effects provider\n if (addInsertedServerHTMLCallback) {\n addInsertedServerHTMLCallback(callback)\n }\n}\n"],"names":["React","useContext","ServerInsertedHTMLContext","createContext","useServerInsertedHTML","callback","addInsertedServerHTMLCallback"],"mappings":"AAAA;AAEA,OAAOA,SAASC,UAAU,QAAQ,QAAO;AAIzC,wEAAwE;AACxE,sDAAsD;AACtD,EAAE;AACF,0CAA0C;AAC1C,EAAE;AACF,0DAA0D;AAC1D,OAAO,MAAMC,0CACXF,MAAMG,aAAa,CAAgC,MAAY;AAEjE,OAAO,SAASC,sBAAsBC,QAA+B;IACnE,MAAMC,gCAAgCL,WAAWC;IACjD,2EAA2E;IAC3E,IAAII,+BAA+B;QACjCA,8BAA8BD;IAChC;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/server-reference-info.js b/e-commerce/node_modules/next/dist/esm/shared/lib/server-reference-info.js new file mode 100644 index 0000000000000000000000000000000000000000..e87d79d242227c5cfc33e50cf7cfb8b11560ffef --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/server-reference-info.js @@ -0,0 +1,60 @@ +export const SERVER_REFERENCE_ID_LENGTH = 42; +export function mightBeServerReferenceId(id) { + return id.length === SERVER_REFERENCE_ID_LENGTH; +} +/** + * Extracts info about the server reference for the given server reference ID by + * parsing the first byte of the hex-encoded ID. + * + * ``` + * Bit positions: [7] [6] [5] [4] [3] [2] [1] [0] + * Bits: typeBit argMask restArgs + * ``` + * + * If the `typeBit` is `1` the server reference represents a `"use cache"` + * function, otherwise a server action. + * + * The `argMask` encodes whether the function uses the argument at the + * respective position. + * + * The `restArgs` bit indicates whether the function uses a rest parameter. It's + * also set to 1 if the function has more than 6 args. + * + * @param id hex-encoded server reference ID + */ export function extractInfoFromServerReferenceId(id) { + const infoByte = parseInt(id.slice(0, 2), 16); + const typeBit = infoByte >> 7 & 0x1; + const argMask = infoByte >> 1 & 0x3f; + const restArgs = infoByte & 0x1; + const usedArgs = Array(6); + for(let index = 0; index < 6; index++){ + const bitPosition = 5 - index; + const bit = argMask >> bitPosition & 0x1; + usedArgs[index] = bit === 1; + } + return { + type: typeBit === 1 ? 'use-cache' : 'server-action', + usedArgs: usedArgs, + hasRestArgs: restArgs === 1 + }; +} +/** + * Creates a sparse array containing only the used arguments based on the + * provided action info. + */ export function omitUnusedArgs(args, info) { + const filteredArgs = new Array(args.length); + let length = 0; + for(let index = 0; index < args.length; index++){ + if (index < 6 && info.usedArgs[index] || // This assumes that the server reference info byte has the restArgs bit + // set to 1 if there are more than 6 args. + index >= 6 && info.hasRestArgs) { + filteredArgs[index] = args[index]; + length = index + 1; + } + } + // Trim trailing unused args from the array. + filteredArgs.length = length; + return filteredArgs; +} + +//# sourceMappingURL=server-reference-info.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/server-reference-info.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/server-reference-info.js.map new file mode 100644 index 0000000000000000000000000000000000000000..2691b27e16a7362cde2c9f4a87f239b05ec41f3a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/server-reference-info.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/server-reference-info.ts"],"sourcesContent":["export interface ServerReferenceInfo {\n type: 'server-action' | 'use-cache'\n usedArgs: [boolean, boolean, boolean, boolean, boolean, boolean]\n hasRestArgs: boolean\n}\n\nexport const SERVER_REFERENCE_ID_LENGTH = 42\n\nexport function mightBeServerReferenceId(id: string): boolean {\n return id.length === SERVER_REFERENCE_ID_LENGTH\n}\n\n/**\n * Extracts info about the server reference for the given server reference ID by\n * parsing the first byte of the hex-encoded ID.\n *\n * ```\n * Bit positions: [7] [6] [5] [4] [3] [2] [1] [0]\n * Bits: typeBit argMask restArgs\n * ```\n *\n * If the `typeBit` is `1` the server reference represents a `\"use cache\"`\n * function, otherwise a server action.\n *\n * The `argMask` encodes whether the function uses the argument at the\n * respective position.\n *\n * The `restArgs` bit indicates whether the function uses a rest parameter. It's\n * also set to 1 if the function has more than 6 args.\n *\n * @param id hex-encoded server reference ID\n */\nexport function extractInfoFromServerReferenceId(\n id: string\n): ServerReferenceInfo {\n const infoByte = parseInt(id.slice(0, 2), 16)\n const typeBit = (infoByte >> 7) & 0x1\n const argMask = (infoByte >> 1) & 0x3f\n const restArgs = infoByte & 0x1\n const usedArgs = Array(6)\n\n for (let index = 0; index < 6; index++) {\n const bitPosition = 5 - index\n const bit = (argMask >> bitPosition) & 0x1\n usedArgs[index] = bit === 1\n }\n\n return {\n type: typeBit === 1 ? 'use-cache' : 'server-action',\n usedArgs: usedArgs as [\n boolean,\n boolean,\n boolean,\n boolean,\n boolean,\n boolean,\n ],\n hasRestArgs: restArgs === 1,\n }\n}\n\n/**\n * Creates a sparse array containing only the used arguments based on the\n * provided action info.\n */\nexport function omitUnusedArgs(\n args: unknown[],\n info: ServerReferenceInfo\n): unknown[] {\n const filteredArgs = new Array(args.length)\n let length = 0\n\n for (let index = 0; index < args.length; index++) {\n if (\n (index < 6 && info.usedArgs[index]) ||\n // This assumes that the server reference info byte has the restArgs bit\n // set to 1 if there are more than 6 args.\n (index >= 6 && info.hasRestArgs)\n ) {\n filteredArgs[index] = args[index]\n length = index + 1\n }\n }\n\n // Trim trailing unused args from the array.\n filteredArgs.length = length\n\n return filteredArgs\n}\n"],"names":["SERVER_REFERENCE_ID_LENGTH","mightBeServerReferenceId","id","length","extractInfoFromServerReferenceId","infoByte","parseInt","slice","typeBit","argMask","restArgs","usedArgs","Array","index","bitPosition","bit","type","hasRestArgs","omitUnusedArgs","args","info","filteredArgs"],"mappings":"AAMA,OAAO,MAAMA,6BAA6B,GAAE;AAE5C,OAAO,SAASC,yBAAyBC,EAAU;IACjD,OAAOA,GAAGC,MAAM,KAAKH;AACvB;AAEA;;;;;;;;;;;;;;;;;;;CAmBC,GACD,OAAO,SAASI,iCACdF,EAAU;IAEV,MAAMG,WAAWC,SAASJ,GAAGK,KAAK,CAAC,GAAG,IAAI;IAC1C,MAAMC,UAAU,AAACH,YAAY,IAAK;IAClC,MAAMI,UAAU,AAACJ,YAAY,IAAK;IAClC,MAAMK,WAAWL,WAAW;IAC5B,MAAMM,WAAWC,MAAM;IAEvB,IAAK,IAAIC,QAAQ,GAAGA,QAAQ,GAAGA,QAAS;QACtC,MAAMC,cAAc,IAAID;QACxB,MAAME,MAAM,AAACN,WAAWK,cAAe;QACvCH,QAAQ,CAACE,MAAM,GAAGE,QAAQ;IAC5B;IAEA,OAAO;QACLC,MAAMR,YAAY,IAAI,cAAc;QACpCG,UAAUA;QAQVM,aAAaP,aAAa;IAC5B;AACF;AAEA;;;CAGC,GACD,OAAO,SAASQ,eACdC,IAAe,EACfC,IAAyB;IAEzB,MAAMC,eAAe,IAAIT,MAAMO,KAAKhB,MAAM;IAC1C,IAAIA,SAAS;IAEb,IAAK,IAAIU,QAAQ,GAAGA,QAAQM,KAAKhB,MAAM,EAAEU,QAAS;QAChD,IACE,AAACA,QAAQ,KAAKO,KAAKT,QAAQ,CAACE,MAAM,IAClC,wEAAwE;QACxE,0CAA0C;QACzCA,SAAS,KAAKO,KAAKH,WAAW,EAC/B;YACAI,YAAY,CAACR,MAAM,GAAGM,IAAI,CAACN,MAAM;YACjCV,SAASU,QAAQ;QACnB;IACF;IAEA,4CAA4C;IAC5CQ,aAAalB,MAAM,GAAGA;IAEtB,OAAOkB;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/side-effect.js b/e-commerce/node_modules/next/dist/esm/shared/lib/side-effect.js new file mode 100644 index 0000000000000000000000000000000000000000..1721f7e5a953b24bca59f8f06c4a68a1912b4998 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/side-effect.js @@ -0,0 +1,53 @@ +import { Children, useEffect, useLayoutEffect } from 'react'; +const isServer = typeof window === 'undefined'; +const useClientOnlyLayoutEffect = isServer ? ()=>{} : useLayoutEffect; +const useClientOnlyEffect = isServer ? ()=>{} : useEffect; +export default function SideEffect(props) { + const { headManager, reduceComponentsToState } = props; + function emitChange() { + if (headManager && headManager.mountedInstances) { + const headElements = Children.toArray(Array.from(headManager.mountedInstances).filter(Boolean)); + headManager.updateHead(reduceComponentsToState(headElements)); + } + } + if (isServer) { + headManager?.mountedInstances?.add(props.children); + emitChange(); + } + useClientOnlyLayoutEffect(()=>{ + headManager?.mountedInstances?.add(props.children); + return ()=>{ + headManager?.mountedInstances?.delete(props.children); + }; + }); + // We need to call `updateHead` method whenever the `SideEffect` is trigger in all + // life-cycles: mount, update, unmount. However, if there are multiple `SideEffect`s + // being rendered, we only trigger the method from the last one. + // This is ensured by keeping the last unflushed `updateHead` in the `_pendingUpdate` + // singleton in the layout effect pass, and actually trigger it in the effect pass. + useClientOnlyLayoutEffect(()=>{ + if (headManager) { + headManager._pendingUpdate = emitChange; + } + return ()=>{ + if (headManager) { + headManager._pendingUpdate = emitChange; + } + }; + }); + useClientOnlyEffect(()=>{ + if (headManager && headManager._pendingUpdate) { + headManager._pendingUpdate(); + headManager._pendingUpdate = null; + } + return ()=>{ + if (headManager && headManager._pendingUpdate) { + headManager._pendingUpdate(); + headManager._pendingUpdate = null; + } + }; + }); + return null; +} + +//# sourceMappingURL=side-effect.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/side-effect.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/side-effect.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1e53b4dcedbbca1e32e86c5947f9dfb464047198 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/side-effect.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/side-effect.tsx"],"sourcesContent":["import type React from 'react'\nimport { Children, useEffect, useLayoutEffect, type JSX } from 'react'\n\ntype State = JSX.Element[] | undefined\n\nexport type SideEffectProps = {\n reduceComponentsToState: (components: Array<React.ReactElement<any>>) => State\n handleStateChange?: (state: State) => void\n headManager: any\n children: React.ReactNode\n}\n\nconst isServer = typeof window === 'undefined'\nconst useClientOnlyLayoutEffect = isServer ? () => {} : useLayoutEffect\nconst useClientOnlyEffect = isServer ? () => {} : useEffect\n\nexport default function SideEffect(props: SideEffectProps) {\n const { headManager, reduceComponentsToState } = props\n\n function emitChange() {\n if (headManager && headManager.mountedInstances) {\n const headElements = Children.toArray(\n Array.from(headManager.mountedInstances as Set<React.ReactNode>).filter(\n Boolean\n )\n ) as React.ReactElement[]\n headManager.updateHead(reduceComponentsToState(headElements))\n }\n }\n\n if (isServer) {\n headManager?.mountedInstances?.add(props.children)\n emitChange()\n }\n\n useClientOnlyLayoutEffect(() => {\n headManager?.mountedInstances?.add(props.children)\n return () => {\n headManager?.mountedInstances?.delete(props.children)\n }\n })\n\n // We need to call `updateHead` method whenever the `SideEffect` is trigger in all\n // life-cycles: mount, update, unmount. However, if there are multiple `SideEffect`s\n // being rendered, we only trigger the method from the last one.\n // This is ensured by keeping the last unflushed `updateHead` in the `_pendingUpdate`\n // singleton in the layout effect pass, and actually trigger it in the effect pass.\n useClientOnlyLayoutEffect(() => {\n if (headManager) {\n headManager._pendingUpdate = emitChange\n }\n return () => {\n if (headManager) {\n headManager._pendingUpdate = emitChange\n }\n }\n })\n\n useClientOnlyEffect(() => {\n if (headManager && headManager._pendingUpdate) {\n headManager._pendingUpdate()\n headManager._pendingUpdate = null\n }\n return () => {\n if (headManager && headManager._pendingUpdate) {\n headManager._pendingUpdate()\n headManager._pendingUpdate = null\n }\n }\n })\n\n return null\n}\n"],"names":["Children","useEffect","useLayoutEffect","isServer","window","useClientOnlyLayoutEffect","useClientOnlyEffect","SideEffect","props","headManager","reduceComponentsToState","emitChange","mountedInstances","headElements","toArray","Array","from","filter","Boolean","updateHead","add","children","delete","_pendingUpdate"],"mappings":"AACA,SAASA,QAAQ,EAAEC,SAAS,EAAEC,eAAe,QAAkB,QAAO;AAWtE,MAAMC,WAAW,OAAOC,WAAW;AACnC,MAAMC,4BAA4BF,WAAW,KAAO,IAAID;AACxD,MAAMI,sBAAsBH,WAAW,KAAO,IAAIF;AAElD,eAAe,SAASM,WAAWC,KAAsB;IACvD,MAAM,EAAEC,WAAW,EAAEC,uBAAuB,EAAE,GAAGF;IAEjD,SAASG;QACP,IAAIF,eAAeA,YAAYG,gBAAgB,EAAE;YAC/C,MAAMC,eAAeb,SAASc,OAAO,CACnCC,MAAMC,IAAI,CAACP,YAAYG,gBAAgB,EAA0BK,MAAM,CACrEC;YAGJT,YAAYU,UAAU,CAACT,wBAAwBG;QACjD;IACF;IAEA,IAAIV,UAAU;QACZM,aAAaG,kBAAkBQ,IAAIZ,MAAMa,QAAQ;QACjDV;IACF;IAEAN,0BAA0B;QACxBI,aAAaG,kBAAkBQ,IAAIZ,MAAMa,QAAQ;QACjD,OAAO;YACLZ,aAAaG,kBAAkBU,OAAOd,MAAMa,QAAQ;QACtD;IACF;IAEA,kFAAkF;IAClF,oFAAoF;IACpF,gEAAgE;IAChE,qFAAqF;IACrF,mFAAmF;IACnFhB,0BAA0B;QACxB,IAAII,aAAa;YACfA,YAAYc,cAAc,GAAGZ;QAC/B;QACA,OAAO;YACL,IAAIF,aAAa;gBACfA,YAAYc,cAAc,GAAGZ;YAC/B;QACF;IACF;IAEAL,oBAAoB;QAClB,IAAIG,eAAeA,YAAYc,cAAc,EAAE;YAC7Cd,YAAYc,cAAc;YAC1Bd,YAAYc,cAAc,GAAG;QAC/B;QACA,OAAO;YACL,IAAId,eAAeA,YAAYc,cAAc,EAAE;gBAC7Cd,YAAYc,cAAc;gBAC1Bd,YAAYc,cAAc,GAAG;YAC/B;QACF;IACF;IAEA,OAAO;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/size-limit.js b/e-commerce/node_modules/next/dist/esm/shared/lib/size-limit.js new file mode 100644 index 0000000000000000000000000000000000000000..9b14e0df95b7f19efa7df209a0043e6cb02b4023 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/size-limit.js @@ -0,0 +1,20 @@ +export const DEFAULT_MAX_POSTPONED_STATE_SIZE = '100 MB'; +// 100MB in bytes. Not using the parseSizeLimit for performance as parseMaxPostponedStateSize is in the hot path for rendering. +const DEFAULT_MAX_POSTPONED_STATE_SIZE_BYTES = 104857600; +function parseSizeLimit(size) { + const bytes = require('next/dist/compiled/bytes').parse(size); + if (bytes === null || isNaN(bytes) || bytes < 1) { + return undefined; + } + return bytes; +} +/** + * Parses the maxPostponedStateSize config value, using the default if not provided. + */ export function parseMaxPostponedStateSize(size) { + if (!size) { + return DEFAULT_MAX_POSTPONED_STATE_SIZE_BYTES; + } + return parseSizeLimit(size); +} + +//# sourceMappingURL=size-limit.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/size-limit.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/size-limit.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d084d0cc7e7d00736c861d5f97380b5b3cbc693b --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/size-limit.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/size-limit.ts"],"sourcesContent":["import type { SizeLimit } from '../../types'\n\nexport const DEFAULT_MAX_POSTPONED_STATE_SIZE: SizeLimit = '100 MB'\n\n// 100MB in bytes. Not using the parseSizeLimit for performance as parseMaxPostponedStateSize is in the hot path for rendering.\nconst DEFAULT_MAX_POSTPONED_STATE_SIZE_BYTES = 104_857_600\n\nfunction parseSizeLimit(size: SizeLimit): number | undefined {\n const bytes = (\n require('next/dist/compiled/bytes') as typeof import('next/dist/compiled/bytes')\n ).parse(size)\n if (bytes === null || isNaN(bytes) || bytes < 1) {\n return undefined\n }\n return bytes\n}\n\n/**\n * Parses the maxPostponedStateSize config value, using the default if not provided.\n */\nexport function parseMaxPostponedStateSize(\n size: SizeLimit | undefined\n): number | undefined {\n if (!size) {\n return DEFAULT_MAX_POSTPONED_STATE_SIZE_BYTES\n }\n return parseSizeLimit(size)\n}\n"],"names":["DEFAULT_MAX_POSTPONED_STATE_SIZE","DEFAULT_MAX_POSTPONED_STATE_SIZE_BYTES","parseSizeLimit","size","bytes","require","parse","isNaN","undefined","parseMaxPostponedStateSize"],"mappings":"AAEA,OAAO,MAAMA,mCAA8C,SAAQ;AAEnE,+HAA+H;AAC/H,MAAMC,yCAAyC;AAE/C,SAASC,eAAeC,IAAe;IACrC,MAAMC,QAAQ,AACZC,QAAQ,4BACRC,KAAK,CAACH;IACR,IAAIC,UAAU,QAAQG,MAAMH,UAAUA,QAAQ,GAAG;QAC/C,OAAOI;IACT;IACA,OAAOJ;AACT;AAEA;;CAEC,GACD,OAAO,SAASK,2BACdN,IAA2B;IAE3B,IAAI,CAACA,MAAM;QACT,OAAOF;IACT;IACA,OAAOC,eAAeC;AACxB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/styled-jsx.d.ts b/e-commerce/node_modules/next/dist/esm/shared/lib/styled-jsx.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..57be2222c272af3ae470dd3bb8b99ee264193819 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/styled-jsx.d.ts @@ -0,0 +1 @@ +export { default } from 'styled-jsx/style' diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/styled-jsx.js b/e-commerce/node_modules/next/dist/esm/shared/lib/styled-jsx.js new file mode 100644 index 0000000000000000000000000000000000000000..f75dfd0ddc719efe0c73126f0fad22a37c0668a0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/styled-jsx.js @@ -0,0 +1,3 @@ +module.exports = require('styled-jsx/style'); + +//# sourceMappingURL=styled-jsx.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/styled-jsx.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/styled-jsx.js.map new file mode 100644 index 0000000000000000000000000000000000000000..fb0d1814b85fe269ba37c7c565cbc2b8f40cf164 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/styled-jsx.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/styled-jsx.js"],"sourcesContent":["module.exports = require('styled-jsx/style')\n"],"names":["module","exports","require"],"mappings":"AAAAA,OAAOC,OAAO,GAAGC,QAAQ","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/compilation-events.js b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/compilation-events.js new file mode 100644 index 0000000000000000000000000000000000000000..5b92e9adc3a332108c0c4450b9d387ade775e037 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/compilation-events.js @@ -0,0 +1,71 @@ +import * as Log from '../../../build/output/log'; +import { flushAllTraces } from '../../../trace'; +import { traceMemoryUsage } from '../../../lib/memory/trace'; +const MILLISECONDS_IN_NANOSECOND = BigInt(1000000); +export function msToNs(ms) { + return BigInt(Math.floor(ms)) * MILLISECONDS_IN_NANOSECOND; +} +/** + * Subscribes to compilation events for `project` and prints them using the + * `Log` library. + * + * When `parentSpan` is provided, `TraceEvent` compilation events are recorded + * as trace spans in the `.next/trace` file. + * + * Returns a promise that resolves when the subscription ends. Abort the + * `signal` to close the underlying async iterator and settle the promise + * promptly. The iterator also closes automatically when the Rust side + * drops the subscription (e.g. after project shutdown). + */ export function backgroundLogCompilationEvents(project, { eventTypes, signal, parentSpan } = {}) { + const iterator = project.compilationEventsSubscribe(eventTypes); + // If there is no signal assume there will be no clean shutdown, + // to ensure trace spans aren't lost just flush after each one. + const flushEachTraceEvent = signal === undefined; + // Close the iterator as soon as the signal fires so the for-await loop + // exits without waiting for the next compilation event. + signal?.addEventListener('abort', ()=>iterator.return?.(undefined), { + once: true + }); + const promise = async function() { + for await (const event of iterator){ + // Record TraceEvent compilation events as trace spans in .next/trace. + if (parentSpan && event.typeName === 'TraceEvent' && event.eventJson) { + try { + const data = JSON.parse(event.eventJson); + parentSpan.manualTraceChild(data.name, msToNs(data.startTimeMs), msToNs(data.endTimeMs), Object.fromEntries(data.attributes ?? [])); + traceMemoryUsage(data.name, parentSpan); + if (flushEachTraceEvent) { + flushAllTraces(); + } + } catch {} + continue; // don't log these events, they just go to the trace file + } + switch(event.severity){ + case 'EVENT': + Log.event(event.message); + break; + case 'TRACE': + Log.trace(event.message); + break; + case 'INFO': + Log.info(event.message); + break; + case 'WARNING': + Log.warn(event.message); + break; + case 'ERROR': + Log.error(event.message); + break; + case 'FATAL': + Log.error(event.message); + break; + default: + break; + } + } + }(); + // Prevent unhandled rejection if the subscription errors after the project shuts down. + return promise.catch(()=>{}); +} + +//# sourceMappingURL=compilation-events.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/compilation-events.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/compilation-events.js.map new file mode 100644 index 0000000000000000000000000000000000000000..74252badd09c13b900a1663305ce018ca7e542a5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/compilation-events.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/turbopack/compilation-events.ts"],"sourcesContent":["import type { Project } from '../../../build/swc/types'\nimport * as Log from '../../../build/output/log'\nimport { flushAllTraces, type Span } from '../../../trace'\nimport { traceMemoryUsage } from '../../../lib/memory/trace'\n\nconst MILLISECONDS_IN_NANOSECOND = BigInt(1_000_000)\nexport function msToNs(ms: number): bigint {\n return BigInt(Math.floor(ms)) * MILLISECONDS_IN_NANOSECOND\n}\n\n/**\n * Subscribes to compilation events for `project` and prints them using the\n * `Log` library.\n *\n * When `parentSpan` is provided, `TraceEvent` compilation events are recorded\n * as trace spans in the `.next/trace` file.\n *\n * Returns a promise that resolves when the subscription ends. Abort the\n * `signal` to close the underlying async iterator and settle the promise\n * promptly. The iterator also closes automatically when the Rust side\n * drops the subscription (e.g. after project shutdown).\n */\nexport function backgroundLogCompilationEvents(\n project: Project,\n {\n eventTypes,\n signal,\n parentSpan,\n }: { eventTypes?: string[]; signal?: AbortSignal; parentSpan?: Span } = {}\n): Promise<void> {\n const iterator = project.compilationEventsSubscribe(eventTypes)\n\n // If there is no signal assume there will be no clean shutdown,\n // to ensure trace spans aren't lost just flush after each one.\n const flushEachTraceEvent = signal === undefined\n\n // Close the iterator as soon as the signal fires so the for-await loop\n // exits without waiting for the next compilation event.\n signal?.addEventListener('abort', () => iterator.return?.(undefined as any), {\n once: true,\n })\n\n const promise = (async function () {\n for await (const event of iterator) {\n // Record TraceEvent compilation events as trace spans in .next/trace.\n if (parentSpan && event.typeName === 'TraceEvent' && event.eventJson) {\n try {\n const data = JSON.parse(event.eventJson)\n parentSpan.manualTraceChild(\n data.name,\n msToNs(data.startTimeMs),\n msToNs(data.endTimeMs),\n Object.fromEntries(data.attributes ?? [])\n )\n traceMemoryUsage(data.name, parentSpan)\n if (flushEachTraceEvent) {\n flushAllTraces()\n }\n } catch {}\n continue // don't log these events, they just go to the trace file\n }\n\n switch (event.severity) {\n case 'EVENT':\n Log.event(event.message)\n break\n case 'TRACE':\n Log.trace(event.message)\n break\n case 'INFO':\n Log.info(event.message)\n break\n case 'WARNING':\n Log.warn(event.message)\n break\n case 'ERROR':\n Log.error(event.message)\n break\n case 'FATAL':\n Log.error(event.message)\n break\n default:\n break\n }\n }\n })()\n // Prevent unhandled rejection if the subscription errors after the project shuts down.\n return promise.catch(() => {})\n}\n"],"names":["Log","flushAllTraces","traceMemoryUsage","MILLISECONDS_IN_NANOSECOND","BigInt","msToNs","ms","Math","floor","backgroundLogCompilationEvents","project","eventTypes","signal","parentSpan","iterator","compilationEventsSubscribe","flushEachTraceEvent","undefined","addEventListener","return","once","promise","event","typeName","eventJson","data","JSON","parse","manualTraceChild","name","startTimeMs","endTimeMs","Object","fromEntries","attributes","severity","message","trace","info","warn","error","catch"],"mappings":"AACA,YAAYA,SAAS,4BAA2B;AAChD,SAASC,cAAc,QAAmB,iBAAgB;AAC1D,SAASC,gBAAgB,QAAQ,4BAA2B;AAE5D,MAAMC,6BAA6BC,OAAO;AAC1C,OAAO,SAASC,OAAOC,EAAU;IAC/B,OAAOF,OAAOG,KAAKC,KAAK,CAACF,OAAOH;AAClC;AAEA;;;;;;;;;;;CAWC,GACD,OAAO,SAASM,+BACdC,OAAgB,EAChB,EACEC,UAAU,EACVC,MAAM,EACNC,UAAU,EACyD,GAAG,CAAC,CAAC;IAE1E,MAAMC,WAAWJ,QAAQK,0BAA0B,CAACJ;IAEpD,gEAAgE;IAChE,+DAA+D;IAC/D,MAAMK,sBAAsBJ,WAAWK;IAEvC,uEAAuE;IACvE,wDAAwD;IACxDL,QAAQM,iBAAiB,SAAS,IAAMJ,SAASK,MAAM,GAAGF,YAAmB;QAC3EG,MAAM;IACR;IAEA,MAAMC,UAAU,AAAC;QACf,WAAW,MAAMC,SAASR,SAAU;YAClC,sEAAsE;YACtE,IAAID,cAAcS,MAAMC,QAAQ,KAAK,gBAAgBD,MAAME,SAAS,EAAE;gBACpE,IAAI;oBACF,MAAMC,OAAOC,KAAKC,KAAK,CAACL,MAAME,SAAS;oBACvCX,WAAWe,gBAAgB,CACzBH,KAAKI,IAAI,EACTxB,OAAOoB,KAAKK,WAAW,GACvBzB,OAAOoB,KAAKM,SAAS,GACrBC,OAAOC,WAAW,CAACR,KAAKS,UAAU,IAAI,EAAE;oBAE1ChC,iBAAiBuB,KAAKI,IAAI,EAAEhB;oBAC5B,IAAIG,qBAAqB;wBACvBf;oBACF;gBACF,EAAE,OAAM,CAAC;gBACT,UAAS,yDAAyD;YACpE;YAEA,OAAQqB,MAAMa,QAAQ;gBACpB,KAAK;oBACHnC,IAAIsB,KAAK,CAACA,MAAMc,OAAO;oBACvB;gBACF,KAAK;oBACHpC,IAAIqC,KAAK,CAACf,MAAMc,OAAO;oBACvB;gBACF,KAAK;oBACHpC,IAAIsC,IAAI,CAAChB,MAAMc,OAAO;oBACtB;gBACF,KAAK;oBACHpC,IAAIuC,IAAI,CAACjB,MAAMc,OAAO;oBACtB;gBACF,KAAK;oBACHpC,IAAIwC,KAAK,CAAClB,MAAMc,OAAO;oBACvB;gBACF,KAAK;oBACHpC,IAAIwC,KAAK,CAAClB,MAAMc,OAAO;oBACvB;gBACF;oBACE;YACJ;QACF;IACF;IACA,uFAAuF;IACvF,OAAOf,QAAQoB,KAAK,CAAC,KAAO;AAC9B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/deferred-emit.js b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/deferred-emit.js new file mode 100644 index 0000000000000000000000000000000000000000..9354ff10ec8f4e5c42b2bb03277deaf29d211338 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/deferred-emit.js @@ -0,0 +1,50 @@ +/** + * Fires a callback after a delay unless it's cancelled or flushed first. + * + * `schedule()` replaces any still-pending emit. + */ export class DeferredEmit { + #timer; + #fn; + /** + * Arm `fn` to run after `delayMs`, replacing any still-pending emit. + * + * @param delayMs The delay in milliseconds before the callback is fired. + * @param fn The callback function to be executed after the delay. + */ schedule(delayMs, scheduledFn) { + this.cancel(); + this.#fn = scheduledFn; + this.#timer = setTimeout(()=>{ + this.#timer = undefined; + const fn = this.#fn; + this.#fn = undefined; + fn?.(); + }, delayMs); + } + /** + * If an emit is pending, run it now instead of waiting for the delay. + */ flush() { + if (this.#timer === undefined) { + return; + } + clearTimeout(this.#timer); + this.#timer = undefined; + const fn = this.#fn; + this.#fn = undefined; + fn?.(); + } + /** + * Cancel a pending emit without running it. + */ cancel() { + if (this.#timer === undefined) { + return; + } + clearTimeout(this.#timer); + this.#timer = undefined; + this.#fn = undefined; + } + get isPending() { + return this.#timer !== undefined; + } +} + +//# sourceMappingURL=deferred-emit.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/deferred-emit.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/deferred-emit.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6d05357c7cb20c522254a876de400d32e636a2ff --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/deferred-emit.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/turbopack/deferred-emit.ts"],"sourcesContent":["/**\n * Fires a callback after a delay unless it's cancelled or flushed first.\n *\n * `schedule()` replaces any still-pending emit.\n */\nexport class DeferredEmit {\n #timer: ReturnType<typeof setTimeout> | undefined\n #fn: (() => void) | undefined\n\n /**\n * Arm `fn` to run after `delayMs`, replacing any still-pending emit.\n *\n * @param delayMs The delay in milliseconds before the callback is fired.\n * @param fn The callback function to be executed after the delay.\n */\n schedule(delayMs: number, scheduledFn: () => void): void {\n this.cancel()\n this.#fn = scheduledFn\n this.#timer = setTimeout(() => {\n this.#timer = undefined\n const fn = this.#fn\n this.#fn = undefined\n fn?.()\n }, delayMs)\n }\n\n /**\n * If an emit is pending, run it now instead of waiting for the delay.\n */\n flush(): void {\n if (this.#timer === undefined) {\n return\n }\n clearTimeout(this.#timer)\n this.#timer = undefined\n const fn = this.#fn\n this.#fn = undefined\n fn?.()\n }\n\n /**\n * Cancel a pending emit without running it.\n */\n cancel(): void {\n if (this.#timer === undefined) {\n return\n }\n clearTimeout(this.#timer)\n this.#timer = undefined\n this.#fn = undefined\n }\n\n get isPending(): boolean {\n return this.#timer !== undefined\n }\n}\n"],"names":["DeferredEmit","schedule","delayMs","scheduledFn","cancel","setTimeout","undefined","fn","flush","clearTimeout","isPending"],"mappings":"AAAA;;;;CAIC,GACD,OAAO,MAAMA;IACX,CAAA,KAAM,CAA2C;IACjD,CAAA,EAAG,CAA0B;IAE7B;;;;;GAKC,GACDC,SAASC,OAAe,EAAEC,WAAuB,EAAQ;QACvD,IAAI,CAACC,MAAM;QACX,IAAI,CAAC,CAAA,EAAG,GAAGD;QACX,IAAI,CAAC,CAAA,KAAM,GAAGE,WAAW;YACvB,IAAI,CAAC,CAAA,KAAM,GAAGC;YACd,MAAMC,KAAK,IAAI,CAAC,CAAA,EAAG;YACnB,IAAI,CAAC,CAAA,EAAG,GAAGD;YACXC;QACF,GAAGL;IACL;IAEA;;GAEC,GACDM,QAAc;QACZ,IAAI,IAAI,CAAC,CAAA,KAAM,KAAKF,WAAW;YAC7B;QACF;QACAG,aAAa,IAAI,CAAC,CAAA,KAAM;QACxB,IAAI,CAAC,CAAA,KAAM,GAAGH;QACd,MAAMC,KAAK,IAAI,CAAC,CAAA,EAAG;QACnB,IAAI,CAAC,CAAA,EAAG,GAAGD;QACXC;IACF;IAEA;;GAEC,GACDH,SAAe;QACb,IAAI,IAAI,CAAC,CAAA,KAAM,KAAKE,WAAW;YAC7B;QACF;QACAG,aAAa,IAAI,CAAC,CAAA,KAAM;QACxB,IAAI,CAAC,CAAA,KAAM,GAAGH;QACd,IAAI,CAAC,CAAA,EAAG,GAAGA;IACb;IAEA,IAAII,YAAqB;QACvB,OAAO,IAAI,CAAC,CAAA,KAAM,KAAKJ;IACzB;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/entry-key.js b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/entry-key.js new file mode 100644 index 0000000000000000000000000000000000000000..eb428ece0030674b9ded5915e70f9d443b5d3607 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/entry-key.js @@ -0,0 +1,21 @@ +/** + * `app` -> app dir + * `pages` -> pages dir + * `root` -> middleware / instrumentation + * `assets` -> assets + */ /** + * Get a key that's unique across all entrypoints. + */ export function getEntryKey(type, side, page) { + return JSON.stringify({ + type, + side, + page + }); +} +/** + * Split an `EntryKey` up into its components. + */ export function splitEntryKey(key) { + return JSON.parse(key); +} + +//# sourceMappingURL=entry-key.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/entry-key.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/entry-key.js.map new file mode 100644 index 0000000000000000000000000000000000000000..5832537120884f419afdd5d9ef45efc4e7f4408a --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/entry-key.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/turbopack/entry-key.ts"],"sourcesContent":["/**\n * `app` -> app dir\n * `pages` -> pages dir\n * `root` -> middleware / instrumentation\n * `assets` -> assets\n */\nexport type EntryKeyType = 'app' | 'pages' | 'root' | 'assets'\nexport type EntryKeySide = 'client' | 'server'\n\n// custom type to make sure you can't accidentally use a \"generic\" string\nexport type EntryKey =\n `{\"type\":\"${EntryKeyType}\",\"side\":\"${EntryKeyType}\",\"page\":\"${string}\"}`\n\n/**\n * Get a key that's unique across all entrypoints.\n */\nexport function getEntryKey(\n type: EntryKeyType,\n side: EntryKeySide,\n page: string\n): EntryKey {\n return JSON.stringify({ type, side, page }) as EntryKey\n}\n\n/**\n * Split an `EntryKey` up into its components.\n */\nexport function splitEntryKey(key: EntryKey): {\n type: EntryKeyType\n side: EntryKeySide\n page: string\n} {\n return JSON.parse(key)\n}\n"],"names":["getEntryKey","type","side","page","JSON","stringify","splitEntryKey","key","parse"],"mappings":"AAAA;;;;;CAKC,GAQD;;CAEC,GACD,OAAO,SAASA,YACdC,IAAkB,EAClBC,IAAkB,EAClBC,IAAY;IAEZ,OAAOC,KAAKC,SAAS,CAAC;QAAEJ;QAAMC;QAAMC;IAAK;AAC3C;AAEA;;CAEC,GACD,OAAO,SAASG,cAAcC,GAAa;IAKzC,OAAOH,KAAKI,KAAK,CAACD;AACpB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/internal-error.js b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/internal-error.js new file mode 100644 index 0000000000000000000000000000000000000000..6530361d0e47dabc67327a941281ba7a7d40ac01 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/internal-error.js @@ -0,0 +1,35 @@ +import { eventErrorThrown } from '../../../telemetry/events'; +import { traceGlobals } from '../../../trace/shared'; +/** + * An error caused by a bug in Turbopack, and not the user's code (e.g. a Rust panic). These should + * be written to a log file and details should not be shown to the user. + * + * These are constructed in Turbopack by calling `throwTurbopackInternalError`. + */ export class TurbopackInternalError extends Error { + constructor({ message, anonymizedLocation }){ + super(message), this.name = 'TurbopackInternalError'; + this.location = anonymizedLocation; + } +} +/** + * A helper used by the napi Rust entrypoints to construct and throw a `TurbopackInternalError`. + * + * When called, this will emit a telemetry event. + */ export function throwTurbopackInternalError(conversionError, opts) { + if (conversionError != null) { + // Somehow napi failed to convert `opts` to a JS object??? Just give up and throw that instead. + throw new Error('NAPI type conversion error in throwTurbopackInternalError', { + cause: conversionError + }); + } + const err = new TurbopackInternalError(opts); + const telemetry = traceGlobals.get('telemetry'); + if (telemetry) { + telemetry.record(eventErrorThrown(err, opts.anonymizedLocation)); + } else { + console.error('Expected `telemetry` to be set in globals'); + } + throw err; +} + +//# sourceMappingURL=internal-error.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/internal-error.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/internal-error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0e0d8ebb258bdd33735bdd1caca62c7a48711d23 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/internal-error.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/turbopack/internal-error.ts"],"sourcesContent":["import type { TurbopackInternalErrorOpts } from '../../../build/swc/generated-native'\nimport { eventErrorThrown } from '../../../telemetry/events'\nimport { traceGlobals } from '../../../trace/shared'\n\n/**\n * An error caused by a bug in Turbopack, and not the user's code (e.g. a Rust panic). These should\n * be written to a log file and details should not be shown to the user.\n *\n * These are constructed in Turbopack by calling `throwTurbopackInternalError`.\n */\nexport class TurbopackInternalError extends Error {\n name = 'TurbopackInternalError'\n location: string | undefined\n\n constructor({ message, anonymizedLocation }: TurbopackInternalErrorOpts) {\n super(message)\n this.location = anonymizedLocation\n }\n}\n\n/**\n * A helper used by the napi Rust entrypoints to construct and throw a `TurbopackInternalError`.\n *\n * When called, this will emit a telemetry event.\n */\nexport function throwTurbopackInternalError(\n conversionError: Error | null,\n opts: TurbopackInternalErrorOpts\n): never {\n if (conversionError != null) {\n // Somehow napi failed to convert `opts` to a JS object??? Just give up and throw that instead.\n throw new Error(\n 'NAPI type conversion error in throwTurbopackInternalError',\n {\n cause: conversionError,\n }\n )\n }\n const err = new TurbopackInternalError(opts)\n const telemetry = traceGlobals.get('telemetry')\n if (telemetry) {\n telemetry.record(eventErrorThrown(err, opts.anonymizedLocation))\n } else {\n console.error('Expected `telemetry` to be set in globals')\n }\n throw err\n}\n"],"names":["eventErrorThrown","traceGlobals","TurbopackInternalError","Error","constructor","message","anonymizedLocation","name","location","throwTurbopackInternalError","conversionError","opts","cause","err","telemetry","get","record","console","error"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,4BAA2B;AAC5D,SAASC,YAAY,QAAQ,wBAAuB;AAEpD;;;;;CAKC,GACD,OAAO,MAAMC,+BAA+BC;IAI1CC,YAAY,EAAEC,OAAO,EAAEC,kBAAkB,EAA8B,CAAE;QACvE,KAAK,CAACD,eAJRE,OAAO;QAKL,IAAI,CAACC,QAAQ,GAAGF;IAClB;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASG,4BACdC,eAA6B,EAC7BC,IAAgC;IAEhC,IAAID,mBAAmB,MAAM;QAC3B,+FAA+F;QAC/F,MAAM,IAAIP,MACR,6DACA;YACES,OAAOF;QACT;IAEJ;IACA,MAAMG,MAAM,IAAIX,uBAAuBS;IACvC,MAAMG,YAAYb,aAAac,GAAG,CAAC;IACnC,IAAID,WAAW;QACbA,UAAUE,MAAM,CAAChB,iBAAiBa,KAAKF,KAAKL,kBAAkB;IAChE,OAAO;QACLW,QAAQC,KAAK,CAAC;IAChB;IACA,MAAML;AACR","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/manifest-loader.js b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/manifest-loader.js new file mode 100644 index 0000000000000000000000000000000000000000..ace551cac519762022b4f28e4fd88509d9fe761c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/manifest-loader.js @@ -0,0 +1,514 @@ +import { APP_PATHS_MANIFEST, BUILD_MANIFEST, CLIENT_STATIC_FILES_PATH, INTERCEPTION_ROUTE_REWRITE_MANIFEST, MIDDLEWARE_BUILD_MANIFEST, MIDDLEWARE_MANIFEST, NEXT_FONT_MANIFEST, PAGES_MANIFEST, SERVER_REFERENCE_MANIFEST, SUBRESOURCE_INTEGRITY_MANIFEST, TURBOPACK_CLIENT_BUILD_MANIFEST, TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST } from '../constants'; +import { join, posix } from 'path'; +import { readFileSync } from 'fs'; +import { deleteCache } from '../../../server/dev/require-cache'; +import { writeFileAtomic } from '../../../lib/fs/write-atomic'; +import getAssetPathFromRoute from '../router/utils/get-asset-path-from-route'; +import { getEntryKey, splitEntryKey } from './entry-key'; +import { getSortedRoutes } from '../router/utils'; +import { existsSync } from 'fs'; +import { addMetadataIdToRoute, addRouteSuffix, removeRouteSuffix } from '../../../server/dev/turbopack-utils'; +import { tryToParsePath } from '../../../lib/try-to-parse-path'; +import { safePathToRegexp } from '../router/utils/route-match-utils'; +import { normalizeRewritesForBuildManifest, srcEmptySsgManifest, processRoute, createEdgeRuntimeManifest } from '../../../build/webpack/plugins/build-manifest-plugin-utils'; +const getManifestPath = (page, distDir, name, type, firstCall)=>{ + let manifestPath = posix.join(distDir, `server`, type, type === 'middleware' || type === 'instrumentation' ? '' : type === 'app' ? page : getAssetPathFromRoute(page), name); + if (firstCall) { + const isSitemapRoute = /[\\/]sitemap(.xml)?\/route$/.test(page); + // Check the ambiguity of /sitemap and /sitemap.xml + if (isSitemapRoute && !existsSync(manifestPath)) { + manifestPath = getManifestPath(page.replace(/\/sitemap\/route$/, '/sitemap.xml/route'), distDir, name, type, false); + } + // existsSync is faster than using the async version + if (!existsSync(manifestPath) && page.endsWith('/route')) { + // TODO: Improve implementation of metadata routes, currently it requires this extra check for the variants of the files that can be written. + let basePage = removeRouteSuffix(page); + // For sitemap.xml routes with generateSitemaps, the manifest is at + // /sitemap/[__metadata_id__]/route (without .xml), because the route + // handler serves at /sitemap/[id] not /sitemap.xml/[id] + if (basePage.endsWith('/sitemap.xml')) { + basePage = basePage.slice(0, -'.xml'.length); + } + let metadataPage = addRouteSuffix(addMetadataIdToRoute(basePage)); + manifestPath = getManifestPath(metadataPage, distDir, name, type, false); + } + } + return manifestPath; +}; +function readPartialManifestContent(distDir, name, pageName, type = 'pages') { + const page = pageName; + const manifestPath = getManifestPath(page, distDir, name, type, true); + return readFileSync(posix.join(manifestPath), 'utf-8'); +} +/// Helper class that stores a map of manifests and tracks if they have changed +/// since the last time they were written to disk. This is used to avoid +/// unnecessary writes to disk. +class ManifestsMap { + set(key, value) { + if (this.rawMap.get(key) === value) return; + this.changed = true; + this.rawMap.set(key, value); + this.map.set(key, JSON.parse(value)); + } + delete(key) { + if (this.map.has(key)) { + this.changed = true; + this.rawMap.delete(key); + this.map.delete(key); + } + } + get(key) { + return this.map.get(key); + } + takeChanged(extraInvalidationKey) { + let changed = this.changed; + if (extraInvalidationKey !== undefined) { + const stringified = JSON.stringify(extraInvalidationKey); + if (this.extraInvalidationKey !== stringified) { + this.extraInvalidationKey = stringified; + changed = true; + } + } + this.changed = false; + return changed; + } + values() { + return this.map.values(); + } + entries() { + return this.map.entries(); + } + constructor(){ + this.rawMap = new Map(); + this.map = new Map(); + this.extraInvalidationKey = undefined; + this.changed = true; + } +} +export class TurbopackManifestLoader { + constructor({ distDir, buildId, encryptionKey, dev, sriEnabled }){ + this.actionManifests = new ManifestsMap(); + this.appPathsManifests = new ManifestsMap(); + this.buildManifests = new ManifestsMap(); + this.clientBuildManifests = new ManifestsMap(); + this.fontManifests = new ManifestsMap(); + this.middlewareManifests = new ManifestsMap(); + this.pagesManifests = new ManifestsMap(); + this.sriManifests = new ManifestsMap(); + /// interceptionRewrites that have been written to disk + /// This is used to avoid unnecessary writes if the rewrites haven't changed + this.cachedInterceptionRewrites = undefined; + this.pendingCacheDeletes = []; + this.distDir = distDir; + this.buildId = buildId; + this.encryptionKey = encryptionKey; + this.dev = dev; + this.sriEnabled = sriEnabled; + } + delete(key) { + this.actionManifests.delete(key); + this.appPathsManifests.delete(key); + this.buildManifests.delete(key); + this.clientBuildManifests.delete(key); + this.fontManifests.delete(key); + this.middlewareManifests.delete(key); + this.pagesManifests.delete(key); + } + loadActionManifest(pageName) { + this.actionManifests.set(getEntryKey('app', 'server', pageName), readPartialManifestContent(this.distDir, `${SERVER_REFERENCE_MANIFEST}.json`, pageName, 'app')); + } + mergeActionManifests(manifests) { + const manifest = { + node: {}, + edge: {}, + encryptionKey: this.encryptionKey + }; + function mergeActionIds(actionEntries, other) { + for(const key in other){ + const action = actionEntries[key] ??= { + workers: {} + }; + action.filename = other[key].filename; + action.exportedName = other[key].exportedName; + Object.assign(action.workers, other[key].workers); + } + } + for (const m of manifests){ + mergeActionIds(manifest.node, m.node); + mergeActionIds(manifest.edge, m.edge); + } + for(const key in manifest.node){ + const entry = manifest.node[key]; + entry.workers = sortObjectByKey(entry.workers); + } + for(const key in manifest.edge){ + const entry = manifest.edge[key]; + entry.workers = sortObjectByKey(entry.workers); + } + return manifest; + } + writeActionManifest() { + if (!this.actionManifests.takeChanged()) { + return; + } + const actionManifest = this.mergeActionManifests(this.actionManifests.values()); + const actionManifestJsonPath = join(this.distDir, 'server', `${SERVER_REFERENCE_MANIFEST}.json`); + const actionManifestJsPath = join(this.distDir, 'server', `${SERVER_REFERENCE_MANIFEST}.js`); + const json = JSON.stringify(actionManifest, null, 2); + this.pendingCacheDeletes.push(actionManifestJsonPath); + this.pendingCacheDeletes.push(actionManifestJsPath); + writeFileAtomic(actionManifestJsonPath, json); + writeFileAtomic(actionManifestJsPath, `self.__RSC_SERVER_MANIFEST=${JSON.stringify(json)}`); + } + loadAppPathsManifest(pageName) { + this.appPathsManifests.set(getEntryKey('app', 'server', pageName), readPartialManifestContent(this.distDir, APP_PATHS_MANIFEST, pageName, 'app')); + } + writeAppPathsManifest() { + if (!this.appPathsManifests.takeChanged()) { + return; + } + const appPathsManifest = this.mergePagesManifests(this.appPathsManifests.values()); + const appPathsManifestPath = join(this.distDir, 'server', APP_PATHS_MANIFEST); + this.pendingCacheDeletes.push(appPathsManifestPath); + writeFileAtomic(appPathsManifestPath, JSON.stringify(appPathsManifest, null, 2)); + } + writeSriManifest() { + if (!this.sriEnabled || !this.sriManifests.takeChanged()) { + return; + } + const sriManifest = this.mergeSriManifests(this.sriManifests.values()); + const pathJson = join(this.distDir, 'server', `${SUBRESOURCE_INTEGRITY_MANIFEST}.json`); + const pathJs = join(this.distDir, 'server', `${SUBRESOURCE_INTEGRITY_MANIFEST}.js`); + this.pendingCacheDeletes.push(pathJson); + this.pendingCacheDeletes.push(pathJs); + writeFileAtomic(pathJson, JSON.stringify(sriManifest, null, 2)); + writeFileAtomic(pathJs, `self.__SUBRESOURCE_INTEGRITY_MANIFEST=${JSON.stringify(JSON.stringify(sriManifest))}`); + } + loadBuildManifest(pageName, type = 'pages') { + this.buildManifests.set(getEntryKey(type, 'server', pageName), readPartialManifestContent(this.distDir, BUILD_MANIFEST, pageName, type)); + } + loadClientBuildManifest(pageName, type = 'pages') { + this.clientBuildManifests.set(getEntryKey(type, 'server', pageName), readPartialManifestContent(this.distDir, TURBOPACK_CLIENT_BUILD_MANIFEST, pageName, type)); + } + loadSriManifest(pageName, type = 'pages') { + if (!this.sriEnabled) return; + this.sriManifests.set(getEntryKey(type, 'client', pageName), readPartialManifestContent(this.distDir, `${SUBRESOURCE_INTEGRITY_MANIFEST}.json`, pageName, type)); + } + mergeBuildManifests(manifests, lowPriorityFiles) { + const manifest = { + pages: { + '/_app': [] + }, + // Something in next.js depends on these to exist even for app dir rendering + devFiles: [], + polyfillFiles: [], + lowPriorityFiles, + rootMainFiles: [], + rootMainFilesTree: {}, + pagesChunkGroupBootstrapParams: {} + }; + for (const m of manifests){ + Object.assign(manifest.pages, m.pages); + if (m.rootMainFiles.length) manifest.rootMainFiles = m.rootMainFiles; + // polyfillFiles should always be the same, so we can overwrite instead of actually merging + if (m.polyfillFiles.length) manifest.polyfillFiles = m.polyfillFiles; + if (m.rootMainFilesTree) { + Object.assign(manifest.rootMainFilesTree, m.rootMainFilesTree); + } + if (m.pagesChunkGroupBootstrapParams) { + Object.assign(manifest.pagesChunkGroupBootstrapParams, m.pagesChunkGroupBootstrapParams); + } + if (m.chunkLoadingGlobal) manifest.chunkLoadingGlobal = m.chunkLoadingGlobal; + } + manifest.pages = sortObjectByKey(manifest.pages); + return manifest; + } + mergeClientBuildManifests(manifests, rewrites, sortedPageKeys) { + const manifest = { + __rewrites: rewrites, + sortedPages: sortedPageKeys + }; + for (const m of manifests){ + Object.assign(manifest, m); + } + return sortObjectByKey(manifest); + } + writeInterceptionRouteRewriteManifest(devRewrites, productionRewrites) { + const rewrites = productionRewrites ?? { + ...devRewrites, + beforeFiles: (devRewrites?.beforeFiles ?? []).map(processRoute), + afterFiles: (devRewrites?.afterFiles ?? []).map(processRoute), + fallback: (devRewrites?.fallback ?? []).map(processRoute) + }; + const interceptionRewrites = JSON.stringify(rewrites.beforeFiles.filter(require('../../../lib/is-interception-route-rewrite').isInterceptionRouteRewrite)); + if (this.cachedInterceptionRewrites === interceptionRewrites) { + return; + } + this.cachedInterceptionRewrites = interceptionRewrites; + const interceptionRewriteManifestPath = join(this.distDir, 'server', `${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`); + this.pendingCacheDeletes.push(interceptionRewriteManifestPath); + writeFileAtomic(interceptionRewriteManifestPath, `self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST=${JSON.stringify(interceptionRewrites)};`); + } + writeBuildManifest(lowPriorityFiles) { + if (!this.buildManifests.takeChanged()) { + return; + } + const buildManifest = this.mergeBuildManifests(this.buildManifests.values(), lowPriorityFiles); + const buildManifestPath = join(this.distDir, BUILD_MANIFEST); + const middlewareBuildManifestPath = join(this.distDir, 'server', `${MIDDLEWARE_BUILD_MANIFEST}.js`); + this.pendingCacheDeletes.push(buildManifestPath); + this.pendingCacheDeletes.push(middlewareBuildManifestPath); + writeFileAtomic(buildManifestPath, JSON.stringify(buildManifest, null, 2)); + writeFileAtomic(middlewareBuildManifestPath, createEdgeRuntimeManifest(buildManifest)); + // Write fallback build manifest + const fallbackBuildManifest = this.mergeBuildManifests([ + this.buildManifests.get(getEntryKey('pages', 'server', '_app')), + this.buildManifests.get(getEntryKey('pages', 'server', '_error')) + ].filter(Boolean), lowPriorityFiles); + const fallbackBuildManifestPath = join(this.distDir, `fallback-${BUILD_MANIFEST}`); + this.pendingCacheDeletes.push(fallbackBuildManifestPath); + writeFileAtomic(fallbackBuildManifestPath, JSON.stringify(fallbackBuildManifest, null, 2)); + } + writeClientBuildManifest(entrypoints, devRewrites, productionRewrites) { + const rewrites = normalizeRewritesForBuildManifest(productionRewrites ?? { + ...devRewrites, + beforeFiles: (devRewrites?.beforeFiles ?? []).map(processRoute), + afterFiles: (devRewrites?.afterFiles ?? []).map(processRoute), + fallback: (devRewrites?.fallback ?? []).map(processRoute) + }); + const pagesKeys = [ + ...entrypoints.page.keys() + ]; + if (entrypoints.global.app) { + pagesKeys.push('/_app'); + } + if (entrypoints.global.error) { + pagesKeys.push('/_error'); + } + const sortedPageKeys = getSortedRoutes(pagesKeys); + let buildManifestPath = posix.join(CLIENT_STATIC_FILES_PATH, this.buildId, '_buildManifest.js'); + let ssgManifestPath = posix.join(CLIENT_STATIC_FILES_PATH, this.buildId, '_ssgManifest.js'); + if (this.dev && !this.clientBuildManifests.takeChanged({ + rewrites, + sortedPageKeys + })) { + return [ + buildManifestPath, + ssgManifestPath + ]; + } + const clientBuildManifest = this.mergeClientBuildManifests(this.clientBuildManifests.values(), rewrites, sortedPageKeys); + // Expose each route's bootstrap params and the chunk-loading global to the client + // so `route-loader` can instantiate a navigated page's entry module. The server + // stores params as raw JSON per route. + const pageBootstrapParams = {}; + let chunkLoadingGlobal; + for (const [key, m] of this.buildManifests.entries()){ + // Only the pages-router `route-loader` reads `__TURBOPACK_PAGE_BOOTSTRAP`. App routes + // navigate via flight and never use it, so skip app entries to keep `_buildManifest.js` + // (loaded on every page) small. + if (splitEntryKey(key).type !== 'pages') continue; + if (m.chunkLoadingGlobal) chunkLoadingGlobal = m.chunkLoadingGlobal; + for (const [route, params] of Object.entries(m.pagesChunkGroupBootstrapParams ?? {})){ + pageBootstrapParams[route] = params; + } + } + // Only emit the bootstrap globals when a route actually inlined its bootstrap (shared runtime + // enabled). + const hasBootstrapParams = Object.keys(pageBootstrapParams).length > 0; + const clientBuildManifestJs = `self.__BUILD_MANIFEST = ${JSON.stringify(clientBuildManifest, null, 2)};` + (hasBootstrapParams ? `self.__TURBOPACK_PAGE_BOOTSTRAP = ${JSON.stringify(pageBootstrapParams)};` + (chunkLoadingGlobal ? `self.__TURBOPACK_CHUNK_LOADING_GLOBAL = ${JSON.stringify(chunkLoadingGlobal)};` : '') : '') + `self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()`; + writeFileAtomic(join(this.distDir, buildManifestPath), clientBuildManifestJs); + // This is just an empty placeholder, the actual manifest is written after prerendering in + // packages/next/src/build/index.ts + writeFileAtomic(join(this.distDir, ssgManifestPath), srcEmptySsgManifest); + return [ + buildManifestPath, + ssgManifestPath + ]; + } + loadFontManifest(pageName, type = 'pages') { + this.fontManifests.set(getEntryKey(type, 'server', pageName), readPartialManifestContent(this.distDir, `${NEXT_FONT_MANIFEST}.json`, pageName, type)); + } + mergeFontManifests(manifests) { + const manifest = { + app: {}, + appUsingSizeAdjust: false, + pages: {}, + pagesUsingSizeAdjust: false + }; + for (const m of manifests){ + Object.assign(manifest.app, m.app); + Object.assign(manifest.pages, m.pages); + manifest.appUsingSizeAdjust = manifest.appUsingSizeAdjust || m.appUsingSizeAdjust; + manifest.pagesUsingSizeAdjust = manifest.pagesUsingSizeAdjust || m.pagesUsingSizeAdjust; + } + manifest.app = sortObjectByKey(manifest.app); + manifest.pages = sortObjectByKey(manifest.pages); + return manifest; + } + async writeNextFontManifest() { + if (!this.fontManifests.takeChanged()) { + return; + } + const fontManifest = this.mergeFontManifests(this.fontManifests.values()); + const json = JSON.stringify(fontManifest, null, 2); + const fontManifestJsonPath = join(this.distDir, 'server', `${NEXT_FONT_MANIFEST}.json`); + const fontManifestJsPath = join(this.distDir, 'server', `${NEXT_FONT_MANIFEST}.js`); + this.pendingCacheDeletes.push(fontManifestJsonPath); + this.pendingCacheDeletes.push(fontManifestJsPath); + writeFileAtomic(fontManifestJsonPath, json); + writeFileAtomic(fontManifestJsPath, `self.__NEXT_FONT_MANIFEST=${JSON.stringify(json)}`); + } + /** + * @returns If the manifest was written or not + */ loadMiddlewareManifest(pageName, type) { + const middlewareManifestPath = getManifestPath(pageName, this.distDir, MIDDLEWARE_MANIFEST, type, true); + // middlewareManifest is actually "edge manifest" and not all routes are edge runtime. If it is not written we skip it. + if (!existsSync(middlewareManifestPath)) { + return false; + } + this.middlewareManifests.set(getEntryKey(type === 'middleware' || type === 'instrumentation' ? 'root' : type, 'server', pageName), readPartialManifestContent(this.distDir, MIDDLEWARE_MANIFEST, pageName, type)); + return true; + } + getMiddlewareManifest(key) { + return this.middlewareManifests.get(key); + } + deleteMiddlewareManifest(key) { + return this.middlewareManifests.delete(key); + } + mergeMiddlewareManifests(manifests) { + const manifest = { + version: 3, + middleware: {}, + sortedMiddleware: [], + functions: {} + }; + let instrumentation = undefined; + for (const m of manifests){ + Object.assign(manifest.functions, m.functions); + Object.assign(manifest.middleware, m.middleware); + if (m.instrumentation) { + instrumentation = m.instrumentation; + } + } + manifest.functions = sortObjectByKey(manifest.functions); + manifest.middleware = sortObjectByKey(manifest.middleware); + const updateFunctionDefinition = (fun)=>{ + return { + ...fun, + files: [ + ...instrumentation?.files ?? [], + ...fun.files + ] + }; + }; + for (const key of Object.keys(manifest.middleware)){ + const value = manifest.middleware[key]; + manifest.middleware[key] = updateFunctionDefinition(value); + } + for (const key of Object.keys(manifest.functions)){ + const value = manifest.functions[key]; + manifest.functions[key] = updateFunctionDefinition(value); + } + for (const fun of Object.values(manifest.functions).concat(Object.values(manifest.middleware))){ + for (const matcher of fun.matchers){ + if (!matcher.regexp) { + matcher.regexp = safePathToRegexp(matcher.originalSource, [], { + delimiter: '/', + sensitive: false, + strict: true + }).source.replaceAll('\\/', '/'); + } + } + } + manifest.sortedMiddleware = Object.keys(manifest.middleware); + return manifest; + } + writeMiddlewareManifest() { + let clientMiddlewareManifestPath = posix.join(CLIENT_STATIC_FILES_PATH, this.buildId, TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST); + if (this.dev && !this.middlewareManifests.takeChanged()) { + return { + clientMiddlewareManifestPath + }; + } + const middlewareManifest = this.mergeMiddlewareManifests(this.middlewareManifests.values()); + // Server middleware manifest + // Normalize regexes as it uses path-to-regexp + for(const key in middlewareManifest.middleware){ + middlewareManifest.middleware[key].matchers.forEach((matcher)=>{ + if (!matcher.regexp.startsWith('^')) { + const parsedPage = tryToParsePath(matcher.regexp); + if (parsedPage.error || !parsedPage.regexStr) { + throw new Error(`Invalid source: ${matcher.regexp}`); + } + matcher.regexp = parsedPage.regexStr; + } + }); + } + const middlewareManifestPath = join(this.distDir, 'server', MIDDLEWARE_MANIFEST); + this.pendingCacheDeletes.push(middlewareManifestPath); + writeFileAtomic(middlewareManifestPath, JSON.stringify(middlewareManifest, null, 2)); + // Client middleware manifest This is only used in dev though, packages/next/src/build/index.ts + // writes the manifest again for builds. + const matchers = middlewareManifest?.middleware['/']?.matchers || []; + const clientMiddlewareManifestJs = `self.__MIDDLEWARE_MATCHERS = ${JSON.stringify(matchers, null, 2)};self.__MIDDLEWARE_MATCHERS_CB && self.__MIDDLEWARE_MATCHERS_CB()`; + this.pendingCacheDeletes.push(clientMiddlewareManifestPath); + writeFileAtomic(join(this.distDir, clientMiddlewareManifestPath), clientMiddlewareManifestJs); + return { + clientMiddlewareManifestPath + }; + } + loadPagesManifest(pageName) { + this.pagesManifests.set(getEntryKey('pages', 'server', pageName), readPartialManifestContent(this.distDir, PAGES_MANIFEST, pageName)); + } + mergePagesManifests(manifests) { + const manifest = {}; + for (const m of manifests){ + Object.assign(manifest, m); + } + return sortObjectByKey(manifest); + } + mergeSriManifests(manifests) { + const manifest = {}; + for (const m of manifests){ + Object.assign(manifest, m); + } + return sortObjectByKey(manifest); + } + writePagesManifest() { + if (!this.pagesManifests.takeChanged()) { + return; + } + const pagesManifest = this.mergePagesManifests(this.pagesManifests.values()); + const pagesManifestPath = join(this.distDir, 'server', PAGES_MANIFEST); + this.pendingCacheDeletes.push(pagesManifestPath); + writeFileAtomic(pagesManifestPath, JSON.stringify(pagesManifest, null, 2)); + } + writeManifests({ devRewrites, productionRewrites, entrypoints }) { + this.writeActionManifest(); + this.writeAppPathsManifest(); + const lowPriorityFiles = this.writeClientBuildManifest(entrypoints, devRewrites, productionRewrites); + const { clientMiddlewareManifestPath } = this.writeMiddlewareManifest(); + this.writeBuildManifest([ + ...lowPriorityFiles, + clientMiddlewareManifestPath + ]); + this.writeInterceptionRouteRewriteManifest(devRewrites, productionRewrites); + this.writeNextFontManifest(); + this.writePagesManifest(); + this.writeSriManifest(); + // Flush all queued cache deletions in a single require.cache scan + if (this.pendingCacheDeletes.length > 0) { + deleteCache(this.pendingCacheDeletes); + this.pendingCacheDeletes = []; + } + } +} +function sortObjectByKey(obj) { + return Object.keys(obj).sort().reduce((acc, key)=>{ + acc[key] = obj[key]; + return acc; + }, {}); +} + +//# sourceMappingURL=manifest-loader.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/manifest-loader.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/manifest-loader.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6148b34e160ad0ad377b87f8caedc52282b5d818 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/manifest-loader.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/turbopack/manifest-loader.ts"],"sourcesContent":["import type {\n EdgeFunctionDefinition,\n MiddlewareManifest,\n} from '../../../build/webpack/plugins/middleware-plugin'\nimport type { BuildManifest } from '../../../server/get-page-files'\nimport type { PagesManifest } from '../../../build/webpack/plugins/pages-manifest-plugin'\nimport type { ActionManifest } from '../../../build/webpack/plugins/flight-client-entry-plugin'\nimport type { NextFontManifest } from '../../../build/webpack/plugins/next-font-manifest-plugin'\nimport type { REACT_LOADABLE_MANIFEST } from '../constants'\nimport {\n APP_PATHS_MANIFEST,\n BUILD_MANIFEST,\n CLIENT_STATIC_FILES_PATH,\n INTERCEPTION_ROUTE_REWRITE_MANIFEST,\n MIDDLEWARE_BUILD_MANIFEST,\n MIDDLEWARE_MANIFEST,\n NEXT_FONT_MANIFEST,\n PAGES_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n SUBRESOURCE_INTEGRITY_MANIFEST,\n TURBOPACK_CLIENT_BUILD_MANIFEST,\n TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST,\n} from '../constants'\nimport { join, posix } from 'path'\nimport { readFileSync } from 'fs'\nimport type { SetupOpts } from '../../../server/lib/router-utils/setup-dev-bundler'\nimport { deleteCache } from '../../../server/dev/require-cache'\nimport { writeFileAtomic } from '../../../lib/fs/write-atomic'\nimport getAssetPathFromRoute from '../router/utils/get-asset-path-from-route'\nimport { getEntryKey, splitEntryKey, type EntryKey } from './entry-key'\nimport type { CustomRoutes } from '../../../lib/load-custom-routes'\nimport { getSortedRoutes } from '../router/utils'\nimport { existsSync } from 'fs'\nimport {\n addMetadataIdToRoute,\n addRouteSuffix,\n removeRouteSuffix,\n} from '../../../server/dev/turbopack-utils'\nimport { tryToParsePath } from '../../../lib/try-to-parse-path'\nimport { safePathToRegexp } from '../router/utils/route-match-utils'\nimport type { Entrypoints } from '../../../build/swc/types'\nimport {\n normalizeRewritesForBuildManifest,\n type ClientBuildManifest,\n srcEmptySsgManifest,\n processRoute,\n createEdgeRuntimeManifest,\n} from '../../../build/webpack/plugins/build-manifest-plugin-utils'\nimport type { SubresourceIntegrityManifest } from '../../../build'\n\ninterface InstrumentationDefinition {\n files: string[]\n name: 'instrumentation'\n}\n\ntype TurbopackMiddlewareManifest = MiddlewareManifest & {\n instrumentation?: InstrumentationDefinition\n}\n\ntype ManifestName =\n | typeof MIDDLEWARE_MANIFEST\n | typeof BUILD_MANIFEST\n | typeof PAGES_MANIFEST\n | typeof APP_PATHS_MANIFEST\n | `${typeof SERVER_REFERENCE_MANIFEST}.json`\n | `${typeof SUBRESOURCE_INTEGRITY_MANIFEST}.json`\n | `${typeof NEXT_FONT_MANIFEST}.json`\n | typeof REACT_LOADABLE_MANIFEST\n | typeof TURBOPACK_CLIENT_BUILD_MANIFEST\n\nconst getManifestPath = (\n page: string,\n distDir: string,\n name: ManifestName,\n type: string,\n firstCall: boolean\n) => {\n let manifestPath = posix.join(\n distDir,\n `server`,\n type,\n type === 'middleware' || type === 'instrumentation'\n ? ''\n : type === 'app'\n ? page\n : getAssetPathFromRoute(page),\n name\n )\n\n if (firstCall) {\n const isSitemapRoute = /[\\\\/]sitemap(.xml)?\\/route$/.test(page)\n // Check the ambiguity of /sitemap and /sitemap.xml\n if (isSitemapRoute && !existsSync(manifestPath)) {\n manifestPath = getManifestPath(\n page.replace(/\\/sitemap\\/route$/, '/sitemap.xml/route'),\n distDir,\n name,\n type,\n false\n )\n }\n // existsSync is faster than using the async version\n if (!existsSync(manifestPath) && page.endsWith('/route')) {\n // TODO: Improve implementation of metadata routes, currently it requires this extra check for the variants of the files that can be written.\n let basePage = removeRouteSuffix(page)\n // For sitemap.xml routes with generateSitemaps, the manifest is at\n // /sitemap/[__metadata_id__]/route (without .xml), because the route\n // handler serves at /sitemap/[id] not /sitemap.xml/[id]\n if (basePage.endsWith('/sitemap.xml')) {\n basePage = basePage.slice(0, -'.xml'.length)\n }\n let metadataPage = addRouteSuffix(addMetadataIdToRoute(basePage))\n manifestPath = getManifestPath(metadataPage, distDir, name, type, false)\n }\n }\n\n return manifestPath\n}\n\nfunction readPartialManifestContent(\n distDir: string,\n name: ManifestName,\n pageName: string,\n type: 'pages' | 'app' | 'middleware' | 'instrumentation' = 'pages'\n): string {\n const page = pageName\n const manifestPath = getManifestPath(page, distDir, name, type, true)\n return readFileSync(posix.join(manifestPath), 'utf-8')\n}\n\n/// Helper class that stores a map of manifests and tracks if they have changed\n/// since the last time they were written to disk. This is used to avoid\n/// unnecessary writes to disk.\nclass ManifestsMap<K, V> {\n private rawMap = new Map<K, string>()\n private map = new Map<K, V>()\n private extraInvalidationKey: string | undefined = undefined\n private changed = true\n\n set(key: K, value: string) {\n if (this.rawMap.get(key) === value) return\n this.changed = true\n this.rawMap.set(key, value)\n this.map.set(key, JSON.parse(value))\n }\n\n delete(key: K) {\n if (this.map.has(key)) {\n this.changed = true\n this.rawMap.delete(key)\n this.map.delete(key)\n }\n }\n\n get(key: K) {\n return this.map.get(key)\n }\n\n takeChanged(extraInvalidationKey?: any) {\n let changed = this.changed\n if (extraInvalidationKey !== undefined) {\n const stringified = JSON.stringify(extraInvalidationKey)\n if (this.extraInvalidationKey !== stringified) {\n this.extraInvalidationKey = stringified\n changed = true\n }\n }\n this.changed = false\n return changed\n }\n\n values() {\n return this.map.values()\n }\n\n entries() {\n return this.map.entries()\n }\n}\n\nexport class TurbopackManifestLoader {\n private actionManifests: ManifestsMap<EntryKey, ActionManifest> =\n new ManifestsMap()\n private appPathsManifests: ManifestsMap<EntryKey, PagesManifest> =\n new ManifestsMap()\n private buildManifests: ManifestsMap<EntryKey, BuildManifest> =\n new ManifestsMap()\n private clientBuildManifests: ManifestsMap<EntryKey, ClientBuildManifest> =\n new ManifestsMap()\n private fontManifests: ManifestsMap<EntryKey, NextFontManifest> =\n new ManifestsMap()\n private middlewareManifests: ManifestsMap<\n EntryKey,\n TurbopackMiddlewareManifest\n > = new ManifestsMap()\n private pagesManifests: ManifestsMap<string, PagesManifest> =\n new ManifestsMap()\n private sriManifests: ManifestsMap<EntryKey, SubresourceIntegrityManifest> =\n new ManifestsMap()\n private encryptionKey: string\n /// interceptionRewrites that have been written to disk\n /// This is used to avoid unnecessary writes if the rewrites haven't changed\n private cachedInterceptionRewrites: string | undefined = undefined\n private pendingCacheDeletes: string[] = []\n\n private readonly distDir: string\n private readonly buildId: string\n private readonly dev: boolean\n private readonly sriEnabled: boolean\n\n constructor({\n distDir,\n buildId,\n encryptionKey,\n dev,\n sriEnabled,\n }: {\n buildId: string\n distDir: string\n encryptionKey: string\n dev: boolean\n sriEnabled: boolean\n }) {\n this.distDir = distDir\n this.buildId = buildId\n this.encryptionKey = encryptionKey\n this.dev = dev\n this.sriEnabled = sriEnabled\n }\n\n delete(key: EntryKey) {\n this.actionManifests.delete(key)\n this.appPathsManifests.delete(key)\n this.buildManifests.delete(key)\n this.clientBuildManifests.delete(key)\n this.fontManifests.delete(key)\n this.middlewareManifests.delete(key)\n this.pagesManifests.delete(key)\n }\n\n loadActionManifest(pageName: string): void {\n this.actionManifests.set(\n getEntryKey('app', 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n `${SERVER_REFERENCE_MANIFEST}.json`,\n pageName,\n 'app'\n )\n )\n }\n\n private mergeActionManifests(manifests: Iterable<ActionManifest>) {\n type ActionEntries = ActionManifest['edge' | 'node']\n const manifest: ActionManifest = {\n node: {},\n edge: {},\n encryptionKey: this.encryptionKey,\n }\n\n function mergeActionIds(\n actionEntries: ActionEntries,\n other: ActionEntries\n ): void {\n for (const key in other) {\n const action = (actionEntries[key] ??= {\n workers: {},\n })\n action.filename = other[key].filename\n action.exportedName = other[key].exportedName\n Object.assign(action.workers, other[key].workers)\n }\n }\n\n for (const m of manifests) {\n mergeActionIds(manifest.node, m.node)\n mergeActionIds(manifest.edge, m.edge)\n }\n for (const key in manifest.node) {\n const entry = manifest.node[key]\n entry.workers = sortObjectByKey(entry.workers)\n }\n for (const key in manifest.edge) {\n const entry = manifest.edge[key]\n entry.workers = sortObjectByKey(entry.workers)\n }\n\n return manifest\n }\n\n private writeActionManifest(): void {\n if (!this.actionManifests.takeChanged()) {\n return\n }\n const actionManifest = this.mergeActionManifests(\n this.actionManifests.values()\n )\n const actionManifestJsonPath = join(\n this.distDir,\n 'server',\n `${SERVER_REFERENCE_MANIFEST}.json`\n )\n const actionManifestJsPath = join(\n this.distDir,\n 'server',\n `${SERVER_REFERENCE_MANIFEST}.js`\n )\n const json = JSON.stringify(actionManifest, null, 2)\n this.pendingCacheDeletes.push(actionManifestJsonPath)\n this.pendingCacheDeletes.push(actionManifestJsPath)\n writeFileAtomic(actionManifestJsonPath, json)\n writeFileAtomic(\n actionManifestJsPath,\n `self.__RSC_SERVER_MANIFEST=${JSON.stringify(json)}`\n )\n }\n\n loadAppPathsManifest(pageName: string): void {\n this.appPathsManifests.set(\n getEntryKey('app', 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n APP_PATHS_MANIFEST,\n pageName,\n 'app'\n )\n )\n }\n\n private writeAppPathsManifest(): void {\n if (!this.appPathsManifests.takeChanged()) {\n return\n }\n const appPathsManifest = this.mergePagesManifests(\n this.appPathsManifests.values()\n )\n const appPathsManifestPath = join(\n this.distDir,\n 'server',\n APP_PATHS_MANIFEST\n )\n this.pendingCacheDeletes.push(appPathsManifestPath)\n writeFileAtomic(\n appPathsManifestPath,\n JSON.stringify(appPathsManifest, null, 2)\n )\n }\n\n private writeSriManifest(): void {\n if (!this.sriEnabled || !this.sriManifests.takeChanged()) {\n return\n }\n const sriManifest = this.mergeSriManifests(this.sriManifests.values())\n const pathJson = join(\n this.distDir,\n 'server',\n `${SUBRESOURCE_INTEGRITY_MANIFEST}.json`\n )\n const pathJs = join(\n this.distDir,\n 'server',\n `${SUBRESOURCE_INTEGRITY_MANIFEST}.js`\n )\n this.pendingCacheDeletes.push(pathJson)\n this.pendingCacheDeletes.push(pathJs)\n writeFileAtomic(pathJson, JSON.stringify(sriManifest, null, 2))\n writeFileAtomic(\n pathJs,\n `self.__SUBRESOURCE_INTEGRITY_MANIFEST=${JSON.stringify(\n JSON.stringify(sriManifest)\n )}`\n )\n }\n\n loadBuildManifest(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n this.buildManifests.set(\n getEntryKey(type, 'server', pageName),\n readPartialManifestContent(this.distDir, BUILD_MANIFEST, pageName, type)\n )\n }\n\n loadClientBuildManifest(\n pageName: string,\n type: 'app' | 'pages' = 'pages'\n ): void {\n this.clientBuildManifests.set(\n getEntryKey(type, 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n TURBOPACK_CLIENT_BUILD_MANIFEST,\n pageName,\n type\n )\n )\n }\n\n loadSriManifest(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n if (!this.sriEnabled) return\n this.sriManifests.set(\n getEntryKey(type, 'client', pageName),\n readPartialManifestContent(\n this.distDir,\n `${SUBRESOURCE_INTEGRITY_MANIFEST}.json`,\n pageName,\n type\n )\n )\n }\n\n private mergeBuildManifests(\n manifests: Iterable<BuildManifest>,\n lowPriorityFiles: string[]\n ) {\n const manifest: Partial<BuildManifest> & Pick<BuildManifest, 'pages'> = {\n pages: {\n '/_app': [],\n },\n // Something in next.js depends on these to exist even for app dir rendering\n devFiles: [],\n polyfillFiles: [],\n lowPriorityFiles,\n rootMainFiles: [],\n rootMainFilesTree: {},\n pagesChunkGroupBootstrapParams: {},\n }\n for (const m of manifests) {\n Object.assign(manifest.pages, m.pages)\n if (m.rootMainFiles.length) manifest.rootMainFiles = m.rootMainFiles\n // polyfillFiles should always be the same, so we can overwrite instead of actually merging\n if (m.polyfillFiles.length) manifest.polyfillFiles = m.polyfillFiles\n if (m.rootMainFilesTree) {\n Object.assign(manifest.rootMainFilesTree!, m.rootMainFilesTree)\n }\n if (m.pagesChunkGroupBootstrapParams) {\n Object.assign(\n manifest.pagesChunkGroupBootstrapParams!,\n m.pagesChunkGroupBootstrapParams\n )\n }\n if (m.chunkLoadingGlobal)\n manifest.chunkLoadingGlobal = m.chunkLoadingGlobal\n }\n manifest.pages = sortObjectByKey(manifest.pages) as BuildManifest['pages']\n return manifest\n }\n\n private mergeClientBuildManifests(\n manifests: Iterable<ClientBuildManifest>,\n rewrites: CustomRoutes['rewrites'],\n sortedPageKeys: string[]\n ): ClientBuildManifest {\n const manifest = {\n __rewrites: rewrites as any,\n sortedPages: sortedPageKeys,\n }\n for (const m of manifests) {\n Object.assign(manifest, m)\n }\n return sortObjectByKey(manifest)\n }\n\n private writeInterceptionRouteRewriteManifest(\n devRewrites: SetupOpts['fsChecker']['rewrites'] | undefined,\n productionRewrites: CustomRoutes['rewrites'] | undefined\n ): void {\n const rewrites = productionRewrites ?? {\n ...devRewrites,\n beforeFiles: (devRewrites?.beforeFiles ?? []).map(processRoute),\n afterFiles: (devRewrites?.afterFiles ?? []).map(processRoute),\n fallback: (devRewrites?.fallback ?? []).map(processRoute),\n }\n\n const interceptionRewrites = JSON.stringify(\n rewrites.beforeFiles.filter(\n (\n require('../../../lib/is-interception-route-rewrite') as typeof import('../../../lib/is-interception-route-rewrite')\n ).isInterceptionRouteRewrite\n )\n )\n\n if (this.cachedInterceptionRewrites === interceptionRewrites) {\n return\n }\n this.cachedInterceptionRewrites = interceptionRewrites\n\n const interceptionRewriteManifestPath = join(\n this.distDir,\n 'server',\n `${INTERCEPTION_ROUTE_REWRITE_MANIFEST}.js`\n )\n this.pendingCacheDeletes.push(interceptionRewriteManifestPath)\n\n writeFileAtomic(\n interceptionRewriteManifestPath,\n `self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST=${JSON.stringify(\n interceptionRewrites\n )};`\n )\n }\n\n private writeBuildManifest(lowPriorityFiles: string[]): void {\n if (!this.buildManifests.takeChanged()) {\n return\n }\n const buildManifest = this.mergeBuildManifests(\n this.buildManifests.values(),\n lowPriorityFiles\n )\n\n const buildManifestPath = join(this.distDir, BUILD_MANIFEST)\n const middlewareBuildManifestPath = join(\n this.distDir,\n 'server',\n `${MIDDLEWARE_BUILD_MANIFEST}.js`\n )\n\n this.pendingCacheDeletes.push(buildManifestPath)\n this.pendingCacheDeletes.push(middlewareBuildManifestPath)\n writeFileAtomic(buildManifestPath, JSON.stringify(buildManifest, null, 2))\n writeFileAtomic(\n middlewareBuildManifestPath,\n createEdgeRuntimeManifest(buildManifest)\n )\n\n // Write fallback build manifest\n const fallbackBuildManifest = this.mergeBuildManifests(\n [\n this.buildManifests.get(getEntryKey('pages', 'server', '_app')),\n this.buildManifests.get(getEntryKey('pages', 'server', '_error')),\n ].filter(Boolean) as BuildManifest[],\n lowPriorityFiles\n )\n const fallbackBuildManifestPath = join(\n this.distDir,\n `fallback-${BUILD_MANIFEST}`\n )\n this.pendingCacheDeletes.push(fallbackBuildManifestPath)\n writeFileAtomic(\n fallbackBuildManifestPath,\n JSON.stringify(fallbackBuildManifest, null, 2)\n )\n }\n\n private writeClientBuildManifest(\n entrypoints: Entrypoints,\n devRewrites: SetupOpts['fsChecker']['rewrites'] | undefined,\n productionRewrites: CustomRoutes['rewrites'] | undefined\n ): string[] {\n const rewrites = normalizeRewritesForBuildManifest(\n productionRewrites ?? {\n ...devRewrites,\n beforeFiles: (devRewrites?.beforeFiles ?? []).map(processRoute),\n afterFiles: (devRewrites?.afterFiles ?? []).map(processRoute),\n fallback: (devRewrites?.fallback ?? []).map(processRoute),\n }\n )\n\n const pagesKeys = [...entrypoints.page.keys()]\n if (entrypoints.global.app) {\n pagesKeys.push('/_app')\n }\n if (entrypoints.global.error) {\n pagesKeys.push('/_error')\n }\n\n const sortedPageKeys = getSortedRoutes(pagesKeys)\n\n let buildManifestPath = posix.join(\n CLIENT_STATIC_FILES_PATH,\n this.buildId,\n '_buildManifest.js'\n )\n let ssgManifestPath = posix.join(\n CLIENT_STATIC_FILES_PATH,\n this.buildId,\n '_ssgManifest.js'\n )\n\n if (\n this.dev &&\n !this.clientBuildManifests.takeChanged({ rewrites, sortedPageKeys })\n ) {\n return [buildManifestPath, ssgManifestPath]\n }\n\n const clientBuildManifest = this.mergeClientBuildManifests(\n this.clientBuildManifests.values(),\n rewrites,\n sortedPageKeys\n )\n\n // Expose each route's bootstrap params and the chunk-loading global to the client\n // so `route-loader` can instantiate a navigated page's entry module. The server\n // stores params as raw JSON per route.\n const pageBootstrapParams: Record<string, unknown> = {}\n let chunkLoadingGlobal: string | undefined\n for (const [key, m] of this.buildManifests.entries()) {\n // Only the pages-router `route-loader` reads `__TURBOPACK_PAGE_BOOTSTRAP`. App routes\n // navigate via flight and never use it, so skip app entries to keep `_buildManifest.js`\n // (loaded on every page) small.\n if (splitEntryKey(key).type !== 'pages') continue\n if (m.chunkLoadingGlobal) chunkLoadingGlobal = m.chunkLoadingGlobal\n for (const [route, params] of Object.entries(\n m.pagesChunkGroupBootstrapParams ?? {}\n )) {\n pageBootstrapParams[route] = params\n }\n }\n\n // Only emit the bootstrap globals when a route actually inlined its bootstrap (shared runtime\n // enabled).\n const hasBootstrapParams = Object.keys(pageBootstrapParams).length > 0\n const clientBuildManifestJs =\n `self.__BUILD_MANIFEST = ${JSON.stringify(clientBuildManifest, null, 2)};` +\n (hasBootstrapParams\n ? `self.__TURBOPACK_PAGE_BOOTSTRAP = ${JSON.stringify(pageBootstrapParams)};` +\n (chunkLoadingGlobal\n ? `self.__TURBOPACK_CHUNK_LOADING_GLOBAL = ${JSON.stringify(\n chunkLoadingGlobal\n )};`\n : '')\n : '') +\n `self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()`\n\n writeFileAtomic(\n join(this.distDir, buildManifestPath),\n clientBuildManifestJs\n )\n // This is just an empty placeholder, the actual manifest is written after prerendering in\n // packages/next/src/build/index.ts\n writeFileAtomic(join(this.distDir, ssgManifestPath), srcEmptySsgManifest)\n\n return [buildManifestPath, ssgManifestPath]\n }\n\n loadFontManifest(pageName: string, type: 'app' | 'pages' = 'pages'): void {\n this.fontManifests.set(\n getEntryKey(type, 'server', pageName),\n readPartialManifestContent(\n this.distDir,\n `${NEXT_FONT_MANIFEST}.json`,\n pageName,\n type\n )\n )\n }\n\n private mergeFontManifests(manifests: Iterable<NextFontManifest>) {\n const manifest: NextFontManifest = {\n app: {},\n appUsingSizeAdjust: false,\n pages: {},\n pagesUsingSizeAdjust: false,\n }\n for (const m of manifests) {\n Object.assign(manifest.app, m.app)\n Object.assign(manifest.pages, m.pages)\n\n manifest.appUsingSizeAdjust =\n manifest.appUsingSizeAdjust || m.appUsingSizeAdjust\n manifest.pagesUsingSizeAdjust =\n manifest.pagesUsingSizeAdjust || m.pagesUsingSizeAdjust\n }\n manifest.app = sortObjectByKey(manifest.app)\n manifest.pages = sortObjectByKey(manifest.pages)\n return manifest\n }\n\n private async writeNextFontManifest(): Promise<void> {\n if (!this.fontManifests.takeChanged()) {\n return\n }\n const fontManifest = this.mergeFontManifests(this.fontManifests.values())\n const json = JSON.stringify(fontManifest, null, 2)\n\n const fontManifestJsonPath = join(\n this.distDir,\n 'server',\n `${NEXT_FONT_MANIFEST}.json`\n )\n const fontManifestJsPath = join(\n this.distDir,\n 'server',\n `${NEXT_FONT_MANIFEST}.js`\n )\n this.pendingCacheDeletes.push(fontManifestJsonPath)\n this.pendingCacheDeletes.push(fontManifestJsPath)\n writeFileAtomic(fontManifestJsonPath, json)\n writeFileAtomic(\n fontManifestJsPath,\n `self.__NEXT_FONT_MANIFEST=${JSON.stringify(json)}`\n )\n }\n\n /**\n * @returns If the manifest was written or not\n */\n loadMiddlewareManifest(\n pageName: string,\n type: 'pages' | 'app' | 'middleware' | 'instrumentation'\n ): boolean {\n const middlewareManifestPath = getManifestPath(\n pageName,\n this.distDir,\n MIDDLEWARE_MANIFEST,\n type,\n true\n )\n\n // middlewareManifest is actually \"edge manifest\" and not all routes are edge runtime. If it is not written we skip it.\n if (!existsSync(middlewareManifestPath)) {\n return false\n }\n\n this.middlewareManifests.set(\n getEntryKey(\n type === 'middleware' || type === 'instrumentation' ? 'root' : type,\n 'server',\n pageName\n ),\n readPartialManifestContent(\n this.distDir,\n MIDDLEWARE_MANIFEST,\n pageName,\n type\n )\n )\n\n return true\n }\n\n getMiddlewareManifest(key: EntryKey) {\n return this.middlewareManifests.get(key)\n }\n\n deleteMiddlewareManifest(key: EntryKey) {\n return this.middlewareManifests.delete(key)\n }\n\n private mergeMiddlewareManifests(\n manifests: Iterable<TurbopackMiddlewareManifest>\n ): MiddlewareManifest {\n const manifest: MiddlewareManifest = {\n version: 3,\n middleware: {},\n sortedMiddleware: [],\n functions: {},\n }\n let instrumentation: InstrumentationDefinition | undefined = undefined\n for (const m of manifests) {\n Object.assign(manifest.functions, m.functions)\n Object.assign(manifest.middleware, m.middleware)\n if (m.instrumentation) {\n instrumentation = m.instrumentation\n }\n }\n manifest.functions = sortObjectByKey(manifest.functions)\n manifest.middleware = sortObjectByKey(manifest.middleware)\n const updateFunctionDefinition = (\n fun: EdgeFunctionDefinition\n ): EdgeFunctionDefinition => {\n return {\n ...fun,\n files: [...(instrumentation?.files ?? []), ...fun.files],\n }\n }\n for (const key of Object.keys(manifest.middleware)) {\n const value = manifest.middleware[key]\n manifest.middleware[key] = updateFunctionDefinition(value)\n }\n for (const key of Object.keys(manifest.functions)) {\n const value = manifest.functions[key]\n manifest.functions[key] = updateFunctionDefinition(value)\n }\n for (const fun of Object.values(manifest.functions).concat(\n Object.values(manifest.middleware)\n )) {\n for (const matcher of fun.matchers) {\n if (!matcher.regexp) {\n matcher.regexp = safePathToRegexp(matcher.originalSource, [], {\n delimiter: '/',\n sensitive: false,\n strict: true,\n }).source.replaceAll('\\\\/', '/')\n }\n }\n }\n manifest.sortedMiddleware = Object.keys(manifest.middleware)\n\n return manifest\n }\n\n private writeMiddlewareManifest(): {\n clientMiddlewareManifestPath: string\n } {\n let clientMiddlewareManifestPath = posix.join(\n CLIENT_STATIC_FILES_PATH,\n this.buildId,\n TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST\n )\n\n if (this.dev && !this.middlewareManifests.takeChanged()) {\n return {\n clientMiddlewareManifestPath,\n }\n }\n const middlewareManifest = this.mergeMiddlewareManifests(\n this.middlewareManifests.values()\n )\n\n // Server middleware manifest\n\n // Normalize regexes as it uses path-to-regexp\n for (const key in middlewareManifest.middleware) {\n middlewareManifest.middleware[key].matchers.forEach((matcher) => {\n if (!matcher.regexp.startsWith('^')) {\n const parsedPage = tryToParsePath(matcher.regexp)\n if (parsedPage.error || !parsedPage.regexStr) {\n throw new Error(`Invalid source: ${matcher.regexp}`)\n }\n matcher.regexp = parsedPage.regexStr\n }\n })\n }\n\n const middlewareManifestPath = join(\n this.distDir,\n 'server',\n MIDDLEWARE_MANIFEST\n )\n this.pendingCacheDeletes.push(middlewareManifestPath)\n writeFileAtomic(\n middlewareManifestPath,\n JSON.stringify(middlewareManifest, null, 2)\n )\n\n // Client middleware manifest This is only used in dev though, packages/next/src/build/index.ts\n // writes the manifest again for builds.\n const matchers = middlewareManifest?.middleware['/']?.matchers || []\n\n const clientMiddlewareManifestJs = `self.__MIDDLEWARE_MATCHERS = ${JSON.stringify(\n matchers,\n null,\n 2\n )};self.__MIDDLEWARE_MATCHERS_CB && self.__MIDDLEWARE_MATCHERS_CB()`\n\n this.pendingCacheDeletes.push(clientMiddlewareManifestPath)\n writeFileAtomic(\n join(this.distDir, clientMiddlewareManifestPath),\n clientMiddlewareManifestJs\n )\n\n return {\n clientMiddlewareManifestPath,\n }\n }\n\n loadPagesManifest(pageName: string): void {\n this.pagesManifests.set(\n getEntryKey('pages', 'server', pageName),\n readPartialManifestContent(this.distDir, PAGES_MANIFEST, pageName)\n )\n }\n\n private mergePagesManifests(manifests: Iterable<PagesManifest>) {\n const manifest: PagesManifest = {}\n for (const m of manifests) {\n Object.assign(manifest, m)\n }\n return sortObjectByKey(manifest)\n }\n\n private mergeSriManifests(manifests: Iterable<SubresourceIntegrityManifest>) {\n const manifest: SubresourceIntegrityManifest = {}\n for (const m of manifests) {\n Object.assign(manifest, m)\n }\n return sortObjectByKey(manifest)\n }\n\n private writePagesManifest(): void {\n if (!this.pagesManifests.takeChanged()) {\n return\n }\n const pagesManifest = this.mergePagesManifests(this.pagesManifests.values())\n const pagesManifestPath = join(this.distDir, 'server', PAGES_MANIFEST)\n this.pendingCacheDeletes.push(pagesManifestPath)\n writeFileAtomic(pagesManifestPath, JSON.stringify(pagesManifest, null, 2))\n }\n\n writeManifests({\n devRewrites,\n productionRewrites,\n entrypoints,\n }: {\n devRewrites: SetupOpts['fsChecker']['rewrites'] | undefined\n productionRewrites: CustomRoutes['rewrites'] | undefined\n entrypoints: Entrypoints\n }): void {\n this.writeActionManifest()\n this.writeAppPathsManifest()\n const lowPriorityFiles = this.writeClientBuildManifest(\n entrypoints,\n devRewrites,\n productionRewrites\n )\n const { clientMiddlewareManifestPath } = this.writeMiddlewareManifest()\n this.writeBuildManifest([...lowPriorityFiles, clientMiddlewareManifestPath])\n this.writeInterceptionRouteRewriteManifest(devRewrites, productionRewrites)\n this.writeNextFontManifest()\n this.writePagesManifest()\n\n this.writeSriManifest()\n\n // Flush all queued cache deletions in a single require.cache scan\n if (this.pendingCacheDeletes.length > 0) {\n deleteCache(this.pendingCacheDeletes)\n this.pendingCacheDeletes = []\n }\n }\n}\n\nfunction sortObjectByKey(obj: Record<string, any>) {\n return Object.keys(obj)\n .sort()\n .reduce(\n (acc, key) => {\n acc[key] = obj[key]\n return acc\n },\n {} as Record<string, any>\n )\n}\n"],"names":["APP_PATHS_MANIFEST","BUILD_MANIFEST","CLIENT_STATIC_FILES_PATH","INTERCEPTION_ROUTE_REWRITE_MANIFEST","MIDDLEWARE_BUILD_MANIFEST","MIDDLEWARE_MANIFEST","NEXT_FONT_MANIFEST","PAGES_MANIFEST","SERVER_REFERENCE_MANIFEST","SUBRESOURCE_INTEGRITY_MANIFEST","TURBOPACK_CLIENT_BUILD_MANIFEST","TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST","join","posix","readFileSync","deleteCache","writeFileAtomic","getAssetPathFromRoute","getEntryKey","splitEntryKey","getSortedRoutes","existsSync","addMetadataIdToRoute","addRouteSuffix","removeRouteSuffix","tryToParsePath","safePathToRegexp","normalizeRewritesForBuildManifest","srcEmptySsgManifest","processRoute","createEdgeRuntimeManifest","getManifestPath","page","distDir","name","type","firstCall","manifestPath","isSitemapRoute","test","replace","endsWith","basePage","slice","length","metadataPage","readPartialManifestContent","pageName","ManifestsMap","set","key","value","rawMap","get","changed","map","JSON","parse","delete","has","takeChanged","extraInvalidationKey","undefined","stringified","stringify","values","entries","Map","TurbopackManifestLoader","constructor","buildId","encryptionKey","dev","sriEnabled","actionManifests","appPathsManifests","buildManifests","clientBuildManifests","fontManifests","middlewareManifests","pagesManifests","sriManifests","cachedInterceptionRewrites","pendingCacheDeletes","loadActionManifest","mergeActionManifests","manifests","manifest","node","edge","mergeActionIds","actionEntries","other","action","workers","filename","exportedName","Object","assign","m","entry","sortObjectByKey","writeActionManifest","actionManifest","actionManifestJsonPath","actionManifestJsPath","json","push","loadAppPathsManifest","writeAppPathsManifest","appPathsManifest","mergePagesManifests","appPathsManifestPath","writeSriManifest","sriManifest","mergeSriManifests","pathJson","pathJs","loadBuildManifest","loadClientBuildManifest","loadSriManifest","mergeBuildManifests","lowPriorityFiles","pages","devFiles","polyfillFiles","rootMainFiles","rootMainFilesTree","pagesChunkGroupBootstrapParams","chunkLoadingGlobal","mergeClientBuildManifests","rewrites","sortedPageKeys","__rewrites","sortedPages","writeInterceptionRouteRewriteManifest","devRewrites","productionRewrites","beforeFiles","afterFiles","fallback","interceptionRewrites","filter","require","isInterceptionRouteRewrite","interceptionRewriteManifestPath","writeBuildManifest","buildManifest","buildManifestPath","middlewareBuildManifestPath","fallbackBuildManifest","Boolean","fallbackBuildManifestPath","writeClientBuildManifest","entrypoints","pagesKeys","keys","global","app","error","ssgManifestPath","clientBuildManifest","pageBootstrapParams","route","params","hasBootstrapParams","clientBuildManifestJs","loadFontManifest","mergeFontManifests","appUsingSizeAdjust","pagesUsingSizeAdjust","writeNextFontManifest","fontManifest","fontManifestJsonPath","fontManifestJsPath","loadMiddlewareManifest","middlewareManifestPath","getMiddlewareManifest","deleteMiddlewareManifest","mergeMiddlewareManifests","version","middleware","sortedMiddleware","functions","instrumentation","updateFunctionDefinition","fun","files","concat","matcher","matchers","regexp","originalSource","delimiter","sensitive","strict","source","replaceAll","writeMiddlewareManifest","clientMiddlewareManifestPath","middlewareManifest","forEach","startsWith","parsedPage","regexStr","Error","clientMiddlewareManifestJs","loadPagesManifest","writePagesManifest","pagesManifest","pagesManifestPath","writeManifests","obj","sort","reduce","acc"],"mappings":"AASA,SACEA,kBAAkB,EAClBC,cAAc,EACdC,wBAAwB,EACxBC,mCAAmC,EACnCC,yBAAyB,EACzBC,mBAAmB,EACnBC,kBAAkB,EAClBC,cAAc,EACdC,yBAAyB,EACzBC,8BAA8B,EAC9BC,+BAA+B,EAC/BC,oCAAoC,QAC/B,eAAc;AACrB,SAASC,IAAI,EAAEC,KAAK,QAAQ,OAAM;AAClC,SAASC,YAAY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ACA,MAAMqJ,gBAAgB,IAAI,CAAClG,mBAAmB,CAAC,IAAI,CAAC/B,cAAc,CAACf,MAAM;QACzE,MAAMiJ,oBAAoBtM,KAAK,IAAI,CAACqB,OAAO,EAAE,UAAU1B;QACvD,IAAI,CAAC4E,mBAAmB,CAACwB,IAAI,CAACuG;QAC9BlM,gBAAgBkM,mBAAmB1J,KAAKQ,SAAS,CAACiJ,eAAe,MAAM;IACzE;IAEAE,eAAe,EACb3E,WAAW,EACXC,kBAAkB,EAClBiB,WAAW,EAKZ,EAAQ;QACP,IAAI,CAACpD,mBAAmB;QACxB,IAAI,CAACO,qBAAqB;QAC1B,MAAMa,mBAAmB,IAAI,CAAC+B,wBAAwB,CACpDC,aACAlB,aACAC;QAEF,MAAM,EAAE8D,4BAA4B,EAAE,GAAG,IAAI,CAACD,uBAAuB;QACrE,IAAI,CAACpD,kBAAkB,CAAC;eAAIxB;YAAkB6E;SAA6B;QAC3E,IAAI,CAAChE,qCAAqC,CAACC,aAAaC;QACxD,IAAI,CAACkC,qBAAqB;QAC1B,IAAI,CAACqC,kBAAkB;QAEvB,IAAI,CAAC/F,gBAAgB;QAErB,kEAAkE;QAClE,IAAI,IAAI,CAAC9B,mBAAmB,CAACvC,MAAM,GAAG,GAAG;YACvC7B,YAAY,IAAI,CAACoE,mBAAmB;YACpC,IAAI,CAACA,mBAAmB,GAAG,EAAE;QAC/B;IACF;AACF;AAEA,SAASkB,gBAAgB+G,GAAwB;IAC/C,OAAOnH,OAAO2D,IAAI,CAACwD,KAChBC,IAAI,GACJC,MAAM,CACL,CAACC,KAAKrK;QACJqK,GAAG,CAACrK,IAAI,GAAGkK,GAAG,CAAClK,IAAI;QACnB,OAAOqK;IACT,GACA,CAAC;AAEP","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/utils.js b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..7643a10dc96bd61765d0f884a9390ecf2d0a993e --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/utils.js @@ -0,0 +1,225 @@ +import { bold, green, magenta, red, yellow } from '../../../lib/picocolors'; +import { deobfuscateText } from '../magic-identifier'; +import * as Log from '../../../build/output/log'; +const VERBOSE_ISSUES = !!process.env.NEXT_TURBOPACK_VERBOSE_ISSUES; +/** + * An error generated from emitted Turbopack issues. This can include build + * errors caused by issues with user code. + */ export class ModuleBuildError extends Error { + constructor(...args){ + super(...args), this.name = 'ModuleBuildError'; + } +} +/** + * Thin stopgap workaround layer to mimic existing wellknown-errors-plugin in webpack's build + * to emit certain type of errors into cli. + */ export function isWellKnownError(issue) { + const { title } = issue; + const formattedTitle = renderStyledStringToErrorAnsi(title); + // TODO: add more well known errors + if (formattedTitle.includes('Module not found') || formattedTitle.includes('Unknown module type')) { + return true; + } + return false; +} +export function getIssueKey(issue) { + return `${issue.severity}-${issue.filePath}-${JSON.stringify(issue.title)}-${JSON.stringify(issue.description)}`; +} +export function processIssues(currentEntryIssues, key, result, throwIssue, logErrors) { + const newIssues = new Map(); + currentEntryIssues.set(key, newIssues); + const relevantIssues = new Set(); + for (const issue of result.issues){ + if (issue.severity !== 'error' && issue.severity !== 'fatal' && issue.severity !== 'warning') continue; + const issueKey = getIssueKey(issue); + newIssues.set(issueKey, issue); + if (issue.severity !== 'warning') { + if (throwIssue) { + const formatted = formatIssue(issue); + relevantIssues.add(formatted); + } else if (logErrors && isWellKnownError(issue)) { + const formatted = formatIssue(issue); + Log.error(formatted); + } + } + } + if (relevantIssues.size && throwIssue) { + throw new ModuleBuildError([ + ...relevantIssues + ].join('\n\n')); + } +} +function formatFilePath(filePath) { + return filePath.replace('[project]/', './').replaceAll('/./', '/').replace('\\\\?\\', ''); +} +export function formatIssue(issue) { + const { filePath, title, description, detail, source, importTraces, severity } = issue; + let { documentationLink } = issue; + let formattedTitle = renderStyledStringToErrorAnsi(title).replace(/\n/g, '\n '); + if (severity === 'bug' || severity === 'error' || severity === 'fatal') { + formattedTitle = bold(`${red('Error')}: ${formattedTitle}`); + } else if (severity === 'warning') { + formattedTitle = bold(`${yellow('Warning')}: ${formattedTitle}`); + } else { + formattedTitle = bold(`Info: ${formattedTitle}`); + } + // TODO: Use error codes to identify these + // TODO: Generalize adapting Turbopack errors to Next.js errors + if (formattedTitle.includes('Module not found')) { + // For compatiblity with webpack + // TODO: include columns in webpack errors. + documentationLink = 'https://nextjs.org/docs/messages/module-not-found'; + } + const formattedFilePath = formatFilePath(filePath); + let message = ''; + if (source?.range) { + const { start } = source.range; + message = `${formattedFilePath}:${start.line + 1}:${start.column + 1}\n${formattedTitle}`; + } else if (formattedFilePath) { + message = `${formattedFilePath}\n${formattedTitle}`; + } else { + message = formattedTitle; + } + message += '\n'; + if (issue.codeFrame) { + message += issue.codeFrame.trimEnd() + '\n\n'; + } + if (description) { + if (description.type === 'text' && description.value.includes(`Cannot find module 'sass'`)) { + message += "To use Next.js' built-in Sass support, you first need to install `sass`.\n"; + message += 'Run `npm i sass` or `yarn add sass` inside your workspace.\n'; + message += '\nLearn more: https://nextjs.org/docs/messages/install-sass\n'; + } else { + message += renderStyledStringToErrorAnsi(description) + '\n\n'; + } + } + // TODO: make it easier to enable this for debugging + if (VERBOSE_ISSUES && detail) { + message += renderStyledStringToErrorAnsi(detail) + '\n\n'; + } + // Render additional sources (e.g., generated code from a loader) + for (const additional of issue.additionalSources ?? []){ + if (additional.codeFrame) { + const additionalFilePath = formatFilePath(additional.source.source.filePath); + const loc = additional.source.range ? `:${additional.source.range.start.line + 1}:${additional.source.range.start.column + 1}` : ''; + message += `${additional.description}:\n${additionalFilePath}${loc}\n${additional.codeFrame.trimEnd()}\n\n`; + } + } + if (importTraces?.length) { + // This is the same logic as in turbopack/crates/turbopack-cli-utils/src/issue.rs + // We end up with multiple traces when the file with the error is reachable from multiple + // different entry points (e.g. ssr, client) + message += `Import trace${importTraces.length > 1 ? 's' : ''}:\n`; + const everyTraceHasADistinctRootLayer = new Set(importTraces.map(leafLayerName).filter((l)=>l != null)).size === importTraces.length; + for(let i = 0; i < importTraces.length; i++){ + const trace = importTraces[i]; + const layer = leafLayerName(trace); + let traceIndent = ' '; + // If this is true, layer must be present + if (everyTraceHasADistinctRootLayer) { + message += ` ${layer}:\n`; + } else { + if (importTraces.length > 1) { + // Otherwise use simple 1 based indices to disambiguate + message += ` #${i + 1}`; + if (layer) { + message += ` [${layer}]`; + } + message += ':\n'; + } else if (layer) { + message += ` [${layer}]:\n`; + } else { + // If there is a single trace and no layer name just don't indent it. + traceIndent = ' '; + } + } + message += formatIssueTrace(trace, traceIndent, !identicalLayers(trace)); + } + } + if (documentationLink) { + message += documentationLink + '\n\n'; + } + return message; +} +/** Returns the first present layer name in the trace */ function leafLayerName(items) { + for (const item of items){ + const layer = item.layer; + if (layer != null) return layer; + } + return undefined; +} +/** + * Returns whether or not all items share the same layer. + * If a layer is absent we ignore it in this analysis + */ function identicalLayers(items) { + const firstPresentLayer = items.findIndex((t)=>t.layer != null); + if (firstPresentLayer === -1) return true // all layers are absent + ; + const layer = items[firstPresentLayer].layer; + for(let i = firstPresentLayer + 1; i < items.length; i++){ + const itemLayer = items[i].layer; + if (itemLayer == null || itemLayer !== layer) { + return false; + } + } + return true; +} +function formatIssueTrace(items, indent, printLayers) { + return `${items.map((item)=>{ + let r = indent; + if (item.fsName !== 'project') { + r += `[${item.fsName}]/`; + } else { + // This is consistent with webpack's output + r += './'; + } + r += item.path; + if (printLayers && item.layer) { + r += ` [${item.layer}]`; + } + return r; + }).join('\n')}\n\n`; +} +export function isRelevantWarning(issue) { + return issue.severity === 'warning' && !isNodeModulesIssue(issue); +} +function isNodeModulesIssue(issue) { + if (issue.severity === 'warning' && issue.stage === 'config') { + // Override for the externalize issue + // `Package foo (serverExternalPackages or default list) can't be external` + if (renderStyledStringToErrorAnsi(issue.title).includes("can't be external")) { + return false; + } + } + return issue.severity === 'warning' && (issue.filePath.match(/^(?:.*[\\/])?node_modules(?:[\\/].*)?$/) !== null || // Ignore Next.js itself when running next directly in the monorepo where it is not inside + // node_modules anyway. + // TODO(mischnic) prevent matches when this is published to npm + issue.filePath.startsWith('[project]/packages/next/')); +} +export function renderStyledStringToErrorAnsi(string) { + function applyDeobfuscation(str) { + // Use shared deobfuscate function and apply magenta color to identifiers + const deobfuscated = deobfuscateText(str); + // Color any {...} wrapped identifiers with magenta + return deobfuscated.replace(/\{([^}]+)\}/g, (match)=>magenta(match)); + } + switch(string.type){ + case 'text': + return applyDeobfuscation(string.value); + case 'strong': + return bold(red(applyDeobfuscation(string.value))); + case 'code': + return green(applyDeobfuscation(string.value)); + case 'line': + return string.value.map(renderStyledStringToErrorAnsi).join(''); + case 'stack': + return string.value.map(renderStyledStringToErrorAnsi).join('\n'); + default: + throw new Error('Unknown StyledString type', string); + } +} +export function isFileSystemCacheEnabledForDev(config) { + return config.experimental?.turbopackFileSystemCacheForDev || false; +} + +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/utils.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/utils.js.map new file mode 100644 index 0000000000000000000000000000000000000000..df3d2614c6a8d24d6ed98be5e8e85966eeafdd49 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/turbopack/utils.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/turbopack/utils.ts"],"sourcesContent":["import type {\n Issue,\n PlainTraceItem,\n StyledString,\n TurbopackResult,\n} from '../../../build/swc/types'\n\nimport { bold, green, magenta, red, yellow } from '../../../lib/picocolors'\nimport { deobfuscateText } from '../magic-identifier'\nimport type { EntryKey } from './entry-key'\nimport * as Log from '../../../build/output/log'\nimport type { NextConfigComplete } from '../../../server/config-shared'\n\ntype IssueKey = `${Issue['severity']}-${Issue['filePath']}-${string}-${string}`\nexport type IssuesMap = Map<IssueKey, Issue>\nexport type EntryIssuesMap = Map<EntryKey, IssuesMap>\nexport type TopLevelIssuesMap = IssuesMap\n\nconst VERBOSE_ISSUES = !!process.env.NEXT_TURBOPACK_VERBOSE_ISSUES\n\n/**\n * An error generated from emitted Turbopack issues. This can include build\n * errors caused by issues with user code.\n */\nexport class ModuleBuildError extends Error {\n name = 'ModuleBuildError'\n}\n\n/**\n * Thin stopgap workaround layer to mimic existing wellknown-errors-plugin in webpack's build\n * to emit certain type of errors into cli.\n */\nexport function isWellKnownError(issue: Issue): boolean {\n const { title } = issue\n const formattedTitle = renderStyledStringToErrorAnsi(title)\n // TODO: add more well known errors\n if (\n formattedTitle.includes('Module not found') ||\n formattedTitle.includes('Unknown module type')\n ) {\n return true\n }\n\n return false\n}\n\nexport function getIssueKey(issue: Issue): IssueKey {\n return `${issue.severity}-${issue.filePath}-${JSON.stringify(\n issue.title\n )}-${JSON.stringify(issue.description)}`\n}\n\nexport function processIssues<T>(\n currentEntryIssues: EntryIssuesMap,\n key: EntryKey,\n result: TurbopackResult<T>,\n throwIssue: boolean,\n logErrors: boolean\n) {\n const newIssues = new Map<IssueKey, Issue>()\n currentEntryIssues.set(key, newIssues)\n\n const relevantIssues = new Set()\n\n for (const issue of result.issues) {\n if (\n issue.severity !== 'error' &&\n issue.severity !== 'fatal' &&\n issue.severity !== 'warning'\n )\n continue\n\n const issueKey = getIssueKey(issue)\n newIssues.set(issueKey, issue)\n\n if (issue.severity !== 'warning') {\n if (throwIssue) {\n const formatted = formatIssue(issue)\n relevantIssues.add(formatted)\n }\n // if we throw the issue it will most likely get handed and logged elsewhere\n else if (logErrors && isWellKnownError(issue)) {\n const formatted = formatIssue(issue)\n Log.error(formatted)\n }\n }\n }\n\n if (relevantIssues.size && throwIssue) {\n throw new ModuleBuildError([...relevantIssues].join('\\n\\n'))\n }\n}\n\nfunction formatFilePath(filePath: string): string {\n return filePath\n .replace('[project]/', './')\n .replaceAll('/./', '/')\n .replace('\\\\\\\\?\\\\', '')\n}\n\nexport function formatIssue(issue: Issue) {\n const {\n filePath,\n title,\n description,\n detail,\n source,\n importTraces,\n severity,\n } = issue\n let { documentationLink } = issue\n let formattedTitle = renderStyledStringToErrorAnsi(title).replace(\n /\\n/g,\n '\\n '\n )\n\n if (severity === 'bug' || severity === 'error' || severity === 'fatal') {\n formattedTitle = bold(`${red('Error')}: ${formattedTitle}`)\n } else if (severity === 'warning') {\n formattedTitle = bold(`${yellow('Warning')}: ${formattedTitle}`)\n } else {\n formattedTitle = bold(`Info: ${formattedTitle}`)\n }\n\n // TODO: Use error codes to identify these\n // TODO: Generalize adapting Turbopack errors to Next.js errors\n if (formattedTitle.includes('Module not found')) {\n // For compatiblity with webpack\n // TODO: include columns in webpack errors.\n documentationLink = 'https://nextjs.org/docs/messages/module-not-found'\n }\n\n const formattedFilePath = formatFilePath(filePath)\n\n let message = ''\n\n if (source?.range) {\n const { start } = source.range\n message = `${formattedFilePath}:${start.line + 1}:${\n start.column + 1\n }\\n${formattedTitle}`\n } else if (formattedFilePath) {\n message = `${formattedFilePath}\\n${formattedTitle}`\n } else {\n message = formattedTitle\n }\n message += '\\n'\n\n if (issue.codeFrame) {\n message += issue.codeFrame.trimEnd() + '\\n\\n'\n }\n\n if (description) {\n if (\n description.type === 'text' &&\n description.value.includes(`Cannot find module 'sass'`)\n ) {\n message +=\n \"To use Next.js' built-in Sass support, you first need to install `sass`.\\n\"\n message += 'Run `npm i sass` or `yarn add sass` inside your workspace.\\n'\n message += '\\nLearn more: https://nextjs.org/docs/messages/install-sass\\n'\n } else {\n message += renderStyledStringToErrorAnsi(description) + '\\n\\n'\n }\n }\n\n // TODO: make it easier to enable this for debugging\n if (VERBOSE_ISSUES && detail) {\n message += renderStyledStringToErrorAnsi(detail) + '\\n\\n'\n }\n\n // Render additional sources (e.g., generated code from a loader)\n for (const additional of issue.additionalSources ?? []) {\n if (additional.codeFrame) {\n const additionalFilePath = formatFilePath(\n additional.source.source.filePath\n )\n const loc = additional.source.range\n ? `:${additional.source.range.start.line + 1}:${additional.source.range.start.column + 1}`\n : ''\n message += `${additional.description}:\\n${additionalFilePath}${loc}\\n${additional.codeFrame.trimEnd()}\\n\\n`\n }\n }\n\n if (importTraces?.length) {\n // This is the same logic as in turbopack/crates/turbopack-cli-utils/src/issue.rs\n // We end up with multiple traces when the file with the error is reachable from multiple\n // different entry points (e.g. ssr, client)\n message += `Import trace${importTraces.length > 1 ? 's' : ''}:\\n`\n const everyTraceHasADistinctRootLayer =\n new Set(importTraces.map(leafLayerName).filter((l) => l != null)).size ===\n importTraces.length\n for (let i = 0; i < importTraces.length; i++) {\n const trace = importTraces[i]\n const layer = leafLayerName(trace)\n let traceIndent = ' '\n // If this is true, layer must be present\n if (everyTraceHasADistinctRootLayer) {\n message += ` ${layer}:\\n`\n } else {\n if (importTraces.length > 1) {\n // Otherwise use simple 1 based indices to disambiguate\n message += ` #${i + 1}`\n if (layer) {\n message += ` [${layer}]`\n }\n message += ':\\n'\n } else if (layer) {\n message += ` [${layer}]:\\n`\n } else {\n // If there is a single trace and no layer name just don't indent it.\n traceIndent = ' '\n }\n }\n message += formatIssueTrace(trace, traceIndent, !identicalLayers(trace))\n }\n }\n if (documentationLink) {\n message += documentationLink + '\\n\\n'\n }\n return message\n}\n\n/** Returns the first present layer name in the trace */\nfunction leafLayerName(items: PlainTraceItem[]): string | undefined {\n for (const item of items) {\n const layer = item.layer\n if (layer != null) return layer\n }\n return undefined\n}\n\n/**\n * Returns whether or not all items share the same layer.\n * If a layer is absent we ignore it in this analysis\n */\nfunction identicalLayers(items: PlainTraceItem[]): boolean {\n const firstPresentLayer = items.findIndex((t) => t.layer != null)\n if (firstPresentLayer === -1) return true // all layers are absent\n const layer = items[firstPresentLayer].layer\n for (let i = firstPresentLayer + 1; i < items.length; i++) {\n const itemLayer = items[i].layer\n if (itemLayer == null || itemLayer !== layer) {\n return false\n }\n }\n return true\n}\n\nfunction formatIssueTrace(\n items: PlainTraceItem[],\n indent: string,\n printLayers: boolean\n): string {\n return `${items\n .map((item) => {\n let r = indent\n if (item.fsName !== 'project') {\n r += `[${item.fsName}]/`\n } else {\n // This is consistent with webpack's output\n r += './'\n }\n r += item.path\n if (printLayers && item.layer) {\n r += ` [${item.layer}]`\n }\n return r\n })\n .join('\\n')}\\n\\n`\n}\n\nexport function isRelevantWarning(issue: Issue): boolean {\n return issue.severity === 'warning' && !isNodeModulesIssue(issue)\n}\n\nfunction isNodeModulesIssue(issue: Issue): boolean {\n if (issue.severity === 'warning' && issue.stage === 'config') {\n // Override for the externalize issue\n // `Package foo (serverExternalPackages or default list) can't be external`\n if (\n renderStyledStringToErrorAnsi(issue.title).includes(\"can't be external\")\n ) {\n return false\n }\n }\n\n return (\n issue.severity === 'warning' &&\n (issue.filePath.match(/^(?:.*[\\\\/])?node_modules(?:[\\\\/].*)?$/) !== null ||\n // Ignore Next.js itself when running next directly in the monorepo where it is not inside\n // node_modules anyway.\n // TODO(mischnic) prevent matches when this is published to npm\n issue.filePath.startsWith('[project]/packages/next/'))\n )\n}\n\nexport function renderStyledStringToErrorAnsi(string: StyledString): string {\n function applyDeobfuscation(str: string): string {\n // Use shared deobfuscate function and apply magenta color to identifiers\n const deobfuscated = deobfuscateText(str)\n // Color any {...} wrapped identifiers with magenta\n return deobfuscated.replace(/\\{([^}]+)\\}/g, (match) => magenta(match))\n }\n\n switch (string.type) {\n case 'text':\n return applyDeobfuscation(string.value)\n case 'strong':\n return bold(red(applyDeobfuscation(string.value)))\n case 'code':\n return green(applyDeobfuscation(string.value))\n case 'line':\n return string.value.map(renderStyledStringToErrorAnsi).join('')\n case 'stack':\n return string.value.map(renderStyledStringToErrorAnsi).join('\\n')\n default:\n throw new Error('Unknown StyledString type', string)\n }\n}\n\nexport function isFileSystemCacheEnabledForDev(\n config: NextConfigComplete\n): boolean {\n return config.experimental?.turbopackFileSystemCacheForDev || false\n}\n"],"names":["bold","green","magenta","red","yellow","deobfuscateText","Log","VERBOSE_ISSUES","process","env","NEXT_TURBOPACK_VERBOSE_ISSUES","ModuleBuildError","Error","name","isWellKnownError","issue","title","formattedTitle","renderStyledStringToErrorAnsi","includes","getIssueKey","severity","filePath","JSON","stringify","description","processIssues","currentEntryIssues","key","result","throwIssue","logErrors","newIssues","Map","set","relevantIssues","Set","issues","issueKey","formatted","formatIssue","add","error","size","join","formatFilePath","replace","replaceAll","detail","source","importTraces","documentationLink","formattedFilePath","message","range","start","line","column","codeFrame","trimEnd","type","value","additional","additionalSources","additionalFilePath","loc","length","everyTraceHasADistinctRootLayer","map","leafLayerName","filter","l","i","trace","layer","traceIndent","formatIssueTrace","identicalLayers","items","item","undefined","firstPresentLayer","findIndex","t","itemLayer","indent","printLayers","r","fsName","path","isRelevantWarning","isNodeModulesIssue","stage","match","startsWith","string","applyDeobfuscation","str","deobfuscated","isFileSystemCacheEnabledForDev","config","experimental","turbopackFileSystemCacheForDev"],"mappings":"AAOA,SAASA,IAAI,EAAEC,KAAK,EAAEC,OAAO,EAAEC,GAAG,EAAEC,MAAM,QAAQ,0BAAyB;AAC3E,SAASC,eAAe,QAAQ,sBAAqB;AAErD,YAAYC,SAAS,4BAA2B;AAQhD,MAAMC,iBAAiB,CAAC,CAACC,QAAQC,GAAG,CAACC,6BAA6B;AAElE;;;CAGC,GACD,OAAO,MAAMC,yBAAyBC;;QAA/B,qBACLC,OAAO;;AACT;AAEA;;;CAGC,GACD,OAAO,SAASC,iBAAiBC,KAAY;IAC3C,MAAM,EAAEC,KAAK,EAAE,GAAGD;IAClB,MAAME,iBAAiBC,8BAA8BF;IACrD,mCAAmC;IACnC,IACEC,eAAeE,QAAQ,CAAC,uBACxBF,eAAeE,QAAQ,CAAC,wBACxB;QACA,OAAO;IACT;IAEA,OAAO;AACT;AAEA,OAAO,SAASC,YAAYL,KAAY;IACtC,OAAO,GAAGA,MAAMM,QAAQ,CAAC,CAAC,EAAEN,MAAMO,QAAQ,CAAC,CAAC,EAAEC,KAAKC,SAAS,CAC1DT,MAAMC,KAAK,EACX,CAAC,EAAEO,KAAKC,SAAS,CAACT,MAAMU,WAAW,GAAG;AAC1C;AAEA,O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node_modules/next/dist/esm/shared/lib/typescript-utils.js b/e-commerce/node_modules/next/dist/esm/shared/lib/typescript-utils.js new file mode 100644 index 0000000000000000000000000000000000000000..934846cb28fe1fbeefd11005e5cc201fef4618b0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/typescript-utils.js @@ -0,0 +1,7 @@ +/** + * Turns optional fields into fields that are required but accept undefined, i.e. + * `NonPartial<{ x?: number }>` is `{ x: number | undefined }`. + * Source: https://github.com/microsoft/TypeScript/issues/31025#issuecomment-870011852 + * */ export { }; + +//# sourceMappingURL=typescript-utils.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/typescript-utils.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/typescript-utils.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6654d24862c70d9b6ce10b3af433ea187617fcca --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/typescript-utils.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/typescript-utils.ts"],"sourcesContent":["/**\n * Turns optional fields into fields that are required but accept undefined, i.e.\n * `NonPartial<{ x?: number }>` is `{ x: number | undefined }`.\n * Source: https://github.com/microsoft/TypeScript/issues/31025#issuecomment-870011852\n * */\nexport type NonPartial<T> = { [K in keyof Required<T>]: T[K] }\n"],"names":[],"mappings":"AAAA;;;;GAIG,GACH,WAA8D","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/utils.js b/e-commerce/node_modules/next/dist/esm/shared/lib/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..f290ea6fd13d0ddf1fdf277298d92a12cd39a6b6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/utils.js @@ -0,0 +1,130 @@ +/** + * Web vitals provided to _app.reportWebVitals by Core Web Vitals plugin developed by Google Chrome team. + * https://nextjs.org/blog/next-9-4#integrated-web-vitals-reporting + */ export const WEB_VITALS = [ + 'CLS', + 'FCP', + 'INP', + 'LCP', + 'TTFB' +]; +/** + * Utils + */ export function execOnce(fn) { + let used = false; + let result; + return (...args)=>{ + if (!used) { + used = true; + result = fn(...args); + } + return result; + }; +} +// Scheme: https://tools.ietf.org/html/rfc3986#section-3.1 +// Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3 +const ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/; +export const isAbsoluteUrl = (url)=>{ + // Fast path: an absolute URL must start with a letter (the scheme). + // Check for a-z and A-Z without the cost of the regex. + const c = url.charCodeAt(0); + const isLetter = c >= 65 /* A */ && c <= 90 || c >= 97 /* a */ && c <= 122; + /* z */ if (!isLetter) { + return false; + } + return ABSOLUTE_URL_REGEX.test(url); +}; +export function getLocationOrigin() { + const { protocol, hostname, port } = window.location; + return `${protocol}//${hostname}${port ? ':' + port : ''}`; +} +export function getURL() { + const { href } = window.location; + const origin = getLocationOrigin(); + return href.substring(origin.length); +} +export function getDisplayName(Component) { + return typeof Component === 'string' ? Component : Component.displayName || Component.name || 'Unknown'; +} +export function isResSent(res) { + return res.finished || res.headersSent; +} +export function normalizeRepeatedSlashes(url) { + const urlParts = url.split('?'); + const urlNoQuery = urlParts[0]; + return urlNoQuery// first we replace any non-encoded backslashes with forward + // then normalize repeated forward slashes + .replace(/\\/g, '/').replace(/\/\/+/g, '/') + (urlParts[1] ? `?${urlParts.slice(1).join('?')}` : ''); +} +export async function loadGetInitialProps(App, ctx) { + if (process.env.NODE_ENV !== 'production') { + if (App.prototype?.getInitialProps) { + const message = `"${getDisplayName(App)}.getInitialProps()" is defined as an instance method - visit https://nextjs.org/docs/messages/get-initial-props-as-an-instance-method for more information.`; + throw new Error(message); + } + } + // when called from _app `ctx` is nested in `ctx` + const res = ctx.res || ctx.ctx && ctx.ctx.res; + if (!App.getInitialProps) { + if (ctx.ctx && ctx.Component) { + // @ts-ignore pageProps default + return { + pageProps: await loadGetInitialProps(ctx.Component, ctx.ctx) + }; + } + return {}; + } + const props = await App.getInitialProps(ctx); + if (res && isResSent(res)) { + return props; + } + if (!props) { + const message = `"${getDisplayName(App)}.getInitialProps()" should resolve to an object. But found "${props}" instead.`; + throw new Error(message); + } + if (process.env.NODE_ENV !== 'production') { + if (Object.keys(props).length === 0 && !ctx.ctx) { + console.warn(`${getDisplayName(App)} returned an empty object from \`getInitialProps\`. This de-optimizes and prevents automatic static optimization. https://nextjs.org/docs/messages/empty-object-getInitialProps`); + } + } + return props; +} +export const SP = typeof performance !== 'undefined'; +export const ST = SP && [ + 'mark', + 'measure', + 'getEntriesByName' +].every((method)=>typeof performance[method] === 'function'); +export class DecodeError extends Error { +} +export class NormalizeError extends Error { +} +export class PageNotFoundError extends Error { + constructor(page){ + super(); + this.code = 'ENOENT'; + this.name = 'PageNotFoundError'; + this.message = `Cannot find module for page: ${page}`; + } +} +export class MissingStaticPage extends Error { + constructor(page, message){ + super(); + this.message = `Failed to load static file for page: ${page} ${message}`; + } +} +export class MiddlewareNotFoundError extends Error { + constructor(){ + super(); + this.code = 'ENOENT'; + this.message = `Cannot find the middleware module`; + } +} +export function stringifyError(error) { + return JSON.stringify({ + message: error.message, + stack: error.stack + }); +} + +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/utils.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/utils.js.map new file mode 100644 index 0000000000000000000000000000000000000000..5a7d3662e92785b1a72f5fa6737251fbe510148c --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/utils.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/utils.ts"],"sourcesContent":["import type { HtmlProps } from './html-context.shared-runtime'\nimport type { ComponentType, JSX } from 'react'\nimport type { DomainLocale } from '../../server/config'\nimport type { Env } from '@next/env'\nimport type { IncomingMessage, ServerResponse } from 'http'\nimport type { NextRouter } from './router/router'\nimport type { ParsedUrlQuery } from 'querystring'\nimport type { PreviewData } from '../../types'\nimport type { COMPILER_NAMES } from './constants'\nimport type fs from 'fs'\n\nexport type NextComponentType<\n Context extends BaseContext = NextPageContext,\n InitialProps = {},\n Props = {},\n> = ComponentType<Props> & {\n /**\n * Used for initial page load data population. Data returned from `getInitialProps` is serialized when server rendered.\n * Make sure to return plain `Object` without using `Date`, `Map`, `Set`.\n * @param context Context of `page`\n */\n getInitialProps?(context: Context): InitialProps | Promise<InitialProps>\n}\n\nexport type DocumentType = NextComponentType<\n DocumentContext,\n DocumentInitialProps,\n DocumentProps\n>\n\nexport type AppType<P = {}> = NextComponentType<\n AppContextType,\n P,\n AppPropsType<any, P>\n>\n\nexport type AppTreeType = ComponentType<\n AppInitialProps & { [name: string]: any }\n>\n\n/**\n * Web vitals provided to _app.reportWebVitals by Core Web Vitals plugin developed by Google Chrome team.\n * https://nextjs.org/blog/next-9-4#integrated-web-vitals-reporting\n */\nexport const WEB_VITALS = ['CLS', 'FCP', 'INP', 'LCP', 'TTFB'] as const\nexport type NextWebVitalsMetric = {\n id: string\n startTime: number\n value: number\n attribution?: { [key: string]: unknown }\n} & (\n | {\n label: 'web-vital'\n name: (typeof WEB_VITALS)[number]\n }\n | {\n label: 'custom'\n name:\n | 'Next.js-hydration'\n | 'Next.js-route-change-to-render'\n | 'Next.js-render'\n }\n)\n\nexport type Enhancer<C> = (Component: C) => C\n\nexport type ComponentsEnhancer =\n | {\n enhanceApp?: Enhancer<AppType>\n enhanceComponent?: Enhancer<NextComponentType>\n }\n | Enhancer<NextComponentType>\n\nexport type RenderPageResult = {\n html: string\n head?: Array<JSX.Element | null>\n}\n\nexport type RenderPage = (\n options?: ComponentsEnhancer\n) => DocumentInitialProps | Promise<DocumentInitialProps>\n\nexport type BaseContext = {\n res?: ServerResponse\n [k: string]: any\n}\n\nexport type NEXT_DATA = {\n props: Record<string, any>\n page: string\n query: ParsedUrlQuery\n buildId: string\n assetPrefix?: string\n nextExport?: boolean\n autoExport?: boolean\n isFallback?: boolean\n isExperimentalCompile?: boolean\n dynamicIds?: (string | number)[]\n err?: Error & {\n statusCode?: number\n source?: typeof COMPILER_NAMES.server | typeof COMPILER_NAMES.edgeServer\n }\n gsp?: boolean\n gssp?: boolean\n customServer?: boolean\n gip?: boolean\n appGip?: boolean\n locale?: string\n locales?: readonly string[]\n defaultLocale?: string\n domainLocales?: readonly DomainLocale[]\n scriptLoader?: any[]\n isPreview?: boolean\n notFoundSrcPage?: string\n}\n\n/**\n * `Next` context\n */\nexport interface NextPageContext {\n /**\n * Error object if encountered during rendering\n */\n err?: (Error & { statusCode?: number }) | null\n /**\n * `HTTP` request object.\n */\n req?: IncomingMessage\n /**\n * `HTTP` response object.\n */\n res?: ServerResponse\n /**\n * Path section of `URL`.\n */\n pathname: string\n /**\n * Query string section of `URL` parsed as an object.\n */\n query: ParsedUrlQuery\n /**\n * `String` of the actual path including query.\n */\n asPath?: string\n /**\n * The currently active locale\n */\n locale?: string\n /**\n * All configured locales\n */\n locales?: readonly string[]\n /**\n * The configured default locale\n */\n defaultLocale?: string\n /**\n * `Component` the tree of the App to use if needing to render separately\n */\n AppTree: AppTreeType\n}\n\nexport type AppContextType<Router extends NextRouter = NextRouter> = {\n Component: NextComponentType<NextPageContext>\n AppTree: AppTreeType\n ctx: NextPageContext\n router: Router\n}\n\nexport type AppInitialProps<PageProps = any> = {\n pageProps: PageProps\n}\n\nexport type AppPropsType<\n Router extends NextRouter = NextRouter,\n PageProps = {},\n> = AppInitialProps<PageProps> & {\n Component: NextComponentType<NextPageContext, any, any>\n router: Router\n __N_SSG?: boolean\n __N_SSP?: boolean\n}\n\nexport type DocumentContext = NextPageContext & {\n renderPage: RenderPage\n defaultGetInitialProps(\n ctx: DocumentContext,\n options?: { nonce?: string }\n ): Promise<DocumentInitialProps>\n}\n\nexport type DocumentInitialProps = RenderPageResult & {\n styles?: React.ReactElement[] | Iterable<React.ReactNode> | JSX.Element\n}\n\nexport type DocumentProps = DocumentInitialProps & HtmlProps\n\n/**\n * Next `API` route request\n */\nexport interface NextApiRequest extends IncomingMessage {\n /**\n * Object of `query` values from url\n */\n query: Partial<{\n [key: string]: string | string[]\n }>\n /**\n * Object of `cookies` from header\n */\n cookies: Partial<{\n [key: string]: string\n }>\n\n body: any\n\n env: Env\n\n draftMode?: boolean\n\n preview?: boolean\n /**\n * Preview data set on the request, if any\n * */\n previewData?: PreviewData\n}\n\n/**\n * Send body of response\n */\ntype Send<T> = (body: T) => void\n\n/**\n * Next `API` route response\n */\nexport type NextApiResponse<Data = any> = ServerResponse & {\n /**\n * Send data `any` data in response\n */\n send: Send<Data>\n /**\n * Send data `json` data in response\n */\n json: Send<Data>\n status: (statusCode: number) => NextApiResponse<Data>\n redirect(url: string): NextApiResponse<Data>\n redirect(status: number, url: string): NextApiResponse<Data>\n\n /**\n * Set draft mode\n */\n setDraftMode: (options: { enable: boolean }) => NextApiResponse<Data>\n\n /**\n * Set preview data for Next.js' prerender mode\n */\n setPreviewData: (\n data: object | string,\n options?: {\n /**\n * Specifies the number (in seconds) for the preview session to last for.\n * The given number will be converted to an integer by rounding down.\n * By default, no maximum age is set and the preview session finishes\n * when the client shuts down (browser is closed).\n */\n maxAge?: number\n /**\n * Specifies the path for the preview session to work under. By default,\n * the path is considered the \"default path\", i.e., any pages under \"/\".\n */\n path?: string\n }\n ) => NextApiResponse<Data>\n\n /**\n * Clear preview data for Next.js' prerender mode\n */\n clearPreviewData: (options?: { path?: string }) => NextApiResponse<Data>\n\n /**\n * Revalidate a specific page and regenerate it using On-Demand Incremental\n * Static Regeneration.\n * The path should be an actual path, not a rewritten path. E.g. for\n * \"/blog/[slug]\" this should be \"/blog/post-1\".\n * @link https://nextjs.org/docs/app/building-your-application/data-fetching/incremental-static-regeneration#on-demand-revalidation-with-revalidatepath\n */\n revalidate: (\n urlPath: string,\n opts?: {\n unstable_onlyGenerated?: boolean\n }\n ) => Promise<void>\n}\n\n/**\n * Next `API` route handler\n */\nexport type NextApiHandler<T = any> = (\n req: NextApiRequest,\n res: NextApiResponse<T>\n) => unknown | Promise<unknown>\n\n/**\n * Utils\n */\nexport function execOnce<T extends (...args: any[]) => ReturnType<T>>(\n fn: T\n): T {\n let used = false\n let result: ReturnType<T>\n\n return ((...args: any[]) => {\n if (!used) {\n used = true\n result = fn(...args)\n }\n return result\n }) as T\n}\n\n// Scheme: https://tools.ietf.org/html/rfc3986#section-3.1\n// Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3\nconst ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\\d+\\-.]*?:/\nexport const isAbsoluteUrl = (url: string) => {\n // Fast path: an absolute URL must start with a letter (the scheme).\n // Check for a-z and A-Z without the cost of the regex.\n const c = url.charCodeAt(0)\n const isLetter =\n (c >= 65 /* A */ && c <= 90) /* Z */ ||\n (c >= 97 /* a */ && c <= 122) /* z */\n if (!isLetter) {\n return false\n }\n\n return ABSOLUTE_URL_REGEX.test(url)\n}\n\nexport function getLocationOrigin() {\n const { protocol, hostname, port } = window.location\n return `${protocol}//${hostname}${port ? ':' + port : ''}`\n}\n\nexport function getURL() {\n const { href } = window.location\n const origin = getLocationOrigin()\n return href.substring(origin.length)\n}\n\nexport function getDisplayName<P>(Component: ComponentType<P>) {\n return typeof Component === 'string'\n ? Component\n : Component.displayName || Component.name || 'Unknown'\n}\n\nexport function isResSent(res: ServerResponse) {\n return res.finished || res.headersSent\n}\n\nexport function normalizeRepeatedSlashes(url: string) {\n const urlParts = url.split('?')\n const urlNoQuery = urlParts[0]\n\n return (\n urlNoQuery\n // first we replace any non-encoded backslashes with forward\n // then normalize repeated forward slashes\n .replace(/\\\\/g, '/')\n .replace(/\\/\\/+/g, '/') +\n (urlParts[1] ? `?${urlParts.slice(1).join('?')}` : '')\n )\n}\n\nexport async function loadGetInitialProps<\n C extends BaseContext,\n IP = {},\n P = {},\n>(App: NextComponentType<C, IP, P>, ctx: C): Promise<IP> {\n if (process.env.NODE_ENV !== 'production') {\n if (App.prototype?.getInitialProps) {\n const message = `\"${getDisplayName(\n App\n )}.getInitialProps()\" is defined as an instance method - visit https://nextjs.org/docs/messages/get-initial-props-as-an-instance-method for more information.`\n throw new Error(message)\n }\n }\n // when called from _app `ctx` is nested in `ctx`\n const res = ctx.res || (ctx.ctx && ctx.ctx.res)\n\n if (!App.getInitialProps) {\n if (ctx.ctx && ctx.Component) {\n // @ts-ignore pageProps default\n return {\n pageProps: await loadGetInitialProps(ctx.Component, ctx.ctx),\n }\n }\n return {} as IP\n }\n\n const props = await App.getInitialProps(ctx)\n\n if (res && isResSent(res)) {\n return props\n }\n\n if (!props) {\n const message = `\"${getDisplayName(\n App\n )}.getInitialProps()\" should resolve to an object. But found \"${props}\" instead.`\n throw new Error(message)\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (Object.keys(props).length === 0 && !ctx.ctx) {\n console.warn(\n `${getDisplayName(\n App\n )} returned an empty object from \\`getInitialProps\\`. This de-optimizes and prevents automatic static optimization. https://nextjs.org/docs/messages/empty-object-getInitialProps`\n )\n }\n }\n\n return props\n}\n\nexport const SP = typeof performance !== 'undefined'\nexport const ST =\n SP &&\n (['mark', 'measure', 'getEntriesByName'] as const).every(\n (method) => typeof performance[method] === 'function'\n )\n\nexport class DecodeError extends Error {}\nexport class NormalizeError extends Error {}\nexport class PageNotFoundError extends Error {\n code: string\n\n constructor(page: string) {\n super()\n this.code = 'ENOENT'\n this.name = 'PageNotFoundError'\n this.message = `Cannot find module for page: ${page}`\n }\n}\n\nexport class MissingStaticPage extends Error {\n constructor(page: string, message: string) {\n super()\n this.message = `Failed to load static file for page: ${page} ${message}`\n }\n}\n\nexport class MiddlewareNotFoundError extends Error {\n code: string\n constructor() {\n super()\n this.code = 'ENOENT'\n this.message = `Cannot find the middleware module`\n }\n}\n\nexport interface CacheFs {\n existsSync: typeof fs.existsSync\n readFile: typeof fs.promises.readFile\n readFileSync: typeof fs.readFileSync\n writeFile(f: string, d: any): Promise<void>\n /** Publish a complete file without replacing an existing destination. */\n writeFileAtomic?(f: string, d: any): Promise<boolean>\n mkdir(dir: string): Promise<void | string>\n stat(f: string): Promise<{ mtime: Date }>\n}\n\nexport function stringifyError(error: Error) {\n return JSON.stringify({ message: error.message, stack: error.stack })\n}\n"],"names":["WEB_VITALS","execOnce","fn","used","result","args","ABSOLUTE_URL_REGEX","isAbsoluteUrl","url","c","charCodeAt","isLetter","test","getLocationOrigin","protocol","hostname","port","window","location","getURL","href","origin","substring","length","getDisplayName","Component","displayName","name","isResSent","res","finished","headersSent","normalizeRepeatedSlashes","urlParts","split","urlNoQuery","replace","slice","join","loadGetInitialProps","App","ctx","process","env","NODE_ENV","prototype","getInitialProps","message","Error","pageProps","props","Object","keys","console","warn","SP","performance","ST","every","method","DecodeError","NormalizeError","PageNotFoundError","constructor","page","code","MissingStaticPage","MiddlewareNotFoundError","stringifyError","error","JSON","stringify","stack"],"mappings":"AAwCA;;;CAGC,GACD,OAAO,MAAMA,aAAa;IAAC;IAAO;IAAO;IAAO;IAAO;CAAO,CAAS;AAkQvE;;CAEC,GACD,OAAO,SAASC,SACdC,EAAK;IAEL,IAAIC,OAAO;IACX,IAAIC;IAEJ,OAAQ,CAAC,GAAGC;QACV,IAAI,CAACF,MAAM;YACTA,OAAO;YACPC,SAASF,MAAMG;QACjB;QACA,OAAOD;IACT;AACF;AAEA,0DAA0D;AAC1D,gEAAgE;AAChE,MAAME,qBAAqB;AAC3B,OAAO,MAAMC,gBAAgB,CAACC;IAC5B,oEAAoE;IACpE,uDAAuD;IACvD,MAAMC,IAAID,IAAIE,UAAU,CAAC;IACzB,MAAMC,WACJ,AAACF,KAAK,GAAG,KAAK,OAAMA,KAAK,MACxBA,KAAK,GAAG,KAAK,OAAMA,KAAK;IAAK,KAAK,GACrC,IAAI,CAACE,UAAU;QACb,OAAO;IACT;IAEA,OAAOL,mBAAmBM,IAAI,CAACJ;AACjC,EAAC;AAED,OAAO,SAASK;IACd,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGC,OAAOC,QAAQ;IACpD,OAAO,GAAGJ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AAK;QACL,IAAI,CAACE,IAAI,GAAG;QACZ,IAAI,CAAClB,OAAO,GAAG,CAAC,iCAAiC,CAAC;IACpD;AACF;AAaA,OAAO,SAASqB,eAAeC,KAAY;IACzC,OAAOC,KAAKC,SAAS,CAAC;QAAExB,SAASsB,MAAMtB,OAAO;QAAEyB,OAAOH,MAAMG,KAAK;IAAC;AACrE","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/utils/error-once.js b/e-commerce/node_modules/next/dist/esm/shared/lib/utils/error-once.js new file mode 100644 index 0000000000000000000000000000000000000000..05764780078a3fc97dfae13ab7879990dcc8f0d2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/utils/error-once.js @@ -0,0 +1,13 @@ +let errorOnce = (_)=>{}; +if (process.env.NODE_ENV !== 'production') { + const errors = new Set(); + errorOnce = (msg)=>{ + if (!errors.has(msg)) { + console.error(msg); + } + errors.add(msg); + }; +} +export { errorOnce }; + +//# sourceMappingURL=error-once.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/utils/error-once.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/utils/error-once.js.map new file mode 100644 index 0000000000000000000000000000000000000000..54470b3b4d363dc09bfcd36c8bcd4b4dc839dfca --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/utils/error-once.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/utils/error-once.ts"],"sourcesContent":["let errorOnce = (_: string) => {}\nif (process.env.NODE_ENV !== 'production') {\n const errors = new Set<string>()\n errorOnce = (msg: string) => {\n if (!errors.has(msg)) {\n console.error(msg)\n }\n errors.add(msg)\n }\n}\n\nexport { errorOnce }\n"],"names":["errorOnce","_","process","env","NODE_ENV","errors","Set","msg","has","console","error","add"],"mappings":"AAAA,IAAIA,YAAY,CAACC,KAAe;AAChC,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzC,MAAMC,SAAS,IAAIC;IACnBN,YAAY,CAACO;QACX,IAAI,CAACF,OAAOG,GAAG,CAACD,MAAM;YACpBE,QAAQC,KAAK,CAACH;QAChB;QACAF,OAAOM,GAAG,CAACJ;IACb;AACF;AAEA,SAASP,SAAS,GAAE","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/utils/reflect-utils.js b/e-commerce/node_modules/next/dist/esm/shared/lib/utils/reflect-utils.js new file mode 100644 index 0000000000000000000000000000000000000000..2607d53ceacafc88e7400e6cc51630e20b099d69 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/utils/reflect-utils.js @@ -0,0 +1,43 @@ +// This regex will have fast negatives meaning valid identifiers may not pass +// this test. However this is only used during static generation to provide hints +// about why a page bailed out of some or all prerendering and we can use bracket notation +// for example while `ಠ_ಠ` is a valid identifier it's ok to print `searchParams['ಠ_ಠ']` +// even if this would have been fine too `searchParams.ಠ_ಠ` +const isDefinitelyAValidIdentifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/; +export function describeStringPropertyAccess(target, prop) { + if (isDefinitelyAValidIdentifier.test(prop)) { + return `\`${target}.${prop}\``; + } + return `\`${target}[${JSON.stringify(prop)}]\``; +} +export function describeHasCheckingStringProperty(target, prop) { + const stringifiedProp = JSON.stringify(prop); + return `\`Reflect.has(${target}, ${stringifiedProp})\`, \`${stringifiedProp} in ${target}\`, or similar`; +} +export const wellKnownProperties = new Set([ + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'toString', + 'valueOf', + 'toLocaleString', + // Promise prototype + 'then', + 'catch', + 'finally', + // React Promise extension + 'status', + // 'value', + // 'error', + // React introspection + 'displayName', + '_debugInfo', + // Common tested properties + 'toJSON', + '$$typeof', + '__esModule', + // Tested by flight when checking for iterables + '@@iterator' +]); + +//# sourceMappingURL=reflect-utils.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/utils/reflect-utils.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/utils/reflect-utils.js.map new file mode 100644 index 0000000000000000000000000000000000000000..675edff7a2b02a079ada41dd2086f665938f2b0f --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/utils/reflect-utils.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/utils/reflect-utils.ts"],"sourcesContent":["// This regex will have fast negatives meaning valid identifiers may not pass\n// this test. However this is only used during static generation to provide hints\n// about why a page bailed out of some or all prerendering and we can use bracket notation\n// for example while `ಠ_ಠ` is a valid identifier it's ok to print `searchParams['ಠ_ಠ']`\n// even if this would have been fine too `searchParams.ಠ_ಠ`\nconst isDefinitelyAValidIdentifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/\n\nexport function describeStringPropertyAccess(target: string, prop: string) {\n if (isDefinitelyAValidIdentifier.test(prop)) {\n return `\\`${target}.${prop}\\``\n }\n return `\\`${target}[${JSON.stringify(prop)}]\\``\n}\n\nexport function describeHasCheckingStringProperty(\n target: string,\n prop: string\n) {\n const stringifiedProp = JSON.stringify(prop)\n return `\\`Reflect.has(${target}, ${stringifiedProp})\\`, \\`${stringifiedProp} in ${target}\\`, or similar`\n}\n\nexport const wellKnownProperties = new Set([\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'toString',\n 'valueOf',\n 'toLocaleString',\n\n // Promise prototype\n 'then',\n 'catch',\n 'finally',\n\n // React Promise extension\n 'status',\n // 'value',\n // 'error',\n\n // React introspection\n 'displayName',\n '_debugInfo',\n\n // Common tested properties\n 'toJSON',\n '$$typeof',\n '__esModule',\n\n // Tested by flight when checking for iterables\n '@@iterator',\n])\n"],"names":["isDefinitelyAValidIdentifier","describeStringPropertyAccess","target","prop","test","JSON","stringify","describeHasCheckingStringProperty","stringifiedProp","wellKnownProperties","Set"],"mappings":"AAAA,6EAA6E;AAC7E,iFAAiF;AACjF,0FAA0F;AAC1F,uFAAuF;AACvF,2DAA2D;AAC3D,MAAMA,+BAA+B;AAErC,OAAO,SAASC,6BAA6BC,MAAc,EAAEC,IAAY;IACvE,IAAIH,6BAA6BI,IAAI,CAACD,OAAO;QAC3C,OAAO,CAAC,EAAE,EAAED,OAAO,CAAC,EAAEC,KAAK,EAAE,CAAC;IAChC;IACA,OAAO,CAAC,EAAE,EAAED,OAAO,CAAC,EAAEG,KAAKC,SAAS,CAACH,MAAM,GAAG,CAAC;AACjD;AAEA,OAAO,SAASI,kCACdL,MAAc,EACdC,IAAY;IAEZ,MAAMK,kBAAkBH,KAAKC,SAAS,CAACH;IACvC,OAAO,CAAC,cAAc,EAAED,OAAO,EAAE,EAAEM,gBAAgB,OAAO,EAAEA,gBAAgB,IAAI,EAAEN,OAAO,cAAc,CAAC;AAC1G;AAEA,OAAO,MAAMO,sBAAsB,IAAIC,IAAI;IACzC;IACA;IACA;IACA;IACA;IACA;IAEA,oBAAoB;IACpB;IACA;IACA;IAEA,0BAA0B;IAC1B;IACA,WAAW;IACX,WAAW;IAEX,sBAAsB;IACtB;IACA;IAEA,2BAA2B;IAC3B;IACA;IACA;IAEA,+CAA+C;IAC/C;CACD,EAAC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/utils/warn-once.js b/e-commerce/node_modules/next/dist/esm/shared/lib/utils/warn-once.js new file mode 100644 index 0000000000000000000000000000000000000000..293f2867976e419bdd9ba28dc860775c161b9eb3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/utils/warn-once.js @@ -0,0 +1,13 @@ +let warnOnce = (_)=>{}; +if (process.env.NODE_ENV !== 'production') { + const warnings = new Set(); + warnOnce = (msg)=>{ + if (!warnings.has(msg)) { + console.warn(msg); + } + warnings.add(msg); + }; +} +export { warnOnce }; + +//# sourceMappingURL=warn-once.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/utils/warn-once.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/utils/warn-once.js.map new file mode 100644 index 0000000000000000000000000000000000000000..4b07aca604cce98e294cca76ffd6ad360a4055e0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/utils/warn-once.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../../src/shared/lib/utils/warn-once.ts"],"sourcesContent":["let warnOnce = (_: string) => {}\nif (process.env.NODE_ENV !== 'production') {\n const warnings = new Set<string>()\n warnOnce = (msg: string) => {\n if (!warnings.has(msg)) {\n console.warn(msg)\n }\n warnings.add(msg)\n }\n}\n\nexport { warnOnce }\n"],"names":["warnOnce","_","process","env","NODE_ENV","warnings","Set","msg","has","console","warn","add"],"mappings":"AAAA,IAAIA,WAAW,CAACC,KAAe;AAC/B,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzC,MAAMC,WAAW,IAAIC;IACrBN,WAAW,CAACO;QACV,IAAI,CAACF,SAASG,GAAG,CAACD,MAAM;YACtBE,QAAQC,IAAI,CAACH;QACf;QACAF,SAASM,GAAG,CAACJ;IACf;AACF;AAEA,SAASP,QAAQ,GAAE","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/zod.js b/e-commerce/node_modules/next/dist/esm/shared/lib/zod.js new file mode 100644 index 0000000000000000000000000000000000000000..4cef74df2357649b90a091ee2ca563812fc746f5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/zod.js @@ -0,0 +1,70 @@ +import { ZodParsedType, util } from 'next/dist/compiled/zod'; +import { fromZodError } from 'next/dist/compiled/zod-validation-error'; +import * as Log from '../../build/output/log'; +function processZodErrorMessage(issue) { + let message = issue.message; + let path; + if (issue.path.length > 0) { + if (issue.path.length === 1) { + const identifier = issue.path[0]; + if (typeof identifier === 'number') { + // The first identifier inside path is a number + path = `index ${identifier}`; + } else { + path = `"${identifier}"`; + } + } else { + // joined path to be shown in the error message + path = `"${issue.path.reduce((acc, cur)=>{ + if (typeof cur === 'number') { + // array index + return `${acc}[${cur}]`; + } + if (cur.includes('"')) { + // escape quotes + return `${acc}["${cur.replaceAll('"', '\\"')}"]`; + } + // dot notation + const separator = acc.length === 0 ? '' : '.'; + return acc + separator + cur; + }, '')}"`; + } + } else { + path = ''; + } + if (issue.code === 'invalid_type' && issue.received === ZodParsedType.undefined) { + // Missing key in object. + return `${path} is missing, expected ${issue.expected}`; + } + if (issue.code === 'invalid_enum_value') { + // Remove "Invalid enum value" prefix from zod default error message + return `Expected ${util.joinValues(issue.options)}, received '${issue.received}' at ${path}`; + } + return message + (path ? ` at ${path}` : ''); +} +export function normalizeZodErrors(error) { + return error.issues.flatMap((issue)=>{ + const issues = [ + { + issue, + message: processZodErrorMessage(issue) + } + ]; + if ('unionErrors' in issue) { + for (const unionError of issue.unionErrors){ + issues.push(...normalizeZodErrors(unionError)); + } + } + return issues; + }); +} +export function formatZodError(prefix, error) { + return new Error(fromZodError(error, { + prefix: prefix + }).toString()); +} +export function reportZodError(prefix, error) { + Log.error(formatZodError(prefix, error).message); +} + +//# sourceMappingURL=zod.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/esm/shared/lib/zod.js.map b/e-commerce/node_modules/next/dist/esm/shared/lib/zod.js.map new file mode 100644 index 0000000000000000000000000000000000000000..08beaa590728623bb891dec6594bb63ddf9348ce --- /dev/null +++ b/e-commerce/node_modules/next/dist/esm/shared/lib/zod.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/shared/lib/zod.ts"],"sourcesContent":["import type { ZodError } from 'next/dist/compiled/zod'\nimport { ZodParsedType, util, type ZodIssue } from 'next/dist/compiled/zod'\nimport { fromZodError } from 'next/dist/compiled/zod-validation-error'\nimport * as Log from '../../build/output/log'\n\nfunction processZodErrorMessage(issue: ZodIssue) {\n let message = issue.message\n\n let path: string\n\n if (issue.path.length > 0) {\n if (issue.path.length === 1) {\n const identifier = issue.path[0]\n if (typeof identifier === 'number') {\n // The first identifier inside path is a number\n path = `index ${identifier}`\n } else {\n path = `\"${identifier}\"`\n }\n } else {\n // joined path to be shown in the error message\n path = `\"${issue.path.reduce<string>((acc, cur) => {\n if (typeof cur === 'number') {\n // array index\n return `${acc}[${cur}]`\n }\n if (cur.includes('\"')) {\n // escape quotes\n return `${acc}[\"${cur.replaceAll('\"', '\\\\\"')}\"]`\n }\n // dot notation\n const separator = acc.length === 0 ? '' : '.'\n return acc + separator + cur\n }, '')}\"`\n }\n } else {\n path = ''\n }\n\n if (\n issue.code === 'invalid_type' &&\n issue.received === ZodParsedType.undefined\n ) {\n // Missing key in object.\n return `${path} is missing, expected ${issue.expected}`\n }\n\n if (issue.code === 'invalid_enum_value') {\n // Remove \"Invalid enum value\" prefix from zod default error message\n return `Expected ${util.joinValues(issue.options)}, received '${\n issue.received\n }' at ${path}`\n }\n\n return message + (path ? ` at ${path}` : '')\n}\n\nexport function normalizeZodErrors(error: ZodError) {\n return error.issues.flatMap((issue) => {\n const issues = [{ issue, message: processZodErrorMessage(issue) }]\n if ('unionErrors' in issue) {\n for (const unionError of issue.unionErrors) {\n issues.push(...normalizeZodErrors(unionError))\n }\n }\n\n return issues\n })\n}\n\nexport function formatZodError(prefix: string, error: ZodError) {\n return new Error(fromZodError(error, { prefix: prefix }).toString())\n}\n\nexport function reportZodError(prefix: string, error: ZodError) {\n Log.error(formatZodError(prefix, error).message)\n}\n"],"names":["ZodParsedType","util","fromZodError","Log","processZodErrorMessage","issue","message","path","length","identifier","reduce","acc","cur","includes","replaceAll","separator","code","received","undefined","expected","joinValues","options","normalizeZodErrors","error","issues","flatMap","unionError","unionErrors","push","formatZodError","prefix","Error","toString","reportZodError"],"mappings":"AACA,SAASA,aAAa,EAAEC,IAAI,QAAuB,yBAAwB;AAC3E,SAASC,YAAY,QAAQ,0CAAyC;AACtE,YAAYC,SAAS,yBAAwB;AAE7C,SAASC,uBAAuBC,KAAe;IAC7C,IAAIC,UAAUD,MAAMC,OAAO;IAE3B,IAAIC;IAEJ,IAAIF,MAAME,IAAI,CAACC,MAAM,GAAG,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,KAAe;IAChD,OAAOA,MAAMC,MAAM,CAACC,OAAO,CAAC,CAACpB;QAC3B,MAAMmB,SAAS;YAAC;gBAAEnB;gBAAOC,SAASF,uBAAuBC;YAAO;SAAE;QAClE,IAAI,iBAAiBA,OAAO;YAC1B,KAAK,MAAMqB,cAAcrB,MAAMsB,WAAW,CAAE;gBAC1CH,OAAOI,IAAI,IAAIN,mBAAmBI;YACpC;QACF;QAEA,OAAOF;IACT;AACF;AAEA,OAAO,SAASK,eAAeC,MAAc,EAAEP,KAAe;IAC5D,OAAO,IAAIQ,MAAM7B,aAAaqB,OAAO;QAAEO,QAAQA;IAAO,GAAGE,QAAQ;AACnE;AAEA,OAAO,SAASC,eAAeH,MAAc,EAAEP,KAAe;IAC5DpB,IAAIoB,KAAK,CAACM,eAAeC,QAAQP,OAAOjB,OAAO;AACjD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testing/server/config-testing-utils.d.ts b/e-commerce/node_modules/next/dist/experimental/testing/server/config-testing-utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..208c4774063977a58cd05b9a229e9f5bcf8a34e0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testing/server/config-testing-utils.d.ts @@ -0,0 +1,31 @@ +import type { IncomingHttpHeaders } from 'node:http'; +import { type NextConfig } from '../../../server/config-shared'; +import { NextResponse } from '../../../server/web/exports'; +/** + * Tests the logic of `headers`, `redirects`, and `rewrites` in `next.config.js`. + * Given the provided next config, this function will return a `NextResponse` + * with the result of running the request through the custom routes. + * + * @example Test whether a given URL results in a redirect. + * ``` + * import { unstable_getResponseFromNextConfig, getRedirectUrl } from 'next/server/testing' + * const response = await unstable_getResponseFromNextConfig({ + * url: 'https://nextjs.org/test', + * nextConfig: { + * async redirects() { + * return [ + * { source: '/test', destination: '/test2', permanent: false }, + * ] + * }, + * } + * }); + * expect(response.status).toEqual(307); + * expect(getRedirectUrl(response)).toEqual('https://nextjs.org/test2'); + * ``` + */ +export declare function unstable_getResponseFromNextConfig({ url, nextConfig, headers, cookies, }: { + url: string; + nextConfig: NextConfig | ((...args: any[]) => NextConfig | Promise<NextConfig>); + headers?: IncomingHttpHeaders; + cookies?: Record<string, string>; +}): Promise<NextResponse>; diff --git a/e-commerce/node_modules/next/dist/experimental/testing/server/config-testing-utils.js b/e-commerce/node_modules/next/dist/experimental/testing/server/config-testing-utils.js new file mode 100644 index 0000000000000000000000000000000000000000..e0cbbbb356e9e07f26a0ddca79aff53657073dfb --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testing/server/config-testing-utils.js @@ -0,0 +1,115 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "unstable_getResponseFromNextConfig", { + enumerable: true, + get: function() { + return unstable_getResponseFromNextConfig; + } +}); +const _pathtoregexp = require("next/dist/compiled/path-to-regexp"); +const _preparedestination = require("../../../shared/lib/router/utils/prepare-destination"); +const _constants = require("../../../shared/lib/constants"); +const _buildcustomroute = require("../../../lib/build-custom-route"); +const _loadcustomroutes = /*#__PURE__*/ _interop_require_default(require("../../../lib/load-custom-routes")); +const _configshared = require("../../../server/config-shared"); +const _exports = require("../../../server/web/exports"); +const _redirectstatus = require("../../../lib/redirect-status"); +const _utils = require("./utils"); +const _parsedurlquerytoparams = require("../../../server/route-modules/app-route/helpers/parsed-url-query-to-params"); +const _querystring = require("../../../shared/lib/router/utils/querystring"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +/** + * Tries to match the current request against the provided route. If there is + * a match, it returns the params extracted from the path. If not, it returns + * undefined. + */ function matchRoute(route, request, pathname, query) { + const regexMatches = pathname.match(route.regex); + if (regexMatches) { + const pathMatch = (0, _pathtoregexp.match)(route.source)(pathname); + if (!pathMatch) { + throw new Error('Unexpected error: extracting params from path failed but the regular expression matched'); + } + if (route.has || route.missing) { + if (!(0, _preparedestination.matchHas)(request, query, route.has, route.missing)) { + return; + } + } + return pathMatch.params; + } +} +async function unstable_getResponseFromNextConfig({ url, nextConfig, headers = {}, cookies = {} }) { + const parsed = new URL(url, 'https://example.com'); + const pathname = parsed.pathname; + const query = (0, _querystring.searchParamsToUrlQuery)(parsed.searchParams); + const request = (0, _utils.constructRequest)({ + url, + headers, + cookies + }); + const resolvedConfig = await (0, _configshared.normalizeConfig)(_constants.PHASE_PRODUCTION_BUILD, nextConfig); + const routes = await (0, _loadcustomroutes.default)(resolvedConfig); + const headerRoutes = routes.headers.map((route)=>(0, _buildcustomroute.buildCustomRoute)('header', route)); + const redirectRoutes = routes.redirects.map((route)=>(0, _buildcustomroute.buildCustomRoute)('redirect', route, [ + '/_next/' + ])); + const rewriteRoutes = [ + ...routes.rewrites.beforeFiles, + ...routes.rewrites.afterFiles, + ...routes.rewrites.fallback + ].map((route)=>(0, _buildcustomroute.buildCustomRoute)('rewrite', route)); + const respHeaders = {}; + for (const route of headerRoutes){ + const matched = matchRoute(route, request, pathname, query); + if (matched) { + for (const header of route.headers){ + respHeaders[header.key] = header.value; + } + } + } + function matchRouteAndGetDestination(route) { + const params = matchRoute(route, request, pathname, query); + if (!params) { + return; + } + const { newUrl, parsedDestination } = (0, _preparedestination.prepareDestination)({ + appendParamsToQuery: false, + destination: route.destination, + params, + query + }); + const searchParams = new URLSearchParams((0, _parsedurlquerytoparams.parsedUrlQueryToParams)(parsedDestination.query)); + return new URL(searchParams.size > 0 ? `${newUrl}?${searchParams.toString()}` : newUrl, parsedDestination.hostname ? `${parsedDestination.protocol}//${parsedDestination.hostname}` : parsed.origin); + } + for (const route of redirectRoutes){ + const redirectUrl = matchRouteAndGetDestination(route); + if (!redirectUrl) { + continue; + } + const statusCode = (0, _redirectstatus.getRedirectStatus)(route); + return _exports.NextResponse.redirect(redirectUrl, { + status: statusCode, + headers: respHeaders + }); + } + for (const route of rewriteRoutes){ + const rewriteUrl = matchRouteAndGetDestination(route); + if (!rewriteUrl) { + continue; + } + return _exports.NextResponse.rewrite(rewriteUrl, { + headers: respHeaders + }); + } + return new _exports.NextResponse('', { + status: 200, + headers: respHeaders + }); +} + +//# sourceMappingURL=config-testing-utils.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testing/server/config-testing-utils.js.map b/e-commerce/node_modules/next/dist/experimental/testing/server/config-testing-utils.js.map new file mode 100644 index 0000000000000000000000000000000000000000..53fd737d6c5901602ac2b2cbef0c80827d083dbf --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testing/server/config-testing-utils.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/experimental/testing/server/config-testing-utils.ts"],"sourcesContent":["import type { IncomingHttpHeaders } from 'node:http'\nimport type { ParsedUrlQuery } from 'querystring'\nimport { match } from 'next/dist/compiled/path-to-regexp'\nimport {\n matchHas,\n prepareDestination,\n} from '../../../shared/lib/router/utils/prepare-destination'\nimport { PHASE_PRODUCTION_BUILD } from '../../../shared/lib/constants'\nimport { buildCustomRoute } from '../../../lib/build-custom-route'\nimport loadCustomRoutes from '../../../lib/load-custom-routes'\nimport { normalizeConfig, type NextConfig } from '../../../server/config-shared'\nimport { NextResponse } from '../../../server/web/exports'\nimport { getRedirectStatus } from '../../../lib/redirect-status'\nimport type {\n ManifestHeaderRoute,\n ManifestRedirectRoute,\n ManifestRewriteRoute,\n} from '../../../build'\nimport type { BaseNextRequest } from '../../../server/base-http'\nimport type { Params } from '../../../server/request/params'\nimport { constructRequest } from './utils'\nimport { parsedUrlQueryToParams } from '../../../server/route-modules/app-route/helpers/parsed-url-query-to-params'\nimport { searchParamsToUrlQuery } from '../../../shared/lib/router/utils/querystring'\n\n/**\n * Tries to match the current request against the provided route. If there is\n * a match, it returns the params extracted from the path. If not, it returns\n * undefined.\n */\nfunction matchRoute(\n route: ManifestHeaderRoute | ManifestRedirectRoute | ManifestRewriteRoute,\n request: BaseNextRequest,\n pathname: string,\n query: ParsedUrlQuery\n): Params | undefined {\n const regexMatches = pathname.match(route.regex)\n\n if (regexMatches) {\n const pathMatch = match<Params>(route.source)(pathname)\n if (!pathMatch) {\n throw new Error(\n 'Unexpected error: extracting params from path failed but the regular expression matched'\n )\n }\n if (route.has || route.missing) {\n if (!matchHas(request, query, route.has, route.missing)) {\n return\n }\n }\n return pathMatch.params\n }\n}\n\n/**\n * Tests the logic of `headers`, `redirects`, and `rewrites` in `next.config.js`.\n * Given the provided next config, this function will return a `NextResponse`\n * with the result of running the request through the custom routes.\n *\n * @example Test whether a given URL results in a redirect.\n * ```\n * import { unstable_getResponseFromNextConfig, getRedirectUrl } from 'next/server/testing'\n * const response = await unstable_getResponseFromNextConfig({\n * url: 'https://nextjs.org/test',\n * nextConfig: {\n * async redirects() {\n * return [\n * { source: '/test', destination: '/test2', permanent: false },\n * ]\n * },\n * }\n * });\n * expect(response.status).toEqual(307);\n * expect(getRedirectUrl(response)).toEqual('https://nextjs.org/test2');\n * ```\n */\nexport async function unstable_getResponseFromNextConfig({\n url,\n nextConfig,\n headers = {},\n cookies = {},\n}: {\n url: string\n nextConfig:\n | NextConfig\n | ((...args: any[]) => NextConfig | Promise<NextConfig>)\n headers?: IncomingHttpHeaders\n cookies?: Record<string, string>\n}): Promise<NextResponse> {\n const parsed = new URL(url, 'https://example.com')\n const pathname = parsed.pathname\n const query = searchParamsToUrlQuery(parsed.searchParams)\n const request = constructRequest({ url, headers, cookies })\n const resolvedConfig = await normalizeConfig(\n PHASE_PRODUCTION_BUILD,\n nextConfig\n )\n const routes = await loadCustomRoutes(resolvedConfig)\n\n const headerRoutes = routes.headers.map((route) =>\n buildCustomRoute('header', route)\n )\n const redirectRoutes = routes.redirects.map((route) =>\n buildCustomRoute('redirect', route, ['/_next/'])\n )\n const rewriteRoutes = [\n ...routes.rewrites.beforeFiles,\n ...routes.rewrites.afterFiles,\n ...routes.rewrites.fallback,\n ].map((route) => buildCustomRoute('rewrite', route))\n\n const respHeaders: Record<string, string> = {}\n for (const route of headerRoutes) {\n const matched = matchRoute(route, request, pathname, query)\n if (matched) {\n for (const header of route.headers) {\n respHeaders[header.key] = header.value\n }\n }\n }\n function matchRouteAndGetDestination(\n route: ManifestRedirectRoute | ManifestRewriteRoute\n ): URL | undefined {\n const params = matchRoute(route, request, pathname, query)\n if (!params) {\n return\n }\n const { newUrl, parsedDestination } = prepareDestination({\n appendParamsToQuery: false,\n destination: route.destination,\n params,\n query,\n })\n const searchParams = new URLSearchParams(\n parsedUrlQueryToParams(parsedDestination.query) as Record<string, string>\n )\n return new URL(\n searchParams.size > 0 ? `${newUrl}?${searchParams.toString()}` : newUrl,\n parsedDestination.hostname\n ? `${parsedDestination.protocol}//${parsedDestination.hostname}`\n : parsed.origin\n )\n }\n for (const route of redirectRoutes) {\n const redirectUrl = matchRouteAndGetDestination(route)\n if (!redirectUrl) {\n continue\n }\n const statusCode = getRedirectStatus(route)\n return NextResponse.redirect(redirectUrl, {\n status: statusCode,\n headers: respHeaders,\n })\n }\n for (const route of rewriteRoutes) {\n const rewriteUrl = matchRouteAndGetDestination(route)\n if (!rewriteUrl) {\n continue\n }\n return NextResponse.rewrite(rewriteUrl, {\n headers: respHeaders,\n })\n }\n return new NextResponse('', { status: 200, headers: respHeaders })\n}\n"],"names":["unstable_getResponseFromNextConfig","matchRoute","route","request","pathname","query","regexMatches","match","regex","pathMatch","source","Error","has","missing","matchHas","params","url","nextConfig","headers","cookies","parsed","URL","searchParamsToUrlQuery","searchParams","constructRequest","resolvedConfig","normalizeConfig","PHASE_PRODUCTION_BUILD","routes","loadCustomRoutes","headerRoutes","map","buildCustomRoute","redirectRoutes","redirects","rewriteRoutes","rewrites","beforeFiles","afterFiles","fallback","respHeaders","matched","header","key","value","matchRouteAndGetDestination","newUrl","parsedDestination","prepareDestination","appendParamsToQuery","destination","URLSearchParams","parsedUrlQueryToParams","size","toString","hostname","protocol","origin","redirectUrl","statusCode","getRedirectStatus","NextResponse","redirect","status","rewriteUrl","rewrite"],"mappings":";;;;+BA2EsBA;;;eAAAA;;;8BAzEA;oCAIf;2BACgC;kCACN;yEACJ;8BACoB;yBACpB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AanB,4BAA4B3C;QAC/C,IAAI,CAAC8D,YAAY;YACf;QACF;QACA,OAAOH,qBAAY,CAACI,OAAO,CAACD,YAAY;YACtC9C,SAASsB;QACX;IACF;IACA,OAAO,IAAIqB,qBAAY,CAAC,IAAI;QAAEE,QAAQ;QAAK7C,SAASsB;IAAY;AAClE","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testing/server/index.d.ts b/e-commerce/node_modules/next/dist/experimental/testing/server/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6b244fe9b19536f3248bbb357645e5d82235bf0d --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testing/server/index.d.ts @@ -0,0 +1,3 @@ +export * from './config-testing-utils'; +export * from './middleware-testing-utils'; +export { getRedirectUrl, getRewrittenUrl, isRewrite } from './utils'; diff --git a/e-commerce/node_modules/next/dist/experimental/testing/server/index.js b/e-commerce/node_modules/next/dist/experimental/testing/server/index.js new file mode 100644 index 0000000000000000000000000000000000000000..43bf90a74e8110409d4ea9addf8ec425f978d5aa --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testing/server/index.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + getRedirectUrl: null, + getRewrittenUrl: null, + isRewrite: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + getRedirectUrl: function() { + return _utils.getRedirectUrl; + }, + getRewrittenUrl: function() { + return _utils.getRewrittenUrl; + }, + isRewrite: function() { + return _utils.isRewrite; + } +}); +0 && __export(require("./config-testing-utils")) && __export(require("./middleware-testing-utils")); +_export_star(require("./config-testing-utils"), exports); +_export_star(require("./middleware-testing-utils"), exports); +const _utils = require("./utils"); +function _export_star(from, to) { + Object.keys(from).forEach(function(k) { + if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) { + Object.defineProperty(to, k, { + enumerable: true, + get: function() { + return from[k]; + } + }); + } + }); + return from; +} + +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testing/server/index.js.map b/e-commerce/node_modules/next/dist/experimental/testing/server/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..496ef2424e42d8f3a5a5d5dcb4102051d52d3c53 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testing/server/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/experimental/testing/server/index.ts"],"sourcesContent":["export * from './config-testing-utils'\nexport * from './middleware-testing-utils'\nexport { getRedirectUrl, getRewrittenUrl, isRewrite } from './utils'\n"],"names":["getRedirectUrl","getRewrittenUrl","isRewrite"],"mappings":";;;;;;;;;;;;;;;;IAESA,cAAc;eAAdA,qBAAc;;IAAEC,eAAe;eAAfA,sBAAe;;IAAEC,SAAS;eAATA,gBAAS;;;;qBAFrC;qBACA;uBAC6C","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testing/server/middleware-testing-utils.d.ts b/e-commerce/node_modules/next/dist/experimental/testing/server/middleware-testing-utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d4b9e78f1c84fc8d29769bf4c6216ba2fab381e9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testing/server/middleware-testing-utils.d.ts @@ -0,0 +1,19 @@ +import type { IncomingHttpHeaders } from 'http'; +import type { NextConfig } from '../../../server/config-shared'; +import type { MiddlewareConfigMatcherInput } from '../../../build/segment-config/middleware/middleware-config'; +export interface MiddlewareSourceConfig { + matcher?: MiddlewareConfigMatcherInput; +} +/** + * Checks whether the middleware config will match the provide URL and request + * information such as headers and cookies. This function is useful for + * unit tests to assert that middleware is matching (and therefore executing) + * only when it should be. + */ +export declare function unstable_doesMiddlewareMatch({ config, url, headers, cookies, nextConfig, }: { + config: MiddlewareSourceConfig; + url: string; + headers?: IncomingHttpHeaders; + cookies?: Record<string, string>; + nextConfig?: NextConfig; +}): boolean; diff --git a/e-commerce/node_modules/next/dist/experimental/testing/server/middleware-testing-utils.js b/e-commerce/node_modules/next/dist/experimental/testing/server/middleware-testing-utils.js new file mode 100644 index 0000000000000000000000000000000000000000..75f492bf70863dc9498afec85f8fd702e70aaef3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testing/server/middleware-testing-utils.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "unstable_doesMiddlewareMatch", { + enumerable: true, + get: function() { + return unstable_doesMiddlewareMatch; + } +}); +const _getpagestaticinfo = require("../../../build/analysis/get-page-static-info"); +const _middlewareroutematcher = require("../../../shared/lib/router/utils/middleware-route-matcher"); +const _url = require("../../../lib/url"); +const _utils = require("./utils"); +function unstable_doesMiddlewareMatch({ config, url, headers, cookies, nextConfig }) { + if (!config.matcher) { + return true; + } + const matchers = (0, _getpagestaticinfo.getMiddlewareMatchers)(config.matcher, nextConfig ?? {}); + const routeMatchFn = (0, _middlewareroutematcher.getMiddlewareRouteMatcher)(matchers); + const { pathname, searchParams = new URLSearchParams() } = (0, _url.parseUrl)(url) || {}; + const request = (0, _utils.constructRequest)({ + url, + headers, + cookies + }); + return routeMatchFn(pathname, request, Object.fromEntries(searchParams)); +} + +//# sourceMappingURL=middleware-testing-utils.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testing/server/middleware-testing-utils.js.map b/e-commerce/node_modules/next/dist/experimental/testing/server/middleware-testing-utils.js.map new file mode 100644 index 0000000000000000000000000000000000000000..dfacbf8a4e7fbcf2788658186023f1531b15fd7d --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testing/server/middleware-testing-utils.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/experimental/testing/server/middleware-testing-utils.ts"],"sourcesContent":["import type { IncomingHttpHeaders } from 'http'\nimport { getMiddlewareMatchers } from '../../../build/analysis/get-page-static-info'\nimport { getMiddlewareRouteMatcher } from '../../../shared/lib/router/utils/middleware-route-matcher'\nimport type { NextConfig } from '../../../server/config-shared'\nimport { parseUrl } from '../../../lib/url'\nimport { constructRequest } from './utils'\nimport type { MiddlewareConfigMatcherInput } from '../../../build/segment-config/middleware/middleware-config'\n\nexport interface MiddlewareSourceConfig {\n matcher?: MiddlewareConfigMatcherInput\n}\n\n/**\n * Checks whether the middleware config will match the provide URL and request\n * information such as headers and cookies. This function is useful for\n * unit tests to assert that middleware is matching (and therefore executing)\n * only when it should be.\n */\nexport function unstable_doesMiddlewareMatch({\n config,\n url,\n headers,\n cookies,\n nextConfig,\n}: {\n config: MiddlewareSourceConfig\n url: string\n headers?: IncomingHttpHeaders\n cookies?: Record<string, string>\n nextConfig?: NextConfig\n}): boolean {\n if (!config.matcher) {\n return true\n }\n const matchers = getMiddlewareMatchers(config.matcher, nextConfig ?? {})\n const routeMatchFn = getMiddlewareRouteMatcher(matchers)\n const { pathname, searchParams = new URLSearchParams() } = parseUrl(url) || {}\n const request = constructRequest({ url, headers, cookies })\n return routeMatchFn(pathname, request, Object.fromEntries(searchParams))\n}\n"],"names":["unstable_doesMiddlewareMatch","config","url","headers","cookies","nextConfig","matcher","matchers","getMiddlewareMatchers","routeMatchFn","getMiddlewareRouteMatcher","pathname","searchParams","URLSearchParams","parseUrl","request","constructRequest","Object","fromEntries"],"mappings":";;;;+BAkBgBA;;;eAAAA;;;mCAjBsB;wCACI;qBAEjB;uBACQ;AAa1B,SAASA,6BAA6B,EAC3CC,MAAM,EACNC,GAAG,EACHC,OAAO,EACPC,OAAO,EACPC,UAAU,EAOX;IACC,IAAI,CAACJ,OAAOK,OAAO,EAAE;QACnB,OAAO;IACT;IACA,MAAMC,WAAWC,IAAAA,wCAAqB,EAACP,OAAOK,OAAO,EAAED,cAAc,CAAC;IACtE,MAAMI,eAAeC,IAAAA,iDAAyB,EAACH;IAC/C,MAAM,EAAEI,QAAQ,EAAEC,eAAe,IAAIC,iBAAiB,EAAE,GAAGC,IAAAA,aAAQ,EAACZ,QAAQ,CAAC;IAC7E,MAAMa,UAAUC,IAAAA,uBAAgB,EAAC;QAAEd;QAAKC;QAASC;IAAQ;IACzD,OAAOK,aAAaE,UAAUI,SAASE,OAAOC,WAAW,CAACN;AAC5D","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testing/server/utils.d.ts b/e-commerce/node_modules/next/dist/experimental/testing/server/utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..80d6a4c305b4fd8021d8ef2d02be6d222bed758c --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testing/server/utils.d.ts @@ -0,0 +1,23 @@ +import type { IncomingHttpHeaders } from 'http'; +import type { BaseNextRequest } from '../../../server/base-http'; +import type { NextResponse } from '../../../server/web/exports'; +export declare function constructRequest({ url, headers, cookies, }: { + url: string; + headers?: IncomingHttpHeaders; + cookies?: Record<string, string>; +}): BaseNextRequest; +/** + * Returns the URL of the redirect if the response is a redirect response or + * returns null if the response is not. + */ +export declare function getRedirectUrl(response: NextResponse): string | null; +/** + * Checks whether the provided response is a rewrite response to a different + * URL. + */ +export declare function isRewrite(response: NextResponse): boolean; +/** + * Returns the URL of the response rewrite if the response is a rewrite, or + * returns null if the response is not. + */ +export declare function getRewrittenUrl(response: NextResponse): string | null; diff --git a/e-commerce/node_modules/next/dist/experimental/testing/server/utils.js b/e-commerce/node_modules/next/dist/experimental/testing/server/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..7e03082848bdf9a202e507d97743b0c5876ff2dc --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testing/server/utils.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + constructRequest: null, + getRedirectUrl: null, + getRewrittenUrl: null, + isRewrite: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + constructRequest: function() { + return constructRequest; + }, + getRedirectUrl: function() { + return getRedirectUrl; + }, + getRewrittenUrl: function() { + return getRewrittenUrl; + }, + isRewrite: function() { + return isRewrite; + } +}); +const _mockrequest = require("../../../server/lib/mock-request"); +const _node = require("../../../server/base-http/node"); +const _url = require("../../../lib/url"); +function constructRequest({ url, headers = {}, cookies = {} }) { + if (!headers) { + headers = {}; + } + if (!headers.host) { + var _parseUrl; + headers.host = (_parseUrl = (0, _url.parseUrl)(url)) == null ? void 0 : _parseUrl.host; + } + if (cookies) { + headers = { + ...headers, + cookie: Object.entries(cookies).map(([name, value])=>`${name}=${value}`).join(';') + }; + } + return new _node.NodeNextRequest(new _mockrequest.MockedRequest({ + url, + headers, + method: 'GET' + })); +} +function getRedirectUrl(response) { + return response.headers.get('location'); +} +function isRewrite(response) { + return Boolean(getRewrittenUrl(response)); +} +function getRewrittenUrl(response) { + return response.headers.get('x-middleware-rewrite'); +} + +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testing/server/utils.js.map b/e-commerce/node_modules/next/dist/experimental/testing/server/utils.js.map new file mode 100644 index 0000000000000000000000000000000000000000..56361b7fef7dd348fc88d55cf74604f95d9800e2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testing/server/utils.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/experimental/testing/server/utils.ts"],"sourcesContent":["import type { IncomingHttpHeaders } from 'http'\nimport { MockedRequest } from '../../../server/lib/mock-request'\nimport { NodeNextRequest } from '../../../server/base-http/node'\nimport type { BaseNextRequest } from '../../../server/base-http'\nimport type { NextResponse } from '../../../server/web/exports'\nimport { parseUrl } from '../../../lib/url'\n\nexport function constructRequest({\n url,\n headers = {},\n cookies = {},\n}: {\n url: string\n headers?: IncomingHttpHeaders\n cookies?: Record<string, string>\n}): BaseNextRequest {\n if (!headers) {\n headers = {}\n }\n if (!headers.host) {\n headers.host = parseUrl(url)?.host\n }\n if (cookies) {\n headers = {\n ...headers,\n cookie: Object.entries(cookies)\n .map(([name, value]) => `${name}=${value}`)\n .join(';'),\n }\n }\n return new NodeNextRequest(new MockedRequest({ url, headers, method: 'GET' }))\n}\n\n/**\n * Returns the URL of the redirect if the response is a redirect response or\n * returns null if the response is not.\n */\nexport function getRedirectUrl(response: NextResponse): string | null {\n return response.headers.get('location')\n}\n\n/**\n * Checks whether the provided response is a rewrite response to a different\n * URL.\n */\nexport function isRewrite(response: NextResponse): boolean {\n return Boolean(getRewrittenUrl(response))\n}\n\n/**\n * Returns the URL of the response rewrite if the response is a rewrite, or\n * returns null if the response is not.\n */\nexport function getRewrittenUrl(response: NextResponse): string | null {\n return response.headers.get('x-middleware-rewrite')\n}\n"],"names":["constructRequest","getRedirectUrl","getRewrittenUrl","isRewrite","url","headers","cookies","host","parseUrl","cookie","Object","entries","map","name","value","join","NodeNextRequest","MockedRequest","method","response","get","Boolean"],"mappings":";;;;;;;;;;;;;;;;;IAOgBA,gBAAgB;eAAhBA;;IA8BAC,cAAc;eAAdA;;IAgBAC,eAAe;eAAfA;;IARAC,SAAS;eAATA;;;6BA5Cc;sBACE;qBAGP;AAElB,SAASH,iBAAiB,EAC/BI,GAAG,EACHC,UAAU,CAAC,CAAC,EACZC,UAAU,CAAC,CAAC,EAKb;IACC,IAAI,CAACD,SAAS;QACZA,UAAU,CAAC;IACb;IACA,IAAI,CAACA,QAAQE,IAAI,EAAE;YACFC;QAAfH,QAAQE,IAAI,IAAGC,YAAAA,IAAAA,aAAQ,EAACJ,yBAATI,UAAeD,IAAI;IACpC;IACA,IAAID,SAAS;QACXD,UAAU;YACR,GAAGA,OAAO;YACVI,QAAQC,OAAOC,OAAO,CAACL,SACpBM,GAAG,CAAC,CAAC,CAACC,MAAMC,MAAM,GAAK,GAAGD,KAAK,CAAC,EAAEC,OAAO,EACzCC,IAAI,CAAC;QACV;IACF;IACA,OAAO,IAAIC,qBAAe,CAAC,IAAIC,0BAAa,CAAC;QAAEb;QAAKC;QAASa,QAAQ;IAAM;AAC7E;AAMO,SAASjB,eAAekB,QAAsB;IACnD,OAAOA,SAASd,OAAO,CAACe,GAAG,CAAC;AAC9B;AAMO,SAASjB,UAAUgB,QAAsB;IAC9C,OAAOE,QAAQnB,gBAAgBiB;AACjC;AAMO,SAASjB,gBAAgBiB,QAAsB;IACpD,OAAOA,SAASd,OAAO,CAACe,GAAG,CAAC;AAC9B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/context.d.ts b/e-commerce/node_modules/next/dist/experimental/testmode/context.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b510d9824d4b4b3bdbb39b95d98885e43a5757ea --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/context.d.ts @@ -0,0 +1,11 @@ +export interface TestReqInfo { + url: string; + proxyPort: number; + testData: string; +} +export interface TestRequestReader<R> { + url(req: R): string; + header(req: R, name: string): string | null; +} +export declare function withRequest<R, T>(req: R, reader: TestRequestReader<R>, fn: () => T): T; +export declare function getTestReqInfo<R>(req?: R, reader?: TestRequestReader<R>): TestReqInfo | undefined; diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/context.js b/e-commerce/node_modules/next/dist/experimental/testmode/context.js new file mode 100644 index 0000000000000000000000000000000000000000..1ce3204dc2fea812545a748a76815f15903a44d1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/context.js @@ -0,0 +1,57 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + getTestReqInfo: null, + withRequest: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + getTestReqInfo: function() { + return getTestReqInfo; + }, + withRequest: function() { + return withRequest; + } +}); +const _nodeasync_hooks = require("node:async_hooks"); +const testStorage = new _nodeasync_hooks.AsyncLocalStorage(); +function extractTestInfoFromRequest(req, reader) { + const proxyPortHeader = reader.header(req, 'next-test-proxy-port'); + if (!proxyPortHeader) { + return undefined; + } + const url = reader.url(req); + const proxyPort = Number(proxyPortHeader); + const testData = reader.header(req, 'next-test-data') || ''; + return { + url, + proxyPort, + testData + }; +} +function withRequest(req, reader, fn) { + const testReqInfo = extractTestInfoFromRequest(req, reader); + if (!testReqInfo) { + return fn(); + } + return testStorage.run(testReqInfo, fn); +} +function getTestReqInfo(req, reader) { + const testReqInfo = testStorage.getStore(); + if (testReqInfo) { + return testReqInfo; + } + if (req && reader) { + return extractTestInfoFromRequest(req, reader); + } + return undefined; +} + +//# sourceMappingURL=context.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/context.js.map b/e-commerce/node_modules/next/dist/experimental/testmode/context.js.map new file mode 100644 index 0000000000000000000000000000000000000000..eb0adb220d1d582a2ea0b70800f9f0581489793c --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/context.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/experimental/testmode/context.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks'\n\nexport interface TestReqInfo {\n url: string\n proxyPort: number\n testData: string\n}\n\nexport interface TestRequestReader<R> {\n url(req: R): string\n header(req: R, name: string): string | null\n}\n\nconst testStorage = new AsyncLocalStorage<TestReqInfo>()\n\nfunction extractTestInfoFromRequest<R>(\n req: R,\n reader: TestRequestReader<R>\n): TestReqInfo | undefined {\n const proxyPortHeader = reader.header(req, 'next-test-proxy-port')\n if (!proxyPortHeader) {\n return undefined\n }\n const url = reader.url(req)\n const proxyPort = Number(proxyPortHeader)\n const testData = reader.header(req, 'next-test-data') || ''\n return { url, proxyPort, testData }\n}\n\nexport function withRequest<R, T>(\n req: R,\n reader: TestRequestReader<R>,\n fn: () => T\n): T {\n const testReqInfo = extractTestInfoFromRequest(req, reader)\n if (!testReqInfo) {\n return fn()\n }\n return testStorage.run(testReqInfo, fn)\n}\n\nexport function getTestReqInfo<R>(\n req?: R,\n reader?: TestRequestReader<R>\n): TestReqInfo | undefined {\n const testReqInfo = testStorage.getStore()\n if (testReqInfo) {\n return testReqInfo\n }\n if (req && reader) {\n return extractTestInfoFromRequest(req, reader)\n }\n return undefined\n}\n"],"names":["getTestReqInfo","withRequest","testStorage","AsyncLocalStorage","extractTestInfoFromRequest","req","reader","proxyPortHeader","header","undefined","url","proxyPort","Number","testData","fn","testReqInfo","run","getStore"],"mappings":";;;;;;;;;;;;;;;IAyCgBA,cAAc;eAAdA;;IAZAC,WAAW;eAAXA;;;iCA7BkB;AAalC,MAAMC,cAAc,IAAIC,kCAAiB;AAEzC,SAASC,2BACPC,GAAM,EACNC,MAA4B;IAE5B,MAAMC,kBAAkBD,OAAOE,MAAM,CAACH,KAAK;IAC3C,IAAI,CAACE,iBAAiB;QACpB,OAAOE;IACT;IACA,MAAMC,MAAMJ,OAAOI,GAAG,CAACL;IACvB,MAAMM,YAAYC,OAAOL;IACzB,MAAMM,WAAWP,OAAOE,MAAM,CAACH,KAAK,qBAAqB;IACzD,OAAO;QAAEK;QAAKC;QAAWE;IAAS;AACpC;AAEO,SAASZ,YACdI,GAAM,EACNC,MAA4B,EAC5BQ,EAAW;IAEX,MAAMC,cAAcX,2BAA2BC,KAAKC;IACpD,IAAI,CAACS,aAAa;QAChB,OAAOD;IACT;IACA,OAAOZ,YAAYc,GAAG,CAACD,aAAaD;AACtC;AAEO,SAASd,eACdK,GAAO,EACPC,MAA6B;IAE7B,MAAMS,cAAcb,YAAYe,QAAQ;IACxC,IAAIF,aAAa;QACf,OAAOA;IACT;IACA,IAAIV,OAAOC,QAAQ;QACjB,OAAOF,2BAA2BC,KAAKC;IACzC;IACA,OAAOG;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/fetch.d.ts b/e-commerce/node_modules/next/dist/experimental/testmode/fetch.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8d393460f4a847c40278a92511e492752e431648 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/fetch.d.ts @@ -0,0 +1,6 @@ +import { type TestRequestReader } from './context'; +type Fetch = typeof fetch; +export declare const reader: TestRequestReader<Request>; +export declare function handleFetch(originalFetch: Fetch, request: Request): Promise<Response>; +export declare function interceptFetch(originalFetch: Fetch): () => void; +export {}; diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/fetch.js b/e-commerce/node_modules/next/dist/experimental/testmode/fetch.js new file mode 100644 index 0000000000000000000000000000000000000000..e8bb46913001201b346c540772492cc7d13459b9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/fetch.js @@ -0,0 +1,150 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + handleFetch: null, + interceptFetch: null, + reader: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + handleFetch: function() { + return handleFetch; + }, + interceptFetch: function() { + return interceptFetch; + }, + reader: function() { + return reader; + } +}); +const _context = require("./context"); +const reader = { + url (req) { + return req.url; + }, + header (req, name) { + return req.headers.get(name); + } +}; +function getTestStack() { + let stack = (new Error().stack ?? '').split('\n'); + // Skip the first line and find first non-empty line. + for(let i = 1; i < stack.length; i++){ + if (stack[i].length > 0) { + stack = stack.slice(i); + break; + } + } + // Filter out franmework lines. + stack = stack.filter((f)=>!f.includes('/next/dist/')); + // At most 5 lines. + stack = stack.slice(0, 5); + // Cleanup some internal info and trim. + stack = stack.map((s)=>s.replace('webpack-internal:///(rsc)/', '').trim()); + return stack.join(' '); +} +async function buildProxyRequest(testData, request) { + const { url, method, headers, body, cache, credentials, integrity, mode, redirect, referrer, referrerPolicy } = request; + return { + testData, + api: 'fetch', + request: { + url, + method, + headers: [ + ...Array.from(headers), + [ + 'next-test-stack', + getTestStack() + ] + ], + body: body ? Buffer.from(await request.arrayBuffer()).toString('base64') : null, + cache, + credentials, + integrity, + mode, + redirect, + referrer, + referrerPolicy + } + }; +} +function buildResponse(proxyResponse) { + const { status, headers, body } = proxyResponse.response; + return new Response(body ? Buffer.from(body, 'base64') : null, { + status, + headers: new Headers(headers) + }); +} +function passthroughFetch(originalFetch, request) { + // Mark the request so the ClientRequest interception in `httpget.ts` sends it + // to the real server instead of intercepting it again. @mswjs/interceptors + // intercepts at the TCP level, so an unmarked passthrough would re-enter the + // interception listener from within itself, recursing indefinitely. + request.headers.set('next-test-internal', '1'); + return originalFetch(request); +} +async function handleFetch(originalFetch, request) { + const testInfo = (0, _context.getTestReqInfo)(request, reader); + if (!testInfo) { + // Passthrough non-test requests. + return passthroughFetch(originalFetch, request); + } + const { testData, proxyPort } = testInfo; + const proxyRequest = await buildProxyRequest(testData, request); + const resp = await originalFetch(`http://localhost:${proxyPort}`, { + method: 'POST', + body: JSON.stringify(proxyRequest), + // The header lets the ClientRequest interception in `httpget.ts` identify + // this request as part of the test proxy protocol. @mswjs/interceptors + // intercepts at the TCP level, so this request would otherwise be + // intercepted again when it's sent from within an interception listener, + // recursing indefinitely. + headers: { + 'next-test-internal': '1' + }, + next: { + // @ts-ignore + internal: true + } + }); + if (!resp.ok) { + throw new Error(`Proxy request failed: ${resp.status}`); + } + const proxyResponse = await resp.json(); + const { api } = proxyResponse; + switch(api){ + case 'continue': + return passthroughFetch(originalFetch, request); + case 'abort': + case 'unhandled': + throw new Error(`Proxy request aborted [${request.method} ${request.url}]`); + case 'fetch': + return buildResponse(proxyResponse); + default: + return api; + } +} +function interceptFetch(originalFetch) { + global.fetch = function testFetch(input, init) { + var _init_next; + // Passthrough internal requests. + // @ts-ignore + if (init == null ? void 0 : (_init_next = init.next) == null ? void 0 : _init_next.internal) { + return originalFetch(input, init); + } + return handleFetch(originalFetch, new Request(input, init)); + }; + return ()=>{ + global.fetch = originalFetch; + }; +} + +//# sourceMappingURL=fetch.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/fetch.js.map b/e-commerce/node_modules/next/dist/experimental/testmode/fetch.js.map new file mode 100644 index 0000000000000000000000000000000000000000..fc8f68ee9d210ab90ef11e8ade34e453e6eccbc2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/fetch.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/experimental/testmode/fetch.ts"],"sourcesContent":["import type {\n ProxyFetchRequest,\n ProxyFetchResponse,\n ProxyResponse,\n} from './proxy'\nimport { getTestReqInfo, type TestRequestReader } from './context'\n\ntype Fetch = typeof fetch\ntype FetchInputArg = Parameters<Fetch>[0]\ntype FetchInitArg = Parameters<Fetch>[1]\n\nexport const reader: TestRequestReader<Request> = {\n url(req) {\n return req.url\n },\n header(req, name) {\n return req.headers.get(name)\n },\n}\n\nfunction getTestStack(): string {\n let stack = (new Error().stack ?? '').split('\\n')\n // Skip the first line and find first non-empty line.\n for (let i = 1; i < stack.length; i++) {\n if (stack[i].length > 0) {\n stack = stack.slice(i)\n break\n }\n }\n // Filter out franmework lines.\n stack = stack.filter((f) => !f.includes('/next/dist/'))\n // At most 5 lines.\n stack = stack.slice(0, 5)\n // Cleanup some internal info and trim.\n stack = stack.map((s) => s.replace('webpack-internal:///(rsc)/', '').trim())\n return stack.join(' ')\n}\n\nasync function buildProxyRequest(\n testData: string,\n request: Request\n): Promise<ProxyFetchRequest> {\n const {\n url,\n method,\n headers,\n body,\n cache,\n credentials,\n integrity,\n mode,\n redirect,\n referrer,\n referrerPolicy,\n } = request\n return {\n testData,\n api: 'fetch',\n request: {\n url,\n method,\n headers: [...Array.from(headers), ['next-test-stack', getTestStack()]],\n body: body\n ? Buffer.from(await request.arrayBuffer()).toString('base64')\n : null,\n cache,\n credentials,\n integrity,\n mode,\n redirect,\n referrer,\n referrerPolicy,\n },\n }\n}\n\nfunction buildResponse(proxyResponse: ProxyFetchResponse): Response {\n const { status, headers, body } = proxyResponse.response\n return new Response(body ? Buffer.from(body, 'base64') : null, {\n status,\n headers: new Headers(headers),\n })\n}\n\nfunction passthroughFetch(\n originalFetch: Fetch,\n request: Request\n): Promise<Response> {\n // Mark the request so the ClientRequest interception in `httpget.ts` sends it\n // to the real server instead of intercepting it again. @mswjs/interceptors\n // intercepts at the TCP level, so an unmarked passthrough would re-enter the\n // interception listener from within itself, recursing indefinitely.\n request.headers.set('next-test-internal', '1')\n return originalFetch(request)\n}\n\nexport async function handleFetch(\n originalFetch: Fetch,\n request: Request\n): Promise<Response> {\n const testInfo = getTestReqInfo(request, reader)\n if (!testInfo) {\n // Passthrough non-test requests.\n return passthroughFetch(originalFetch, request)\n }\n\n const { testData, proxyPort } = testInfo\n const proxyRequest = await buildProxyRequest(testData, request)\n\n const resp = await originalFetch(`http://localhost:${proxyPort}`, {\n method: 'POST',\n body: JSON.stringify(proxyRequest),\n // The header lets the ClientRequest interception in `httpget.ts` identify\n // this request as part of the test proxy protocol. @mswjs/interceptors\n // intercepts at the TCP level, so this request would otherwise be\n // intercepted again when it's sent from within an interception listener,\n // recursing indefinitely.\n headers: {\n 'next-test-internal': '1',\n },\n next: {\n // @ts-ignore\n internal: true,\n },\n })\n if (!resp.ok) {\n throw new Error(`Proxy request failed: ${resp.status}`)\n }\n\n const proxyResponse = (await resp.json()) as ProxyResponse\n const { api } = proxyResponse\n switch (api) {\n case 'continue':\n return passthroughFetch(originalFetch, request)\n case 'abort':\n case 'unhandled':\n throw new Error(\n `Proxy request aborted [${request.method} ${request.url}]`\n )\n case 'fetch':\n return buildResponse(proxyResponse)\n default:\n return api satisfies never\n }\n}\n\nexport function interceptFetch(originalFetch: Fetch) {\n global.fetch = function testFetch(\n input: FetchInputArg,\n init?: FetchInitArg\n ): Promise<Response> {\n // Passthrough internal requests.\n // @ts-ignore\n if (init?.next?.internal) {\n return originalFetch(input, init)\n }\n return handleFetch(originalFetch, new Request(input, init))\n }\n return () => {\n global.fetch = originalFetch\n }\n}\n"],"names":["handleFetch","interceptFetch","reader","url","req","header","name","headers","get","getTestStack","stack","Error","split","i","length","slice","filter","f","includes","map","s","replace","trim","join","buildProxyRequest","testData","request","method","body","cache","credentials","integrity","mode","redirect","referrer","referrerPolicy","api","Array","from","Buffer","arrayBuffer","toString","buildResponse","proxyResponse","status","response","Response","Headers","passthroughFetch","originalFetch","set","testInfo","getTestReqInfo","proxyPort","proxyRequest","resp","JSON","stringify","next","internal","ok","json","global","fetch","testFetch","input","init","Request"],"mappings":";;;;;;;;;;;;;;;;IAgGsBA,WAAW;eAAXA;;IAkDNC,cAAc;eAAdA;;IAvIHC,MAAM;eAANA;;;yBAN0C;AAMhD,MAAMA,SAAqC;IAChDC,KAAIC,GAAG;QACL,OAAOA,IAAID,GAAG;IAChB;IACAE,QAAOD,GAAG,EAAEE,IAAI;QACd,OAAOF,IAAIG,OAAO,CAACC,GAAG,CAACF;IACzB;AACF;AAEA,SAASG;IACP,IAAIC,QAAQ,AAAC,CAAA,IAAIC,QAAQD,KAAK,IAAI,EAAC,EAAGE,KAAK,CAAC;IAC5C,qDAAqD;IACrD,IAAK,IAAIC,IAAI,GAAGA,IAAIH,MAAMI,MAAM,EAAED,IAAK;QACrC,IAAIH,KAAK,CAACG,EAAE,CAACC,MAAM,GAAG,GAAG;YACvBJ,QAAQA,MAAMK,KAAK,CAACF;YACpB;QACF;IACF;IACA,+BAA+B;IAC/BH,QAAQA,MAAMM,MAAM,CAAC,CAACC,IAAM,CAACA,EAAEC,QAAQ,CAAC;IACxC,mBAAmB;IACnBR,QAAQA,MAAMK,KAAK,CAAC,GAAG;IACvB,uCAAuC;IACvCL,QAAQA,MAAMS,GAAG,CAAC,CAACC,IAAMA,EAAEC,OAAO,CAAC,8BAA8B,IAAIC,IAAI;IACzE,OAAOZ,MAAMa,IAAI,CAAC;AACpB;AAEA,eAAeC,kBACbC,QAAgB,EAChBC,OAAgB;IAEhB,MAAM,EACJvB,GAAG,EACHwB,MAAM,EACNpB,OAAO,EACPqB,IAAI,EACJC,KAAK,EACLC,WAAW,EACXC,SAAS,EACTC,IAAI,EACJC,QAAQ,EACRC,QAAQ,EACRC,cAAc,EACf,GAAGT;IACJ,OAAO;QACLD;QACAW,KAAK;QACLV,SAAS;YACPvB;YACAwB;YACApB,SAAS;mBAAI8B,MA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BAAsB,EAAE4C,KAAKX,MAAM,EAAE;IACxD;IAEA,MAAMD,gBAAiB,MAAMY,KAAKM,IAAI;IACtC,MAAM,EAAEzB,GAAG,EAAE,GAAGO;IAChB,OAAQP;QACN,KAAK;YACH,OAAOY,iBAAiBC,eAAevB;QACzC,KAAK;QACL,KAAK;YACH,MAAM,IAAIf,MACR,CAAC,uBAAuB,EAAEe,QAAQC,MAAM,CAAC,CAAC,EAAED,QAAQvB,GAAG,CAAC,CAAC,CAAC;QAE9D,KAAK;YACH,OAAOuC,cAAcC;QACvB;YACE,OAAOP;IACX;AACF;AAEO,SAASnC,eAAegD,aAAoB;IACjDa,OAAOC,KAAK,GAAG,SAASC,UACtBC,KAAoB,EACpBC,IAAmB;YAIfA;QAFJ,iCAAiC;QACjC,aAAa;QACb,IAAIA,yBAAAA,aAAAA,KAAMR,IAAI,qBAAVQ,WAAYP,QAAQ,EAAE;YACxB,OAAOV,cAAcgB,OAAOC;QAC9B;QACA,OAAOlE,YAAYiD,eAAe,IAAIkB,QAAQF,OAAOC;IACvD;IACA,OAAO;QACLJ,OAAOC,KAAK,GAAGd;IACjB;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/httpget.d.ts b/e-commerce/node_modules/next/dist/experimental/testmode/httpget.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..67ac186bc29d8a7f14ed934ec2b6a08a7ba13ce8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/httpget.d.ts @@ -0,0 +1,3 @@ +type Fetch = typeof fetch; +export declare function interceptHttpGet(originalFetch: Fetch): () => void; +export {}; diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/httpget.js b/e-commerce/node_modules/next/dist/experimental/testmode/httpget.js new file mode 100644 index 0000000000000000000000000000000000000000..09136967ed1bb4de3fbbab2d5f6269f512fedf67 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/httpget.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "interceptHttpGet", { + enumerable: true, + get: function() { + return interceptHttpGet; + } +}); +const _ClientRequest = require("next/dist/compiled/@mswjs/interceptors/ClientRequest"); +const _fetch = require("./fetch"); +function interceptHttpGet(originalFetch) { + const clientRequestInterceptor = new _ClientRequest.ClientRequestInterceptor(); + clientRequestInterceptor.on('request', async ({ request, controller })=>{ + if (request.headers.get('next-test-internal') === '1') { + // A request that's part of the test proxy protocol itself, sent by + // `handleFetch` from within this listener. Not responding lets the + // interceptor perform it against the real server. Handling it here + // instead would recurse indefinitely. + return; + } + const response = await (0, _fetch.handleFetch)(originalFetch, request); + controller.respondWith(response); + }); + clientRequestInterceptor.apply(); + // Cleanup. + return ()=>{ + clientRequestInterceptor.dispose(); + }; +} + +//# sourceMappingURL=httpget.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/httpget.js.map b/e-commerce/node_modules/next/dist/experimental/testmode/httpget.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3471127cb6803dc56d84899cb90e379b3cdcde1d --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/httpget.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/experimental/testmode/httpget.ts"],"sourcesContent":["import { ClientRequestInterceptor } from 'next/dist/compiled/@mswjs/interceptors/ClientRequest'\nimport { handleFetch } from './fetch'\n\ntype Fetch = typeof fetch\n\nexport function interceptHttpGet(originalFetch: Fetch): () => void {\n const clientRequestInterceptor = new ClientRequestInterceptor()\n clientRequestInterceptor.on('request', async ({ request, controller }) => {\n if (request.headers.get('next-test-internal') === '1') {\n // A request that's part of the test proxy protocol itself, sent by\n // `handleFetch` from within this listener. Not responding lets the\n // interceptor perform it against the real server. Handling it here\n // instead would recurse indefinitely.\n return\n }\n const response = await handleFetch(originalFetch, request)\n controller.respondWith(response)\n })\n clientRequestInterceptor.apply()\n\n // Cleanup.\n return () => {\n clientRequestInterceptor.dispose()\n }\n}\n"],"names":["interceptHttpGet","originalFetch","clientRequestInterceptor","ClientRequestInterceptor","on","request","controller","headers","get","response","handleFetch","respondWith","apply","dispose"],"mappings":";;;;+BAKgBA;;;eAAAA;;;+BALyB;uBACb;AAIrB,SAASA,iBAAiBC,aAAoB;IACnD,MAAMC,2BAA2B,IAAIC,uCAAwB;IAC7DD,yBAAyBE,EAAE,CAAC,WAAW,OAAO,EAAEC,OAAO,EAAEC,UAAU,EAAE;QACnE,IAAID,QAAQE,OAAO,CAACC,GAAG,CAAC,0BAA0B,KAAK;YACrD,mEAAmE;YACnE,mEAAmE;YACnE,mEAAmE;YACnE,sCAAsC;YACtC;QACF;QACA,MAAMC,WAAW,MAAMC,IAAAA,kBAAW,EAACT,eAAeI;QAClDC,WAAWK,WAAW,CAACF;IACzB;IACAP,yBAAyBU,KAAK;IAE9B,WAAW;IACX,OAAO;QACLV,yBAAyBW,OAAO;IAClC;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/default-config.d.ts b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/default-config.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3d240dbdf4de850377064bd55b0684aebe4dacef --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/default-config.d.ts @@ -0,0 +1,10 @@ +import { type PlaywrightTestConfig } from '@playwright/test'; +import type { NextOptionsConfig } from './next-options'; +/** + * This is the default configuration generated by Playwright as of v1.43.0 with some modifications. + * + * - the `testMatch` property is configured to match all `*.spec.js` or `*.spec.ts` files within the `app` and `pages` directories + * - the `use` property is configured with a baseURL matching the expected dev server endpoint (http://127.0.0.1:3000) + * - the `webserver` property is configured to run `next dev`. + */ +export declare const defaultPlaywrightConfig: PlaywrightTestConfig<NextOptionsConfig>; diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/default-config.js b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/default-config.js new file mode 100644 index 0000000000000000000000000000000000000000..d7f197fd660b9cd3d0fc0cfc928018478cc82de4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/default-config.js @@ -0,0 +1,59 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "defaultPlaywrightConfig", { + enumerable: true, + get: function() { + return defaultPlaywrightConfig; + } +}); +const _test = require("@playwright/test"); +const defaultPlaywrightConfig = { + testMatch: '{app,pages}/**/*.spec.{t,j}s', + fullyParallel: true, + forbidOnly: process.env.CI === 'true', + retries: process.env.CI === 'true' ? 2 : 0, + reporter: [ + [ + 'list' + ], + [ + 'html', + { + open: 'never' + } + ] + ], + use: { + baseURL: 'http://127.0.0.1:3000', + trace: 'on-first-retry' + }, + projects: [ + { + name: 'chromium', + use: { + ..._test.devices['Desktop Chrome'] + } + }, + { + name: 'firefox', + use: { + ..._test.devices['Desktop Firefox'] + } + }, + { + name: 'webkit', + use: { + ..._test.devices['Desktop Safari'] + } + } + ], + webServer: { + command: process.env.CI === 'true' ? 'next start' : 'next dev', + url: 'http://127.0.0.1:3000', + reuseExistingServer: process.env.CI !== 'true' + } +}; + +//# sourceMappingURL=default-config.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/default-config.js.map b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/default-config.js.map new file mode 100644 index 0000000000000000000000000000000000000000..fce653955fe4307c6e59ffb7775471037d317bfb --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/default-config.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/experimental/testmode/playwright/default-config.ts"],"sourcesContent":["import { devices, type PlaywrightTestConfig } from '@playwright/test'\nimport type { NextOptionsConfig } from './next-options'\n\n/**\n * This is the default configuration generated by Playwright as of v1.43.0 with some modifications.\n *\n * - the `testMatch` property is configured to match all `*.spec.js` or `*.spec.ts` files within the `app` and `pages` directories\n * - the `use` property is configured with a baseURL matching the expected dev server endpoint (http://127.0.0.1:3000)\n * - the `webserver` property is configured to run `next dev`.\n */\nexport const defaultPlaywrightConfig: PlaywrightTestConfig<NextOptionsConfig> =\n {\n testMatch: '{app,pages}/**/*.spec.{t,j}s',\n fullyParallel: true,\n forbidOnly: process.env.CI === 'true',\n retries: process.env.CI === 'true' ? 2 : 0,\n reporter: [['list'], ['html', { open: 'never' }]],\n use: {\n baseURL: 'http://127.0.0.1:3000',\n trace: 'on-first-retry',\n },\n projects: [\n {\n name: 'chromium',\n use: { ...devices['Desktop Chrome'] },\n },\n\n {\n name: 'firefox',\n use: { ...devices['Desktop Firefox'] },\n },\n\n {\n name: 'webkit',\n use: { ...devices['Desktop Safari'] },\n },\n ],\n webServer: {\n command: process.env.CI === 'true' ? 'next start' : 'next dev',\n url: 'http://127.0.0.1:3000',\n reuseExistingServer: process.env.CI !== 'true',\n },\n }\n"],"names":["defaultPlaywrightConfig","testMatch","fullyParallel","forbidOnly","process","env","CI","retries","reporter","open","use","baseURL","trace","projects","name","devices","webServer","command","url","reuseExistingServer"],"mappings":";;;;+BAUaA;;;eAAAA;;;sBAVsC;AAU5C,MAAMA,0BACX;IACEC,WAAW;IACXC,eAAe;IACfC,YAAYC,QAAQC,GAAG,CAACC,EAAE,KAAK;IAC/BC,SAASH,QAAQC,GAAG,CAACC,EAAE,KAAK,SAAS,IAAI;IACzCE,UAAU;QAAC;YAAC;SAAO;QAAE;YAAC;YAAQ;gBAAEC,MAAM;YAAQ;SAAE;KAAC;IACjDC,KAAK;QACHC,SAAS;QACTC,OAAO;IACT;IACAC,UAAU;QACR;YACEC,MAAM;YACNJ,KAAK;gBAAE,GAAGK,aAAO,CAAC,iBAAiB;YAAC;QACtC;QAEA;YACED,MAAM;YACNJ,KAAK;gBAAE,GAAGK,aAAO,CAAC,kBAAkB;YAAC;QACvC;QAEA;YACED,MAAM;YACNJ,KAAK;gBAAE,GAAGK,aAAO,CAAC,iBAAiB;YAAC;QACtC;KACD;IACDC,WAAW;QACTC,SAASb,QAAQC,GAAG,CAACC,EAAE,KAAK,SAAS,eAAe;QACpDY,KAAK;QACLC,qBAAqBf,QAAQC,GAAG,CAACC,EAAE,KAAK;IAC1C;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/index.d.ts b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6f41465c1fd7c68223a4555cad919af46738d6a --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/index.d.ts @@ -0,0 +1,17 @@ +import * as base from '@playwright/test'; +import type { NextFixture } from './next-fixture'; +import type { NextOptions, NextOptionsConfig } from './next-options'; +import type { NextWorkerFixture } from './next-worker-fixture'; +import { defaultPlaywrightConfig } from './default-config'; +export { defaultPlaywrightConfig }; +export * from '@playwright/test'; +export declare function defineConfig<T extends NextOptionsConfig, W>(config: base.PlaywrightTestConfig<T, W>): base.PlaywrightTestConfig<T, W>; +export type { NextFixture, NextOptions }; +export type { FetchHandlerResult } from '../proxy'; +export declare const test: base.TestType<base.PlaywrightTestArgs & base.PlaywrightTestOptions & { + next: NextFixture; + nextOptions: NextOptions; +}, base.PlaywrightWorkerArgs & base.PlaywrightWorkerOptions & { + _nextWorker: NextWorkerFixture; +}>; +export default test; diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/index.js b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/index.js new file mode 100644 index 0000000000000000000000000000000000000000..abc1184dfc32290041a91b0a376ed9fc17486e39 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/index.js @@ -0,0 +1,129 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + default: null, + defaultPlaywrightConfig: null, + defineConfig: null, + test: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + default: function() { + return _default; + }, + defaultPlaywrightConfig: function() { + return _defaultconfig.defaultPlaywrightConfig; + }, + defineConfig: function() { + return defineConfig; + }, + test: function() { + return test; + } +}); +0 && __export(require("@playwright/test")); +const _test = /*#__PURE__*/ _interop_require_wildcard(_export_star(require("@playwright/test"), exports)); +const _nextworkerfixture = require("./next-worker-fixture"); +const _nextfixture = require("./next-fixture"); +const _defaultconfig = require("./default-config"); +function _export_star(from, to) { + Object.keys(from).forEach(function(k) { + if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) { + Object.defineProperty(to, k, { + enumerable: true, + get: function() { + return from[k]; + } + }); + } + }); + return from; +} +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +function defineConfig(config) { + if (config.webServer !== undefined) { + // Playwright doesn't merge the `webServer` field as we'd expect, so remove our default if the user specifies one. + const { webServer, ...partialDefaultPlaywrightConfig } = _defaultconfig.defaultPlaywrightConfig; + return _test.defineConfig(partialDefaultPlaywrightConfig, config); + } else { + return _test.defineConfig(_defaultconfig.defaultPlaywrightConfig, config); + } +} +const test = _test.test.extend({ + nextOptions: [ + { + fetchLoopback: false + }, + { + option: true + } + ], + _nextWorker: [ + // eslint-disable-next-line no-empty-pattern + async ({}, use)=>{ + await (0, _nextworkerfixture.applyNextWorkerFixture)(use); + }, + { + scope: 'worker', + auto: true + } + ], + next: async ({ nextOptions, _nextWorker, page }, use, testInfo)=>{ + await (0, _nextfixture.applyNextFixture)(use, { + testInfo, + nextWorker: _nextWorker, + page, + nextOptions + }); + } +}); +const _default = test; + +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/index.js.map b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..68d8f3d87edffaffefbcbcbb020bc8d31bb30a41 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/experimental/testmode/playwright/index.ts"],"sourcesContent":["import * as base from '@playwright/test'\nimport type { NextFixture } from './next-fixture'\nimport type { NextOptions, NextOptionsConfig } from './next-options'\nimport type { NextWorkerFixture } from './next-worker-fixture'\nimport { applyNextWorkerFixture } from './next-worker-fixture'\nimport { applyNextFixture } from './next-fixture'\nimport { defaultPlaywrightConfig } from './default-config'\n\nexport { defaultPlaywrightConfig }\n\nexport * from '@playwright/test'\n\n// Export this second so it overrides the one from `@playwright/test`\nexport function defineConfig<T extends NextOptionsConfig, W>(\n config: base.PlaywrightTestConfig<T, W>\n): base.PlaywrightTestConfig<T, W>\nexport function defineConfig<T extends NextOptionsConfig = NextOptionsConfig>(\n config: base.PlaywrightTestConfig<T>\n): base.PlaywrightTestConfig<T> {\n if (config.webServer !== undefined) {\n // Playwright doesn't merge the `webServer` field as we'd expect, so remove our default if the user specifies one.\n const { webServer, ...partialDefaultPlaywrightConfig } =\n defaultPlaywrightConfig as base.PlaywrightTestConfig<T>\n return base.defineConfig<T>(partialDefaultPlaywrightConfig, config)\n } else {\n return base.defineConfig<T>(\n defaultPlaywrightConfig as base.PlaywrightTestConfig<T>,\n config\n )\n }\n}\n\nexport type { NextFixture, NextOptions }\nexport type { FetchHandlerResult } from '../proxy'\n\nexport const test = base.test.extend<\n { next: NextFixture; nextOptions: NextOptions },\n { _nextWorker: NextWorkerFixture }\n>({\n nextOptions: [{ fetchLoopback: false }, { option: true }],\n\n _nextWorker: [\n // eslint-disable-next-line no-empty-pattern\n async ({}, use) => {\n await applyNextWorkerFixture(use)\n },\n { scope: 'worker', auto: true },\n ],\n\n next: async ({ nextOptions, _nextWorker, page }, use, testInfo) => {\n await applyNextFixture(use, {\n testInfo,\n nextWorker: _nextWorker,\n page,\n nextOptions,\n })\n },\n})\n\nexport default test\n"],"names":["defaultPlaywrightConfig","defineConfig","test","config","webServer","undefined","partialDefaultPlaywrightConfig","base","extend","nextOptions","fetchLoopback","option","_nextWorker","use","applyNextWorkerFixture","scope","auto","next","page","testInfo","applyNextFixture","nextWorker"],"mappings":";;;;;;;;;;;;;;;;;IA2DA,OAAmB;eAAnB;;IAnDSA,uBAAuB;eAAvBA,sCAAuB;;IAQhBC,YAAY;eAAZA;;IAmBHC,IAAI;eAAJA;;;;2EAnCS;mCAIiB;6BACN;+BACO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUjC,SAASD,aACdE,MAAoC;IAEpC,IAAIA,OAAOC,SAAS,KAAKC,WAAW;QAClC,kHAAkH;QAClH,MAAM,EAAED,SAAS,EAAE,GAAGE,gCAAgC,GACpDN,sCAAuB;QACzB,OAAOO,MAAKN,YAAY,CAAIK,gCAAgCH;IAC9D,OAAO;QACL,OAAOI,MAAKN,YAAY,CACtBD,sCAAuB,EACvBG;IAEJ;AACF;AAKO,MAAMD,OAAOK,MAAKL,IAAI,CAACM,MAAM,CAGlC;IACAC,aAAa;QAAC;YAAEC,eAAe;QAAM;QAAG;YAAEC,QAAQ;QAAK;KAAE;IAEzDC,aAAa;QACX,4CAA4C;QAC5C,OAAO,EAAE,EAAEC;YACT,MAAMC,IAAAA,yCAAsB,EAACD;QAC/B;QACA;YAAEE,OAAO;YAAUC,MAAM;QAAK;KAC/B;IAEDC,MAAM,OAAO,EAAER,WAAW,EAAEG,WAAW,EAAEM,IAAI,EAAE,EAAEL,KAAKM;QACpD,MAAMC,IAAAA,6BAAgB,EAACP,KAAK;YAC1BM;YACAE,YAAYT;YACZM;YACAT;QACF;IACF;AACF;MAEA,WAAeP","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/msw.d.ts b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/msw.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a710eecb38051435f348eba486353739a8a2e327 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/msw.d.ts @@ -0,0 +1,20 @@ +import { defineConfig } from './index'; +import type { NextFixture } from './next-fixture'; +import { type RequestHandler } from 'msw'; +export * from 'msw'; +export * from '@playwright/test'; +export type { NextFixture }; +export { defineConfig }; +export interface MswFixture { + use: (...handlers: RequestHandler[]) => void; +} +export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & { + next: NextFixture; + nextOptions: import("./next-options").NextOptions; +} & { + msw: MswFixture; + mswHandlers: RequestHandler[]; +}, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & { + _nextWorker: import("./next-worker-fixture").NextWorkerFixture; +}>; +export default test; diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/msw.js b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/msw.js new file mode 100644 index 0000000000000000000000000000000000000000..0bf708e9b84f077bc3a8e8f8eeced5b9f9edcf25 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/msw.js @@ -0,0 +1,100 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + default: null, + defineConfig: null, + test: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + default: function() { + return _default; + }, + defineConfig: function() { + return _index.defineConfig; + }, + test: function() { + return test; + } +}); +0 && __export(require("msw")) && __export(require("@playwright/test")); +const _index = require("./index"); +const _msw = _export_star(require("msw"), exports); +const _stricteventemitter = require("strict-event-emitter"); +_export_star(require("@playwright/test"), exports); +function _export_star(from, to) { + Object.keys(from).forEach(function(k) { + if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) { + Object.defineProperty(to, k, { + enumerable: true, + get: function() { + return from[k]; + } + }); + } + }); + return from; +} +const test = _index.test.extend({ + mswHandlers: [ + [], + { + option: true + } + ], + msw: [ + async ({ next, mswHandlers }, use)=>{ + const handlers = [ + ...mswHandlers + ]; + const emitter = new _stricteventemitter.Emitter(); + next.onFetch(async (request)=>{ + const requestId = Math.random().toString(16).slice(2); + let isUnhandled = false; + let isPassthrough = false; + let mockedResponse; + await (0, _msw.handleRequest)(request.clone(), requestId, handlers.slice(0), { + onUnhandledRequest: ()=>{ + isUnhandled = true; + } + }, emitter, { + onPassthroughResponse: ()=>{ + isPassthrough = true; + }, + onMockedResponse: (r)=>{ + mockedResponse = r; + } + }); + if (isUnhandled) { + return undefined; + } + if (isPassthrough) { + return 'continue'; + } + if (mockedResponse) { + return mockedResponse; + } + return 'abort'; + }); + await use({ + use: (...newHandlers)=>{ + handlers.unshift(...newHandlers); + } + }); + handlers.length = 0; + }, + { + auto: true + } + ] +}); +const _default = test; + +//# sourceMappingURL=msw.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/msw.js.map b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/msw.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ee8728636970f4de3ba0972cf68504df658b8337 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/msw.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/experimental/testmode/playwright/msw.ts"],"sourcesContent":["import { test as base, defineConfig } from './index'\nimport type { NextFixture } from './next-fixture'\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { type RequestHandler, handleRequest } from 'msw'\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { Emitter } from 'strict-event-emitter'\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nexport * from 'msw'\nexport * from '@playwright/test'\nexport type { NextFixture }\nexport { defineConfig }\n\nexport interface MswFixture {\n use: (...handlers: RequestHandler[]) => void\n}\n\nexport const test = base.extend<{\n msw: MswFixture\n mswHandlers: RequestHandler[]\n}>({\n mswHandlers: [[], { option: true }],\n\n msw: [\n async ({ next, mswHandlers }, use) => {\n const handlers: RequestHandler[] = [...mswHandlers]\n const emitter = new Emitter()\n\n next.onFetch(async (request) => {\n const requestId = Math.random().toString(16).slice(2)\n let isUnhandled = false\n let isPassthrough = false\n let mockedResponse\n await handleRequest(\n request.clone(),\n requestId,\n handlers.slice(0),\n {\n onUnhandledRequest: () => {\n isUnhandled = true\n },\n },\n emitter as any,\n {\n onPassthroughResponse: () => {\n isPassthrough = true\n },\n onMockedResponse: (r) => {\n mockedResponse = r\n },\n }\n )\n\n if (isUnhandled) {\n return undefined\n }\n if (isPassthrough) {\n return 'continue'\n }\n\n if (mockedResponse) {\n return mockedResponse\n }\n\n return 'abort'\n })\n\n await use({\n use: (...newHandlers) => {\n handlers.unshift(...newHandlers)\n },\n })\n\n handlers.length = 0\n },\n { auto: true },\n ],\n})\n\nexport default test\n"],"names":["defineConfig","test","base","extend","mswHandlers","option","msw","next","use","handlers","emitter","Emitter","onFetch","request","requestId","Math","random","toString","slice","isUnhandled","isPassthrough","mockedResponse","handleRequest","clone","onUnhandledRequest","onPassthroughResponse","onMockedResponse","r","undefined","newHandlers","unshift","length","auto"],"mappings":";;;;;;;;;;;;;;;;IA+EA,OAAmB;eAAnB;;IApESA,YAAY;eAAZA,mBAAY;;IAMRC,IAAI;eAAJA;;;;uBAjB8B;kCAGQ;oCAE3B;qBAIV;;;;;;;;;;;;;;AAQP,MAAMA,OAAOC,WAAI,CAACC,MAAM,CAG5B;IACDC,aAAa;QAAC,EAAE;QAAE;YAAEC,QAAQ;QAAK;KAAE;IAEnCC,KAAK;QACH,OAAO,EAAEC,IAAI,EAAEH,WAAW,EAAE,EAAEI;YAC5B,MAAMC,WAA6B;mBAAIL;aAAY;YACnD,MAAMM,UAAU,IAAIC,2BAAO;YAE3BJ,KAAKK,OAAO,CAAC,OAAOC;gBAClB,MAAMC,YAAYC,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,KAAK,CAAC;gBACnD,IAAIC,cAAc;gBAClB,IAAIC,gBAAgB;gBACpB,IAAIC;gBACJ,MAAMC,IAAAA,kBAAa,EACjBT,QAAQU,KAAK,IACbT,WACAL,SAASS,KAAK,CAAC,IACf;oBACEM,oBAAoB;wBAClBL,cAAc;oBAChB;gBACF,GACAT,SACA;oBACEe,uBAAuB;wBACrBL,gBAAgB;oBAClB;oBACAM,kBAAkB,CAACC;wBACjBN,iBAAiBM;oBACnB;gBACF;gBAGF,IAAIR,aAAa;oBACf,OAAOS;gBACT;gBACA,IAAIR,eAAe;oBACjB,OAAO;gBACT;gBAEA,IAAIC,gBAAgB;oBAClB,OAAOA;gBACT;gBAEA,OAAO;YACT;YAEA,MAAMb,IAAI;gBACRA,KAAK,CAAC,GAAGqB;oBACPpB,SAASqB,OAAO,IAAID;gBACtB;YACF;YAEApB,SAASsB,MAAM,GAAG;QACpB;QACA;YAAEC,MAAM;QAAK;KACd;AACH;MAEA,WAAe/B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-fixture.d.ts b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-fixture.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ecdde01437697f3205a7211b53434a26aad56c30 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-fixture.d.ts @@ -0,0 +1,12 @@ +import type { Page, TestInfo } from '@playwright/test'; +import type { NextWorkerFixture, FetchHandler } from './next-worker-fixture'; +import type { NextOptions } from './next-options'; +export interface NextFixture { + onFetch: (handler: FetchHandler) => void; +} +export declare function applyNextFixture(use: (fixture: NextFixture) => Promise<void>, { testInfo, nextOptions, nextWorker, page, }: { + testInfo: TestInfo; + nextOptions: NextOptions; + nextWorker: NextWorkerFixture; + page: Page; +}): Promise<void>; diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-fixture.js b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-fixture.js new file mode 100644 index 0000000000000000000000000000000000000000..e6e42b96dbe6621eb4990923e770382441c55667 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-fixture.js @@ -0,0 +1,59 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "applyNextFixture", { + enumerable: true, + get: function() { + return applyNextFixture; + } +}); +const _pageroute = require("./page-route"); +const _report = require("./report"); +class NextFixtureImpl { + constructor(testInfo, options, worker, page){ + this.testInfo = testInfo; + this.options = options; + this.worker = worker; + this.page = page; + this.fetchHandlers = []; + this.testId = testInfo.testId; + worker.onFetch(this.testId, this.handleFetch.bind(this)); + } + async setup() { + const testHeaders = { + 'Next-Test-Proxy-Port': String(this.worker.proxyPort), + 'Next-Test-Data': this.testId + }; + await this.page.context().route('**', (route)=>(0, _pageroute.handleRoute)(route, this.page, testHeaders, this.handleFetch.bind(this))); + } + teardown() { + this.worker.cleanupTest(this.testId); + } + onFetch(handler) { + this.fetchHandlers.push(handler); + } + async handleFetch(request) { + return (0, _report.reportFetch)(this.testInfo, request, async (req)=>{ + for (const handler of this.fetchHandlers.slice().reverse()){ + const result = await handler(req.clone()); + if (result) { + return result; + } + } + if (this.options.fetchLoopback) { + return fetch(req.clone()); + } + return undefined; + }); + } +} +async function applyNextFixture(use, { testInfo, nextOptions, nextWorker, page }) { + const fixture = new NextFixtureImpl(testInfo, nextOptions, nextWorker, page); + await fixture.setup(); + // eslint-disable-next-line react-hooks/rules-of-hooks -- not React.use() + await use(fixture); + fixture.teardown(); +} + +//# sourceMappingURL=next-fixture.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-fixture.js.map b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-fixture.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7abe464eb805d643ee354163dbff9168bbdd5508 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-fixture.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/experimental/testmode/playwright/next-fixture.ts"],"sourcesContent":["import type { Page, TestInfo } from '@playwright/test'\nimport type { NextWorkerFixture, FetchHandler } from './next-worker-fixture'\nimport type { NextOptions } from './next-options'\nimport type { FetchHandlerResult } from '../proxy'\nimport { handleRoute } from './page-route'\nimport { reportFetch } from './report'\n\nexport interface NextFixture {\n onFetch: (handler: FetchHandler) => void\n}\n\nclass NextFixtureImpl implements NextFixture {\n public readonly testId: string\n private fetchHandlers: FetchHandler[] = []\n\n constructor(\n private testInfo: TestInfo,\n private options: NextOptions,\n private worker: NextWorkerFixture,\n private page: Page\n ) {\n this.testId = testInfo.testId\n worker.onFetch(this.testId, this.handleFetch.bind(this))\n }\n\n async setup(): Promise<void> {\n const testHeaders = {\n 'Next-Test-Proxy-Port': String(this.worker.proxyPort),\n 'Next-Test-Data': this.testId,\n }\n\n await this.page\n .context()\n .route('**', (route) =>\n handleRoute(route, this.page, testHeaders, this.handleFetch.bind(this))\n )\n }\n\n teardown(): void {\n this.worker.cleanupTest(this.testId)\n }\n\n onFetch(handler: FetchHandler): void {\n this.fetchHandlers.push(handler)\n }\n\n private async handleFetch(request: Request): Promise<FetchHandlerResult> {\n return reportFetch(this.testInfo, request, async (req) => {\n for (const handler of this.fetchHandlers.slice().reverse()) {\n const result = await handler(req.clone())\n if (result) {\n return result\n }\n }\n if (this.options.fetchLoopback) {\n return fetch(req.clone())\n }\n return undefined\n })\n }\n}\n\nexport async function applyNextFixture(\n use: (fixture: NextFixture) => Promise<void>,\n {\n testInfo,\n nextOptions,\n nextWorker,\n page,\n }: {\n testInfo: TestInfo\n nextOptions: NextOptions\n nextWorker: NextWorkerFixture\n page: Page\n }\n): Promise<void> {\n const fixture = new NextFixtureImpl(testInfo, nextOptions, nextWorker, page)\n\n await fixture.setup()\n // eslint-disable-next-line react-hooks/rules-of-hooks -- not React.use()\n await use(fixture)\n\n fixture.teardown()\n}\n"],"names":["applyNextFixture","NextFixtureImpl","constructor","testInfo","options","worker","page","fetchHandlers","testId","onFetch","handleFetch","bind","setup","testHeaders","String","proxyPort","context","route","handleRoute","teardown","cleanupTest","handler","push","request","reportFetch","req","slice","reverse","result","clone","fetchLoopback","fetch","undefined","use","nextOptions","nextWorker","fixture"],"mappings":";;;;+BA8DsBA;;;eAAAA;;;2BA1DM;wBACA;AAM5B,MAAMC;IAIJC,YACE,AAAQC,QAAkB,EAC1B,AAAQC,OAAoB,EAC5B,AAAQC,MAAyB,EACjC,AAAQC,IAAU,CAClB;aAJQH,WAAAA;aACAC,UAAAA;aACAC,SAAAA;aACAC,OAAAA;aANFC,gBAAgC,EAAE;QAQxC,IAAI,CAACC,MAAM,GAAGL,SAASK,MAAM;QAC7BH,OAAOI,OAAO,CAAC,IAAI,CAACD,MAAM,EAAE,IAAI,CAACE,WAAW,CAACC,IAAI,CAAC,IAAI;IACxD;IAEA,MAAMC,QAAuB;QAC3B,MAAMC,cAAc;YAClB,wBAAwBC,OAAO,IAAI,CAACT,MAAM,CAACU,SAAS;YACpD,kBAAkB,IAAI,CAACP,MAAM;QAC/B;QAEA,MAAM,IAAI,CAACF,IAAI,CACZU,OAAO,GACPC,KAAK,CAAC,MAAM,CAACA,QACZC,IAAAA,sBAAW,EAACD,OAAO,IAAI,CAACX,IAAI,EAAEO,aAAa,IAAI,CAACH,WAAW,CAACC,IAAI,CAAC,IAAI;IAE3E;IAEAQ,WAAiB;QACf,IAAI,CAACd,MAAM,CAACe,WAAW,CAAC,IAAI,CAACZ,MAAM;IACrC;IAEAC,QAAQY,OAAqB,EAAQ;QACnC,IAAI,CAACd,aAAa,CAACe,IAAI,CAACD;IAC1B;IAEA,MAAcX,YAAYa,OAAgB,EAA+B;QACvE,OAAOC,IAAAA,mBAAW,EAAC,IAAI,CAACrB,QAAQ,EAAEoB,SAAS,OAAOE;YAChD,KAAK,MAAMJ,WAAW,IAAI,CAACd,aAAa,CAACmB,KAAK,GAAGC,OAAO,GAAI;gBAC1D,MAAMC,SAAS,MAAMP,QAAQI,IAAII,KAAK;gBACtC,IAAID,QAAQ;oBACV,OAAOA;gBACT;YACF;YACA,IAAI,IAAI,CAACxB,OAAO,CAAC0B,aAAa,EAAE;gBAC9B,OAAOC,MAAMN,IAAII,KAAK;YACxB;YACA,OAAOG;QACT;IACF;AACF;AAEO,eAAehC,iBACpBiC,GAA4C,EAC5C,EACE9B,QAAQ,EACR+B,WAAW,EACXC,UAAU,EACV7B,IAAI,EAML;IAED,MAAM8B,UAAU,IAAInC,gBAAgBE,UAAU+B,aAAaC,YAAY7B;IAEvE,MAAM8B,QAAQxB,KAAK;IACnB,yEAAyE;IACzE,MAAMqB,IAAIG;IAEVA,QAAQjB,QAAQ;AAClB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-options.d.ts b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-options.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..75a8370346bdf88a1f102466bdb92cbc436bb4fa --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-options.d.ts @@ -0,0 +1,6 @@ +export interface NextOptions { + fetchLoopback?: boolean; +} +export interface NextOptionsConfig { + nextOptions?: NextOptions; +} diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-options.js b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-options.js new file mode 100644 index 0000000000000000000000000000000000000000..a847dac92ee89012a5d87f32ad4180b5c203da29 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-options.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); + +//# sourceMappingURL=next-options.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-options.js.map b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-options.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ad48a910f81e5873737ebce8e9fa87278c9f7cd9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-options.js.map @@ -0,0 +1 @@ +{"version":3,"sources":[],"names":[],"mappings":"","ignoreList":[]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.d.ts b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f4949b324aa1fa64ab98a21550b5bcea4b95ea86 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.d.ts @@ -0,0 +1,8 @@ +import type { FetchHandlerResult } from '../proxy'; +export type FetchHandler = (request: Request) => FetchHandlerResult | Promise<FetchHandlerResult>; +export interface NextWorkerFixture { + proxyPort: number; + onFetch: (testId: string, handler: FetchHandler) => void; + cleanupTest: (testId: string) => void; +} +export declare function applyNextWorkerFixture(use: (fixture: NextWorkerFixture) => Promise<void>): Promise<void>; diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.js b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.js new file mode 100644 index 0000000000000000000000000000000000000000..67c8b82745cd2930d66b512c507e8f63f88c4a90 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "applyNextWorkerFixture", { + enumerable: true, + get: function() { + return applyNextWorkerFixture; + } +}); +const _proxy = require("../proxy"); +class NextWorkerFixtureImpl { + async setup() { + const server = await (0, _proxy.createProxyServer)({ + onFetch: this.handleProxyFetch.bind(this) + }); + this.proxyPort = server.port; + this.proxyServer = server; + } + teardown() { + if (this.proxyServer) { + this.proxyServer.close(); + this.proxyServer = null; + } + } + cleanupTest(testId) { + this.proxyFetchMap.delete(testId); + } + onFetch(testId, handler) { + this.proxyFetchMap.set(testId, handler); + } + async handleProxyFetch(testId, request) { + const handler = this.proxyFetchMap.get(testId); + return handler == null ? void 0 : handler(request); + } + constructor(){ + this.proxyPort = 0; + this.proxyServer = null; + this.proxyFetchMap = new Map(); + } +} +async function applyNextWorkerFixture(use) { + const fixture = new NextWorkerFixtureImpl(); + await fixture.setup(); + // eslint-disable-next-line react-hooks/rules-of-hooks -- not React.use() + await use(fixture); + fixture.teardown(); +} + +//# sourceMappingURL=next-worker-fixture.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.js.map b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.js.map new file mode 100644 index 0000000000000000000000000000000000000000..69a1e85dd97f570e3c276b53341080c79fe665ee --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/experimental/testmode/playwright/next-worker-fixture.ts"],"sourcesContent":["import type { FetchHandlerResult, ProxyServer } from '../proxy'\nimport { createProxyServer } from '../proxy'\n\nexport type FetchHandler = (\n request: Request\n) => FetchHandlerResult | Promise<FetchHandlerResult>\n\nexport interface NextWorkerFixture {\n proxyPort: number\n onFetch: (testId: string, handler: FetchHandler) => void\n cleanupTest: (testId: string) => void\n}\n\nclass NextWorkerFixtureImpl implements NextWorkerFixture {\n public proxyPort: number = 0\n private proxyServer: ProxyServer | null = null\n private proxyFetchMap = new Map<string, FetchHandler>()\n\n async setup(): Promise<void> {\n const server = await createProxyServer({\n onFetch: this.handleProxyFetch.bind(this),\n })\n\n this.proxyPort = server.port\n this.proxyServer = server\n }\n\n teardown(): void {\n if (this.proxyServer) {\n this.proxyServer.close()\n this.proxyServer = null\n }\n }\n\n cleanupTest(testId: string): void {\n this.proxyFetchMap.delete(testId)\n }\n\n onFetch(testId: string, handler: FetchHandler): void {\n this.proxyFetchMap.set(testId, handler)\n }\n\n private async handleProxyFetch(\n testId: string,\n request: Request\n ): Promise<FetchHandlerResult> {\n const handler = this.proxyFetchMap.get(testId)\n return handler?.(request)\n }\n}\n\nexport async function applyNextWorkerFixture(\n use: (fixture: NextWorkerFixture) => Promise<void>\n): Promise<void> {\n const fixture = new NextWorkerFixtureImpl()\n await fixture.setup()\n // eslint-disable-next-line react-hooks/rules-of-hooks -- not React.use()\n await use(fixture)\n fixture.teardown()\n}\n"],"names":["applyNextWorkerFixture","NextWorkerFixtureImpl","setup","server","createProxyServer","onFetch","handleProxyFetch","bind","proxyPort","port","proxyServer","teardown","close","cleanupTest","testId","proxyFetchMap","delete","handler","set","request","get","Map","use","fixture"],"mappings":";;;;+BAmDsBA;;;eAAAA;;;uBAlDY;AAYlC,MAAMC;IAKJ,MAAMC,QAAuB;QAC3B,MAAMC,SAAS,MAAMC,IAAAA,wBAAiB,EAAC;YACrCC,SAAS,IAAI,CAACC,gBAAgB,CAACC,IAAI,CAAC,IAAI;QAC1C;QAEA,IAAI,CAACC,SAAS,GAAGL,OAAOM,IAAI;QAC5B,IAAI,CAACC,WAAW,GAAGP;IACrB;IAEAQ,WAAiB;QACf,IAAI,IAAI,CAACD,WAAW,EAAE;YACpB,IAAI,CAACA,WAAW,CAACE,KAAK;YACtB,IAAI,CAACF,WAAW,GAAG;QACrB;IACF;IAEAG,YAAYC,MAAc,EAAQ;QAChC,IAAI,CAACC,aAAa,CAACC,MAAM,CAACF;IAC5B;IAEAT,QAAQS,MAAc,EAAEG,OAAqB,EAAQ;QACnD,IAAI,CAACF,aAAa,CAACG,GAAG,CAACJ,QAAQG;IACjC;IAEA,MAAcX,iBACZQ,MAAc,EACdK,OAAgB,EACa;QAC7B,MAAMF,UAAU,IAAI,CAACF,aAAa,CAACK,GAAG,CAACN;QACvC,OAAOG,2BAAAA,QAAUE;IACnB;;aAlCOX,YAAoB;aACnBE,cAAkC;aAClCK,gBAAgB,IAAIM;;AAiC9B;AAEO,eAAerB,uBACpBsB,GAAkD;IAElD,MAAMC,UAAU,IAAItB;IACpB,MAAMsB,QAAQrB,KAAK;IACnB,yEAAyE;IACzE,MAAMoB,IAAIC;IACVA,QAAQZ,QAAQ;AAClB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/page-route.d.ts b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/page-route.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..31fc0e51550330e79befeaf6b9c4a162b7766750 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/page-route.d.ts @@ -0,0 +1,3 @@ +import type { Page, Route } from '@playwright/test'; +import type { FetchHandler } from './next-worker-fixture'; +export declare function handleRoute(route: Route, page: Page, testHeaders: Record<string, string>, fetchHandler: FetchHandler | null): Promise<void>; diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/page-route.js b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/page-route.js new file mode 100644 index 0000000000000000000000000000000000000000..adc599cfc5b8dd7d4b4cb435768642b78dc1a7d7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/page-route.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "handleRoute", { + enumerable: true, + get: function() { + return handleRoute; + } +}); +function continueRoute(route, request, testHeaders) { + return route.continue({ + headers: { + ...request.headers(), + ...testHeaders + } + }); +} +async function handleRoute(route, page, testHeaders, fetchHandler) { + const request = route.request(); + // Continue the navigation and non-fetch requests. + if (request.isNavigationRequest() || request.resourceType() !== 'fetch') { + return continueRoute(route, request, testHeaders); + } + // Continue the local requests. The followup requests will be intercepted + // on the server. + const pageOrigin = new URL(page.url()).origin; + const requestOrigin = new URL(request.url()).origin; + if (pageOrigin === requestOrigin) { + return continueRoute(route, request, testHeaders); + } + if (!fetchHandler) { + return route.abort(); + } + const postData = request.postDataBuffer(); + const fetchRequest = new Request(request.url(), { + method: request.method(), + headers: Object.fromEntries(Object.entries(request.headers()).filter(([name])=>!name.toLowerCase().startsWith('next-test-'))), + // @ts-expect-error - Type 'Buffer<ArrayBufferLike> | null' is not assignable to type 'BodyInit | null | undefined'. + body: postData ?? null + }); + const proxyResponse = await fetchHandler(fetchRequest); + if (!proxyResponse) { + return route.abort(); + } + if (proxyResponse === 'abort') { + return route.abort(); + } + if (proxyResponse === 'continue') { + return continueRoute(route, request, testHeaders); + } + const { status, headers, body } = proxyResponse; + return route.fulfill({ + status, + headers: Object.fromEntries(headers), + body: body ? Buffer.from(await proxyResponse.arrayBuffer()) : undefined + }); +} + +//# sourceMappingURL=page-route.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/page-route.js.map b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/page-route.js.map new file mode 100644 index 0000000000000000000000000000000000000000..2ad34791d0b9f11418b7e85c754100502c760952 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/page-route.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/experimental/testmode/playwright/page-route.ts"],"sourcesContent":["import type {\n Page,\n Route,\n Request as PlaywrightRequest,\n} from '@playwright/test'\nimport type { FetchHandler } from './next-worker-fixture'\n\nfunction continueRoute(\n route: Route,\n request: PlaywrightRequest,\n testHeaders: Record<string, string>\n): Promise<void> {\n return route.continue({\n headers: {\n ...request.headers(),\n ...testHeaders,\n },\n })\n}\n\nexport async function handleRoute(\n route: Route,\n page: Page,\n testHeaders: Record<string, string>,\n fetchHandler: FetchHandler | null\n) {\n const request = route.request()\n\n // Continue the navigation and non-fetch requests.\n if (request.isNavigationRequest() || request.resourceType() !== 'fetch') {\n return continueRoute(route, request, testHeaders)\n }\n\n // Continue the local requests. The followup requests will be intercepted\n // on the server.\n const pageOrigin = new URL(page.url()).origin\n const requestOrigin = new URL(request.url()).origin\n if (pageOrigin === requestOrigin) {\n return continueRoute(route, request, testHeaders)\n }\n\n if (!fetchHandler) {\n return route.abort()\n }\n\n const postData = request.postDataBuffer()\n const fetchRequest = new Request(request.url(), {\n method: request.method(),\n headers: Object.fromEntries(\n Object.entries(request.headers()).filter(\n ([name]) => !name.toLowerCase().startsWith('next-test-')\n )\n ),\n // @ts-expect-error - Type 'Buffer<ArrayBufferLike> | null' is not assignable to type 'BodyInit | null | undefined'.\n body: postData ?? null,\n })\n\n const proxyResponse = await fetchHandler(fetchRequest)\n if (!proxyResponse) {\n return route.abort()\n }\n if (proxyResponse === 'abort') {\n return route.abort()\n }\n if (proxyResponse === 'continue') {\n return continueRoute(route, request, testHeaders)\n }\n const { status, headers, body } = proxyResponse\n return route.fulfill({\n status,\n headers: Object.fromEntries(headers),\n body: body ? Buffer.from(await proxyResponse.arrayBuffer()) : undefined,\n })\n}\n"],"names":["handleRoute","continueRoute","route","request","testHeaders","continue","headers","page","fetchHandler","isNavigationRequest","resourceType","pageOrigin","URL","url","origin","requestOrigin","abort","postData","postDataBuffer","fetchRequest","Request","method","Object","fromEntries","entries","filter","name","toLowerCase","startsWith","body","proxyResponse","status","fulfill","Buffer","from","arrayBuffer","undefined"],"mappings":";;;;+BAoBsBA;;;eAAAA;;;AAbtB,SAASC,cACPC,KAAY,EACZC,OAA0B,EAC1BC,WAAmC;IAEnC,OAAOF,MAAMG,QAAQ,CAAC;QACpBC,SAAS;YACP,GAAGH,QAAQG,OAAO,EAAE;YACpB,GAAGF,W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CAAC,MAAMJ,cAAcK,WAAW,MAAMC;IAChE;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/report.d.ts b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/report.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2db35bce8a48ea3b29a280f8512de072efa19c56 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/report.d.ts @@ -0,0 +1,3 @@ +import type { TestInfo } from '@playwright/test'; +import type { FetchHandler } from './next-worker-fixture'; +export declare function reportFetch(testInfo: TestInfo, req: Request, handler: FetchHandler): Promise<Awaited<ReturnType<FetchHandler>>>; diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/report.js b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/report.js new file mode 100644 index 0000000000000000000000000000000000000000..16a80894087922be178af0c4ab8b9b1738d006d7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/report.js @@ -0,0 +1,127 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "reportFetch", { + enumerable: true, + get: function() { + return reportFetch; + } +}); +const _step = require("./step"); +async function parseBody(r) { + const contentType = r.headers.get('content-type'); + let error; + let text; + let json; + let formData; + let buffer; + if (contentType == null ? void 0 : contentType.includes('text')) { + try { + text = await r.text(); + } catch (e) { + error = 'failed to parse text'; + } + } else if (contentType == null ? void 0 : contentType.includes('json')) { + try { + json = await r.json(); + } catch (e) { + error = 'failed to parse json'; + } + } else if (contentType == null ? void 0 : contentType.includes('form-data')) { + try { + formData = await r.formData(); + } catch (e) { + error = 'failed to parse formData'; + } + } else { + try { + buffer = await r.arrayBuffer(); + } catch (e) { + error = 'failed to parse arrayBuffer'; + } + } + return { + ...error ? { + error + } : null, + ...text ? { + text + } : null, + ...json ? { + json: JSON.stringify(json) + } : null, + ...formData ? { + formData: JSON.stringify(Array.from(formData)) + } : null, + ...buffer && buffer.byteLength > 0 ? { + buffer: `base64;${Buffer.from(buffer).toString('base64')}` + } : null + }; +} +function parseHeaders(headers) { + return Object.fromEntries(Array.from(headers).sort(([key1], [key2])=>key1.localeCompare(key2)).map(([key, value])=>{ + return [ + `header.${key}`, + value + ]; + })); +} +async function reportFetch(testInfo, req, handler) { + return (0, _step.step)(testInfo, { + title: `next.onFetch: ${req.method} ${req.url}`, + category: 'next.onFetch', + apiName: 'next.onFetch', + params: { + method: req.method, + url: req.url, + ...await parseBody(req.clone()), + ...parseHeaders(req.headers) + } + }, async (complete)=>{ + const res = await handler(req); + if (res === undefined || res == null) { + complete({ + error: { + message: 'unhandled' + } + }); + } else if (typeof res === 'string' && res !== 'continue') { + complete({ + error: { + message: res + } + }); + } else { + let body; + if (typeof res === 'string') { + body = { + response: res + }; + } else { + const { status, statusText } = res; + body = { + status, + ...statusText ? { + statusText + } : null, + ...await parseBody(res.clone()), + ...parseHeaders(res.headers) + }; + } + await (0, _step.step)(testInfo, { + title: `next.onFetch.fulfilled: ${req.method} ${req.url}`, + category: 'next.onFetch', + apiName: 'next.onFetch.fulfilled', + params: { + ...body, + 'request.url': req.url, + 'request.method': req.method + } + }, async ()=>undefined).catch(()=>undefined); + } + return res; + }); +} + +//# sourceMappingURL=report.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/report.js.map b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/report.js.map new file mode 100644 index 0000000000000000000000000000000000000000..2692db3a890560b3539848118c760da678c80859 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/report.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/experimental/testmode/playwright/report.ts"],"sourcesContent":["import type { TestInfo } from '@playwright/test'\nimport type { FetchHandler } from './next-worker-fixture'\nimport { step } from './step'\n\nasync function parseBody(\n r: Pick<Request, 'headers' | 'json' | 'text' | 'arrayBuffer' | 'formData'>\n): Promise<Record<string, string>> {\n const contentType = r.headers.get('content-type')\n let error: string | undefined\n let text: string | undefined\n let json: unknown\n let formData: FormData | undefined\n let buffer: ArrayBuffer | undefined\n if (contentType?.includes('text')) {\n try {\n text = await r.text()\n } catch (e) {\n error = 'failed to parse text'\n }\n } else if (contentType?.includes('json')) {\n try {\n json = await r.json()\n } catch (e) {\n error = 'failed to parse json'\n }\n } else if (contentType?.includes('form-data')) {\n try {\n formData = await r.formData()\n } catch (e) {\n error = 'failed to parse formData'\n }\n } else {\n try {\n buffer = await r.arrayBuffer()\n } catch (e) {\n error = 'failed to parse arrayBuffer'\n }\n }\n return {\n ...(error ? { error } : null),\n ...(text ? { text } : null),\n ...(json ? { json: JSON.stringify(json) } : null),\n ...(formData ? { formData: JSON.stringify(Array.from(formData)) } : null),\n ...(buffer && buffer.byteLength > 0\n ? { buffer: `base64;${Buffer.from(buffer).toString('base64')}` }\n : null),\n }\n}\n\nfunction parseHeaders(headers: Headers): Record<string, string> {\n return Object.fromEntries(\n Array.from(headers)\n .sort(([key1], [key2]) => key1.localeCompare(key2))\n .map(([key, value]) => {\n return [`header.${key}`, value]\n })\n )\n}\n\nexport async function reportFetch(\n testInfo: TestInfo,\n req: Request,\n handler: FetchHandler\n): Promise<Awaited<ReturnType<FetchHandler>>> {\n return step(\n testInfo,\n {\n title: `next.onFetch: ${req.method} ${req.url}`,\n category: 'next.onFetch',\n apiName: 'next.onFetch',\n params: {\n method: req.method,\n url: req.url,\n ...(await parseBody(req.clone())),\n ...parseHeaders(req.headers),\n },\n },\n async (complete) => {\n const res = await handler(req)\n if (res === undefined || res == null) {\n complete({ error: { message: 'unhandled' } })\n } else if (typeof res === 'string' && res !== 'continue') {\n complete({ error: { message: res } })\n } else {\n let body: Record<string, unknown>\n if (typeof res === 'string') {\n body = { response: res }\n } else {\n const { status, statusText } = res\n body = {\n status,\n ...(statusText ? { statusText } : null),\n ...(await parseBody(res.clone())),\n ...parseHeaders(res.headers),\n }\n }\n await step(\n testInfo,\n {\n title: `next.onFetch.fulfilled: ${req.method} ${req.url}`,\n category: 'next.onFetch',\n apiName: 'next.onFetch.fulfilled',\n params: {\n ...body,\n 'request.url': req.url,\n 'request.method': req.method,\n },\n },\n async () => undefined\n ).catch(() => undefined)\n }\n return res\n }\n )\n}\n"],"names":["reportFetch","parseBody","r","contentType","headers","get","error","text","json","formData","buffer","includes","e","arrayBuffer","JSON","stringify","Array","from","byteLength","Buffer","toString","parseHeaders","Object","fromEntries","sort","key1","key2","localeCompare","map","key","value","testInfo","req","handler","step","title","method","url","category","apiName","params","clone","complete","res","undefined","message","body","response","status","statusText","catch"],"mappings":";;;;+BA2DsBA;;;eAAAA;;;sBAzDD;AAErB,eAAeC,UACbC,CAA0E;IAE1E,MAAMC,cAAcD,EAAEE,OAAO,CAACC,GAAG,CAAC;IAClC,IAAIC;IACJ,IAAIC;IACJ,IAAIC;IACJ,IAAIC;IACJ,IAAIC;IACJ,IAAIP,+BAAAA,YAAaQ,QAAQ,CAAC,SAAS;QACjC,IAAI;YACFJ,OAAO,MAAML,EAAEK,IAAI;QACrB,EAAE,OAAOK,GAAG;YACVN,QAAQ;QACV;IACF,OAAO,IAAIH,+BAAAA,YAAaQ,QAAQ,CAAC,SAAS;QACxC,IAAI;YACFH,OAAO,MAAMN,EAAEM,IAAI;QACrB,EAAE,OAAOI,GAAG;YACVN,QAAQ;QACV;IACF,OAAO,IAAIH,+BAAAA,YAAaQ,QAAQ,CAAC,cAAc;QAC7C,IAAI;YACFF,WAAW,MAAMP,EAAEO,QAAQ;QAC7B,EAAE,OAAOG,GAAG;YACVN,QAAQ;QACV;IACF,OAAO;QACL,IAAI;YACFI,SAAS,MAAMR,EAAEW,WAAW;QAC9B,EAAE,OAAOD,GAAG;YACVN,QAAQ;QACV;IACF;IACA,OAAO;QACL,GAAIA,QAAQ;YAAEA;QAAM,IAAI,IAAI;QAC5B,GAAIC,OAAO;YAAEA;QAAK,IAAI,IAAI;QAC1B,GAAIC,OAAO;YAAEA,MAAMM,KAAKC,SAAS,CAACP;QAAM,I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;oBAAEC,UAAUJ;gBAAI;YACzB,OAAO;gBACL,MAAM,EAAEK,MAAM,EAAEC,UAAU,EAAE,GAAGN;gBAC/BG,OAAO;oBACLE;oBACA,GAAIC,aAAa;wBAAEA;oBAAW,IAAI,IAAI;oBACtC,GAAI,MAAMhD,UAAU0C,IAAIF,KAAK,GAAG;oBAChC,GAAGpB,aAAasB,IAAIvC,OAAO,CAAC;gBAC9B;YACF;YACA,MAAM8B,IAAAA,UAAI,EACRH,UACA;gBACEI,OAAO,CAAC,wBAAwB,EAAEH,IAAII,MAAM,CAAC,CAAC,EAAEJ,IAAIK,GAAG,EAAE;gBACzDC,UAAU;gBACVC,SAAS;gBACTC,QAAQ;oBACN,GAAGM,IAAI;oBACP,eAAed,IAAIK,GAAG;oBACtB,kBAAkBL,IAAII,MAAM;gBAC9B;YACF,GACA,UAAYQ,WACZM,KAAK,CAAC,IAAMN;QAChB;QACA,OAAOD;IACT;AAEJ","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/step.d.ts b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/step.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bcd954681943aa7e13deab00e3f9fddc51ffe8be --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/step.d.ts @@ -0,0 +1,12 @@ +import type { TestInfo } from '@playwright/test'; +export interface StepProps { + category: string; + title: string; + apiName?: string; + params?: Record<string, string | number | boolean | null | undefined>; +} +type Complete = (result: { + error?: any; +}) => void; +export declare function step<T>(_testInfo: TestInfo, props: StepProps, handler: (complete: Complete) => Promise<Awaited<T>>): Promise<Awaited<T>>; +export {}; diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/step.js b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/step.js new file mode 100644 index 0000000000000000000000000000000000000000..530a791935fa4cd6db79d438c4df20cf97d6d48c --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/step.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "step", { + enumerable: true, + get: function() { + return step; + } +}); +const _test = require("@playwright/test"); +async function step(_testInfo, props, handler) { + let result; + let reportedError; + try { + await _test.test.step(props.title, async ()=>{ + result = await handler(({ error })=>{ + reportedError = error; + if (reportedError) { + throw reportedError; + } + }); + }); + } catch (error) { + if (error !== reportedError) { + throw error; + } + } + return result; +} + +//# sourceMappingURL=step.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/playwright/step.js.map b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/step.js.map new file mode 100644 index 0000000000000000000000000000000000000000..889311ed021049f7e4d937ac21a4c585029c2ca9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/playwright/step.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/experimental/testmode/playwright/step.ts"],"sourcesContent":["import type { TestInfo } from '@playwright/test'\nimport { test } from '@playwright/test'\n\nexport interface StepProps {\n category: string\n title: string\n apiName?: string\n params?: Record<string, string | number | boolean | null | undefined>\n}\n\ntype Complete = (result: { error?: any }) => void\n\nexport async function step<T>(\n _testInfo: TestInfo,\n props: StepProps,\n handler: (complete: Complete) => Promise<Awaited<T>>\n): Promise<Awaited<T>> {\n let result: Awaited<T>\n let reportedError: any\n try {\n await test.step(props.title, async () => {\n result = await handler(({ error }) => {\n reportedError = error\n if (reportedError) {\n throw reportedError\n }\n })\n })\n } catch (error) {\n if (error !== reportedError) {\n throw error\n }\n }\n return result!\n}\n"],"names":["step","_testInfo","props","handler","result","reportedError","test","title","error"],"mappings":";;;;+BAYsBA;;;eAAAA;;;sBAXD;AAWd,eAAeA,KACpBC,SAAmB,EACnBC,KAAgB,EAChBC,OAAoD;IAEpD,IAAIC;IACJ,IAAIC;IACJ,IAAI;QACF,MAAMC,UAAI,CAACN,IAAI,CAACE,MAAMK,KAAK,EAAE;YAC3BH,SAAS,MAAMD,QAAQ,CAAC,EAAEK,KAAK,EAAE;gBAC/BH,gBAAgBG;gBAChB,IAAIH,eAAe;oBACjB,MAAMA;gBACR;YACF;QACF;IACF,EAAE,OAAOG,OAAO;QACd,IAAIA,UAAUH,eAAe;YAC3B,MAAMG;QACR;IACF;IACA,OAAOJ;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/proxy/fetch-api.d.ts b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/fetch-api.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c13b3cceab0e78929d78bc688c7b01419f2e3deb --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/fetch-api.d.ts @@ -0,0 +1,4 @@ +import type { ProxyFetchRequest, ProxyResponse } from './types'; +export type FetchHandlerResult = Response | 'abort' | 'continue' | null | undefined; +export type FetchHandler = (testData: string, request: Request) => FetchHandlerResult | Promise<FetchHandlerResult>; +export declare function handleFetch(req: ProxyFetchRequest, onFetch: FetchHandler): Promise<ProxyResponse>; diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/proxy/fetch-api.js b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/fetch-api.js new file mode 100644 index 0000000000000000000000000000000000000000..3e3fbbc54c757dff5cd2dacf44e25d4729fd4cbd --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/fetch-api.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "handleFetch", { + enumerable: true, + get: function() { + return handleFetch; + } +}); +const _types = require("./types"); +function buildRequest(req) { + const { request: proxyRequest } = req; + const { url, headers, body, ...options } = proxyRequest; + return new Request(url, { + ...options, + headers: new Headers(headers), + body: body ? Buffer.from(body, 'base64') : null + }); +} +async function buildResponse(response) { + if (!response) { + return _types.UNHANDLED; + } + if (response === 'abort') { + return _types.ABORT; + } + if (response === 'continue') { + return _types.CONTINUE; + } + const { status, headers, body } = response; + return { + api: 'fetch', + response: { + status, + headers: Array.from(headers), + body: body ? Buffer.from(await response.arrayBuffer()).toString('base64') : null + } + }; +} +async function handleFetch(req, onFetch) { + const { testData } = req; + const request = buildRequest(req); + const response = await onFetch(testData, request); + return buildResponse(response); +} + +//# sourceMappingURL=fetch-api.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/proxy/fetch-api.js.map b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/fetch-api.js.map new file mode 100644 index 0000000000000000000000000000000000000000..5a2e1a015596b1fddcab244184bb9d99338690d6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/fetch-api.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/experimental/testmode/proxy/fetch-api.ts"],"sourcesContent":["import type { ProxyFetchRequest, ProxyResponse } from './types'\nimport { ABORT, CONTINUE, UNHANDLED } from './types'\n\nexport type FetchHandlerResult =\n | Response\n | 'abort'\n | 'continue'\n | null\n | undefined\n\nexport type FetchHandler = (\n testData: string,\n request: Request\n) => FetchHandlerResult | Promise<FetchHandlerResult>\n\nfunction buildRequest(req: ProxyFetchRequest): Request {\n const { request: proxyRequest } = req\n const { url, headers, body, ...options } = proxyRequest\n return new Request(url, {\n ...options,\n headers: new Headers(headers),\n body: body ? Buffer.from(body, 'base64') : null,\n })\n}\n\nasync function buildResponse(\n response: FetchHandlerResult\n): Promise<ProxyResponse> {\n if (!response) {\n return UNHANDLED\n }\n if (response === 'abort') {\n return ABORT\n }\n if (response === 'continue') {\n return CONTINUE\n }\n\n const { status, headers, body } = response\n return {\n api: 'fetch',\n response: {\n status,\n headers: Array.from(headers),\n body: body\n ? Buffer.from(await response.arrayBuffer()).toString('base64')\n : null,\n },\n }\n}\n\nexport async function handleFetch(\n req: ProxyFetchRequest,\n onFetch: FetchHandler\n): Promise<ProxyResponse> {\n const { testData } = req\n const request = buildRequest(req)\n const response = await onFetch(testData, request)\n return buildResponse(response)\n}\n"],"names":["handleFetch","buildRequest","req","request","proxyRequest","url","headers","body","options","Request","Headers","Buffer","from","buildResponse","response","UNHANDLED","ABORT","CONTINUE","status","api","Array","arrayBuffer","toString","onFetch","testData"],"mappings":";;;;+BAmDsBA;;;eAAAA;;;uBAlDqB;AAc3C,SAASC,aAAaC,GAAsB;IAC1C,MAAM,EAAEC,SAASC,YAAY,EAAE,GAAGF;IAClC,MAAM,EAAEG,GAAG,EAAEC,OAAO,EAAEC,IAAI,EAAE,GAAGC,SAAS,GAAGJ;IAC3C,OAAO,IAAIK,QAAQJ,KAAK;QACtB,GAAGG,OAAO;QACVF,SAAS,IAAII,QAAQJ;QACrBC,MAAMA,OAAOI,OAAOC,IAAI,CAACL,MAAM,YAAY;IAC7C;AACF;AAEA,eAAeM,cACbC,QAA4B;IAE5B,IAAI,CAACA,UAAU;QACb,OAAOC,gBAAS;IAClB;IACA,IAAID,aAAa,SAAS;QACxB,OAAOE,YAAK;IACd;IACA,IAAIF,aAAa,YAAY;QAC3B,OAAOG,eAAQ;IACjB;IAEA,MAAM,EAAEC,MAAM,EAAEZ,OAAO,EAAEC,IAAI,EAAE,GAAGO;IAClC,OAAO;QACLK,KAAK;QACLL,UAAU;YACRI;YACAZ,SAASc,MAAMR,IAAI,CAACN;YACpBC,MAAMA,OACFI,OAAOC,IAAI,CAAC,MAAME,SAASO,WAAW,IAAIC,QAAQ,CAAC,YACnD;QACN;IACF;AACF;AAEO,eAAetB,YACpBE,GAAsB,EACtBqB,OAAqB;IAErB,MAAM,EAAEC,QAAQ,EAAE,GAAGtB;IACrB,MAAMC,UAAUF,aAAaC;IAC7B,MAAMY,WAAW,MAAMS,QAAQC,UAAUrB;IACzC,OAAOU,cAAcC;AACvB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/proxy/index.d.ts b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cc80338013958ad919d69e113814bf18f9ddbda8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/index.d.ts @@ -0,0 +1,3 @@ +export { createProxyServer } from './server'; +export type { FetchHandler, FetchHandlerResult } from './fetch-api'; +export type * from './types'; diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/proxy/index.js b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/index.js new file mode 100644 index 0000000000000000000000000000000000000000..908b247f5719ec37bd8a250b82080be1fec32c83 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/index.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "createProxyServer", { + enumerable: true, + get: function() { + return _server.createProxyServer; + } +}); +const _server = require("./server"); + +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/proxy/index.js.map b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f6bb9695a8e80a68639834e056ce253abf97ff6a --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/experimental/testmode/proxy/index.ts"],"sourcesContent":["export { createProxyServer } from './server'\nexport type { FetchHandler, FetchHandlerResult } from './fetch-api'\nexport type * from './types'\n"],"names":["createProxyServer"],"mappings":";;;;+BAASA;;;eAAAA,yBAAiB;;;wBAAQ","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/proxy/server.d.ts b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/server.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a1e75113e27983e2192acc0e1ed421d885a0d203 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/server.d.ts @@ -0,0 +1,5 @@ +import type { ProxyServer } from './types'; +import type { FetchHandler } from './fetch-api'; +export declare function createProxyServer({ onFetch, }: { + onFetch?: FetchHandler; +}): Promise<ProxyServer>; diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/proxy/server.js b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/server.js new file mode 100644 index 0000000000000000000000000000000000000000..708040af318c548e7afce834ba2adff90bebde1a --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/server.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "createProxyServer", { + enumerable: true, + get: function() { + return createProxyServer; + } +}); +const _http = /*#__PURE__*/ _interop_require_default(require("http")); +const _types = require("./types"); +const _fetchapi = require("./fetch-api"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +async function readBody(req) { + const acc = []; + for await (const chunk of req){ + acc.push(chunk); + } + return Buffer.concat(acc); +} +async function createProxyServer({ onFetch }) { + const server = _http.default.createServer(async (req, res)=>{ + if (req.url !== '/') { + res.writeHead(404); + res.end(); + return; + } + let json; + try { + json = JSON.parse((await readBody(req)).toString('utf-8')); + } catch (e) { + res.writeHead(400); + res.end(); + return; + } + const { api } = json; + let response; + switch(api){ + case 'fetch': + if (onFetch) { + response = await (0, _fetchapi.handleFetch)(json, onFetch); + } + break; + default: + break; + } + if (!response) { + response = _types.UNHANDLED; + } + res.writeHead(200, { + 'Content-Type': 'application/json' + }); + res.write(JSON.stringify(response)); + res.end(); + }); + await new Promise((resolve)=>{ + server.listen(0, '::', ()=>{ + resolve(undefined); + }); + }); + const address = server.address(); + if (!address || typeof address !== 'object') { + server.close(); + throw new Error('Failed to create a proxy server'); + } + const port = address.port; + const fetchWith = (input, init, testData)=>{ + const request = new Request(input, init); + request.headers.set('Next-Test-Proxy-Port', String(port)); + request.headers.set('Next-Test-Data', testData ?? ''); + return fetch(request); + }; + return { + port, + close: ()=>server.close(), + fetchWith + }; +} + +//# sourceMappingURL=server.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/proxy/server.js.map b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/server.js.map new file mode 100644 index 0000000000000000000000000000000000000000..260373d89d63aa3f06ce35c06c3028f1bfb5b219 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/server.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/experimental/testmode/proxy/server.ts"],"sourcesContent":["import http from 'http'\nimport type { IncomingMessage } from 'http'\nimport type { ProxyRequest, ProxyResponse, ProxyServer } from './types'\nimport { UNHANDLED } from './types'\nimport type { FetchHandler } from './fetch-api'\nimport { handleFetch } from './fetch-api'\n\nasync function readBody(req: IncomingMessage): Promise<Buffer> {\n const acc: Buffer[] = []\n\n for await (const chunk of req) {\n acc.push(chunk)\n }\n\n return Buffer.concat(acc)\n}\n\nexport async function createProxyServer({\n onFetch,\n}: {\n onFetch?: FetchHandler\n}): Promise<ProxyServer> {\n const server = http.createServer(async (req, res) => {\n if (req.url !== '/') {\n res.writeHead(404)\n res.end()\n return\n }\n\n let json: ProxyRequest | undefined\n try {\n json = JSON.parse((await readBody(req)).toString('utf-8')) as ProxyRequest\n } catch (e) {\n res.writeHead(400)\n res.end()\n return\n }\n\n const { api } = json\n\n let response: ProxyResponse | undefined\n switch (api) {\n case 'fetch':\n if (onFetch) {\n response = await handleFetch(json, onFetch)\n }\n break\n default:\n break\n }\n if (!response) {\n response = UNHANDLED\n }\n\n res.writeHead(200, { 'Content-Type': 'application/json' })\n res.write(JSON.stringify(response))\n res.end()\n })\n\n await new Promise((resolve) => {\n server.listen(0, '::', () => {\n resolve(undefined)\n })\n })\n\n const address = server.address()\n if (!address || typeof address !== 'object') {\n server.close()\n throw new Error('Failed to create a proxy server')\n }\n const port = address.port\n\n const fetchWith: ProxyServer['fetchWith'] = (input, init, testData) => {\n const request = new Request(input, init)\n request.headers.set('Next-Test-Proxy-Port', String(port))\n request.headers.set('Next-Test-Data', testData ?? '')\n return fetch(request)\n }\n\n return { port, close: () => server.close(), fetchWith }\n}\n"],"names":["createProxyServer","readBody","req","acc","chunk","push","Buffer","concat","onFetch","server","http","createServer","res","url","writeHead","end","json","JSON","parse","toString","e","api","response","handleFetch","UNHANDLED","write","stringify","Promise","resolve","listen","undefined","address","close","Error","port","fetchWith","input","init","testData","request","Request","headers","set","String","fetch"],"mappings":";;;;+BAiBsBA;;;eAAAA;;;6DAjBL;uBAGS;0BAEE;;;;;;AAE5B,eAAeC,SAASC,GAAoB;IAC1C,MAAMC,MAAgB,EAAE;IAExB,WAAW,MAAMC,SAASF,IAAK;QAC7BC,IAAIE,IAAI,CAACD;IACX;IAEA,OAAOE,OAAOC,MAAM,CAACJ;AACvB;AAEO,eAAeH,kBAAkB,EACtCQ,OAAO,EAGR;IACC,MAAMC,SAASC,aAAI,CAACC,YAAY,CAAC,OAAOT,KAAKU;QAC3C,IAAIV,IAAIW,GAAG,KAAK,KAAK;YACnBD,IAAIE,SAAS,CAAC;YACdF,IAAIG,GAAG;YACP;QACF;QAEA,IAAIC;QACJ,IAAI;YACFA,OAAOC,KAAKC,KAAK,CAAC,AAAC,CAAA,MAAMjB,SAASC,IAAG,EAAGiB,QAAQ,CAAC;QACnD,EAAE,OAAOC,GAAG;YACVR,IAAIE,SAAS,CAAC;YACdF,IAAIG,GAAG;YACP;QACF;QAEA,MAAM,EAAEM,GAAG,EAAE,GAAGL;QAEhB,IAAIM;QACJ,OAAQD;YACN,KAAK;gBACH,IAAIb,SAAS;oBACXc,WAAW,MAAMC,IAAAA,qBAAW,EAACP,MAAMR;gBACrC;gBACA;YACF;gBACE;QACJ;QACA,IAAI,CAACc,UAAU;YACbA,WAAWE,gBAAS;QACtB;QAEAZ,IAAIE,SAAS,CAAC,KAAK;YAAE,gBAAgB;QAAmB;QACxDF,IAAIa,KAAK,CAACR,KAAKS,SAAS,CAACJ;QACzBV,IAAIG,GAAG;IACT;IAEA,MAAM,IAAIY,QAAQ,CAACC;QACjBnB,OAAOoB,MAAM,CAAC,GAAG,MAAM;YACrBD,QAAQE;QACV;IACF;IAEA,MAAMC,UAAUtB,OAAOsB,OAAO;IAC9B,IAAI,CAACA,WAAW,OAAOA,YAAY,UAAU;QAC3CtB,OAAOuB,KAAK;QACZ,MAAM,IAAIC,MAAM;IAClB;IACA,MAAMC,OAAOH,QAAQG,IAAI;IAEzB,MAAMC,YAAsC,CAACC,OAAOC,MAAMC;QACxD,MAAMC,UAAU,IAAIC,QAAQJ,OAAOC;QACnCE,QAAQE,OAAO,CAACC,GAAG,CAAC,wBAAwBC,OAAOT;QACnDK,QAAQE,OAAO,CAACC,GAAG,CAAC,kBAAkBJ,YAAY;QAClD,OAAOM,MAAML;IACf;IAEA,OAAO;QAAEL;QAAMF,OAAO,IAAMvB,OAAOuB,KAAK;QAAIG;IAAU;AACxD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/proxy/types.d.ts b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b708014d42e5608f6fa5709e31f8ad86b997f93d --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/types.d.ts @@ -0,0 +1,43 @@ +export interface ProxyServer { + readonly port: number; + fetchWith(input: string | URL, init?: RequestInit, testData?: string): Promise<Response>; + close(): void; +} +interface ProxyRequestBase { + testData: string; + api: string; +} +interface ProxyResponseBase { + api: string; +} +export interface ProxyUnhandledResponse extends ProxyResponseBase { + api: 'unhandled'; +} +export interface ProxyAbortResponse extends ProxyResponseBase { + api: 'abort'; +} +export interface ProxyContinueResponse extends ProxyResponseBase { + api: 'continue'; +} +export interface ProxyFetchRequest extends ProxyRequestBase { + api: 'fetch'; + request: { + url: string; + headers: Array<[string, string]>; + body: string | null; + } & Omit<RequestInit, 'headers' | 'body'>; +} +export interface ProxyFetchResponse extends ProxyResponseBase { + api: 'fetch'; + response: { + status: number; + headers: Array<[string, string]>; + body: string | null; + }; +} +export type ProxyRequest = ProxyFetchRequest; +export type ProxyResponse = ProxyUnhandledResponse | ProxyAbortResponse | ProxyContinueResponse | ProxyFetchResponse; +export declare const ABORT: ProxyResponse; +export declare const CONTINUE: ProxyResponse; +export declare const UNHANDLED: ProxyResponse; +export {}; diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/proxy/types.js b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/types.js new file mode 100644 index 0000000000000000000000000000000000000000..629d964590693459fc0f164676485473e8129db0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/types.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + ABORT: null, + CONTINUE: null, + UNHANDLED: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + ABORT: function() { + return ABORT; + }, + CONTINUE: function() { + return CONTINUE; + }, + UNHANDLED: function() { + return UNHANDLED; + } +}); +const ABORT = { + api: 'abort' +}; +const CONTINUE = { + api: 'continue' +}; +const UNHANDLED = { + api: 'unhandled' +}; + +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/proxy/types.js.map b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a04b6505bdc8e486f4261899ff52f47067b7e725 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/proxy/types.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/experimental/testmode/proxy/types.ts"],"sourcesContent":["export interface ProxyServer {\n readonly port: number\n fetchWith(\n input: string | URL,\n init?: RequestInit,\n testData?: string\n ): Promise<Response>\n close(): void\n}\n\ninterface ProxyRequestBase {\n testData: string\n api: string\n}\n\ninterface ProxyResponseBase {\n api: string\n}\n\nexport interface ProxyUnhandledResponse extends ProxyResponseBase {\n api: 'unhandled'\n}\n\nexport interface ProxyAbortResponse extends ProxyResponseBase {\n api: 'abort'\n}\n\nexport interface ProxyContinueResponse extends ProxyResponseBase {\n api: 'continue'\n}\n\nexport interface ProxyFetchRequest extends ProxyRequestBase {\n api: 'fetch'\n request: {\n url: string\n headers: Array<[string, string]>\n body: string | null\n } & Omit<RequestInit, 'headers' | 'body'>\n}\n\nexport interface ProxyFetchResponse extends ProxyResponseBase {\n api: 'fetch'\n response: {\n status: number\n headers: Array<[string, string]>\n body: string | null\n }\n}\n\nexport type ProxyRequest = ProxyFetchRequest\n\nexport type ProxyResponse =\n | ProxyUnhandledResponse\n | ProxyAbortResponse\n | ProxyContinueResponse\n | ProxyFetchResponse\n\nexport const ABORT: ProxyResponse = { api: 'abort' }\nexport const CONTINUE: ProxyResponse = { api: 'continue' }\nexport const UNHANDLED: ProxyResponse = { api: 'unhandled' }\n"],"names":["ABORT","CONTINUE","UNHANDLED","api"],"mappings":";;;;;;;;;;;;;;;;IAyDaA,KAAK;eAALA;;IACAC,QAAQ;eAARA;;IACAC,SAAS;eAATA;;;AAFN,MAAMF,QAAuB;IAAEG,KAAK;AAAQ;AAC5C,MAAMF,WAA0B;IAAEE,KAAK;AAAW;AAClD,MAAMD,YAA2B;IAAEC,KAAK;AAAY","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/server-edge.d.ts b/e-commerce/node_modules/next/dist/experimental/testmode/server-edge.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..968310d815a30233593f8383182ef3aceea76397 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/server-edge.d.ts @@ -0,0 +1,2 @@ +export declare function interceptTestApis(): () => void; +export declare function wrapRequestHandler<T, TRequest extends Request>(handler: (req: TRequest, fn: () => T) => T): (req: TRequest, fn: () => T) => T; diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/server-edge.js b/e-commerce/node_modules/next/dist/experimental/testmode/server-edge.js new file mode 100644 index 0000000000000000000000000000000000000000..31a97c662e952144b5eae8cc003c0b98d2583c07 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/server-edge.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + interceptTestApis: null, + wrapRequestHandler: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + interceptTestApis: function() { + return interceptTestApis; + }, + wrapRequestHandler: function() { + return wrapRequestHandler; + } +}); +const _context = require("./context"); +const _fetch = require("./fetch"); +function interceptTestApis() { + return (0, _fetch.interceptFetch)(global.fetch); +} +function wrapRequestHandler(handler) { + return (req, fn)=>(0, _context.withRequest)(req, _fetch.reader, ()=>handler(req, fn)); +} + +//# sourceMappingURL=server-edge.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/server-edge.js.map b/e-commerce/node_modules/next/dist/experimental/testmode/server-edge.js.map new file mode 100644 index 0000000000000000000000000000000000000000..07828b8ac0829f08c44c45a07cbd12b48808e8bf --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/server-edge.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/experimental/testmode/server-edge.ts"],"sourcesContent":["import { withRequest as withRequestContext } from './context'\nimport { interceptFetch, reader } from './fetch'\n\nexport function interceptTestApis(): () => void {\n return interceptFetch(global.fetch)\n}\n\nexport function wrapRequestHandler<T, TRequest extends Request>(\n handler: (req: TRequest, fn: () => T) => T\n): (req: TRequest, fn: () => T) => T {\n return (req, fn) => withRequestContext(req, reader, () => handler(req, fn))\n}\n"],"names":["interceptTestApis","wrapRequestHandler","interceptFetch","global","fetch","handler","req","fn","withRequestContext","reader"],"mappings":";;;;;;;;;;;;;;;IAGgBA,iBAAiB;eAAjBA;;IAIAC,kBAAkB;eAAlBA;;;yBAPkC;uBACX;AAEhC,SAASD;IACd,OAAOE,IAAAA,qBAAc,EAACC,OAAOC,KAAK;AACpC;AAEO,SAASH,mBACdI,OAA0C;IAE1C,OAAO,CAACC,KAAKC,KAAOC,IAAAA,oBAAkB,EAACF,KAAKG,aAAM,EAAE,IAAMJ,QAAQC,KAAKC;AACzE","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/server.d.ts b/e-commerce/node_modules/next/dist/experimental/testmode/server.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..321c9d09c6dfa862ff71dc79c7fccb27b7788ae2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/server.d.ts @@ -0,0 +1,5 @@ +import type { WorkerRequestHandler } from '../../server/lib/types'; +import type { NodeRequestHandler } from '../../server/next-server'; +export declare function interceptTestApis(): () => void; +export declare function wrapRequestHandlerWorker(handler: WorkerRequestHandler): WorkerRequestHandler; +export declare function wrapRequestHandlerNode(handler: NodeRequestHandler): NodeRequestHandler; diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/server.js b/e-commerce/node_modules/next/dist/experimental/testmode/server.js new file mode 100644 index 0000000000000000000000000000000000000000..1c5044aa3b3d1aad76cd39980c56a1ce8a09c6f1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/server.js @@ -0,0 +1,73 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + interceptTestApis: null, + wrapRequestHandlerNode: null, + wrapRequestHandlerWorker: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + interceptTestApis: function() { + return interceptTestApis; + }, + wrapRequestHandlerNode: function() { + return wrapRequestHandlerNode; + }, + wrapRequestHandlerWorker: function() { + return wrapRequestHandlerWorker; + } +}); +const _context = require("./context"); +const _fetch = require("./fetch"); +const _httpget = require("./httpget"); +const reader = { + url (req) { + return req.url ?? ''; + }, + header (req, name) { + const h = req.headers[name]; + if (h === undefined || h === null) { + return null; + } + if (typeof h === 'string') { + return h; + } + return h[0] ?? null; + } +}; +const interceptedSymbol = Symbol.for('next.testmode.intercepted'); +function interceptTestApis() { + // In development the render server runs in the same process as the router + // server, so both call this function. @mswjs/interceptors throws when its + // global replacements are applied a second time, so make repeated + // interception within the same process a no-op. + const globalState = globalThis; + if (globalState[interceptedSymbol] === true) { + return ()=>{}; + } + globalState[interceptedSymbol] = true; + const originalFetch = global.fetch; + const restoreFetch = (0, _fetch.interceptFetch)(originalFetch); + const restoreHttpGet = (0, _httpget.interceptHttpGet)(originalFetch); + // Cleanup. + return ()=>{ + globalState[interceptedSymbol] = false; + restoreFetch(); + restoreHttpGet(); + }; +} +function wrapRequestHandlerWorker(handler) { + return (req, res)=>(0, _context.withRequest)(req, reader, ()=>handler(req, res)); +} +function wrapRequestHandlerNode(handler) { + return (req, res, parsedUrl)=>(0, _context.withRequest)(req, reader, ()=>handler(req, res, parsedUrl)); +} + +//# sourceMappingURL=server.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/experimental/testmode/server.js.map b/e-commerce/node_modules/next/dist/experimental/testmode/server.js.map new file mode 100644 index 0000000000000000000000000000000000000000..156e6d217e5ac8dff02d88baeddfa4e3f6d0f268 --- /dev/null +++ b/e-commerce/node_modules/next/dist/experimental/testmode/server.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/experimental/testmode/server.ts"],"sourcesContent":["import type { WorkerRequestHandler } from '../../server/lib/types'\nimport type { NodeRequestHandler } from '../../server/next-server'\nimport { withRequest, type TestRequestReader } from './context'\nimport { interceptFetch } from './fetch'\nimport { interceptHttpGet } from './httpget'\nimport type { IncomingMessage } from 'http'\n\nconst reader: TestRequestReader<IncomingMessage> = {\n url(req) {\n return req.url ?? ''\n },\n header(req, name) {\n const h = req.headers[name]\n if (h === undefined || h === null) {\n return null\n }\n if (typeof h === 'string') {\n return h\n }\n return h[0] ?? null\n },\n}\n\nconst interceptedSymbol = Symbol.for('next.testmode.intercepted')\n\nexport function interceptTestApis(): () => void {\n // In development the render server runs in the same process as the router\n // server, so both call this function. @mswjs/interceptors throws when its\n // global replacements are applied a second time, so make repeated\n // interception within the same process a no-op.\n const globalState = globalThis as { [interceptedSymbol]?: boolean }\n if (globalState[interceptedSymbol] === true) {\n return () => {}\n }\n globalState[interceptedSymbol] = true\n\n const originalFetch = global.fetch\n const restoreFetch = interceptFetch(originalFetch)\n const restoreHttpGet = interceptHttpGet(originalFetch)\n\n // Cleanup.\n return () => {\n globalState[interceptedSymbol] = false\n restoreFetch()\n restoreHttpGet()\n }\n}\n\nexport function wrapRequestHandlerWorker(\n handler: WorkerRequestHandler\n): WorkerRequestHandler {\n return (req, res) => withRequest(req, reader, () => handler(req, res))\n}\n\nexport function wrapRequestHandlerNode(\n handler: NodeRequestHandler\n): NodeRequestHandler {\n return (req, res, parsedUrl) =>\n withRequest(req, reader, () => handler(req, res, parsedUrl))\n}\n"],"names":["interceptTestApis","wrapRequestHandlerNode","wrapRequestHandlerWorker","reader","url","req","header","name","h","headers","undefined","interceptedSymbol","Symbol","for","globalState","globalThis","originalFetch","global","fetch","restoreFetch","interceptFetch","restoreHttpGet","interceptHttpGet","handler","res","withRequest","parsedUrl"],"mappings":";;;;;;;;;;;;;;;;IAyBgBA,iBAAiB;eAAjBA;;IA6BAC,sBAAsB;eAAtBA;;IANAC,wBAAwB;eAAxBA;;;yBA9CoC;uBACrB;yBACE;AAGjC,MAAMC,SAA6C;IACjDC,KAAIC,GAAG;QACL,OAAOA,IAAID,GAAG,IAAI;IACpB;IACAE,QAAOD,GAAG,EAAEE,IAAI;QACd,MAAMC,IAAIH,IAAII,OAAO,CAACF,KAAK;QAC3B,IAAIC,MAAME,aAAaF,MAAM,MAAM;YACjC,OAAO;QACT;QACA,IAAI,OAAOA,MAAM,UAAU;YACzB,OAAOA;QACT;QACA,OAAOA,CAAC,CAAC,EAAE,IAAI;IACjB;AACF;AAEA,MAAMG,oBAAoBC,OAAOC,GAAG,CAAC;AAE9B,SAASb;IACd,0EAA0E;IAC1E,0EAA0E;IAC1E,kEAAkE;IAClE,gDAAgD;IAChD,MAAMc,cAAcC;IACpB,IAAID,WAAW,CAACH,kBAAkB,KAAK,MAAM;QAC3C,OAAO,KAAO;IAChB;IACAG,WAAW,CAACH,kBAAkB,GAAG;IAEjC,MAAMK,gBAAgBC,OAAOC,KAAK;IAClC,MAAMC,eAAeC,IAAAA,qBAAc,EAACJ;IACpC,MAAMK,iBAAiBC,IAAAA,yBAAgB,EAACN;IAExC,WAAW;IACX,OAAO;QACLF,WAAW,CAACH,kBAAkB,GAAG;QACjCQ;QACAE;IACF;AACF;AAEO,SAASnB,yBACdqB,OAA6B;IAE7B,OAAO,CAAClB,KAAKmB,MAAQC,IAAAA,oBAAW,EAACpB,KAAKF,QAAQ,IAAMoB,QAAQlB,KAAKmB;AACnE;AAEO,SAASvB,uBACdsB,OAA2B;IAE3B,OAAO,CAAClB,KAAKmB,KAAKE,YAChBD,IAAAA,oBAAW,EAACpB,KAAKF,QAAQ,IAAMoB,QAAQlB,KAAKmB,KAAKE;AACrD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/helpers/create-incremental-cache.d.ts b/e-commerce/node_modules/next/dist/export/helpers/create-incremental-cache.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..90542ec425c7841f8b3706ea7d46626b649d6302 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/helpers/create-incremental-cache.d.ts @@ -0,0 +1,11 @@ +import { IncrementalCache } from '../../server/lib/incremental-cache'; +export declare function createIncrementalCache({ cacheHandler, cacheMaxMemorySize, fetchCacheKeyPrefix, distDir, dir, flushToDisk, cacheHandlers, requestHeaders, }: { + cacheHandler?: string; + cacheMaxMemorySize: number; + fetchCacheKeyPrefix?: string; + distDir: string; + dir: string; + flushToDisk?: boolean; + requestHeaders?: Record<string, string | string[] | undefined>; + cacheHandlers?: Record<string, string | undefined>; +}): Promise<IncrementalCache>; diff --git a/e-commerce/node_modules/next/dist/export/helpers/create-incremental-cache.js b/e-commerce/node_modules/next/dist/export/helpers/create-incremental-cache.js new file mode 100644 index 0000000000000000000000000000000000000000..0c92e1caaf443b6449bd5706b74b5e3d0e712374 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/helpers/create-incremental-cache.js @@ -0,0 +1,66 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "createIncrementalCache", { + enumerable: true, + get: function() { + return createIncrementalCache; + } +}); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +const _incrementalcache = require("../../server/lib/incremental-cache"); +const _ciinfo = require("../../server/ci-info"); +const _nodefsmethods = require("../../server/lib/node-fs-methods"); +const _interopdefault = require("../../lib/interop-default"); +const _formatdynamicimportpath = require("../../lib/format-dynamic-import-path"); +const _handlers = require("../../server/use-cache/handlers"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +async function createIncrementalCache({ cacheHandler, cacheMaxMemorySize, fetchCacheKeyPrefix, distDir, dir, flushToDisk, cacheHandlers, requestHeaders }) { + // Custom cache handler overrides. + let CacheHandler; + if (cacheHandler) { + CacheHandler = (0, _interopdefault.interopDefault)(await import((0, _formatdynamicimportpath.formatDynamicImportPath)(dir, cacheHandler)).then((mod)=>mod.default || mod)); + } + if (cacheHandlers) { + (0, _handlers.initializeCacheHandlers)(cacheMaxMemorySize); + await (0, _handlers.registerCustomCacheHandlers)(async ()=>{ + for (const [kind, handler] of Object.entries(cacheHandlers)){ + if (!handler) continue; + (0, _handlers.setCacheHandler)(kind, (0, _interopdefault.interopDefault)(await import((0, _formatdynamicimportpath.formatDynamicImportPath)(dir, handler)).then((mod)=>mod.default || mod))); + } + }); + } + let previewProps = { + previewModeEncryptionKey: '', + previewModeId: '', + previewModeSigningKey: '' + }; + const incrementalCache = new _incrementalcache.IncrementalCache({ + dev: false, + requestHeaders: requestHeaders || {}, + flushToDisk, + maxMemoryCacheSize: cacheMaxMemorySize, + fetchCacheKeyPrefix, + previewProps, + prerenderManifest: { + version: 4, + routes: {}, + dynamicRoutes: {}, + notFoundRoutes: [], + preview: previewProps + }, + fs: _nodefsmethods.nodeFs, + serverDistDir: _path.default.join(distDir, 'server'), + CurCacheHandler: CacheHandler, + minimalMode: _ciinfo.hasNextSupport + }); + globalThis.__incrementalCache = incrementalCache; + return incrementalCache; +} + +//# sourceMappingURL=create-incremental-cache.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/helpers/create-incremental-cache.js.map b/e-commerce/node_modules/next/dist/export/helpers/create-incremental-cache.js.map new file mode 100644 index 0000000000000000000000000000000000000000..19ced6757759c4fdb764641dad741f839b3a5806 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/helpers/create-incremental-cache.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/export/helpers/create-incremental-cache.ts"],"sourcesContent":["import path from 'path'\nimport { IncrementalCache } from '../../server/lib/incremental-cache'\nimport { hasNextSupport } from '../../server/ci-info'\nimport { nodeFs } from '../../server/lib/node-fs-methods'\nimport { interopDefault } from '../../lib/interop-default'\nimport { formatDynamicImportPath } from '../../lib/format-dynamic-import-path'\nimport {\n initializeCacheHandlers,\n registerCustomCacheHandlers,\n setCacheHandler,\n} from '../../server/use-cache/handlers'\n\nexport async function createIncrementalCache({\n cacheHandler,\n cacheMaxMemorySize,\n fetchCacheKeyPrefix,\n distDir,\n dir,\n flushToDisk,\n cacheHandlers,\n requestHeaders,\n}: {\n cacheHandler?: string\n cacheMaxMemorySize: number\n fetchCacheKeyPrefix?: string\n distDir: string\n dir: string\n flushToDisk?: boolean\n requestHeaders?: Record<string, string | string[] | undefined>\n cacheHandlers?: Record<string, string | undefined>\n}) {\n // Custom cache handler overrides.\n let CacheHandler: any\n if (cacheHandler) {\n CacheHandler = interopDefault(\n await import(formatDynamicImportPath(dir, cacheHandler)).then(\n (mod) => mod.default || mod\n )\n )\n }\n\n if (cacheHandlers) {\n initializeCacheHandlers(cacheMaxMemorySize)\n await registerCustomCacheHandlers(async () => {\n for (const [kind, handler] of Object.entries(cacheHandlers)) {\n if (!handler) continue\n\n setCacheHandler(\n kind,\n interopDefault(\n await import(formatDynamicImportPath(dir, handler)).then(\n (mod) => mod.default || mod\n )\n )\n )\n }\n })\n }\n\n let previewProps = {\n previewModeEncryptionKey: '',\n previewModeId: '',\n previewModeSigningKey: '',\n }\n const incrementalCache = new IncrementalCache({\n dev: false,\n requestHeaders: requestHeaders || {},\n flushToDisk,\n maxMemoryCacheSize: cacheMaxMemorySize,\n fetchCacheKeyPrefix,\n previewProps,\n prerenderManifest: {\n version: 4,\n routes: {},\n dynamicRoutes: {},\n notFoundRoutes: [],\n preview: previewProps,\n },\n fs: nodeFs,\n serverDistDir: path.join(distDir, 'server'),\n CurCacheHandler: CacheHandler,\n minimalMode: hasNextSupport,\n })\n\n ;(globalThis as any).__incrementalCache = incrementalCache\n\n return incrementalCache\n}\n"],"names":["createIncrementalCache","cacheHandler","cacheMaxMemorySize","fetchCacheKeyPrefix","distDir","dir","flushToDisk","cacheHandlers","requestHeaders","CacheHandler","interopDefault","formatDynamicImportPath","then","mod","default","initializeCacheHandlers","registerCustomCacheHandlers","kind","handler","Object","entries","setCacheHandler","previewProps","previewModeEncryptionKey","previewModeId","previewModeSigningKey","incrementalCache","IncrementalCache","dev","maxMemoryCacheSize","prerenderManifest","version","routes","dynamicRoutes","notFoundRoutes","preview","fs","nodeFs","serverDistDir","path","join","CurCacheHandler","minimalMode","hasNextSupport","globalThis","__incrementalCache"],"mappings":";;;;+BAYsBA;;;eAAAA;;;6DAZL;kCACgB;wBACF;+BACR;gCACQ;yCACS;0BAKjC;;;;;;AAEA,eAAeA,uBAAuB,EAC3CC,YAAY,EACZC,kBAAkB,EAClBC,mBAAmB,EACnBC,OAAO,EACPC,GAAG,EACHC,WAAW,EACXC,aAAa,EACbC,cAAc,EAUf;IACC,kCAAkC;IAClC,IAAIC;IACJ,IAAIR,cAAc;QAChBQ,eAAeC,IAAAA,8BAAc,EAC3B,MAAM,MAAM,CAACC,IAAAA,gDAAuB,EAACN,KAAKJ,eAAeW,IAAI,CAC3D,CAACC,MAAQA,IAAIC,OAAO,IAAID;IAG9B;IAEA,IAAIN,eAAe;QACjBQ,IAAAA,iCAAuB,EAACb;QACxB,MAAMc,IAAAA,qCAA2B,EAAC;YAChC,KAAK,MAAM,CAACC,MAAMC,QAAQ,IAAIC,OAAOC,OAAO,CAACb,eAAgB;gBAC3D,IAAI,CAACW,SAAS;gBAEdG,IAAAA,yBAAe,EACbJ,MACAP,IAAAA,8BAAc,EACZ,MAAM,MAAM,CAACC,IAAAA,gDAAuB,EAACN,KAAKa,UAAUN,IAAI,CACtD,CAACC,MAAQA,IAAIC,OAAO,IAAID;YAIhC;QACF;IACF;IAEA,IAAIS,eAAe;QACjBC,0BAA0B;QAC1BC,eAAe;QACfC,uBAAuB;IACzB;IACA,MAAMC,mBAAmB,IAAIC,kCAAgB,CAAC;QAC5CC,KAAK;QACLpB,gBAAgBA,kBAAkB,CAAC;QACnCF;QACAuB,oBAAoB3B;QACpBC;QACAmB;QACAQ,mBAAmB;YACjBC,SAAS;YACTC,QAAQ,CAAC;YACTC,eAAe,CAAC;YAChBC,gBAAgB,EAAE;YAClBC,SAASb;QACX;QACAc,IAAIC,qBAAM;QACVC,eAAeC,aAAI,CAACC,IAAI,CAACpC,SAAS;QAClCqC,iBAAiBhC;QACjBiC,aAAaC,sBAAc;IAC7B;IAEEC,WAAmBC,kBAAkB,GAAGnB;IAE1C,OAAOA;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/helpers/get-params.d.ts b/e-commerce/node_modules/next/dist/export/helpers/get-params.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9e623bfe3aab39ea08c370729a9694d7cb638060 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/helpers/get-params.d.ts @@ -0,0 +1,7 @@ +/** + * Gets the params for the provided page. + * @param page the page that contains dynamic path parameters + * @param pathname the pathname to match + * @returns the matches that were found, throws otherwise + */ +export declare function getParams(page: string, pathname: string): import("../../server/request/params").Params; diff --git a/e-commerce/node_modules/next/dist/export/helpers/get-params.js b/e-commerce/node_modules/next/dist/export/helpers/get-params.js new file mode 100644 index 0000000000000000000000000000000000000000..02e2e23e0e99af8841758a708ac7fb75938c62e3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/helpers/get-params.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "getParams", { + enumerable: true, + get: function() { + return getParams; + } +}); +const _routematcher = require("../../shared/lib/router/utils/route-matcher"); +const _routeregex = require("../../shared/lib/router/utils/route-regex"); +// The last page and matcher that this function handled. +let last = null; +function getParams(page, pathname) { + // Because this is often called on the output of `getStaticPaths` or similar + // where the `page` here doesn't change, this will "remember" the last page + // it created the RegExp for. If it matches, it'll just re-use it. + let matcher; + if ((last == null ? void 0 : last.page) === page) { + matcher = last.matcher; + } else { + matcher = (0, _routematcher.getRouteMatcher)((0, _routeregex.getRouteRegex)(page)); + } + const params = matcher(pathname); + if (!params) { + throw new Error(`The provided export path '${pathname}' doesn't match the '${page}' page.\nRead more: https://nextjs.org/docs/messages/export-path-mismatch`); + } + return params; +} + +//# sourceMappingURL=get-params.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/helpers/get-params.js.map b/e-commerce/node_modules/next/dist/export/helpers/get-params.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f3ff6d329306b12e5b43551192e132b196b61533 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/helpers/get-params.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/export/helpers/get-params.ts"],"sourcesContent":["import {\n type RouteMatchFn,\n getRouteMatcher,\n} from '../../shared/lib/router/utils/route-matcher'\nimport { getRouteRegex } from '../../shared/lib/router/utils/route-regex'\n\n// The last page and matcher that this function handled.\nlet last: {\n page: string\n matcher: RouteMatchFn\n} | null = null\n\n/**\n * Gets the params for the provided page.\n * @param page the page that contains dynamic path parameters\n * @param pathname the pathname to match\n * @returns the matches that were found, throws otherwise\n */\nexport function getParams(page: string, pathname: string) {\n // Because this is often called on the output of `getStaticPaths` or similar\n // where the `page` here doesn't change, this will \"remember\" the last page\n // it created the RegExp for. If it matches, it'll just re-use it.\n let matcher: RouteMatchFn\n if (last?.page === page) {\n matcher = last.matcher\n } else {\n matcher = getRouteMatcher(getRouteRegex(page))\n }\n\n const params = matcher(pathname)\n if (!params) {\n throw new Error(\n `The provided export path '${pathname}' doesn't match the '${page}' page.\\nRead more: https://nextjs.org/docs/messages/export-path-mismatch`\n )\n }\n\n return params\n}\n"],"names":["getParams","last","page","pathname","matcher","getRouteMatcher","getRouteRegex","params","Error"],"mappings":";;;;+BAkBgBA;;;eAAAA;;;8BAfT;4BACuB;AAE9B,wDAAwD;AACxD,IAAIC,OAGO;AAQJ,SAASD,UAAUE,IAAY,EAAEC,QAAgB;IACtD,4EAA4E;IAC5E,2EAA2E;IAC3E,kEAAkE;IAClE,IAAIC;IACJ,IAAIH,CAAAA,wBAAAA,KAAMC,IAAI,MAAKA,MAAM;QACvBE,UAAUH,KAAKG,OAAO;IACxB,OAAO;QACLA,UAAUC,IAAAA,6BAAe,EAACC,IAAAA,yBAAa,EAACJ;IAC1C;IAEA,MAAMK,SAASH,QAAQD;IACvB,IAAI,CAACI,QAAQ;QACX,MAAM,IAAIC,MACR,CAAC,0BAA0B,EAAEL,SAAS,qBAAqB,EAAED,KAAK,yEAAyE,CAAC;IAEhJ;IAEA,OAAOK;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/helpers/is-dynamic-usage-error.d.ts b/e-commerce/node_modules/next/dist/export/helpers/is-dynamic-usage-error.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cd95a6aa48210ada7e61a520d1704615c449870f --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/helpers/is-dynamic-usage-error.d.ts @@ -0,0 +1 @@ +export declare const isDynamicUsageError: (err: unknown) => err is import("../../client/components/hooks-server-context").DynamicServerError | import("../../client/components/http-access-fallback/http-access-fallback").HTTPAccessFallbackError | import("../../client/components/redirect-error").RedirectError | import("../../shared/lib/lazy-dynamic/bailout-to-csr").BailoutToCSRError; diff --git a/e-commerce/node_modules/next/dist/export/helpers/is-dynamic-usage-error.js b/e-commerce/node_modules/next/dist/export/helpers/is-dynamic-usage-error.js new file mode 100644 index 0000000000000000000000000000000000000000..07ca6d715c4ed7b301c538bdeb880bf3bc609965 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/helpers/is-dynamic-usage-error.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "isDynamicUsageError", { + enumerable: true, + get: function() { + return isDynamicUsageError; + } +}); +const _hooksservercontext = require("../../client/components/hooks-server-context"); +const _bailouttocsr = require("../../shared/lib/lazy-dynamic/bailout-to-csr"); +const _isnextroutererror = require("../../client/components/is-next-router-error"); +const isDynamicUsageError = (err)=>(0, _hooksservercontext.isDynamicServerError)(err) || (0, _bailouttocsr.isBailoutToCSRError)(err) || (0, _isnextroutererror.isNextRouterError)(err); + +//# sourceMappingURL=is-dynamic-usage-error.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/helpers/is-dynamic-usage-error.js.map b/e-commerce/node_modules/next/dist/export/helpers/is-dynamic-usage-error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..94699238348faf1fe0a0e9dca44168916ba652a6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/helpers/is-dynamic-usage-error.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/export/helpers/is-dynamic-usage-error.ts"],"sourcesContent":["import { isDynamicServerError } from '../../client/components/hooks-server-context'\nimport { isBailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr'\nimport { isNextRouterError } from '../../client/components/is-next-router-error'\n\nexport const isDynamicUsageError = (err: unknown) =>\n isDynamicServerError(err) ||\n isBailoutToCSRError(err) ||\n isNextRouterError(err)\n"],"names":["isDynamicUsageError","err","isDynamicServerError","isBailoutToCSRError","isNextRouterError"],"mappings":";;;;+BAIaA;;;eAAAA;;;oCAJwB;8BACD;mCACF;AAE3B,MAAMA,sBAAsB,CAACC,MAClCC,IAAAA,wCAAoB,EAACD,QACrBE,IAAAA,iCAAmB,EAACF,QACpBG,IAAAA,oCAAiB,EAACH","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/index.d.ts b/e-commerce/node_modules/next/dist/export/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6f423d2a92691b945744c257729a2c32cff1c3c7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/index.d.ts @@ -0,0 +1,8 @@ +import type { ExportAppResult, ExportAppOptions } from './types'; +import { type StaticWorker } from '../build'; +import '../server/require-hook'; +import type { Span } from '../trace'; +export declare class ExportError extends Error { + code: string; +} +export default function exportApp(dir: string, options: ExportAppOptions, span: Span, staticWorker?: StaticWorker): Promise<ExportAppResult | null>; diff --git a/e-commerce/node_modules/next/dist/export/index.js b/e-commerce/node_modules/next/dist/export/index.js new file mode 100644 index 0000000000000000000000000000000000000000..5fb63998343cd749f26c5722589675bd34b1c917 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/index.js @@ -0,0 +1,817 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + ExportError: null, + default: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + ExportError: function() { + return ExportError; + }, + default: function() { + return exportApp; + } +}); +const _build = require("../build"); +const _picocolors = require("../lib/picocolors"); +const _findup = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/find-up")); +const _fs = require("fs"); +require("../server/require-hook"); +const _path = require("path"); +const _log = /*#__PURE__*/ _interop_require_wildcard(require("../build/output/log")); +const _constants = require("../lib/constants"); +const _recursivecopy = require("../lib/recursive-copy"); +const _constants1 = require("../shared/lib/constants"); +const _config = /*#__PURE__*/ _interop_require_default(require("../server/config")); +const _configshared = require("../server/config-shared"); +const _events = require("../telemetry/events"); +const _ciinfo = require("../server/ci-info"); +const _storage = require("../telemetry/storage"); +const _normalizepagepath = require("../shared/lib/page-path/normalize-page-path"); +const _denormalizepagepath = require("../shared/lib/page-path/denormalize-page-path"); +const _env = require("@next/env"); +const _isapiroute = require("../lib/is-api-route"); +const _require = require("../server/require"); +const _isapprouteroute = require("../lib/is-app-route-route"); +const _isapppageroute = require("../lib/is-app-page-route"); +const _iserror = /*#__PURE__*/ _interop_require_default(require("../lib/is-error")); +const _formatmanifest = require("../build/manifests/formatter/format-manifest"); +const _turborepoaccesstrace = require("../build/turborepo-access-trace"); +const _progress = require("../build/progress"); +const _isinterceptionrouterewrite = require("../lib/is-interception-route-rewrite"); +const _serverreferenceinfo = require("../shared/lib/server-reference-info"); +const _segmentvalueencoding = require("../shared/lib/segment-cache/segment-value-encoding"); +const _worker = require("../lib/worker"); +const _getparams = require("./helpers/get-params"); +const _isdynamic = require("../shared/lib/router/utils/is-dynamic"); +const _apppaths = require("../shared/lib/router/utils/app-paths"); +const _bundler = require("../lib/bundler"); +const _utils = require("./utils"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +class ExportError extends Error { + constructor(...args){ + super(...args), this.code = 'NEXT_EXPORT_ERROR'; + } +} +/** + * Picks an RDC seed by matching on the params that are + * already known, so fallback shells use a seed that has already + * computed those known params. + */ function buildRDCCacheByPage(results, finalPhaseExportPaths) { + const renderResumeDataCachesByPage = {}; + const seedCandidatesByPage = new Map(); + for (const { page, path, result } of results){ + if (!result) { + continue; + } + if ('renderResumeDataCache' in result && result.renderResumeDataCache) { + // Collect all RDC seeds for this page so we can pick the best match + // for each fallback shell later (e.g. locale-specific variants). + const candidates = seedCandidatesByPage.get(page) ?? []; + candidates.push({ + path, + renderResumeDataCache: result.renderResumeDataCache + }); + seedCandidatesByPage.set(page, candidates); + // Remove the RDC string from the result so that it can be garbage + // collected, when there are more results for the same page. + result.renderResumeDataCache = undefined; + } + } + const getKnownParamsKey = (normalizedPage, path, fallbackParamNames)=>{ + let params; + try { + params = (0, _getparams.getParams)(normalizedPage, path); + } catch { + return null; + } + // Only keep params that are known, then sort + // for a stable key so we can match a compatible seed. + const entries = Object.entries(params).filter(([key])=>!fallbackParamNames.has(key)); + entries.sort(([a], [b])=>a < b ? -1 : a > b ? 1 : 0); + return JSON.stringify(entries); + }; + for (const exportPath of finalPhaseExportPaths){ + const { page, path, _fallbackRouteParams = [] } = exportPath; + if (!(0, _isdynamic.isDynamicRoute)(page)) { + continue; + } + // Normalize app pages before param matching. + const normalizedPage = (0, _apppaths.normalizeAppPath)(page); + const pageKey = page !== path ? `${page}: ${path}` : path; + const fallbackParamNames = new Set(_fallbackRouteParams.map((param)=>param.paramName)); + // Build a key from the known params for this fallback shell so we can + // select a seed from a compatible prerendered route. + const targetKey = getKnownParamsKey(normalizedPage, path, fallbackParamNames); + if (!targetKey) { + continue; + } + const candidates = seedCandidatesByPage.get(page); + // No suitable candidates, so there's no RDC seed to select + if (!candidates || candidates.length === 0) { + continue; + } + let selected = null; + for (const candidate of candidates){ + // Pick the seed whose known params match this fallback shell. + const candidateKey = getKnownParamsKey(normalizedPage, candidate.path, fallbackParamNames); + if (candidateKey === targetKey) { + selected = candidate.renderResumeDataCache; + break; + } + } + if (selected) { + renderResumeDataCachesByPage[pageKey] = selected; + } + } + return renderResumeDataCachesByPage; +} +async function exportAppImpl(dir, options, span, staticWorker) { + dir = (0, _path.resolve)(dir); + // attempt to load global env values so they are available in next.config.js + span.traceChild('load-dotenv').traceFn(()=>(0, _env.loadEnvConfig)(dir, false, _log)); + const { enabledDirectories } = options; + const nextConfig = options.nextConfig || await span.traceChild('load-next-config').traceAsyncFn(()=>(0, _config.default)(_constants1.PHASE_EXPORT, dir, { + debugPrerender: options.debugPrerender + })); + const distDir = (0, _path.join)(dir, (0, _utils.getBuildDistDir)(nextConfig)); + const telemetry = options.buildExport ? null : new _storage.Telemetry({ + distDir + }); + if (telemetry) { + telemetry.record((0, _events.eventCliSession)(nextConfig, { + webpackVersion: null, + cliCommand: 'export', + isSrcDir: null, + hasNowJson: !!await (0, _findup.default)('now.json', { + cwd: dir + }), + isCustomServer: null, + turboFlag: options.bundler === _bundler.Bundler.Turbopack, + pagesDir: null, + appDir: null + })); + } + const subFolders = nextConfig.trailingSlash && !options.buildExport; + if (!options.silent && !options.buildExport) { + _log.info(`using build directory: ${distDir}`); + } + const buildIdFile = (0, _path.join)(distDir, _constants1.BUILD_ID_FILE); + if (!(0, _fs.existsSync)(buildIdFile)) { + throw new ExportError(`Could not find a production build in the '${distDir}' directory. Try building your app with 'next build' before starting the static export. https://nextjs.org/docs/messages/next-export-no-build-id`); + } + const customRoutes = [ + 'rewrites', + 'redirects', + 'headers' + ].filter((config)=>typeof nextConfig[config] === 'function'); + if (!_ciinfo.hasNextSupport && !options.buildExport && customRoutes.length > 0) { + _log.warn(`rewrites, redirects, and headers are not applied when exporting your application, detected (${customRoutes.join(', ')}). See more info here: https://nextjs.org/docs/messages/export-no-custom-routes`); + } + const buildId = await _fs.promises.readFile(buildIdFile, 'utf8'); + const pagesManifest = !options.pages && require((0, _path.join)(distDir, _constants1.SERVER_DIRECTORY, _constants1.PAGES_MANIFEST)); + let previewProps; + try { + previewProps = require((0, _path.join)(distDir, 'server', _constants1.PREVIEW_PROPS_MANIFEST)); + } catch {} + let prerenderManifest; + try { + prerenderManifest = require((0, _path.join)(distDir, _constants1.PRERENDER_MANIFEST)); + } catch {} + let appRoutePathManifest; + try { + appRoutePathManifest = require((0, _path.join)(distDir, _constants1.APP_PATH_ROUTES_MANIFEST)); + } catch (err) { + if ((0, _iserror.default)(err) && (err.code === 'ENOENT' || err.code === 'MODULE_NOT_FOUND')) { + // the manifest doesn't exist which will happen when using + // "pages" dir instead of "app" dir. + appRoutePathManifest = undefined; + } else { + // the manifest is malformed (invalid json) + throw err; + } + } + const excludedPrerenderRoutes = new Set(); + const pages = options.pages || Object.keys(pagesManifest); + const defaultPathMap = {}; + let hasApiRoutes = false; + for (const page of pages){ + // _document and _app are not real pages + // _error is exported as 404.html later on + // API Routes are Node.js functions + if ((0, _isapiroute.isAPIRoute)(page)) { + hasApiRoutes = true; + continue; + } + if (page === '/_document' || page === '/_app' || page === '/_error') { + continue; + } + // iSSG pages that are dynamic should not export templated version by + // default. In most cases, this would never work. There is no server that + // could run `getStaticProps`. If users make their page work lazily, they + // can manually add it to the `exportPathMap`. + if (prerenderManifest == null ? void 0 : prerenderManifest.dynamicRoutes[page]) { + excludedPrerenderRoutes.add(page); + continue; + } + defaultPathMap[page] = { + page + }; + } + const mapAppRouteToPage = new Map(); + if (!options.buildExport && appRoutePathManifest) { + for (const [pageName, routePath] of Object.entries(appRoutePathManifest)){ + mapAppRouteToPage.set(routePath, pageName); + if ((0, _isapppageroute.isAppPageRoute)(pageName) && !(prerenderManifest == null ? void 0 : prerenderManifest.routes[routePath]) && !(prerenderManifest == null ? void 0 : prerenderManifest.dynamicRoutes[routePath])) { + defaultPathMap[routePath] = { + page: pageName, + _isAppDir: true + }; + } + } + } + // Initialize the output directory + const outDir = options.outdir; + if (outDir === (0, _path.join)(dir, 'public')) { + throw new ExportError(`The 'public' directory is reserved in Next.js and can not be used as the export out directory. https://nextjs.org/docs/messages/can-not-output-to-public`); + } + if (outDir === (0, _path.join)(dir, 'static')) { + throw new ExportError(`The 'static' directory is reserved in Next.js and can not be used as the export out directory. https://nextjs.org/docs/messages/can-not-output-to-static`); + } + if (!options.buildExport) { + await _fs.promises.rm(outDir, { + recursive: true, + force: true + }); + await _fs.promises.mkdir((0, _path.join)(outDir, '_next', buildId), { + recursive: true + }); + } + await _fs.promises.writeFile((0, _path.join)(distDir, _constants1.EXPORT_DETAIL), (0, _formatmanifest.formatManifest)({ + version: 1, + outDirectory: outDir, + success: false + }), 'utf8'); + // Copy static directory + if (!options.buildExport && (0, _fs.existsSync)((0, _path.join)(dir, 'static'))) { + if (!options.silent) { + _log.info('Copying "static" directory'); + } + await span.traceChild('copy-static-directory').traceAsyncFn(()=>(0, _recursivecopy.recursiveCopy)((0, _path.join)(dir, 'static'), (0, _path.join)(outDir, 'static'))); + } + // Copy .next/static directory + if (!options.buildExport && (0, _fs.existsSync)((0, _path.join)(distDir, _constants1.CLIENT_STATIC_FILES_PATH))) { + if (!options.silent) { + _log.info('Copying "static build" directory'); + } + await span.traceChild('copy-next-static-directory').traceAsyncFn(()=>(0, _recursivecopy.recursiveCopy)((0, _path.join)(distDir, _constants1.CLIENT_STATIC_FILES_PATH), (0, _path.join)(outDir, '_next', _constants1.CLIENT_STATIC_FILES_PATH))); + } + const { i18n, images: { loader = 'default', unoptimized } } = nextConfig; + if (i18n && !options.buildExport) { + throw new ExportError(`i18n support is not compatible with next export. See here for more info on deploying: https://nextjs.org/docs/messages/export-no-custom-routes`); + } + if (!options.buildExport) { + const { isNextImageImported } = await span.traceChild('is-next-image-imported').traceAsyncFn(()=>_fs.promises.readFile((0, _path.join)(distDir, _constants1.EXPORT_MARKER), 'utf8').then((text)=>JSON.parse(text)).catch(()=>({}))); + if (isNextImageImported && loader === 'default' && !unoptimized && !_ciinfo.hasNextSupport) { + throw new ExportError(`Image Optimization using the default loader is not compatible with export. + Possible solutions: + - Use \`next start\` to run a server, which includes the Image Optimization API. + - Configure \`images.unoptimized = true\` in \`next.config.js\` to disable the Image Optimization API. + Read more: https://nextjs.org/docs/messages/export-image-api`); + } + } + let serverActionsManifest; + if (enabledDirectories.app) { + serverActionsManifest = require((0, _path.join)(distDir, _constants1.SERVER_DIRECTORY, _constants1.SERVER_REFERENCE_MANIFEST + '.json')); + if (nextConfig.output === 'export') { + var _routesManifest_rewrites_beforeFiles, _routesManifest_rewrites; + const routesManifest = require((0, _path.join)(distDir, _constants1.ROUTES_MANIFEST)); + // We already prevent rewrites earlier in the process, however Next.js will insert rewrites + // for interception routes so we need to check for that here. + if ((routesManifest == null ? void 0 : (_routesManifest_rewrites = routesManifest.rewrites) == null ? void 0 : (_routesManifest_rewrites_beforeFiles = _routesManifest_rewrites.beforeFiles) == null ? void 0 : _routesManifest_rewrites_beforeFiles.length) > 0) { + const hasInterceptionRouteRewrite = routesManifest.rewrites.beforeFiles.some(_isinterceptionrouterewrite.isInterceptionRouteRewrite); + if (hasInterceptionRouteRewrite) { + throw new ExportError(`Intercepting routes are not supported with static export.\nRead more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports#unsupported-features`); + } + } + const actionIds = [ + ...Object.keys(serverActionsManifest.node), + ...Object.keys(serverActionsManifest.edge) + ]; + if (actionIds.some((actionId)=>(0, _serverreferenceinfo.extractInfoFromServerReferenceId)(actionId).type === 'server-action')) { + throw new ExportError(`Server Actions are not supported with static export.\nRead more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports#unsupported-features`); + } + } + } + // Start the rendering process + const renderOpts = { + previewProps, + isBuildTimePrerendering: true, + assetPrefix: nextConfig.assetPrefix.replace(/\/$/, ''), + distDir, + basePath: nextConfig.basePath, + cacheComponents: nextConfig.cacheComponents ?? false, + partialPrefetching: nextConfig.partialPrefetching, + validationLevel: nextConfig.experimental.instantInsights.validationLevel, + trailingSlash: nextConfig.trailingSlash, + locales: i18n == null ? void 0 : i18n.locales, + locale: i18n == null ? void 0 : i18n.defaultLocale, + defaultLocale: i18n == null ? void 0 : i18n.defaultLocale, + domainLocales: i18n == null ? void 0 : i18n.domains, + disableOptimizedLoading: nextConfig.experimental.disableOptimizedLoading, + // Exported pages do not currently support dynamic HTML. + supportsDynamicResponse: false, + crossOrigin: nextConfig.crossOrigin, + optimizeCss: nextConfig.experimental.optimizeCss, + nextConfigOutput: nextConfig.output, + nextScriptWorkers: nextConfig.experimental.nextScriptWorkers, + largePageDataBytes: nextConfig.experimental.largePageDataBytes, + serverActions: nextConfig.experimental.serverActions, + serverComponents: enabledDirectories.app, + cacheLifeProfiles: nextConfig.cacheLife, + staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout, + nextFontManifest: require((0, _path.join)(distDir, 'server', `${_constants1.NEXT_FONT_MANIFEST}.json`)), + images: nextConfig.images, + experimental: { + clientTraceMetadata: nextConfig.experimental.clientTraceMetadata, + expireTime: nextConfig.expireTime, + staleTimes: nextConfig.experimental.staleTimes, + clientParamParsingOrigins: nextConfig.experimental.clientParamParsingOrigins, + dynamicOnHover: nextConfig.experimental.dynamicOnHover ?? false, + optimisticRouting: nextConfig.experimental.optimisticRouting ?? false, + parallelRouteMetadata: nextConfig.experimental.parallelRouteMetadata ?? false, + inlineCss: nextConfig.experimental.inlineCss ?? false, + prefetchInlining: nextConfig.experimental.prefetchInlining ?? false, + authInterrupts: !!nextConfig.experimental.authInterrupts, + reactBrowserBailout: nextConfig.experimental.reactBrowserBailout ?? false, + useCacheTimeout: nextConfig.experimental.useCacheTimeout, + durableUseCacheEntries: Boolean(nextConfig.experimental.durableUseCacheEntries), + cachedNavigations: nextConfig.experimental.cachedNavigations ?? false, + maxPostponedStateSizeBytes: (0, _configshared.parseMaxPostponedStateSize)(nextConfig.experimental.maxPostponedStateSize), + disableResumeDataCacheCompression: nextConfig.experimental.disableResumeDataCacheCompression ?? false, + exposeTestingApi: nextConfig.experimental.exposeTestingApiInProductionBuild === true + }, + reactMaxHeadersLength: nextConfig.reactMaxHeadersLength + }; + globalThis.__NEXT_DATA__ = { + nextExport: true + }; + const exportPathMap = await span.traceChild('run-export-path-map').traceAsyncFn(async ()=>{ + if (typeof nextConfig.exportPathMap !== 'function') { + return defaultPathMap; + } + const exportMap = await nextConfig.exportPathMap(defaultPathMap, { + dev: false, + dir, + outDir, + distDir, + buildId + }); + return exportMap; + }); + // During static export, remove export 404/500 of pages router + // when only app router presents + if (!options.buildExport && options.appDirOnly) { + delete exportPathMap['/404']; + delete exportPathMap['/500']; + } + // only add missing 404 page when `buildExport` is false + if (!options.buildExport && !options.appDirOnly) { + // only add missing /404 if not specified in `exportPathMap` + if (!exportPathMap['/404']) { + exportPathMap['/404'] = { + page: '/_error' + }; + } + /** + * exports 404.html for backwards compat + * E.g. GitHub Pages, GitLab Pages, Cloudflare Pages, Netlify + */ if (!exportPathMap['/404.html'] && exportPathMap['/404']) { + // alias /404.html to /404 to be compatible with custom 404 / _error page + exportPathMap['/404.html'] = exportPathMap['/404']; + } + } + const allExportPaths = []; + const seenExportPaths = new Set(); + const fallbackEnabledPages = new Set(); + for (const [path, entry] of Object.entries(exportPathMap)){ + // make sure to prevent duplicates + const normalizedPath = (0, _denormalizepagepath.denormalizePagePath)((0, _normalizepagepath.normalizePagePath)(path)); + if (seenExportPaths.has(normalizedPath)) { + continue; + } + seenExportPaths.add(normalizedPath); + if (!entry._isAppDir && (0, _isapiroute.isAPIRoute)(entry.page)) { + hasApiRoutes = true; + continue; + } + allExportPaths.push({ + ...entry, + path: normalizedPath + }); + if (prerenderManifest && !options.buildExport) { + const prerenderInfo = prerenderManifest.dynamicRoutes[entry.page]; + if (prerenderInfo && prerenderInfo.fallback !== false) { + fallbackEnabledPages.add(entry.page); + } + } + } + if (allExportPaths.length === 0) { + if (!prerenderManifest) { + return null; + } + } + if (fallbackEnabledPages.size > 0) { + throw new ExportError(`Found pages with \`fallback\` enabled:\n${[ + ...fallbackEnabledPages + ].join('\n')}\n${_constants.SSG_FALLBACK_EXPORT_ERROR}\n`); + } + let hasMiddleware = false; + if (!options.buildExport) { + try { + var _functionsConfigManifest_functions; + const middlewareManifest = require((0, _path.join)(distDir, _constants1.SERVER_DIRECTORY, _constants1.MIDDLEWARE_MANIFEST)); + const functionsConfigManifest = require((0, _path.join)(distDir, _constants1.SERVER_DIRECTORY, _constants1.FUNCTIONS_CONFIG_MANIFEST)); + hasMiddleware = Object.keys(middlewareManifest.middleware).length > 0 || Boolean((_functionsConfigManifest_functions = functionsConfigManifest.functions) == null ? void 0 : _functionsConfigManifest_functions['/_middleware']); + } catch {} + // Warn if the user defines a path for an API page + if (hasApiRoutes || hasMiddleware) { + if (nextConfig.output === 'export') { + _log.warn((0, _picocolors.yellow)(`Statically exporting a Next.js application via \`next export\` disables API routes and middleware.`) + `\n` + (0, _picocolors.yellow)(`This command is meant for static-only hosts, and is` + ' ' + (0, _picocolors.bold)(`not necessary to make your application static.`)) + `\n` + (0, _picocolors.yellow)(`Pages in your application without server-side data dependencies will be automatically statically exported by \`next build\`, including pages powered by \`getStaticProps\`.`) + `\n` + (0, _picocolors.yellow)(`Learn more: https://nextjs.org/docs/messages/api-routes-static-export`)); + } + } + } + const pagesDataDir = options.buildExport ? (0, _path.join)(distDir, 'server', 'pages') : (0, _path.join)(outDir, '_next/data', buildId); + const publicDir = (0, _path.join)(dir, _constants1.CLIENT_PUBLIC_FILES_PATH); + // Copy public directory + if (!options.buildExport && (0, _fs.existsSync)(publicDir)) { + if (!options.silent) { + _log.info('Copying "public" directory'); + } + await span.traceChild('copy-public-directory').traceAsyncFn(()=>(0, _recursivecopy.recursiveCopy)(publicDir, outDir, { + filter (path) { + // Exclude paths used by pages + return !exportPathMap[path]; + } + })); + } + const exportPagesInBatches = async (worker, exportPaths, renderResumeDataCachesByPage)=>{ + // Batch filtered pages into smaller batches, and call the export worker on + // each batch. We've set a default minimum of 25 pages per batch to ensure + // that even setups with only a few static pages can leverage a shared + // incremental cache, however this value can be configured. + const minPageCountPerBatch = nextConfig.experimental.staticGenerationMinPagesPerWorker ?? 25; + // Calculate the number of workers needed to ensure each batch has at least + // minPageCountPerBatch pages. + const numWorkers = Math.min(options.numWorkers, Math.ceil(exportPaths.length / minPageCountPerBatch)); + // Calculate the page count per batch based on the number of workers. + const pageCountPerBatch = Math.ceil(exportPaths.length / numWorkers); + const batches = Array.from({ + length: numWorkers + }, (_, i)=>exportPaths.slice(i * pageCountPerBatch, (i + 1) * pageCountPerBatch)); + // Distribute remaining pages. + const remainingPages = exportPaths.slice(numWorkers * pageCountPerBatch); + remainingPages.forEach((page, index)=>{ + batches[index % batches.length].push(page); + }); + return (await Promise.all(batches.map(async (batch)=>worker.exportPages({ + buildId, + deploymentId: nextConfig.deploymentId, + clientAssetToken: nextConfig.supportsImmutableAssets ? '' : nextConfig.deploymentId, + exportPaths: batch, + parentSpanId: span.getId(), + pagesDataDir, + renderOpts, + options, + dir, + distDir, + outDir: options.buildExport ? (0, _path.join)(distDir, 'server', 'pages') : outDir, + nextConfig, + cacheHandler: nextConfig.cacheHandler, + cacheMaxMemorySize: nextConfig.cacheMaxMemorySize, + fetchCache: true, + fetchCacheKeyPrefix: nextConfig.experimental.fetchCacheKeyPrefix, + renderResumeDataCachesByPage + })))).flat(); + }; + let initialPhaseExportPaths = []; + const finalPhaseExportPaths = []; + if (renderOpts.cacheComponents) { + // Only run instant validation once per route, even if multiple param sets from generateStaticParams exist. + const routesWithInstantValidation = new Set(); + for (const exportPath of allExportPaths){ + if (exportPath._allowEmptyStaticShell) { + finalPhaseExportPaths.push(exportPath); + } else { + initialPhaseExportPaths.push(exportPath); + } + // Always mark routes for potential build validation. The actual + // decision of whether to validate is made per-route by + // anySegmentNeedsInstantValidationInBuild, which checks both the + // default validation level and per-segment level overrides. + const route = exportPath.page; + if (!routesWithInstantValidation.has(route)) { + exportPath._runInstantValidation = true; + routesWithInstantValidation.add(route); + } + } + } else { + initialPhaseExportPaths = allExportPaths; + } + const totalExportPaths = initialPhaseExportPaths.length + finalPhaseExportPaths.length; + let worker = null; + let results = []; + if (totalExportPaths > 0) { + const progress = (0, _progress.createProgress)(totalExportPaths, options.statusMessage ?? `Exporting using ${options.numWorkers} worker${options.numWorkers > 1 ? 's' : ''}`); + if (staticWorker) { + // TODO: progress shouldn't rely on "activity" event sent from `exportPage`. + staticWorker.setOnActivity(progress.run); + staticWorker.setOnActivityAbort(progress.clear); + worker = staticWorker; + } else { + worker = (0, _build.createStaticWorker)(nextConfig, { + debuggerPortOffset: (0, _worker.getNextBuildDebuggerPortOffset)({ + kind: 'export-page' + }), + numberOfWorkers: options.numWorkers, + progress + }); + } + results = await exportPagesInBatches(worker, initialPhaseExportPaths); + if (finalPhaseExportPaths.length > 0) { + const renderResumeDataCachesByPage = buildRDCCacheByPage(results, finalPhaseExportPaths); + const finalPhaseResults = await exportPagesInBatches(worker, finalPhaseExportPaths, renderResumeDataCachesByPage); + results.push(...finalPhaseResults); + } + } + const collector = { + byPath: new Map(), + byPage: new Map(), + ssgNotFoundPaths: new Set(), + turborepoAccessTraceResults: new Map() + }; + const failedExportAttemptsByPage = new Map(); + for (const { result, path, page, pageKey } of results){ + if (!result) continue; + if ('error' in result) { + failedExportAttemptsByPage.set(pageKey, true); + continue; + } + if (result.turborepoAccessTraceResult) { + var _collector_turborepoAccessTraceResults; + (_collector_turborepoAccessTraceResults = collector.turborepoAccessTraceResults) == null ? void 0 : _collector_turborepoAccessTraceResults.set(path, _turborepoaccesstrace.TurborepoAccessTraceResult.fromSerialized(result.turborepoAccessTraceResult)); + } + if (options.buildExport) { + // Update path info by path. + const info = collector.byPath.get(path) ?? {}; + if (result.cacheControl) { + info.cacheControl = result.cacheControl; + } + if (typeof result.metadata !== 'undefined') { + info.metadata = result.metadata; + } + if (typeof result.hasEmptyStaticShell !== 'undefined') { + info.hasEmptyStaticShell = result.hasEmptyStaticShell; + } + if (typeof result.hasPostponed !== 'undefined') { + info.hasPostponed = result.hasPostponed; + } + if (typeof result.hasPendingUi !== 'undefined') { + info.hasPendingUi = result.hasPendingUi; + } + if (typeof result.htmlSize !== 'undefined') { + info.htmlSize = result.htmlSize; + } + if (typeof result.hasStaticRsc !== 'undefined') { + info.hasStaticRsc = result.hasStaticRsc; + } + if (typeof result.fetchMetrics !== 'undefined') { + info.fetchMetrics = result.fetchMetrics; + } + collector.byPath.set(path, info); + // Update not found. + if (result.ssgNotFound === true) { + collector.ssgNotFoundPaths.add(path); + } + // Update durations. + const durations = collector.byPage.get(page) ?? { + durationsByPath: new Map() + }; + durations.durationsByPath.set(path, result.duration); + collector.byPage.set(page, durations); + } + } + // Export mode provide static outputs that are not compatible with PPR mode. + if (!options.buildExport && nextConfig.cacheComponents) { + // TODO: add message + throw new Error('Invariant: PPR cannot be enabled in export mode'); + } + // copy prerendered routes to outDir + if (!options.buildExport && prerenderManifest) { + await Promise.all(Object.keys(prerenderManifest.routes).map(async (unnormalizedRoute)=>{ + // Special handling: map app /_not-found to 404.html (and 404/index.html when trailingSlash) + if (unnormalizedRoute === '/_not-found') { + const { srcRoute } = prerenderManifest.routes[unnormalizedRoute]; + const appPageName = mapAppRouteToPage.get(srcRoute || ''); + const pageName = appPageName || srcRoute || unnormalizedRoute; + const isAppPath = Boolean(appPageName); + const route = (0, _normalizepagepath.normalizePagePath)(unnormalizedRoute); + const pagePath = (0, _require.getPagePath)(pageName, distDir, undefined, isAppPath); + const distPagesDir = (0, _path.join)(pagePath, pageName.slice(1).split('/').map(()=>'..').join('/')); + const orig = (0, _path.join)(distPagesDir, route); + const htmlSrc = `${orig}.html`; + // write 404.html at root + const htmlDest404 = (0, _path.join)(outDir, '404.html'); + await _fs.promises.mkdir((0, _path.dirname)(htmlDest404), { + recursive: true + }); + await _fs.promises.copyFile(htmlSrc, htmlDest404); + // When trailingSlash, also write 404/index.html + if (subFolders) { + const htmlDest404Index = (0, _path.join)(outDir, '404', 'index.html'); + await _fs.promises.mkdir((0, _path.dirname)(htmlDest404Index), { + recursive: true + }); + await _fs.promises.copyFile(htmlSrc, htmlDest404Index); + } + } + // Skip 500.html in static export + if (unnormalizedRoute === '/_global-error') { + return; + } + const { srcRoute } = prerenderManifest.routes[unnormalizedRoute]; + const appPageName = mapAppRouteToPage.get(srcRoute || ''); + const pageName = appPageName || srcRoute || unnormalizedRoute; + const isAppPath = Boolean(appPageName); + const isAppRouteHandler = appPageName && (0, _isapprouteroute.isAppRouteRoute)(appPageName); + // returning notFound: true from getStaticProps will not + // output html/json files during the build + if (prerenderManifest.notFoundRoutes.includes(unnormalizedRoute)) { + return; + } + // TODO: This rewrites /index/foo to /index/index/foo. Investigate and + // fix. I presume this was because normalizePagePath was designed for + // some other use case and then reused here for static exports without + // realizing the implications. + const route = (0, _normalizepagepath.normalizePagePath)(unnormalizedRoute); + let orig; + if (isAppPath) { + const pagePath = (0, _require.getPagePath)(pageName, distDir, undefined, isAppPath); + const distPagesDir = (0, _path.join)(pagePath, // strip leading / and then recurse number of nested dirs + // to place from base folder + pageName.slice(1).split('/').map(()=>'..').join('/')); + orig = (0, _path.join)(distPagesDir, route); + } else { + // Pages router files are written directly to server/pages/ + // by the export worker during build, so read from there. + orig = (0, _path.join)(distDir, 'server', 'pages', route); + } + const handlerSrc = `${orig}.body`; + const handlerDest = (0, _path.join)(outDir, route); + if (isAppRouteHandler && (0, _fs.existsSync)(handlerSrc)) { + await _fs.promises.mkdir((0, _path.dirname)(handlerDest), { + recursive: true + }); + await _fs.promises.copyFile(handlerSrc, handlerDest); + return; + } + const htmlDest = (0, _path.join)(outDir, `${route}${subFolders && route !== '/index' ? `${_path.sep}index` : ''}.html`); + const jsonDest = isAppPath ? (0, _path.join)(outDir, `${route}${subFolders && route !== '/index' ? `${_path.sep}index` : ''}.txt`) : (0, _path.join)(pagesDataDir, `${route}.json`); + await _fs.promises.mkdir((0, _path.dirname)(htmlDest), { + recursive: true + }); + await _fs.promises.mkdir((0, _path.dirname)(jsonDest), { + recursive: true + }); + const htmlSrc = `${orig}.html`; + const jsonSrc = `${orig}${isAppPath ? _constants.RSC_SUFFIX : '.json'}`; + await _fs.promises.copyFile(htmlSrc, htmlDest); + await _fs.promises.copyFile(jsonSrc, jsonDest); + const segmentsDir = `${orig}${_constants.RSC_SEGMENTS_DIR_SUFFIX}`; + if (isAppPath && (0, _fs.existsSync)(segmentsDir)) { + // Output a data file for each of this page's segments + // + // These files are requested by the client router's internal + // prefetcher, not the user directly. So we don't need to account for + // things like trailing slash handling. + // + // To keep the protocol simple, we can use the non-normalized route + // path instead of the normalized one (which, among other things, + // rewrites `/` to `/index`). + const segmentsDirDest = (0, _path.join)(outDir, unnormalizedRoute); + const segmentPaths = await collectSegmentPaths(segmentsDir); + await Promise.all(segmentPaths.map(async (segmentFileSrc)=>{ + const segmentPath = '/' + segmentFileSrc.slice(0, -_constants.RSC_SEGMENT_SUFFIX.length); + const segmentFilename = (0, _segmentvalueencoding.convertSegmentPathToStaticExportFilename)(segmentPath); + const segmentFileDest = (0, _path.join)(segmentsDirDest, segmentFilename); + await _fs.promises.mkdir((0, _path.dirname)(segmentFileDest), { + recursive: true + }); + await _fs.promises.copyFile((0, _path.join)(segmentsDir, segmentFileSrc), segmentFileDest); + })); + } + })); + } + if (failedExportAttemptsByPage.size > 0) { + const failedPages = Array.from(failedExportAttemptsByPage.keys()); + throw new ExportError(`Export encountered errors on ${failedPages.length} ${failedPages.length === 1 ? 'path' : 'paths'}:\n\t${failedPages.sort().join('\n\t')}`); + } + await _fs.promises.writeFile((0, _path.join)(distDir, _constants1.EXPORT_DETAIL), (0, _formatmanifest.formatManifest)({ + version: 1, + outDirectory: outDir, + success: true + }), 'utf8'); + if (telemetry) { + await telemetry.flush(); + } + // Clean up activity listeners for progress. + if (staticWorker) { + staticWorker.setOnActivity(undefined); + staticWorker.setOnActivityAbort(undefined); + } + if (!staticWorker && worker) { + await worker.end(); + } + return collector; +} +async function collectSegmentPaths(segmentsDirectory) { + const results = []; + await collectSegmentPathsImpl(segmentsDirectory, segmentsDirectory, results); + return results; +} +async function collectSegmentPathsImpl(segmentsDirectory, directory, results) { + const segmentFiles = await _fs.promises.readdir(directory, { + withFileTypes: true + }); + await Promise.all(segmentFiles.map(async (segmentFile)=>{ + if (segmentFile.isDirectory()) { + await collectSegmentPathsImpl(segmentsDirectory, (0, _path.join)(directory, segmentFile.name), results); + return; + } + if (!segmentFile.name.endsWith(_constants.RSC_SEGMENT_SUFFIX)) { + return; + } + results.push((0, _path.relative)(segmentsDirectory, (0, _path.join)(directory, segmentFile.name))); + })); +} +async function exportApp(dir, options, span, staticWorker) { + const nextExportSpan = span.traceChild('next-export'); + return nextExportSpan.traceAsyncFn(async ()=>{ + return await exportAppImpl(dir, options, nextExportSpan, staticWorker); + }); +} + +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/index.js.map b/e-commerce/node_modules/next/dist/export/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a294f41c81cf37a906c41c95dffa9037085b72f3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/export/index.ts"],"sourcesContent":["import type {\n ExportAppResult,\n ExportAppOptions,\n WorkerRenderOptsPartial,\n ExportPagesResult,\n ExportPathEntry,\n} from './types'\nimport {\n createStaticWorker,\n type PrerenderManifest,\n type PreviewPropsManifest,\n type StaticWorker,\n} from '../build'\nimport type { PagesManifest } from '../build/webpack/plugins/pages-manifest-plugin'\n\nimport { bold, yellow } from '../lib/picocolors'\nimport findUp from 'next/dist/compiled/find-up'\nimport { existsSync, promises as fs } from 'fs'\n\nimport '../server/require-hook'\n\nimport { dirname, join, resolve, sep, relative } from 'path'\nimport * as Log from '../build/output/log'\nimport {\n RSC_SEGMENT_SUFFIX,\n RSC_SEGMENTS_DIR_SUFFIX,\n RSC_SUFFIX,\n SSG_FALLBACK_EXPORT_ERROR,\n} from '../lib/constants'\nimport { recursiveCopy } from '../lib/recursive-copy'\nimport {\n BUILD_ID_FILE,\n CLIENT_PUBLIC_FILES_PATH,\n CLIENT_STATIC_FILES_PATH,\n EXPORT_DETAIL,\n EXPORT_MARKER,\n NEXT_FONT_MANIFEST,\n MIDDLEWARE_MANIFEST,\n PAGES_MANIFEST,\n PHASE_EXPORT,\n PRERENDER_MANIFEST,\n SERVER_DIRECTORY,\n SERVER_REFERENCE_MANIFEST,\n APP_PATH_ROUTES_MANIFEST,\n ROUTES_MANIFEST,\n FUNCTIONS_CONFIG_MANIFEST,\n PREVIEW_PROPS_MANIFEST,\n} from '../shared/lib/constants'\nimport loadConfig from '../server/config'\nimport type { ExportPathMap } from '../server/config-shared'\nimport { parseMaxPostponedStateSize } from '../server/config-shared'\nimport { eventCliSession } from '../telemetry/events'\nimport { hasNextSupport } from '../server/ci-info'\nimport { Telemetry } from '../telemetry/storage'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { denormalizePagePath } from '../shared/lib/page-path/denormalize-page-path'\nimport { loadEnvConfig } from '@next/env'\nimport { isAPIRoute } from '../lib/is-api-route'\nimport { getPagePath } from '../server/require'\nimport type { Span } from '../trace'\nimport type { MiddlewareManifest } from '../build/webpack/plugins/middleware-plugin'\nimport { isAppRouteRoute } from '../lib/is-app-route-route'\nimport { isAppPageRoute } from '../lib/is-app-page-route'\nimport isError from '../lib/is-error'\nimport { formatManifest } from '../build/manifests/formatter/format-manifest'\nimport { TurborepoAccessTraceResult } from '../build/turborepo-access-trace'\nimport { createProgress } from '../build/progress'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport { isInterceptionRouteRewrite } from '../lib/is-interception-route-rewrite'\nimport type { ActionManifest } from '../build/webpack/plugins/flight-client-entry-plugin'\nimport { extractInfoFromServerReferenceId } from '../shared/lib/server-reference-info'\nimport { convertSegmentPathToStaticExportFilename } from '../shared/lib/segment-cache/segment-value-encoding'\nimport { getNextBuildDebuggerPortOffset } from '../lib/worker'\nimport { getParams } from './helpers/get-params'\nimport { isDynamicRoute } from '../shared/lib/router/utils/is-dynamic'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\nimport type { Params } from '../server/request/params'\nimport { Bundler } from '../lib/bundler'\nimport { getBuildDistDir } from './utils'\n\nexport class ExportError extends Error {\n code = 'NEXT_EXPORT_ERROR'\n}\n\n/**\n * Picks an RDC seed by matching on the params that are\n * already known, so fallback shells use a seed that has already\n * computed those known params.\n */\nfunction buildRDCCacheByPage(\n results: ExportPagesResult,\n finalPhaseExportPaths: ExportPathEntry[]\n): Record<string, string> {\n const renderResumeDataCachesByPage: Record<string, string> = {}\n const seedCandidatesByPage = new Map<\n string,\n Array<{ path: string; renderResumeDataCache: string }>\n >()\n\n for (const { page, path, result } of results) {\n if (!result) {\n continue\n }\n\n if ('renderResumeDataCache' in result && result.renderResumeDataCache) {\n // Collect all RDC seeds for this page so we can pick the best match\n // for each fallback shell later (e.g. locale-specific variants).\n const candidates = seedCandidatesByPage.get(page) ?? []\n candidates.push({\n path,\n renderResumeDataCache: result.renderResumeDataCache,\n })\n seedCandidatesByPage.set(page, candidates)\n // Remove the RDC string from the result so that it can be garbage\n // collected, when there are more results for the same page.\n result.renderResumeDataCache = undefined\n }\n }\n\n const getKnownParamsKey = (\n normalizedPage: string,\n path: string,\n fallbackParamNames: Set<string>\n ): string | null => {\n let params: Params\n try {\n params = getParams(normalizedPage, path)\n } catch {\n return null\n }\n\n // Only keep params that are known, then sort\n // for a stable key so we can match a compatible seed.\n const entries = Object.entries(params).filter(\n ([key]) => !fallbackParamNames.has(key)\n )\n\n entries.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n return JSON.stringify(entries)\n }\n\n for (const exportPath of finalPhaseExportPaths) {\n const { page, path, _fallbackRouteParams = [] } = exportPath\n if (!isDynamicRoute(page)) {\n continue\n }\n\n // Normalize app pages before param matching.\n const normalizedPage = normalizeAppPath(page)\n const pageKey = page !== path ? `${page}: ${path}` : path\n const fallbackParamNames = new Set(\n _fallbackRouteParams.map((param) => param.paramName)\n )\n // Build a key from the known params for this fallback shell so we can\n // select a seed from a compatible prerendered route.\n const targetKey = getKnownParamsKey(\n normalizedPage,\n path,\n fallbackParamNames\n )\n\n if (!targetKey) {\n continue\n }\n\n const candidates = seedCandidatesByPage.get(page)\n\n // No suitable candidates, so there's no RDC seed to select\n if (!candidates || candidates.length === 0) {\n continue\n }\n\n let selected: string | null = null\n for (const candidate of candidates) {\n // Pick the seed whose known params match this fallback shell.\n const candidateKey = getKnownParamsKey(\n normalizedPage,\n candidate.path,\n fallbackParamNames\n )\n if (candidateKey === targetKey) {\n selected = candidate.renderResumeDataCache\n break\n }\n }\n\n if (selected) {\n renderResumeDataCachesByPage[pageKey] = selected\n }\n }\n\n return renderResumeDataCachesByPage\n}\n\nasync function exportAppImpl(\n dir: string,\n options: Readonly<ExportAppOptions>,\n span: Span,\n staticWorker?: StaticWorker\n): Promise<ExportAppResult | null> {\n dir = resolve(dir)\n\n // attempt to load global env values so they are available in next.config.js\n span.traceChild('load-dotenv').traceFn(() => loadEnvConfig(dir, false, Log))\n\n const { enabledDirectories } = options\n\n const nextConfig =\n options.nextConfig ||\n (await span.traceChild('load-next-config').traceAsyncFn(() =>\n loadConfig(PHASE_EXPORT, dir, {\n debugPrerender: options.debugPrerender,\n })\n ))\n\n const distDir = join(dir, getBuildDistDir(nextConfig))\n const telemetry = options.buildExport ? null : new Telemetry({ distDir })\n\n if (telemetry) {\n telemetry.record(\n eventCliSession(nextConfig, {\n webpackVersion: null,\n cliCommand: 'export',\n isSrcDir: null,\n hasNowJson: !!(await findUp('now.json', { cwd: dir })),\n isCustomServer: null,\n turboFlag: options.bundler === Bundler.Turbopack,\n pagesDir: null,\n appDir: null,\n })\n )\n }\n\n const subFolders = nextConfig.trailingSlash && !options.buildExport\n\n if (!options.silent && !options.buildExport) {\n Log.info(`using build directory: ${distDir}`)\n }\n\n const buildIdFile = join(distDir, BUILD_ID_FILE)\n\n if (!existsSync(buildIdFile)) {\n throw new ExportError(\n `Could not find a production build in the '${distDir}' directory. Try building your app with 'next build' before starting the static export. https://nextjs.org/docs/messages/next-export-no-build-id`\n )\n }\n\n const customRoutes = (['rewrites', 'redirects', 'headers'] as const).filter(\n (config) => typeof nextConfig[config] === 'function'\n )\n\n if (!hasNextSupport && !options.buildExport && customRoutes.length > 0) {\n Log.warn(\n `rewrites, redirects, and headers are not applied when exporting your application, detected (${customRoutes.join(\n ', '\n )}). See more info here: https://nextjs.org/docs/messages/export-no-custom-routes`\n )\n }\n\n const buildId = await fs.readFile(buildIdFile, 'utf8')\n\n const pagesManifest =\n !options.pages &&\n (require(join(distDir, SERVER_DIRECTORY, PAGES_MANIFEST)) as PagesManifest)\n\n let previewProps: DeepReadonly<PreviewPropsManifest> | undefined\n try {\n previewProps = require(join(distDir, 'server', PREVIEW_PROPS_MANIFEST))\n } catch {}\n\n let prerenderManifest: DeepReadonly<PrerenderManifest> | undefined\n try {\n prerenderManifest = require(join(distDir, PRERENDER_MANIFEST))\n } catch {}\n\n let appRoutePathManifest: Record<string, string> | undefined\n try {\n appRoutePathManifest = require(join(distDir, APP_PATH_ROUTES_MANIFEST))\n } catch (err) {\n if (\n isError(err) &&\n (err.code === 'ENOENT' || err.code === 'MODULE_NOT_FOUND')\n ) {\n // the manifest doesn't exist which will happen when using\n // \"pages\" dir instead of \"app\" dir.\n appRoutePathManifest = undefined\n } else {\n // the manifest is malformed (invalid json)\n throw err\n }\n }\n\n const excludedPrerenderRoutes = new Set<string>()\n const pages = options.pages || Object.keys(pagesManifest)\n const defaultPathMap: ExportPathMap = {}\n\n let hasApiRoutes = false\n for (const page of pages) {\n // _document and _app are not real pages\n // _error is exported as 404.html later on\n // API Routes are Node.js functions\n\n if (isAPIRoute(page)) {\n hasApiRoutes = true\n continue\n }\n\n if (page === '/_document' || page === '/_app' || page === '/_error') {\n continue\n }\n\n // iSSG pages that are dynamic should not export templated version by\n // default. In most cases, this would never work. There is no server that\n // could run `getStaticProps`. If users make their page work lazily, they\n // can manually add it to the `exportPathMap`.\n if (prerenderManifest?.dynamicRoutes[page]) {\n excludedPrerenderRoutes.add(page)\n continue\n }\n\n defaultPathMap[page] = { page }\n }\n\n const mapAppRouteToPage = new Map<string, string>()\n if (!options.buildExport && appRoutePathManifest) {\n for (const [pageName, routePath] of Object.entries(appRoutePathManifest)) {\n mapAppRouteToPage.set(routePath, pageName)\n if (\n isAppPageRoute(pageName) &&\n !prerenderManifest?.routes[routePath] &&\n !prerenderManifest?.dynamicRoutes[routePath]\n ) {\n defaultPathMap[routePath] = {\n page: pageName,\n _isAppDir: true,\n }\n }\n }\n }\n\n // Initialize the output directory\n const outDir = options.outdir\n\n if (outDir === join(dir, 'public')) {\n throw new ExportError(\n `The 'public' directory is reserved in Next.js and can not be used as the export out directory. https://nextjs.org/docs/messages/can-not-output-to-public`\n )\n }\n\n if (outDir === join(dir, 'static')) {\n throw new ExportError(\n `The 'static' directory is reserved in Next.js and can not be used as the export out directory. https://nextjs.org/docs/messages/can-not-output-to-static`\n )\n }\n\n if (!options.buildExport) {\n await fs.rm(outDir, { recursive: true, force: true })\n await fs.mkdir(join(outDir, '_next', buildId), { recursive: true })\n }\n\n await fs.writeFile(\n join(distDir, EXPORT_DETAIL),\n formatManifest({\n version: 1,\n outDirectory: outDir,\n success: false,\n }),\n 'utf8'\n )\n\n // Copy static directory\n if (!options.buildExport && existsSync(join(dir, 'static'))) {\n if (!options.silent) {\n Log.info('Copying \"static\" directory')\n }\n await span\n .traceChild('copy-static-directory')\n .traceAsyncFn(() =>\n recursiveCopy(join(dir, 'static'), join(outDir, 'static'))\n )\n }\n\n // Copy .next/static directory\n if (\n !options.buildExport &&\n existsSync(join(distDir, CLIENT_STATIC_FILES_PATH))\n ) {\n if (!options.silent) {\n Log.info('Copying \"static build\" directory')\n }\n await span\n .traceChild('copy-next-static-directory')\n .traceAsyncFn(() =>\n recursiveCopy(\n join(distDir, CLIENT_STATIC_FILES_PATH),\n join(outDir, '_next', CLIENT_STATIC_FILES_PATH)\n )\n )\n }\n\n const {\n i18n,\n images: { loader = 'default', unoptimized },\n } = nextConfig\n\n if (i18n && !options.buildExport) {\n throw new ExportError(\n `i18n support is not compatible with next export. See here for more info on deploying: https://nextjs.org/docs/messages/export-no-custom-routes`\n )\n }\n\n if (!options.buildExport) {\n const { isNextImageImported } = await span\n .traceChild('is-next-image-imported')\n .traceAsyncFn(() =>\n fs\n .readFile(join(distDir, EXPORT_MARKER), 'utf8')\n .then((text) => JSON.parse(text))\n .catch(() => ({}))\n )\n\n if (\n isNextImageImported &&\n loader === 'default' &&\n !unoptimized &&\n !hasNextSupport\n ) {\n throw new ExportError(\n `Image Optimization using the default loader is not compatible with export.\n Possible solutions:\n - Use \\`next start\\` to run a server, which includes the Image Optimization API.\n - Configure \\`images.unoptimized = true\\` in \\`next.config.js\\` to disable the Image Optimization API.\n Read more: https://nextjs.org/docs/messages/export-image-api`\n )\n }\n }\n\n let serverActionsManifest: ActionManifest | undefined\n if (enabledDirectories.app) {\n serverActionsManifest = require(\n join(distDir, SERVER_DIRECTORY, SERVER_REFERENCE_MANIFEST + '.json')\n ) as ActionManifest\n\n if (nextConfig.output === 'export') {\n const routesManifest = require(join(distDir, ROUTES_MANIFEST))\n\n // We already prevent rewrites earlier in the process, however Next.js will insert rewrites\n // for interception routes so we need to check for that here.\n if (routesManifest?.rewrites?.beforeFiles?.length > 0) {\n const hasInterceptionRouteRewrite =\n routesManifest.rewrites.beforeFiles.some(isInterceptionRouteRewrite)\n\n if (hasInterceptionRouteRewrite) {\n throw new ExportError(\n `Intercepting routes are not supported with static export.\\nRead more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports#unsupported-features`\n )\n }\n }\n\n const actionIds = [\n ...Object.keys(serverActionsManifest.node),\n ...Object.keys(serverActionsManifest.edge),\n ]\n\n if (\n actionIds.some(\n (actionId) =>\n extractInfoFromServerReferenceId(actionId).type === 'server-action'\n )\n ) {\n throw new ExportError(\n `Server Actions are not supported with static export.\\nRead more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports#unsupported-features`\n )\n }\n }\n }\n\n // Start the rendering process\n const renderOpts: WorkerRenderOptsPartial = {\n previewProps,\n isBuildTimePrerendering: true,\n assetPrefix: nextConfig.assetPrefix.replace(/\\/$/, ''),\n distDir,\n basePath: nextConfig.basePath,\n cacheComponents: nextConfig.cacheComponents ?? false,\n partialPrefetching: nextConfig.partialPrefetching,\n validationLevel: nextConfig.experimental.instantInsights.validationLevel,\n trailingSlash: nextConfig.trailingSlash,\n locales: i18n?.locales,\n locale: i18n?.defaultLocale,\n defaultLocale: i18n?.defaultLocale,\n domainLocales: i18n?.domains,\n disableOptimizedLoading: nextConfig.experimental.disableOptimizedLoading,\n // Exported pages do not currently support dynamic HTML.\n supportsDynamicResponse: false,\n crossOrigin: nextConfig.crossOrigin,\n optimizeCss: nextConfig.experimental.optimizeCss,\n nextConfigOutput: nextConfig.output,\n nextScriptWorkers: nextConfig.experimental.nextScriptWorkers,\n largePageDataBytes: nextConfig.experimental.largePageDataBytes,\n serverActions: nextConfig.experimental.serverActions,\n serverComponents: enabledDirectories.app,\n cacheLifeProfiles: nextConfig.cacheLife,\n staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout,\n nextFontManifest: require(\n join(distDir, 'server', `${NEXT_FONT_MANIFEST}.json`)\n ),\n images: nextConfig.images,\n experimental: {\n clientTraceMetadata: nextConfig.experimental.clientTraceMetadata,\n expireTime: nextConfig.expireTime,\n staleTimes: nextConfig.experimental.staleTimes,\n clientParamParsingOrigins:\n nextConfig.experimental.clientParamParsingOrigins,\n dynamicOnHover: nextConfig.experimental.dynamicOnHover ?? false,\n optimisticRouting: nextConfig.experimental.optimisticRouting ?? false,\n parallelRouteMetadata:\n nextConfig.experimental.parallelRouteMetadata ?? false,\n inlineCss: nextConfig.experimental.inlineCss ?? false,\n prefetchInlining: nextConfig.experimental.prefetchInlining ?? false,\n authInterrupts: !!nextConfig.experimental.authInterrupts,\n reactBrowserBailout: nextConfig.experimental.reactBrowserBailout ?? false,\n useCacheTimeout: nextConfig.experimental.useCacheTimeout,\n durableUseCacheEntries: Boolean(\n nextConfig.experimental.durableUseCacheEntries\n ),\n cachedNavigations: nextConfig.experimental.cachedNavigations ?? false,\n maxPostponedStateSizeBytes: parseMaxPostponedStateSize(\n nextConfig.experimental.maxPostponedStateSize\n ),\n disableResumeDataCacheCompression:\n nextConfig.experimental.disableResumeDataCacheCompression ?? false,\n exposeTestingApi:\n nextConfig.experimental.exposeTestingApiInProductionBuild === true,\n },\n reactMaxHeadersLength: nextConfig.reactMaxHeadersLength,\n }\n\n // We need this for server rendering the Link component.\n ;(globalThis as any).__NEXT_DATA__ = {\n nextExport: true,\n }\n\n const exportPathMap = await span\n .traceChild('run-export-path-map')\n .traceAsyncFn(async () => {\n if (typeof nextConfig.exportPathMap !== 'function') {\n return defaultPathMap\n }\n\n const exportMap = await nextConfig.exportPathMap(defaultPathMap, {\n dev: false,\n dir,\n outDir,\n distDir,\n buildId,\n })\n return exportMap\n })\n\n // During static export, remove export 404/500 of pages router\n // when only app router presents\n if (!options.buildExport && options.appDirOnly) {\n delete exportPathMap['/404']\n delete exportPathMap['/500']\n }\n\n // only add missing 404 page when `buildExport` is false\n if (!options.buildExport && !options.appDirOnly) {\n // only add missing /404 if not specified in `exportPathMap`\n if (!exportPathMap['/404']) {\n exportPathMap['/404'] = { page: '/_error' }\n }\n\n /**\n * exports 404.html for backwards compat\n * E.g. GitHub Pages, GitLab Pages, Cloudflare Pages, Netlify\n */\n if (!exportPathMap['/404.html'] && exportPathMap['/404']) {\n // alias /404.html to /404 to be compatible with custom 404 / _error page\n exportPathMap['/404.html'] = exportPathMap['/404']\n }\n }\n\n const allExportPaths: ExportPathEntry[] = []\n const seenExportPaths = new Set<string>()\n const fallbackEnabledPages = new Set<string>()\n\n for (const [path, entry] of Object.entries(exportPathMap)) {\n // make sure to prevent duplicates\n const normalizedPath = denormalizePagePath(normalizePagePath(path))\n\n if (seenExportPaths.has(normalizedPath)) {\n continue\n }\n\n seenExportPaths.add(normalizedPath)\n\n if (!entry._isAppDir && isAPIRoute(entry.page)) {\n hasApiRoutes = true\n continue\n }\n\n allExportPaths.push({ ...entry, path: normalizedPath })\n\n if (prerenderManifest && !options.buildExport) {\n const prerenderInfo = prerenderManifest.dynamicRoutes[entry.page]\n\n if (prerenderInfo && prerenderInfo.fallback !== false) {\n fallbackEnabledPages.add(entry.page)\n }\n }\n }\n\n if (allExportPaths.length === 0) {\n if (!prerenderManifest) {\n return null\n }\n }\n\n if (fallbackEnabledPages.size > 0) {\n throw new ExportError(\n `Found pages with \\`fallback\\` enabled:\\n${[...fallbackEnabledPages].join(\n '\\n'\n )}\\n${SSG_FALLBACK_EXPORT_ERROR}\\n`\n )\n }\n\n let hasMiddleware = false\n\n if (!options.buildExport) {\n try {\n const middlewareManifest = require(\n join(distDir, SERVER_DIRECTORY, MIDDLEWARE_MANIFEST)\n ) as MiddlewareManifest\n\n const functionsConfigManifest = require(\n join(distDir, SERVER_DIRECTORY, FUNCTIONS_CONFIG_MANIFEST)\n )\n\n hasMiddleware =\n Object.keys(middlewareManifest.middleware).length > 0 ||\n Boolean(functionsConfigManifest.functions?.['/_middleware'])\n } catch {}\n\n // Warn if the user defines a path for an API page\n if (hasApiRoutes || hasMiddleware) {\n if (nextConfig.output === 'export') {\n Log.warn(\n yellow(\n `Statically exporting a Next.js application via \\`next export\\` disables API routes and middleware.`\n ) +\n `\\n` +\n yellow(\n `This command is meant for static-only hosts, and is` +\n ' ' +\n bold(`not necessary to make your application static.`)\n ) +\n `\\n` +\n yellow(\n `Pages in your application without server-side data dependencies will be automatically statically exported by \\`next build\\`, including pages powered by \\`getStaticProps\\`.`\n ) +\n `\\n` +\n yellow(\n `Learn more: https://nextjs.org/docs/messages/api-routes-static-export`\n )\n )\n }\n }\n }\n\n const pagesDataDir = options.buildExport\n ? join(distDir, 'server', 'pages')\n : join(outDir, '_next/data', buildId)\n\n const publicDir = join(dir, CLIENT_PUBLIC_FILES_PATH)\n // Copy public directory\n if (!options.buildExport && existsSync(publicDir)) {\n if (!options.silent) {\n Log.info('Copying \"public\" directory')\n }\n await span.traceChild('copy-public-directory').traceAsyncFn(() =>\n recursiveCopy(publicDir, outDir, {\n filter(path) {\n // Exclude paths used by pages\n return !exportPathMap[path]\n },\n })\n )\n }\n\n const exportPagesInBatches = async (\n worker: StaticWorker,\n exportPaths: ExportPathEntry[],\n renderResumeDataCachesByPage?: Record<string, string>\n ): Promise<ExportPagesResult> => {\n // Batch filtered pages into smaller batches, and call the export worker on\n // each batch. We've set a default minimum of 25 pages per batch to ensure\n // that even setups with only a few static pages can leverage a shared\n // incremental cache, however this value can be configured.\n const minPageCountPerBatch =\n nextConfig.experimental.staticGenerationMinPagesPerWorker ?? 25\n\n // Calculate the number of workers needed to ensure each batch has at least\n // minPageCountPerBatch pages.\n const numWorkers = Math.min(\n options.numWorkers,\n Math.ceil(exportPaths.length / minPageCountPerBatch)\n )\n\n // Calculate the page count per batch based on the number of workers.\n const pageCountPerBatch = Math.ceil(exportPaths.length / numWorkers)\n\n const batches = Array.from({ length: numWorkers }, (_, i) =>\n exportPaths.slice(i * pageCountPerBatch, (i + 1) * pageCountPerBatch)\n )\n\n // Distribute remaining pages.\n const remainingPages = exportPaths.slice(numWorkers * pageCountPerBatch)\n remainingPages.forEach((page, index) => {\n batches[index % batches.length].push(page)\n })\n\n return (\n await Promise.all(\n batches.map(async (batch) =>\n worker.exportPages({\n buildId,\n deploymentId: nextConfig.deploymentId,\n clientAssetToken: nextConfig.supportsImmutableAssets\n ? ''\n : nextConfig.deploymentId,\n exportPaths: batch,\n parentSpanId: span.getId(),\n pagesDataDir,\n renderOpts,\n options,\n dir,\n distDir,\n outDir: options.buildExport\n ? join(distDir, 'server', 'pages')\n : outDir,\n nextConfig,\n cacheHandler: nextConfig.cacheHandler,\n cacheMaxMemorySize: nextConfig.cacheMaxMemorySize,\n fetchCache: true,\n fetchCacheKeyPrefix: nextConfig.experimental.fetchCacheKeyPrefix,\n renderResumeDataCachesByPage,\n })\n )\n )\n ).flat()\n }\n\n let initialPhaseExportPaths: ExportPathEntry[] = []\n const finalPhaseExportPaths: ExportPathEntry[] = []\n\n if (renderOpts.cacheComponents) {\n // Only run instant validation once per route, even if multiple param sets from generateStaticParams exist.\n const routesWithInstantValidation = new Set<string>()\n\n for (const exportPath of allExportPaths) {\n if (exportPath._allowEmptyStaticShell) {\n finalPhaseExportPaths.push(exportPath)\n } else {\n initialPhaseExportPaths.push(exportPath)\n }\n\n // Always mark routes for potential build validation. The actual\n // decision of whether to validate is made per-route by\n // anySegmentNeedsInstantValidationInBuild, which checks both the\n // default validation level and per-segment level overrides.\n const route = exportPath.page\n if (!routesWithInstantValidation.has(route)) {\n exportPath._runInstantValidation = true\n routesWithInstantValidation.add(route)\n }\n }\n } else {\n initialPhaseExportPaths = allExportPaths\n }\n\n const totalExportPaths =\n initialPhaseExportPaths.length + finalPhaseExportPaths.length\n let worker: StaticWorker | null = null\n let results: ExportPagesResult = []\n\n if (totalExportPaths > 0) {\n const progress = createProgress(\n totalExportPaths,\n options.statusMessage ??\n `Exporting using ${options.numWorkers} worker${options.numWorkers > 1 ? 's' : ''}`\n )\n\n if (staticWorker) {\n // TODO: progress shouldn't rely on \"activity\" event sent from `exportPage`.\n staticWorker.setOnActivity(progress.run)\n staticWorker.setOnActivityAbort(progress.clear)\n worker = staticWorker\n } else {\n worker = createStaticWorker(nextConfig, {\n debuggerPortOffset: getNextBuildDebuggerPortOffset({\n kind: 'export-page',\n }),\n numberOfWorkers: options.numWorkers,\n progress,\n })\n }\n\n results = await exportPagesInBatches(worker, initialPhaseExportPaths)\n\n if (finalPhaseExportPaths.length > 0) {\n const renderResumeDataCachesByPage = buildRDCCacheByPage(\n results,\n finalPhaseExportPaths\n )\n\n const finalPhaseResults = await exportPagesInBatches(\n worker,\n finalPhaseExportPaths,\n renderResumeDataCachesByPage\n )\n\n results.push(...finalPhaseResults)\n }\n }\n\n const collector: ExportAppResult = {\n byPath: new Map(),\n byPage: new Map(),\n ssgNotFoundPaths: new Set(),\n turborepoAccessTraceResults: new Map(),\n }\n\n const failedExportAttemptsByPage: Map<string, boolean> = new Map()\n\n for (const { result, path, page, pageKey } of results) {\n if (!result) continue\n if ('error' in result) {\n failedExportAttemptsByPage.set(pageKey, true)\n continue\n }\n\n if (result.turborepoAccessTraceResult) {\n collector.turborepoAccessTraceResults?.set(\n path,\n TurborepoAccessTraceResult.fromSerialized(\n result.turborepoAccessTraceResult\n )\n )\n }\n\n if (options.buildExport) {\n // Update path info by path.\n const info = collector.byPath.get(path) ?? {}\n if (result.cacheControl) {\n info.cacheControl = result.cacheControl\n }\n if (typeof result.metadata !== 'undefined') {\n info.metadata = result.metadata\n }\n\n if (typeof result.hasEmptyStaticShell !== 'undefined') {\n info.hasEmptyStaticShell = result.hasEmptyStaticShell\n }\n\n if (typeof result.hasPostponed !== 'undefined') {\n info.hasPostponed = result.hasPostponed\n }\n\n if (typeof result.hasPendingUi !== 'undefined') {\n info.hasPendingUi = result.hasPendingUi\n }\n\n if (typeof result.htmlSize !== 'undefined') {\n info.htmlSize = result.htmlSize\n }\n\n if (typeof result.hasStaticRsc !== 'undefined') {\n info.hasStaticRsc = result.hasStaticRsc\n }\n\n if (typeof result.fetchMetrics !== 'undefined') {\n info.fetchMetrics = result.fetchMetrics\n }\n\n collector.byPath.set(path, info)\n\n // Update not found.\n if (result.ssgNotFound === true) {\n collector.ssgNotFoundPaths.add(path)\n }\n\n // Update durations.\n const durations = collector.byPage.get(page) ?? {\n durationsByPath: new Map<string, number>(),\n }\n durations.durationsByPath.set(path, result.duration)\n collector.byPage.set(page, durations)\n }\n }\n\n // Export mode provide static outputs that are not compatible with PPR mode.\n if (!options.buildExport && nextConfig.cacheComponents) {\n // TODO: add message\n throw new Error('Invariant: PPR cannot be enabled in export mode')\n }\n\n // copy prerendered routes to outDir\n if (!options.buildExport && prerenderManifest) {\n await Promise.all(\n Object.keys(prerenderManifest.routes).map(async (unnormalizedRoute) => {\n // Special handling: map app /_not-found to 404.html (and 404/index.html when trailingSlash)\n if (unnormalizedRoute === '/_not-found') {\n const { srcRoute } = prerenderManifest!.routes[unnormalizedRoute]\n const appPageName = mapAppRouteToPage.get(srcRoute || '')\n const pageName = appPageName || srcRoute || unnormalizedRoute\n const isAppPath = Boolean(appPageName)\n const route = normalizePagePath(unnormalizedRoute)\n\n const pagePath = getPagePath(pageName, distDir, undefined, isAppPath)\n const distPagesDir = join(\n pagePath,\n pageName\n .slice(1)\n .split('/')\n .map(() => '..')\n .join('/')\n )\n\n const orig = join(distPagesDir, route)\n const htmlSrc = `${orig}.html`\n\n // write 404.html at root\n const htmlDest404 = join(outDir, '404.html')\n await fs.mkdir(dirname(htmlDest404), { recursive: true })\n await fs.copyFile(htmlSrc, htmlDest404)\n\n // When trailingSlash, also write 404/index.html\n if (subFolders) {\n const htmlDest404Index = join(outDir, '404', 'index.html')\n await fs.mkdir(dirname(htmlDest404Index), { recursive: true })\n await fs.copyFile(htmlSrc, htmlDest404Index)\n }\n }\n // Skip 500.html in static export\n if (unnormalizedRoute === '/_global-error') {\n return\n }\n const { srcRoute } = prerenderManifest!.routes[unnormalizedRoute]\n const appPageName = mapAppRouteToPage.get(srcRoute || '')\n const pageName = appPageName || srcRoute || unnormalizedRoute\n const isAppPath = Boolean(appPageName)\n const isAppRouteHandler = appPageName && isAppRouteRoute(appPageName)\n\n // returning notFound: true from getStaticProps will not\n // output html/json files during the build\n if (prerenderManifest!.notFoundRoutes.includes(unnormalizedRoute)) {\n return\n }\n // TODO: This rewrites /index/foo to /index/index/foo. Investigate and\n // fix. I presume this was because normalizePagePath was designed for\n // some other use case and then reused here for static exports without\n // realizing the implications.\n const route = normalizePagePath(unnormalizedRoute)\n\n let orig: string\n if (isAppPath) {\n const pagePath = getPagePath(pageName, distDir, undefined, isAppPath)\n const distPagesDir = join(\n pagePath,\n // strip leading / and then recurse number of nested dirs\n // to place from base folder\n pageName\n .slice(1)\n .split('/')\n .map(() => '..')\n .join('/')\n )\n orig = join(distPagesDir, route)\n } else {\n // Pages router files are written directly to server/pages/\n // by the export worker during build, so read from there.\n orig = join(distDir, 'server', 'pages', route)\n }\n const handlerSrc = `${orig}.body`\n const handlerDest = join(outDir, route)\n\n if (isAppRouteHandler && existsSync(handlerSrc)) {\n await fs.mkdir(dirname(handlerDest), { recursive: true })\n await fs.copyFile(handlerSrc, handlerDest)\n return\n }\n\n const htmlDest = join(\n outDir,\n `${route}${\n subFolders && route !== '/index' ? `${sep}index` : ''\n }.html`\n )\n const jsonDest = isAppPath\n ? join(\n outDir,\n `${route}${\n subFolders && route !== '/index' ? `${sep}index` : ''\n }.txt`\n )\n : join(pagesDataDir, `${route}.json`)\n\n await fs.mkdir(dirname(htmlDest), { recursive: true })\n await fs.mkdir(dirname(jsonDest), { recursive: true })\n\n const htmlSrc = `${orig}.html`\n const jsonSrc = `${orig}${isAppPath ? RSC_SUFFIX : '.json'}`\n\n await fs.copyFile(htmlSrc, htmlDest)\n await fs.copyFile(jsonSrc, jsonDest)\n\n const segmentsDir = `${orig}${RSC_SEGMENTS_DIR_SUFFIX}`\n\n if (isAppPath && existsSync(segmentsDir)) {\n // Output a data file for each of this page's segments\n //\n // These files are requested by the client router's internal\n // prefetcher, not the user directly. So we don't need to account for\n // things like trailing slash handling.\n //\n // To keep the protocol simple, we can use the non-normalized route\n // path instead of the normalized one (which, among other things,\n // rewrites `/` to `/index`).\n const segmentsDirDest = join(outDir, unnormalizedRoute)\n const segmentPaths = await collectSegmentPaths(segmentsDir)\n await Promise.all(\n segmentPaths.map(async (segmentFileSrc) => {\n const segmentPath =\n '/' + segmentFileSrc.slice(0, -RSC_SEGMENT_SUFFIX.length)\n const segmentFilename =\n convertSegmentPathToStaticExportFilename(segmentPath)\n const segmentFileDest = join(segmentsDirDest, segmentFilename)\n await fs.mkdir(dirname(segmentFileDest), { recursive: true })\n await fs.copyFile(\n join(segmentsDir, segmentFileSrc),\n segmentFileDest\n )\n })\n )\n }\n })\n )\n }\n\n if (failedExportAttemptsByPage.size > 0) {\n const failedPages = Array.from(failedExportAttemptsByPage.keys())\n throw new ExportError(\n `Export encountered errors on ${failedPages.length} ${failedPages.length === 1 ? 'path' : 'paths'}:\\n\\t${failedPages\n .sort()\n .join('\\n\\t')}`\n )\n }\n\n await fs.writeFile(\n join(distDir, EXPORT_DETAIL),\n formatManifest({\n version: 1,\n outDirectory: outDir,\n success: true,\n }),\n 'utf8'\n )\n\n if (telemetry) {\n await telemetry.flush()\n }\n\n // Clean up activity listeners for progress.\n if (staticWorker) {\n staticWorker.setOnActivity(undefined)\n staticWorker.setOnActivityAbort(undefined)\n }\n\n if (!staticWorker && worker) {\n await worker.end()\n }\n\n return collector\n}\n\nasync function collectSegmentPaths(segmentsDirectory: string) {\n const results: Array<string> = []\n await collectSegmentPathsImpl(segmentsDirectory, segmentsDirectory, results)\n return results\n}\n\nasync function collectSegmentPathsImpl(\n segmentsDirectory: string,\n directory: string,\n results: Array<string>\n) {\n const segmentFiles = await fs.readdir(directory, {\n withFileTypes: true,\n })\n await Promise.all(\n segmentFiles.map(async (segmentFile) => {\n if (segmentFile.isDirectory()) {\n await collectSegmentPathsImpl(\n segmentsDirectory,\n join(directory, segmentFile.name),\n results\n )\n return\n }\n if (!segmentFile.name.endsWith(RSC_SEGMENT_SUFFIX)) {\n return\n }\n results.push(\n relative(segmentsDirectory, join(directory, segmentFile.name))\n )\n })\n )\n}\n\nexport default async function exportApp(\n dir: string,\n options: ExportAppOptions,\n span: Span,\n staticWorker?: StaticWorker\n): Promise<ExportAppResult | null> {\n const nextExportSpan = span.traceChild('next-export')\n\n return nextExportSpan.traceAsyncFn(async () => {\n return await exportAppImpl(dir, options, nextExportSpan, staticWorker)\n })\n}\n"],"names":["ExportError","exportApp","Error","code","buildRDCCacheByPage","results","finalPhaseExportPaths","renderResumeDataCachesByPage","seedCandidatesByPage","Map","page","path","result","renderResumeDataCache","candidates","get","push","set","undefined","getKnownParamsKey","normalizedPage","fallbackParamNames","params","getParams","entries","Object","filter","key","has","sort","a","b","JSON","stringify","exportPath","_fallbackRouteParams","isDynamicRoute","normalizeAppPath","pageKey","Set","map","param","paramName","targetKey","length","selected","candidate","candidateKey","exportAppImpl","dir","options","span","staticWorker","resolve","traceChild","traceFn","loadEnvConfig","Log","enabledDirectories","nextConfig","traceAsyncFn","loadConfig","PHASE_EXPORT","debugPrerender","distDir","join","getBuildDistDir","telemetry","buildExport","Telemetry","record","eventCliSession","webpackVersion","cliCommand","isSrcDir","hasNowJson","findUp","cwd","isCustomServer","turboFlag","bundler","Bundler","Turbopack","pagesDir","appDir","subFolders","trailingSlash","silent","info","buildIdFile","BUILD_ID_FILE","existsSync","customRoutes","config","hasNextSupport","warn","buildId","fs","readFile","pagesManifest","pages","require","SERVER_DIRECTORY","PAGES_MANIFEST","previewProps","PREVIEW_PROPS_MANIFEST","prerenderManifest","PRERENDER_MANIFEST","appRoutePathManifest","APP_PATH_ROUTES_MANIFEST","err","isError","excludedPrerenderRoutes","keys","defaultPathMap","hasApiRoutes","isAPIRoute","dynamicRoutes","add","mapAppRouteToPage","pageName","routePath","isAppPageRoute","routes","_isAppDir","outDir","outdir","rm","recursive","force","mkdir","writeFile","EXPORT_DETAIL","formatManifest","version","outDirectory","success","recursiveCopy","CLIENT_STATIC_FILES_PATH","i18n","images","loader","unoptimized","isNextImageImported","EXPORT_MARKER","then","text","parse","catch","serverActionsManifest","app","SERVER_REFERENCE_MANIFEST","output","routesManifest","ROUTES_MANIFEST","rewrites","beforeFiles","hasInterceptionRouteRewrite","some","isInterceptionRouteRewrite","actionIds","node","edge","actionId","extractInfoFromServerReferenceId","type","renderOpts","isBuildTimePrerendering","assetPrefix","replace","basePath","cacheComponents","partialPrefetching","validationLevel","experimental","instantInsights","locales","locale","defaultLocale","domainLocales","domains","disableOptimizedLoading","supportsDynamicResponse","crossOrigin","optimizeCss","nextConfigOutput","nextScriptWorkers","largePageDataBytes","serverActions","serverComponents","cacheLifeProfiles","cacheLife","staticPageGenerationTimeout","nextFontManifest","NEXT_FONT_MANIFEST","clientTraceMetadata","expireTime","staleTimes","clientParamParsingOrigins","dynamicOnHover","optimisticRouting","parallelRouteMetadata","inlineCss","prefetchInlining","authInterrupts","reactBrowserBailout","useCacheTimeout","durableUseCacheEntries","Boolean","cachedNavigations","maxPostponedStateSizeBytes","parseMaxPostponedStateSize","maxPostponedStateSize","disableResumeDataCacheCompression","exposeTestingApi","exposeTestingApiInProductionBuild","reactMaxHeadersLength","globalThis","__NEXT_DATA__","nextExport","exportPathMap","exportMap","dev","appDirOnly","allExportPaths","seenExportPaths","fallbackEnabledPages","entry","normalizedPath","denormalizePagePath","normalizePagePath","prerenderInfo","fallback","size","SSG_FALLBACK_EXPORT_ERROR","hasMiddleware","functionsConfigManifest","middlewareManifest","MIDDLEWARE_MANIFEST","FUNCTIONS_CONFIG_MANIFEST","middleware","functions","yellow","bold","pagesDataDir","publicDir","CLIENT_PUBLIC_FILES_PATH","exportPagesInBatches","worker","exportPaths","minPageCountPerBatch","staticGenerationMinPagesPerWorker","numWorkers","Math","min","ceil","pageCountPerBatch","batches","Array","from","_","i","slice","remainingPages","forEach","index","Promise","all","batch","exportPages","deploymentId","clientAssetToken","supportsImmutableAssets","parentSpanId","getId","cacheHandler","cacheMaxMemorySize","fetchCache","fetchCacheKeyPrefix","flat","initialPhaseExportPaths","routesWithInstantValidation","_allowEmptyStaticShell","route","_runInstantValidation","totalExportPaths","progress","createProgress","statusMessage","setOnActivity","run","setOnActivityAbort","clear","createStaticWorker","debuggerPortOffset","getNextBuildDebuggerPortOffset","kind","numberOfWorkers","finalPhaseResults","collector","byPath","byPage","ssgNotFoundPaths","turborepoAccessTraceResults","failedExportAttemptsByPage","turborepoAccessTraceResult","TurborepoAccessTraceResult","fromSerialized","cacheControl","metadata","hasEmptyStaticShell","hasPostponed","hasPendingUi","htmlSize","hasStaticRsc","fetchMetrics","ssgNotFound","durations","durationsByPath","duration","unnormalizedRoute","srcRoute","appPageName","isAppPath","pagePath","getPagePath","distPagesDir","split","orig","htmlSrc","htmlDest404","dirname","copyFile","htmlDest404Index","isAppRouteHandler","isAppRouteRoute","notFoundRoutes","includes","handlerSrc","handlerDest","htmlDest","sep","jsonDest","jsonSrc","RSC_SUFFIX","segmentsDir","RSC_SEGMENTS_DIR_SUFFIX","segmentsDirDest","segmentPaths","collectSegmentPaths","segmentFileSrc","segmentPath","RSC_SEGMENT_SUFFIX","segmentFilename","convertSegmentPathToStaticExportFilename","segmentFileDest","failedPages","flush","end","segmentsDirectory","collectSegmentPathsImpl","directory","segmentFiles","readdir","withFileTypes","segmentFile","isDirectory","name","endsWith","relative","nextExportSpan"],"mappings":";;;;;;;;;;;;;;;IAgFaA,WAAW;eAAXA;;IAihCb,OAWC;eAX6BC;;;uBArlCvB;4BAGsB;+DACV;oBACwB;QAEpC;sBAE+C;6DACjC;2BAMd;+BACuB;4BAkBvB;+DACgB;8BAEoB;wBACX;wBACD;yBACL;mCACQ;qCACE;qBACN;4BACH;yBACC;iCAGI;gCACD;gEACX;gCACW;sCACY;0BACZ;4CAEY;qCAEM;sCACQ;wBACV;2BACrB;2BACK;0BACE;yBAET;uBACQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzB,MAAMD,oBAAoBE;;QAA1B,qBACLC,OAAO;;AACT;AAEA;;;;CAIC,GACD,SAASC,oBACPC,OAA0B,EAC1BC,qBAAwC;IAExC,MAAMC,+BAAuD,CAAC;IAC9D,MAAMC,uBAAuB,IAAIC;IAKjC,KAAK,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,MAAM,EAAE,IAAIP,QAAS;QAC5C,IAAI,CAACO,QAAQ;YACX;QACF;QAEA,IAAI,2BAA2BA,UAAUA,OAAOC,qBAAqB,EAAE;YACrE,oEAAoE;YACpE,iEAAiE;YACjE,MAAMC,aAAaN,qBA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C3BkC,aAAa+O,kBAAkB,CAACjR;IAClC;IAEA,IAAI,CAACkC,gBAAgBoM,QAAQ;QAC3B,MAAMA,OAAO8G,GAAG;IAClB;IAEA,OAAO3D;AACT;AAEA,eAAekD,oBAAoBU,iBAAyB;IAC1D,MAAMlW,UAAyB,EAAE;IACjC,MAAMmW,wBAAwBD,mBAAmBA,mBAAmBlW;IACpE,OAAOA;AACT;AAEA,eAAemW,wBACbD,iBAAyB,EACzBE,SAAiB,EACjBpW,OAAsB;IAEtB,MAAMqW,eAAe,MAAMzQ,YAAE,CAAC0Q,OAAO,CAACF,WAAW;QAC/CG,eAAe;IACjB;IACA,MAAMlG,QAAQC,GAAG,CACf+F,aAAalU,GAAG,CAAC,OAAOqU;QACtB,IAAIA,YAAYC,WAAW,IAAI;YAC7B,MAAMN,wBACJD,mBACAtS,IAAAA,UAAI,EAACwS,WAAWI,YAAYE,IAAI,GAChC1W;YAEF;QACF;QACA,IAAI,CAACwW,YAAYE,IAAI,CAACC,QAAQ,CAAChB,6BAAkB,GAAG;YAClD;QACF;QACA3V,QAAQW,IAAI,CACViW,IAAAA,cAAQ,EAACV,mBAAmBtS,IAAAA,UAAI,EAACwS,WAAWI,YAAYE,IAAI;IAEhE;AAEJ;AAEe,eAAe9W,UAC5BgD,GAAW,EACXC,OAAyB,EACzBC,IAAU,EACVC,YAA2B;IAE3B,MAAM8T,iBAAiB/T,KAAKG,UAAU,CAAC;IAEvC,OAAO4T,eAAetT,YAAY,CAAC;QACjC,OAAO,MAAMZ,cAAcC,KAAKC,SAASgU,gBAAgB9T;IAC3D;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/routes/app-page.d.ts b/e-commerce/node_modules/next/dist/export/routes/app-page.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2fddde9976e7d6cc8394c9fe90d4cbc4806a6af4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/routes/app-page.d.ts @@ -0,0 +1,14 @@ +import type { ExportRouteResult } from '../types'; +import type { RenderOpts } from '../../server/app-render/types'; +import type { NextParsedUrlQuery } from '../../server/request-meta'; +import type { RouteCacheMetadata } from './types'; +import type { MockedRequest, MockedResponse } from '../../server/lib/mock-request'; +import type { OpaqueFallbackRouteParams } from '../../server/request/fallback-params'; +import type { RequestLifecycleOpts } from '../../server/base-server'; +import type { AppSharedContext } from '../../server/app-render/app-render'; +import type { RouteMatch } from '../../server/route-modules/app-page/module'; +import type { MultiFileWriter } from '../../lib/multi-file-writer'; +/** + * Renders & exports a page associated with the /app directory + */ +export declare function exportAppPage(req: MockedRequest, res: MockedResponse, page: string, path: string, pathname: string, query: NextParsedUrlQuery, fallbackRouteParams: OpaqueFallbackRouteParams | null, partialRenderOpts: Omit<RenderOpts, keyof RequestLifecycleOpts>, htmlFilepath: string, debugOutput: boolean, isDynamicError: boolean, fileWriter: MultiFileWriter, sharedContext: AppSharedContext, routeMatch: RouteMatch, routeCache?: RouteCacheMetadata): Promise<ExportRouteResult>; diff --git a/e-commerce/node_modules/next/dist/export/routes/app-page.js b/e-commerce/node_modules/next/dist/export/routes/app-page.js new file mode 100644 index 0000000000000000000000000000000000000000..3273610e477eb94716e5dbf20c89a08b3e7822df --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/routes/app-page.js @@ -0,0 +1,211 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "exportAppPage", { + enumerable: true, + get: function() { + return exportAppPage; + } +}); +const _isdynamicusageerror = require("../helpers/is-dynamic-usage-error"); +const _constants = require("../../lib/constants"); +const _ciinfo = require("../../server/ci-info"); +const _modulerender = require("../../server/route-modules/app-page/module.render"); +const _parserequestheaders = require("../../server/route-modules/app-page/parse-request-headers"); +const _bailouttocsr = require("../../shared/lib/lazy-dynamic/bailout-to-csr"); +const _node = require("../../server/base-http/node"); +const _approuterheaders = require("../../client/components/app-router-headers"); +const _runwithafter = require("../../server/after/run-with-after"); +const _resumedatacache = require("../../server/resume-data-cache/resume-data-cache"); +const _entryconstants = require("../../shared/lib/entry-constants"); +async function exportAppPage(req, res, page, path, pathname, query, fallbackRouteParams, partialRenderOpts, htmlFilepath, debugOutput, isDynamicError, fileWriter, sharedContext, routeMatch, routeCache) { + const afterRunner = new _runwithafter.AfterRunner(); + const renderOpts = { + ...partialRenderOpts, + waitUntil: afterRunner.context.waitUntil, + onClose: afterRunner.context.onClose, + onAfterTaskError: afterRunner.context.onTaskError + }; + let isDefaultNotFound = false; + let isDefaultGlobalError = false; + // If the page is `/_not-found`, then we should update the page to be `/404`. + if (page === _entryconstants.UNDERSCORE_NOT_FOUND_ROUTE_ENTRY) { + isDefaultNotFound = true; + pathname = '/404'; + } + // If the page is `/_global-error`, then we should update the page to be `/500`. + if (page === _entryconstants.UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY) { + isDefaultGlobalError = true; + pathname = '/500'; + } + try { + var _renderOpts_previewProps; + const nextReq = new _node.NodeNextRequest(req); + const parsedRequestHeaders = (0, _parserequestheaders.parseRequestHeaders)(nextReq.headers, { + isRoutePPREnabled: renderOpts.experimental.isRoutePPREnabled === true, + previewModeId: (_renderOpts_previewProps = renderOpts.previewProps) == null ? void 0 : _renderOpts_previewProps.previewModeId + }); + const result = await (0, _modulerender.lazyPrerenderAppPage)(nextReq, new _node.NodeNextResponse(res), pathname, query, fallbackRouteParams, renderOpts, undefined, sharedContext, routeMatch, parsedRequestHeaders); + if ('error' in result) { + throw result.error; + } + const html = result.toUnchunkedString(); + // TODO(after): if we abort a prerender because of an error in an after-callback + // we should probably communicate that better (and not log the error twice) + await afterRunner.executeAfter(); + const { metadata } = result; + const { flightData, cacheControl = { + revalidate: false, + expire: undefined + }, postponed, fetchTags, fetchMetrics, segmentData, prefetchHints, renderResumeDataCache, hasPendingUi } = metadata; + // Ensure we don't postpone without having PPR enabled. + if (postponed && !renderOpts.experimental.isRoutePPREnabled) { + throw new Error('Invariant: page postponed without PPR being enabled'); + } + if (cacheControl.revalidate === 0) { + if (isDynamicError) { + throw new Error(`Page with dynamic = "error" encountered dynamic data method on ${path}.`); + } + const { staticBailoutInfo = {} } = metadata; + if (debugOutput && (staticBailoutInfo == null ? void 0 : staticBailoutInfo.description)) { + logDynamicUsageWarning({ + path, + description: staticBailoutInfo.description, + stack: staticBailoutInfo.stack + }); + } + return { + cacheControl, + fetchMetrics + }; + } + // If page data isn't available, it means that the page couldn't be rendered + // properly so long as we don't have unknown route params. When a route doesn't + // have unknown route params, there will not be any flight data. + let hasStaticRsc = false; + if (!flightData) { + if (!fallbackRouteParams || fallbackRouteParams.size === 0 || renderOpts.cacheComponents) { + throw new Error(`Invariant: failed to get page data for ${path}`); + } + } else { + const hasFallbackParams = fallbackRouteParams != null && fallbackRouteParams.size > 0; + const shouldWriteRsc = !renderOpts.experimental.isRoutePPREnabled || !postponed && !hasFallbackParams; + hasStaticRsc = shouldWriteRsc; + // With PPR enabled, we normally skip writing .rsc because it may contain + // dynamic data. However, for fully static outputs (no postponed state and + // no fallback params), we can safely emit the route .rsc to support + // static navigations. + if (shouldWriteRsc) { + fileWriter.append(htmlFilepath.replace(/\.html$/, _constants.RSC_SUFFIX), flightData); + } + } + let segmentPaths; + if (segmentData) { + // Emit the per-segment prefetch data. We emit them as separate files + // so that the cache handler has the option to treat each as a + // separate entry. + segmentPaths = []; + const segmentsDir = htmlFilepath.replace(/\.html$/, _constants.RSC_SEGMENTS_DIR_SUFFIX); + for (const [segmentPath, buffer] of segmentData){ + segmentPaths.push(segmentPath); + const segmentDataFilePath = segmentsDir + segmentPath + _constants.RSC_SEGMENT_SUFFIX; + fileWriter.append(segmentDataFilePath, buffer); + } + } + const headers = { + ...metadata.headers + }; + // If we're writing the file to disk, we know it's a prerender. + headers[_approuterheaders.NEXT_IS_PRERENDER_HEADER] = '1'; + if (fetchTags) { + headers[_constants.NEXT_CACHE_TAGS_HEADER] = fetchTags; + } + // Writing static HTML to a file. + fileWriter.append(htmlFilepath, html); + const isParallelRoute = /\/@\w+/.test(page); + const isNonSuccessfulStatusCode = res.statusCode > 300; + // When PPR is enabled, we don't always send 200 for routes that have been + // pregenerated, so we should grab the status code from the mocked + // response. + let status = renderOpts.experimental.isRoutePPREnabled ? res.statusCode : undefined; + if (isDefaultNotFound) { + // Override the default /_not-found page status code to 404 + status = 404; + } else if (isDefaultGlobalError) { + // Override the default /_global-error page status code to 500 + status = 500; + } else if (isNonSuccessfulStatusCode && !isParallelRoute) { + // If it's parallel route the status from mock response is 404 + status = res.statusCode; + } + // Writing the request metadata to a file. + const meta = { + status, + headers, + postponed, + segmentPaths, + prefetchHints, + routeCache + }; + fileWriter.append(htmlFilepath.replace(/\.html$/, _constants.NEXT_META_SUFFIX), JSON.stringify(meta, null, 2)); + let serializedRenderResumeDataCache; + if (renderResumeDataCache) { + serializedRenderResumeDataCache = await (0, _resumedatacache.stringifyResumeDataCache)(renderResumeDataCache, renderOpts.cacheComponents); + if (!renderOpts.experimental.disableResumeDataCacheCompression) { + serializedRenderResumeDataCache = (0, _resumedatacache.deflateResumeDataCache)(serializedRenderResumeDataCache); + } + } + return { + // Filter the metadata if the environment does not have next support. + metadata: _ciinfo.hasNextSupport ? meta : { + segmentPaths: meta.segmentPaths, + prefetchHints: meta.prefetchHints + }, + hasEmptyStaticShell: Boolean(postponed) && html === '', + hasPostponed: Boolean(postponed), + hasPendingUi: hasPendingUi ?? false, + htmlSize: Buffer.byteLength(html), + hasStaticRsc, + cacheControl, + fetchMetrics, + renderResumeDataCache: serializedRenderResumeDataCache + }; + } catch (err) { + if (!(0, _isdynamicusageerror.isDynamicUsageError)(err)) { + throw err; + } + // We should fail rendering if a client side rendering bailout + // occurred at the page level. + if ((0, _bailouttocsr.isBailoutToCSRError)(err)) { + throw err; + } + let fetchMetrics; + if (debugOutput) { + const store = renderOpts.store; + const { dynamicUsageDescription, dynamicUsageStack } = store; + fetchMetrics = store.fetchMetrics; + logDynamicUsageWarning({ + path, + description: dynamicUsageDescription ?? '', + stack: dynamicUsageStack + }); + } + return { + cacheControl: { + revalidate: 0, + expire: undefined + }, + fetchMetrics + }; + } +} +function logDynamicUsageWarning({ path, description, stack }) { + const errMessage = new Error(`Static generation failed due to dynamic usage on ${path}, reason: ${description}`); + if (stack) { + errMessage.stack = errMessage.message + stack.substring(stack.indexOf('\n')); + } + console.warn(errMessage); +} + +//# sourceMappingURL=app-page.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/routes/app-page.js.map b/e-commerce/node_modules/next/dist/export/routes/app-page.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b1ee144c5bc6f560becaac0170295c4d0198e20b --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/routes/app-page.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/export/routes/app-page.ts"],"sourcesContent":["import type { OutgoingHttpHeaders } from 'node:http'\nimport type { ExportRouteResult } from '../types'\nimport type { RenderOpts } from '../../server/app-render/types'\nimport type { NextParsedUrlQuery } from '../../server/request-meta'\nimport type { RouteCacheMetadata, RouteMetadata } from './types'\n\nimport type {\n MockedRequest,\n MockedResponse,\n} from '../../server/lib/mock-request'\nimport { isDynamicUsageError } from '../helpers/is-dynamic-usage-error'\nimport {\n NEXT_CACHE_TAGS_HEADER,\n NEXT_META_SUFFIX,\n RSC_SUFFIX,\n RSC_SEGMENTS_DIR_SUFFIX,\n RSC_SEGMENT_SUFFIX,\n} from '../../lib/constants'\nimport { hasNextSupport } from '../../server/ci-info'\nimport { lazyPrerenderAppPage } from '../../server/route-modules/app-page/module.render'\nimport {\n parseRequestHeaders,\n type ParsedRequestHeaders,\n} from '../../server/route-modules/app-page/parse-request-headers'\nimport { isBailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr'\nimport { NodeNextRequest, NodeNextResponse } from '../../server/base-http/node'\nimport { NEXT_IS_PRERENDER_HEADER } from '../../client/components/app-router-headers'\nimport type { FetchMetrics } from '../../server/base-http'\nimport type { WorkStore } from '../../server/app-render/work-async-storage.external'\nimport type { OpaqueFallbackRouteParams } from '../../server/request/fallback-params'\nimport { AfterRunner } from '../../server/after/run-with-after'\nimport type { RequestLifecycleOpts } from '../../server/base-server'\nimport type { AppSharedContext } from '../../server/app-render/app-render'\nimport type { RouteMatch } from '../../server/route-modules/app-page/module'\nimport type { MultiFileWriter } from '../../lib/multi-file-writer'\nimport {\n deflateResumeDataCache,\n stringifyResumeDataCache,\n} from '../../server/resume-data-cache/resume-data-cache'\nimport {\n UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY,\n UNDERSCORE_NOT_FOUND_ROUTE_ENTRY,\n} from '../../shared/lib/entry-constants'\n\n/**\n * Renders & exports a page associated with the /app directory\n */\nexport async function exportAppPage(\n req: MockedRequest,\n res: MockedResponse,\n page: string,\n path: string,\n pathname: string,\n query: NextParsedUrlQuery,\n fallbackRouteParams: OpaqueFallbackRouteParams | null,\n partialRenderOpts: Omit<RenderOpts, keyof RequestLifecycleOpts>,\n htmlFilepath: string,\n debugOutput: boolean,\n isDynamicError: boolean,\n fileWriter: MultiFileWriter,\n sharedContext: AppSharedContext,\n routeMatch: RouteMatch,\n routeCache?: RouteCacheMetadata\n): Promise<ExportRouteResult> {\n const afterRunner = new AfterRunner()\n\n const renderOpts: RenderOpts = {\n ...partialRenderOpts,\n waitUntil: afterRunner.context.waitUntil,\n onClose: afterRunner.context.onClose,\n onAfterTaskError: afterRunner.context.onTaskError,\n }\n\n let isDefaultNotFound = false\n let isDefaultGlobalError = false\n // If the page is `/_not-found`, then we should update the page to be `/404`.\n if (page === UNDERSCORE_NOT_FOUND_ROUTE_ENTRY) {\n isDefaultNotFound = true\n pathname = '/404'\n }\n // If the page is `/_global-error`, then we should update the page to be `/500`.\n if (page === UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY) {\n isDefaultGlobalError = true\n pathname = '/500'\n }\n\n try {\n const nextReq = new NodeNextRequest(req)\n const parsedRequestHeaders: ParsedRequestHeaders = parseRequestHeaders(\n nextReq.headers,\n {\n isRoutePPREnabled: renderOpts.experimental.isRoutePPREnabled === true,\n previewModeId: renderOpts.previewProps?.previewModeId,\n }\n )\n const result = await lazyPrerenderAppPage(\n nextReq,\n new NodeNextResponse(res),\n pathname,\n query,\n fallbackRouteParams,\n renderOpts,\n undefined, // dev\n sharedContext,\n routeMatch,\n parsedRequestHeaders\n )\n\n if ('error' in result) {\n throw result.error\n }\n\n const html = result.toUnchunkedString()\n\n // TODO(after): if we abort a prerender because of an error in an after-callback\n // we should probably communicate that better (and not log the error twice)\n await afterRunner.executeAfter()\n\n const { metadata } = result\n const {\n flightData,\n cacheControl = { revalidate: false, expire: undefined },\n postponed,\n fetchTags,\n fetchMetrics,\n segmentData,\n prefetchHints,\n renderResumeDataCache,\n hasPendingUi,\n } = metadata\n\n // Ensure we don't postpone without having PPR enabled.\n if (postponed && !renderOpts.experimental.isRoutePPREnabled) {\n throw new Error('Invariant: page postponed without PPR being enabled')\n }\n\n if (cacheControl.revalidate === 0) {\n if (isDynamicError) {\n throw new Error(\n `Page with dynamic = \"error\" encountered dynamic data method on ${path}.`\n )\n }\n const { staticBailoutInfo = {} } = metadata\n\n if (debugOutput && staticBailoutInfo?.description) {\n logDynamicUsageWarning({\n path,\n description: staticBailoutInfo.description,\n stack: staticBailoutInfo.stack,\n })\n }\n\n return { cacheControl, fetchMetrics }\n }\n\n // If page data isn't available, it means that the page couldn't be rendered\n // properly so long as we don't have unknown route params. When a route doesn't\n // have unknown route params, there will not be any flight data.\n let hasStaticRsc = false\n\n if (!flightData) {\n if (\n !fallbackRouteParams ||\n fallbackRouteParams.size === 0 ||\n renderOpts.cacheComponents\n ) {\n throw new Error(`Invariant: failed to get page data for ${path}`)\n }\n } else {\n const hasFallbackParams =\n fallbackRouteParams != null && fallbackRouteParams.size > 0\n const shouldWriteRsc =\n !renderOpts.experimental.isRoutePPREnabled ||\n (!postponed && !hasFallbackParams)\n hasStaticRsc = shouldWriteRsc\n\n // With PPR enabled, we normally skip writing .rsc because it may contain\n // dynamic data. However, for fully static outputs (no postponed state and\n // no fallback params), we can safely emit the route .rsc to support\n // static navigations.\n if (shouldWriteRsc) {\n fileWriter.append(\n htmlFilepath.replace(/\\.html$/, RSC_SUFFIX),\n flightData\n )\n }\n }\n\n let segmentPaths\n if (segmentData) {\n // Emit the per-segment prefetch data. We emit them as separate files\n // so that the cache handler has the option to treat each as a\n // separate entry.\n segmentPaths = []\n const segmentsDir = htmlFilepath.replace(\n /\\.html$/,\n RSC_SEGMENTS_DIR_SUFFIX\n )\n\n for (const [segmentPath, buffer] of segmentData) {\n segmentPaths.push(segmentPath)\n const segmentDataFilePath =\n segmentsDir + segmentPath + RSC_SEGMENT_SUFFIX\n fileWriter.append(segmentDataFilePath, buffer)\n }\n }\n\n const headers: OutgoingHttpHeaders = { ...metadata.headers }\n\n // If we're writing the file to disk, we know it's a prerender.\n headers[NEXT_IS_PRERENDER_HEADER] = '1'\n\n if (fetchTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = fetchTags\n }\n\n // Writing static HTML to a file.\n fileWriter.append(htmlFilepath, html)\n\n const isParallelRoute = /\\/@\\w+/.test(page)\n const isNonSuccessfulStatusCode = res.statusCode > 300\n\n // When PPR is enabled, we don't always send 200 for routes that have been\n // pregenerated, so we should grab the status code from the mocked\n // response.\n let status: number | undefined = renderOpts.experimental.isRoutePPREnabled\n ? res.statusCode\n : undefined\n\n if (isDefaultNotFound) {\n // Override the default /_not-found page status code to 404\n status = 404\n } else if (isDefaultGlobalError) {\n // Override the default /_global-error page status code to 500\n status = 500\n } else if (isNonSuccessfulStatusCode && !isParallelRoute) {\n // If it's parallel route the status from mock response is 404\n status = res.statusCode\n }\n\n // Writing the request metadata to a file.\n const meta: RouteMetadata = {\n status,\n headers,\n postponed,\n segmentPaths,\n prefetchHints,\n routeCache,\n }\n\n fileWriter.append(\n htmlFilepath.replace(/\\.html$/, NEXT_META_SUFFIX),\n JSON.stringify(meta, null, 2)\n )\n\n let serializedRenderResumeDataCache: string | undefined\n if (renderResumeDataCache) {\n serializedRenderResumeDataCache = await stringifyResumeDataCache(\n renderResumeDataCache,\n renderOpts.cacheComponents\n )\n if (!renderOpts.experimental.disableResumeDataCacheCompression) {\n serializedRenderResumeDataCache = deflateResumeDataCache(\n serializedRenderResumeDataCache\n )\n }\n }\n\n return {\n // Filter the metadata if the environment does not have next support.\n metadata: hasNextSupport\n ? meta\n : {\n segmentPaths: meta.segmentPaths,\n prefetchHints: meta.prefetchHints,\n },\n hasEmptyStaticShell: Boolean(postponed) && html === '',\n hasPostponed: Boolean(postponed),\n hasPendingUi: hasPendingUi ?? false,\n htmlSize: Buffer.byteLength(html),\n hasStaticRsc,\n cacheControl,\n fetchMetrics,\n renderResumeDataCache: serializedRenderResumeDataCache,\n }\n } catch (err) {\n if (!isDynamicUsageError(err)) {\n throw err\n }\n\n // We should fail rendering if a client side rendering bailout\n // occurred at the page level.\n if (isBailoutToCSRError(err)) {\n throw err\n }\n\n let fetchMetrics: FetchMetrics | undefined\n\n if (debugOutput) {\n const store = (renderOpts as any).store as WorkStore\n const { dynamicUsageDescription, dynamicUsageStack } = store\n fetchMetrics = store.fetchMetrics\n\n logDynamicUsageWarning({\n path,\n description: dynamicUsageDescription ?? '',\n stack: dynamicUsageStack,\n })\n }\n\n return { cacheControl: { revalidate: 0, expire: undefined }, fetchMetrics }\n }\n}\n\nfunction logDynamicUsageWarning({\n path,\n description,\n stack,\n}: {\n path: string\n description: string\n stack?: string\n}) {\n const errMessage = new Error(\n `Static generation failed due to dynamic usage on ${path}, reason: ${description}`\n )\n\n if (stack) {\n errMessage.stack = errMessage.message + stack.substring(stack.indexOf('\\n'))\n }\n\n console.warn(errMessage)\n}\n"],"names":["exportAppPage","req","res","page","path","pathname","query","fallbackRouteParams","partialRenderOpts","htmlFilepath","debugOutput","isDynamicError","fileWriter","sharedContext","routeMatch","routeCache","afterRunner","AfterRunner","renderOpts","waitUntil","context","onClose","onAfterTaskError","onTaskError","isDefaultNotFound","isDefaultGlobalError","UNDERSCORE_NOT_FOUND_ROUTE_ENTRY","UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY","nextReq","NodeNextRequest","parsedRequestHeaders","parseRequestHeaders","headers","isRoutePPREnabled","experimental","previewModeId","previewProps","result","lazyPrerenderAppPage","NodeNextResponse","undefined","error","html","toUnchunkedString","executeAfter","metadata","flightData","cacheControl","revalidate","expire","postponed","fetchTags","fetchMetrics","segmentData","prefetchHints","renderResumeDataCache","hasPendingUi","Error","staticBailoutInfo","description","logDynamicUsageWarning","stack","hasStaticRsc","size","cacheComponents","hasFallbackParams","shouldWriteRsc","append","replace","RSC_SUFFIX","segmentPaths","segmentsDir","RSC_SEGMENTS_DIR_SUFFIX","segmentPath","buffer","push","segmentDataFilePath","RSC_SEGMENT_SUFFIX","NEXT_IS_PRERENDER_HEADER","NEXT_CACHE_TAGS_HEADER","isParallelRoute","test","isNonSuccessfulStatusCode","statusCode","status","meta","NEXT_META_SUFFIX","JSON","stringify","serializedRenderResumeDataCache","stringifyResumeDataCache","disableResumeDataCacheCompression","deflateResumeDataCache","hasNextSupport","hasEmptyStaticShell","Boolean","hasPostponed","htmlSize","Buffer","byteLength","err","isDynamicUsageError","isBailoutToCSRError","store","dynamicUsageDescription","dynamicUsageStack","errMessage","message","substring","indexOf","console","warn"],"mappings":";;;;+BA+CsBA;;;eAAAA;;;qCArCc;2BAO7B;wBACwB;8BACM;qCAI9B;8BAC6B;sBACc;kCACT;8BAIb;iCAQrB;gCAIA;AAKA,eAAeA,cACpBC,GAAkB,EAClBC,GAAmB,EACnBC,IAAY,EACZC,IAAY,EACZC,QAAgB,EAChBC,KAAyB,EACzBC,mBAAqD,EACrDC,iBAA+D,EAC/DC,YAAoB,EACpBC,WAAoB,EACpBC,cAAuB,EACvBC,UAA2B,EAC3BC,aAA+B,EAC/BC,UAAsB,EACtBC,UAA+B;IAE/B,MAAMC,cAAc,IAAIC,yBAAW;IAEnC,MAAMC,aAAyB;QAC7B,GAAGV,iBAAiB;QACpBW,WAAWH,YAAYI,OAAO,CAACD,SAAS;QAC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,QAAQ7C;YACtBM,cAAcA,gBAAgB;YAC9ByC,UAAUC,OAAOC,UAAU,CAACzD;YAC5BoB;YACAf;YACAK;YACAG,uBAAuBkC;QACzB;IACF,EAAE,OAAOW,KAAK;QACZ,IAAI,CAACC,IAAAA,wCAAmB,EAACD,MAAM;YAC7B,MAAMA;QACR;QAEA,8DAA8D;QAC9D,8BAA8B;QAC9B,IAAIE,IAAAA,iCAAmB,EAACF,MAAM;YAC5B,MAAMA;QACR;QAEA,IAAIhD;QAEJ,IAAI1C,aAAa;YACf,MAAM6F,QAAQ,AAACrF,WAAmBqF,KAAK;YACvC,MAAM,EAAEC,uBAAuB,EAAEC,iBAAiB,EAAE,GAAGF;YACvDnD,eAAemD,MAAMnD,YAAY;YAEjCQ,uBAAuB;gBACrBxD;gBACAuD,aAAa6C,2BAA2B;gBACxC3C,OAAO4C;YACT;QACF;QAEA,OAAO;YAAE1D,cAAc;gBAAEC,YAAY;gBAAGC,QAAQT;YAAU;YAAGY;QAAa;IAC5E;AACF;AAEA,SAASQ,uBAAuB,EAC9BxD,IAAI,EACJuD,WAAW,EACXE,KAAK,EAKN;IACC,MAAM6C,aAAa,IAAIjD,MACrB,CAAC,iDAAiD,EAAErD,KAAK,UAAU,EAAEuD,aAAa;IAGpF,IAAIE,OAAO;QACT6C,WAAW7C,KAAK,GAAG6C,WAAWC,OAAO,GAAG9C,MAAM+C,SAAS,CAAC/C,MAAMgD,OAAO,CAAC;IACxE;IAEAC,QAAQC,IAAI,CAACL;AACf","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/routes/app-route.d.ts b/e-commerce/node_modules/next/dist/export/routes/app-route.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..115a14e880fa2b40fb559b8137bf316c18dabeb9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/routes/app-route.d.ts @@ -0,0 +1,13 @@ +import type { ExportRouteResult } from '../types'; +import type { RouteCacheMetadata } from './types'; +import type AppRouteRouteModule from '../../server/route-modules/app-route/module'; +import type { IncrementalCache } from '../../server/lib/incremental-cache'; +import type { MockedRequest, MockedResponse } from '../../server/lib/mock-request'; +import type { ExperimentalConfig } from '../../server/config-shared'; +import type { Params } from '../../server/request/params'; +import type { MultiFileWriter } from '../../lib/multi-file-writer'; +export declare const enum ExportedAppRouteFiles { + BODY = "BODY", + META = "META" +} +export declare function exportAppRoute(req: MockedRequest, res: MockedResponse, params: Params | undefined, page: string, module: AppRouteRouteModule, incrementalCache: IncrementalCache | undefined, cacheLifeProfiles: import('../../server/config-shared').ResolvedCacheLifeProfiles, htmlFilepath: string, fileWriter: MultiFileWriter, cacheComponents: boolean, staticPageGenerationTimeout: number, experimental: Required<Pick<ExperimentalConfig, 'authInterrupts' | 'useCacheTimeout' | 'durableUseCacheEntries'>>, buildId: string, deploymentId: string, routeCache?: RouteCacheMetadata): Promise<ExportRouteResult>; diff --git a/e-commerce/node_modules/next/dist/export/routes/app-route.js b/e-commerce/node_modules/next/dist/export/routes/app-route.js new file mode 100644 index 0000000000000000000000000000000000000000..6368e12695f4ca8223f55ddb99426aadfe506de8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/routes/app-route.js @@ -0,0 +1,147 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + ExportedAppRouteFiles: null, + exportAppRoute: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + ExportedAppRouteFiles: function() { + return ExportedAppRouteFiles; + }, + exportAppRoute: function() { + return exportAppRoute; + } +}); +const _constants = require("../../lib/constants"); +const _node = require("../../server/base-http/node"); +const _nextrequest = require("../../server/web/spec-extension/adapters/next-request"); +const _utils = require("../../server/web/utils"); +const _isdynamicusageerror = require("../helpers/is-dynamic-usage-error"); +const _isstaticgenenabled = require("../../server/route-modules/app-route/helpers/is-static-gen-enabled"); +const _ismetadataroute = require("../../lib/metadata/is-metadata-route"); +const _apppaths = require("../../shared/lib/router/utils/app-paths"); +const _runwithafter = require("../../server/after/run-with-after"); +var ExportedAppRouteFiles = /*#__PURE__*/ function(ExportedAppRouteFiles) { + ExportedAppRouteFiles["BODY"] = "BODY"; + ExportedAppRouteFiles["META"] = "META"; + return ExportedAppRouteFiles; +}({}); +async function exportAppRoute(req, res, params, page, module1, incrementalCache, cacheLifeProfiles, htmlFilepath, fileWriter, cacheComponents, staticPageGenerationTimeout, experimental, buildId, deploymentId, routeCache) { + // Ensure that the URL is absolute. + req.url = `http://localhost:3000${req.url}`; + // Adapt the request and response to the Next.js request and response. + const request = _nextrequest.NextRequestAdapter.fromNodeNextRequest(new _node.NodeNextRequest(req), (0, _nextrequest.signalFromNodeResponse)(res)); + const afterRunner = new _runwithafter.AfterRunner(); + // Create the context for the handler. This contains the params from + // the route and the context for the request. + const context = { + params, + previewProps: { + previewModeEncryptionKey: '', + previewModeId: '', + previewModeSigningKey: '' + }, + renderOpts: { + cacheComponents, + // app-route handlers don't run instant validation, so the level + // value is irrelevant here. + // TODO: move validationLevel and other global config out of renderOpts + validationLevel: 'warning', + experimental, + isBuildTimePrerendering: true, + incrementalCache, + waitUntil: afterRunner.context.waitUntil, + onClose: afterRunner.context.onClose, + onAfterTaskError: afterRunner.context.onTaskError, + cacheLifeProfiles, + staticPageGenerationTimeout + }, + sharedContext: { + buildId, + deploymentId + } + }; + try { + // The route file may be an async module (top-level await), so the + // userland module must be resolved before its exports can be inspected. + await module1.ensureUserland(); + const userland = module1.userland; + // we don't bail from the static optimization for + // metadata routes, since it's app-route we can always append /route suffix. + const routePath = (0, _apppaths.normalizeAppPath)(page) + '/route'; + const isPageMetadataRoute = (0, _ismetadataroute.isMetadataRoute)(routePath); + if (!(0, _isstaticgenenabled.isStaticGenEnabled)(userland) && !isPageMetadataRoute && // We don't disable static gen when cacheComponents is enabled because we + // expect that anything dynamic in the GET handler will make it dynamic + // and thus avoid the cache surprises that led to us removing static gen + // unless specifically opted into + cacheComponents !== true) { + return { + cacheControl: { + revalidate: 0, + expire: undefined + } + }; + } + const response = await module1.prerender(request, context); + const isValidStatus = response.status < 400 || response.status === 404; + if (!isValidStatus) { + return { + cacheControl: { + revalidate: 0, + expire: undefined + } + }; + } + const blob = await response.blob(); + // TODO(after): if we abort a prerender because of an error in an after-callback + // we should probably communicate that better (and not log the error twice) + await afterRunner.executeAfter(); + const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= _constants.INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate; + const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= _constants.INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire; + const headers = (0, _utils.toNodeOutgoingHttpHeaders)(response.headers); + const cacheTags = context.renderOpts.collectedTags; + if (cacheTags) { + headers[_constants.NEXT_CACHE_TAGS_HEADER] = cacheTags; + } + if (!headers['content-type'] && blob.type) { + headers['content-type'] = blob.type; + } + // Writing response body to a file. + const body = Buffer.from(await blob.arrayBuffer()); + fileWriter.append(htmlFilepath.replace(/\.html$/, _constants.NEXT_BODY_SUFFIX), body); + // Write the request metadata to a file. + const meta = { + status: response.status, + headers, + routeCache + }; + fileWriter.append(htmlFilepath.replace(/\.html$/, _constants.NEXT_META_SUFFIX), JSON.stringify(meta)); + return { + cacheControl: { + revalidate, + expire + }, + metadata: meta + }; + } catch (err) { + if (!(0, _isdynamicusageerror.isDynamicUsageError)(err)) { + throw err; + } + return { + cacheControl: { + revalidate: 0, + expire: undefined + } + }; + } +} + +//# sourceMappingURL=app-route.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/routes/app-route.js.map b/e-commerce/node_modules/next/dist/export/routes/app-route.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6ba75f87c9d2d3de19c0235ab544db251029fbf9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/routes/app-route.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/export/routes/app-route.ts"],"sourcesContent":["import type { ExportRouteResult } from '../types'\nimport type { RouteCacheMetadata } from './types'\nimport type AppRouteRouteModule from '../../server/route-modules/app-route/module'\nimport type { AppRouteRouteHandlerContext } from '../../server/route-modules/app-route/module'\nimport type { IncrementalCache } from '../../server/lib/incremental-cache'\n\nimport {\n INFINITE_CACHE,\n NEXT_BODY_SUFFIX,\n NEXT_CACHE_TAGS_HEADER,\n NEXT_META_SUFFIX,\n} from '../../lib/constants'\nimport { NodeNextRequest } from '../../server/base-http/node'\nimport {\n NextRequestAdapter,\n signalFromNodeResponse,\n} from '../../server/web/spec-extension/adapters/next-request'\nimport { toNodeOutgoingHttpHeaders } from '../../server/web/utils'\nimport type {\n MockedRequest,\n MockedResponse,\n} from '../../server/lib/mock-request'\nimport { isDynamicUsageError } from '../helpers/is-dynamic-usage-error'\nimport { isStaticGenEnabled } from '../../server/route-modules/app-route/helpers/is-static-gen-enabled'\nimport type { ExperimentalConfig } from '../../server/config-shared'\nimport { isMetadataRoute } from '../../lib/metadata/is-metadata-route'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport type { Params } from '../../server/request/params'\nimport { AfterRunner } from '../../server/after/run-with-after'\nimport type { MultiFileWriter } from '../../lib/multi-file-writer'\n\nexport const enum ExportedAppRouteFiles {\n BODY = 'BODY',\n META = 'META',\n}\n\nexport async function exportAppRoute(\n req: MockedRequest,\n res: MockedResponse,\n params: Params | undefined,\n page: string,\n module: AppRouteRouteModule,\n incrementalCache: IncrementalCache | undefined,\n cacheLifeProfiles: import('../../server/config-shared').ResolvedCacheLifeProfiles,\n htmlFilepath: string,\n fileWriter: MultiFileWriter,\n cacheComponents: boolean,\n staticPageGenerationTimeout: number,\n experimental: Required<\n Pick<\n ExperimentalConfig,\n 'authInterrupts' | 'useCacheTimeout' | 'durableUseCacheEntries'\n >\n >,\n buildId: string,\n deploymentId: string,\n routeCache?: RouteCacheMetadata\n): Promise<ExportRouteResult> {\n // Ensure that the URL is absolute.\n req.url = `http://localhost:3000${req.url}`\n\n // Adapt the request and response to the Next.js request and response.\n const request = NextRequestAdapter.fromNodeNextRequest(\n new NodeNextRequest(req),\n signalFromNodeResponse(res)\n )\n\n const afterRunner = new AfterRunner()\n\n // Create the context for the handler. This contains the params from\n // the route and the context for the request.\n const context: AppRouteRouteHandlerContext = {\n params,\n previewProps: {\n previewModeEncryptionKey: '',\n previewModeId: '',\n previewModeSigningKey: '',\n },\n renderOpts: {\n cacheComponents,\n // app-route handlers don't run instant validation, so the level\n // value is irrelevant here.\n // TODO: move validationLevel and other global config out of renderOpts\n validationLevel: 'warning',\n experimental,\n isBuildTimePrerendering: true,\n incrementalCache,\n waitUntil: afterRunner.context.waitUntil,\n onClose: afterRunner.context.onClose,\n onAfterTaskError: afterRunner.context.onTaskError,\n cacheLifeProfiles,\n staticPageGenerationTimeout,\n },\n sharedContext: {\n buildId,\n deploymentId,\n },\n }\n\n try {\n // The route file may be an async module (top-level await), so the\n // userland module must be resolved before its exports can be inspected.\n await module.ensureUserland()\n const userland = module.userland\n // we don't bail from the static optimization for\n // metadata routes, since it's app-route we can always append /route suffix.\n const routePath = normalizeAppPath(page) + '/route'\n const isPageMetadataRoute = isMetadataRoute(routePath)\n\n if (\n !isStaticGenEnabled(userland) &&\n !isPageMetadataRoute &&\n // We don't disable static gen when cacheComponents is enabled because we\n // expect that anything dynamic in the GET handler will make it dynamic\n // and thus avoid the cache surprises that led to us removing static gen\n // unless specifically opted into\n cacheComponents !== true\n ) {\n return { cacheControl: { revalidate: 0, expire: undefined } }\n }\n\n const response = await module.prerender(request, context)\n\n const isValidStatus = response.status < 400 || response.status === 404\n if (!isValidStatus) {\n return { cacheControl: { revalidate: 0, expire: undefined } }\n }\n\n const blob = await response.blob()\n\n // TODO(after): if we abort a prerender because of an error in an after-callback\n // we should probably communicate that better (and not log the error twice)\n await afterRunner.executeAfter()\n\n const revalidate =\n typeof context.renderOpts.collectedRevalidate === 'undefined' ||\n context.renderOpts.collectedRevalidate >= INFINITE_CACHE\n ? false\n : context.renderOpts.collectedRevalidate\n\n const expire =\n typeof context.renderOpts.collectedExpire === 'undefined' ||\n context.renderOpts.collectedExpire >= INFINITE_CACHE\n ? undefined\n : context.renderOpts.collectedExpire\n\n const headers = toNodeOutgoingHttpHeaders(response.headers)\n const cacheTags = context.renderOpts.collectedTags\n\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags\n }\n\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type\n }\n\n // Writing response body to a file.\n const body = Buffer.from(await blob.arrayBuffer())\n fileWriter.append(htmlFilepath.replace(/\\.html$/, NEXT_BODY_SUFFIX), body)\n\n // Write the request metadata to a file.\n const meta = { status: response.status, headers, routeCache }\n fileWriter.append(\n htmlFilepath.replace(/\\.html$/, NEXT_META_SUFFIX),\n JSON.stringify(meta)\n )\n\n return {\n cacheControl: { revalidate, expire },\n metadata: meta,\n }\n } catch (err) {\n if (!isDynamicUsageError(err)) {\n throw err\n }\n\n return { cacheControl: { revalidate: 0, expire: undefined } }\n }\n}\n"],"names":["ExportedAppRouteFiles","exportAppRoute","req","res","params","page","module","incrementalCache","cacheLifeProfiles","htmlFilepath","fileWriter","cacheComponents","staticPageGenerationTimeout","experimental","buildId","deploymentId","routeCache","url","request","NextRequestAdapter","fromNodeNextRequest","NodeNextRequest","signalFromNodeResponse","afterRunner","AfterRunner","context","previewProps","previewModeEncryptionKey","previewModeId","previewModeSigningKey","renderOpts","validationLevel","isBuildTimePrerendering","waitUntil","onClose","onAfterTaskError","onTaskError","sharedContext","ensureUserland","userland","routePath","normalizeAppPath","isPageMetadataRoute","isMetadataRoute","isStaticGenEnabled","cacheControl","revalidate","expire","undefined","response","prerender","isValidStatus","status","blob","executeAfter","collectedRevalidate","INFINITE_CACHE","collectedExpire","headers","toNodeOutgoingHttpHeaders","cacheTags","collectedTags","NEXT_CACHE_TAGS_HEADER","type","body","Buffer","from","arrayBuffer","append","replace","NEXT_BODY_SUFFIX","meta","NEXT_META_SUFF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AmC;QACnC,MAAMC,OAAOC,OAAOC,IAAI,CAAC,MAAMb,KAAKc,WAAW;QAC/CzD,WAAW0D,MAAM,CAAC3D,aAAa4D,OAAO,CAAC,WAAWC,2BAAgB,GAAGN;QAErE,wCAAwC;QACxC,MAAMO,OAAO;YAAEnB,QAAQH,SAASG,MAAM;YAAEM;YAAS1C;QAAW;QAC5DN,WAAW0D,MAAM,CACf3D,aAAa4D,OAAO,CAAC,WAAWG,2BAAgB,GAChDC,KAAKC,SAAS,CAACH;QAGjB,OAAO;YACL1B,cAAc;gBAAEC;gBAAYC;YAAO;YACnC4B,UAAUJ;QACZ;IACF,EAAE,OAAOK,KAAK;QACZ,IAAI,CAACC,IAAAA,wCAAmB,EAACD,MAAM;YAC7B,MAAMA;QACR;QAEA,OAAO;YAAE/B,cAAc;gBAAEC,YAAY;gBAAGC,QAAQC;YAAU;QAAE;IAC9D;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/routes/pages.d.ts b/e-commerce/node_modules/next/dist/export/routes/pages.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..736a5d24899e410012499d4f4c78e8e668b8a220 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/routes/pages.d.ts @@ -0,0 +1,12 @@ +import type { ExportRouteResult } from '../types'; +import type { RouteCacheMetadata } from './types'; +import type { PagesRenderContext, PagesSharedContext, RenderOpts } from '../../server/render'; +import type { LoadComponentsReturnType } from '../../server/load-components'; +import type { NextParsedUrlQuery } from '../../server/request-meta'; +import type { Params } from '../../server/request/params'; +import type { MockedRequest, MockedResponse } from '../../server/lib/mock-request'; +import type { MultiFileWriter } from '../../lib/multi-file-writer'; +/** + * Renders & exports a page associated with the /pages directory + */ +export declare function exportPagesPage(req: MockedRequest, res: MockedResponse, path: string, page: string, query: NextParsedUrlQuery, params: Params | undefined, htmlFilepath: string, htmlFilename: string, pagesDataDir: string, buildExport: boolean, isDynamic: boolean, sharedContext: PagesSharedContext, renderContext: PagesRenderContext, hasOrigQueryValues: boolean, renderOpts: RenderOpts, components: LoadComponentsReturnType, fileWriter: MultiFileWriter, routeCache?: RouteCacheMetadata): Promise<ExportRouteResult | undefined>; diff --git a/e-commerce/node_modules/next/dist/export/routes/pages.js b/e-commerce/node_modules/next/dist/export/routes/pages.js new file mode 100644 index 0000000000000000000000000000000000000000..c6772cc2f88d39fb755086eca5222b2b788164e2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/routes/pages.js @@ -0,0 +1,88 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "exportPagesPage", { + enumerable: true, + get: function() { + return exportPagesPage; + } +}); +const _renderresult = /*#__PURE__*/ _interop_require_default(require("../../server/render-result")); +const _path = require("path"); +const _constants = require("../../lib/constants"); +const _bailouttocsr = require("../../shared/lib/lazy-dynamic/bailout-to-csr"); +const _modulerender = require("../../server/route-modules/pages/module.render"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +async function exportPagesPage(req, res, path, page, query, params, htmlFilepath, htmlFilename, pagesDataDir, buildExport, isDynamic, sharedContext, renderContext, hasOrigQueryValues, renderOpts, components, fileWriter, routeCache) { + if (components.getServerSideProps) { + throw new Error(`Error for page ${page}: ${_constants.SERVER_PROPS_EXPORT_ERROR}`); + } + // for non-dynamic SSG pages we should have already + // prerendered the file + if (!buildExport && components.getStaticProps && !isDynamic) { + return; + } + // Pages router merges page params (e.g. [lang]) with query params + // primarily to support them both being accessible on `useRouter().query`. + // If we extracted dynamic params from the path, we need to merge them + // back into the query object. + const searchAndDynamicParams = { + ...query, + ...params + }; + if (components.getStaticProps && !htmlFilepath.endsWith('.html')) { + // make sure it ends with .html if the name contains a dot + htmlFilepath += '.html'; + htmlFilename += '.html'; + } + let renderResult; + if (typeof components.Component === 'string') { + renderResult = _renderresult.default.fromStatic(components.Component, _constants.HTML_CONTENT_TYPE_HEADER); + if (hasOrigQueryValues) { + throw new Error(`\nError: you provided query values for ${path} which is an auto-exported page. These can not be applied since the page can no longer be re-rendered on the server. To disable auto-export for this page add \`getInitialProps\`\n`); + } + } else { + /** + * This sets environment variable to be used at the time of SSR by head.tsx. + * Using this from process.env allows targeting SSR by calling + * `process.env.__NEXT_OPTIMIZE_CSS`. + */ if (renderOpts.optimizeCss) { + process.env.__NEXT_OPTIMIZE_CSS = JSON.stringify(true); + } + try { + renderResult = await (0, _modulerender.lazyRenderPagesPage)(req, res, page, searchAndDynamicParams, renderOpts, sharedContext, renderContext); + } catch (err) { + if (!(0, _bailouttocsr.isBailoutToCSRError)(err)) throw err; + } + } + const ssgNotFound = renderResult == null ? void 0 : renderResult.metadata.isNotFound; + const html = renderResult && !renderResult.isNull ? renderResult.toUnchunkedString() : ''; + const metadata = (renderResult == null ? void 0 : renderResult.metadata) || {}; + if (metadata.pageData && !ssgNotFound) { + const dataFile = (0, _path.join)(pagesDataDir, htmlFilename.replace(/\.html$/, _constants.NEXT_DATA_SUFFIX)); + fileWriter.append(dataFile, JSON.stringify(metadata.pageData)); + } + if (!ssgNotFound) { + // don't attempt writing to disk if getStaticProps returned not found + fileWriter.append(htmlFilepath, html); + if (routeCache) { + fileWriter.append(htmlFilepath.replace(/\.html$/, '.meta'), JSON.stringify({ + routeCache + })); + } + } + return { + cacheControl: metadata.cacheControl ?? { + revalidate: false, + expire: undefined + }, + ssgNotFound + }; +} + +//# sourceMappingURL=pages.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/routes/pages.js.map b/e-commerce/node_modules/next/dist/export/routes/pages.js.map new file mode 100644 index 0000000000000000000000000000000000000000..822981cb7c47c1878034c2b8965b162c09252355 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/routes/pages.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/export/routes/pages.ts"],"sourcesContent":["import type { ExportRouteResult } from '../types'\nimport type { RouteCacheMetadata } from './types'\nimport type {\n PagesRenderContext,\n PagesSharedContext,\n RenderOpts,\n} from '../../server/render'\nimport type { LoadComponentsReturnType } from '../../server/load-components'\nimport type { NextParsedUrlQuery } from '../../server/request-meta'\nimport type { Params } from '../../server/request/params'\n\nimport RenderResult from '../../server/render-result'\nimport { join } from 'path'\nimport type {\n MockedRequest,\n MockedResponse,\n} from '../../server/lib/mock-request'\nimport {\n HTML_CONTENT_TYPE_HEADER,\n NEXT_DATA_SUFFIX,\n SERVER_PROPS_EXPORT_ERROR,\n} from '../../lib/constants'\nimport { isBailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr'\nimport { lazyRenderPagesPage } from '../../server/route-modules/pages/module.render'\nimport type { MultiFileWriter } from '../../lib/multi-file-writer'\n\n/**\n * Renders & exports a page associated with the /pages directory\n */\nexport async function exportPagesPage(\n req: MockedRequest,\n res: MockedResponse,\n path: string,\n page: string,\n query: NextParsedUrlQuery,\n params: Params | undefined,\n htmlFilepath: string,\n htmlFilename: string,\n pagesDataDir: string,\n buildExport: boolean,\n isDynamic: boolean,\n sharedContext: PagesSharedContext,\n renderContext: PagesRenderContext,\n hasOrigQueryValues: boolean,\n renderOpts: RenderOpts,\n components: LoadComponentsReturnType,\n fileWriter: MultiFileWriter,\n routeCache?: RouteCacheMetadata\n): Promise<ExportRouteResult | undefined> {\n if (components.getServerSideProps) {\n throw new Error(`Error for page ${page}: ${SERVER_PROPS_EXPORT_ERROR}`)\n }\n\n // for non-dynamic SSG pages we should have already\n // prerendered the file\n if (!buildExport && components.getStaticProps && !isDynamic) {\n return\n }\n\n // Pages router merges page params (e.g. [lang]) with query params\n // primarily to support them both being accessible on `useRouter().query`.\n // If we extracted dynamic params from the path, we need to merge them\n // back into the query object.\n const searchAndDynamicParams = {\n ...query,\n ...params,\n }\n\n if (components.getStaticProps && !htmlFilepath.endsWith('.html')) {\n // make sure it ends with .html if the name contains a dot\n htmlFilepath += '.html'\n htmlFilename += '.html'\n }\n\n let renderResult: RenderResult | undefined\n\n if (typeof components.Component === 'string') {\n renderResult = RenderResult.fromStatic(\n components.Component,\n HTML_CONTENT_TYPE_HEADER\n )\n\n if (hasOrigQueryValues) {\n throw new Error(\n `\\nError: you provided query values for ${path} which is an auto-exported page. These can not be applied since the page can no longer be re-rendered on the server. To disable auto-export for this page add \\`getInitialProps\\`\\n`\n )\n }\n } else {\n /**\n * This sets environment variable to be used at the time of SSR by head.tsx.\n * Using this from process.env allows targeting SSR by calling\n * `process.env.__NEXT_OPTIMIZE_CSS`.\n */\n if (renderOpts.optimizeCss) {\n process.env.__NEXT_OPTIMIZE_CSS = JSON.stringify(true)\n }\n try {\n renderResult = await lazyRenderPagesPage(\n req,\n res,\n page,\n searchAndDynamicParams,\n renderOpts,\n sharedContext,\n renderContext\n )\n } catch (err) {\n if (!isBailoutToCSRError(err)) throw err\n }\n }\n\n const ssgNotFound = renderResult?.metadata.isNotFound\n\n const html =\n renderResult && !renderResult.isNull ? renderResult.toUnchunkedString() : ''\n\n const metadata = renderResult?.metadata || {}\n if (metadata.pageData && !ssgNotFound) {\n const dataFile = join(\n pagesDataDir,\n htmlFilename.replace(/\\.html$/, NEXT_DATA_SUFFIX)\n )\n\n fileWriter.append(dataFile, JSON.stringify(metadata.pageData))\n }\n\n if (!ssgNotFound) {\n // don't attempt writing to disk if getStaticProps returned not found\n fileWriter.append(htmlFilepath, html)\n if (routeCache) {\n fileWriter.append(\n htmlFilepath.replace(/\\.html$/, '.meta'),\n JSON.stringify({ routeCache })\n )\n }\n }\n\n return {\n cacheControl: metadata.cacheControl ?? {\n revalidate: false,\n expire: undefined,\n },\n ssgNotFound,\n }\n}\n"],"names":["exportPagesPage","req","res","path","page","query","params","htmlFilepath","htmlFilename","pagesDataDir","buildExport","isDynamic","sharedContext","renderContext","hasOrigQueryValues","renderOpts","components","fileWriter","routeCache","getServerSideProps","Error","SERVER_PROPS_EXPORT_ERROR","getStaticProps","searchAndDynamicParams","endsWith","renderResult","Component","RenderResult","fromStatic","HTML_CONTENT_TYPE_HEADER","optimizeCss","process","env","__NEXT_OPTIMIZE_CSS","JSON","stringify","lazyRenderPagesPage","err","isBailoutToCSRError","ssgNotFound","metadata","isNotFound","html","isNull","toUnchunkedString","pageData","dataFile","join","replace","NEXT_DATA_SUFFIX","append","cacheControl","revalidate","expire","undefined"],"mappings":";;;;+BA6BsBA;;;eAAAA;;;qEAlBG;sBACJ;2BASd;8BAC6B;8BACA;;;;;;AAM7B,eAAeA,gBACpBC,GAAkB,EAClBC,GAAmB,EACnBC,IAAY,EACZC,IAAY,EACZC,KAAyB,EACzBC,MAA0B,EAC1BC,YAAoB,EACpBC,YAAoB,EACpBC,YAAoB,EACpBC,WAAoB,EACpBC,SAAkB,EAClBC,aAAiC,EACjCC,aAAiC,EACjCC,kBAA2B,EAC3BC,UAAsB,EACtBC,UAAoC,EACpCC,UAA2B,EAC3BC,UAA+B;IAE/B,IAAIF,WAAWG,kBAAkB,EAAE;QACjC,MAAM,IAAIC,MAAM,CAAC,eAAe,EAAEhB,KAAK,EAAE,EAAEiB,oCAAyB,EAAE;IACxE;IAEA,mDAAmD;IACnD,uBAAuB;IACvB,IAAI,CAACX,eAAeM,WAAWM,cAAc,IAAI,CAACX,WAAW;QAC3D;IACF;IAEA,kEAAkE;IAClE,0EAA0E;IAC1E,sEAAsE;IACtE,8BAA8B;IAC9B,MAAMY,yBAAyB;QAC7B,GAAGlB,KAAK;QACR,GAAGC,MAAM;IACX;IAEA,IAAIU,WAAWM,cAAc,IAAI,CAACf,aAAaiB,QAAQ,CAAC,UAAU;QAChE,0DAA0D;QAC1DjB,gBAAgB;QAChBC,gBAAgB;IAClB;IAEA,IAAIiB;IAEJ,IAAI,OAAOT,WAAWU,SAAS,KAAK,UAAU;QAC5CD,eAAeE,qBAAY,CAACC,UAAU,CACpCZ,WAAWU,SAAS,EACpBG,mCAAwB;QAG1B,IAAIf,oBAAoB;YACtB,MAAM,IAAIM,MACR,CAAC,uCAAuC,EAAEjB,KAAK,mLAAmL,CAAC;QAEvO;IACF,OAAO;QACL;;;;KAIC,GACD,IAAIY,WAAWe,WAAW,EAAE;YAC1BC,QAAQC,GAAG,CAACC,mBAAmB,GAAGC,KAAKC,SAAS,CAAC;QACnD;QACA,IAAI;YACFV,eAAe,MAAMW,IAAAA,iCAAmB,EACtCnC,KACAC,KACAE,MACAmB,wBACAR,YACAH,eACAC;QAEJ,EAAE,OAAOwB,KAAK;YACZ,IAAI,CAACC,IAAAA,iCAAmB,EAACD,MAAM,MAAMA;QACvC;IACF;IAEA,MAAME,cAAcd,gCAAAA,aAAce,QAAQ,CAACC,UAAU;IAErD,MAAMC,OACJjB,gBAAgB,CAACA,aAAakB,MAAM,GAAGlB,aAAamB,iBAAiB,KAAK;IAE5E,MAAMJ,WAAWf,CAAAA,gCAAAA,aAAce,QAAQ,KAAI,CAAC;IAC5C,IAAIA,SAASK,QAAQ,IAAI,CAACN,aAAa;QACrC,MAAMO,WAAWC,IAAAA,UAAI,EACnBtC,cACAD,aAAawC,OAAO,CAAC,WAAWC,2BAAgB;QAGlDhC,WAAWiC,MAAM,CAACJ,UAAUZ,KAAKC,SAAS,CAACK,SAASK,QAAQ;IAC9D;IAEA,IAAI,CAACN,aAAa;QAChB,qEAAqE;QACrEtB,WAAWiC,MAAM,CAAC3C,cAAcmC;QAChC,IAAIxB,YAAY;YACdD,WAAWiC,MAAM,CACf3C,aAAayC,OAAO,CAAC,WAAW,UAChCd,KAAKC,SAAS,CAAC;gBAAEjB;YAAW;QAEhC;IACF;IAEA,OAAO;QACLiC,cAAcX,SAASW,YAAY,IAAI;YACrCC,YAAY;YACZC,QAAQC;QACV;QACAf;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/routes/types.d.ts b/e-commerce/node_modules/next/dist/export/routes/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5970d8ff90ce6e4a30fcc423a13151e6a760bca7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/routes/types.d.ts @@ -0,0 +1,25 @@ +import type { OutgoingHttpHeaders } from 'node:http'; +import type { PrefetchHints } from '../../shared/lib/app-router-types'; +import type { CacheControl } from '../../server/lib/cache-control'; +import type { ResponseCacheOwner } from '../../server/lib/route-cache-key'; +export type RouteCacheMetadata = { + key: string; + owner: ResponseCacheOwner; + isFallback: boolean; +}; +export type RouteMetadata = { + status: number | undefined; + headers: OutgoingHttpHeaders | undefined; + postponed: string | undefined; + segmentPaths: Array<string> | undefined; + prefetchHints: PrefetchHints | undefined; + /** + * The lifetime of an entry written by the incremental cache at runtime, so an + * instance that did not render it can serve it with the same Cache-Control. + */ + cacheControl?: CacheControl; + /** Identifies the response-cache entry represented by this build artifact. */ + routeCache?: RouteCacheMetadata; + /** Original payload mtime retained when a build seed is promoted. */ + routeCacheLastModified?: number; +}; diff --git a/e-commerce/node_modules/next/dist/export/routes/types.js b/e-commerce/node_modules/next/dist/export/routes/types.js new file mode 100644 index 0000000000000000000000000000000000000000..f89b9ccce54e89b62b432c4802c4612600a703d4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/routes/types.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); + +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/routes/types.js.map b/e-commerce/node_modules/next/dist/export/routes/types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ad48a910f81e5873737ebce8e9fa87278c9f7cd9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/routes/types.js.map @@ -0,0 +1 @@ +{"version":3,"sources":[],"names":[],"mappings":"","ignoreList":[]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/types.d.ts b/e-commerce/node_modules/next/dist/export/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..11f7d79a9d20cb392ca5719831aef6c056f151fc --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/types.d.ts @@ -0,0 +1,159 @@ +import type { RenderOptsPartial as AppRenderOptsPartial } from '../server/app-render/types'; +import type { RenderOptsPartial as PagesRenderOptsPartial } from '../server/render'; +import type { GenericComponentMod, LoadComponentsReturnType } from '../server/load-components'; +import type { OutgoingHttpHeaders } from 'http'; +import type { ExportPathMap, NextConfigComplete } from '../server/config-shared'; +import type { CacheControl } from '../server/lib/cache-control'; +import type { NextEnabledDirectories } from '../server/base-server'; +import type { SerializableTurborepoAccessTraceResult, TurborepoAccessTraceResult } from '../build/turborepo-access-trace'; +import type { FetchMetrics } from '../server/base-http'; +import type { RouteMetadata } from './routes/types'; +import type { RenderResumeDataCache } from '../server/resume-data-cache/resume-data-cache'; +import type { StaticWorker } from '../build'; +import type { Bundler } from '../lib/bundler'; +export type ExportPathEntry = ExportPathMap[keyof ExportPathMap] & { + path: string; +}; +export interface ExportPagesInput { + buildId: string; + deploymentId: string; + clientAssetToken: string; + exportPaths: ExportPathEntry[]; + parentSpanId: number; + dir: string; + distDir: string; + outDir: string; + pagesDataDir: string; + renderOpts: WorkerRenderOptsPartial; + nextConfig: NextConfigComplete; + cacheMaxMemorySize: NextConfigComplete['cacheMaxMemorySize']; + fetchCache: boolean | undefined; + cacheHandler: string | undefined; + fetchCacheKeyPrefix: string | undefined; + options: ExportAppOptions; + renderResumeDataCachesByPage: Record<string, string> | undefined; +} +export interface ExportPageInput { + buildId: string; + deploymentId: string; + clientAssetToken: string; + exportPath: ExportPathEntry; + distDir: string; + outDir: string; + pagesDataDir: string; + renderOpts: WorkerRenderOptsPartial; + trailingSlash?: boolean; + buildExport?: boolean; + subFolders?: boolean; + optimizeCss: any; + disableOptimizedLoading: any; + parentSpanId: number; + httpAgentOptions: NextConfigComplete['httpAgentOptions']; + debugOutput?: boolean; + nextConfigOutput?: NextConfigComplete['output']; + /** Write build-time response artifacts to their route-scoped cache keys. */ + useScopedBuildArtifacts: boolean; + enableExperimentalReact?: boolean; + sriEnabled: boolean; + renderResumeDataCache: RenderResumeDataCache | undefined; +} +export type ExportRouteResult = { + cacheControl: CacheControl; + metadata?: Partial<RouteMetadata>; + ssgNotFound?: boolean; + hasEmptyStaticShell?: boolean; + hasPostponed?: boolean; + hasPendingUi?: boolean; + htmlSize?: number; + hasStaticRsc?: boolean; + fetchMetrics?: FetchMetrics; + renderResumeDataCache?: string; +} | { + error: boolean; +}; +export type ExportPageResult = ExportRouteResult & { + duration: number; + turborepoAccessTraceResult?: SerializableTurborepoAccessTraceResult; +}; +export type ExportPagesResult = { + result: ExportPageResult | undefined; + path: string; + page: string; + pageKey: string; +}[]; +export type WorkerRenderOptsPartial = PagesRenderOptsPartial & AppRenderOptsPartial; +export type WorkerRenderOpts<NextModule extends GenericComponentMod = GenericComponentMod> = WorkerRenderOptsPartial & LoadComponentsReturnType<NextModule>; +export interface ExportAppOptions { + staticWorker?: StaticWorker; + outdir: string; + enabledDirectories: NextEnabledDirectories; + silent?: boolean; + debugOutput?: boolean; + debugPrerender?: boolean; + pages?: string[]; + buildExport: boolean; + statusMessage?: string; + nextConfig?: NextConfigComplete; + hasOutdirFromCli?: boolean; + numWorkers: number; + appDirOnly: boolean; + bundler: Bundler; +} +export type ExportPageMetadata = { + revalidate: number | false; + metadata: { + status?: number | undefined; + headers?: OutgoingHttpHeaders | undefined; + } | undefined; + duration: number; +}; +export type ExportAppResult = { + /** + * Page information keyed by path. + */ + byPath: Map<string, { + /** + * The cache control for the page. + */ + cacheControl?: CacheControl; + /** + * The metadata for the page. + */ + metadata?: Partial<RouteMetadata>; + /** + * If the page has an empty static shell when using PPR. + */ + hasEmptyStaticShell?: boolean; + /** + * If the page has postponed when using PPR. + */ + hasPostponed?: boolean; + /** + * If the prerender has UI that will resolve after the initial HTML. + */ + hasPendingUi?: boolean; + /** + * The byte size of the HTML returned by the prerender. + */ + htmlSize?: number; + /** + * If the page emitted a static RSC payload. + */ + hasStaticRsc?: boolean; + fetchMetrics?: FetchMetrics; + }>; + /** + * Durations for each page in milliseconds. + */ + byPage: Map<string, { + durationsByPath: Map<string, number>; + }>; + /** + * The paths that were not found during SSG. + */ + ssgNotFoundPaths: Set<string>; + /** + * Traced dependencies for each page. + */ + turborepoAccessTraceResults: Map<string, TurborepoAccessTraceResult>; +}; diff --git a/e-commerce/node_modules/next/dist/export/types.js b/e-commerce/node_modules/next/dist/export/types.js new file mode 100644 index 0000000000000000000000000000000000000000..f89b9ccce54e89b62b432c4802c4612600a703d4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/types.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); + +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/types.js.map b/e-commerce/node_modules/next/dist/export/types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ad48a910f81e5873737ebce8e9fa87278c9f7cd9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/types.js.map @@ -0,0 +1 @@ +{"version":3,"sources":[],"names":[],"mappings":"","ignoreList":[]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/utils.d.ts b/e-commerce/node_modules/next/dist/export/utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f8d2d7b2e61372a1bbe9235690edd25d5fd8b093 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/utils.d.ts @@ -0,0 +1,3 @@ +import type { NextConfigComplete } from '../server/config-shared'; +export declare function hasCustomExportOutput(config: NextConfigComplete): boolean; +export declare function getBuildDistDir(config: NextConfigComplete): string; diff --git a/e-commerce/node_modules/next/dist/export/utils.js b/e-commerce/node_modules/next/dist/export/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..7e8542943a325d65d1ece3b19b949b7b310449fa --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/utils.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + getBuildDistDir: null, + hasCustomExportOutput: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + getBuildDistDir: function() { + return getBuildDistDir; + }, + hasCustomExportOutput: function() { + return hasCustomExportOutput; + } +}); +function hasCustomExportOutput(config) { + // In the past, a user had to run "next build" to generate + // ".next" (or whatever the distDir) followed by "next export" + // to generate "out" (or whatever the outDir). However, when + // "output: export" is configured, "next build" does both steps. + // In this mode, a custom distDir names the export destination. + return config.output === 'export' && config.distDir !== '.next'; +} +function getBuildDistDir(config) { + // A custom distDir is the export destination in this mode. Build artifacts + // and manifests still live in .next until they are exported. + return hasCustomExportOutput(config) ? '.next' : config.distDir; +} + +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/utils.js.map b/e-commerce/node_modules/next/dist/export/utils.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ab842ac223fb51649552f2a0bd26cea9a8e7b37e --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/utils.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/export/utils.ts"],"sourcesContent":["import type { NextConfigComplete } from '../server/config-shared'\n\nexport function hasCustomExportOutput(config: NextConfigComplete) {\n // In the past, a user had to run \"next build\" to generate\n // \".next\" (or whatever the distDir) followed by \"next export\"\n // to generate \"out\" (or whatever the outDir). However, when\n // \"output: export\" is configured, \"next build\" does both steps.\n // In this mode, a custom distDir names the export destination.\n return config.output === 'export' && config.distDir !== '.next'\n}\n\nexport function getBuildDistDir(config: NextConfigComplete): string {\n // A custom distDir is the export destination in this mode. Build artifacts\n // and manifests still live in .next until they are exported.\n return hasCustomExportOutput(config) ? '.next' : config.distDir\n}\n"],"names":["getBuildDistDir","hasCustomExportOutput","config","output","distDir"],"mappings":";;;;;;;;;;;;;;;IAWgBA,eAAe;eAAfA;;IATAC,qBAAqB;eAArBA;;;AAAT,SAASA,sBAAsBC,MAA0B;IAC9D,0DAA0D;IAC1D,8DAA8D;IAC9D,4DAA4D;IAC5D,gEAAgE;IAChE,+DAA+D;IAC/D,OAAOA,OAAOC,MAAM,KAAK,YAAYD,OAAOE,OAAO,KAAK;AAC1D;AAEO,SAASJ,gBAAgBE,MAA0B;IACxD,2EAA2E;IAC3E,6DAA6D;IAC7D,OAAOD,sBAAsBC,UAAU,UAAUA,OAAOE,OAAO;AACjE","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/worker.d.ts b/e-commerce/node_modules/next/dist/export/worker.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ce49d8177a456489159338fd4f344844d55fde38 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/worker.d.ts @@ -0,0 +1,3 @@ +import type { ExportPagesInput, ExportPagesResult } from './types'; +import '../server/node-environment'; +export declare function exportPages(input: ExportPagesInput): Promise<ExportPagesResult>; diff --git a/e-commerce/node_modules/next/dist/export/worker.js b/e-commerce/node_modules/next/dist/export/worker.js new file mode 100644 index 0000000000000000000000000000000000000000..ad3c5d9f22b812378601d5b4603bede4485fbe32 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/worker.js @@ -0,0 +1,456 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "exportPages", { + enumerable: true, + get: function() { + return exportPages; + } +}); +const _routecachekey = require("../server/lib/route-cache-key"); +require("../server/node-environment"); +const _installbindings = require("../build/swc/install-bindings"); +const _installcodeframe = require("../server/lib/install-code-frame"); +const _path = require("path"); +const _promises = /*#__PURE__*/ _interop_require_default(require("fs/promises")); +const _loadcomponents = require("../server/load-components"); +const _isdynamic = require("../shared/lib/router/utils/is-dynamic"); +const _normalizepagepath = require("../shared/lib/page-path/normalize-page-path"); +const _normalizelocalepath = require("../shared/lib/i18n/normalize-locale-path"); +const _trace = require("../trace"); +const _setuphttpagentenv = require("../server/setup-http-agent-env"); +const _requestmeta = require("../server/request-meta"); +const _apppaths = require("../shared/lib/router/utils/app-paths"); +const _removetrailingslash = require("../shared/lib/router/utils/remove-trailing-slash"); +const _mockrequest = require("../server/lib/mock-request"); +const _isapprouteroute = require("../lib/is-app-route-route"); +const _ciinfo = require("../server/ci-info"); +const _approute = require("./routes/app-route"); +const _apppage = require("./routes/app-page"); +const _pages = require("./routes/pages"); +const _getparams = require("./helpers/get-params"); +const _createincrementalcache = require("./helpers/create-incremental-cache"); +const _isdynamicusageerror = require("./helpers/is-dynamic-usage-error"); +const _bailouttocsr = require("../shared/lib/lazy-dynamic/bailout-to-csr"); +const _turborepoaccesstrace = require("../build/turborepo-access-trace"); +const _fallbackparams = require("../server/request/fallback-params"); +const _needsexperimentalreact = require("../lib/needs-experimental-react"); +const _staticgenerationbailout = require("../client/components/static-generation-bailout"); +const _multifilewriter = require("../lib/multi-file-writer"); +const _resumedatacache = require("../server/resume-data-cache/resume-data-cache"); +const _globalbehaviors = require("../server/node-environment-extensions/global-behaviors"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +process.env.NEXT_IS_EXPORT_WORKER = 'true'; +globalThis.__NEXT_DATA__ = { + nextExport: true +}; +class TimeoutError extends Error { + constructor(...args){ + super(...args), this.code = 'NEXT_EXPORT_TIMEOUT_ERROR'; + } +} +class ExportPageError extends Error { + constructor(...args){ + super(...args), this.code = 'NEXT_EXPORT_PAGE_ERROR'; + } +} +async function exportPageImpl(input, fileWriter) { + var _req_url; + const { exportPath, distDir, pagesDataDir, buildExport = false, subFolders = false, optimizeCss, disableOptimizedLoading, debugOutput = false, enableExperimentalReact, trailingSlash, sriEnabled, renderOpts: commonRenderOpts, outDir: commonOutDir, buildId, deploymentId, clientAssetToken, renderResumeDataCache, useScopedBuildArtifacts } = input; + if (enableExperimentalReact) { + process.env.__NEXT_EXPERIMENTAL_REACT = 'true'; + } + const { path, page, // The parameters that are currently unknown. + _fallbackRouteParams = [], _notFoundParams: notFoundParams, // Check if this is an `app/` page. + _isAppDir: isAppDir = false, // Check if this should error when dynamic usage is detected. + _isDynamicError: isDynamicError = false, // If this page supports partial prerendering, then we need to pass that to + // the renderOpts. + _isRoutePPREnabled: isRoutePPREnabled, // Configure the rendering of the page to allow that an empty static shell + // is generated while rendering using PPR and Cache Components. + _allowEmptyStaticShell: allowEmptyStaticShell = false, // When true, attempt to run build-time instant validation for this export path. + _runInstantValidation: runInstantValidation = false, // When true, a fallback shell for this path could later be upgraded to a + // concrete version (it has a `generateStaticParams` candidate param). + _isFallbackUpgradeable: isFallbackUpgradeable = false, // Pull the original query out. + query: originalQuery = {} } = exportPath; + const fallbackRouteParams = (0, _fallbackparams.createOpaqueFallbackRouteParams)(_fallbackRouteParams); + let query = { + ...originalQuery + }; + const pathname = (0, _apppaths.normalizeAppPath)(page); + const isDynamic = (0, _isdynamic.isDynamicRoute)(page); + const outDir = isAppDir ? (0, _path.join)(distDir, 'server/app') : commonOutDir; + const filePath = (0, _normalizepagepath.normalizePagePath)(path); + let updatedPath = exportPath._ssgPath || path; + let locale = exportPath._locale || commonRenderOpts.locale; + if (commonRenderOpts.locale) { + const localePathResult = (0, _normalizelocalepath.normalizeLocalePath)(path, commonRenderOpts.locales); + if (localePathResult.detectedLocale) { + updatedPath = localePathResult.pathname; + locale = localePathResult.detectedLocale; + } + } + // We need to show a warning if they try to provide query values + // for an auto-exported page since they won't be available + const hasOrigQueryValues = Object.keys(originalQuery).length > 0; + // Check if the page is a specified dynamic route + const { pathname: nonLocalizedPath } = (0, _normalizelocalepath.normalizeLocalePath)(path, commonRenderOpts.locales); + let params; + if (isDynamic && page !== nonLocalizedPath) { + const normalizedPage = isAppDir ? (0, _apppaths.normalizeAppPath)(page) : page; + params = (0, _getparams.getParams)(normalizedPage, updatedPath); + } + const { req, res } = (0, _mockrequest.createRequestResponseMocks)({ + url: updatedPath + }); + // If this is a status code page, then set the response code. + for (const statusCode of [ + 404, + 500 + ]){ + if ([ + `/${statusCode}`, + `/${statusCode}.html`, + `/${statusCode}/index.html` + ].some((p)=>p === updatedPath || `/${locale}${p}` === updatedPath)) { + res.statusCode = statusCode; + } + } + // Ensure that the URL has a trailing slash if it's configured. + if (trailingSlash && !((_req_url = req.url) == null ? void 0 : _req_url.endsWith('/'))) { + req.url += '/'; + } + // Resolve the pathname without a trailing slash for app page rendering. + const resolvedPathname = (0, _removetrailingslash.removeTrailingSlash)(updatedPath); + if (locale && buildExport && commonRenderOpts.domainLocales && commonRenderOpts.domainLocales.some((dl)=>{ + var _dl_locales; + return dl.defaultLocale === locale || ((_dl_locales = dl.locales) == null ? void 0 : _dl_locales.includes(locale || '')); + })) { + (0, _requestmeta.addRequestMeta)(req, 'isLocaleDomain', true); + } + const getHtmlFilename = (p)=>subFolders ? `${p}${_path.sep}index.html` : `${p}.html`; + let htmlFilename = getHtmlFilename(filePath); + // dynamic routes can provide invalid extensions e.g. /blog/[...slug] returns an + // extension of `.slug]` + const pageExt = isDynamic || isAppDir ? '' : (0, _path.extname)(page); + const pathExt = isDynamic || isAppDir ? '' : (0, _path.extname)(path); + // force output 404.html for backwards compat + if (path === '/404.html') { + htmlFilename = path; + } else if (pageExt !== pathExt && pathExt !== '') { + const isBuiltinPaths = [ + '/500', + '/404' + ].some((p)=>p === path || p === path + '.html'); + // If the ssg path has .html extension, and it's not builtin paths, use it directly + // Otherwise, use that as the filename instead + const isHtmlExtPath = !isBuiltinPaths && path.endsWith('.html'); + htmlFilename = isHtmlExtPath ? getHtmlFilename(path) : path; + } else if (path === '/') { + // If the path is the root, just use index.html + htmlFilename = 'index.html'; + } + const components = await (0, _loadcomponents.loadComponents)({ + distDir, + page, + isAppPath: isAppDir, + isDev: false, + sriEnabled, + needsManifestsForLegacyReasons: true + }); + const routeCache = buildExport && commonRenderOpts.nextConfigOutput !== 'export' && (isAppDir || components.getStaticProps) ? { + key: (0, _routecachekey.getRouteCacheKey)(path, components.routeModule.cacheOwner), + owner: components.routeModule.cacheOwner, + isFallback: isAppDir ? fallbackRouteParams != null && fallbackRouteParams.size > 0 : exportPath._pagesFallback ?? false + } : undefined; + const htmlFilepath = useScopedBuildArtifacts && routeCache ? (0, _path.join)(distDir, 'server', `${routeCache.key}.html`) : (0, _path.join)(outDir, htmlFilename); + const routePagesDataDir = useScopedBuildArtifacts && routeCache ? (0, _path.join)(distDir, 'server') : pagesDataDir; + if (useScopedBuildArtifacts && routeCache) { + htmlFilename = `${routeCache.key}.html`; + } + await _promises.default.mkdir((0, _path.dirname)(htmlFilepath), { + recursive: true + }); + // Handle App Routes. + if (isAppDir && (0, _isapprouteroute.isAppRouteRoute)(page)) { + return (0, _approute.exportAppRoute)(req, res, params, page, components.routeModule, commonRenderOpts.incrementalCache, commonRenderOpts.cacheLifeProfiles, htmlFilepath, fileWriter, commonRenderOpts.cacheComponents, commonRenderOpts.staticPageGenerationTimeout, commonRenderOpts.experimental, buildId, deploymentId, routeCache); + } + const renderOpts = { + ...components, + ...commonRenderOpts, + params, + optimizeCss, + disableOptimizedLoading, + locale, + supportsDynamicResponse: false, + // During the export phase in next build, we always enable the streaming metadata since if there's + // any dynamic access in metadata we can determine it in the build phase. + // If it's static, then it won't affect anything. + // If it's dynamic, then it can be handled when request hits the route. + serveStreamingMetadata: true, + allowEmptyStaticShell, + runInstantValidation, + isFallbackUpgradeable, + notFoundParams, + experimental: { + ...commonRenderOpts.experimental, + isRoutePPREnabled + }, + renderResumeDataCache + }; + // Handle App Pages + if (isAppDir) { + const routeMatch = { + resolvedPathname + }; + const sharedContext = { + buildId, + deploymentId, + clientAssetToken + }; + return (0, _apppage.exportAppPage)(req, res, page, path, pathname, query, fallbackRouteParams, renderOpts, htmlFilepath, debugOutput, isDynamicError, fileWriter, sharedContext, routeMatch, routeCache); + } else { + const sharedContext = { + buildId, + deploymentId, + clientAssetToken, + customServer: undefined + }; + const renderContext = { + isFallback: exportPath._pagesFallback ?? false, + isDraftMode: false, + developmentNotFoundSourcePage: undefined + }; + return (0, _pages.exportPagesPage)(req, res, path, page, query, params, htmlFilepath, htmlFilename, routePagesDataDir, buildExport, isDynamic, sharedContext, renderContext, hasOrigQueryValues, renderOpts, components, fileWriter, routeCache); + } +} +async function exportPages(input) { + // Load native bindings in the worker process so that code frame rendering + // (which uses the native codeFrameColumns function) works during prerendering. + await (0, _installbindings.installBindings)(); + (0, _installcodeframe.installCodeFrameSupport)(); + const { exportPaths, dir, distDir, outDir, cacheHandler, cacheMaxMemorySize, fetchCacheKeyPrefix, pagesDataDir, renderOpts, nextConfig, options, renderResumeDataCachesByPage = {} } = input; + (0, _globalbehaviors.installGlobalBehaviors)(nextConfig); + if (nextConfig.enablePrerenderSourceMaps) { + try { + // Same as `next dev` + // Limiting the stack trace to a useful amount of frames is handled by ignore-listing. + // TODO: How high can we go without severely impacting CPU/memory? + Error.stackTraceLimit = 50; + } catch {} + } + // If the fetch cache was enabled, we need to create an incremental + // cache instance for this page. + const incrementalCache = await (0, _createincrementalcache.createIncrementalCache)({ + cacheHandler, + cacheMaxMemorySize, + fetchCacheKeyPrefix, + distDir, + dir, + // skip writing to disk in minimal mode for now, pending some + // changes to better support it + flushToDisk: !_ciinfo.hasNextSupport, + cacheHandlers: nextConfig.cacheHandlers + }); + renderOpts.incrementalCache = incrementalCache; + const maxConcurrency = nextConfig.experimental.staticGenerationMaxConcurrency ?? 8; + const results = []; + const exportPageWithRetry = async (exportPath, maxAttempts)=>{ + var // Also tests for `inspect-brk` + _process_env_NODE_OPTIONS; + const { page, path } = exportPath; + const pageKey = page !== path ? `${page}: ${path}` : path; + let attempt = 0; + let result; + const hasDebuggerAttached = (_process_env_NODE_OPTIONS = process.env.NODE_OPTIONS) == null ? void 0 : _process_env_NODE_OPTIONS.includes('--inspect'); + const renderResumeDataCache = renderResumeDataCachesByPage[pageKey] ? (0, _resumedatacache.createRenderResumeDataCache)(renderResumeDataCachesByPage[pageKey], renderOpts.experimental.maxPostponedStateSizeBytes, renderOpts.experimental.disableResumeDataCacheCompression) : undefined; + while(attempt < maxAttempts){ + try { + var _nextConfig_experimental_sri; + result = await Promise.race([ + exportPage({ + exportPath, + distDir, + outDir, + pagesDataDir, + renderOpts, + trailingSlash: nextConfig.trailingSlash, + subFolders: nextConfig.trailingSlash && !options.buildExport, + buildExport: options.buildExport, + optimizeCss: nextConfig.experimental.optimizeCss, + disableOptimizedLoading: nextConfig.experimental.disableOptimizedLoading, + parentSpanId: input.parentSpanId, + httpAgentOptions: nextConfig.httpAgentOptions, + debugOutput: options.debugOutput, + enableExperimentalReact: (0, _needsexperimentalreact.needsExperimentalReact)(nextConfig), + sriEnabled: Boolean((_nextConfig_experimental_sri = nextConfig.experimental.sri) == null ? void 0 : _nextConfig_experimental_sri.algorithm), + buildId: input.buildId, + deploymentId: input.deploymentId, + clientAssetToken: input.clientAssetToken, + renderResumeDataCache, + useScopedBuildArtifacts: Boolean(nextConfig.adapterPath) && nextConfig.output !== 'export' && options.buildExport + }), + hasDebuggerAttached ? new Promise(()=>{}) : new Promise((_, reject)=>{ + setTimeout(()=>{ + reject(new TimeoutError()); + }, nextConfig.staticPageGenerationTimeout * 1000); + }) + ]); + // If there was an error in the export, throw it immediately. In the catch block, we might retry the export, + // or immediately fail the build, depending on user configuration. We might also continue on and attempt other pages. + if (result && 'error' in result) { + throw new ExportPageError(); + } + break; + } catch (err) { + // The only error that should be caught here is an ExportError, as `exportPage` doesn't throw and instead returns an object with an `error` property. + // This is an overly cautious check to ensure that we don't accidentally catch an unexpected error. + if (!(err instanceof ExportPageError || err instanceof TimeoutError)) { + throw err; + } + if (err instanceof TimeoutError) { + // If the export times out, we will restart the worker up to 3 times. + maxAttempts = 3; + } + // We've reached the maximum number of attempts + if (attempt >= maxAttempts - 1) { + // Log a message if we've reached the maximum number of attempts. + // We only care to do this if maxAttempts was configured. + if (maxAttempts > 1) { + console.info(`Failed to build ${pageKey} after ${maxAttempts} attempts.`); + } + // If prerenderEarlyExit is enabled, we'll exit the build immediately. + if (nextConfig.experimental.prerenderEarlyExit) { + console.error(`Export encountered an error on ${pageKey}, exiting the build.`); + process.exit(1); + } else { + // Otherwise, this is a no-op. The build will continue, and a summary of failed pages will be displayed at the end. + } + } else { + // Otherwise, we have more attempts to make. Wait before retrying + if (err instanceof TimeoutError) { + console.info(`Failed to build ${pageKey} (attempt ${attempt + 1} of ${maxAttempts}) because it took more than ${nextConfig.staticPageGenerationTimeout} seconds. Retrying again shortly.`); + } else { + console.info(`Failed to build ${pageKey} (attempt ${attempt + 1} of ${maxAttempts}). Retrying again shortly.`); + } + // Exponential backoff with random jitter to avoid thundering herd on retries + const baseDelay = 500 // 500ms + ; + const maxDelay = 2000 // 2 seconds + ; + const delay = Math.min(baseDelay * Math.pow(2, attempt), maxDelay); + const jitter = Math.random() * 0.3 * delay // Add up to 30% random jitter + ; + await new Promise((r)=>setTimeout(r, delay + jitter)); + } + } + attempt++; + } + return { + result, + path, + page, + pageKey + }; + }; + for(let i = 0; i < exportPaths.length; i += maxConcurrency){ + const subset = exportPaths.slice(i, i + maxConcurrency); + const subsetResults = await Promise.all(subset.map((exportPath)=>exportPageWithRetry(exportPath, nextConfig.experimental.staticGenerationRetryCount ?? 1))); + results.push(...subsetResults); + } + return results; +} +async function exportPage(input) { + (0, _trace.trace)('export-page', input.parentSpanId).setAttribute('path', input.exportPath.path); + // Configure the http agent. + (0, _setuphttpagentenv.setHttpClientAndAgentOptions)({ + httpAgentOptions: input.httpAgentOptions + }); + const fileWriter = new _multifilewriter.MultiFileWriter({ + writeFile: (filePath, data)=>_promises.default.writeFile(filePath, data), + mkdir: (dir)=>_promises.default.mkdir(dir, { + recursive: true + }) + }); + const exportPageSpan = (0, _trace.trace)('export-page-worker', input.parentSpanId); + const start = Date.now(); + const turborepoAccessTraceResult = new _turborepoaccesstrace.TurborepoAccessTraceResult(); + // Export the page. + let result; + try { + result = await exportPageSpan.traceAsyncFn(()=>(0, _turborepoaccesstrace.turborepoTraceAccess)(()=>exportPageImpl(input, fileWriter), turborepoAccessTraceResult)); + // Wait for all the files to flush to disk. + await fileWriter.wait(); + // If there was no result, then we can exit early. + if (!result) return; + // If there was an error, then we can exit early. + if ('error' in result) { + return { + error: result.error, + duration: Date.now() - start + }; + } + } catch (err) { + console.error(`Error occurred prerendering page "${input.exportPath.path}". Read more: https://nextjs.org/docs/messages/prerender-error`); + // bailoutToCSRError errors should not leak to the user as they are not actionable; they're + // a framework signal + if (!(0, _bailouttocsr.isBailoutToCSRError)(err)) { + // A static generation bailout error is a framework signal to fail static generation but + // and will encode a reason in the error message. If there is a message, we'll print it. + // Otherwise there's nothing to show as we don't want to leak an error internal error stack to the user. + // TODO: Always log the full error. ignore-listing will take care of hiding internal stacks. + if ((0, _staticgenerationbailout.isStaticGenBailoutError)(err)) { + if (err.message) { + console.error(`Error: ${err.message}`); + } + } else { + console.error(err); + } + } + return { + error: true, + duration: Date.now() - start + }; + } + // Notify the parent process that we processed a page (used by the progress activity indicator) + process.send == null ? void 0 : process.send.call(process, [ + 3, + { + type: 'activity' + } + ]); + // Otherwise we can return the result. + return { + ...result, + duration: Date.now() - start, + turborepoAccessTraceResult: turborepoAccessTraceResult.serialize() + }; +} +process.on('unhandledRejection', (err)=>{ + // we don't want to log these errors + if ((0, _isdynamicusageerror.isDynamicUsageError)(err)) { + return; + } + console.error(err); +}); +process.on('rejectionHandled', ()=>{ +// It is ok to await a Promise late in Next.js as it allows for better +// prefetching patterns to avoid waterfalls. We ignore logging these. +// We should've already errored in anyway unhandledRejection. +}); +const FATAL_UNHANDLED_NEXT_API_EXIT_CODE = 78; +process.on('uncaughtException', (err)=>{ + if ((0, _isdynamicusageerror.isDynamicUsageError)(err)) { + console.error('A Next.js API that uses exceptions to signal framework behavior was uncaught. This suggests improper usage of a Next.js API. The original error is printed below and the build will now exit.'); + console.error(err); + process.exit(FATAL_UNHANDLED_NEXT_API_EXIT_CODE); + } else { + console.error(err); + } +}); + +//# sourceMappingURL=worker.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/export/worker.js.map b/e-commerce/node_modules/next/dist/export/worker.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f41cae4a53ca81717d54ca0db4163c7a646f8180 --- /dev/null +++ b/e-commerce/node_modules/next/dist/export/worker.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/export/worker.ts"],"sourcesContent":["import { getRouteCacheKey } from '../server/lib/route-cache-key'\nimport type { RouteCacheMetadata } from './routes/types'\nimport type {\n ExportPagesInput,\n ExportPageInput,\n ExportPageResult,\n ExportRouteResult,\n WorkerRenderOpts,\n ExportPagesResult,\n ExportPathEntry,\n} from './types'\nimport type {\n AppPageModule,\n RouteMatch,\n} from '../server/route-modules/app-page/module'\nimport type { PagesModule } from '../server/route-modules/pages/module.compiled'\n\nimport '../server/node-environment'\nimport { installBindings } from '../build/swc/install-bindings'\nimport { installCodeFrameSupport } from '../server/lib/install-code-frame'\n\nprocess.env.NEXT_IS_EXPORT_WORKER = 'true'\n\nimport { extname, join, dirname, sep } from 'path'\nimport fs from 'fs/promises'\nimport { loadComponents } from '../server/load-components'\nimport { isDynamicRoute } from '../shared/lib/router/utils/is-dynamic'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { normalizeLocalePath } from '../shared/lib/i18n/normalize-locale-path'\nimport { trace } from '../trace'\nimport { setHttpClientAndAgentOptions } from '../server/setup-http-agent-env'\nimport { addRequestMeta } from '../server/request-meta'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\nimport { removeTrailingSlash } from '../shared/lib/router/utils/remove-trailing-slash'\n\nimport { createRequestResponseMocks } from '../server/lib/mock-request'\nimport { isAppRouteRoute } from '../lib/is-app-route-route'\nimport { hasNextSupport } from '../server/ci-info'\nimport { exportAppRoute } from './routes/app-route'\nimport { exportAppPage } from './routes/app-page'\nimport { exportPagesPage } from './routes/pages'\nimport { getParams } from './helpers/get-params'\nimport { createIncrementalCache } from './helpers/create-incremental-cache'\nimport { isDynamicUsageError } from './helpers/is-dynamic-usage-error'\nimport { isBailoutToCSRError } from '../shared/lib/lazy-dynamic/bailout-to-csr'\nimport {\n turborepoTraceAccess,\n TurborepoAccessTraceResult,\n} from '../build/turborepo-access-trace'\nimport type { Params } from '../server/request/params'\nimport {\n createOpaqueFallbackRouteParams,\n type OpaqueFallbackRouteParams,\n} from '../server/request/fallback-params'\nimport { needsExperimentalReact } from '../lib/needs-experimental-react'\nimport type { AppRouteRouteModule } from '../server/route-modules/app-route/module.compiled'\nimport { isStaticGenBailoutError } from '../client/components/static-generation-bailout'\nimport type { PagesRenderContext, PagesSharedContext } from '../server/render'\nimport type { AppSharedContext } from '../server/app-render/app-render'\nimport { MultiFileWriter } from '../lib/multi-file-writer'\nimport { createRenderResumeDataCache } from '../server/resume-data-cache/resume-data-cache'\nimport { installGlobalBehaviors } from '../server/node-environment-extensions/global-behaviors'\n;(globalThis as any).__NEXT_DATA__ = {\n nextExport: true,\n}\n\nclass TimeoutError extends Error {\n code = 'NEXT_EXPORT_TIMEOUT_ERROR'\n}\n\nclass ExportPageError extends Error {\n code = 'NEXT_EXPORT_PAGE_ERROR'\n}\n\nasync function exportPageImpl(\n input: ExportPageInput,\n fileWriter: MultiFileWriter\n): Promise<ExportRouteResult | undefined> {\n const {\n exportPath,\n distDir,\n pagesDataDir,\n buildExport = false,\n subFolders = false,\n optimizeCss,\n disableOptimizedLoading,\n debugOutput = false,\n enableExperimentalReact,\n trailingSlash,\n sriEnabled,\n renderOpts: commonRenderOpts,\n outDir: commonOutDir,\n buildId,\n deploymentId,\n clientAssetToken,\n renderResumeDataCache,\n useScopedBuildArtifacts,\n } = input\n\n if (enableExperimentalReact) {\n process.env.__NEXT_EXPERIMENTAL_REACT = 'true'\n }\n\n const {\n path,\n page,\n\n // The parameters that are currently unknown.\n _fallbackRouteParams = [],\n\n _notFoundParams: notFoundParams,\n\n // Check if this is an `app/` page.\n _isAppDir: isAppDir = false,\n\n // Check if this should error when dynamic usage is detected.\n _isDynamicError: isDynamicError = false,\n\n // If this page supports partial prerendering, then we need to pass that to\n // the renderOpts.\n _isRoutePPREnabled: isRoutePPREnabled,\n\n // Configure the rendering of the page to allow that an empty static shell\n // is generated while rendering using PPR and Cache Components.\n _allowEmptyStaticShell: allowEmptyStaticShell = false,\n\n // When true, attempt to run build-time instant validation for this export path.\n _runInstantValidation: runInstantValidation = false,\n\n // When true, a fallback shell for this path could later be upgraded to a\n // concrete version (it has a `generateStaticParams` candidate param).\n _isFallbackUpgradeable: isFallbackUpgradeable = false,\n\n // Pull the original query out.\n query: originalQuery = {},\n } = exportPath\n\n const fallbackRouteParams: OpaqueFallbackRouteParams | null =\n createOpaqueFallbackRouteParams(_fallbackRouteParams)\n\n let query = { ...originalQuery }\n const pathname = normalizeAppPath(page)\n const isDynamic = isDynamicRoute(page)\n const outDir = isAppDir ? join(distDir, 'server/app') : commonOutDir\n\n const filePath = normalizePagePath(path)\n\n let updatedPath = exportPath._ssgPath || path\n let locale = exportPath._locale || commonRenderOpts.locale\n\n if (commonRenderOpts.locale) {\n const localePathResult = normalizeLocalePath(path, commonRenderOpts.locales)\n\n if (localePathResult.detectedLocale) {\n updatedPath = localePathResult.pathname\n locale = localePathResult.detectedLocale\n }\n }\n\n // We need to show a warning if they try to provide query values\n // for an auto-exported page since they won't be available\n const hasOrigQueryValues = Object.keys(originalQuery).length > 0\n\n // Check if the page is a specified dynamic route\n const { pathname: nonLocalizedPath } = normalizeLocalePath(\n path,\n commonRenderOpts.locales\n )\n\n let params: Params | undefined\n\n if (isDynamic && page !== nonLocalizedPath) {\n const normalizedPage = isAppDir ? normalizeAppPath(page) : page\n\n params = getParams(normalizedPage, updatedPath)\n }\n\n const { req, res } = createRequestResponseMocks({ url: updatedPath })\n\n // If this is a status code page, then set the response code.\n for (const statusCode of [404, 500]) {\n if (\n [\n `/${statusCode}`,\n `/${statusCode}.html`,\n `/${statusCode}/index.html`,\n ].some((p) => p === updatedPath || `/${locale}${p}` === updatedPath)\n ) {\n res.statusCode = statusCode\n }\n }\n\n // Ensure that the URL has a trailing slash if it's configured.\n if (trailingSlash && !req.url?.endsWith('/')) {\n req.url += '/'\n }\n\n // Resolve the pathname without a trailing slash for app page rendering.\n const resolvedPathname = removeTrailingSlash(updatedPath)\n\n if (\n locale &&\n buildExport &&\n commonRenderOpts.domainLocales &&\n commonRenderOpts.domainLocales.some(\n (dl) => dl.defaultLocale === locale || dl.locales?.includes(locale || '')\n )\n ) {\n addRequestMeta(req, 'isLocaleDomain', true)\n }\n\n const getHtmlFilename = (p: string) =>\n subFolders ? `${p}${sep}index.html` : `${p}.html`\n\n let htmlFilename = getHtmlFilename(filePath)\n\n // dynamic routes can provide invalid extensions e.g. /blog/[...slug] returns an\n // extension of `.slug]`\n const pageExt = isDynamic || isAppDir ? '' : extname(page)\n const pathExt = isDynamic || isAppDir ? '' : extname(path)\n\n // force output 404.html for backwards compat\n if (path === '/404.html') {\n htmlFilename = path\n }\n // Make sure page isn't a folder with a dot in the name e.g. `v1.2`\n else if (pageExt !== pathExt && pathExt !== '') {\n const isBuiltinPaths = ['/500', '/404'].some(\n (p) => p === path || p === path + '.html'\n )\n // If the ssg path has .html extension, and it's not builtin paths, use it directly\n // Otherwise, use that as the filename instead\n const isHtmlExtPath = !isBuiltinPaths && path.endsWith('.html')\n htmlFilename = isHtmlExtPath ? getHtmlFilename(path) : path\n } else if (path === '/') {\n // If the path is the root, just use index.html\n htmlFilename = 'index.html'\n }\n\n const components = await loadComponents({\n distDir,\n page,\n isAppPath: isAppDir,\n isDev: false,\n sriEnabled,\n needsManifestsForLegacyReasons: true,\n })\n\n const routeCache: RouteCacheMetadata | undefined =\n buildExport &&\n commonRenderOpts.nextConfigOutput !== 'export' &&\n (isAppDir || components.getStaticProps)\n ? {\n key: getRouteCacheKey(path, components.routeModule.cacheOwner),\n owner: components.routeModule.cacheOwner,\n isFallback: isAppDir\n ? fallbackRouteParams != null && fallbackRouteParams.size > 0\n : (exportPath._pagesFallback ?? false),\n }\n : undefined\n const htmlFilepath =\n useScopedBuildArtifacts && routeCache\n ? join(distDir, 'server', `${routeCache.key}.html`)\n : join(outDir, htmlFilename)\n const routePagesDataDir =\n useScopedBuildArtifacts && routeCache\n ? join(distDir, 'server')\n : pagesDataDir\n if (useScopedBuildArtifacts && routeCache) {\n htmlFilename = `${routeCache.key}.html`\n }\n await fs.mkdir(dirname(htmlFilepath), { recursive: true })\n\n // Handle App Routes.\n if (isAppDir && isAppRouteRoute(page)) {\n return exportAppRoute(\n req,\n res,\n params,\n page,\n components.routeModule as AppRouteRouteModule,\n commonRenderOpts.incrementalCache,\n commonRenderOpts.cacheLifeProfiles,\n htmlFilepath,\n fileWriter,\n commonRenderOpts.cacheComponents,\n commonRenderOpts.staticPageGenerationTimeout,\n commonRenderOpts.experimental,\n buildId,\n deploymentId,\n routeCache\n )\n }\n\n const renderOpts: WorkerRenderOpts = {\n ...components,\n ...commonRenderOpts,\n params,\n optimizeCss,\n disableOptimizedLoading,\n locale,\n supportsDynamicResponse: false,\n // During the export phase in next build, we always enable the streaming metadata since if there's\n // any dynamic access in metadata we can determine it in the build phase.\n // If it's static, then it won't affect anything.\n // If it's dynamic, then it can be handled when request hits the route.\n serveStreamingMetadata: true,\n allowEmptyStaticShell,\n runInstantValidation,\n isFallbackUpgradeable,\n notFoundParams,\n experimental: {\n ...commonRenderOpts.experimental,\n isRoutePPREnabled,\n },\n renderResumeDataCache,\n }\n\n // Handle App Pages\n if (isAppDir) {\n const routeMatch: RouteMatch = { resolvedPathname }\n const sharedContext: AppSharedContext = {\n buildId,\n deploymentId,\n clientAssetToken,\n }\n\n return exportAppPage(\n req,\n res,\n page,\n path,\n pathname,\n query,\n fallbackRouteParams,\n renderOpts as WorkerRenderOpts<AppPageModule>,\n htmlFilepath,\n debugOutput,\n isDynamicError,\n fileWriter,\n sharedContext,\n routeMatch,\n routeCache\n )\n } else {\n const sharedContext: PagesSharedContext = {\n buildId,\n deploymentId,\n clientAssetToken,\n customServer: undefined,\n }\n\n const renderContext: PagesRenderContext = {\n isFallback: exportPath._pagesFallback ?? false,\n isDraftMode: false,\n developmentNotFoundSourcePage: undefined,\n }\n\n return exportPagesPage(\n req,\n res,\n path,\n page,\n query,\n params,\n htmlFilepath,\n htmlFilename,\n routePagesDataDir,\n buildExport,\n isDynamic,\n sharedContext,\n renderContext,\n hasOrigQueryValues,\n renderOpts as WorkerRenderOpts<PagesModule>,\n components,\n fileWriter,\n routeCache\n )\n }\n}\n\nexport async function exportPages(\n input: ExportPagesInput\n): Promise<ExportPagesResult> {\n // Load native bindings in the worker process so that code frame rendering\n // (which uses the native codeFrameColumns function) works during prerendering.\n await installBindings()\n installCodeFrameSupport()\n\n const {\n exportPaths,\n dir,\n distDir,\n outDir,\n cacheHandler,\n cacheMaxMemorySize,\n fetchCacheKeyPrefix,\n pagesDataDir,\n renderOpts,\n nextConfig,\n options,\n renderResumeDataCachesByPage = {},\n } = input\n\n installGlobalBehaviors(nextConfig)\n\n if (nextConfig.enablePrerenderSourceMaps) {\n try {\n // Same as `next dev`\n // Limiting the stack trace to a useful amount of frames is handled by ignore-listing.\n // TODO: How high can we go without severely impacting CPU/memory?\n Error.stackTraceLimit = 50\n } catch {}\n }\n\n // If the fetch cache was enabled, we need to create an incremental\n // cache instance for this page.\n const incrementalCache = await createIncrementalCache({\n cacheHandler,\n cacheMaxMemorySize,\n fetchCacheKeyPrefix,\n distDir,\n dir,\n // skip writing to disk in minimal mode for now, pending some\n // changes to better support it\n flushToDisk: !hasNextSupport,\n cacheHandlers: nextConfig.cacheHandlers,\n })\n\n renderOpts.incrementalCache = incrementalCache\n\n const maxConcurrency =\n nextConfig.experimental.staticGenerationMaxConcurrency ?? 8\n const results: ExportPagesResult = []\n\n const exportPageWithRetry = async (\n exportPath: ExportPathEntry,\n maxAttempts: number\n ) => {\n const { page, path } = exportPath\n const pageKey = page !== path ? `${page}: ${path}` : path\n let attempt = 0\n let result\n\n const hasDebuggerAttached =\n // Also tests for `inspect-brk`\n process.env.NODE_OPTIONS?.includes('--inspect')\n\n const renderResumeDataCache = renderResumeDataCachesByPage[pageKey]\n ? createRenderResumeDataCache(\n renderResumeDataCachesByPage[pageKey],\n renderOpts.experimental.maxPostponedStateSizeBytes,\n renderOpts.experimental.disableResumeDataCacheCompression\n )\n : undefined\n\n while (attempt < maxAttempts) {\n try {\n result = await Promise.race<ExportPageResult | undefined>([\n exportPage({\n exportPath,\n distDir,\n outDir,\n pagesDataDir,\n renderOpts,\n trailingSlash: nextConfig.trailingSlash,\n subFolders: nextConfig.trailingSlash && !options.buildExport,\n buildExport: options.buildExport,\n optimizeCss: nextConfig.experimental.optimizeCss,\n disableOptimizedLoading:\n nextConfig.experimental.disableOptimizedLoading,\n parentSpanId: input.parentSpanId,\n httpAgentOptions: nextConfig.httpAgentOptions,\n debugOutput: options.debugOutput,\n enableExperimentalReact: needsExperimentalReact(nextConfig),\n sriEnabled: Boolean(nextConfig.experimental.sri?.algorithm),\n buildId: input.buildId,\n deploymentId: input.deploymentId,\n clientAssetToken: input.clientAssetToken,\n renderResumeDataCache,\n useScopedBuildArtifacts:\n Boolean(nextConfig.adapterPath) &&\n nextConfig.output !== 'export' &&\n options.buildExport,\n }),\n hasDebuggerAttached\n ? // With a debugger attached, exporting can take infinitely if we paused script execution.\n new Promise(() => {})\n : // If exporting the page takes longer than the timeout, reject the promise.\n new Promise((_, reject) => {\n setTimeout(() => {\n reject(new TimeoutError())\n }, nextConfig.staticPageGenerationTimeout * 1000)\n }),\n ])\n\n // If there was an error in the export, throw it immediately. In the catch block, we might retry the export,\n // or immediately fail the build, depending on user configuration. We might also continue on and attempt other pages.\n if (result && 'error' in result) {\n throw new ExportPageError()\n }\n\n // If the export succeeds, break out of the retry loop\n break\n } catch (err) {\n // The only error that should be caught here is an ExportError, as `exportPage` doesn't throw and instead returns an object with an `error` property.\n // This is an overly cautious check to ensure that we don't accidentally catch an unexpected error.\n if (!(err instanceof ExportPageError || err instanceof TimeoutError)) {\n throw err\n }\n\n if (err instanceof TimeoutError) {\n // If the export times out, we will restart the worker up to 3 times.\n maxAttempts = 3\n }\n\n // We've reached the maximum number of attempts\n if (attempt >= maxAttempts - 1) {\n // Log a message if we've reached the maximum number of attempts.\n // We only care to do this if maxAttempts was configured.\n if (maxAttempts > 1) {\n console.info(\n `Failed to build ${pageKey} after ${maxAttempts} attempts.`\n )\n }\n // If prerenderEarlyExit is enabled, we'll exit the build immediately.\n if (nextConfig.experimental.prerenderEarlyExit) {\n console.error(\n `Export encountered an error on ${pageKey}, exiting the build.`\n )\n process.exit(1)\n } else {\n // Otherwise, this is a no-op. The build will continue, and a summary of failed pages will be displayed at the end.\n }\n } else {\n // Otherwise, we have more attempts to make. Wait before retrying\n if (err instanceof TimeoutError) {\n console.info(\n `Failed to build ${pageKey} (attempt ${attempt + 1} of ${maxAttempts}) because it took more than ${nextConfig.staticPageGenerationTimeout} seconds. Retrying again shortly.`\n )\n } else {\n console.info(\n `Failed to build ${pageKey} (attempt ${attempt + 1} of ${maxAttempts}). Retrying again shortly.`\n )\n }\n\n // Exponential backoff with random jitter to avoid thundering herd on retries\n const baseDelay = 500 // 500ms\n const maxDelay = 2000 // 2 seconds\n const delay = Math.min(baseDelay * Math.pow(2, attempt), maxDelay)\n const jitter = Math.random() * 0.3 * delay // Add up to 30% random jitter\n await new Promise((r) => setTimeout(r, delay + jitter))\n }\n }\n\n attempt++\n }\n\n return { result, path, page, pageKey }\n }\n\n for (let i = 0; i < exportPaths.length; i += maxConcurrency) {\n const subset = exportPaths.slice(i, i + maxConcurrency)\n\n const subsetResults = await Promise.all(\n subset.map((exportPath) =>\n exportPageWithRetry(\n exportPath,\n nextConfig.experimental.staticGenerationRetryCount ?? 1\n )\n )\n )\n\n results.push(...subsetResults)\n }\n\n return results\n}\n\nasync function exportPage(\n input: ExportPageInput\n): Promise<ExportPageResult | undefined> {\n trace('export-page', input.parentSpanId).setAttribute(\n 'path',\n input.exportPath.path\n )\n\n // Configure the http agent.\n setHttpClientAndAgentOptions({\n httpAgentOptions: input.httpAgentOptions,\n })\n\n const fileWriter = new MultiFileWriter({\n writeFile: (filePath, data) => fs.writeFile(filePath, data),\n mkdir: (dir) => fs.mkdir(dir, { recursive: true }),\n })\n\n const exportPageSpan = trace('export-page-worker', input.parentSpanId)\n\n const start = Date.now()\n\n const turborepoAccessTraceResult = new TurborepoAccessTraceResult()\n\n // Export the page.\n let result: ExportRouteResult | undefined\n try {\n result = await exportPageSpan.traceAsyncFn(() =>\n turborepoTraceAccess(\n () => exportPageImpl(input, fileWriter),\n turborepoAccessTraceResult\n )\n )\n\n // Wait for all the files to flush to disk.\n await fileWriter.wait()\n\n // If there was no result, then we can exit early.\n if (!result) return\n\n // If there was an error, then we can exit early.\n if ('error' in result) {\n return { error: result.error, duration: Date.now() - start }\n }\n } catch (err) {\n console.error(\n `Error occurred prerendering page \"${input.exportPath.path}\". Read more: https://nextjs.org/docs/messages/prerender-error`\n )\n\n // bailoutToCSRError errors should not leak to the user as they are not actionable; they're\n // a framework signal\n if (!isBailoutToCSRError(err)) {\n // A static generation bailout error is a framework signal to fail static generation but\n // and will encode a reason in the error message. If there is a message, we'll print it.\n // Otherwise there's nothing to show as we don't want to leak an error internal error stack to the user.\n // TODO: Always log the full error. ignore-listing will take care of hiding internal stacks.\n if (isStaticGenBailoutError(err)) {\n if (err.message) {\n console.error(`Error: ${err.message}`)\n }\n } else {\n console.error(err)\n }\n }\n\n return { error: true, duration: Date.now() - start }\n }\n\n // Notify the parent process that we processed a page (used by the progress activity indicator)\n process.send?.([3, { type: 'activity' }])\n\n // Otherwise we can return the result.\n return {\n ...result,\n duration: Date.now() - start,\n turborepoAccessTraceResult: turborepoAccessTraceResult.serialize(),\n }\n}\n\nprocess.on('unhandledRejection', (err: unknown) => {\n // we don't want to log these errors\n if (isDynamicUsageError(err)) {\n return\n }\n\n console.error(err)\n})\n\nprocess.on('rejectionHandled', () => {\n // It is ok to await a Promise late in Next.js as it allows for better\n // prefetching patterns to avoid waterfalls. We ignore logging these.\n // We should've already errored in anyway unhandledRejection.\n})\n\nconst FATAL_UNHANDLED_NEXT_API_EXIT_CODE = 78\n\nprocess.on('uncaughtException', (err) => {\n if (isDynamicUsageError(err)) {\n console.error(\n 'A Next.js API that uses exceptions to signal framework behavior was uncaught. This suggests improper usage of a Next.js API. The original error is printed below and the build will now exit.'\n )\n console.error(err)\n process.exit(FATAL_UNHANDLED_NEXT_API_EXIT_CODE)\n } else {\n console.error(err)\n }\n})\n"],"names":["exportPages","process","env","NEXT_IS_EXPORT_WORKER","globalThis","__NEXT_DATA__","nextExport","TimeoutError","Error","code","ExportPageError","exportPageImpl","input","fileWriter","req","exportPath","distDir","pagesDataDir","buildExport","subFolders","optimizeCss","disableOptimizedLoading","debugOutput","enableExperimentalReact","trailingSlash","sriEnabled","renderOpts","commonRenderOpts","outDir","commonOutDir","buildId","deploymentId","clientAssetToken","renderResumeDataCache","useScopedBuildArtifacts","__NEXT_EXPERIMENTAL_REACT","path","page","_fallbackRouteParams","_notFoundParams","notFoundParams","_isAppDir","isAppDir","_isDynamicError","isDynamicError","_isRoutePPREnabled","isRoutePPREnabled","_allowEmptyStaticShell","allowEmptyStaticShell","_runInstantValidation","runInstantValidation","_isFallbackUpgradeable","isFallbackUpgradeable","query","originalQuery","fallbackRouteParams","createOpaqueFallbackRouteParams","pathname","normalizeAppPath","isDynamic","isDynamicRoute","join","filePath","normalizePagePath","updatedPath","_ssgPath","locale","_locale","localePathResult","normalizeLocalePath","locales","detectedLocale","hasOrigQueryValues","Object","keys","length","nonLocalizedPath","params","normalizedPage","getParams","res","createRequestResponseMocks","url","statusCode","some","p","endsWith","resolvedPathname","removeTrailingSlash","domainLocales","dl","defaultLocale","includes","addRequestMeta","getHtmlFilename","sep","htmlFilename","pageExt","extname","pathExt","isBuiltinPaths","isHtmlExtPath","components","loadComponents","isAppPath","isDev","needsManifestsForLegacyReasons","routeCache","nextConfigOutput","getStaticProps","key","getRouteCacheKey","routeModule","cacheOwner","owner","isFallback","size","_pagesFallback","undefined","htmlFilepath","routePagesDataDir","fs","mkdir","dirname","recursive","isAppRouteRoute","exportAppRoute","incrementalCache","cacheLifeProfiles","cacheComponents","staticPageGenerationTimeout","experimental","supportsDynamicResponse","serveStreamingMetadata","routeMatch","sharedContext","exportAppPage","customServer","renderContext","isDraftMode","developmentNotFoundSourcePage","exportPagesPage","installBindings","installCodeFrameSupport","exportPaths","dir","cacheHandler","cacheMaxMemorySize","fetchCacheKeyPrefix","nextConfig","options","renderResumeDataCachesByPage","installGlobalBehaviors","enablePrerenderSourceMaps","stackTraceLimit","createIncrementalCache","flushToDisk","hasNextSupport","cacheHandlers","maxConcurrency","staticGenerationMaxConcurrency","results","exportPageWithRetry","maxAttempts","pageKey","attempt","result","hasDebuggerAttached","NODE_OPTIONS","createRenderResumeDataCache","maxPostponedStateSizeBytes","disableResumeDataCacheCompression","Promise","race","exportPage","parentSpanId","httpAgentOptions","needsExperimentalReact","Boolean","sri","algorithm","adapterPath","output","_","reject","setTimeout","err","console","info","prerenderEarlyExit","error","exit","baseDelay","maxDelay","delay","Math","min","pow","jitter","random","r","i","subset","slice","subsetResults","all","map","staticGenerationRetryCount","push","trace","setAttribute","setHttpClientAndAgentOptions","MultiFileWriter","writeFile","data","exportPageSpan","start","Date","now","turborepoAccessTraceResult","TurborepoAccessTraceResult","traceAsyncFn","turborepoTraceAccess","wait","duration","isBailoutToCSRError","isStaticGenBailoutError","message","send","type","serialize","on","isDynamicUsageError","FATAL_UNHANDLED_NEXT_API_EXIT_CODE"],"mappings":";;;;+BA6XsBA;;;eAAAA;;;+BA7XW;QAiB1B;iCACyB;kCACQ;sBAII;iEAC7B;gCACgB;2BACA;mCACG;qCACE;uBACd;mCACuB;6BACd;0BACE;qCACG;6BAEO;iCACX;wBACD;0BACA;yBACD;uBACE;2BACN;wCACa;qCACH;8BACA;sCAI7B;gCAKA;wCACgC;yCAEC;iCAGR;iCACY;iCACL;;;;;;AAxCvCC,QAAQC,GAAG,CAACC,qBAAqB,GAAG;AAyClCC,WAAmBC,aAAa,GAAG;IACnCC,YAAY;AACd;AAEA,MAAMC,qBAAqBC;;QAA3B,qBACEC,OAAO;;AACT;AAEA,MAAMC,wBAAwBF;;QAA9B,qBACEC,OAAO;;AACT;AAEA,eAAeE,eACbC,KAAsB,EACtBC,UAA2B;QAqHLC;IAnHtB,MAAM,EACJC,UAAU,EACVC,OAAO,EACPC,YAAY,EACZC,cAAc,KAAK,EACnBC,aAAa,KAAK,EAClBC,WAAW,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IACtC,OAAO;QACL,GAAG/D,MAAM;QACT0D,UAAUP,KAAKC,GAAG,KAAKF;QACvBG,4BAA4BA,2BAA2BW,SAAS;IAClE;AACF;AAEArO,QAAQsO,EAAE,CAAC,sBAAsB,CAAC7C;IAChC,oCAAoC;IACpC,IAAI8C,IAAAA,wCAAmB,EAAC9C,MAAM;QAC5B;IACF;IAEAC,QAAQG,KAAK,CAACJ;AAChB;AAEAzL,QAAQsO,EAAE,CAAC,oBAAoB;AAC7B,sEAAsE;AACtE,qEAAqE;AACrE,6DAA6D;AAC/D;AAEA,MAAME,qCAAqC;AAE3CxO,QAAQsO,EAAE,CAAC,qBAAqB,CAAC7C;IAC/B,IAAI8C,IAAAA,wCAAmB,EAAC9C,MAAM;QAC5BC,QAAQG,KAAK,CACX;QAEFH,QAAQG,KAAK,CAACJ;QACdzL,QAAQ8L,IAAI,CAAC0C;IACf,OAAO;QACL9C,QAAQG,KAAK,CAACJ;IAChB;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/batcher.d.ts b/e-commerce/node_modules/next/dist/lib/batcher.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f67daac5399470d3f4d725747f4c7becebea9716 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/batcher.d.ts @@ -0,0 +1,51 @@ +import type { SchedulerFn } from './scheduler'; +type CacheKeyFn<K, C extends string | number | null> = (key: K) => PromiseLike<C> | C; +type BatcherOptions<K, C extends string | number | null> = { + cacheKeyFn?: CacheKeyFn<K, C>; + schedulerFn?: SchedulerFn<void>; +}; +type WorkFnContext<V, K> = { + resolve: (value: V | PromiseLike<V>) => void; + key: K; +}; +type WorkFn<V, K> = (context: WorkFnContext<V, K>) => Promise<V>; +/** + * A wrapper for a function that will only allow one call to the function to + * execute at a time. + */ +export declare class Batcher<K, V, C extends string | number | null> { + private readonly cacheKeyFn?; + /** + * A function that will be called to schedule the wrapped function to be + * executed. This defaults to a function that will execute the function + * immediately. + */ + private readonly schedulerFn; + private readonly pending; + protected constructor(cacheKeyFn?: CacheKeyFn<K, C> | undefined, + /** + * A function that will be called to schedule the wrapped function to be + * executed. This defaults to a function that will execute the function + * immediately. + */ + schedulerFn?: SchedulerFn<void>); + /** + * Creates a new instance of PendingWrapper. If the key extends a string or + * number, the key will be used as the cache key. If the key is an object, a + * cache key function must be provided. + */ + static create<K extends string | number | null, V>(options?: BatcherOptions<K, K>): Batcher<K, V, K>; + static create<K, V, C extends string | number | null>(options: BatcherOptions<K, C> & Required<Pick<BatcherOptions<K, C>, 'cacheKeyFn'>>): Batcher<K, V, C>; + /** + * Wraps a function in a promise that will be resolved or rejected only once + * for a given key. This will allow multiple calls to the function to be + * made, but only one will be executed at a time. The result of the first + * call will be returned to all callers. + * + * @param key the key to use for the cache + * @param fn the function to wrap + * @returns a promise that resolves to the result of the function + */ + batch(key: K, fn: WorkFn<V, K>): Promise<V>; +} +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/batcher.js b/e-commerce/node_modules/next/dist/lib/batcher.js new file mode 100644 index 0000000000000000000000000000000000000000..601f24fc74ecd3c14988cc55a5a573184188b226 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/batcher.js @@ -0,0 +1,65 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Batcher", { + enumerable: true, + get: function() { + return Batcher; + } +}); +const _promisewithresolvers = require("../shared/lib/promise-with-resolvers"); +class Batcher { + constructor(cacheKeyFn, /** + * A function that will be called to schedule the wrapped function to be + * executed. This defaults to a function that will execute the function + * immediately. + */ schedulerFn = (fn)=>fn()){ + this.cacheKeyFn = cacheKeyFn; + this.schedulerFn = schedulerFn; + this.pending = new Map(); + } + static create(options) { + return new Batcher(options == null ? void 0 : options.cacheKeyFn, options == null ? void 0 : options.schedulerFn); + } + /** + * Wraps a function in a promise that will be resolved or rejected only once + * for a given key. This will allow multiple calls to the function to be + * made, but only one will be executed at a time. The result of the first + * call will be returned to all callers. + * + * @param key the key to use for the cache + * @param fn the function to wrap + * @returns a promise that resolves to the result of the function + */ async batch(key, fn) { + const cacheKey = this.cacheKeyFn ? await this.cacheKeyFn(key) : key; + if (cacheKey === null) { + return fn({ + resolve: (value)=>Promise.resolve(value), + key + }); + } + const pending = this.pending.get(cacheKey); + if (pending) return pending; + const { promise, resolve, reject } = (0, _promisewithresolvers.createPromiseWithResolvers)(); + this.pending.set(cacheKey, promise); + this.schedulerFn(async ()=>{ + try { + const result = await fn({ + resolve, + key + }); + // Resolving a promise multiple times is a no-op, so we can safely + // resolve all pending promises with the same result. + resolve(result); + } catch (err) { + reject(err); + } finally{ + this.pending.delete(cacheKey); + } + }); + return promise; + } +} + +//# sourceMappingURL=batcher.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/batcher.js.map b/e-commerce/node_modules/next/dist/lib/batcher.js.map new file mode 100644 index 0000000000000000000000000000000000000000..79b55f1498706f60ce88ef8f0fabe60bcb90cff3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/batcher.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/batcher.ts"],"sourcesContent":["import type { SchedulerFn } from './scheduler'\n\nimport { createPromiseWithResolvers } from '../shared/lib/promise-with-resolvers'\n\ntype CacheKeyFn<K, C extends string | number | null> = (\n key: K\n) => PromiseLike<C> | C\n\ntype BatcherOptions<K, C extends string | number | null> = {\n cacheKeyFn?: CacheKeyFn<K, C>\n schedulerFn?: SchedulerFn<void>\n}\n\ntype WorkFnContext<V, K> = {\n resolve: (value: V | PromiseLike<V>) => void\n key: K\n}\n\ntype WorkFn<V, K> = (context: WorkFnContext<V, K>) => Promise<V>\n\n/**\n * A wrapper for a function that will only allow one call to the function to\n * execute at a time.\n */\nexport class Batcher<K, V, C extends string | number | null> {\n private readonly pending = new Map<C, Promise<V>>()\n\n protected constructor(\n private readonly cacheKeyFn?: CacheKeyFn<K, C>,\n /**\n * A function that will be called to schedule the wrapped function to be\n * executed. This defaults to a function that will execute the function\n * immediately.\n */\n private readonly schedulerFn: SchedulerFn<void> = (fn) => fn()\n ) {}\n\n /**\n * Creates a new instance of PendingWrapper. If the key extends a string or\n * number, the key will be used as the cache key. If the key is an object, a\n * cache key function must be provided.\n */\n public static create<K extends string | number | null, V>(\n options?: BatcherOptions<K, K>\n ): Batcher<K, V, K>\n public static create<K, V, C extends string | number | null>(\n options: BatcherOptions<K, C> &\n Required<Pick<BatcherOptions<K, C>, 'cacheKeyFn'>>\n ): Batcher<K, V, C>\n public static create<K, V, C extends string | number | null>(\n options?: BatcherOptions<K, C>\n ): Batcher<K, V, C> {\n return new Batcher<K, V, C>(options?.cacheKeyFn, options?.schedulerFn)\n }\n\n /**\n * Wraps a function in a promise that will be resolved or rejected only once\n * for a given key. This will allow multiple calls to the function to be\n * made, but only one will be executed at a time. The result of the first\n * call will be returned to all callers.\n *\n * @param key the key to use for the cache\n * @param fn the function to wrap\n * @returns a promise that resolves to the result of the function\n */\n public async batch(key: K, fn: WorkFn<V, K>): Promise<V> {\n const cacheKey = (this.cacheKeyFn ? await this.cacheKeyFn(key) : key) as C\n if (cacheKey === null) {\n return fn({ resolve: (value) => Promise.resolve(value), key })\n }\n\n const pending = this.pending.get(cacheKey)\n if (pending) return pending\n\n const { promise, resolve, reject } = createPromiseWithResolvers<V>()\n this.pending.set(cacheKey, promise)\n\n this.schedulerFn(async () => {\n try {\n const result = await fn({ resolve, key })\n\n // Resolving a promise multiple times is a no-op, so we can safely\n // resolve all pending promises with the same result.\n resolve(result)\n } catch (err) {\n reject(err)\n } finally {\n this.pending.delete(cacheKey)\n }\n })\n\n return promise\n }\n}\n"],"names":["Batcher","cacheKeyFn","schedulerFn","fn","pending","Map","create","options","batch","key","cacheKey","resolve","value","Promise","get","promise","reject","createPromiseWithResolvers","set","result","err","delete"],"mappings":";;;;+BAwBaA;;;eAAAA;;;sCAtB8B;AAsBpC,MAAMA;IAGX,YACE,AAAiBC,UAA6B,EAC9C;;;;KAIC,GACD,AAAiBC,cAAiC,CAACC,KAAOA,IAAI,CAC9D;aAPiBF,aAAAA;aAMAC,cAAAA;aATFE,UAAU,IAAIC;IAU5B;IAcH,OAAcC,OACZC,OAA8B,EACZ;QAClB,OAAO,IAAIP,QAAiBO,2BAAAA,QAASN,UAAU,EAAEM,2BAAAA,QAASL,WAAW;IACvE;IAEA;;;;;;;;;GASC,GACD,MAAaM,MAAMC,GAAM,EAAEN,EAAgB,EAAc;QACvD,MAAMO,WAAY,IAAI,CAACT,UAAU,GAAG,MAAM,IAAI,CAACA,UAAU,CAACQ,OAAOA;QACjE,IAAIC,aAAa,MAAM;YACrB,OAAOP,GAAG;gBAAEQ,SAAS,CAACC,QAAUC,QAAQF,OAAO,CAACC;gBAAQH;YAAI;QAC9D;QAEA,MAAML,UAAU,IAAI,CAACA,OAAO,CAACU,GAAG,CAACJ;QACjC,IAAIN,SAAS,OAAOA;QAEpB,MAAM,EAAEW,OAAO,EAAEJ,OAAO,EAAEK,MAAM,EAAE,GAAGC,IAAAA,gDAA0B;QAC/D,IAAI,CAACb,OAAO,CAACc,GAAG,CAACR,UAAUK;QAE3B,IAAI,CAACb,WAAW,CAAC;YACf,IAAI;gBACF,MAAMiB,SAAS,MAAMhB,GAAG;oBAAEQ;oBAASF;gBAAI;gBAEvC,kEAAkE;gBAClE,qDAAqD;gBACrDE,QAAQQ;YACV,EAAE,OAAOC,KAAK;gBACZJ,OAAOI;YACT,SAAU;gBACR,IAAI,CAAChB,OAAO,CAACiB,MAAM,CAACX;YACtB;QACF;QAEA,OAAOK;IACT;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/build-custom-route.d.ts b/e-commerce/node_modules/next/dist/lib/build-custom-route.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..048834e283f82fd88dfde85b5cc1b579e4c6068b --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/build-custom-route.d.ts @@ -0,0 +1,5 @@ +import type { ManifestHeaderRoute, ManifestRedirectRoute, ManifestRewriteRoute } from '../build'; +import { type Header, type Redirect, type Rewrite } from './load-custom-routes'; +export declare function buildCustomRoute(type: 'header', route: Header): ManifestHeaderRoute; +export declare function buildCustomRoute(type: 'rewrite', route: Rewrite): ManifestRewriteRoute; +export declare function buildCustomRoute(type: 'redirect', route: Redirect, restrictedRedirectPaths: string[]): ManifestRedirectRoute; diff --git a/e-commerce/node_modules/next/dist/lib/build-custom-route.js b/e-commerce/node_modules/next/dist/lib/build-custom-route.js new file mode 100644 index 0000000000000000000000000000000000000000..b236676be61f2ecc46449856daaa9f23f9c7a420 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/build-custom-route.js @@ -0,0 +1,46 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "buildCustomRoute", { + enumerable: true, + get: function() { + return buildCustomRoute; + } +}); +const _pathtoregexp = require("next/dist/compiled/path-to-regexp"); +const _loadcustomroutes = require("./load-custom-routes"); +const _redirectstatus = require("./redirect-status"); +function buildCustomRoute(type, route, restrictedRedirectPaths) { + const compiled = (0, _pathtoregexp.pathToRegexp)(route.source, [], { + strict: true, + sensitive: false, + delimiter: '/' + }); + // If this is an internal rewrite and it already provides a regex, use it + // otherwise, normalize the source to a regex. + let regex; + if (!route.internal || type !== 'rewrite' || !('regex' in route) || typeof route.regex !== 'string') { + let source = compiled.source; + if (!route.internal) { + source = (0, _redirectstatus.modifyRouteRegex)(source, type === 'redirect' ? restrictedRedirectPaths : undefined); + } + regex = (0, _loadcustomroutes.normalizeRouteRegex)(source); + } else { + regex = route.regex; + } + if (type !== 'redirect') { + return { + ...route, + regex + }; + } + return { + ...route, + statusCode: (0, _redirectstatus.getRedirectStatus)(route), + permanent: undefined, + regex + }; +} + +//# sourceMappingURL=build-custom-route.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/build-custom-route.js.map b/e-commerce/node_modules/next/dist/lib/build-custom-route.js.map new file mode 100644 index 0000000000000000000000000000000000000000..786a2713898242c944fc08efc2f28319fb095151 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/build-custom-route.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/build-custom-route.ts"],"sourcesContent":["import { pathToRegexp } from 'next/dist/compiled/path-to-regexp'\nimport type {\n ManifestHeaderRoute,\n ManifestRedirectRoute,\n ManifestRewriteRoute,\n} from '../build'\nimport {\n normalizeRouteRegex,\n type Header,\n type Redirect,\n type Rewrite,\n type RouteType,\n} from './load-custom-routes'\nimport { getRedirectStatus, modifyRouteRegex } from './redirect-status'\n\nexport function buildCustomRoute(\n type: 'header',\n route: Header\n): ManifestHeaderRoute\nexport function buildCustomRoute(\n type: 'rewrite',\n route: Rewrite\n): ManifestRewriteRoute\nexport function buildCustomRoute(\n type: 'redirect',\n route: Redirect,\n restrictedRedirectPaths: string[]\n): ManifestRedirectRoute\nexport function buildCustomRoute(\n type: RouteType,\n route: Redirect | Rewrite | Header,\n restrictedRedirectPaths?: string[]\n): ManifestHeaderRoute | ManifestRewriteRoute | ManifestRedirectRoute {\n const compiled = pathToRegexp(route.source, [], {\n strict: true,\n sensitive: false,\n delimiter: '/', // default is `/#?`, but Next does not pass query info\n })\n\n // If this is an internal rewrite and it already provides a regex, use it\n // otherwise, normalize the source to a regex.\n let regex: string\n if (\n !route.internal ||\n type !== 'rewrite' ||\n !('regex' in route) ||\n typeof route.regex !== 'string'\n ) {\n let source = compiled.source\n if (!route.internal) {\n source = modifyRouteRegex(\n source,\n type === 'redirect' ? restrictedRedirectPaths : undefined\n )\n }\n\n regex = normalizeRouteRegex(source)\n } else {\n regex = route.regex\n }\n\n if (type !== 'redirect') {\n return { ...route, regex }\n }\n\n return {\n ...route,\n statusCode: getRedirectStatus(route as Redirect),\n permanent: undefined,\n regex,\n }\n}\n"],"names":["buildCustomRoute","type","route","restrictedRedirectPaths","compiled","pathToRegexp","source","strict","sensitive","delimiter","regex","internal","modifyRouteRegex","undefined","normalizeRouteRegex","statusCode","getRedirectStatus","permanent"],"mappings":";;;;+BA4BgBA;;;eAAAA;;;8BA5Ba;kCAYtB;gCAC6C;AAe7C,SAASA,iBACdC,IAAe,EACfC,KAAkC,EAClCC,uBAAkC;IAElC,MAAMC,WAAWC,IAAAA,0BAAY,EAACH,MAAMI,MAAM,EAAE,EAAE,EAAE;QAC9CC,QAAQ;QACRC,WAAW;QACXC,WAAW;IACb;IAEA,yEAAyE;IACzE,8CAA8C;IAC9C,IAAIC;IACJ,IACE,CAACR,MAAMS,QAAQ,IACfV,SAAS,aACT,CAAE,CAAA,WAAWC,KAAI,KACjB,OAAOA,MAAMQ,KAAK,KAAK,UACvB;QACA,IAAIJ,SAASF,SAASE,MAAM;QAC5B,IAAI,CAACJ,MAAMS,QAAQ,EAAE;YACnBL,SAASM,IAAAA,gCAAgB,EACvBN,QACAL,SAAS,aAAaE,0BAA0BU;QAEpD;QAEAH,QAAQI,IAAAA,qCAAmB,EAACR;IAC9B,OAAO;QACLI,QAAQR,MAAMQ,KAAK;IACrB;IAEA,IAAIT,SAAS,YAAY;QACvB,OAAO;YAAE,GAAGC,KAAK;YAAEQ;QAAM;IAC3B;IAEA,OAAO;QACL,GAAGR,KAAK;QACRa,YAAYC,IAAAA,iCAAiB,EAACd;QAC9Be,WAAWJ;QACXH;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/bundler.d.ts b/e-commerce/node_modules/next/dist/lib/bundler.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bcee538f49a4aa459578397b158b8f82c526bb25 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/bundler.d.ts @@ -0,0 +1,30 @@ +export declare enum Bundler { + Turbopack = 0, + Webpack = 1, + Rspack = 2 +} +export declare function bundlerName(bundler: Bundler): string; +/** + * Derive the currently configured bundler from the environment. + */ +export declare function getBundlerFromEnv(): Bundler; +/** + * Parse the bundler arguments and potentially sets the `TURBOPACK` environment variable. + * + * NOTE: rspack is configured via next config which is chaotic so it is possible for this to be overridden later. + * + * @param options The options to parse. + * @returns The bundler that was configured + */ +export declare function parseBundlerArgs(options: { + turbo?: boolean; + turbopack?: boolean; + webpack?: boolean; +}): Bundler; +/** + * Finalize the bundler based on the config. + * + * Rspack is configured via next config by setting an environment variable (yay, side effects) + * so this should only be called after parsing the config. + */ +export declare function finalizeBundlerFromConfig(fromOptions: Bundler): Bundler; diff --git a/e-commerce/node_modules/next/dist/lib/bundler.js b/e-commerce/node_modules/next/dist/lib/bundler.js new file mode 100644 index 0000000000000000000000000000000000000000..b28f5c1785f0b2ead57bb80532430694b3f222db --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/bundler.js @@ -0,0 +1,168 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + Bundler: null, + bundlerName: null, + finalizeBundlerFromConfig: null, + getBundlerFromEnv: null, + parseBundlerArgs: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + Bundler: function() { + return Bundler; + }, + bundlerName: function() { + return bundlerName; + }, + finalizeBundlerFromConfig: function() { + return finalizeBundlerFromConfig; + }, + getBundlerFromEnv: function() { + return getBundlerFromEnv; + }, + parseBundlerArgs: function() { + return parseBundlerArgs; + } +}); +const _log = /*#__PURE__*/ _interop_require_wildcard(require("../build/output/log")); +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +var Bundler = /*#__PURE__*/ function(Bundler) { + Bundler[Bundler["Turbopack"] = 0] = "Turbopack"; + Bundler[Bundler["Webpack"] = 1] = "Webpack"; + Bundler[Bundler["Rspack"] = 2] = "Rspack"; + return Bundler; +}({}); +function bundlerName(bundler) { + switch(bundler){ + case 0: + return 'Turbopack'; + case 1: + return 'webpack'; + case 2: + return 'Rspack'; + } +} +function getBundlerFromEnv() { + if (process.env.NEXT_RSPACK) { + return 2; + } + if (process.env.TURBOPACK) { + return 0; + } + return 1; +} +function parseBundlerArgs(options) { + const bundlerFlags = new Map(); + const setBundlerFlag = (bundler, flag)=>{ + bundlerFlags.set(bundler, (bundlerFlags.get(bundler) ?? []).concat(flag)); + }; + // What turbo flag was set? We allow multiple to be set, which is silly but not ambiguous, just pick the most relevant one. + if (options.turbopack) { + setBundlerFlag(0, '--turbopack'); + } + if (options.turbo) { + setBundlerFlag(0, '--turbo'); + } else if (process.env.TURBOPACK) { + // We don't really want to support this but it is trivial and not really confusing. + // If we don't support it and someone sets it, we would have inconsistent behavior + // since some parts of next would read the return value of this function and other + // parts will read the env variable. + setBundlerFlag(0, `TURBOPACK=${process.env.TURBOPACK}`); + } else if (process.env.IS_TURBOPACK_TEST) { + setBundlerFlag(0, `IS_TURBOPACK_TEST=${process.env.IS_TURBOPACK_TEST}`); + } + if (options.webpack) { + setBundlerFlag(1, '--webpack'); + } + if (process.env.IS_WEBPACK_TEST) { + setBundlerFlag(1, `IS_WEBPACK_TEST=${process.env.IS_WEBPACK_TEST}`); + } + // Mostly this is set via the NextConfig but it can also be set via the command line which is + // common for testing. + if (process.env.NEXT_RSPACK) { + setBundlerFlag(2, `NEXT_RSPACK=${process.env.NEXT_RSPACK}`); + } + if (process.env.NEXT_TEST_USE_RSPACK) { + setBundlerFlag(2, `NEXT_TEST_USE_RSPACK=${process.env.NEXT_TEST_USE_RSPACK}`); + } + if (bundlerFlags.size > 1) { + console.error(`Multiple bundler flags set: ${Array.from(bundlerFlags.values()).flat().join(', ')}. + +Edit your command or your package.json script to configure only one bundler.`); + process.exit(1); + } + // The default is turbopack when nothing is configured. + if (bundlerFlags.size === 0) { + process.env.TURBOPACK = 'auto'; + return 0; + } + if (bundlerFlags.has(0)) { + // Only conditionally assign to the environment variable, preserving already set values. + // If it was set to 'auto' because no flag was set and this function is called a second time we + // would upgrade to '1' but we don't really want that. + process.env.TURBOPACK ??= '1'; + return 0; + } + // Otherwise it is one of rspack or webpack. At this point there must be exactly one key in the map. + return bundlerFlags.keys().next().value; +} +function finalizeBundlerFromConfig(fromOptions) { + // Reading the next config can set NEXT_RSPACK environment variables. + if (process.env.NEXT_RSPACK) { + if (fromOptions !== 2) { + _log.event(`Switching bundler from ${bundlerName(fromOptions)} to Rspack based on config`); + } + return 2; + } + return fromOptions; +} + +//# sourceMappingURL=bundler.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/bundler.js.map b/e-commerce/node_modules/next/dist/lib/bundler.js.map new file mode 100644 index 0000000000000000000000000000000000000000..86e458b110eca6e0df3cec116864503b8dbb74ea --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/bundler.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/bundler.ts"],"sourcesContent":["import * as Log from '../build/output/log'\n\n/// Utilties for configuring the bundler to use.\nexport enum Bundler {\n Turbopack,\n Webpack,\n Rspack,\n}\n\nexport function bundlerName(bundler: Bundler): string {\n switch (bundler) {\n case Bundler.Turbopack:\n return 'Turbopack'\n case Bundler.Webpack:\n return 'webpack'\n case Bundler.Rspack:\n return 'Rspack'\n }\n}\n\n/**\n * Derive the currently configured bundler from the environment.\n */\nexport function getBundlerFromEnv(): Bundler {\n if (process.env.NEXT_RSPACK) {\n return Bundler.Rspack\n }\n if (process.env.TURBOPACK) {\n return Bundler.Turbopack\n }\n return Bundler.Webpack\n}\n/**\n * Parse the bundler arguments and potentially sets the `TURBOPACK` environment variable.\n *\n * NOTE: rspack is configured via next config which is chaotic so it is possible for this to be overridden later.\n *\n * @param options The options to parse.\n * @returns The bundler that was configured\n */\nexport function parseBundlerArgs(options: {\n turbo?: boolean\n turbopack?: boolean\n webpack?: boolean\n}): Bundler {\n const bundlerFlags = new Map<Bundler, string[]>()\n const setBundlerFlag = (bundler: Bundler, flag: string) => {\n bundlerFlags.set(bundler, (bundlerFlags.get(bundler) ?? []).concat(flag))\n }\n // What turbo flag was set? We allow multiple to be set, which is silly but not ambiguous, just pick the most relevant one.\n if (options.turbopack) {\n setBundlerFlag(Bundler.Turbopack, '--turbopack')\n }\n if (options.turbo) {\n setBundlerFlag(Bundler.Turbopack, '--turbo')\n } else if (process.env.TURBOPACK) {\n // We don't really want to support this but it is trivial and not really confusing.\n // If we don't support it and someone sets it, we would have inconsistent behavior\n // since some parts of next would read the return value of this function and other\n // parts will read the env variable.\n setBundlerFlag(Bundler.Turbopack, `TURBOPACK=${process.env.TURBOPACK}`)\n } else if (process.env.IS_TURBOPACK_TEST) {\n setBundlerFlag(\n Bundler.Turbopack,\n `IS_TURBOPACK_TEST=${process.env.IS_TURBOPACK_TEST}`\n )\n }\n if (options.webpack) {\n setBundlerFlag(Bundler.Webpack, '--webpack')\n }\n\n if (process.env.IS_WEBPACK_TEST) {\n setBundlerFlag(\n Bundler.Webpack,\n `IS_WEBPACK_TEST=${process.env.IS_WEBPACK_TEST}`\n )\n }\n\n // Mostly this is set via the NextConfig but it can also be set via the command line which is\n // common for testing.\n if (process.env.NEXT_RSPACK) {\n setBundlerFlag(Bundler.Rspack, `NEXT_RSPACK=${process.env.NEXT_RSPACK}`)\n }\n if (process.env.NEXT_TEST_USE_RSPACK) {\n setBundlerFlag(\n Bundler.Rspack,\n `NEXT_TEST_USE_RSPACK=${process.env.NEXT_TEST_USE_RSPACK}`\n )\n }\n\n if (bundlerFlags.size > 1) {\n console.error(\n `Multiple bundler flags set: ${Array.from(bundlerFlags.values()).flat().join(', ')}.\n\nEdit your command or your package.json script to configure only one bundler.`\n )\n process.exit(1)\n }\n // The default is turbopack when nothing is configured.\n if (bundlerFlags.size === 0) {\n process.env.TURBOPACK = 'auto'\n return Bundler.Turbopack\n }\n if (bundlerFlags.has(Bundler.Turbopack)) {\n // Only conditionally assign to the environment variable, preserving already set values.\n // If it was set to 'auto' because no flag was set and this function is called a second time we\n // would upgrade to '1' but we don't really want that.\n process.env.TURBOPACK ??= '1'\n return Bundler.Turbopack\n }\n // Otherwise it is one of rspack or webpack. At this point there must be exactly one key in the map.\n return bundlerFlags.keys().next().value!\n}\n\n/**\n * Finalize the bundler based on the config.\n *\n * Rspack is configured via next config by setting an environment variable (yay, side effects)\n * so this should only be called after parsing the config.\n */\nexport function finalizeBundlerFromConfig(fromOptions: Bundler) {\n // Reading the next config can set NEXT_RSPACK environment variables.\n if (process.env.NEXT_RSPACK) {\n if (fromOptions !== Bundler.Rspack) {\n Log.event(\n `Switching bundler from ${bundlerName(fromOptions)} to Rspack based on config`\n )\n }\n return Bundler.Rspack\n }\n return fromOptions\n}\n"],"names":["Bundler","bundlerName","finalizeBundlerFromConfig","getBundlerFromEnv","parseBundlerArgs","bundler","process","env","NEXT_RSPACK","TURBOPACK","options","bundlerFlags","Map","setBundlerFlag","flag","set","get","concat","turbopack","turbo","IS_TURBOPACK_TEST","webpack","IS_WEBPACK_TEST","NEXT_TEST_USE_RSPACK","size","console","error","Array","from","values","flat","join","exit","has","keys","next","value","fromOptions","Log","event"],"mappings":";;;;;;;;;;;;;;;;;;IAGYA,OAAO;eAAPA;;IAMIC,WAAW;eAAXA;;IA+GAC,yBAAyB;eAAzBA;;IAjGAC,iBAAiB;eAAjB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,kBAA+B,CAAC,YAAY,EAAEP,QAAQC,GAAG,CAACC,WAAW,EAAE;IACzE;IACA,IAAIF,QAAQC,GAAG,CAACgB,oBAAoB,EAAE;QACpCV,kBAEE,CAAC,qBAAqB,EAAEP,QAAQC,GAAG,CAACgB,oBAAoB,EAAE;IAE9D;IAEA,IAAIZ,aAAaa,IAAI,GAAG,GAAG;QACzBC,QAAQC,KAAK,CACX,CAAC,4BAA4B,EAAEC,MAAMC,IAAI,CAACjB,aAAakB,MAAM,IAAIC,IAAI,GAAGC,IAAI,CAAC,MAAM;;4EAEb,CAAC;QAEzEzB,QAAQ0B,IAAI,CAAC;IACf;IACA,uDAAuD;IACvD,IAAIrB,aAAaa,IAAI,KAAK,GAAG;QAC3BlB,QAAQC,GAAG,CAACE,SAAS,GAAG;QACxB;IACF;IACA,IAAIE,aAAasB,GAAG,KAAqB;QACvC,wFAAwF;QACxF,+FAA+F;QAC/F,sDAAsD;QACtD3B,QAAQC,GAAG,CAACE,SAAS,KAAK;QAC1B;IACF;IACA,oGAAoG;IACpG,OAAOE,aAAauB,IAAI,GAAGC,IAAI,GAAGC,KAAK;AACzC;AAQO,SAASlC,0BAA0BmC,WAAoB;IAC5D,qEAAqE;IACrE,IAAI/B,QAAQC,GAAG,CAACC,WAAW,EAAE;QAC3B,IAAI6B,mBAAgC;YAClCC,KAAIC,KAAK,CACP,CAAC,uBAAuB,EAAEtC,YAAYoC,aAAa,0BAA0B,CAAC;QAElF;QACA;IACF;IACA,OAAOA;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/client-and-server-references.d.ts b/e-commerce/node_modules/next/dist/lib/client-and-server-references.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..12c458b4ce281c363dc222febb60cea94f50dca6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/client-and-server-references.d.ts @@ -0,0 +1,10 @@ +import { type ServerReferenceInfo } from '../shared/lib/server-reference-info'; +export interface ServerReference { + $$typeof: Symbol; + $$id: string; +} +export type ServerFunction = ServerReference & ((...args: unknown[]) => Promise<unknown>); +export declare function isServerReference<T>(value: T & Partial<ServerReference>): value is T & ServerFunction; +export declare function isUseCacheFunction<T>(value: T & Partial<ServerReference>): value is T & ServerFunction; +export declare function getUseCacheFunctionInfo<T>(value: T & Partial<ServerReference>): ServerReferenceInfo | null; +export declare function isClientReference(mod: any): boolean; diff --git a/e-commerce/node_modules/next/dist/lib/client-and-server-references.js b/e-commerce/node_modules/next/dist/lib/client-and-server-references.js new file mode 100644 index 0000000000000000000000000000000000000000..2545cc0a02e99dbc5a3cf4ceb3cc10b9888eaec8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/client-and-server-references.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + getUseCacheFunctionInfo: null, + isClientReference: null, + isServerReference: null, + isUseCacheFunction: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + getUseCacheFunctionInfo: function() { + return getUseCacheFunctionInfo; + }, + isClientReference: function() { + return isClientReference; + }, + isServerReference: function() { + return isServerReference; + }, + isUseCacheFunction: function() { + return isUseCacheFunction; + } +}); +const _serverreferenceinfo = require("../shared/lib/server-reference-info"); +function isServerReference(value) { + return value.$$typeof === Symbol.for('react.server.reference'); +} +function isUseCacheFunction(value) { + if (!isServerReference(value)) { + return false; + } + const { type } = (0, _serverreferenceinfo.extractInfoFromServerReferenceId)(value.$$id); + return type === 'use-cache'; +} +function getUseCacheFunctionInfo(value) { + if (!isServerReference(value)) { + return null; + } + const info = (0, _serverreferenceinfo.extractInfoFromServerReferenceId)(value.$$id); + return info.type === 'use-cache' ? info : null; +} +function isClientReference(mod) { + const defaultExport = (mod == null ? void 0 : mod.default) || mod; + return (defaultExport == null ? void 0 : defaultExport.$$typeof) === Symbol.for('react.client.reference'); +} + +//# sourceMappingURL=client-and-server-references.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/client-and-server-references.js.map b/e-commerce/node_modules/next/dist/lib/client-and-server-references.js.map new file mode 100644 index 0000000000000000000000000000000000000000..81ae2e3c0153a80fba7ffeb01ce921a7f5c6023f --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/client-and-server-references.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/client-and-server-references.ts"],"sourcesContent":["import {\n extractInfoFromServerReferenceId,\n type ServerReferenceInfo,\n} from '../shared/lib/server-reference-info'\n\n// Only contains the properties we're interested in.\nexport interface ServerReference {\n $$typeof: Symbol\n $$id: string\n}\n\nexport type ServerFunction = ServerReference &\n ((...args: unknown[]) => Promise<unknown>)\n\nexport function isServerReference<T>(\n value: T & Partial<ServerReference>\n): value is T & ServerFunction {\n return value.$$typeof === Symbol.for('react.server.reference')\n}\n\nexport function isUseCacheFunction<T>(\n value: T & Partial<ServerReference>\n): value is T & ServerFunction {\n if (!isServerReference(value)) {\n return false\n }\n\n const { type } = extractInfoFromServerReferenceId(value.$$id)\n\n return type === 'use-cache'\n}\n\nexport function getUseCacheFunctionInfo<T>(\n value: T & Partial<ServerReference>\n): ServerReferenceInfo | null {\n if (!isServerReference(value)) {\n return null\n }\n\n const info = extractInfoFromServerReferenceId(value.$$id)\n\n return info.type === 'use-cache' ? info : null\n}\n\nexport function isClientReference(mod: any): boolean {\n const defaultExport = mod?.default || mod\n return defaultExport?.$$typeof === Symbol.for('react.client.reference')\n}\n"],"names":["getUseCacheFunctionInfo","isClientReference","isServerReference","isUseCacheFunction","value","$$typeof","Symbol","for","type","extractInfoFromServerReferenceId","$$id","info","mod","defaultExport","default"],"mappings":";;;;;;;;;;;;;;;;;IAgCgBA,uBAAuB;eAAvBA;;IAYAC,iBAAiB;eAAjBA;;IA9BAC,iBAAiB;eAAjBA;;IAMAC,kBAAkB;eAAlBA;;;qCAjBT;AAWA,SAASD,kBACdE,KAAmC;IAEnC,OAAOA,MAAMC,QAAQ,KAAKC,OAAOC,GAAG,CAAC;AACvC;AAEO,SAASJ,mBACdC,KAAmC;IAEnC,IAAI,CAACF,kBAAkBE,QAAQ;QAC7B,OAAO;IACT;IAEA,MAAM,EAAEI,IAAI,EAAE,GAAGC,IAAAA,qDAAgC,EAACL,MAAMM,IAAI;IAE5D,OAAOF,SAAS;AAClB;AAEO,SAASR,wBACdI,KAAmC;IAEnC,IAAI,CAACF,kBAAkBE,QAAQ;QAC7B,OAAO;IACT;IAEA,MAAMO,OAAOF,IAAAA,qDAAgC,EAACL,MAAMM,IAAI;IAExD,OAAOC,KAAKH,IAAI,KAAK,cAAcG,OAAO;AAC5C;AAEO,SAASV,kBAAkBW,GAAQ;IACxC,MAAMC,gBAAgBD,CAAAA,uBAAAA,IAAKE,OAAO,KAAIF;IACtC,OAAOC,CAAAA,iCAAAA,cAAeR,QAAQ,MAAKC,OAAOC,GAAG,CAAC;AAChD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/coalesced-function.d.ts b/e-commerce/node_modules/next/dist/lib/coalesced-function.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..db2834bfdfd3d37af9a1d859c7fd9a8bcff2eab6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/coalesced-function.d.ts @@ -0,0 +1,7 @@ +type CoalescedInvoke<T> = { + isOrigin: boolean; + value: T; +}; +export type UnwrapPromise<T> = T extends Promise<infer U> ? U : T; +export declare function withCoalescedInvoke<F extends (...args: any) => any>(func: F): (key: string, args: Parameters<F>) => Promise<CoalescedInvoke<UnwrapPromise<ReturnType<F>>>>; +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/coalesced-function.js b/e-commerce/node_modules/next/dist/lib/coalesced-function.js new file mode 100644 index 0000000000000000000000000000000000000000..aa70314ff387fca03f9b2c1f3e28cadbe6bae701 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/coalesced-function.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "withCoalescedInvoke", { + enumerable: true, + get: function() { + return withCoalescedInvoke; + } +}); +const globalInvokeCache = new Map(); +function withCoalescedInvoke(func) { + return async function(key, args) { + const entry = globalInvokeCache.get(key); + if (entry) { + return entry.then((res)=>({ + isOrigin: false, + value: res.value + })); + } + async function __wrapper() { + return await func.apply(undefined, args); + } + const future = __wrapper().then((res)=>{ + globalInvokeCache.delete(key); + return { + isOrigin: true, + value: res + }; + }).catch((err)=>{ + globalInvokeCache.delete(key); + return Promise.reject(err); + }); + globalInvokeCache.set(key, future); + return future; + }; +} + +//# sourceMappingURL=coalesced-function.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/coalesced-function.js.map b/e-commerce/node_modules/next/dist/lib/coalesced-function.js.map new file mode 100644 index 0000000000000000000000000000000000000000..924a16540c7d512aa8ffca245569c9a8c2fe598f --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/coalesced-function.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/coalesced-function.ts"],"sourcesContent":["type CoalescedInvoke<T> = {\n isOrigin: boolean\n value: T\n}\n\nexport type UnwrapPromise<T> = T extends Promise<infer U> ? U : T\n\nconst globalInvokeCache = new Map<string, Promise<CoalescedInvoke<unknown>>>()\n\nexport function withCoalescedInvoke<F extends (...args: any) => any>(\n func: F\n): (\n key: string,\n args: Parameters<F>\n) => Promise<CoalescedInvoke<UnwrapPromise<ReturnType<F>>>> {\n return async function (key: string, args: Parameters<F>) {\n const entry = globalInvokeCache.get(key)\n if (entry) {\n return entry.then((res) => ({\n isOrigin: false,\n value: res.value as UnwrapPromise<ReturnType<F>>,\n }))\n }\n\n async function __wrapper() {\n return await func.apply(undefined, args)\n }\n\n const future = __wrapper()\n .then((res) => {\n globalInvokeCache.delete(key)\n return { isOrigin: true, value: res as UnwrapPromise<ReturnType<F>> }\n })\n .catch((err) => {\n globalInvokeCache.delete(key)\n return Promise.reject(err)\n })\n globalInvokeCache.set(key, future)\n return future\n }\n}\n"],"names":["withCoalescedInvoke","globalInvokeCache","Map","func","key","args","entry","get","then","res","isOrigin","value","__wrapper","apply","undefined","future","delete","catch","err","Promise","reject","set"],"mappings":";;;;+BASgBA;;;eAAAA;;;AAFhB,MAAMC,oBAAoB,IAAIC;AAEvB,SAASF,oBACdG,IAAO;IAKP,OAAO,eAAgBC,GAAW,EAAEC,IAAmB;QACrD,MAAMC,QAAQL,kBAAkBM,GAAG,CAACH;QACpC,IAAIE,OAAO;YACT,OAAOA,MAAME,IAAI,CAAC,CAACC,MAAS,CAAA;oBAC1BC,UAAU;oBACVC,OAAOF,IAAIE,KAAK;gBAClB,CAAA;QACF;QAEA,eAAeC;YACb,OAAO,MAAMT,KAAKU,KAAK,CAACC,WAAWT;QACrC;QAEA,MAAMU,SAASH,YACZJ,IAAI,CAAC,CAACC;YACLR,kBAAkBe,MAAM,CAACZ;YACzB,OAAO;gBAAEM,UAAU;gBAAMC,OAAOF;YAAoC;QACtE,GACCQ,KAAK,CAAC,CAACC;YACNjB,kBAAkBe,MAAM,CAACZ;YACzB,OAAOe,QAAQC,MAAM,CAACF;QACxB;QACFjB,kBAAkBoB,GAAG,CAACjB,KAAKW;QAC3B,OAAOA;IACT;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/compile-error.d.ts b/e-commerce/node_modules/next/dist/lib/compile-error.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..07e88814b17d34c7b41c5eb5098a1ec357fcb4cf --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/compile-error.d.ts @@ -0,0 +1,2 @@ +export declare class CompileError extends Error { +} diff --git a/e-commerce/node_modules/next/dist/lib/compile-error.js b/e-commerce/node_modules/next/dist/lib/compile-error.js new file mode 100644 index 0000000000000000000000000000000000000000..63b1acd1e8647ee8152cf8d27f30e91a1a8b04ee --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/compile-error.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "CompileError", { + enumerable: true, + get: function() { + return CompileError; + } +}); +class CompileError extends Error { +} + +//# sourceMappingURL=compile-error.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/compile-error.js.map b/e-commerce/node_modules/next/dist/lib/compile-error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ca8e660beaa3ef378b612d8032857f0fc4100a6b --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/compile-error.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/compile-error.ts"],"sourcesContent":["export class CompileError extends Error {}\n"],"names":["CompileError","Error"],"mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,MAAMA,qBAAqBC;AAAO","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/constants.d.ts b/e-commerce/node_modules/next/dist/lib/constants.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a930361c992290533611cd31686ca56fbf9e51b1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/constants.d.ts @@ -0,0 +1,150 @@ +import type { ServerRuntime } from '../types'; +export declare const TEXT_PLAIN_CONTENT_TYPE_HEADER = "text/plain"; +export declare const HTML_CONTENT_TYPE_HEADER = "text/html; charset=utf-8"; +export declare const JSON_CONTENT_TYPE_HEADER = "application/json; charset=utf-8"; +export declare const NEXT_QUERY_PARAM_PREFIX = "nxtP"; +export declare const NEXT_INTERCEPTION_MARKER_PREFIX = "nxtI"; +export declare const MATCHED_PATH_HEADER = "x-matched-path"; +export declare const PRERENDER_REVALIDATE_HEADER = "x-prerender-revalidate"; +export declare const PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER = "x-prerender-revalidate-if-generated"; +export declare const RSC_SEGMENTS_DIR_SUFFIX = ".segments"; +export declare const RSC_SEGMENT_SUFFIX = ".segment.rsc"; +export declare const RSC_SUFFIX = ".rsc"; +export declare const ACTION_SUFFIX = ".action"; +export declare const NEXT_DATA_SUFFIX = ".json"; +export declare const NEXT_META_SUFFIX = ".meta"; +export declare const NEXT_BODY_SUFFIX = ".body"; +export declare const NEXT_NAV_DEPLOYMENT_ID_HEADER = "x-nextjs-deployment-id"; +export declare const NEXT_CACHE_TAGS_HEADER = "x-next-cache-tags"; +export declare const NEXT_CACHE_REVALIDATED_TAGS_HEADER = "x-next-revalidated-tags"; +export declare const NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER = "x-next-revalidate-tag-token"; +export declare const NEXT_RESUME_HEADER = "next-resume"; +export declare const NEXT_RESUME_STATE_LENGTH_HEADER = "x-next-resume-state-length"; +export declare const NEXT_CACHE_TAG_MAX_ITEMS = 128; +export declare const NEXT_CACHE_TAG_MAX_LENGTH = 256; +export declare const NEXT_CACHE_SOFT_TAG_MAX_LENGTH = 1024; +export declare const NEXT_CACHE_IMPLICIT_TAG_ID = "_N_T_"; +export declare const NEXT_CACHE_ROOT_PARAM_TAG_ID = "_N_RP_"; +export declare const CACHE_ONE_YEAR_SECONDS = 31536000; +export declare const INFINITE_CACHE = 4294967294; +export declare const MIDDLEWARE_FILENAME = "middleware"; +export declare const MIDDLEWARE_LOCATION_REGEXP = "(?:src/)?middleware"; +export declare const PROXY_FILENAME = "proxy"; +export declare const PROXY_LOCATION_REGEXP = "(?:src/)?proxy"; +export declare const INSTRUMENTATION_HOOK_FILENAME = "instrumentation"; +export declare const PAGES_DIR_ALIAS = "private-next-pages"; +export declare const DOT_NEXT_ALIAS = "private-dot-next"; +export declare const ROOT_DIR_ALIAS = "private-next-root-dir"; +export declare const APP_DIR_ALIAS = "private-next-app-dir"; +export declare const RSC_MOD_REF_PROXY_ALIAS = "private-next-rsc-mod-ref-proxy"; +export declare const RSC_ACTION_VALIDATE_ALIAS = "private-next-rsc-action-validate"; +export declare const RSC_ACTION_PROXY_ALIAS = "private-next-rsc-server-reference"; +export declare const RSC_CACHE_WRAPPER_ALIAS = "private-next-rsc-cache-wrapper"; +export declare const RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS = "private-next-rsc-track-dynamic-import"; +export declare const RSC_ACTION_ENCRYPTION_ALIAS = "private-next-rsc-action-encryption"; +export declare const RSC_ACTION_CLIENT_WRAPPER_ALIAS = "private-next-rsc-action-client-wrapper"; +export declare const PUBLIC_DIR_MIDDLEWARE_CONFLICT = "You can not have a '_next' folder inside of your public folder. This conflicts with the internal '/_next' route. https://nextjs.org/docs/messages/public-next-folder-conflict"; +export declare const SSG_GET_INITIAL_PROPS_CONFLICT = "You can not use getInitialProps with getStaticProps. To use SSG, please remove your getInitialProps"; +export declare const SERVER_PROPS_GET_INIT_PROPS_CONFLICT = "You can not use getInitialProps with getServerSideProps. Please remove getInitialProps."; +export declare const SERVER_PROPS_SSG_CONFLICT = "You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps"; +export declare const STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR = "can not have getInitialProps/getServerSideProps, https://nextjs.org/docs/messages/404-get-initial-props"; +export declare const SERVER_PROPS_EXPORT_ERROR = "pages with `getServerSideProps` can not be exported. See more info here: https://nextjs.org/docs/messages/gssp-export"; +export declare const GSP_NO_RETURNED_VALUE = "Your `getStaticProps` function did not return an object. Did you forget to add a `return`?"; +export declare const GSSP_NO_RETURNED_VALUE = "Your `getServerSideProps` function did not return an object. Did you forget to add a `return`?"; +export declare const UNSTABLE_REVALIDATE_RENAME_ERROR: string; +export declare const GSSP_COMPONENT_MEMBER_ERROR = "can not be attached to a page's component and must be exported from the page. See more info here: https://nextjs.org/docs/messages/gssp-component-member"; +export declare const NON_STANDARD_NODE_ENV = "You are using a non-standard \"NODE_ENV\" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env"; +export declare const SSG_FALLBACK_EXPORT_ERROR = "Pages with `fallback` enabled in `getStaticPaths` can not be exported. See more info here: https://nextjs.org/docs/messages/ssg-fallback-true-export"; +export declare const ESLINT_DEFAULT_DIRS: string[]; +export declare const SERVER_RUNTIME: Record<string, ServerRuntime>; +export declare const WEB_SOCKET_MAX_RECONNECTIONS = 12; +/** + * The names of the webpack layers. These layers are the primitives for the + * webpack chunks. + */ +declare const WEBPACK_LAYERS_NAMES: { + /** + * The layer for the shared code between the client and server bundles. + */ + readonly shared: "shared"; + /** + * The layer for server-only runtime and picking up `react-server` export conditions. + * Including app router RSC pages and app router custom routes and metadata routes. + */ + readonly reactServerComponents: "rsc"; + /** + * Server Side Rendering layer for app (ssr). + */ + readonly serverSideRendering: "ssr"; + /** + * The browser client bundle layer for actions. + */ + readonly actionBrowser: "action-browser"; + /** + * The Node.js bundle layer for the API routes. + */ + readonly apiNode: "api-node"; + /** + * The Edge Lite bundle layer for the API routes. + */ + readonly apiEdge: "api-edge"; + /** + * The layer for the middleware code. + */ + readonly middleware: "middleware"; + /** + * The layer for the instrumentation hooks. + */ + readonly instrument: "instrument"; + /** + * The layer for assets on the edge. + */ + readonly edgeAsset: "edge-asset"; + /** + * The browser client bundle layer for App directory. + */ + readonly appPagesBrowser: "app-pages-browser"; + /** + * The browser client bundle layer for Pages directory. + */ + readonly pagesDirBrowser: "pages-dir-browser"; + /** + * The Edge Lite bundle layer for Pages directory. + */ + readonly pagesDirEdge: "pages-dir-edge"; + /** + * The Node.js bundle layer for Pages directory. + */ + readonly pagesDirNode: "pages-dir-node"; +}; +export type WebpackLayerName = (typeof WEBPACK_LAYERS_NAMES)[keyof typeof WEBPACK_LAYERS_NAMES]; +declare const WEBPACK_LAYERS: { + GROUP: { + builtinReact: ("rsc" | "action-browser")[]; + serverOnly: ("middleware" | "rsc" | "action-browser" | "instrument")[]; + neutralTarget: ("api-node" | "api-edge")[]; + clientOnly: ("ssr" | "app-pages-browser")[]; + bundled: ("shared" | "middleware" | "rsc" | "ssr" | "action-browser" | "instrument" | "app-pages-browser")[]; + appPages: ("rsc" | "ssr" | "action-browser" | "app-pages-browser")[]; + }; + shared: "shared"; + reactServerComponents: "rsc"; + serverSideRendering: "ssr"; + actionBrowser: "action-browser"; + apiNode: "api-node"; + apiEdge: "api-edge"; + middleware: "middleware"; + instrument: "instrument"; + edgeAsset: "edge-asset"; + appPagesBrowser: "app-pages-browser"; + pagesDirBrowser: "pages-dir-browser"; + pagesDirEdge: "pages-dir-edge"; + pagesDirNode: "pages-dir-node"; +}; +declare const WEBPACK_RESOURCE_QUERIES: { + edgeSSREntry: string; + metadata: string; + metadataRoute: string; + metadataImageMeta: string; +}; +export { WEBPACK_LAYERS, WEBPACK_RESOURCE_QUERIES }; diff --git a/e-commerce/node_modules/next/dist/lib/constants.js b/e-commerce/node_modules/next/dist/lib/constants.js new file mode 100644 index 0000000000000000000000000000000000000000..888d53368fd3d9fe2efbf3ea6f7fbb932f75cd00 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/constants.js @@ -0,0 +1,420 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + ACTION_SUFFIX: null, + APP_DIR_ALIAS: null, + CACHE_ONE_YEAR_SECONDS: null, + DOT_NEXT_ALIAS: null, + ESLINT_DEFAULT_DIRS: null, + GSP_NO_RETURNED_VALUE: null, + GSSP_COMPONENT_MEMBER_ERROR: null, + GSSP_NO_RETURNED_VALUE: null, + HTML_CONTENT_TYPE_HEADER: null, + INFINITE_CACHE: null, + INSTRUMENTATION_HOOK_FILENAME: null, + JSON_CONTENT_TYPE_HEADER: null, + MATCHED_PATH_HEADER: null, + MIDDLEWARE_FILENAME: null, + MIDDLEWARE_LOCATION_REGEXP: null, + NEXT_BODY_SUFFIX: null, + NEXT_CACHE_IMPLICIT_TAG_ID: null, + NEXT_CACHE_REVALIDATED_TAGS_HEADER: null, + NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER: null, + NEXT_CACHE_ROOT_PARAM_TAG_ID: null, + NEXT_CACHE_SOFT_TAG_MAX_LENGTH: null, + NEXT_CACHE_TAGS_HEADER: null, + NEXT_CACHE_TAG_MAX_ITEMS: null, + NEXT_CACHE_TAG_MAX_LENGTH: null, + NEXT_DATA_SUFFIX: null, + NEXT_INTERCEPTION_MARKER_PREFIX: null, + NEXT_META_SUFFIX: null, + NEXT_NAV_DEPLOYMENT_ID_HEADER: null, + NEXT_QUERY_PARAM_PREFIX: null, + NEXT_RESUME_HEADER: null, + NEXT_RESUME_STATE_LENGTH_HEADER: null, + NON_STANDARD_NODE_ENV: null, + PAGES_DIR_ALIAS: null, + PRERENDER_REVALIDATE_HEADER: null, + PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER: null, + PROXY_FILENAME: null, + PROXY_LOCATION_REGEXP: null, + PUBLIC_DIR_MIDDLEWARE_CONFLICT: null, + ROOT_DIR_ALIAS: null, + RSC_ACTION_CLIENT_WRAPPER_ALIAS: null, + RSC_ACTION_ENCRYPTION_ALIAS: null, + RSC_ACTION_PROXY_ALIAS: null, + RSC_ACTION_VALIDATE_ALIAS: null, + RSC_CACHE_WRAPPER_ALIAS: null, + RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS: null, + RSC_MOD_REF_PROXY_ALIAS: null, + RSC_SEGMENTS_DIR_SUFFIX: null, + RSC_SEGMENT_SUFFIX: null, + RSC_SUFFIX: null, + SERVER_PROPS_EXPORT_ERROR: null, + SERVER_PROPS_GET_INIT_PROPS_CONFLICT: null, + SERVER_PROPS_SSG_CONFLICT: null, + SERVER_RUNTIME: null, + SSG_FALLBACK_EXPORT_ERROR: null, + SSG_GET_INITIAL_PROPS_CONFLICT: null, + STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR: null, + TEXT_PLAIN_CONTENT_TYPE_HEADER: null, + UNSTABLE_REVALIDATE_RENAME_ERROR: null, + WEBPACK_LAYERS: null, + WEBPACK_RESOURCE_QUERIES: null, + WEB_SOCKET_MAX_RECONNECTIONS: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + ACTION_SUFFIX: function() { + return ACTION_SUFFIX; + }, + APP_DIR_ALIAS: function() { + return APP_DIR_ALIAS; + }, + CACHE_ONE_YEAR_SECONDS: function() { + return CACHE_ONE_YEAR_SECONDS; + }, + DOT_NEXT_ALIAS: function() { + return DOT_NEXT_ALIAS; + }, + ESLINT_DEFAULT_DIRS: function() { + return ESLINT_DEFAULT_DIRS; + }, + GSP_NO_RETURNED_VALUE: function() { + return GSP_NO_RETURNED_VALUE; + }, + GSSP_COMPONENT_MEMBER_ERROR: function() { + return GSSP_COMPONENT_MEMBER_ERROR; + }, + GSSP_NO_RETURNED_VALUE: function() { + return GSSP_NO_RETURNED_VALUE; + }, + HTML_CONTENT_TYPE_HEADER: function() { + return HTML_CONTENT_TYPE_HEADER; + }, + INFINITE_CACHE: function() { + return INFINITE_CACHE; + }, + INSTRUMENTATION_HOOK_FILENAME: function() { + return INSTRUMENTATION_HOOK_FILENAME; + }, + JSON_CONTENT_TYPE_HEADER: function() { + return JSON_CONTENT_TYPE_HEADER; + }, + MATCHED_PATH_HEADER: function() { + return MATCHED_PATH_HEADER; + }, + MIDDLEWARE_FILENAME: function() { + return MIDDLEWARE_FILENAME; + }, + MIDDLEWARE_LOCATION_REGEXP: function() { + return MIDDLEWARE_LOCATION_REGEXP; + }, + NEXT_BODY_SUFFIX: function() { + return NEXT_BODY_SUFFIX; + }, + NEXT_CACHE_IMPLICIT_TAG_ID: function() { + return NEXT_CACHE_IMPLICIT_TAG_ID; + }, + NEXT_CACHE_REVALIDATED_TAGS_HEADER: function() { + return NEXT_CACHE_REVALIDATED_TAGS_HEADER; + }, + NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER: function() { + return NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER; + }, + NEXT_CACHE_ROOT_PARAM_TAG_ID: function() { + return NEXT_CACHE_ROOT_PARAM_TAG_ID; + }, + NEXT_CACHE_SOFT_TAG_MAX_LENGTH: function() { + return NEXT_CACHE_SOFT_TAG_MAX_LENGTH; + }, + NEXT_CACHE_TAGS_HEADER: function() { + return NEXT_CACHE_TAGS_HEADER; + }, + NEXT_CACHE_TAG_MAX_ITEMS: function() { + return NEXT_CACHE_TAG_MAX_ITEMS; + }, + NEXT_CACHE_TAG_MAX_LENGTH: function() { + return NEXT_CACHE_TAG_MAX_LENGTH; + }, + NEXT_DATA_SUFFIX: function() { + return NEXT_DATA_SUFFIX; + }, + NEXT_INTERCEPTION_MARKER_PREFIX: function() { + return NEXT_INTERCEPTION_MARKER_PREFIX; + }, + NEXT_META_SUFFIX: function() { + return NEXT_META_SUFFIX; + }, + NEXT_NAV_DEPLOYMENT_ID_HEADER: function() { + return NEXT_NAV_DEPLOYMENT_ID_HEADER; + }, + NEXT_QUERY_PARAM_PREFIX: function() { + return NEXT_QUERY_PARAM_PREFIX; + }, + NEXT_RESUME_HEADER: function() { + return NEXT_RESUME_HEADER; + }, + NEXT_RESUME_STATE_LENGTH_HEADER: function() { + return NEXT_RESUME_STATE_LENGTH_HEADER; + }, + NON_STANDARD_NODE_ENV: function() { + return NON_STANDARD_NODE_ENV; + }, + PAGES_DIR_ALIAS: function() { + return PAGES_DIR_ALIAS; + }, + PRERENDER_REVALIDATE_HEADER: function() { + return PRERENDER_REVALIDATE_HEADER; + }, + PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER: function() { + return PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER; + }, + PROXY_FILENAME: function() { + return PROXY_FILENAME; + }, + PROXY_LOCATION_REGEXP: function() { + return PROXY_LOCATION_REGEXP; + }, + PUBLIC_DIR_MIDDLEWARE_CONFLICT: function() { + return PUBLIC_DIR_MIDDLEWARE_CONFLICT; + }, + ROOT_DIR_ALIAS: function() { + return ROOT_DIR_ALIAS; + }, + RSC_ACTION_CLIENT_WRAPPER_ALIAS: function() { + return RSC_ACTION_CLIENT_WRAPPER_ALIAS; + }, + RSC_ACTION_ENCRYPTION_ALIAS: function() { + return RSC_ACTION_ENCRYPTION_ALIAS; + }, + RSC_ACTION_PROXY_ALIAS: function() { + return RSC_ACTION_PROXY_ALIAS; + }, + RSC_ACTION_VALIDATE_ALIAS: function() { + return RSC_ACTION_VALIDATE_ALIAS; + }, + RSC_CACHE_WRAPPER_ALIAS: function() { + return RSC_CACHE_WRAPPER_ALIAS; + }, + RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS: function() { + return RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS; + }, + RSC_MOD_REF_PROXY_ALIAS: function() { + return RSC_MOD_REF_PROXY_ALIAS; + }, + RSC_SEGMENTS_DIR_SUFFIX: function() { + return RSC_SEGMENTS_DIR_SUFFIX; + }, + RSC_SEGMENT_SUFFIX: function() { + return RSC_SEGMENT_SUFFIX; + }, + RSC_SUFFIX: function() { + return RSC_SUFFIX; + }, + SERVER_PROPS_EXPORT_ERROR: function() { + return SERVER_PROPS_EXPORT_ERROR; + }, + SERVER_PROPS_GET_INIT_PROPS_CONFLICT: function() { + return SERVER_PROPS_GET_INIT_PROPS_CONFLICT; + }, + SERVER_PROPS_SSG_CONFLICT: function() { + return SERVER_PROPS_SSG_CONFLICT; + }, + SERVER_RUNTIME: function() { + return SERVER_RUNTIME; + }, + SSG_FALLBACK_EXPORT_ERROR: function() { + return SSG_FALLBACK_EXPORT_ERROR; + }, + SSG_GET_INITIAL_PROPS_CONFLICT: function() { + return SSG_GET_INITIAL_PROPS_CONFLICT; + }, + STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR: function() { + return STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR; + }, + TEXT_PLAIN_CONTENT_TYPE_HEADER: function() { + return TEXT_PLAIN_CONTENT_TYPE_HEADER; + }, + UNSTABLE_REVALIDATE_RENAME_ERROR: function() { + return UNSTABLE_REVALIDATE_RENAME_ERROR; + }, + WEBPACK_LAYERS: function() { + return WEBPACK_LAYERS; + }, + WEBPACK_RESOURCE_QUERIES: function() { + return WEBPACK_RESOURCE_QUERIES; + }, + WEB_SOCKET_MAX_RECONNECTIONS: function() { + return WEB_SOCKET_MAX_RECONNECTIONS; + } +}); +const TEXT_PLAIN_CONTENT_TYPE_HEADER = 'text/plain'; +const HTML_CONTENT_TYPE_HEADER = 'text/html; charset=utf-8'; +const JSON_CONTENT_TYPE_HEADER = 'application/json; charset=utf-8'; +const NEXT_QUERY_PARAM_PREFIX = 'nxtP'; +const NEXT_INTERCEPTION_MARKER_PREFIX = 'nxtI'; +const MATCHED_PATH_HEADER = 'x-matched-path'; +const PRERENDER_REVALIDATE_HEADER = 'x-prerender-revalidate'; +const PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER = 'x-prerender-revalidate-if-generated'; +const RSC_SEGMENTS_DIR_SUFFIX = '.segments'; +const RSC_SEGMENT_SUFFIX = '.segment.rsc'; +const RSC_SUFFIX = '.rsc'; +const ACTION_SUFFIX = '.action'; +const NEXT_DATA_SUFFIX = '.json'; +const NEXT_META_SUFFIX = '.meta'; +const NEXT_BODY_SUFFIX = '.body'; +const NEXT_NAV_DEPLOYMENT_ID_HEADER = 'x-nextjs-deployment-id'; +const NEXT_CACHE_TAGS_HEADER = 'x-next-cache-tags'; +const NEXT_CACHE_REVALIDATED_TAGS_HEADER = 'x-next-revalidated-tags'; +const NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER = 'x-next-revalidate-tag-token'; +const NEXT_RESUME_HEADER = 'next-resume'; +const NEXT_RESUME_STATE_LENGTH_HEADER = 'x-next-resume-state-length'; +const NEXT_CACHE_TAG_MAX_ITEMS = 128; +const NEXT_CACHE_TAG_MAX_LENGTH = 256; +const NEXT_CACHE_SOFT_TAG_MAX_LENGTH = 1024; +const NEXT_CACHE_IMPLICIT_TAG_ID = '_N_T_'; +const NEXT_CACHE_ROOT_PARAM_TAG_ID = '_N_RP_'; +const CACHE_ONE_YEAR_SECONDS = 31536000; +const INFINITE_CACHE = 0xfffffffe; +const MIDDLEWARE_FILENAME = 'middleware'; +const MIDDLEWARE_LOCATION_REGEXP = `(?:src/)?${MIDDLEWARE_FILENAME}`; +const PROXY_FILENAME = 'proxy'; +const PROXY_LOCATION_REGEXP = `(?:src/)?${PROXY_FILENAME}`; +const INSTRUMENTATION_HOOK_FILENAME = 'instrumentation'; +const PAGES_DIR_ALIAS = 'private-next-pages'; +const DOT_NEXT_ALIAS = 'private-dot-next'; +const ROOT_DIR_ALIAS = 'private-next-root-dir'; +const APP_DIR_ALIAS = 'private-next-app-dir'; +const RSC_MOD_REF_PROXY_ALIAS = 'private-next-rsc-mod-ref-proxy'; +const RSC_ACTION_VALIDATE_ALIAS = 'private-next-rsc-action-validate'; +const RSC_ACTION_PROXY_ALIAS = 'private-next-rsc-server-reference'; +const RSC_CACHE_WRAPPER_ALIAS = 'private-next-rsc-cache-wrapper'; +const RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS = 'private-next-rsc-track-dynamic-import'; +const RSC_ACTION_ENCRYPTION_ALIAS = 'private-next-rsc-action-encryption'; +const RSC_ACTION_CLIENT_WRAPPER_ALIAS = 'private-next-rsc-action-client-wrapper'; +const PUBLIC_DIR_MIDDLEWARE_CONFLICT = `You can not have a '_next' folder inside of your public folder. This conflicts with the internal '/_next' route. https://nextjs.org/docs/messages/public-next-folder-conflict`; +const SSG_GET_INITIAL_PROPS_CONFLICT = `You can not use getInitialProps with getStaticProps. To use SSG, please remove your getInitialProps`; +const SERVER_PROPS_GET_INIT_PROPS_CONFLICT = `You can not use getInitialProps with getServerSideProps. Please remove getInitialProps.`; +const SERVER_PROPS_SSG_CONFLICT = `You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps`; +const STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR = `can not have getInitialProps/getServerSideProps, https://nextjs.org/docs/messages/404-get-initial-props`; +const SERVER_PROPS_EXPORT_ERROR = `pages with \`getServerSideProps\` can not be exported. See more info here: https://nextjs.org/docs/messages/gssp-export`; +const GSP_NO_RETURNED_VALUE = 'Your `getStaticProps` function did not return an object. Did you forget to add a `return`?'; +const GSSP_NO_RETURNED_VALUE = 'Your `getServerSideProps` function did not return an object. Did you forget to add a `return`?'; +const UNSTABLE_REVALIDATE_RENAME_ERROR = 'The `unstable_revalidate` property is available for general use.\n' + 'Please use `revalidate` instead.'; +const GSSP_COMPONENT_MEMBER_ERROR = `can not be attached to a page's component and must be exported from the page. See more info here: https://nextjs.org/docs/messages/gssp-component-member`; +const NON_STANDARD_NODE_ENV = `You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env`; +const SSG_FALLBACK_EXPORT_ERROR = `Pages with \`fallback\` enabled in \`getStaticPaths\` can not be exported. See more info here: https://nextjs.org/docs/messages/ssg-fallback-true-export`; +const ESLINT_DEFAULT_DIRS = [ + 'app', + 'pages', + 'components', + 'lib', + 'src' +]; +const SERVER_RUNTIME = { + edge: 'edge', + experimentalEdge: 'experimental-edge', + nodejs: 'nodejs' +}; +const WEB_SOCKET_MAX_RECONNECTIONS = 12; +/** + * The names of the webpack layers. These layers are the primitives for the + * webpack chunks. + */ const WEBPACK_LAYERS_NAMES = { + /** + * The layer for the shared code between the client and server bundles. + */ shared: 'shared', + /** + * The layer for server-only runtime and picking up `react-server` export conditions. + * Including app router RSC pages and app router custom routes and metadata routes. + */ reactServerComponents: 'rsc', + /** + * Server Side Rendering layer for app (ssr). + */ serverSideRendering: 'ssr', + /** + * The browser client bundle layer for actions. + */ actionBrowser: 'action-browser', + /** + * The Node.js bundle layer for the API routes. + */ apiNode: 'api-node', + /** + * The Edge Lite bundle layer for the API routes. + */ apiEdge: 'api-edge', + /** + * The layer for the middleware code. + */ middleware: 'middleware', + /** + * The layer for the instrumentation hooks. + */ instrument: 'instrument', + /** + * The layer for assets on the edge. + */ edgeAsset: 'edge-asset', + /** + * The browser client bundle layer for App directory. + */ appPagesBrowser: 'app-pages-browser', + /** + * The browser client bundle layer for Pages directory. + */ pagesDirBrowser: 'pages-dir-browser', + /** + * The Edge Lite bundle layer for Pages directory. + */ pagesDirEdge: 'pages-dir-edge', + /** + * The Node.js bundle layer for Pages directory. + */ pagesDirNode: 'pages-dir-node' +}; +const WEBPACK_LAYERS = { + ...WEBPACK_LAYERS_NAMES, + GROUP: { + builtinReact: [ + WEBPACK_LAYERS_NAMES.reactServerComponents, + WEBPACK_LAYERS_NAMES.actionBrowser + ], + serverOnly: [ + WEBPACK_LAYERS_NAMES.reactServerComponents, + WEBPACK_LAYERS_NAMES.actionBrowser, + WEBPACK_LAYERS_NAMES.instrument, + WEBPACK_LAYERS_NAMES.middleware + ], + neutralTarget: [ + // pages api + WEBPACK_LAYERS_NAMES.apiNode, + WEBPACK_LAYERS_NAMES.apiEdge + ], + clientOnly: [ + WEBPACK_LAYERS_NAMES.serverSideRendering, + WEBPACK_LAYERS_NAMES.appPagesBrowser + ], + bundled: [ + WEBPACK_LAYERS_NAMES.reactServerComponents, + WEBPACK_LAYERS_NAMES.actionBrowser, + WEBPACK_LAYERS_NAMES.serverSideRendering, + WEBPACK_LAYERS_NAMES.appPagesBrowser, + WEBPACK_LAYERS_NAMES.shared, + WEBPACK_LAYERS_NAMES.instrument, + WEBPACK_LAYERS_NAMES.middleware + ], + appPages: [ + // app router pages and layouts + WEBPACK_LAYERS_NAMES.reactServerComponents, + WEBPACK_LAYERS_NAMES.serverSideRendering, + WEBPACK_LAYERS_NAMES.appPagesBrowser, + WEBPACK_LAYERS_NAMES.actionBrowser + ] + } +}; +const WEBPACK_RESOURCE_QUERIES = { + edgeSSREntry: '__next_edge_ssr_entry__', + metadata: '__next_metadata__', + metadataRoute: '__next_metadata_route__', + metadataImageMeta: '__next_metadata_image_meta__' +}; + +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/constants.js.map b/e-commerce/node_modules/next/dist/lib/constants.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f05177f5f50a0fd0ffe76e4998d03b7f692bf984 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/constants.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/constants.ts"],"sourcesContent":["import type { ServerRuntime } from '../types'\n\nexport const TEXT_PLAIN_CONTENT_TYPE_HEADER = 'text/plain'\nexport const HTML_CONTENT_TYPE_HEADER = 'text/html; charset=utf-8'\nexport const JSON_CONTENT_TYPE_HEADER = 'application/json; charset=utf-8'\nexport const NEXT_QUERY_PARAM_PREFIX = 'nxtP'\nexport const NEXT_INTERCEPTION_MARKER_PREFIX = 'nxtI'\n\nexport const MATCHED_PATH_HEADER = 'x-matched-path'\nexport const PRERENDER_REVALIDATE_HEADER = 'x-prerender-revalidate'\nexport const PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER =\n 'x-prerender-revalidate-if-generated'\n\nexport const RSC_SEGMENTS_DIR_SUFFIX = '.segments'\nexport const RSC_SEGMENT_SUFFIX = '.segment.rsc'\nexport const RSC_SUFFIX = '.rsc'\nexport const ACTION_SUFFIX = '.action'\nexport const NEXT_DATA_SUFFIX = '.json'\nexport const NEXT_META_SUFFIX = '.meta'\nexport const NEXT_BODY_SUFFIX = '.body'\n\nexport const NEXT_NAV_DEPLOYMENT_ID_HEADER = 'x-nextjs-deployment-id'\n\nexport const NEXT_CACHE_TAGS_HEADER = 'x-next-cache-tags'\nexport const NEXT_CACHE_REVALIDATED_TAGS_HEADER = 'x-next-revalidated-tags'\nexport const NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER =\n 'x-next-revalidate-tag-token'\n\nexport const NEXT_RESUME_HEADER = 'next-resume'\nexport const NEXT_RESUME_STATE_LENGTH_HEADER = 'x-next-resume-state-length'\n\n// if these change make sure we update the related\n// documentation as well\nexport const NEXT_CACHE_TAG_MAX_ITEMS = 128\nexport const NEXT_CACHE_TAG_MAX_LENGTH = 256\nexport const NEXT_CACHE_SOFT_TAG_MAX_LENGTH = 1024\nexport const NEXT_CACHE_IMPLICIT_TAG_ID = '_N_T_'\nexport const NEXT_CACHE_ROOT_PARAM_TAG_ID = '_N_RP_'\n\n// in seconds\nexport const CACHE_ONE_YEAR_SECONDS = 31536000\n\n// in seconds, represents revalidate=false. I.e. never revaliate.\n// We use this value since it can be represented as a V8 SMI for optimal performance.\n// It can also be serialized as JSON if it ever leaks accidentally as an actual value.\nexport const INFINITE_CACHE = 0xfffffffe\n\n// Patterns to detect middleware files\nexport const MIDDLEWARE_FILENAME = 'middleware'\nexport const MIDDLEWARE_LOCATION_REGEXP = `(?:src/)?${MIDDLEWARE_FILENAME}`\n\n// Patterns to detect proxy files (replacement for middleware)\nexport const PROXY_FILENAME = 'proxy'\nexport const PROXY_LOCATION_REGEXP = `(?:src/)?${PROXY_FILENAME}`\n\n// Pattern to detect instrumentation hooks file\nexport const INSTRUMENTATION_HOOK_FILENAME = 'instrumentation'\n\n// Because on Windows absolute paths in the generated code can break because of numbers, eg 1 in the path,\n// we have to use a private alias\nexport const PAGES_DIR_ALIAS = 'private-next-pages'\nexport const DOT_NEXT_ALIAS = 'private-dot-next'\nexport const ROOT_DIR_ALIAS = 'private-next-root-dir'\nexport const APP_DIR_ALIAS = 'private-next-app-dir'\nexport const RSC_MOD_REF_PROXY_ALIAS = 'private-next-rsc-mod-ref-proxy'\nexport const RSC_ACTION_VALIDATE_ALIAS = 'private-next-rsc-action-validate'\nexport const RSC_ACTION_PROXY_ALIAS = 'private-next-rsc-server-reference'\nexport const RSC_CACHE_WRAPPER_ALIAS = 'private-next-rsc-cache-wrapper'\nexport const RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS =\n 'private-next-rsc-track-dynamic-import'\nexport const RSC_ACTION_ENCRYPTION_ALIAS = 'private-next-rsc-action-encryption'\nexport const RSC_ACTION_CLIENT_WRAPPER_ALIAS =\n 'private-next-rsc-action-client-wrapper'\n\nexport const PUBLIC_DIR_MIDDLEWARE_CONFLICT = `You can not have a '_next' folder inside of your public folder. This conflicts with the internal '/_next' route. https://nextjs.org/docs/messages/public-next-folder-conflict`\n\nexport const SSG_GET_INITIAL_PROPS_CONFLICT = `You can not use getInitialProps with getStaticProps. To use SSG, please remove your getInitialProps`\n\nexport const SERVER_PROPS_GET_INIT_PROPS_CONFLICT = `You can not use getInitialProps with getServerSideProps. Please remove getInitialProps.`\n\nexport const SERVER_PROPS_SSG_CONFLICT = `You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps`\n\nexport const STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR = `can not have getInitialProps/getServerSideProps, https://nextjs.org/docs/messages/404-get-initial-props`\n\nexport const SERVER_PROPS_EXPORT_ERROR = `pages with \\`getServerSideProps\\` can not be exported. See more info here: https://nextjs.org/docs/messages/gssp-export`\n\nexport const GSP_NO_RETURNED_VALUE =\n 'Your `getStaticProps` function did not return an object. Did you forget to add a `return`?'\nexport const GSSP_NO_RETURNED_VALUE =\n 'Your `getServerSideProps` function did not return an object. Did you forget to add a `return`?'\n\nexport const UNSTABLE_REVALIDATE_RENAME_ERROR =\n 'The `unstable_revalidate` property is available for general use.\\n' +\n 'Please use `revalidate` instead.'\n\nexport const GSSP_COMPONENT_MEMBER_ERROR = `can not be attached to a page's component and must be exported from the page. See more info here: https://nextjs.org/docs/messages/gssp-component-member`\n\nexport const NON_STANDARD_NODE_ENV = `You are using a non-standard \"NODE_ENV\" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env`\n\nexport const SSG_FALLBACK_EXPORT_ERROR = `Pages with \\`fallback\\` enabled in \\`getStaticPaths\\` can not be exported. See more info here: https://nextjs.org/docs/messages/ssg-fallback-true-export`\n\nexport const ESLINT_DEFAULT_DIRS = ['app', 'pages', 'components', 'lib', 'src']\n\nexport const SERVER_RUNTIME: Record<string, ServerRuntime> = {\n edge: 'edge',\n experimentalEdge: 'experimental-edge',\n nodejs: 'nodejs',\n}\n\nexport const WEB_SOCKET_MAX_RECONNECTIONS = 12\n\n/**\n * The names of the webpack layers. These layers are the primitives for the\n * webpack chunks.\n */\nconst WEBPACK_LAYERS_NAMES = {\n /**\n * The layer for the shared code between the client and server bundles.\n */\n shared: 'shared',\n /**\n * The layer for server-only runtime and picking up `react-server` export conditions.\n * Including app router RSC pages and app router custom routes and metadata routes.\n */\n reactServerComponents: 'rsc',\n /**\n * Server Side Rendering layer for app (ssr).\n */\n serverSideRendering: 'ssr',\n /**\n * The browser client bundle layer for actions.\n */\n actionBrowser: 'action-browser',\n /**\n * The Node.js bundle layer for the API routes.\n */\n apiNode: 'api-node',\n /**\n * The Edge Lite bundle layer for the API routes.\n */\n apiEdge: 'api-edge',\n /**\n * The layer for the middleware code.\n */\n middleware: 'middleware',\n /**\n * The layer for the instrumentation hooks.\n */\n instrument: 'instrument',\n /**\n * The layer for assets on the edge.\n */\n edgeAsset: 'edge-asset',\n /**\n * The browser client bundle layer for App directory.\n */\n appPagesBrowser: 'app-pages-browser',\n /**\n * The browser client bundle layer for Pages directory.\n */\n pagesDirBrowser: 'pages-dir-browser',\n /**\n * The Edge Lite bundle layer for Pages directory.\n */\n pagesDirEdge: 'pages-dir-edge',\n /**\n * The Node.js bundle layer for Pages directory.\n */\n pagesDirNode: 'pages-dir-node',\n} as const\n\nexport type WebpackLayerName =\n (typeof WEBPACK_LAYERS_NAMES)[keyof typeof WEBPACK_LAYERS_NAMES]\n\nconst WEBPACK_LAYERS = {\n ...WEBPACK_LAYERS_NAMES,\n GROUP: {\n builtinReact: [\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n ],\n serverOnly: [\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n WEBPACK_LAYERS_NAMES.instrument,\n WEBPACK_LAYERS_NAMES.middleware,\n ],\n neutralTarget: [\n // pages api\n WEBPACK_LAYERS_NAMES.apiNode,\n WEBPACK_LAYERS_NAMES.apiEdge,\n ],\n clientOnly: [\n WEBPACK_LAYERS_NAMES.serverSideRendering,\n WEBPACK_LAYERS_NAMES.appPagesBrowser,\n ],\n bundled: [\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n WEBPACK_LAYERS_NAMES.serverSideRendering,\n WEBPACK_LAYERS_NAMES.appPagesBrowser,\n WEBPACK_LAYERS_NAMES.shared,\n WEBPACK_LAYERS_NAMES.instrument,\n WEBPACK_LAYERS_NAMES.middleware,\n ],\n appPages: [\n // app router pages and layouts\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.serverSideRendering,\n WEBPACK_LAYERS_NAMES.appPagesBrowser,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n ],\n },\n}\n\nconst WEBPACK_RESOURCE_QUERIES = {\n edgeSSREntry: '__next_edge_ssr_entry__',\n metadata: '__next_metadata__',\n metadataRoute: '__next_metadata_route__',\n metadataImageMeta: '__next_metadata_image_meta__',\n}\n\nexport { WEBPACK_LAYERS, WEBPACK_RESOURCE_QUERIES }\n"],"names":["ACTION_SUFFIX","APP_DIR_ALIAS","CACHE_ONE_YEAR_SECONDS","DOT_NEXT_ALIAS","ESLINT_DEFAULT_DIRS","GSP_NO_RETURNED_VALUE","GSSP_COMPONENT_MEMBER_ERROR","GSSP_NO_RETURNED_VALUE","HTML_CONTENT_TYPE_HEADER","INFINITE_CACHE","INSTRUMENTATION_HOOK_FILENAME","JSON_CONTENT_TYPE_HEADER","MATCHED_PATH_HEADER","MIDDLEWARE_FILENAME","MIDDLEWARE_LOCATION_REGEXP","NEXT_BODY_SUFFIX","NEXT_CACHE_IMPLICIT_TAG_ID","NEXT_CACHE_REVALIDATED_TAGS_HEADER","NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER","NEXT_CACHE_ROOT_PARAM_TAG_ID","NEXT_CACHE_SOFT_TAG_MAX_LENGTH","NEXT_CACHE_TAGS_HEADER","NEXT_CACHE_TAG_MAX_ITEMS","NEXT_CACHE_TAG_MAX_LENGTH","NEXT_DATA_SUFFIX","NEXT_INTERCEPTION_MARKER_PREFIX","NEXT_META_SUFFIX","NEXT_NAV_DEPLOYMENT_ID_HEADER","NEXT_QUERY_PARAM_PREFIX","NEXT_RESUME_HEADER","NEXT_RESUME_STATE_LENGTH_HEADER","NON_STANDARD_NODE_ENV","PAGES_DIR_ALIAS","PRERENDER_REVALIDATE_HEADER","PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER","PROXY_FILENAME","PROXY_LOCATION_REGEXP","PUBLIC_DIR_MIDDLEWARE_CONFLICT","ROOT_DIR_ALIAS","RSC_ACTION_CLIENT_WRAPPER_ALIAS","RSC_ACTION_ENCRYPTION_ALIAS","RSC_ACTION_PROXY_ALIAS","RSC_ACTION_VALIDATE_ALIAS","RSC_CACHE_WRAPPER_ALIAS","RSC_DYNAMIC_IMPORT_WRAPPER_ALIAS","RSC_MOD_REF_PROXY_ALIAS","RSC_SEGMENTS_DIR_SUFFIX","RSC_SEGMENT_SUFFIX","RSC_SUFFIX","SERVER_PROPS_EXPORT_ERROR","SERVER_PROPS_GET_INIT_PROPS_CONFLICT","SERVER_PROPS_SSG_CONFLICT","SERVER_RUNTIME","SSG_FALLBACK_EXPORT_ERROR","SSG_GET_INITIAL_PROPS_CONFLICT","STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR","TEXT_PLAIN_CONTENT_TYPE_HEADER","UNSTABLE_REVALIDATE_RENAME_ERROR","WEBPACK_LAYERS","WEBPACK_RESOURCE_QUERIES","WEB_SOCKET_MAX_RECONNECTIONS","edge","experimentalEdge","nodejs","WEBPACK_LAYERS_NAMES","shared","reactServerComponents","serverSideRendering","actionBrowser","apiNode","apiEdge","middleware","instrument","edgeAsset","appPagesBrowser","pagesDirBrowser","pagesDirEdge","pagesDirNode","GROUP","builtinReact","serverOnly","neutralTarget","clientOnly","bundled","appPages","edgeSSREntry","metadata","metadataRoute","metadataImageMeta"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgBaA,aAAa;eAAbA;;IA+CAC,aAAa;eA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Q,UAAU;YAC/BR,qBAAqBO,UAAU;SAChC;QACDU,eAAe;YACb,YAAY;YACZjB,qBAAqBK,OAAO;YAC5BL,qBAAqBM,OAAO;SAC7B;QACDY,YAAY;YACVlB,qBAAqBG,mBAAmB;YACxCH,qBAAqBU,eAAe;SACrC;QACDS,SAAS;YACPnB,qBAAqBE,qBAAqB;YAC1CF,qBAAqBI,aAAa;YAClCJ,qBAAqBG,mBAAmB;YACxCH,qBAAqBU,eAAe;YACpCV,qBAAqBC,MAAM;YAC3BD,qBAAqBQ,UAAU;YAC/BR,qBAAqBO,UAAU;SAChC;QACDa,UAAU;YACR,+BAA+B;YAC/BpB,qBAAqBE,qBAAqB;YAC1CF,qBAAqBG,mBAAmB;YACxCH,qBAAqBU,eAAe;YACpCV,qBAAqBI,aAAa;SACnC;IACH;AACF;AAEA,MAAMT,2BAA2B;IAC/B0B,cAAc;IACdC,UAAU;IACVC,eAAe;IACfC,mBAAmB;AACrB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/create-client-router-filter.d.ts b/e-commerce/node_modules/next/dist/lib/create-client-router-filter.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9efc14e147c8a6af862f15fb2078966b39231626 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/create-client-router-filter.d.ts @@ -0,0 +1,6 @@ +import { BloomFilter } from '../shared/lib/bloom-filter'; +import type { Redirect } from './load-custom-routes'; +export declare function createClientRouterFilter(paths: string[], redirects: Redirect[], allowedErrorRate?: number): { + staticFilter: ReturnType<BloomFilter['export']>; + dynamicFilter: ReturnType<BloomFilter['export']>; +}; diff --git a/e-commerce/node_modules/next/dist/lib/create-client-router-filter.js b/e-commerce/node_modules/next/dist/lib/create-client-router-filter.js new file mode 100644 index 0000000000000000000000000000000000000000..bd306685e7e7557e5f7bd070a228fc2f95819803 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/create-client-router-filter.js @@ -0,0 +1,83 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "createClientRouterFilter", { + enumerable: true, + get: function() { + return createClientRouterFilter; + } +}); +const _bloomfilter = require("../shared/lib/bloom-filter"); +const _utils = require("../shared/lib/router/utils"); +const _removetrailingslash = require("../shared/lib/router/utils/remove-trailing-slash"); +const _trytoparsepath = require("./try-to-parse-path"); +const _interceptionroutes = require("../shared/lib/router/utils/interception-routes"); +const _dynamicfilterpattern = require("../shared/lib/router/utils/dynamic-filter-pattern"); +function createClientRouterFilter(paths, redirects, allowedErrorRate) { + const staticPaths = new Set(); + const dynamicPaths = new Set(); + for (let path of paths){ + if ((0, _utils.isDynamicRoute)(path)) { + if ((0, _interceptionroutes.isInterceptionRouteAppPath)(path)) { + path = (0, _interceptionroutes.extractInterceptionRouteInformation)(path).interceptedRoute; + } + let subPath = ''; + const pathParts = path.split('/'); + // start at 1 since we split on '/' and the path starts + // with this so the first entry is an empty string + for(let i = 1; i < pathParts.length; i++){ + const curPart = pathParts[i]; + if (curPart.startsWith('[')) { + break; + } + subPath = `${subPath}/${curPart}`; + } + if (subPath) { + dynamicPaths.add(subPath); + } else { + // The route begins with a dynamic segment, so it has no static + // prefix to anchor the prefix-based dynamic filter on (e.g. + // `/[locale]/about`). Store its normalized pattern instead so the + // client can still detect it when a pages dynamic route would + // otherwise shadow it. + dynamicPaths.add(normalizeRouteToFilterPattern(path)); + } + } else { + staticPaths.add(path); + } + } + for (const redirect of redirects){ + const { source } = redirect; + const path = (0, _removetrailingslash.removeTrailingSlash)(source); + let tokens = []; + try { + tokens = (0, _trytoparsepath.tryToParsePath)(source).tokens || []; + } catch {} + if (tokens.every((token)=>typeof token === 'string')) { + // only include static redirects initially + staticPaths.add(path); + } + } + const staticFilter = _bloomfilter.BloomFilter.from([ + ...staticPaths + ], allowedErrorRate); + const dynamicFilter = _bloomfilter.BloomFilter.from([ + ...dynamicPaths + ], allowedErrorRate); + const data = { + staticFilter: staticFilter.export(), + dynamicFilter: dynamicFilter.export() + }; + return data; +} +/** + * Replace every dynamic segment of a route with the placeholder token, e.g. + * `/[locale]/about` -> `/[]/about`, `/[lang]` -> `/[]`. This is the encode half + * of the dynamic filter; the pages router decodes it with + * `hasDynamicFilterCandidate`, and both rely on `DYNAMIC_FILTER_PLACEHOLDER`. + */ function normalizeRouteToFilterPattern(route) { + return route.split('/').map((segment)=>segment.startsWith('[') ? _dynamicfilterpattern.DYNAMIC_FILTER_PLACEHOLDER : segment).join('/'); +} + +//# sourceMappingURL=create-client-router-filter.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/create-client-router-filter.js.map b/e-commerce/node_modules/next/dist/lib/create-client-router-filter.js.map new file mode 100644 index 0000000000000000000000000000000000000000..5c1fad4553d76b5166cbed84a7200ba14b275515 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/create-client-router-filter.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/create-client-router-filter.ts"],"sourcesContent":["import type { Token } from 'next/dist/compiled/path-to-regexp'\nimport { BloomFilter } from '../shared/lib/bloom-filter'\nimport { isDynamicRoute } from '../shared/lib/router/utils'\nimport { removeTrailingSlash } from '../shared/lib/router/utils/remove-trailing-slash'\nimport type { Redirect } from './load-custom-routes'\nimport { tryToParsePath } from './try-to-parse-path'\nimport {\n extractInterceptionRouteInformation,\n isInterceptionRouteAppPath,\n} from '../shared/lib/router/utils/interception-routes'\nimport { DYNAMIC_FILTER_PLACEHOLDER } from '../shared/lib/router/utils/dynamic-filter-pattern'\n\nexport function createClientRouterFilter(\n paths: string[],\n redirects: Redirect[],\n allowedErrorRate?: number\n): {\n staticFilter: ReturnType<BloomFilter['export']>\n dynamicFilter: ReturnType<BloomFilter['export']>\n} {\n const staticPaths = new Set<string>()\n const dynamicPaths = new Set<string>()\n\n for (let path of paths) {\n if (isDynamicRoute(path)) {\n if (isInterceptionRouteAppPath(path)) {\n path = extractInterceptionRouteInformation(path).interceptedRoute\n }\n\n let subPath = ''\n const pathParts = path.split('/')\n\n // start at 1 since we split on '/' and the path starts\n // with this so the first entry is an empty string\n for (let i = 1; i < pathParts.length; i++) {\n const curPart = pathParts[i]\n\n if (curPart.startsWith('[')) {\n break\n }\n subPath = `${subPath}/${curPart}`\n }\n\n if (subPath) {\n dynamicPaths.add(subPath)\n } else {\n // The route begins with a dynamic segment, so it has no static\n // prefix to anchor the prefix-based dynamic filter on (e.g.\n // `/[locale]/about`). Store its normalized pattern instead so the\n // client can still detect it when a pages dynamic route would\n // otherwise shadow it.\n dynamicPaths.add(normalizeRouteToFilterPattern(path))\n }\n } else {\n staticPaths.add(path)\n }\n }\n\n for (const redirect of redirects) {\n const { source } = redirect\n const path = removeTrailingSlash(source)\n let tokens: Token[] = []\n\n try {\n tokens = tryToParsePath(source).tokens || []\n } catch {}\n\n if (tokens.every((token) => typeof token === 'string')) {\n // only include static redirects initially\n staticPaths.add(path)\n }\n }\n\n const staticFilter = BloomFilter.from([...staticPaths], allowedErrorRate)\n\n const dynamicFilter = BloomFilter.from([...dynamicPaths], allowedErrorRate)\n const data = {\n staticFilter: staticFilter.export(),\n dynamicFilter: dynamicFilter.export(),\n }\n return data\n}\n\n/**\n * Replace every dynamic segment of a route with the placeholder token, e.g.\n * `/[locale]/about` -> `/[]/about`, `/[lang]` -> `/[]`. This is the encode half\n * of the dynamic filter; the pages router decodes it with\n * `hasDynamicFilterCandidate`, and both rely on `DYNAMIC_FILTER_PLACEHOLDER`.\n */\nfunction normalizeRouteToFilterPattern(route: string): string {\n return route\n .split('/')\n .map((segment) =>\n segment.startsWith('[') ? DYNAMIC_FILTER_PLACEHOLDER : segment\n )\n .join('/')\n}\n"],"names":["createClientRouterFilter","paths","redirects","allowedErrorRate","staticPaths","Set","dynamicPaths","path","isDynamicRoute","isInterceptionRouteAppPath","extractInterceptionRouteInformation","interceptedRoute","subPath","pathParts","split","i","length","curPart","startsWith","add","normalizeRouteToFilterPattern","redirect","source","removeTrailingSlash","tokens","tryToParsePath","every","token","staticFilter","BloomFilter","from","dynamicFilter","data","export","route","map","segment","DYNAMIC_FILTER_PLACEHOLDER","join"],"mappings":";;;;+BAYgBA;;;eAAAA;;;6BAXY;uBACG;qCACK;gCAEL;oCAIxB;sCACoC;AAEpC,SAASA,yBACdC,KAAe,EACfC,SAAqB,EACrBC,gBAAyB;IAKzB,MAAMC,cAAc,IAAIC;IACxB,MAAMC,eAAe,IAAID;IAEzB,KAAK,IAAIE,QAAQN,MAAO;QACtB,IAAIO,IAAAA,qBAAc,EAACD,OAAO;YACxB,IAAIE,IAAAA,8CAA0B,EAACF,OAAO;gBACpCA,OAAOG,IAAAA,uDAAmC,EAACH,MAAMI,gBAAgB;YACnE;YAEA,IAAIC,UAAU;YACd,MAAMC,YAAYN,KAAKO,KAAK,CAAC;YAE7B,uDAAuD;YACvD,kDAAkD;YAClD,IAAK,IAAIC,IAAI,GAAGA,IAAIF,UAAUG,MAAM,EAAED,IAAK;gBACzC,MAAME,UAAUJ,SAAS,CAACE,EAAE;gBAE5B,IAAIE,QAAQC,UAAU,CAAC,MAAM;oBAC3B;gBACF;gBACAN,UAAU,GAAGA,QAAQ,CAAC,EAAEK,SAAS;YACnC;YAEA,IAAIL,SAAS;gBACXN,aAAaa,GAAG,CAACP;YACnB,OAAO;gBACL,+DAA+D;gBAC/D,4DAA4D;gBAC5D,kEAAkE;gBAClE,8DAA8D;gBAC9D,uBAAuB;gBACvBN,aAAaa,GAAG,CAACC,8BAA8Bb;YACjD;QACF,OAAO;YACLH,YAAYe,GAAG,CAACZ;QAClB;IACF;IAEA,KAAK,MAAMc,YAAYnB,UAAW;QAChC,MAAM,EAAEoB,MAAM,EAAE,GAAGD;QACnB,MAAMd,OAAOgB,IAAAA,wCAAmB,EAACD;QACjC,IAAIE,SAAkB,EAAE;QAExB,IAAI;YACFA,SAASC,IAAAA,8BAAc,EAACH,QAAQE,MAAM,IAAI,EAAE;QAC9C,EAAE,OAAM,CAAC;QAET,IAAIA,OAAOE,KAAK,CAAC,CAACC,QAAU,OAAOA,UAAU,WAAW;YACtD,0CAA0C;YAC1CvB,YAAYe,GAAG,CAACZ;QAClB;IACF;IAEA,MAAMqB,eAAeC,wBAAW,CAACC,IAAI,CAAC;WAAI1B;KAAY,EAAED;IAExD,MAAM4B,gBAAgBF,wBAAW,CAACC,IAAI,CAAC;WAAIxB;KAAa,EAAEH;IAC1D,MAAM6B,OAAO;QACXJ,cAAcA,aAAaK,MAAM;QACjCF,eAAeA,cAAcE,MAAM;IACrC;IACA,OAAOD;AACT;AAEA;;;;;CAKC,GACD,SAASZ,8BAA8Bc,KAAa;IAClD,OAAOA,MACJpB,KAAK,CAAC,KACNqB,GAAG,CAAC,CAACC,UACJA,QAAQlB,UAAU,CAAC,OAAOmB,gDAA0B,GAAGD,SAExDE,IAAI,CAAC;AACV","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/default-transpiled-packages.json b/e-commerce/node_modules/next/dist/lib/default-transpiled-packages.json new file mode 100644 index 0000000000000000000000000000000000000000..aca6e6df9a42678c8c4f8f95f3bacac1349fb5a8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/default-transpiled-packages.json @@ -0,0 +1 @@ +["geist"] diff --git a/e-commerce/node_modules/next/dist/lib/detect-typo.d.ts b/e-commerce/node_modules/next/dist/lib/detect-typo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cd3ad60673f4b703c65ab4a029f0a16de98dc938 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/detect-typo.d.ts @@ -0,0 +1 @@ +export declare function detectTypo(input: string, options: string[], threshold?: number): string | null; diff --git a/e-commerce/node_modules/next/dist/lib/detect-typo.js b/e-commerce/node_modules/next/dist/lib/detect-typo.js new file mode 100644 index 0000000000000000000000000000000000000000..135f48135707f3f71fef8c2b2251c6d1244f1591 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/detect-typo.js @@ -0,0 +1,51 @@ +// the minimum number of operations required to convert string a to string b. +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "detectTypo", { + enumerable: true, + get: function() { + return detectTypo; + } +}); +function minDistance(a, b, threshold) { + const m = a.length; + const n = b.length; + if (m < n) { + return minDistance(b, a, threshold); + } + if (n === 0) { + return m; + } + let previousRow = Array.from({ + length: n + 1 + }, (_, i)=>i); + for(let i = 0; i < m; i++){ + const s1 = a[i]; + let currentRow = [ + i + 1 + ]; + for(let j = 0; j < n; j++){ + const s2 = b[j]; + const insertions = previousRow[j + 1] + 1; + const deletions = currentRow[j] + 1; + const substitutions = previousRow[j] + Number(s1 !== s2); + currentRow.push(Math.min(insertions, deletions, substitutions)); + } + previousRow = currentRow; + } + return previousRow[previousRow.length - 1]; +} +function detectTypo(input, options, threshold = 2) { + const potentialTypos = options.map((o)=>({ + option: o, + distance: minDistance(o, input, threshold) + })).filter(({ distance })=>distance <= threshold && distance > 0).sort((a, b)=>a.distance - b.distance); + if (potentialTypos.length) { + return potentialTypos[0].option; + } + return null; +} + +//# sourceMappingURL=detect-typo.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/detect-typo.js.map b/e-commerce/node_modules/next/dist/lib/detect-typo.js.map new file mode 100644 index 0000000000000000000000000000000000000000..11bd70a56e8cdfa62824d6c21ef2b6950b94836e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/detect-typo.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/detect-typo.ts"],"sourcesContent":["// the minimum number of operations required to convert string a to string b.\nfunction minDistance(a: string, b: string, threshold: number): number {\n const m = a.length\n const n = b.length\n\n if (m < n) {\n return minDistance(b, a, threshold)\n }\n\n if (n === 0) {\n return m\n }\n\n let previousRow = Array.from({ length: n + 1 }, (_, i) => i)\n\n for (let i = 0; i < m; i++) {\n const s1 = a[i]\n let currentRow = [i + 1]\n for (let j = 0; j < n; j++) {\n const s2 = b[j]\n const insertions = previousRow[j + 1] + 1\n const deletions = currentRow[j] + 1\n const substitutions = previousRow[j] + Number(s1 !== s2)\n currentRow.push(Math.min(insertions, deletions, substitutions))\n }\n previousRow = currentRow\n }\n return previousRow[previousRow.length - 1]\n}\n\nexport function detectTypo(input: string, options: string[], threshold = 2) {\n const potentialTypos = options\n .map((o) => ({\n option: o,\n distance: minDistance(o, input, threshold),\n }))\n .filter(({ distance }) => distance <= threshold && distance > 0)\n .sort((a, b) => a.distance - b.distance)\n\n if (potentialTypos.length) {\n return potentialTypos[0].option\n }\n return null\n}\n"],"names":["detectTypo","minDistance","a","b","threshold","m","length","n","previousRow","Array","from","_","i","s1","currentRow","j","s2","insertions","deletions","substitutions","Number","push","Math","min","input","options","potentialTypos","map","o","option","distance","filter","sort"],"mappings":"AAAA,6EAA6E;;;;;+BA8B7DA;;;eAAAA;;;AA7BhB,SAASC,YAAYC,CAAS,EAAEC,CAAS,EAAEC,SAAiB;IAC1D,MAAMC,IAAIH,EAAEI,MAAM;IAClB,MAAMC,IAAIJ,EAAEG,MAAM;IAElB,IAAID,IAAIE,GAAG;QACT,OAAON,YAAYE,GAAGD,GAAGE;IAC3B;IAEA,IAAIG,MAAM,GAAG;QACX,OAAOF;IACT;IAEA,IAAIG,cAAcC,MAAMC,IAAI,CAAC;QAAEJ,QAAQC,IAAI;IAAE,GAAG,CAACI,GAAGC,IAAMA;IAE1D,IAAK,IAAIA,IAAI,GAAGA,IAAIP,GAAGO,IAAK;QAC1B,MAAMC,KAAKX,CAAC,CAACU,EAAE;QACf,IAAIE,aAAa;YAACF,IAAI;SAAE;QACxB,IAAK,IAAIG,IAAI,GAAGA,IAAIR,GAAGQ,IAAK;YAC1B,MAAMC,KAAKb,CAAC,CAACY,EAAE;YACf,MAAME,aAAaT,WAAW,CAACO,IAAI,EAAE,GAAG;YACxC,MAAMG,YAAYJ,UAAU,CAACC,EAAE,GAAG;YAClC,MAAMI,gBAAgBX,WAAW,CAACO,EAAE,GAAGK,OAAOP,OAAOG;YACrDF,WAAWO,IAAI,CAACC,KAAKC,GAAG,CAACN,YAAYC,WAAWC;QAClD;QACAX,cAAcM;IAChB;IACA,OAAON,WAAW,CAACA,YAAYF,MAAM,GAAG,EAAE;AAC5C;AAEO,SAASN,WAAWwB,KAAa,EAAEC,OAAiB,EAAErB,YAAY,CAAC;IACxE,MAAMsB,iBAAiBD,QACpBE,GAAG,CAAC,CAACC,IAAO,CAAA;YACXC,QAAQD;YACRE,UAAU7B,YAAY2B,GAAGJ,OAAOpB;QAClC,CAAA,GACC2B,MAAM,CAAC,CAAC,EAAED,QAAQ,EAAE,GAAKA,YAAY1B,aAAa0B,WAAW,GAC7DE,IAAI,CAAC,CAAC9B,GAAGC,IAAMD,EAAE4B,QAAQ,GAAG3B,EAAE2B,QAAQ;IAEzC,IAAIJ,eAAepB,MAAM,EAAE;QACzB,OAAOoB,cAAc,CAAC,EAAE,CAACG,MAAM;IACjC;IACA,OAAO;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/dist-dir.d.ts b/e-commerce/node_modules/next/dist/lib/dist-dir.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fd2ddbfc4019791e626a39898c113993fa74e92b --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/dist-dir.d.ts @@ -0,0 +1,8 @@ +export declare class InvalidDistDirError extends Error { + constructor(distDir: string, appDir: string, workspaceRoot: string); +} +/** + * Throws unless `distDir` is inside the application or workspace, without + * containing the application itself. + */ +export declare function verifyDistDir(distDir: string, appDir: string, workspaceRoot: string): void; diff --git a/e-commerce/node_modules/next/dist/lib/dist-dir.js b/e-commerce/node_modules/next/dist/lib/dist-dir.js new file mode 100644 index 0000000000000000000000000000000000000000..6537a5bf87362d7a201ff5a130b7de847de4a6c0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/dist-dir.js @@ -0,0 +1,88 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + InvalidDistDirError: null, + verifyDistDir: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + InvalidDistDirError: function() { + return InvalidDistDirError; + }, + verifyDistDir: function() { + return verifyDistDir; + } +}); +const _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path")); +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +class InvalidDistDirError extends Error { + constructor(distDir, appDir, workspaceRoot){ + super(`The configured distDir should be inside of the application directory ` + `or the workspace containing it, and must not contain the application ` + `directory itself:\n\n` + ` distDir: ${distDir}\n` + ` application: ${appDir}\n` + ` workspace root: ${workspaceRoot}\n\n` + `Read more: https://nextjs.org/docs/messages/invalid-dist-dir`); + this.name = 'InvalidDistDirError'; + } +} +/** Whether `descendant` is strictly inside `ancestor`. */ // TODO: Account for symlinks when validating containment. +function isStrictlyInside(ancestor, descendant) { + const relative = _nodepath.relative(_nodepath.resolve(ancestor), descendant); + return relative !== '' && relative !== '..' && !relative.startsWith('..' + _nodepath.sep) && !_nodepath.isAbsolute(relative); +} +function verifyDistDir(distDir, appDir, workspaceRoot) { + const resolvedDistDir = _nodepath.resolve(distDir); + const resolvedAppDir = _nodepath.resolve(appDir); + const resolvedWorkspaceRoot = _nodepath.resolve(workspaceRoot); + const isInsideBoundary = isStrictlyInside(resolvedAppDir, resolvedDistDir) || isStrictlyInside(resolvedWorkspaceRoot, resolvedDistDir); + const containsApp = resolvedDistDir === resolvedAppDir || isStrictlyInside(resolvedDistDir, resolvedAppDir); + if (isInsideBoundary && !containsApp) { + return; + } + throw new InvalidDistDirError(resolvedDistDir, resolvedAppDir, resolvedWorkspaceRoot); +} + +//# sourceMappingURL=dist-dir.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/dist-dir.js.map b/e-commerce/node_modules/next/dist/lib/dist-dir.js.map new file mode 100644 index 0000000000000000000000000000000000000000..840b5b1c7f010a2cd44298a1c790e650c1b206bc --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/dist-dir.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/dist-dir.ts"],"sourcesContent":["import * as path from 'node:path'\n\nexport class InvalidDistDirError extends Error {\n constructor(distDir: string, appDir: string, workspaceRoot: string) {\n super(\n `The configured distDir should be inside of the application directory ` +\n `or the workspace containing it, and must not contain the application ` +\n `directory itself:\\n\\n` +\n ` distDir: ${distDir}\\n` +\n ` application: ${appDir}\\n` +\n ` workspace root: ${workspaceRoot}\\n\\n` +\n `Read more: https://nextjs.org/docs/messages/invalid-dist-dir`\n )\n this.name = 'InvalidDistDirError'\n }\n}\n\n/** Whether `descendant` is strictly inside `ancestor`. */\n// TODO: Account for symlinks when validating containment.\nfunction isStrictlyInside(ancestor: string, descendant: string): boolean {\n const relative = path.relative(path.resolve(ancestor), descendant)\n return (\n relative !== '' &&\n relative !== '..' &&\n !relative.startsWith('..' + path.sep) &&\n !path.isAbsolute(relative)\n )\n}\n\n/**\n * Throws unless `distDir` is inside the application or workspace, without\n * containing the application itself.\n */\nexport function verifyDistDir(\n distDir: string,\n appDir: string,\n workspaceRoot: string\n): void {\n const resolvedDistDir = path.resolve(distDir)\n const resolvedAppDir = path.resolve(appDir)\n const resolvedWorkspaceRoot = path.resolve(workspaceRoot)\n\n const isInsideBoundary =\n isStrictlyInside(resolvedAppDir, resolvedDistDir) ||\n isStrictlyInside(resolvedWorkspaceRoot, resolvedDistDir)\n const containsApp =\n resolvedDistDir === resolvedAppDir ||\n isStrictlyInside(resolvedDistDir, resolvedAppDir)\n\n if (isInsideBoundary && !containsApp) {\n return\n }\n\n throw new InvalidDistDirError(\n resolvedDistDir,\n resolvedAppDir,\n resolvedWorkspaceRoot\n )\n}\n"],"names":["InvalidDistDirError","verifyDistDir","Error","constructor","distDir","appDir","workspaceRoot","name","isStrictlyInside","ancestor","descendant","relative","path","resolve","startsWith","sep","isAbsolute","resolvedDistDir","resolvedAppDir","resolvedWorkspaceRoot","isInsideBoundary","containsApp"],"mappings":";;;;;;;;;;;;;;;IAEaA,mBAAmB;eAAnBA;;IA+BGC,aAAa;eAAbA;;;kEAjCM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEf,MAAMD,4BAA4BE;IACvCC,YAAYC,OAAe,EAAEC,MAAc,EAAEC,aAAqB,CAAE;QAClE,KAAK,CACH,CAAC,qEAAqE,CAAC,GACrE,CAAC,qEAAqE,CAAC,GACvE,CAAC,qBAAqB,CAAC,GACvB,CAAC,kBAAkB,EAAEF,QAAQ,EAAE,CAAC,GAChC,CAAC,kBAAkB,EAAEC,OAAO,EAAE,CAAC,GAC/B,CAAC,kBAAkB,EAAEC,cAAc,IAAI,CAAC,GACxC,CAAC,4DAA4D,CAAC;QAElE,IAAI,CAACC,IAAI,GAAG;IACd;AACF;AAEA,wDAAwD,GACxD,0DAA0D;AAC1D,SAASC,iBAAiBC,QAAgB,EAAEC,UAAkB;IAC5D,MAAMC,WAAWC,UAAKD,QAAQ,CAACC,UAAKC,OAAO,CAACJ,WAAWC;IACvD,OACEC,aAAa,MACbA,aAAa,QACb,CAACA,SAASG,UAAU,CAAC,OAAOF,UAAKG,GAAG,KACpC,CAACH,UAAKI,UAAU,CAACL;AAErB;AAMO,SAASV,cACdG,OAAe,EACfC,MAAc,EACdC,aAAqB;IAErB,MAAMW,kBAAkBL,UAAKC,OAAO,CAACT;IACrC,MAAMc,iBAAiBN,UAAKC,OAAO,CAACR;IACpC,MAAMc,wBAAwBP,UAAKC,OAAO,CAACP;IAE3C,MAAMc,mBACJZ,iBAAiBU,gBAAgBD,oBACjCT,iBAAiBW,uBAAuBF;IAC1C,MAAMI,cACJJ,oBAAoBC,kBACpBV,iBAAiBS,iBAAiBC;IAEpC,IAAIE,oBAAoB,CAACC,aAAa;QACpC;IACF;IAEA,MAAM,IAAIrB,oBACRiB,iBACAC,gBACAC;AAEJ","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/download-swc.d.ts b/e-commerce/node_modules/next/dist/lib/download-swc.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b1e749c03bd5ca1971d1bed307e5e73dbdfd63dc --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/download-swc.d.ts @@ -0,0 +1,2 @@ +export declare function downloadNativeNextSwc(version: string, bindingsDirectory: string, triplesABI: Array<string>): Promise<void>; +export declare function downloadWasmSwc(version: string, wasmDirectory: string, variant?: 'nodejs' | 'web'): Promise<void>; diff --git a/e-commerce/node_modules/next/dist/lib/download-swc.js b/e-commerce/node_modules/next/dist/lib/download-swc.js new file mode 100644 index 0000000000000000000000000000000000000000..c6a01456e81c2604a4904ab7628c291859f28f6b --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/download-swc.js @@ -0,0 +1,175 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + downloadNativeNextSwc: null, + downloadWasmSwc: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + downloadNativeNextSwc: function() { + return downloadNativeNextSwc; + }, + downloadWasmSwc: function() { + return downloadWasmSwc; + } +}); +const _fs = /*#__PURE__*/ _interop_require_default(require("fs")); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +const _log = /*#__PURE__*/ _interop_require_wildcard(require("../build/output/log")); +const _tar = require("next/dist/compiled/tar"); +const _getregistry = require("./helpers/get-registry"); +const _getcachedirectory = require("./helpers/get-cache-directory"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +const { WritableStream } = require('node:stream/web'); +const MAX_VERSIONS_TO_CACHE = 8; +async function extractBinary(outputDirectory, pkgName, tarFileName) { + const cacheDirectory = (0, _getcachedirectory.getCacheDirectory)('next-swc', process.env['NEXT_SWC_PATH']); + const extractFromTar = ()=>(0, _tar.x)({ + file: _path.default.join(cacheDirectory, tarFileName), + cwd: outputDirectory, + strip: 1 + }); + if (!_fs.default.existsSync(_path.default.join(cacheDirectory, tarFileName))) { + _log.info(`Downloading swc package ${pkgName}... to ${cacheDirectory}`); + await _fs.default.promises.mkdir(cacheDirectory, { + recursive: true + }); + const tempFile = _path.default.join(cacheDirectory, `${tarFileName}.temp-${Date.now()}`); + const registry = (0, _getregistry.getRegistry)(); + const downloadUrl = `${registry}${pkgName}/-/${tarFileName}`; + await fetch(downloadUrl).then((res)=>{ + const { ok, body } = res; + if (!ok || !body) { + _log.error(`Failed to download swc package from ${downloadUrl}`); + } + if (!ok) { + throw new Error(`request failed with status ${res.status}`); + } + if (!body) { + throw new Error('request failed with empty body'); + } + const cacheWriteStream = _fs.default.createWriteStream(tempFile); + return body.pipeTo(new WritableStream({ + write (chunk) { + return new Promise((resolve, reject)=>cacheWriteStream.write(chunk, (error)=>{ + if (error) { + reject(error); + return; + } + resolve(); + })); + }, + close () { + return new Promise((resolve, reject)=>cacheWriteStream.close((error)=>{ + if (error) { + reject(error); + return; + } + resolve(); + })); + } + })); + }); + await _fs.default.promises.access(tempFile) // ensure the temp file existed + ; + await _fs.default.promises.rename(tempFile, _path.default.join(cacheDirectory, tarFileName)); + } else { + _log.info(`Using cached swc package ${pkgName}...`); + } + await extractFromTar(); + const cacheFiles = await _fs.default.promises.readdir(cacheDirectory); + if (cacheFiles.length > MAX_VERSIONS_TO_CACHE) { + cacheFiles.sort((a, b)=>{ + if (a.length < b.length) return -1; + return a.localeCompare(b); + }); + // prune oldest versions in cache + for(let i = 0; i++; i < cacheFiles.length - MAX_VERSIONS_TO_CACHE){ + await _fs.default.promises.unlink(_path.default.join(cacheDirectory, cacheFiles[i])).catch(()=>{}); + } + } +} +async function downloadNativeNextSwc(version, bindingsDirectory, triplesABI) { + for (const triple of triplesABI){ + const pkgName = `@next/swc-${triple}`; + const tarFileName = `${pkgName.substring(6)}-${version}.tgz`; + const outputDirectory = _path.default.join(bindingsDirectory, pkgName); + if (_fs.default.existsSync(outputDirectory)) { + // if the package is already downloaded a different + // failure occurred than not being present + return; + } + await _fs.default.promises.mkdir(outputDirectory, { + recursive: true + }); + await extractBinary(outputDirectory, pkgName, tarFileName); + } +} +async function downloadWasmSwc(version, wasmDirectory, variant = 'nodejs') { + const pkgName = `@next/swc-wasm-${variant}`; + const tarFileName = `${pkgName.substring(6)}-${version}.tgz`; + const outputDirectory = _path.default.join(wasmDirectory, pkgName); + if (_fs.default.existsSync(outputDirectory)) { + // if the package is already downloaded a different + // failure occurred than not being present + return; + } + await _fs.default.promises.mkdir(outputDirectory, { + recursive: true + }); + await extractBinary(outputDirectory, pkgName, tarFileName); +} + +//# sourceMappingURL=download-swc.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/download-swc.js.map b/e-commerce/node_modules/next/dist/lib/download-swc.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6864a74f887f41685cf003ccdb06ed616bde4bc8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/download-swc.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/download-swc.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport * as Log from '../build/output/log'\nimport { x } from 'next/dist/compiled/tar'\nconst { WritableStream } =\n require('node:stream/web') as typeof import('node:stream/web')\nimport { getRegistry } from './helpers/get-registry'\nimport { getCacheDirectory } from './helpers/get-cache-directory'\n\nconst MAX_VERSIONS_TO_CACHE = 8\n\nasync function extractBinary(\n outputDirectory: string,\n pkgName: string,\n tarFileName: string\n) {\n const cacheDirectory = getCacheDirectory(\n 'next-swc',\n process.env['NEXT_SWC_PATH']\n )\n\n const extractFromTar = () =>\n x({\n file: path.join(cacheDirectory, tarFileName),\n cwd: outputDirectory,\n strip: 1,\n })\n\n if (!fs.existsSync(path.join(cacheDirectory, tarFileName))) {\n Log.info(`Downloading swc package ${pkgName}... to ${cacheDirectory}`)\n await fs.promises.mkdir(cacheDirectory, { recursive: true })\n const tempFile = path.join(\n cacheDirectory,\n `${tarFileName}.temp-${Date.now()}`\n )\n\n const registry = getRegistry()\n\n const downloadUrl = `${registry}${pkgName}/-/${tarFileName}`\n\n await fetch(downloadUrl).then((res) => {\n const { ok, body } = res\n if (!ok || !body) {\n Log.error(`Failed to download swc package from ${downloadUrl}`)\n }\n\n if (!ok) {\n throw new Error(`request failed with status ${res.status}`)\n }\n if (!body) {\n throw new Error('request failed with empty body')\n }\n const cacheWriteStream = fs.createWriteStream(tempFile)\n return body.pipeTo(\n new WritableStream({\n write(chunk) {\n return new Promise<void>((resolve, reject) =>\n cacheWriteStream.write(chunk, (error) => {\n if (error) {\n reject(error)\n return\n }\n\n resolve()\n })\n )\n },\n close() {\n return new Promise<void>((resolve, reject) =>\n cacheWriteStream.close((error) => {\n if (error) {\n reject(error)\n return\n }\n\n resolve()\n })\n )\n },\n })\n )\n })\n\n await fs.promises.access(tempFile) // ensure the temp file existed\n await fs.promises.rename(tempFile, path.join(cacheDirectory, tarFileName))\n } else {\n Log.info(`Using cached swc package ${pkgName}...`)\n }\n await extractFromTar()\n\n const cacheFiles = await fs.promises.readdir(cacheDirectory)\n\n if (cacheFiles.length > MAX_VERSIONS_TO_CACHE) {\n cacheFiles.sort((a, b) => {\n if (a.length < b.length) return -1\n return a.localeCompare(b)\n })\n\n // prune oldest versions in cache\n for (let i = 0; i++; i < cacheFiles.length - MAX_VERSIONS_TO_CACHE) {\n await fs.promises\n .unlink(path.join(cacheDirectory, cacheFiles[i]))\n .catch(() => {})\n }\n }\n}\n\nexport async function downloadNativeNextSwc(\n version: string,\n bindingsDirectory: string,\n triplesABI: Array<string>\n) {\n for (const triple of triplesABI) {\n const pkgName = `@next/swc-${triple}`\n const tarFileName = `${pkgName.substring(6)}-${version}.tgz`\n const outputDirectory = path.join(bindingsDirectory, pkgName)\n\n if (fs.existsSync(outputDirectory)) {\n // if the package is already downloaded a different\n // failure occurred than not being present\n return\n }\n\n await fs.promises.mkdir(outputDirectory, { recursive: true })\n await extractBinary(outputDirectory, pkgName, tarFileName)\n }\n}\n\nexport async function downloadWasmSwc(\n version: string,\n wasmDirectory: string,\n variant: 'nodejs' | 'web' = 'nodejs'\n) {\n const pkgName = `@next/swc-wasm-${variant}`\n const tarFileName = `${pkgName.substring(6)}-${version}.tgz`\n const outputDirectory = path.join(wasmDirectory, pkgName)\n\n if (fs.existsSync(outputDirectory)) {\n // if the package is already downloaded a different\n // failure occurred than not being present\n return\n }\n\n await fs.promises.mkdir(outputDirectory, { recursive: true })\n await extractBinary(outputDirectory, pkgName, tarFileName)\n}\n"],"names":["downloadNativeNextSwc","downloadWasmSwc","WritableStream","require","MAX_VERSIONS_TO_CACHE","extractBinary","outputDirectory","pkgName","tarFileName","cacheDirectory","getCacheDirectory","process","env","extractFromTar","x","file","path","join","cwd","strip","fs","existsSync","Log","info","promises","mkdir","recursive","tempFile","Date","now","registry","getRegistry","downloadUrl","fetch","then","res","ok","body","error","Error","status","cacheWriteStream","createWriteStream","pipeTo","write","chunk","Promise","resolve","reject","close","access","rename","cacheFiles","readdir","length","sort","a","b","localeCompare","i","unlink","catch","version","bindingsDirectory","triplesABI","triple","substring","wasmDirectory","variant"],"mappings":";;;;;;;;;;;;;;;IA2GsBA,qBAAqB;eAArBA;;IAqBAC,eAAe;eAAfA;;;2DAhIP;6DACE;6DACI;qBACH;6BAGU;mCACM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAHlC,MAAM,EAAEC,cAAc,EAAE,GACtBC,QAAQ;AAIV,MAAMC,wBAAwB;AAE9B,eAAeC,cACbC,eAAuB,EACvBC,OAAe,EACfC,WAAmB;IAEnB,MAAMC,iBAAiBC,IAAAA,oCAAiB,EACtC,YACAC,QAAQC,GAAG,CAAC,gBAAgB;IAG9B,MAAMC,iBAAiB,IACrBC,IAAAA,MAAC,EAAC;YACAC,MAAMC,aAAI,CAACC,IAAI,CAACR,gBAAgBD;YAChCU,KAAKZ;YACLa,OAAO;QACT;IAEF,IAAI,CAACC,WAAE,CAACC,UAAU,CAACL,aAAI,CAACC,IAAI,CAACR,gBAAgBD,eAAe;QAC1Dc,KAAIC,IAAI,C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EpC,MAAM7D,UAAU,CAAC,eAAe,EAAE6D,SAAS;IAC3C,MAAM5D,cAAc,GAAGD,QAAQ2D,SAAS,CAAC,GAAG,CAAC,EAAEJ,QAAQ,IAAI,CAAC;IAC5D,MAAMxD,kBAAkBU,aAAI,CAACC,IAAI,CAACkD,eAAe5D;IAEjD,IAAIa,WAAE,CAACC,UAAU,CAACf,kBAAkB;QAClC,mDAAmD;QACnD,0CAA0C;QAC1C;IACF;IAEA,MAAMc,WAAE,CAACI,QAAQ,CAACC,KAAK,CAACnB,iBAAiB;QAAEoB,WAAW;IAAK;IAC3D,MAAMrB,cAAcC,iBAAiBC,SAASC;AAChD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/fallback.d.ts b/e-commerce/node_modules/next/dist/lib/fallback.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ea3368b2bc66c2ecfbcd76a2d0bf2f13cdacb01f --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/fallback.d.ts @@ -0,0 +1,41 @@ +/** + * Describes the different fallback modes that a given page can have. + */ +export declare const enum FallbackMode { + /** + * A BLOCKING_STATIC_RENDER fallback will block the request until the page is + * generated. No fallback page will be rendered, and users will have to wait + * to render the page. + */ + BLOCKING_STATIC_RENDER = "BLOCKING_STATIC_RENDER", + /** + * When set to PRERENDER, a fallback page will be sent to users in place of + * forcing them to wait for the page to be generated. This allows the user to + * see a rendered page earlier. + */ + PRERENDER = "PRERENDER", + /** + * When set to NOT_FOUND, pages that are not already prerendered will result + * in a not found response. + */ + NOT_FOUND = "NOT_FOUND" +} +/** + * The fallback value returned from the `getStaticPaths` function. + */ +export type GetStaticPathsFallback = boolean | 'blocking'; +/** + * Parses the fallback field from the prerender manifest. + * + * @param fallbackField The fallback field from the prerender manifest. + * @returns The fallback mode. + */ +export declare function parseFallbackField(fallbackField: string | boolean | null | undefined): FallbackMode | undefined; +export declare function fallbackModeToFallbackField(fallback: FallbackMode, page: string | undefined): string | false | null; +/** + * Parses the fallback from the static paths result. + * + * @param result The result from the static paths function. + * @returns The fallback mode. + */ +export declare function parseStaticPathsResult(result: GetStaticPathsFallback): FallbackMode; diff --git a/e-commerce/node_modules/next/dist/lib/fallback.js b/e-commerce/node_modules/next/dist/lib/fallback.js new file mode 100644 index 0000000000000000000000000000000000000000..61abba7a154fea80dfd6b5793603ec1c001cf53d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/fallback.js @@ -0,0 +1,88 @@ +/** + * Describes the different fallback modes that a given page can have. + */ "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + FallbackMode: null, + fallbackModeToFallbackField: null, + parseFallbackField: null, + parseStaticPathsResult: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + FallbackMode: function() { + return FallbackMode; + }, + fallbackModeToFallbackField: function() { + return fallbackModeToFallbackField; + }, + parseFallbackField: function() { + return parseFallbackField; + }, + parseStaticPathsResult: function() { + return parseStaticPathsResult; + } +}); +var FallbackMode = /*#__PURE__*/ function(FallbackMode) { + /** + * A BLOCKING_STATIC_RENDER fallback will block the request until the page is + * generated. No fallback page will be rendered, and users will have to wait + * to render the page. + */ FallbackMode["BLOCKING_STATIC_RENDER"] = "BLOCKING_STATIC_RENDER"; + /** + * When set to PRERENDER, a fallback page will be sent to users in place of + * forcing them to wait for the page to be generated. This allows the user to + * see a rendered page earlier. + */ FallbackMode["PRERENDER"] = "PRERENDER"; + /** + * When set to NOT_FOUND, pages that are not already prerendered will result + * in a not found response. + */ FallbackMode["NOT_FOUND"] = "NOT_FOUND"; + return FallbackMode; +}({}); +function parseFallbackField(fallbackField) { + if (typeof fallbackField === 'string') { + return "PRERENDER"; + } else if (fallbackField === null) { + return "BLOCKING_STATIC_RENDER"; + } else if (fallbackField === false) { + return "NOT_FOUND"; + } else if (fallbackField === undefined) { + return undefined; + } else { + throw new Error(`Invalid fallback option: ${fallbackField}. Fallback option must be a string, null, undefined, or false.`); + } +} +function fallbackModeToFallbackField(fallback, page) { + switch(fallback){ + case "BLOCKING_STATIC_RENDER": + return null; + case "NOT_FOUND": + return false; + case "PRERENDER": + if (!page) { + throw new Error(`Invariant: expected a page to be provided when fallback mode is "${fallback}"`); + } + return page; + default: + throw new Error(`Invalid fallback mode: ${fallback}`); + } +} +function parseStaticPathsResult(result) { + if (result === true) { + return "PRERENDER"; + } else if (result === 'blocking') { + return "BLOCKING_STATIC_RENDER"; + } else { + return "NOT_FOUND"; + } +} + +//# sourceMappingURL=fallback.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/fallback.js.map b/e-commerce/node_modules/next/dist/lib/fallback.js.map new file mode 100644 index 0000000000000000000000000000000000000000..4978f7892158511231c3119e57434cb24c2e0a13 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/fallback.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/fallback.ts"],"sourcesContent":["/**\n * Describes the different fallback modes that a given page can have.\n */\nexport const enum FallbackMode {\n /**\n * A BLOCKING_STATIC_RENDER fallback will block the request until the page is\n * generated. No fallback page will be rendered, and users will have to wait\n * to render the page.\n */\n BLOCKING_STATIC_RENDER = 'BLOCKING_STATIC_RENDER',\n\n /**\n * When set to PRERENDER, a fallback page will be sent to users in place of\n * forcing them to wait for the page to be generated. This allows the user to\n * see a rendered page earlier.\n */\n PRERENDER = 'PRERENDER',\n\n /**\n * When set to NOT_FOUND, pages that are not already prerendered will result\n * in a not found response.\n */\n NOT_FOUND = 'NOT_FOUND',\n}\n\n/**\n * The fallback value returned from the `getStaticPaths` function.\n */\nexport type GetStaticPathsFallback = boolean | 'blocking'\n\n/**\n * Parses the fallback field from the prerender manifest.\n *\n * @param fallbackField The fallback field from the prerender manifest.\n * @returns The fallback mode.\n */\nexport function parseFallbackField(\n fallbackField: string | boolean | null | undefined\n): FallbackMode | undefined {\n if (typeof fallbackField === 'string') {\n return FallbackMode.PRERENDER\n } else if (fallbackField === null) {\n return FallbackMode.BLOCKING_STATIC_RENDER\n } else if (fallbackField === false) {\n return FallbackMode.NOT_FOUND\n } else if (fallbackField === undefined) {\n return undefined\n } else {\n throw new Error(\n `Invalid fallback option: ${fallbackField}. Fallback option must be a string, null, undefined, or false.`\n )\n }\n}\n\nexport function fallbackModeToFallbackField(\n fallback: FallbackMode,\n page: string | undefined\n): string | false | null {\n switch (fallback) {\n case FallbackMode.BLOCKING_STATIC_RENDER:\n return null\n case FallbackMode.NOT_FOUND:\n return false\n case FallbackMode.PRERENDER:\n if (!page) {\n throw new Error(\n `Invariant: expected a page to be provided when fallback mode is \"${fallback}\"`\n )\n }\n\n return page\n default:\n throw new Error(`Invalid fallback mode: ${fallback}`)\n }\n}\n\n/**\n * Parses the fallback from the static paths result.\n *\n * @param result The result from the static paths function.\n * @returns The fallback mode.\n */\nexport function parseStaticPathsResult(\n result: GetStaticPathsFallback\n): FallbackMode {\n if (result === true) {\n return FallbackMode.PRERENDER\n } else if (result === 'blocking') {\n return FallbackMode.BLOCKING_STATIC_RENDER\n } else {\n return FallbackMode.NOT_FOUND\n }\n}\n"],"names":["FallbackMode","fallbackModeToFallbackField","parseFallbackField","parseStaticPathsResult","fallbackField","undefined","Error","fallback","page","result"],"mappings":"AAAA;;CAEC;;;;;;;;;;;;;;;;;IACiBA,YAAY;eAAZA;;IAmDFC,2BAA2B;eAA3BA;;IAlBAC,kBAAkB;eAAlBA;;IA8CAC,sBAAsB;eAAtBA;;;AA/ET,IAAA,AAAWH,sCAAAA;IAChB;;;;GAIC;IAGD;;;;GAIC;IAGD;;;GAGC;WAlBeA;;AAiCX,SAASE,mBACdE,aAAkD;IAElD,IAAI,OAAOA,kBAAkB,UAAU;QACrC;IACF,OAAO,IAAIA,kBAAkB,MAAM;QACjC;IACF,OAAO,IAAIA,kBAAkB,OAAO;QAClC;IACF,OAAO,IAAIA,kBAAkBC,WAAW;QACtC,OAAOA;IACT,OAAO;QACL,MAAM,IAAIC,MACR,CAAC,yBAAyB,EAAEF,cAAc,8DAA8D,CAAC;IAE7G;AACF;AAEO,SAASH,4BACdM,QAAsB,EACtBC,IAAwB;IAExB,OAAQD;QACN;YACE,OAAO;QACT;YACE,OAAO;QACT;YACE,IAAI,CAACC,MAAM;gBACT,MAAM,IAAIF,MACR,CAAC,iEAAiE,EAAEC,SAAS,CAAC,CAAC;YAEnF;YAEA,OAAOC;QACT;YACE,MAAM,IAAIF,MAAM,CAAC,uBAAuB,EAAEC,UAAU;IACxD;AACF;AAQO,SAASJ,uBACdM,MAA8B;IAE9B,IAAIA,WAAW,MAAM;QACnB;IACF,OAAO,IAAIA,WAAW,YAAY;QAChC;IACF,OAAO;QACL;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/file-exists.d.ts b/e-commerce/node_modules/next/dist/lib/file-exists.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7ddc4121bf12f592e7dc9ae4b1a9087688a3af13 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/file-exists.d.ts @@ -0,0 +1,5 @@ +export declare enum FileType { + File = "file", + Directory = "directory" +} +export declare function fileExists(fileName: string, type?: FileType): Promise<boolean>; diff --git a/e-commerce/node_modules/next/dist/lib/file-exists.js b/e-commerce/node_modules/next/dist/lib/file-exists.js new file mode 100644 index 0000000000000000000000000000000000000000..183eb896ef87b1b96031df157307e7be36f8a491 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/file-exists.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + FileType: null, + fileExists: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + FileType: function() { + return FileType; + }, + fileExists: function() { + return fileExists; + } +}); +const _fs = require("fs"); +const _iserror = /*#__PURE__*/ _interop_require_default(require("./is-error")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +var FileType = /*#__PURE__*/ function(FileType) { + FileType["File"] = "file"; + FileType["Directory"] = "directory"; + return FileType; +}({}); +async function fileExists(fileName, type) { + try { + if (type === "file") { + const stats = await _fs.promises.stat(fileName); + return stats.isFile(); + } else if (type === "directory") { + const stats = await _fs.promises.stat(fileName); + return stats.isDirectory(); + } + return (0, _fs.existsSync)(fileName); + } catch (err) { + if ((0, _iserror.default)(err) && (err.code === 'ENOENT' || err.code === 'ENAMETOOLONG')) { + return false; + } + throw err; + } +} + +//# sourceMappingURL=file-exists.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/file-exists.js.map b/e-commerce/node_modules/next/dist/lib/file-exists.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f938f1f4e1fa4c927e705cee6c618fabe88b6be1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/file-exists.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/file-exists.ts"],"sourcesContent":["import { existsSync, promises } from 'fs'\nimport isError from './is-error'\n\nexport enum FileType {\n File = 'file',\n Directory = 'directory',\n}\n\nexport async function fileExists(\n fileName: string,\n type?: FileType\n): Promise<boolean> {\n try {\n if (type === FileType.File) {\n const stats = await promises.stat(fileName)\n return stats.isFile()\n } else if (type === FileType.Directory) {\n const stats = await promises.stat(fileName)\n return stats.isDirectory()\n }\n\n return existsSync(fileName)\n } catch (err) {\n if (\n isError(err) &&\n (err.code === 'ENOENT' || err.code === 'ENAMETOOLONG')\n ) {\n return false\n }\n throw err\n }\n}\n"],"names":["FileType","fileExists","fileName","type","stats","promises","stat","isFile","isDirectory","existsSync","err","isError","code"],"mappings":";;;;;;;;;;;;;;;IAGYA,QAAQ;eAARA;;IAKUC,UAAU;eAAVA;;;oBARe;gEACjB;;;;;;AAEb,IAAA,AAAKD,kCAAAA;;;WAAAA;;AAKL,eAAeC,WACpBC,QAAgB,EAChBC,IAAe;IAEf,IAAI;QACF,IAAIA,iBAAwB;YAC1B,MAAMC,QAAQ,MAAMC,YAAQ,CAACC,IAAI,CAACJ;YAClC,OAAOE,MAAMG,MAAM;QACrB,OAAO,IAAIJ,sBAA6B;YACtC,MAAMC,QAAQ,MAAMC,YAAQ,CAACC,IAAI,CAACJ;YAClC,OAAOE,MAAMI,WAAW;QAC1B;QAEA,OAAOC,IAAAA,cAAU,EAACP;IACpB,EAAE,OAAOQ,KAAK;QACZ,IACEC,IAAAA,gBAAO,EAACD,QACPA,CAAAA,IAAIE,IAAI,KAAK,YAAYF,IAAIE,IAAI,KAAK,cAAa,GACpD;YACA,OAAO;QACT;QACA,MAAMF;IACR;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/find-config.d.ts b/e-commerce/node_modules/next/dist/lib/find-config.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5ca4035ef6f4951b3ab36e5321a314544508e784 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/find-config.d.ts @@ -0,0 +1,6 @@ +type RecursivePartial<T> = { + [P in keyof T]?: RecursivePartial<T[P]>; +}; +export declare function findConfigPath(dir: string, key: string): Promise<string | undefined>; +export declare function findConfig<T>(directory: string, key: string, _returnFile?: boolean): Promise<RecursivePartial<T> | null>; +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/find-config.js b/e-commerce/node_modules/next/dist/lib/find-config.js new file mode 100644 index 0000000000000000000000000000000000000000..82b080a2a697bbb8612f0f17d241efcd3dcf3d74 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/find-config.js @@ -0,0 +1,102 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + findConfig: null, + findConfigPath: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + findConfig: function() { + return findConfig; + }, + findConfigPath: function() { + return findConfigPath; + } +}); +const _findup = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/find-up")); +const _promises = require("fs/promises"); +const _json5 = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/json5")); +const _url = require("url"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function findConfigPath(dir, key) { + // If we didn't find the configuration in `package.json`, we should look for + // known filenames. + return (0, _findup.default)([ + `.${key}rc.json`, + `${key}.config.json`, + `.${key}rc.js`, + `${key}.config.js`, + `${key}.config.mjs`, + `${key}.config.cjs` + ], { + cwd: dir + }); +} +async function findConfig(directory, key, _returnFile) { + // `package.json` configuration always wins. Let's check that first. + const packageJsonPath = await (0, _findup.default)('package.json', { + cwd: directory + }); + let isESM = false; + if (packageJsonPath) { + try { + const packageJsonStr = await (0, _promises.readFile)(packageJsonPath, 'utf8'); + const packageJson = JSON.parse(packageJsonStr); + if (typeof packageJson !== 'object') { + throw new Error() // Stop processing and continue + ; + } + if (packageJson.type === 'module') { + isESM = true; + } + if (packageJson[key] != null && typeof packageJson[key] === 'object') { + return packageJson[key]; + } + } catch { + // Ignore error and continue + } + } + const filePath = await findConfigPath(directory, key); + const esmImport = (path)=>{ + // Skip mapping to absolute url with pathToFileURL on windows if it's jest + // https://github.com/nodejs/node/issues/31710#issuecomment-587345749 + if (process.platform === 'win32' && !process.env.JEST_WORKER_ID) { + // on windows import("C:\\path\\to\\file") is not valid, so we need to + // use file:// URLs + return import((0, _url.pathToFileURL)(path).toString()); + } else { + return import(path); + } + }; + if (filePath) { + if (filePath.endsWith('.js')) { + if (isESM) { + return (await esmImport(filePath)).default; + } else { + return require(filePath); + } + } else if (filePath.endsWith('.mjs')) { + return (await esmImport(filePath)).default; + } else if (filePath.endsWith('.cjs')) { + return require(filePath); + } + // We load JSON contents with JSON5 to allow users to comment in their + // configuration file. This pattern was popularized by TypeScript. + const fileContents = await (0, _promises.readFile)(filePath, 'utf8'); + return _json5.default.parse(fileContents); + } + return null; +} + +//# sourceMappingURL=find-config.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/find-config.js.map b/e-commerce/node_modules/next/dist/lib/find-config.js.map new file mode 100644 index 0000000000000000000000000000000000000000..aa8ececf7e7c04134e74b0bf5420d594faf06884 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/find-config.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/find-config.ts"],"sourcesContent":["import findUp from 'next/dist/compiled/find-up'\nimport { readFile } from 'fs/promises'\nimport JSON5 from 'next/dist/compiled/json5'\nimport { pathToFileURL } from 'url'\n\ntype RecursivePartial<T> = {\n [P in keyof T]?: RecursivePartial<T[P]>\n}\n\nexport function findConfigPath(\n dir: string,\n key: string\n): Promise<string | undefined> {\n // If we didn't find the configuration in `package.json`, we should look for\n // known filenames.\n return findUp(\n [\n `.${key}rc.json`,\n `${key}.config.json`,\n `.${key}rc.js`,\n `${key}.config.js`,\n `${key}.config.mjs`,\n `${key}.config.cjs`,\n ],\n {\n cwd: dir,\n }\n )\n}\n\n// We'll allow configuration to be typed, but we force everything provided to\n// become optional. We do not perform any schema validation. We should maybe\n// force all the types to be `unknown` as well.\nexport async function findConfig<T>(\n directory: string,\n key: string,\n _returnFile?: boolean\n): Promise<RecursivePartial<T> | null> {\n // `package.json` configuration always wins. Let's check that first.\n const packageJsonPath = await findUp('package.json', { cwd: directory })\n let isESM = false\n\n if (packageJsonPath) {\n try {\n const packageJsonStr = await readFile(packageJsonPath, 'utf8')\n const packageJson = JSON.parse(packageJsonStr) as {\n [key: string]: string\n }\n\n if (typeof packageJson !== 'object') {\n throw new Error() // Stop processing and continue\n }\n\n if (packageJson.type === 'module') {\n isESM = true\n }\n\n if (packageJson[key] != null && typeof packageJson[key] === 'object') {\n return packageJson[key]\n }\n } catch {\n // Ignore error and continue\n }\n }\n\n const filePath = await findConfigPath(directory, key)\n\n const esmImport = (path: string) => {\n // Skip mapping to absolute url with pathToFileURL on windows if it's jest\n // https://github.com/nodejs/node/issues/31710#issuecomment-587345749\n if (process.platform === 'win32' && !process.env.JEST_WORKER_ID) {\n // on windows import(\"C:\\\\path\\\\to\\\\file\") is not valid, so we need to\n // use file:// URLs\n return import(pathToFileURL(path).toString())\n } else {\n return import(path)\n }\n }\n\n if (filePath) {\n if (filePath.endsWith('.js')) {\n if (isESM) {\n return (await esmImport(filePath)).default\n } else {\n return require(filePath)\n }\n } else if (filePath.endsWith('.mjs')) {\n return (await esmImport(filePath)).default\n } else if (filePath.endsWith('.cjs')) {\n return require(filePath)\n }\n\n // We load JSON contents with JSON5 to allow users to comment in their\n // configuration file. This pattern was popularized by TypeScript.\n const fileContents = await readFile(filePath, 'utf8')\n return JSON5.parse(fileContents)\n }\n\n return null\n}\n"],"names":["findConfig","findConfigPath","dir","key","findUp","cwd","directory","_returnFile","packageJsonPath","isESM","packageJsonStr","readFile","packageJson","JSON","parse","Error","type","filePath","esmImport","path","process","platform","env","JEST_WORKER_ID","pathToFileURL","toString","endsWith","default","require","fileContents","JSON5"],"mappings":";;;;;;;;;;;;;;;IAiCsBA,UAAU;eAAVA;;IAxBNC,cAAc;eAAdA;;;+DATG;0BACM;8DACP;qBACY;;;;;;AAMvB,SAASA,eACdC,GAAW,EACXC,GAAW;IAEX,4EAA4E;IAC5E,mBAAmB;IACnB,OAAOC,IAAAA,eAAM,EACX;QACE,CAAC,CAAC,EAAED,IAAI,OAAO,CAAC;QAChB,GAAGA,IAAI,YAAY,CAAC;QACpB,CAAC,CAAC,EAAEA,IAAI,KAAK,CAAC;QACd,GAAGA,IAAI,UAAU,CAAC;QAClB,GAAGA,IAAI,WAAW,CAAC;QACnB,GAAGA,IAAI,WAAW,CAAC;KACpB,EACD;QACEE,KAAKH;IACP;AAEJ;AAKO,eAAeF,WACpBM,SAAiB,EACjBH,GAAW,EACXI,WAAqB;IAErB,oEAAoE;IACpE,MAAMC,kBAAkB,MAAMJ,IAAAA,eAAM,EAAC,gBAAgB;QAAEC,KAAKC;IAAU;IACtE,IAAIG,QAAQ;IAEZ,IAAID,iBAAiB;QACnB,IAAI;YACF,MAAME,iBAAiB,MAAMC,IAAAA,kBAAQ,EAACH,iBAAi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node_modules/next/dist/lib/find-pages-dir.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8a9e988d5a76a5da210f497427041be65550991a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/find-pages-dir.d.ts @@ -0,0 +1,5 @@ +export declare function findDir(dir: string, name: 'pages' | 'app'): string | null; +export declare function findPagesDir(dir: string): { + pagesDir: string | undefined; + appDir: string | undefined; +}; diff --git a/e-commerce/node_modules/next/dist/lib/find-pages-dir.js b/e-commerce/node_modules/next/dist/lib/find-pages-dir.js new file mode 100644 index 0000000000000000000000000000000000000000..04782cf8e00c48861d4db7f0bddacf159ece97f2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/find-pages-dir.js @@ -0,0 +1,57 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + findDir: null, + findPagesDir: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + findDir: function() { + return findDir; + }, + findPagesDir: function() { + return findPagesDir; + } +}); +const _fs = /*#__PURE__*/ _interop_require_default(require("fs")); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function findDir(dir, name) { + // prioritize ./${name} over ./src/${name} + let curDir = _path.default.join(dir, name); + if (_fs.default.existsSync(curDir)) return curDir; + curDir = _path.default.join(dir, 'src', name); + if (_fs.default.existsSync(curDir)) return curDir; + return null; +} +function findPagesDir(dir) { + const pagesDir = findDir(dir, 'pages') || undefined; + const appDir = findDir(dir, 'app') || undefined; + if (appDir == null && pagesDir == null) { + throw new Error("> Couldn't find any `pages` or `app` directory. Please create one under the project root"); + } + if (pagesDir && appDir) { + const pagesParent = _path.default.dirname(pagesDir); + const appParent = _path.default.dirname(appDir); + if (pagesParent !== appParent) { + throw new Error('> `pages` and `app` directories should be under the same folder'); + } + } + return { + pagesDir, + appDir + }; +} + +//# sourceMappingURL=find-pages-dir.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/find-pages-dir.js.map b/e-commerce/node_modules/next/dist/lib/find-pages-dir.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e9f20ee217f28e478b1b3315ff735a053439e9b8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/find-pages-dir.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/find-pages-dir.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\n\nexport function findDir(dir: string, name: 'pages' | 'app'): string | null {\n // prioritize ./${name} over ./src/${name}\n let curDir = path.join(dir, name)\n if (fs.existsSync(curDir)) return curDir\n\n curDir = path.join(dir, 'src', name)\n if (fs.existsSync(curDir)) return curDir\n\n return null\n}\n\nexport function findPagesDir(dir: string): {\n pagesDir: string | undefined\n appDir: string | undefined\n} {\n const pagesDir = findDir(dir, 'pages') || undefined\n const appDir = findDir(dir, 'app') || undefined\n\n if (appDir == null && pagesDir == null) {\n throw new Error(\n \"> Couldn't find any `pages` or `app` directory. Please create one under the project root\"\n )\n }\n\n if (pagesDir && appDir) {\n const pagesParent = path.dirname(pagesDir)\n const appParent = path.dirname(appDir)\n if (pagesParent !== appParent) {\n throw new Error(\n '> `pages` and `app` directories should be under the same folder'\n )\n }\n }\n\n return {\n pagesDir,\n appDir,\n }\n}\n"],"names":["findDir","findPagesDir","dir","name","curDir","path","join","fs","existsSync","pagesDir","undefined","appDir","Error","pagesParent","dirname","appParent"],"mappings":";;;;;;;;;;;;;;;IAGgBA,OAAO;eAAPA;;IAWAC,YAAY;eAAZA;;;2DAdD;6DACE;;;;;;AAEV,SAASD,QAAQE,GAAW,EAAEC,IAAqB;IACxD,0CAA0C;IAC1C,IAAIC,SAASC,aAAI,CAACC,IAAI,CAACJ,KAAKC;IAC5B,IAAII,WAAE,CAACC,UAAU,CAACJ,SAAS,OAAOA;IAElCA,SAASC,aAAI,CAACC,IAAI,CAACJ,KAAK,OAAOC;IAC/B,IAAII,WAAE,CAACC,UAAU,CAACJ,SAAS,OAAOA;IAElC,OAAO;AACT;AAEO,SAASH,aAAaC,GAAW;IAItC,MAAMO,WAAWT,QAAQE,KAAK,YAAYQ;IAC1C,MAAMC,SAASX,QAAQE,KAAK,UAAUQ;IAEtC,IAAIC,UAAU,QAAQF,YAAY,MAAM;QACtC,MAAM,IAAIG,MACR;IAEJ;IAEA,IAAIH,YAAYE,QAAQ;QACtB,MAAME,cAAcR,aAAI,CAACS,OAAO,CAACL;QACjC,MAAMM,YAAYV,aAAI,CAACS,OAAO,CAACH;QAC/B,IAAIE,gBAAgBE,WAAW;YAC7B,MAAM,IAAIH,MACR;QAEJ;IACF;IAEA,OAAO;QACLH;QACAE;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/find-root.d.ts b/e-commerce/node_modules/next/dist/lib/find-root.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b7c05a84f88a632dae9d74727d86170f669657e1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/find-root.d.ts @@ -0,0 +1,13 @@ +export type RootBoundary = { + boundary: string; + marker: string; + root: string; + type: 'repository' | 'home'; +}; +export declare function findRootDirAndLockFiles(cwd: string): { + lockFiles: string[]; + rootDir: string; + boundary?: RootBoundary; +}; +export declare function warnDuplicatedLockFiles(lockFiles: string[]): void; +export declare function warnRootBoundary({ boundary, marker, root, type, }: RootBoundary): void; diff --git a/e-commerce/node_modules/next/dist/lib/find-root.js b/e-commerce/node_modules/next/dist/lib/find-root.js new file mode 100644 index 0000000000000000000000000000000000000000..baa8fe58db3ac597f92d177a43e0f7a3db5461c2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/find-root.js @@ -0,0 +1,280 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + findRootDirAndLockFiles: null, + warnDuplicatedLockFiles: null, + warnRootBoundary: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + findRootDirAndLockFiles: function() { + return findRootDirAndLockFiles; + }, + warnDuplicatedLockFiles: function() { + return warnDuplicatedLockFiles; + }, + warnRootBoundary: function() { + return warnRootBoundary; + } +}); +const _path = require("path"); +const _fs = require("fs"); +const _os = require("os"); +const _findup = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/find-up")); +const _log = /*#__PURE__*/ _interop_require_wildcard(require("../build/output/log")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +function toRealPath(path) { + try { + return _fs.realpathSync.native(path); + } catch { + return path; + } +} +// `homedir()` throws when it cannot determine a home directory, and returns an +// empty string on some platforms. an empty value would match every directory, +// so treat both as "no home directory". +function findHomeDir() { + try { + return toRealPath((0, _os.homedir)()) || undefined; + } catch { + return undefined; + } +} +// if `descendant` is inside of `ancestor` or `descendant` == `ancestor` +function isAncestorOrSelf(ancestor, descendant) { + const rel = (0, _path.relative)(ancestor, descendant); + return rel === '' || !rel.startsWith('..') && !(0, _path.isAbsolute)(rel); +} +// if `descendant` is inside of `ancestor` +function isStrictAncestor(ancestor, descendant) { + const rel = (0, _path.relative)(ancestor, descendant); + return rel !== '' && !rel.startsWith('..') && !(0, _path.isAbsolute)(rel); +} +// true for a git worktree (its git dir has a `commondir` file); +// this method returns false for a submodule. +function isGitWorktree(dir, gitFile) { + let contents; + try { + contents = (0, _fs.readFileSync)(gitFile, 'utf8'); + } catch { + return false; + } + // Match the behavior in git: + // https://github.com/git/git/blob/13c7afec212fc97ce257d15601659314c6673d6c/setup.c#L1007-L1018 + const match = /^gitdir: (.+?)[\r\n]*$/s.exec(contents); + if (!match) return false; + const gitDir = (0, _path.resolve)(dir, match[1]); + return (0, _fs.existsSync)((0, _path.join)(gitDir, 'commondir')); +} +// finds the first git repository or git worktree above the +// current working directory. we limit the project root to +// inside a worktree or git repository. this is because if +// you use worktrees, you may have lock files from the +// parent git repo that are in folders that are not relevant +// to watch. +function findGitBoundary(cwd) { + let isWorktree = false; + const gitDir = _findup.default.sync((dir)=>{ + var _statSync; + const candidate = (0, _path.join)(dir, '.git'); + const isDirectory = (_statSync = (0, _fs.statSync)(candidate, { + throwIfNoEntry: false + })) == null ? void 0 : _statSync.isDirectory(); + isWorktree = !isDirectory && isGitWorktree(dir, candidate); + return isDirectory || isWorktree ? dir : undefined; + }, { + cwd, + type: 'directory' + }); + if (!gitDir) return undefined; + return { + type: isWorktree ? 'worktree' : 'repository', + dir: toRealPath(gitDir) + }; +} +const LOCK_FILES = [ + 'pnpm-lock.yaml', + 'package-lock.json', + 'yarn.lock', + 'bun.lock', + 'bun.lockb' +]; +// Dedicated workspace-root files. pnpm and Lerna declare the root this way. +const WORKSPACE_MARKERS = [ + 'pnpm-workspace.yaml', + 'lerna.json' +]; +// npm, Yarn, and Bun declare the root via a package.json `workspaces` field, +// which may be an array or an object (e.g. Yarn's `{ packages: [...] }`). +function hasWorkspacesField(packageJson) { + try { + return JSON.parse((0, _fs.readFileSync)(packageJson, 'utf8')).workspaces != null; + } catch { + return false; + } +} +function findWorkspaceMarker(directory) { + for (const name of WORKSPACE_MARKERS){ + const markerPath = (0, _path.join)(directory, name); + if ((0, _fs.existsSync)(markerPath)) { + return markerPath; + } + } + const packageJson = (0, _path.join)(directory, 'package.json'); + return hasWorkspacesField(packageJson) ? packageJson : undefined; +} +function findNextRootCandidate(cwd) { + // a workspace marker takes precedence over lockfiles, which can be included in + // the application directory by accident. + const marker = _findup.default.sync(findWorkspaceMarker, { + cwd + }); + if (marker) { + return { + path: marker, + isWorkspaceMarker: true + }; + } + const lockFile = _findup.default.sync(LOCK_FILES, { + cwd + }); + return lockFile ? { + path: lockFile, + isWorkspaceMarker: false + } : undefined; +} +function findRootDirAndLockFiles(cwd) { + const initialCandidate = findNextRootCandidate(cwd); + if (!initialCandidate) return { + lockFiles: [], + rootDir: cwd + }; + const candidates = [ + initialCandidate.path + ]; + let foundWorkspaceMarker = initialCandidate.isWorkspaceMarker; + while(true){ + const lastCandidate = candidates[candidates.length - 1]; + const currentDir = (0, _path.dirname)(lastCandidate); + const parentDir = (0, _path.dirname)(currentDir); + // dirname('/')==='/' so if we happen to reach the FS root (as might happen in a container we need to quit to avoid looping forever + if (parentDir === currentDir) break; + const nextCandidate = findNextRootCandidate(parentDir); + if (!nextCandidate) break; + // findNextRootCandidate searches for markers all the way up, so a non-marker + // here means there is no higher marker: nothing above can extend the root. + if (foundWorkspaceMarker && !nextCandidate.isWorkspaceMarker) break; + candidates.push(nextCandidate.path); + foundWorkspaceMarker ||= nextCandidate.isWorkspaceMarker; + } + // filter out candidates that would push the root past a + // git boundary or into the home directory. + const homeDir = findHomeDir(); + const gitBoundary = findGitBoundary(cwd); + const acceptedCandidates = []; + let boundary; + for (const candidate of candidates){ + const dir = (0, _path.dirname)(candidate); + // the app's own directory is always a valid root. even if it + // is the home directory. + if (dir !== cwd) { + const resolvedDir = toRealPath(dir); + // `dir` sits above the repo or worktree that contains the app. + if (gitBoundary && isStrictAncestor(resolvedDir, gitBoundary.dir)) { + // add a warning for going beyond a repository + if (gitBoundary.type === 'repository') { + boundary = { + boundary: gitBoundary.dir, + marker: candidate, + root: dir, + type: 'repository' + }; + } + break; + } + // never treat the home directory (or above) as the root. + if (homeDir && isAncestorOrSelf(resolvedDir, homeDir)) { + boundary = { + boundary: homeDir, + marker: candidate, + root: dir, + type: 'home' + }; + break; + } + } + acceptedCandidates.push(candidate); + } + return { + lockFiles: acceptedCandidates.filter((candidate)=>LOCK_FILES.includes((0, _path.basename)(candidate))), + rootDir: acceptedCandidates.length ? (0, _path.dirname)(acceptedCandidates[acceptedCandidates.length - 1]) : cwd, + boundary + }; +} +function warnDuplicatedLockFiles(lockFiles) { + if (lockFiles.length <= 1) return; + const config = process.env.TURBOPACK ? 'turbopack.root' : 'outputFileTracingRoot'; + const docs = process.env.TURBOPACK ? 'https://nextjs.org/docs/app/api-reference/config/next-config-js/turbopack#root-directory' : 'https://nextjs.org/docs/app/api-reference/config/next-config-js/output#caveats'; + const rootLockFile = lockFiles[lockFiles.length - 1]; + const additionalLockFiles = lockFiles.slice(0, -1).map((str)=>`\n * ${str}`).join(''); + _log.warnOnce(`Warning: Next.js inferred your workspace root, but it may not be correct.\n` + ` We detected multiple lockfiles and selected the directory of ${rootLockFile} as the root directory.\n` + ` To silence this warning, set \`${config}\` in your Next.js config, or consider ` + `removing one of the lockfiles if it's not needed.\n` + ` See ${docs} for more information.\n` + ` Detected additional lockfiles: ${additionalLockFiles}\n`); +} +function warnRootBoundary({ boundary, marker, root, type }) { + const config = process.env.TURBOPACK ? 'turbopack.root' : 'outputFileTracingRoot'; + const reason = type === 'repository' ? `it is outside the current Git repository (${boundary})` : `it would include your home directory (${boundary})`; + _log.warnOnce(`Warning: Next.js ignored ${(0, _path.basename)(marker)} in ${root} because ${reason}.\n` + ` To use this directory, set \`${config}\` in your Next.js config.\n`); +} + +//# sourceMappingURL=find-root.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/find-root.js.map b/e-commerce/node_modules/next/dist/lib/find-root.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c560e792b7538c72798d42cbf4bd83c002d748b7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/find-root.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/find-root.ts"],"sourcesContent":["import { basename, dirname, isAbsolute, join, relative, resolve } from 'path'\nimport { existsSync, readFileSync, realpathSync, statSync } from 'fs'\nimport { homedir } from 'os'\nimport findUp from 'next/dist/compiled/find-up'\nimport * as Log from '../build/output/log'\n\nexport type RootBoundary = {\n boundary: string\n marker: string\n root: string\n type: 'repository' | 'home'\n}\n\n// folders that are git checkouts / git worktrees are a good indicator\n// of the folder that someone's project is contained in.\ntype GitBoundary =\n | { type: 'repository'; dir: string }\n | { type: 'worktree'; dir: string }\n\nfunction toRealPath(path: string): string {\n try {\n return realpathSync.native(path)\n } catch {\n return path\n }\n}\n\n// `homedir()` throws when it cannot determine a home directory, and returns an\n// empty string on some platforms. an empty value would match every directory,\n// so treat both as \"no home directory\".\nfunction findHomeDir(): string | undefined {\n try {\n return toRealPath(homedir()) || undefined\n } catch {\n return undefined\n }\n}\n\n// if `descendant` is inside of `ancestor` or `descendant` == `ancestor`\nfunction isAncestorOrSelf(ancestor: string, descendant: string): boolean {\n const rel = relative(ancestor, descendant)\n return rel === '' || (!rel.startsWith('..') && !isAbsolute(rel))\n}\n\n// if `descendant` is inside of `ancestor`\nfunction isStrictAncestor(ancestor: string, descendant: string): boolean {\n const rel = relative(ancestor, descendant)\n return rel !== '' && !rel.startsWith('..') && !isAbsolute(rel)\n}\n\n// true for a git worktree (its git dir has a `commondir` file);\n// this method returns false for a submodule.\nfunction isGitWorktree(dir: string, gitFile: string): boolean {\n let contents: string\n try {\n contents = readFileSync(gitFile, 'utf8')\n } catch {\n return false\n }\n\n // Match the behavior in git:\n // https://github.com/git/git/blob/13c7afec212fc97ce257d15601659314c6673d6c/setup.c#L1007-L1018\n const match = /^gitdir: (.+?)[\\r\\n]*$/s.exec(contents)\n if (!match) return false\n\n const gitDir = resolve(dir, match[1])\n return existsSync(join(gitDir, 'commondir'))\n}\n\n// finds the first git repository or git worktree above the\n// current working directory. we limit the project root to\n// inside a worktree or git repository. this is because if\n// you use worktrees, you may have lock files from the\n// parent git repo that are in folders that are not relevant\n// to watch.\nfunction findGitBoundary(cwd: string): GitBoundary | undefined {\n let isWorktree = false\n const gitDir = findUp.sync(\n (dir) => {\n const candidate = join(dir, '.git')\n const isDirectory = statSync(candidate, {\n throwIfNoEntry: false,\n })?.isDirectory()\n\n isWorktree = !isDirectory && isGitWorktree(dir, candidate)\n return isDirectory || isWorktree ? dir : undefined\n },\n { cwd, type: 'directory' }\n )\n if (!gitDir) return undefined\n\n return {\n type: isWorktree ? 'worktree' : 'repository',\n dir: toRealPath(gitDir),\n }\n}\n\nconst LOCK_FILES = [\n 'pnpm-lock.yaml',\n 'package-lock.json',\n 'yarn.lock',\n 'bun.lock',\n 'bun.lockb',\n]\n\n// Dedicated workspace-root files. pnpm and Lerna declare the root this way.\nconst WORKSPACE_MARKERS = ['pnpm-workspace.yaml', 'lerna.json']\n\n// npm, Yarn, and Bun declare the root via a package.json `workspaces` field,\n// which may be an array or an object (e.g. Yarn's `{ packages: [...] }`).\nfunction hasWorkspacesField(packageJson: string): boolean {\n try {\n return JSON.parse(readFileSync(packageJson, 'utf8')).workspaces != null\n } catch {\n return false\n }\n}\n\nfunction findWorkspaceMarker(directory: string): string | undefined {\n for (const name of WORKSPACE_MARKERS) {\n const markerPath = join(directory, name)\n if (existsSync(markerPath)) {\n return markerPath\n }\n }\n\n const packageJson = join(directory, 'package.json')\n return hasWorkspacesField(packageJson) ? packageJson : undefined\n}\n\ntype RootCandidate = { path: string; isWorkspaceMarker: boolean }\n\nfunction findNextRootCandidate(cwd: string): RootCandidate | undefined {\n // a workspace marker takes precedence over lockfiles, which can be included in\n // the application directory by accident.\n const marker = findUp.sync(findWorkspaceMarker, { cwd })\n if (marker) {\n return { path: marker, isWorkspaceMarker: true }\n }\n\n const lockFile = findUp.sync(LOCK_FILES, { cwd })\n return lockFile ? { path: lockFile, isWorkspaceMarker: false } : undefined\n}\n\nexport function findRootDirAndLockFiles(cwd: string): {\n lockFiles: string[]\n rootDir: string\n boundary?: RootBoundary\n} {\n const initialCandidate = findNextRootCandidate(cwd)\n if (!initialCandidate)\n return {\n lockFiles: [],\n rootDir: cwd,\n }\n\n const candidates = [initialCandidate.path]\n let foundWorkspaceMarker = initialCandidate.isWorkspaceMarker\n while (true) {\n const lastCandidate = candidates[candidates.length - 1]\n const currentDir = dirname(lastCandidate)\n const parentDir = dirname(currentDir)\n\n // dirname('/')==='/' so if we happen to reach the FS root (as might happen in a container we need to quit to avoid looping forever\n if (parentDir === currentDir) break\n\n const nextCandidate = findNextRootCandidate(parentDir)\n\n if (!nextCandidate) break\n\n // findNextRootCandidate searches for markers all the way up, so a non-marker\n // here means there is no higher marker: nothing above can extend the root.\n if (foundWorkspaceMarker && !nextCandidate.isWorkspaceMarker) break\n\n candidates.push(nextCandidate.path)\n foundWorkspaceMarker ||= nextCandidate.isWorkspaceMarker\n }\n\n // filter out candidates that would push the root past a\n // git boundary or into the home directory.\n const homeDir = findHomeDir()\n const gitBoundary = findGitBoundary(cwd)\n\n const acceptedCandidates: string[] = []\n let boundary: RootBoundary | undefined\n\n for (const candidate of candidates) {\n const dir = dirname(candidate)\n\n // the app's own directory is always a valid root. even if it\n // is the home directory.\n if (dir !== cwd) {\n const resolvedDir = toRealPath(dir)\n\n // `dir` sits above the repo or worktree that contains the app.\n if (gitBoundary && isStrictAncestor(resolvedDir, gitBoundary.dir)) {\n // add a warning for going beyond a repository\n if (gitBoundary.type === 'repository') {\n boundary = {\n boundary: gitBoundary.dir,\n marker: candidate,\n root: dir,\n type: 'repository',\n }\n }\n break\n }\n\n // never treat the home directory (or above) as the root.\n if (homeDir && isAncestorOrSelf(resolvedDir, homeDir)) {\n boundary = {\n boundary: homeDir,\n marker: candidate,\n root: dir,\n type: 'home',\n }\n break\n }\n }\n\n acceptedCandidates.push(candidate)\n }\n\n return {\n lockFiles: acceptedCandidates.filter((candidate) =>\n LOCK_FILES.includes(basename(candidate))\n ),\n rootDir: acceptedCandidates.length\n ? dirname(acceptedCandidates[acceptedCandidates.length - 1])\n : cwd,\n boundary,\n }\n}\n\nexport function warnDuplicatedLockFiles(lockFiles: string[]) {\n if (lockFiles.length <= 1) return\n\n const config = process.env.TURBOPACK\n ? 'turbopack.root'\n : 'outputFileTracingRoot'\n const docs = process.env.TURBOPACK\n ? 'https://nextjs.org/docs/app/api-reference/config/next-config-js/turbopack#root-directory'\n : 'https://nextjs.org/docs/app/api-reference/config/next-config-js/output#caveats'\n\n const rootLockFile = lockFiles[lockFiles.length - 1]\n const additionalLockFiles = lockFiles\n .slice(0, -1)\n .map((str) => `\\n * ${str}`)\n .join('')\n\n Log.warnOnce(\n `Warning: Next.js inferred your workspace root, but it may not be correct.\\n` +\n ` We detected multiple lockfiles and selected the directory of ${rootLockFile} as the root directory.\\n` +\n ` To silence this warning, set \\`${config}\\` in your Next.js config, or consider ` +\n `removing one of the lockfiles if it's not needed.\\n` +\n ` See ${docs} for more information.\\n` +\n ` Detected additional lockfiles: ${additionalLockFiles}\\n`\n )\n}\n\nexport function warnRootBoundary({\n boundary,\n marker,\n root,\n type,\n}: RootBoundary) {\n const config = process.env.TURBOPACK\n ? 'turbopack.root'\n : 'outputFileTracingRoot'\n const reason =\n type === 'repository'\n ? `it is outside the current Git repository (${boundary})`\n : `it would include your home directory (${boundary})`\n\n Log.warnOnce(\n `Warning: Next.js ignored ${basename(marker)} in ${root} because ${reason}.\\n` +\n ` To use this directory, set \\`${config}\\` in your Next.js config.\\n`\n )\n}\n"],"names":["findRootDirAndLockFiles","warnDuplicatedLockFiles","warnRootBoundary","toRealPath","path","realpathSync","native","findHomeDir","homedir","undefined","isAncestorOrSelf","ancestor","descendant","rel","relative","startsWith","isAbsolute","isStrictAncestor","isGitWorktree","dir","gitFile","contents","readFileSync","match","exec","gitDir","resolve","existsSync","join","findGitBoundary","cwd","isWorktree","findUp","sync","statSync","candidate","isDirectory","throwIfNoEntry","type","LOCK_FILES","WORKSPACE_MARKERS","hasWorkspacesField","packageJson","JSON","parse","workspaces","findWorkspaceMarker","directory","name","markerPath","findNextRootCandidate","marker","isWorkspaceMarker","lockFile","initialCandidate","lockFiles","rootDir","candidates","foundWorkspaceMarker","lastCandidate","length","currentDir","dirname","parentDir","nextCandidate","push","homeDir","gitBoundary","acceptedCandidates","boundary","resolvedDir","root","filter","includes","basename","config","process","env","TURBOPACK","docs","rootLockFile","additionalLockFiles","slice","map","str","Log","warnOnce","reason"],"mappings":";;;;;;;;;;;;;;;;IAgJgBA,uBAAuB;eAAvBA;;IA0FAC,uBAAuB;eAAvBA;;IA0BAC,gBAAgB;eAAhBA;;;sBApQuD;oBACN;oBACzC;+DACL;6DACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAerB,SAASC,WAAWC,IAAY;IAC9B,IAAI;QACF,OAAOC,gBAAY,CAACC,MAAM,CAACF;IAC7B,EAAE,OAAM;QACN,OAAOA;IACT;AACF;AAEA,+EAA+E;AAC/E,8EAA8E;AAC9E,wCAAwC;AACxC,SAASG;IACP,IAAI;QACF,OAAOJ,WAAWK,IAAAA,WAAO,QAAOC;IAClC,EAAE,OAAM;QACN,OAAOA;IACT;AACF;AAEA,wEAAwE;AACxE,SAASC,iBAAiBC,QAAgB,EAAEC,UAAkB;IAC5D,MAAMC,MAAMC,IAAAA,cAAQ,EAACH,UAAUC;IAC/B,OAAOC,QAAQ,MAAO,CAACA,IAAIE,UAAU,CAAC,SAAS,CAACC,IAAAA,gBAAU,EAACH;AAC7D;AAEA,0CAA0C;AAC1C,SAASI,iBAAiBN,QAAgB,EAAEC,UAAkB;IAC5D,MAAMC,MAAMC,IAAAA,cAAQ,EAACH,UAAUC;IA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,QAAQC,GAAG,CAACC,SAAS,GAChC,mBACA;IACJ,MAAMC,OAAOH,QAAQC,GAAG,CAACC,SAAS,GAC9B,6FACA;IAEJ,MAAME,eAAezB,SAAS,CAACA,UAAUK,MAAM,GAAG,EAAE;IACpD,MAAMqB,sBAAsB1B,UACzB2B,KAAK,CAAC,GAAG,CAAC,GACVC,GAAG,CAAC,CAACC,MAAQ,CAAC,OAAO,EAAEA,KAAK,EAC5BxD,IAAI,CAAC;IAERyD,KAAIC,QAAQ,CACV,CAAC,2EAA2E,CAAC,GAC3E,CAAC,8DAA8D,EAAEN,aAAa,yBAAyB,CAAC,GACxG,CAAC,gCAAgC,EAAEL,OAAO,uCAAuC,CAAC,GAClF,CAAC,mDAAmD,CAAC,GACrD,CAAC,OAAO,EAAEI,KAAK,wBAAwB,CAAC,GACxC,CAAC,gCAAgC,EAAEE,oBAAoB,EAAE,CAAC;AAEhE;AAEO,SAAS/E,iBAAiB,EAC/BmE,QAAQ,EACRlB,MAAM,EACNoB,IAAI,EACJjC,IAAI,EACS;IACb,MAAMqC,SAASC,QAAQC,GAAG,CAACC,SAAS,GAChC,mBACA;IACJ,MAAMS,SACJjD,SAAS,eACL,CAAC,0CAA0C,EAAE+B,SAAS,CAAC,CAAC,GACxD,CAAC,sCAAsC,EAAEA,SAAS,CAAC,CAAC;IAE1DgB,KAAIC,QAAQ,CACV,CAAC,yBAAyB,EAAEZ,IAAAA,cAAQ,EAACvB,QAAQ,IAAI,EAAEoB,KAAK,SAAS,EAAEgB,OAAO,GAAG,CAAC,GAC5E,CAAC,8BAA8B,EAAEZ,OAAO,4BAA4B,CAAC;AAE3E","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/format-cli-help-output.d.ts b/e-commerce/node_modules/next/dist/lib/format-cli-help-output.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dfc0e34fd3687303fcec0b372e976e2c852da9e5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/format-cli-help-output.d.ts @@ -0,0 +1,3 @@ +import type { Command, Help } from 'next/dist/compiled/commander'; +declare const formatCliHelpOutput: (cmd: Command, helper: Help) => string; +export { formatCliHelpOutput }; diff --git a/e-commerce/node_modules/next/dist/lib/format-cli-help-output.js b/e-commerce/node_modules/next/dist/lib/format-cli-help-output.js new file mode 100644 index 0000000000000000000000000000000000000000..d9ecfc2a18363e66ec798707fc328881dc6ba01f --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/format-cli-help-output.js @@ -0,0 +1,84 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "formatCliHelpOutput", { + enumerable: true, + get: function() { + return formatCliHelpOutput; + } +}); +const _picocolors = require("../lib/picocolors"); +// Copy-pasted from Commander's Help class -> formatHelp(). +// TL;DR, we're overriding the built-in help to add a few niceties. +// Link: https://github.com/tj/commander.js/blob/master/lib/help.js +const formatCliHelpOutput = (cmd, helper)=>{ + const termWidth = helper.padWidth(cmd, helper); + const helpWidth = helper.helpWidth || 80; + const itemIndentWidth = 2; + const itemSeparatorWidth = 2 // between term and description + ; + function formatItem(term, description) { + let value = term; + if (description) { + if (term === 'directory') { + value = `[${term}]`; + } + const fullText = `${value.padEnd(termWidth + itemSeparatorWidth)}${description}`; + return helper.wrap(fullText, helpWidth - itemIndentWidth, termWidth + itemSeparatorWidth); + } + return term; + } + function formatList(textArray) { + return textArray.join('\n').replace(/^/gm, ' '.repeat(itemIndentWidth)); + } + // Usage + let output = [ + `${(0, _picocolors.bold)('Usage:')} ${helper.commandUsage(cmd)}`, + '' + ]; + // Description + const commandDescription = helper.commandDescription(cmd); + if (commandDescription.length > 0) { + output = output.concat([ + helper.wrap(commandDescription, helpWidth, 0), + '' + ]); + } + // Arguments + const argumentList = helper.visibleArguments(cmd).map((argument)=>{ + return formatItem(helper.argumentTerm(argument), helper.argumentDescription(argument)); + }); + if (argumentList.length > 0) { + output = output.concat([ + `${(0, _picocolors.bold)('Arguments:')}`, + formatList(argumentList), + '' + ]); + } + // Options + const optionList = helper.visibleOptions(cmd).map((option)=>{ + return formatItem(helper.optionTerm(option), helper.optionDescription(option)); + }); + if (optionList.length > 0) { + output = output.concat([ + `${(0, _picocolors.bold)('Options:')}`, + formatList(optionList), + '' + ]); + } + // Commands + const commandList = helper.visibleCommands(cmd).map((subCmd)=>{ + return formatItem(helper.subcommandTerm(subCmd), helper.subcommandDescription(subCmd)); + }); + if (commandList.length > 0) { + output = output.concat([ + `${(0, _picocolors.bold)('Commands:')}`, + formatList(commandList), + '' + ]); + } + return output.join('\n'); +}; + +//# sourceMappingURL=format-cli-help-output.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/format-cli-help-output.js.map b/e-commerce/node_modules/next/dist/lib/format-cli-help-output.js.map new file mode 100644 index 0000000000000000000000000000000000000000..76287a52bfe31670d87e8a256cc870044be9e173 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/format-cli-help-output.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/format-cli-help-output.ts"],"sourcesContent":["import type { Command, Help } from 'next/dist/compiled/commander'\nimport { bold } from '../lib/picocolors'\n\n// Copy-pasted from Commander's Help class -> formatHelp().\n// TL;DR, we're overriding the built-in help to add a few niceties.\n// Link: https://github.com/tj/commander.js/blob/master/lib/help.js\nconst formatCliHelpOutput = (cmd: Command, helper: Help) => {\n const termWidth = helper.padWidth(cmd, helper)\n const helpWidth = helper.helpWidth || 80\n const itemIndentWidth = 2\n const itemSeparatorWidth = 2 // between term and description\n\n function formatItem(term: string, description: string) {\n let value = term\n\n if (description) {\n if (term === 'directory') {\n value = `[${term}]`\n }\n\n const fullText = `${value.padEnd(\n termWidth + itemSeparatorWidth\n )}${description}`\n\n return helper.wrap(\n fullText,\n helpWidth - itemIndentWidth,\n termWidth + itemSeparatorWidth\n )\n }\n\n return term\n }\n\n function formatList(textArray: string[]) {\n return textArray.join('\\n').replace(/^/gm, ' '.repeat(itemIndentWidth))\n }\n\n // Usage\n let output = [`${bold('Usage:')} ${helper.commandUsage(cmd)}`, '']\n\n // Description\n const commandDescription = helper.commandDescription(cmd)\n\n if (commandDescription.length > 0) {\n output = output.concat([helper.wrap(commandDescription, helpWidth, 0), ''])\n }\n\n // Arguments\n const argumentList = helper.visibleArguments(cmd).map((argument) => {\n return formatItem(\n helper.argumentTerm(argument),\n helper.argumentDescription(argument)\n )\n })\n\n if (argumentList.length > 0) {\n output = output.concat([\n `${bold('Arguments:')}`,\n formatList(argumentList),\n '',\n ])\n }\n\n // Options\n const optionList = helper.visibleOptions(cmd).map((option) => {\n return formatItem(\n helper.optionTerm(option),\n helper.optionDescription(option)\n )\n })\n\n if (optionList.length > 0) {\n output = output.concat([`${bold('Options:')}`, formatList(optionList), ''])\n }\n\n // Commands\n const commandList = helper.visibleCommands(cmd).map((subCmd) => {\n return formatItem(\n helper.subcommandTerm(subCmd),\n helper.subcommandDescription(subCmd)\n )\n })\n\n if (commandList.length > 0) {\n output = output.concat([\n `${bold('Commands:')}`,\n formatList(commandList),\n '',\n ])\n }\n\n return output.join('\\n')\n}\n\nexport { formatCliHelpOutput }\n"],"names":["formatCliHelpOutput","cmd","helper","termWidth","padWidth","helpWidth","itemIndentWidth","itemSeparatorWidth","formatItem","term","description","value","fullText","padEnd","wrap","formatList","textArray","join","replace","repeat","output","bold","commandUsage","commandDescription","length","concat","argumentList","visibleArguments","map","argument","argumentTerm","argumentDescription","optionList","visibleOptions","option","optionTerm","optionDescription","commandList","visibleCommands","subCmd","subcommandTerm","subcommandDescription"],"mappings":";;;;+BA+FSA;;;eAAAA;;;4BA9FY;AAErB,2DAA2D;AAC3D,mEAAmE;AACnE,mEAAmE;AACnE,MAAMA,sBAAsB,CAACC,KAAcC;IACzC,MAAMC,YAAYD,OAAOE,QAAQ,CAACH,KAAKC;IACvC,MAAMG,YAAYH,OAAOG,SAAS,IAAI;IACtC,MAAMC,kBAAkB;IACxB,MAAMC,qBAAqB,EAAE,+BAA+B;;IAE5D,SAASC,WA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AAG,GAAG;QACzBJ,SAASA,OAAOK,MAAM,CAAC;YAAC,GAAGJ,IAAAA,gBAAI,EAAC,aAAa;YAAEN,WAAWiB;YAAa;SAAG;IAC5E;IAEA,WAAW;IACX,MAAMK,cAAcnC,OAAOoC,eAAe,CAACrC,KAAK2B,GAAG,CAAC,CAACW;QACnD,OAAO/B,WACLN,OAAOsC,cAAc,CAACD,SACtBrC,OAAOuC,qBAAqB,CAACF;IAEjC;IAEA,IAAIF,YAAYb,MAAM,GAAG,GAAG;QAC1BJ,SAASA,OAAOK,MAAM,CAAC;YACrB,GAAGJ,IAAAA,gBAAI,EAAC,cAAc;YACtBN,WAAWsB;YACX;SACD;IACH;IAEA,OAAOjB,OAAOH,IAAI,CAAC;AACrB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/format-dynamic-import-path.d.ts b/e-commerce/node_modules/next/dist/lib/format-dynamic-import-path.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..03ab7c4a4cd6b83ba86242519f09be4cb6a92fd7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/format-dynamic-import-path.d.ts @@ -0,0 +1,17 @@ +/** + * Converts a cache handler path to a filesystem path. + * ESM's import.meta.resolve() returns file:// URLs which break when concatenated + * with .next/ or used with path.join/path.relative. + * @param filePath - Absolute path, relative path, or file:// URL (e.g. from import.meta.resolve) + * @returns A filesystem path suitable for path operations + */ +export declare function resolveCacheHandlerPathToFilesystem(filePath: string): string; +/** + * The path for a dynamic route must be URLs with a valid scheme. + * + * When an absolute Windows path is passed to it, it interprets the beginning of the path as a protocol (`C:`). + * Therefore, it is important to always construct a complete path. + * @param dir File directory + * @param filePath Absolute or relative path, or file:// URL (e.g. from import.meta.resolve) + */ +export declare const formatDynamicImportPath: (dir: string, filePath: string) => string; diff --git a/e-commerce/node_modules/next/dist/lib/format-dynamic-import-path.js b/e-commerce/node_modules/next/dist/lib/format-dynamic-import-path.js new file mode 100644 index 0000000000000000000000000000000000000000..bb175e51397d15f31c1f680ffb59bec83ca09978 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/format-dynamic-import-path.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + formatDynamicImportPath: null, + resolveCacheHandlerPathToFilesystem: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + formatDynamicImportPath: function() { + return formatDynamicImportPath; + }, + resolveCacheHandlerPathToFilesystem: function() { + return resolveCacheHandlerPathToFilesystem; + } +}); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +const _url = require("url"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function resolveCacheHandlerPathToFilesystem(filePath) { + if (filePath.startsWith('file://')) { + return (0, _url.fileURLToPath)(filePath); + } + return filePath; +} +const formatDynamicImportPath = (dir, filePath)=>{ + const resolvedFilePath = resolveCacheHandlerPathToFilesystem(filePath); + const absoluteFilePath = _path.default.isAbsolute(resolvedFilePath) ? resolvedFilePath : _path.default.join(dir, resolvedFilePath); + const formattedFilePath = (0, _url.pathToFileURL)(absoluteFilePath).toString(); + return formattedFilePath; +}; + +//# sourceMappingURL=format-dynamic-import-path.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/format-dynamic-import-path.js.map b/e-commerce/node_modules/next/dist/lib/format-dynamic-import-path.js.map new file mode 100644 index 0000000000000000000000000000000000000000..2bda4b359f1969a241bad14bca5d0f93d870017d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/format-dynamic-import-path.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/format-dynamic-import-path.ts"],"sourcesContent":["import path from 'path'\nimport { pathToFileURL, fileURLToPath } from 'url'\n\n/**\n * Converts a cache handler path to a filesystem path.\n * ESM's import.meta.resolve() returns file:// URLs which break when concatenated\n * with .next/ or used with path.join/path.relative.\n * @param filePath - Absolute path, relative path, or file:// URL (e.g. from import.meta.resolve)\n * @returns A filesystem path suitable for path operations\n */\nexport function resolveCacheHandlerPathToFilesystem(filePath: string): string {\n if (filePath.startsWith('file://')) {\n return fileURLToPath(filePath)\n }\n return filePath\n}\n\n/**\n * The path for a dynamic route must be URLs with a valid scheme.\n *\n * When an absolute Windows path is passed to it, it interprets the beginning of the path as a protocol (`C:`).\n * Therefore, it is important to always construct a complete path.\n * @param dir File directory\n * @param filePath Absolute or relative path, or file:// URL (e.g. from import.meta.resolve)\n */\nexport const formatDynamicImportPath = (dir: string, filePath: string) => {\n const resolvedFilePath = resolveCacheHandlerPathToFilesystem(filePath)\n\n const absoluteFilePath = path.isAbsolute(resolvedFilePath)\n ? resolvedFilePath\n : path.join(dir, resolvedFilePath)\n const formattedFilePath = pathToFileURL(absoluteFilePath).toString()\n\n return formattedFilePath\n}\n"],"names":["formatDynamicImportPath","resolveCacheHandlerPathToFilesystem","filePath","startsWith","fileURLToPath","dir","resolvedFilePath","absoluteFilePath","path","isAbsolute","join","formattedFilePath","pathToFileURL","toString"],"mappings":";;;;;;;;;;;;;;;IAyBaA,uBAAuB;eAAvBA;;IAfGC,mCAAmC;eAAnCA;;;6DAVC;qBAC4B;;;;;;AAStC,SAASA,oCAAoCC,QAAgB;IAClE,IAAIA,SAASC,UAAU,CAAC,YAAY;QAClC,OAAOC,IAAAA,kBAAa,EAACF;IACvB;IACA,OAAOA;AACT;AAUO,MAAMF,0BAA0B,CAACK,KAAaH;IACnD,MAAMI,mBAAmBL,oCAAoCC;IAE7D,MAAMK,mBAAmBC,aAAI,CAACC,UAAU,CAACH,oBACrCA,mBACAE,aAAI,CAACE,IAAI,CAACL,KAAKC;IACnB,MAAMK,oBAAoBC,IAAAA,kBAAa,EAACL,kBAAkBM,QAAQ;IAElE,OAAOF;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/format-server-error.d.ts b/e-commerce/node_modules/next/dist/lib/format-server-error.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e1c7764a2ce085f84aa1c1f926d53283b2eb4ede --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/format-server-error.d.ts @@ -0,0 +1,12 @@ +/** + * Input: + * Error: Something went wrong + at funcName (/path/to/file.js:10:5) + at anotherFunc (/path/to/file.js:15:10) + + * Output: + at funcName (/path/to/file.js:10:5) + at anotherFunc (/path/to/file.js:15:10) + */ +export declare function getStackWithoutErrorMessage(error: Error): string; +export declare function formatServerError(error: Error): void; diff --git a/e-commerce/node_modules/next/dist/lib/format-server-error.js b/e-commerce/node_modules/next/dist/lib/format-server-error.js new file mode 100644 index 0000000000000000000000000000000000000000..7e2c8e40abb6ecc9fc45eac1cbbd8016aad8d053 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/format-server-error.js @@ -0,0 +1,75 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + formatServerError: null, + getStackWithoutErrorMessage: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + formatServerError: function() { + return formatServerError; + }, + getStackWithoutErrorMessage: function() { + return getStackWithoutErrorMessage; + } +}); +const invalidServerComponentReactHooks = [ + 'useDeferredValue', + 'useEffect', + 'useEffectEvent', + 'useImperativeHandle', + 'useInsertionEffect', + 'useLayoutEffect', + 'useReducer', + 'useRef', + 'useState', + 'useSyncExternalStore', + 'useTransition', + 'experimental_useOptimistic', + 'useOptimistic' +]; +function setMessage(error, message) { + error.message = message; + if (error.stack) { + const lines = error.stack.split('\n'); + lines[0] = message; + error.stack = lines.join('\n'); + } +} +function getStackWithoutErrorMessage(error) { + const stack = error.stack; + if (!stack) return ''; + return stack.replace(/^[^\n]*\n/, ''); +} +function formatServerError(error) { + if (typeof (error == null ? void 0 : error.message) !== 'string') return; + if (error.message.includes('Class extends value undefined is not a constructor or null')) { + const addedMessage = 'This might be caused by a React Class Component being rendered in a Server Component, React Class Components only works in Client Components. Read more: https://nextjs.org/docs/messages/class-component-in-server-component'; + // If this error instance already has the message, don't add it again + if (error.message.includes(addedMessage)) return; + setMessage(error, `${error.message} + +${addedMessage}`); + return; + } + if (error.message.includes('createContext is not a function')) { + setMessage(error, 'createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/context-in-server-component'); + return; + } + for (const clientHook of invalidServerComponentReactHooks){ + const regex = new RegExp(`\\b${clientHook}\\b.*is not a function`); + if (regex.test(error.message)) { + setMessage(error, `${clientHook} only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/react-client-hook-in-server-component`); + return; + } + } +} + +//# sourceMappingURL=format-server-error.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/format-server-error.js.map b/e-commerce/node_modules/next/dist/lib/format-server-error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a61509d3635ae2a0c010b153896c9c48b75b97c0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/format-server-error.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/format-server-error.ts"],"sourcesContent":["const invalidServerComponentReactHooks = [\n 'useDeferredValue',\n 'useEffect',\n 'useEffectEvent',\n 'useImperativeHandle',\n 'useInsertionEffect',\n 'useLayoutEffect',\n 'useReducer',\n 'useRef',\n 'useState',\n 'useSyncExternalStore',\n 'useTransition',\n 'experimental_useOptimistic',\n 'useOptimistic',\n]\n\nfunction setMessage(error: Error, message: string): void {\n error.message = message\n if (error.stack) {\n const lines = error.stack.split('\\n')\n lines[0] = message\n error.stack = lines.join('\\n')\n }\n}\n\n/**\n * Input:\n * Error: Something went wrong\n at funcName (/path/to/file.js:10:5)\n at anotherFunc (/path/to/file.js:15:10)\n \n * Output:\n at funcName (/path/to/file.js:10:5)\n at anotherFunc (/path/to/file.js:15:10) \n */\nexport function getStackWithoutErrorMessage(error: Error): string {\n const stack = error.stack\n if (!stack) return ''\n return stack.replace(/^[^\\n]*\\n/, '')\n}\n\nexport function formatServerError(error: Error): void {\n if (typeof error?.message !== 'string') return\n\n if (\n error.message.includes(\n 'Class extends value undefined is not a constructor or null'\n )\n ) {\n const addedMessage =\n 'This might be caused by a React Class Component being rendered in a Server Component, React Class Components only works in Client Components. Read more: https://nextjs.org/docs/messages/class-component-in-server-component'\n\n // If this error instance already has the message, don't add it again\n if (error.message.includes(addedMessage)) return\n\n setMessage(\n error,\n `${error.message}\n\n${addedMessage}`\n )\n return\n }\n\n if (error.message.includes('createContext is not a function')) {\n setMessage(\n error,\n 'createContext only works in Client Components. Add the \"use client\" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/context-in-server-component'\n )\n return\n }\n\n for (const clientHook of invalidServerComponentReactHooks) {\n const regex = new RegExp(`\\\\b${clientHook}\\\\b.*is not a function`)\n if (regex.test(error.message)) {\n setMessage(\n error,\n `${clientHook} only works in Client Components. Add the \"use client\" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/react-client-hook-in-server-component`\n )\n return\n }\n }\n}\n"],"names":["formatServerError","getStackWithoutErrorMessage","invalidServerComponentReactHooks","setMessage","error","message","stack","lines","split","join","replace","includes","addedMessage","clientHook","regex","RegExp","test"],"mappings":";;;;;;;;;;;;;;;IAyCgBA,iBAAiB;eAAjBA;;IANAC,2BAA2B;eAA3BA;;;AAnChB,MAAMC,mCAAmC;IACvC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,SAASC,WAAWC,KAAY,EAAEC,OAAe;IAC/CD,MAAMC,OAAO,GAAGA;IAChB,IAAID,MAAME,KAAK,EAAE;QACf,MAAMC,QAAQH,MAAME,KAAK,CAACE,KAAK,CAAC;QAChCD,KAAK,CAAC,EAAE,GAAGF;QACXD,MAAME,KAAK,GAAGC,MAAME,IAAI,CAAC;IAC3B;AACF;AAYO,SAASR,4BAA4BG,KAAY;IACtD,MAAME,QAAQF,MAAME,KAAK;IACzB,IAAI,CAACA,OAAO,OAAO;IACnB,OAAOA,MAAMI,OAAO,CAAC,aAAa;AACpC;AAEO,SAASV,kBAAkBI,KAAY;IAC5C,IAAI,QAAOA,yBAAAA,MAAOC,OAAO,MAAK,UAAU;IAExC,IACED,MAAMC,OAAO,CAACM,QAAQ,CACpB,+DAEF;QACA,MAAMC,eACJ;QAEF,qEAAqE;QACrE,IAAIR,MAAMC,OAAO,CAACM,QAAQ,CAACC,eAAe;QAE1CT,WACEC,OACA,GAAGA,MAAMC,OAAO,CAAC;;AAEvB,EAAEO,cAAc;QAEZ;IACF;IAEA,IAAIR,MAAMC,OAAO,CAACM,QAAQ,CAAC,oCAAoC;QAC7DR,WACEC,OACA;QAEF;IACF;IAEA,KAAK,MAAMS,cAAcX,iCAAkC;QACzD,MAAMY,QAAQ,IAAIC,OAAO,CAAC,GAAG,EAAEF,WAAW,sBAAsB,CAAC;QACjE,IAAIC,MAAME,IAAI,CAACZ,MAAMC,OAAO,GAAG;YAC7BF,WACEC,OACA,GAAGS,WAAW,oLAAoL,CAAC;YAErM;QACF;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/framework/boundary-components.d.ts b/e-commerce/node_modules/next/dist/lib/framework/boundary-components.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c8848b00490ed36bee7a27204bc61a047c709577 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/framework/boundary-components.d.ts @@ -0,0 +1,13 @@ +import type { ReactNode } from 'react'; +export declare const MetadataBoundary: ({ children }: { + children: ReactNode; +}) => ReactNode; +export declare const ViewportBoundary: ({ children }: { + children: ReactNode; +}) => ReactNode; +export declare const OutletBoundary: ({ children }: { + children: ReactNode; +}) => ReactNode; +export declare const RootLayoutBoundary: ({ children, }: { + children: ReactNode; +}) => ReactNode; diff --git a/e-commerce/node_modules/next/dist/lib/framework/boundary-components.js b/e-commerce/node_modules/next/dist/lib/framework/boundary-components.js new file mode 100644 index 0000000000000000000000000000000000000000..c465a9652aee3342d5b54c7217e4d796b51d1fdc --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/framework/boundary-components.js @@ -0,0 +1,62 @@ +'use client'; +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + MetadataBoundary: null, + OutletBoundary: null, + RootLayoutBoundary: null, + ViewportBoundary: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + MetadataBoundary: function() { + return MetadataBoundary; + }, + OutletBoundary: function() { + return OutletBoundary; + }, + RootLayoutBoundary: function() { + return RootLayoutBoundary; + }, + ViewportBoundary: function() { + return ViewportBoundary; + } +}); +const _boundaryconstants = require("./boundary-constants"); +// We use a namespace object to allow us to recover the name of the function +// at runtime even when production bundling/minification is used. +const NameSpace = { + [_boundaryconstants.METADATA_BOUNDARY_NAME]: function({ children }) { + return children; + }, + [_boundaryconstants.VIEWPORT_BOUNDARY_NAME]: function({ children }) { + return children; + }, + [_boundaryconstants.OUTLET_BOUNDARY_NAME]: function({ children }) { + return children; + }, + [_boundaryconstants.ROOT_LAYOUT_BOUNDARY_NAME]: function({ children }) { + return children; + } +}; +const MetadataBoundary = // We use slice(0) to trick the bundler into not inlining/minifying the function +// so it retains the name inferred from the namespace object +NameSpace[_boundaryconstants.METADATA_BOUNDARY_NAME.slice(0)]; +const ViewportBoundary = // We use slice(0) to trick the bundler into not inlining/minifying the function +// so it retains the name inferred from the namespace object +NameSpace[_boundaryconstants.VIEWPORT_BOUNDARY_NAME.slice(0)]; +const OutletBoundary = // We use slice(0) to trick the bundler into not inlining/minifying the function +// so it retains the name inferred from the namespace object +NameSpace[_boundaryconstants.OUTLET_BOUNDARY_NAME.slice(0)]; +const RootLayoutBoundary = // We use slice(0) to trick the bundler into not inlining/minifying the function +// so it retains the name inferred from the namespace object +NameSpace[_boundaryconstants.ROOT_LAYOUT_BOUNDARY_NAME.slice(0)]; + +//# sourceMappingURL=boundary-components.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/framework/boundary-components.js.map b/e-commerce/node_modules/next/dist/lib/framework/boundary-components.js.map new file mode 100644 index 0000000000000000000000000000000000000000..8b3cefcf17adf4e1ec062d84684c2377280becd6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/framework/boundary-components.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/framework/boundary-components.tsx"],"sourcesContent":["'use client'\n\nimport type { ReactNode } from 'react'\nimport {\n METADATA_BOUNDARY_NAME,\n VIEWPORT_BOUNDARY_NAME,\n OUTLET_BOUNDARY_NAME,\n ROOT_LAYOUT_BOUNDARY_NAME,\n} from './boundary-constants'\n\n// We use a namespace object to allow us to recover the name of the function\n// at runtime even when production bundling/minification is used.\nconst NameSpace = {\n [METADATA_BOUNDARY_NAME]: function ({ children }: { children: ReactNode }) {\n return children\n },\n [VIEWPORT_BOUNDARY_NAME]: function ({ children }: { children: ReactNode }) {\n return children\n },\n [OUTLET_BOUNDARY_NAME]: function ({ children }: { children: ReactNode }) {\n return children\n },\n [ROOT_LAYOUT_BOUNDARY_NAME]: function ({\n children,\n }: {\n children: ReactNode\n }) {\n return children\n },\n}\n\nexport const MetadataBoundary =\n // We use slice(0) to trick the bundler into not inlining/minifying the function\n // so it retains the name inferred from the namespace object\n NameSpace[METADATA_BOUNDARY_NAME.slice(0) as typeof METADATA_BOUNDARY_NAME]\n\nexport const ViewportBoundary =\n // We use slice(0) to trick the bundler into not inlining/minifying the function\n // so it retains the name inferred from the namespace object\n NameSpace[VIEWPORT_BOUNDARY_NAME.slice(0) as typeof VIEWPORT_BOUNDARY_NAME]\n\nexport const OutletBoundary =\n // We use slice(0) to trick the bundler into not inlining/minifying the function\n // so it retains the name inferred from the namespace object\n NameSpace[OUTLET_BOUNDARY_NAME.slice(0) as typeof OUTLET_BOUNDARY_NAME]\n\nexport const RootLayoutBoundary =\n // We use slice(0) to trick the bundler into not inlining/minifying the function\n // so it retains the name inferred from the namespace object\n NameSpace[\n ROOT_LAYOUT_BOUNDARY_NAME.slice(0) as typeof ROOT_LAYOUT_BOUNDARY_NAME\n ]\n"],"names":["MetadataBoundary","OutletBoundary","RootLayoutBoundary","ViewportBoundary","NameSpace","METADATA_BOUNDARY_NAME","children","VIEWPORT_BOUNDARY_NAME","OUTLET_BOUNDARY_NAME","ROOT_LAYOUT_BOUNDARY_NAME","slice"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;IA+BaA,gBAAgB;eAAhBA;;IAUAC,cAAc;eAAdA;;IAKAC,kBAAkB;eAAlBA;;IAVAC,gBAAgB;eAAhBA;;;mCA5BN;AAEP,4EAA4E;AAC5E,iEAAiE;AACjE,MAAMC,YAAY;IAChB,CAACC,yCAAsB,CAAC,EAAE,SAAU,EAAEC,QAAQ,EAA2B;QACvE,OAAOA;IACT;IACA,CAACC,yCAAsB,CAAC,EAAE,SAAU,EAAED,QAAQ,EAA2B;QACvE,OAAOA;IACT;IACA,CAACE,uCAAoB,CAAC,EAAE,SAAU,EAAEF,QAAQ,EAA2B;QACrE,OAAOA;IACT;IACA,CAACG,4CAAyB,CAAC,EAAE,SAAU,EACrCH,QAAQ,EAGT;QACC,OAAOA;IACT;AACF;AAEO,MAAMN,mBACX,gFAAgF;AAChF,4DAA4D;AAC5DI,SAAS,CAACC,yCAAsB,CAACK,KAAK,CAAC,GAAoC;AAEtE,MAAMP,mBACX,gFAAgF;AAChF,4DAA4D;AAC5DC,SAAS,CAACG,yCAAsB,CAACG,KAAK,CAAC,GAAoC;AAEtE,MAAMT,iBACX,gFAAgF;AAChF,4DAA4D;AAC5DG,SAAS,CAACI,uCAAoB,CAACE,KAAK,CAAC,GAAkC;AAElE,MAAMR,qBACX,gFAAgF;AAChF,4DAA4D;AAC5DE,SAAS,CACPK,4CAAyB,CAACC,KAAK,CAAC,GACjC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/framework/boundary-constants.d.ts b/e-commerce/node_modules/next/dist/lib/framework/boundary-constants.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a7edffc1a7d1a388337a1e0f43680fd9dd6570c5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/framework/boundary-constants.d.ts @@ -0,0 +1,4 @@ +export declare const METADATA_BOUNDARY_NAME = "__next_metadata_boundary__"; +export declare const VIEWPORT_BOUNDARY_NAME = "__next_viewport_boundary__"; +export declare const OUTLET_BOUNDARY_NAME = "__next_outlet_boundary__"; +export declare const ROOT_LAYOUT_BOUNDARY_NAME = "__next_root_layout_boundary__"; diff --git a/e-commerce/node_modules/next/dist/lib/framework/boundary-constants.js b/e-commerce/node_modules/next/dist/lib/framework/boundary-constants.js new file mode 100644 index 0000000000000000000000000000000000000000..6e9680612ba42b7a96c4b2e98fae38a575192aed --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/framework/boundary-constants.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + METADATA_BOUNDARY_NAME: null, + OUTLET_BOUNDARY_NAME: null, + ROOT_LAYOUT_BOUNDARY_NAME: null, + VIEWPORT_BOUNDARY_NAME: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + METADATA_BOUNDARY_NAME: function() { + return METADATA_BOUNDARY_NAME; + }, + OUTLET_BOUNDARY_NAME: function() { + return OUTLET_BOUNDARY_NAME; + }, + ROOT_LAYOUT_BOUNDARY_NAME: function() { + return ROOT_LAYOUT_BOUNDARY_NAME; + }, + VIEWPORT_BOUNDARY_NAME: function() { + return VIEWPORT_BOUNDARY_NAME; + } +}); +const METADATA_BOUNDARY_NAME = '__next_metadata_boundary__'; +const VIEWPORT_BOUNDARY_NAME = '__next_viewport_boundary__'; +const OUTLET_BOUNDARY_NAME = '__next_outlet_boundary__'; +const ROOT_LAYOUT_BOUNDARY_NAME = '__next_root_layout_boundary__'; + +//# sourceMappingURL=boundary-constants.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/framework/boundary-constants.js.map b/e-commerce/node_modules/next/dist/lib/framework/boundary-constants.js.map new file mode 100644 index 0000000000000000000000000000000000000000..cd65cef441791a1eaf4815aa93ec4abf4191c235 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/framework/boundary-constants.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/framework/boundary-constants.tsx"],"sourcesContent":["export const METADATA_BOUNDARY_NAME = '__next_metadata_boundary__'\nexport const VIEWPORT_BOUNDARY_NAME = '__next_viewport_boundary__'\nexport const OUTLET_BOUNDARY_NAME = '__next_outlet_boundary__'\nexport const ROOT_LAYOUT_BOUNDARY_NAME = '__next_root_layout_boundary__'\n"],"names":["METADATA_BOUNDARY_NAME","OUTLET_BOUNDARY_NAME","ROOT_LAYOUT_BOUNDARY_NAME","VIEWPORT_BOUNDARY_NAME"],"mappings":";;;;;;;;;;;;;;;;;IAAaA,sBAAsB;eAAtBA;;IAEAC,oBAAoB;eAApBA;;IACAC,yBAAyB;eAAzBA;;IAFAC,sBAAsB;eAAtBA;;;AADN,MAAMH,yBAAyB;AAC/B,MAAMG,yBAAyB;AAC/B,MAAMF,uBAAuB;AAC7B,MAAMC,4BAA4B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/fs/rename.d.ts b/e-commerce/node_modules/next/dist/lib/fs/rename.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7a7bee436e6def2c5ec39e8ab7e1de0389fe4967 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/fs/rename.d.ts @@ -0,0 +1,6 @@ +/** + * A drop-in replacement for `fs.rename` that: + * - allows to move across multiple disks + * - attempts to retry the operation for certain error codes on Windows + */ +export declare function renameSync(source: string, target: string, windowsRetryTimeout?: number | false): void; diff --git a/e-commerce/node_modules/next/dist/lib/fs/rename.js b/e-commerce/node_modules/next/dist/lib/fs/rename.js new file mode 100644 index 0000000000000000000000000000000000000000..ba9f169898a5a02664df5c0a45a72ea2cf28ef73 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/fs/rename.js @@ -0,0 +1,87 @@ +/* +MIT License + +Copyright (c) 2015 - present Microsoft Corporation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + */ // This file is based on https://github.com/microsoft/vscode/blob/f860fcf11022f10a992440fd54c6e45674e39617/src/vs/base/node/pfs.ts +// See the LICENSE at the top of the file +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "renameSync", { + enumerable: true, + get: function() { + return renameSync; + } +}); +const _nodefs = require("node:fs"); +function renameSync(source, target, windowsRetryTimeout = 60000 /* matches graceful-fs */ ) { + if (source === target) { + return; // simulate node.js behaviour here and do a no-op if paths match + } + if (process.platform === 'win32' && typeof windowsRetryTimeout === 'number') { + // On Windows, a rename can fail when either source or target + // is locked by AV software. We do leverage graceful-fs to iron + // out these issues, however in case the target file exists, + // graceful-fs will immediately return without retry for fs.rename(). + renameSyncWithRetry(source, target, Date.now(), windowsRetryTimeout); + } else { + (0, _nodefs.renameSync)(source, target); + } +} +function renameSyncWithRetry(source, target, startTime, retryTimeout, attempt = 0) { + try { + return (0, _nodefs.renameSync)(source, target); + } catch (error) { + if (error.code !== 'EACCES' && error.code !== 'EPERM' && error.code !== 'EBUSY') { + throw error // only for errors we think are temporary + ; + } + if (Date.now() - startTime >= retryTimeout) { + console.error(`Node.js fs rename failed after ${attempt} retries with error: ${error}`); + throw error // give up after configurable timeout + ; + } + if (attempt > 100) { + console.error(`Node.js fs rename failed after ${attempt} retries with error ${error}`); + throw error; + } + if (attempt === 0) { + let abortRetry = false; + try { + const statTarget = (0, _nodefs.statSync)(target); + if (!statTarget.isFile()) { + abortRetry = true // if target is not a file, EPERM error may be raised and we should not attempt to retry + ; + } + } catch (e) { + // Ignore + } + if (abortRetry) { + throw error; + } + } + // Attempt again + return renameSyncWithRetry(source, target, startTime, retryTimeout, attempt + 1); + } +} + +//# sourceMappingURL=rename.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/fs/rename.js.map b/e-commerce/node_modules/next/dist/lib/fs/rename.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0721354451b0fb5b406b1f45ada8a84bc6c80c18 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/fs/rename.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/fs/rename.ts"],"sourcesContent":["/*\nMIT License\n\nCopyright (c) 2015 - present Microsoft Corporation\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n */\n\n// This file is based on https://github.com/microsoft/vscode/blob/f860fcf11022f10a992440fd54c6e45674e39617/src/vs/base/node/pfs.ts\n// See the LICENSE at the top of the file\n\nimport { renameSync as fsRenameSync, statSync } from 'node:fs'\n\n/**\n * A drop-in replacement for `fs.rename` that:\n * - allows to move across multiple disks\n * - attempts to retry the operation for certain error codes on Windows\n */\nexport function renameSync(\n source: string,\n target: string,\n windowsRetryTimeout: number | false = 60000 /* matches graceful-fs */\n): void {\n if (source === target) {\n return // simulate node.js behaviour here and do a no-op if paths match\n }\n\n if (process.platform === 'win32' && typeof windowsRetryTimeout === 'number') {\n // On Windows, a rename can fail when either source or target\n // is locked by AV software. We do leverage graceful-fs to iron\n // out these issues, however in case the target file exists,\n // graceful-fs will immediately return without retry for fs.rename().\n renameSyncWithRetry(source, target, Date.now(), windowsRetryTimeout)\n } else {\n fsRenameSync(source, target)\n }\n}\n\nfunction renameSyncWithRetry(\n source: string,\n target: string,\n startTime: number,\n retryTimeout: number,\n attempt = 0\n): void {\n try {\n return fsRenameSync(source, target)\n } catch (error: any) {\n if (\n error.code !== 'EACCES' &&\n error.code !== 'EPERM' &&\n error.code !== 'EBUSY'\n ) {\n throw error // only for errors we think are temporary\n }\n\n if (Date.now() - startTime >= retryTimeout) {\n console.error(\n `Node.js fs rename failed after ${attempt} retries with error: ${error}`\n )\n\n throw error // give up after configurable timeout\n }\n\n if (attempt > 100) {\n console.error(\n `Node.js fs rename failed after ${attempt} retries with error ${error}`\n )\n throw error\n }\n\n if (attempt === 0) {\n let abortRetry = false\n try {\n const statTarget = statSync(target)\n if (!statTarget.isFile()) {\n abortRetry = true // if target is not a file, EPERM error may be raised and we should not attempt to retry\n }\n } catch (e) {\n // Ignore\n }\n\n if (abortRetry) {\n throw error\n }\n }\n\n // Attempt again\n return renameSyncWithRetry(\n source,\n target,\n startTime,\n retryTimeout,\n attempt + 1\n )\n }\n}\n"],"names":["renameSync","source","target","windowsRetryTimeout","process","platform","renameSyncWithRetry","Date","now","fsRenameSync","startTime","retryTimeout","attempt","error","code","console","abortRetry","statTarget","statSync","isFile","e"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;CAsBC,GAED,kIAAkI;AAClI,yCAAyC;;;;;+BASzBA;;;eAAAA;;;wBAPqC;AAO9C,SAASA,WACdC,MAAc,EACdC,MAAc,EACdC,sBAAsC,MAAM,uBAAuB,GAAxB;IAE3C,IAAIF,WAAWC,QAAQ;QACrB,QAAO,gEAAgE;IACzE;IAEA,IAAIE,QAAQC,QAAQ,KAAK,WAAW,OAAOF,wBAAwB,UAAU;QAC3E,6DAA6D;QAC7D,+DAA+D;QAC/D,4DAA4D;QAC5D,qEAAqE;QACrEG,oBAAoBL,QAAQC,QAAQK,KAAKC,GAAG,IAAIL;IAClD,OAAO;QACLM,IAAAA,kBAAY,EAACR,QAAQC;IACvB;AACF;AAEA,SAASI,oBACPL,MAAc,EACdC,MAAc,EACdQ,SAAiB,EACjBC,YAAoB,EACpBC,UAAU,CAAC;IAEX,IAAI;QACF,OAAOH,IAAAA,kBAAY,EAACR,QAAQC;IAC9B,EAAE,OAAOW,OAAY;QACnB,IACEA,MAAMC,IAAI,KAAK,YACfD,MAAMC,IAAI,KAAK,WACfD,MAAMC,IAAI,KAAK,SACf;YACA,MAAMD,MAAM,yCAAyC;;QACvD;QAEA,IAAIN,KAAKC,GAAG,KAAKE,aAAaC,cAAc;YAC1CI,QAAQF,KAAK,CACX,CAAC,+BAA+B,EAAED,QAAQ,qBAAqB,EAAEC,OAAO;YAG1E,MAAMA,MAAM,qCAAqC;;QACnD;QAEA,IAAID,UAAU,KAAK;YACjBG,QAAQF,KAAK,CACX,CAAC,+BAA+B,EAAED,QAAQ,oBAAoB,EAAEC,OAAO;YAEzE,MAAMA;QACR;QAEA,IAAID,YAAY,GAAG;YACjB,IAAII,aAAa;YACjB,IAAI;gBACF,MAAMC,aAAaC,IAAAA,gBAAQ,EAAChB;gBAC5B,IAAI,CAACe,WAAWE,MAAM,IAAI;oBACxBH,aAAa,KAAK,wFAAwF;;gBAC5G;YACF,EAAE,OAAOI,GAAG;YACV,SAAS;YACX;YAEA,IAAIJ,YAAY;gBACd,MAAMH;YACR;QACF;QAEA,gBAAgB;QAChB,OAAOP,oBACLL,QACAC,QACAQ,WACAC,cACAC,UAAU;IAEd;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/fs/write-atomic.d.ts b/e-commerce/node_modules/next/dist/lib/fs/write-atomic.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ae4788bc5308f130549fd38906e8afa5c2a5f827 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/fs/write-atomic.d.ts @@ -0,0 +1 @@ +export declare function writeFileAtomic(filePath: string, content: string): void; diff --git a/e-commerce/node_modules/next/dist/lib/fs/write-atomic.js b/e-commerce/node_modules/next/dist/lib/fs/write-atomic.js new file mode 100644 index 0000000000000000000000000000000000000000..aa2469783a4f08c817312bb85956beebc8aa6116 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/fs/write-atomic.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "writeFileAtomic", { + enumerable: true, + get: function() { + return writeFileAtomic; + } +}); +const _fs = require("fs"); +const _rename = require("./rename"); +function writeFileAtomic(filePath, content) { + const tempPath = filePath + '.tmp.' + Math.random().toString(36).slice(2); + try { + (0, _fs.writeFileSync)(tempPath, content, 'utf-8'); + (0, _rename.renameSync)(tempPath, filePath); + } catch (e) { + try { + (0, _fs.unlinkSync)(tempPath); + } catch { + // ignore + } + throw e; + } +} + +//# sourceMappingURL=write-atomic.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/fs/write-atomic.js.map b/e-commerce/node_modules/next/dist/lib/fs/write-atomic.js.map new file mode 100644 index 0000000000000000000000000000000000000000..8ec4758a460202bab61bc86ca4a40c7fc8c52bdd --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/fs/write-atomic.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/fs/write-atomic.ts"],"sourcesContent":["import { unlinkSync, writeFileSync } from 'fs'\nimport { renameSync } from './rename'\n\nexport function writeFileAtomic(filePath: string, content: string): void {\n const tempPath = filePath + '.tmp.' + Math.random().toString(36).slice(2)\n try {\n writeFileSync(tempPath, content, 'utf-8')\n renameSync(tempPath, filePath)\n } catch (e) {\n try {\n unlinkSync(tempPath)\n } catch {\n // ignore\n }\n throw e\n }\n}\n"],"names":["writeFileAtomic","filePath","content","tempPath","Math","random","toString","slice","writeFileSync","renameSync","e","unlinkSync"],"mappings":";;;;+BAGgBA;;;eAAAA;;;oBAH0B;wBACf;AAEpB,SAASA,gBAAgBC,QAAgB,EAAEC,OAAe;IAC/D,MAAMC,WAAWF,WAAW,UAAUG,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,KAAK,CAAC;IACvE,IAAI;QACFC,IAAAA,iBAAa,EAACL,UAAUD,SAAS;QACjCO,IAAAA,kBAAU,EAACN,UAAUF;IACvB,EAAE,OAAOS,GAAG;QACV,IAAI;YACFC,IAAAA,cAAU,EAACR;QACb,EAAE,OAAM;QACN,SAAS;QACX;QACA,MAAMO;IACR;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/generate-interception-routes-rewrites.d.ts b/e-commerce/node_modules/next/dist/lib/generate-interception-routes-rewrites.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..10a78cf6a805aeae321af9d0d68488b2fa1a6efc --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/generate-interception-routes-rewrites.d.ts @@ -0,0 +1,2 @@ +import type { Rewrite } from './load-custom-routes'; +export declare function generateInterceptionRoutesRewrites(appPaths: string[], basePath?: string): Rewrite[]; diff --git a/e-commerce/node_modules/next/dist/lib/generate-interception-routes-rewrites.js b/e-commerce/node_modules/next/dist/lib/generate-interception-routes-rewrites.js new file mode 100644 index 0000000000000000000000000000000000000000..8e91148112ffcc371591f9fb20e83c574468f923 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/generate-interception-routes-rewrites.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "generateInterceptionRoutesRewrites", { + enumerable: true, + get: function() { + return generateInterceptionRoutesRewrites; + } +}); +const _approuterheaders = require("../client/components/app-router-headers"); +const _interceptionroutes = require("../shared/lib/router/utils/interception-routes"); +const _routeregex = require("../shared/lib/router/utils/route-regex"); +function generateInterceptionRoutesRewrites(appPaths, basePath = '') { + const rewrites = []; + for (const appPath of appPaths){ + if ((0, _interceptionroutes.isInterceptionRouteAppPath)(appPath)) { + const { interceptingRoute, interceptedRoute } = (0, _interceptionroutes.extractInterceptionRouteInformation)(appPath); + const destination = (0, _routeregex.getNamedRouteRegex)(basePath + appPath, { + prefixRouteKeys: true + }); + const header = (0, _routeregex.getNamedRouteRegex)(interceptingRoute, { + prefixRouteKeys: true, + reference: destination.reference + }); + const source = (0, _routeregex.getNamedRouteRegex)(basePath + interceptedRoute, { + prefixRouteKeys: true, + reference: header.reference + }); + const headerRegex = header.namedRegex// Strip ^ and $ anchors since matchHas() will add them automatically + .replace(/^\^/, '').replace(/\$$/, '')// Replace matching the `/` with matching any route segment. + .replace(/^\/\(\?:\/\)\?$/, '/.*')// Replace the optional trailing with slash capture group with one that + // will match any descendants. + .replace(/\(\?:\/\)\?$/, '(?:/.*)?'); + rewrites.push({ + source: source.pathToRegexpPattern, + destination: destination.pathToRegexpPattern, + has: [ + { + type: 'header', + key: _approuterheaders.NEXT_URL, + value: headerRegex + } + ], + regex: source.namedRegex + }); + } + } + return rewrites; +} + +//# sourceMappingURL=generate-interception-routes-rewrites.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/generate-interception-routes-rewrites.js.map b/e-commerce/node_modules/next/dist/lib/generate-interception-routes-rewrites.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ab31d11ea90e5dddaba64490886811650c8bc47e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/generate-interception-routes-rewrites.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/generate-interception-routes-rewrites.ts"],"sourcesContent":["import { NEXT_URL } from '../client/components/app-router-headers'\nimport {\n extractInterceptionRouteInformation,\n isInterceptionRouteAppPath,\n} from '../shared/lib/router/utils/interception-routes'\nimport type { Rewrite } from './load-custom-routes'\nimport { getNamedRouteRegex } from '../shared/lib/router/utils/route-regex'\n\nexport function generateInterceptionRoutesRewrites(\n appPaths: string[],\n basePath = ''\n): Rewrite[] {\n const rewrites: Rewrite[] = []\n\n for (const appPath of appPaths) {\n if (isInterceptionRouteAppPath(appPath)) {\n const { interceptingRoute, interceptedRoute } =\n extractInterceptionRouteInformation(appPath)\n\n const destination = getNamedRouteRegex(basePath + appPath, {\n prefixRouteKeys: true,\n })\n\n const header = getNamedRouteRegex(interceptingRoute, {\n prefixRouteKeys: true,\n reference: destination.reference,\n })\n\n const source = getNamedRouteRegex(basePath + interceptedRoute, {\n prefixRouteKeys: true,\n reference: header.reference,\n })\n\n const headerRegex = header.namedRegex\n // Strip ^ and $ anchors since matchHas() will add them automatically\n .replace(/^\\^/, '')\n .replace(/\\$$/, '')\n // Replace matching the `/` with matching any route segment.\n .replace(/^\\/\\(\\?:\\/\\)\\?$/, '/.*')\n // Replace the optional trailing with slash capture group with one that\n // will match any descendants.\n .replace(/\\(\\?:\\/\\)\\?$/, '(?:/.*)?')\n\n rewrites.push({\n source: source.pathToRegexpPattern,\n destination: destination.pathToRegexpPattern,\n has: [\n {\n type: 'header',\n key: NEXT_URL,\n value: headerRegex,\n },\n ],\n regex: source.namedRegex,\n })\n }\n }\n\n return rewrites\n}\n"],"names":["generateInterceptionRoutesRewrites","appPaths","basePath","rewrites","appPath","isInterceptionRouteAppPath","interceptingRoute","interceptedRoute","extractInterceptionRouteInformation","destination","getNamedRouteRegex","prefixRouteKeys","header","reference","source","headerRegex","namedRegex","replace","push","pathToRegexpPattern","has","type","key","NEXT_URL","value","regex"],"mappings":";;;;+BAQgBA;;;eAAAA;;;kCARS;oCAIlB;4BAE4B;AAE5B,SAASA,mCACdC,QAAkB,EAClBC,WAAW,EAAE;IAEb,MAAMC,WAAsB,EAAE;IAE9B,KAAK,MAAMC,WAAWH,SAAU;QAC9B,IAAII,IAAAA,8CAA0B,EAACD,UAAU;YACvC,MAAM,EAAEE,iBAAiB,EAAEC,gBAAgB,EAAE,GAC3CC,IAAAA,uDAAmC,EAACJ;YAEtC,MAAMK,cAAcC,IAAAA,8BAAkB,EAACR,WAAWE,SAAS;gBACzDO,iBAAiB;YACnB;YAEA,MAAMC,SAASF,IAAAA,8BAAkB,EAACJ,mBAAmB;gBACnDK,iBAAiB;gBACjBE,WAAWJ,YAAYI,SAAS;YAClC;YAEA,MAAMC,SAASJ,IAAAA,8BAAkB,EAACR,WAAWK,kBAAkB;gBAC7DI,iBAAiB;gBACjBE,WAAWD,OAAOC,SAAS;YAC7B;YAEA,MAAME,cAAcH,OAAOI,UAAU,AACnC,qEAAqE;aACpEC,OAAO,CAAC,OAAO,IACfA,OAAO,CAAC,OAAO,GAChB,4DAA4D;aAC3DA,OAAO,CAAC,mBAAmB,MAC5B,uEAAuE;YACvE,8BAA8B;aAC7BA,OAAO,CAAC,gBAAgB;YAE3Bd,SAASe,IAAI,CAAC;gBACZJ,QAAQA,OAAOK,mBAAmB;gBAClCV,aAAaA,YAAYU,mBAAmB;gBAC5CC,KAAK;oBACH;wBACEC,MAAM;wBACNC,KAAKC,0BAAQ;wBACbC,OAAOT;oBACT;iBACD;gBACDU,OAAOX,OAAOE,UAAU;YAC1B;QACF;IACF;IAEA,OAAOb;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/get-files-in-dir.d.ts b/e-commerce/node_modules/next/dist/lib/get-files-in-dir.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3229d1c7e5fbc954bf2342f1010e158b57990013 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/get-files-in-dir.d.ts @@ -0,0 +1 @@ +export declare function getFilesInDir(path: string): Promise<Set<string>>; diff --git a/e-commerce/node_modules/next/dist/lib/get-files-in-dir.js b/e-commerce/node_modules/next/dist/lib/get-files-in-dir.js new file mode 100644 index 0000000000000000000000000000000000000000..797bb24e6940c86858edf83dd7aa0f4da743c461 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/get-files-in-dir.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "getFilesInDir", { + enumerable: true, + get: function() { + return getFilesInDir; + } +}); +const _path = require("path"); +const _promises = /*#__PURE__*/ _interop_require_default(require("fs/promises")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +async function getFilesInDir(path) { + const dir = await _promises.default.opendir(path); + const results = new Set(); + for await (const file of dir){ + let resolvedFile = file; + if (file.isSymbolicLink()) { + resolvedFile = await _promises.default.stat((0, _path.join)(path, file.name)); + } + if (resolvedFile.isFile()) { + results.add(file.name); + } + } + return results; +} + +//# sourceMappingURL=get-files-in-dir.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/get-files-in-dir.js.map b/e-commerce/node_modules/next/dist/lib/get-files-in-dir.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ba85efad500de7836997db0bfa7d5f12e3c27ef6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/get-files-in-dir.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/get-files-in-dir.ts"],"sourcesContent":["import { join } from 'path'\nimport fs from 'fs/promises'\nimport type { Dirent, StatsBase } from 'fs'\n\nexport async function getFilesInDir(path: string): Promise<Set<string>> {\n const dir = await fs.opendir(path)\n const results = new Set<string>()\n\n for await (const file of dir) {\n let resolvedFile: Dirent | StatsBase<number> = file\n\n if (file.isSymbolicLink()) {\n resolvedFile = await fs.stat(join(path, file.name))\n }\n\n if (resolvedFile.isFile()) {\n results.add(file.name)\n }\n }\n\n return results\n}\n"],"names":["getFilesInDir","path","dir","fs","opendir","results","Set","file","resolvedFile","isSymbolicLink","stat","join","name","isFile","add"],"mappings":";;;;+BAIsBA;;;eAAAA;;;sBAJD;iEACN;;;;;;AAGR,eAAeA,cAAcC,IAAY;IAC9C,MAAMC,MAAM,MAAMC,iBAAE,CAACC,OAAO,CAACH;IAC7B,MAAMI,UAAU,IAAIC;IAEpB,WAAW,MAAMC,QAAQL,IAAK;QAC5B,IAAIM,eAA2CD;QAE/C,IAAIA,KAAKE,cAAc,IAAI;YACzBD,eAAe,MAAML,iBAAE,CAACO,IAAI,CAACC,IAAAA,UAAI,EAACV,MAAMM,KAAKK,IAAI;QACnD;QAEA,IAAIJ,aAAaK,MAAM,IAAI;YACzBR,QAAQS,GAAG,CAACP,KAAKK,IAAI;QACvB;IACF;IAEA,OAAOP;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/get-network-host.d.ts b/e-commerce/node_modules/next/dist/lib/get-network-host.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..32a7c88570a9020bd66e3a671d755be858c3889d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/get-network-host.d.ts @@ -0,0 +1 @@ +export declare function getNetworkHost(family: 'IPv4' | 'IPv6'): string | null; diff --git a/e-commerce/node_modules/next/dist/lib/get-network-host.js b/e-commerce/node_modules/next/dist/lib/get-network-host.js new file mode 100644 index 0000000000000000000000000000000000000000..091e2920492ac899df66e6d1ff30e6914d78530e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/get-network-host.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "getNetworkHost", { + enumerable: true, + get: function() { + return getNetworkHost; + } +}); +const _os = /*#__PURE__*/ _interop_require_default(require("os")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function getNetworkHosts(family) { + const interfaces = _os.default.networkInterfaces(); + const hosts = []; + Object.keys(interfaces).forEach((key)=>{ + var _interfaces_key; + (_interfaces_key = interfaces[key]) == null ? void 0 : _interfaces_key.filter((networkInterface)=>{ + switch(networkInterface.family){ + case 'IPv6': + return family === 'IPv6' && networkInterface.scopeid === 0 && networkInterface.address !== '::1'; + case 'IPv4': + return family === 'IPv4' && networkInterface.address !== '127.0.0.1'; + default: + return false; + } + }).forEach((networkInterface)=>{ + if (networkInterface.address) { + hosts.push(networkInterface.address); + } + }); + }); + return hosts; +} +function getNetworkHost(family) { + const hosts = getNetworkHosts(family); + return hosts[0] ?? null; +} + +//# sourceMappingURL=get-network-host.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/get-network-host.js.map b/e-commerce/node_modules/next/dist/lib/get-network-host.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d5a16e757a9d1b688c9015b60f89bcbdc2b59ba9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/get-network-host.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/get-network-host.ts"],"sourcesContent":["import os from 'os'\n\nfunction getNetworkHosts(family: 'IPv4' | 'IPv6'): string[] {\n const interfaces = os.networkInterfaces()\n const hosts: string[] = []\n\n Object.keys(interfaces).forEach((key) => {\n interfaces[key]\n ?.filter((networkInterface) => {\n switch (networkInterface.family) {\n case 'IPv6':\n return (\n family === 'IPv6' &&\n networkInterface.scopeid === 0 &&\n networkInterface.address !== '::1'\n )\n case 'IPv4':\n return family === 'IPv4' && networkInterface.address !== '127.0.0.1'\n default:\n return false\n }\n })\n .forEach((networkInterface) => {\n if (networkInterface.address) {\n hosts.push(networkInterface.address)\n }\n })\n })\n\n return hosts\n}\n\nexport function getNetworkHost(family: 'IPv4' | 'IPv6'): string | null {\n const hosts = getNetworkHosts(family)\n return hosts[0] ?? null\n}\n"],"names":["getNetworkHost","getNetworkHosts","family","interfaces","os","networkInterfaces","hosts","Object","keys","forEach","key","filter","networkInterface","scopeid","address","push"],"mappings":";;;;+BAgCgBA;;;eAAAA;;;2DAhCD;;;;;;AAEf,SAASC,gBAAgBC,MAAuB;IAC9C,MAAMC,aAAaC,WAAE,CAACC,iBAAiB;IACvC,MAAMC,QAAkB,EAAE;IAE1BC,OAAOC,IAAI,CAACL,YAAYM,OAAO,CAAC,CAACC;YAC/BP;SAAAA,kBAAAA,UAAU,CAACO,IAAI,qBAAfP,gBACIQ,MAAM,CAAC,CAACC;YACR,OAAQA,iBAAiBV,MAAM;gBAC7B,KAAK;oBACH,OACEA,WAAW,UACXU,iBAAiBC,OAAO,KAAK,KAC7BD,iBAAiBE,OAAO,KAAK;gBAEjC,KAAK;oBACH,OAAOZ,WAAW,UAAUU,iBAAiBE,OAAO,KAAK;gBAC3D;oBACE,OAAO;YACX;QACF,GACCL,OAAO,CAAC,CAACG;YACR,IAAIA,iBAAiBE,OAAO,EAAE;gBAC5BR,MAAMS,IAAI,CAACH,iBAAiBE,OAAO;YACrC;QACF;IACJ;IAEA,OAAOR;AACT;AAEO,SAASN,eAAeE,MAAuB;IACpD,MAAMI,QAAQL,gBAAgBC;IAC9B,OAAOI,KAAK,CAAC,EAAE,IAAI;AACrB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/get-package-version.d.ts b/e-commerce/node_modules/next/dist/lib/get-package-version.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2f5c61ab19f804fa592888dd226cfe4e7da07e63 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/get-package-version.d.ts @@ -0,0 +1,12 @@ +type PackageJsonDependencies = { + dependencies: Record<string, string>; + devDependencies: Record<string, string>; +}; +export declare function getDependencies({ cwd, }: { + cwd: string; +}): Promise<PackageJsonDependencies>; +export declare function getPackageVersion({ cwd, name, }: { + cwd: string; + name: string; +}): Promise<string | null>; +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/get-package-version.js b/e-commerce/node_modules/next/dist/lib/get-package-version.js new file mode 100644 index 0000000000000000000000000000000000000000..9cd1682849c9f45433042b9ffc47c2921dc929f7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/get-package-version.js @@ -0,0 +1,118 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + getDependencies: null, + getPackageVersion: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + getDependencies: function() { + return getDependencies; + }, + getPackageVersion: function() { + return getPackageVersion; + } +}); +const _fs = require("fs"); +const _findup = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/find-up")); +const _json5 = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/json5")); +const _path = /*#__PURE__*/ _interop_require_wildcard(require("path")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +let cachedDeps; +function getDependencies({ cwd }) { + if (cachedDeps) { + return cachedDeps; + } + return cachedDeps = (async ()=>{ + const configurationPath = await (0, _findup.default)('package.json', { + cwd + }); + if (!configurationPath) { + return { + dependencies: {}, + devDependencies: {} + }; + } + const content = await _fs.promises.readFile(configurationPath, 'utf-8'); + const packageJson = _json5.default.parse(content); + const { dependencies = {}, devDependencies = {} } = packageJson || {}; + return { + dependencies, + devDependencies + }; + })(); +} +async function getPackageVersion({ cwd, name }) { + const { dependencies, devDependencies } = await getDependencies({ + cwd + }); + if (!(dependencies[name] || devDependencies[name])) { + return null; + } + const cwd2 = cwd.endsWith(_path.posix.sep) || cwd.endsWith(_path.win32.sep) ? cwd : `${cwd}/`; + try { + const targetPath = require.resolve(`${name}/package.json`, { + paths: [ + cwd2 + ] + }); + const targetContent = await _fs.promises.readFile(targetPath, 'utf-8'); + return _json5.default.parse(targetContent).version ?? null; + } catch { + return null; + } +} + +//# sourceMappingURL=get-package-version.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/get-package-version.js.map b/e-commerce/node_modules/next/dist/lib/get-package-version.js.map new file mode 100644 index 0000000000000000000000000000000000000000..4b22bc16b3f689ea2e32581e1ea565325b01a55a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/get-package-version.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/get-package-version.ts"],"sourcesContent":["import { promises as fs } from 'fs'\nimport findUp from 'next/dist/compiled/find-up'\nimport JSON5 from 'next/dist/compiled/json5'\nimport * as path from 'path'\n\ntype PackageJsonDependencies = {\n dependencies: Record<string, string>\n devDependencies: Record<string, string>\n}\n\nlet cachedDeps: Promise<PackageJsonDependencies>\n\nexport function getDependencies({\n cwd,\n}: {\n cwd: string\n}): Promise<PackageJsonDependencies> {\n if (cachedDeps) {\n return cachedDeps\n }\n\n return (cachedDeps = (async () => {\n const configurationPath: string | undefined = await findUp('package.json', {\n cwd,\n })\n if (!configurationPath) {\n return { dependencies: {}, devDependencies: {} }\n }\n\n const content = await fs.readFile(configurationPath, 'utf-8')\n const packageJson: any = JSON5.parse(content)\n\n const { dependencies = {}, devDependencies = {} } = packageJson || {}\n return { dependencies, devDependencies }\n })())\n}\n\nexport async function getPackageVersion({\n cwd,\n name,\n}: {\n cwd: string\n name: string\n}): Promise<string | null> {\n const { dependencies, devDependencies } = await getDependencies({ cwd })\n if (!(dependencies[name] || devDependencies[name])) {\n return null\n }\n\n const cwd2 =\n cwd.endsWith(path.posix.sep) || cwd.endsWith(path.win32.sep)\n ? cwd\n : `${cwd}/`\n\n try {\n const targetPath = require.resolve(`${name}/package.json`, {\n paths: [cwd2],\n })\n const targetContent = await fs.readFile(targetPath, 'utf-8')\n return JSON5.parse(targetContent).version ?? null\n } catch {\n return null\n }\n}\n"],"names":["getDependencies","getPackageVersion","cachedDeps","cwd","configurationPath","findUp","dependencies","devDependencies","content","fs","readFile","packageJson","JSON5","parse","name","cwd2","endsWith","path","posix","sep","win32","targetPath","require","resolve","paths","targetContent","version"],"mappings":";;;;;;;;;;;;;;;IAYgBA,eAAe;eAAfA;;IAyBMC,iBAAiB;eAAjBA;;;oBArCS;+DACZ;8DACD;8DACI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOtB,IAAIC;AAEG,SAASF,gBAAgB,EAC9BG,GAAG,EAGJ;IACC,IAAID,YAAY;QACd,OAAOA;IACT;IAEA,OAAQA,aAAa,AAAC,CAAA;QACpB,MAAME,oBAAwC,MAAMC,IAAAA,eAAM,EAAC,gBAAgB;YACzEF;QACF;QACA,IAAI,CAACC,mBAAmB;YACtB,OAAO;gBAAEE,cAAc,CAAC;gBAAGC,iBAAiB,CAAC;YAAE;QACjD;QAEA,MAAMC,UAAU,MAAMC,YAAE,CAACC,QAAQ,CAACN,mBAAmB;QACrD,MAAMO,cAAmBC,cAAK,CAACC,KAAK,CAACL;QAErC,MAAM,EAAEF,eAAe,CAAC,CAAC,EAAEC,kBAAkB,CAAC,CAAC,EAAE,GAAGI,eAAe,CAAC;QACpE,OAAO;YAAEL;YAAcC;QAAgB;IACzC,CAAA;AACF;AAEO,eAAeN,kBAAkB,EACtCE,GAAG,EACHW,IAAI,EAIL;IACC,MAAM,EAAER,YAAY,EAAEC,eAAe,EAAE,GAAG,MAAMP,gBAAgB;QAAEG;IAAI;IACtE,IAAI,CAAEG,CAAAA,YAAY,CAACQ,KAAK,IAAIP,eAAe,CAACO,KAAK,AAAD,GAAI;QAClD,OAAO;IACT;IAEA,MAAMC,OACJZ,IAAIa,QAAQ,CAACC,MAAKC,KAAK,CAACC,GAAG,KAAKhB,IAAIa,QAAQ,CAACC,MAAKG,KAAK,CAACD,GAAG,IACvDhB,MACA,GAAGA,IAAI,CAAC,CAAC;IAEf,IAAI;QACF,MAAMkB,aAAaC,QAAQC,OAAO,CAAC,GAAGT,KAAK,aAAa,CAAC,EAAE;YACzDU,OAAO;gBAACT;aAAK;QACf;QACA,MAAMU,gBAAgB,MAAMhB,YAAE,CAACC,QAAQ,CAACW,YAAY;QACpD,OAAOT,cAAK,CAACC,KAAK,CAACY,eAAeC,OAAO,IAAI;IAC/C,EAAE,OAAM;QACN,OAAO;IACT;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/get-project-dir.d.ts b/e-commerce/node_modules/next/dist/lib/get-project-dir.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ce233da8d4d5bf0d6aae4fe76600339a220caf59 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/get-project-dir.d.ts @@ -0,0 +1 @@ +export declare function getProjectDir(dir?: string, exitOnEnoent?: boolean): string; diff --git a/e-commerce/node_modules/next/dist/lib/get-project-dir.js b/e-commerce/node_modules/next/dist/lib/get-project-dir.js new file mode 100644 index 0000000000000000000000000000000000000000..a2064c09cd142cedffe8e4b49f7a65658d701dc5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/get-project-dir.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "getProjectDir", { + enumerable: true, + get: function() { + return getProjectDir; + } +}); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +const _log = require("../build/output/log"); +const _detecttypo = require("./detect-typo"); +const _realpath = require("./realpath"); +const _utils = require("../server/lib/utils"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function getProjectDir(dir, exitOnEnoent = true) { + const resolvedDir = _path.default.resolve(dir || '.'); + try { + const realDir = (0, _realpath.realpathSync)(resolvedDir); + if (resolvedDir !== realDir && resolvedDir.toLowerCase() === realDir.toLowerCase()) { + (0, _log.warn)(`Invalid casing detected for project dir, received ${resolvedDir} actual path ${realDir}, see more info here https://nextjs.org/docs/messages/invalid-project-dir-casing`); + } + return realDir; + } catch (err) { + if (err.code === 'ENOENT' && exitOnEnoent) { + if (typeof dir === 'string') { + const detectedTypo = (0, _detecttypo.detectTypo)(dir, [ + 'build', + 'dev', + 'info', + 'lint', + 'start', + 'telemetry', + 'experimental-test' + ]); + if (detectedTypo) { + return (0, _utils.printAndExit)(`"next ${dir}" does not exist. Did you mean "next ${detectedTypo}"?`); + } + } + return (0, _utils.printAndExit)(`Invalid project directory provided, no such directory: ${resolvedDir}`); + } + throw err; + } +} + +//# sourceMappingURL=get-project-dir.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/get-project-dir.js.map b/e-commerce/node_modules/next/dist/lib/get-project-dir.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f3e20700f2d64077e7ab65aecaf3942da1478aaf --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/get-project-dir.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/get-project-dir.ts"],"sourcesContent":["import path from 'path'\nimport { warn } from '../build/output/log'\nimport { detectTypo } from './detect-typo'\nimport { realpathSync } from './realpath'\nimport { printAndExit } from '../server/lib/utils'\n\nexport function getProjectDir(dir?: string, exitOnEnoent = true) {\n const resolvedDir = path.resolve(dir || '.')\n try {\n const realDir = realpathSync(resolvedDir)\n\n if (\n resolvedDir !== realDir &&\n resolvedDir.toLowerCase() === realDir.toLowerCase()\n ) {\n warn(\n `Invalid casing detected for project dir, received ${resolvedDir} actual path ${realDir}, see more info here https://nextjs.org/docs/messages/invalid-project-dir-casing`\n )\n }\n\n return realDir\n } catch (err: any) {\n if (err.code === 'ENOENT' && exitOnEnoent) {\n if (typeof dir === 'string') {\n const detectedTypo = detectTypo(dir, [\n 'build',\n 'dev',\n 'info',\n 'lint',\n 'start',\n 'telemetry',\n 'experimental-test',\n ])\n\n if (detectedTypo) {\n return printAndExit(\n `\"next ${dir}\" does not exist. Did you mean \"next ${detectedTypo}\"?`\n )\n }\n }\n\n return printAndExit(\n `Invalid project directory provided, no such directory: ${resolvedDir}`\n )\n }\n throw err\n }\n}\n"],"names":["getProjectDir","dir","exitOnEnoent","resolvedDir","path","resolve","realDir","realpathSync","toLowerCase","warn","err","code","detectedTypo","detectTypo","printAndExit"],"mappings":";;;;+BAMgBA;;;eAAAA;;;6DANC;qBACI;4BACM;0BACE;uBACA;;;;;;AAEtB,SAASA,cAAcC,GAAY,EAAEC,eAAe,IAAI;IAC7D,MAAMC,cAAcC,aAAI,CAACC,OAAO,CAACJ,OAAO;IACxC,IAAI;QACF,MAAMK,UAAUC,IAAAA,sBAAY,EAACJ;QAE7B,IACEA,gBAAgBG,WAChBH,YAAYK,WAAW,OAAOF,QAAQE,WAAW,IACjD;YACAC,IAAAA,SAAI,EACF,CAAC,kDAAkD,EAAEN,YAAY,aAAa,EAAEG,QAAQ,gFAAgF,CAAC;QAE7K;QAEA,OAAOA;IACT,EAAE,OAAOI,KAAU;QACjB,IAAIA,IAAIC,IAAI,KAAK,YAAYT,cAAc;YACzC,IAAI,OAAOD,QAAQ,UAAU;gBAC3B,MAAMW,eAAeC,IAAAA,sBAAU,EAACZ,KAAK;oBACnC;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;iBACD;gBAED,IAAIW,cAAc;oBAChB,OAAOE,IAAAA,mBAAY,EACjB,CAAC,MAAM,EAAEb,IAAI,qCAAqC,EAAEW,aAAa,EAAE,CAAC;gBAExE;YACF;YAEA,OAAOE,IAAAA,mBAAY,EACjB,CAAC,uDAAuD,EAAEX,aAAa;QAE3E;QACA,MAAMO;IACR;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/git-worktree.d.ts b/e-commerce/node_modules/next/dist/lib/git-worktree.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..eb7673ee1d86f9045de1eb0dc54eb22330e2aa01 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/git-worktree.d.ts @@ -0,0 +1,7 @@ +export interface GitWorktreeInfo { + worktreeRoot: string; + mainRepoRoot: string; + isChild: boolean; +} +export declare function getGitWorktreeInfo(cwd: string): GitWorktreeInfo | undefined; +export declare function listLinkedWorktreeRoots(mainRepoRoot: string): string[]; diff --git a/e-commerce/node_modules/next/dist/lib/git-worktree.js b/e-commerce/node_modules/next/dist/lib/git-worktree.js new file mode 100644 index 0000000000000000000000000000000000000000..7e3d649745ba4f025802fc493f894576629e9ca2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/git-worktree.js @@ -0,0 +1,74 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + getGitWorktreeInfo: null, + listLinkedWorktreeRoots: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + getGitWorktreeInfo: function() { + return getGitWorktreeInfo; + }, + listLinkedWorktreeRoots: function() { + return listLinkedWorktreeRoots; + } +}); +const _fs = require("fs"); +const _path = require("path"); +const _findup = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/find-up")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function getGitProjectRoot(dotGitFile) { + try { + const gitWorktreePath = (0, _fs.readFileSync)(dotGitFile, 'utf8').match(/^gitdir:\s*(.+?)\s*$/m); + if (!gitWorktreePath) return undefined; + // The format here is <project>/.git/worktrees/<name> + // So we are trying to get to project directory + return (0, _path.dirname)((0, _path.dirname)((0, _path.dirname)((0, _path.resolve)(dotGitFile, gitWorktreePath[1])))); + } catch { + return undefined; + } +} +function getGitWorktreeInfo(cwd) { + const found = _findup.default.sync('.git', { + cwd, + type: 'file' + }); + if (!found) return undefined; + const projectRoot = getGitProjectRoot(found); + if (!projectRoot) return undefined; + return { + worktreeRoot: (0, _path.dirname)(found), + mainRepoRoot: projectRoot, + isChild: (0, _path.dirname)(found).startsWith(projectRoot) + }; +} +function listLinkedWorktreeRoots(mainRepoRoot) { + const worktreesDir = (0, _path.join)(mainRepoRoot, '.git', 'worktrees'); + let names; + try { + names = (0, _fs.readdirSync)(worktreesDir); + } catch { + return []; + } + const roots = []; + for (const name of names){ + try { + const gitdir = (0, _fs.readFileSync)((0, _path.join)(worktreesDir, name, 'gitdir'), 'utf8').trim(); + if (gitdir) roots.push((0, _path.dirname)(gitdir)); + } catch {} + } + return roots; +} + +//# sourceMappingURL=git-worktree.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/git-worktree.js.map b/e-commerce/node_modules/next/dist/lib/git-worktree.js.map new file mode 100644 index 0000000000000000000000000000000000000000..da7a9ffb1f15be6a5a03966e8ed8f48e061a2990 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/git-worktree.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/git-worktree.ts"],"sourcesContent":["import { readFileSync, readdirSync } from 'fs'\nimport { dirname, join, resolve } from 'path'\nimport findUp from 'next/dist/compiled/find-up'\n\nfunction getGitProjectRoot(dotGitFile: string): string | undefined {\n try {\n const gitWorktreePath = readFileSync(dotGitFile, 'utf8').match(\n /^gitdir:\\s*(.+?)\\s*$/m\n )\n if (!gitWorktreePath) return undefined\n // The format here is <project>/.git/worktrees/<name>\n // So we are trying to get to project directory\n return dirname(dirname(dirname(resolve(dotGitFile, gitWorktreePath[1]))))\n } catch {\n return undefined\n }\n}\n\nexport interface GitWorktreeInfo {\n worktreeRoot: string\n mainRepoRoot: string\n isChild: boolean\n}\n\nexport function getGitWorktreeInfo(cwd: string): GitWorktreeInfo | undefined {\n const found = findUp.sync('.git', { cwd, type: 'file' })\n if (!found) return undefined\n\n const projectRoot = getGitProjectRoot(found)\n if (!projectRoot) return undefined\n\n return {\n worktreeRoot: dirname(found),\n mainRepoRoot: projectRoot,\n isChild: dirname(found).startsWith(projectRoot),\n }\n}\n\nexport function listLinkedWorktreeRoots(mainRepoRoot: string): string[] {\n const worktreesDir = join(mainRepoRoot, '.git', 'worktrees')\n let names: string[]\n try {\n names = readdirSync(worktreesDir)\n } catch {\n return []\n }\n\n const roots: string[] = []\n for (const name of names) {\n try {\n const gitdir = readFileSync(\n join(worktreesDir, name, 'gitdir'),\n 'utf8'\n ).trim()\n if (gitdir) roots.push(dirname(gitdir))\n } catch {}\n }\n return roots\n}\n"],"names":["getGitWorktreeInfo","listLinkedWorktreeRoots","getGitProjectRoot","dotGitFile","gitWorktreePath","readFileSync","match","undefined","dirname","resolve","cwd","found","findUp","sync","type","projectRoot","worktreeRoot","mainRepoRoot","isChild","startsWith","worktreesDir","join","names","readdirSync","roots","name","gitdir","trim","push"],"mappings":";;;;;;;;;;;;;;;IAwBgBA,kBAAkB;eAAlBA;;IAcAC,uBAAuB;eAAvBA;;;oBAtC0B;sBACH;+DACpB;;;;;;AAEnB,SAASC,kBAAkBC,UAAkB;IAC3C,IAAI;QACF,MAAMC,kBAAkBC,IAAAA,gBAAY,EAACF,YAAY,QAAQG,KAAK,CAC5D;QAEF,IAAI,CAACF,iBAAiB,OAAOG;QAC7B,qDAAqD;QACrD,+CAA+C;QAC/C,OAAOC,IAAAA,aAAO,EAACA,IAAAA,aAAO,EAACA,IAAAA,aAAO,EAACC,IAAAA,aAAO,EAACN,YAAYC,eAAe,CAAC,EAAE;IACvE,EAAE,OAAM;QACN,OAAOG;IACT;AACF;AAQO,SAASP,mBAAmBU,GAAW;IAC5C,MAAMC,QAAQC,eAAM,CAACC,IAAI,CAAC,QAAQ;QAAEH;QAAKI,MAAM;IAAO;IACtD,IAAI,CAACH,OAAO,OAAOJ;IAEnB,MAAMQ,cAAcb,kBAAkBS;IACtC,IAAI,CAACI,aAAa,OAAOR;IAEzB,OAAO;QACLS,cAAcR,IAAAA,aAAO,EAACG;QACtBM,cAAcF;QACdG,SAASV,IAAAA,aAAO,EAACG,OAAOQ,UAAU,CAACJ;IACrC;AACF;AAEO,SAASd,wBAAwBgB,YAAoB;IAC1D,MAAMG,eAAeC,IAAAA,UAAI,EAACJ,cAAc,QAAQ;IAChD,IAAIK;IACJ,IAAI;QACFA,QAAQC,IAAAA,eAAW,EAACH;IACtB,EAAE,OAAM;QACN,OAAO,EAAE;IACX;IAEA,MAAMI,QAAkB,EAAE;IAC1B,KAAK,MAAMC,QAAQH,MAAO;QACxB,IAAI;YACF,MAAMI,SAASrB,IAAAA,gBAAY,EACzBgB,IAAAA,UAAI,EAACD,cAAcK,MAAM,WACzB,QACAE,IAAI;YACN,IAAID,QAAQF,MAAMI,IAAI,CAACpB,IAAAA,aAAO,EAACkB;QACjC,EAAE,OAAM,CAAC;IACX;IACA,OAAOF;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/has-necessary-dependencies.d.ts b/e-commerce/node_modules/next/dist/lib/has-necessary-dependencies.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b6425b87558194ec113ef6fb16dd691f169ae8c9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/has-necessary-dependencies.d.ts @@ -0,0 +1,28 @@ +export interface MissingDependency { + file: string; + /** + * The package's package.json (e.g. require(`${pkg}/package.json`)) MUST resolve. + * If `exportsRestrict` is false, `${file}` MUST also resolve. + */ + pkg: string; + /** Package specifier to install when it differs from pkg. */ + install?: string; + /** + * If true, the pkg's package.json needs to be resolvable. + * If true, will resolve `file` relative to the real path of the package.json. + * + * For example, `{ file: '@types/react/index.d.ts', pkg: '@types/react', exportsRestrict: true }` + * will try to resolve '@types/react/package.json' first and then assume `@types/react/index.d.ts` + * resolves to `path.join(dirname(resolvedPackageJsonPath), 'index.d.ts')`. + * + * If false, will resolve `file` relative to the baseDir. + * ForFor example, `{ file: '@types/react/index.d.ts', pkg: '@types/react', exportsRestrict: true }` + * will try to resolve `@types/react/index.d.ts` directly. + */ + exportsRestrict: boolean; +} +export type NecessaryDependencies = { + resolved: Map<string, string>; + missing: MissingDependency[]; +}; +export declare function hasNecessaryDependencies(baseDir: string, requiredPackages: MissingDependency[]): NecessaryDependencies; diff --git a/e-commerce/node_modules/next/dist/lib/has-necessary-dependencies.js b/e-commerce/node_modules/next/dist/lib/has-necessary-dependencies.js new file mode 100644 index 0000000000000000000000000000000000000000..6f4a69329eac24d45eb6184e4f09a89997556014 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/has-necessary-dependencies.js @@ -0,0 +1,49 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "hasNecessaryDependencies", { + enumerable: true, + get: function() { + return hasNecessaryDependencies; + } +}); +const _fs = require("fs"); +const _resolvefrom = require("./resolve-from"); +const _path = require("path"); +function hasNecessaryDependencies(baseDir, requiredPackages) { + let resolutions = new Map(); + const missingPackages = []; + for (const p of requiredPackages){ + try { + const pkgPath = (0, _fs.realpathSync)((0, _resolvefrom.resolveFrom)(baseDir, `${p.pkg}/package.json`)); + const pkgDir = (0, _path.dirname)(pkgPath); + resolutions.set((0, _path.join)(p.pkg, 'package.json'), pkgPath); + if (p.exportsRestrict) { + const fileNameToVerify = (0, _path.relative)(p.pkg, p.file); + if (fileNameToVerify) { + const fileToVerify = (0, _path.join)(pkgDir, fileNameToVerify); + if ((0, _fs.existsSync)(fileToVerify)) { + resolutions.set(p.pkg, fileToVerify); + } else { + missingPackages.push(p); + continue; + } + } else { + resolutions.set(p.pkg, pkgPath); + } + } else { + resolutions.set(p.pkg, (0, _resolvefrom.resolveFrom)(baseDir, p.file)); + } + } catch (_) { + missingPackages.push(p); + continue; + } + } + return { + resolved: resolutions, + missing: missingPackages + }; +} + +//# sourceMappingURL=has-necessary-dependencies.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/has-necessary-dependencies.js.map b/e-commerce/node_modules/next/dist/lib/has-necessary-dependencies.js.map new file mode 100644 index 0000000000000000000000000000000000000000..161812262991c117d6684d1c86003fa3ebf1ce42 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/has-necessary-dependencies.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/has-necessary-dependencies.ts"],"sourcesContent":["import { existsSync, realpathSync } from 'fs'\nimport { resolveFrom } from './resolve-from'\nimport { dirname, join, relative } from 'path'\n\nexport interface MissingDependency {\n file: string\n /**\n * The package's package.json (e.g. require(`${pkg}/package.json`)) MUST resolve.\n * If `exportsRestrict` is false, `${file}` MUST also resolve.\n */\n pkg: string\n /** Package specifier to install when it differs from pkg. */\n install?: string\n /**\n * If true, the pkg's package.json needs to be resolvable.\n * If true, will resolve `file` relative to the real path of the package.json.\n *\n * For example, `{ file: '@types/react/index.d.ts', pkg: '@types/react', exportsRestrict: true }`\n * will try to resolve '@types/react/package.json' first and then assume `@types/react/index.d.ts`\n * resolves to `path.join(dirname(resolvedPackageJsonPath), 'index.d.ts')`.\n *\n * If false, will resolve `file` relative to the baseDir.\n * ForFor example, `{ file: '@types/react/index.d.ts', pkg: '@types/react', exportsRestrict: true }`\n * will try to resolve `@types/react/index.d.ts` directly.\n */\n exportsRestrict: boolean\n}\n\nexport type NecessaryDependencies = {\n resolved: Map<string, string>\n missing: MissingDependency[]\n}\n\nexport function hasNecessaryDependencies(\n baseDir: string,\n requiredPackages: MissingDependency[]\n): NecessaryDependencies {\n let resolutions = new Map<string, string>()\n const missingPackages: MissingDependency[] = []\n\n for (const p of requiredPackages) {\n try {\n const pkgPath = realpathSync(\n resolveFrom(baseDir, `${p.pkg}/package.json`)\n )\n const pkgDir = dirname(pkgPath)\n\n resolutions.set(join(p.pkg, 'package.json'), pkgPath)\n\n if (p.exportsRestrict) {\n const fileNameToVerify = relative(p.pkg, p.file)\n if (fileNameToVerify) {\n const fileToVerify = join(pkgDir, fileNameToVerify)\n if (existsSync(fileToVerify)) {\n resolutions.set(p.pkg, fileToVerify)\n } else {\n missingPackages.push(p)\n continue\n }\n } else {\n resolutions.set(p.pkg, pkgPath)\n }\n } else {\n resolutions.set(p.pkg, resolveFrom(baseDir, p.file))\n }\n } catch (_) {\n missingPackages.push(p)\n continue\n }\n }\n\n return {\n resolved: resolutions,\n missing: missingPackages,\n }\n}\n"],"names":["hasNecessaryDependencies","baseDir","requiredPackages","resolutions","Map","missingPackages","p","pkgPath","realpathSync","resolveFrom","pkg","pkgDir","dirname","set","join","exportsRestrict","fileNameToVerify","relative","file","fileToVerify","existsSync","push","_","resolved","missing"],"mappings":";;;;+BAiCgBA;;;eAAAA;;;oBAjCyB;6BACb;sBACY;AA+BjC,SAASA,yBACdC,OAAe,EACfC,gBAAqC;IAErC,IAAIC,cAAc,IAAIC;IACtB,MAAMC,kBAAuC,EAAE;IAE/C,KAAK,MAAMC,KAAKJ,iBAAkB;QAChC,IAAI;YACF,MAAMK,UAAUC,IAAAA,gBAAY,EAC1BC,IAAAA,wBAAW,EAACR,SAAS,GAAGK,EAAEI,GAAG,CAAC,aAAa,CAAC;YAE9C,MAAMC,SAASC,IAAAA,aAAO,EAACL;YAEvBJ,YAAYU,GAAG,CAACC,IAAAA,UAAI,EAACR,EAAEI,GAAG,EAAE,iBAAiBH;YAE7C,IAAID,EAAES,eAAe,EAAE;gBACrB,MAAMC,mBAAmBC,IAAAA,cAAQ,EAACX,EAAEI,GAAG,EAAEJ,EAAEY,IAAI;gBAC/C,IAAIF,kBAAkB;oBACpB,MAAMG,eAAeL,IAAAA,UAAI,EAACH,QAAQK;oBAClC,IAAII,IAAAA,cAAU,EAACD,eAAe;wBAC5BhB,YAAYU,GAAG,CAACP,EAAEI,GAAG,EAAES;oBACzB,OAAO;wBACLd,gBAAgBgB,IAAI,CAACf;wBACrB;oBACF;gBACF,OAAO;oBACLH,YAAYU,GAAG,CAACP,EAAEI,GAAG,EAAEH;gBACzB;YACF,OAAO;gBACLJ,YAAYU,GAAG,CAACP,EAAEI,GAAG,EAAED,IAAAA,wBAAW,EAACR,SAASK,EAAEY,IAAI;YACpD;QACF,EAAE,OAAOI,GAAG;YACVjB,gBAAgBgB,IAAI,CAACf;YACrB;QACF;IACF;IAEA,OAAO;QACLiB,UAAUpB;QACVqB,SAASnB;IACX;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/helpers/get-cache-directory.d.ts b/e-commerce/node_modules/next/dist/lib/helpers/get-cache-directory.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..022370a6aa5da2fed048e45a0a5a45d89df8535c --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/get-cache-directory.d.ts @@ -0,0 +1 @@ +export declare function getCacheDirectory(fileDirectory: string, envPath?: string): string; diff --git a/e-commerce/node_modules/next/dist/lib/helpers/get-cache-directory.js b/e-commerce/node_modules/next/dist/lib/helpers/get-cache-directory.js new file mode 100644 index 0000000000000000000000000000000000000000..e9d33713c3887227bbcc8e2d7d1bd3fb4e83783a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/get-cache-directory.js @@ -0,0 +1,62 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "getCacheDirectory", { + enumerable: true, + get: function() { + return getCacheDirectory; + } +}); +const _os = /*#__PURE__*/ _interop_require_default(require("os")); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +const _fs = /*#__PURE__*/ _interop_require_default(require("fs")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function getCacheDirectory(fileDirectory, envPath) { + let result; + if (envPath) { + result = envPath; + } else { + let systemCacheDirectory; + if (process.platform === 'linux') { + systemCacheDirectory = process.env.XDG_CACHE_HOME || _path.default.join(_os.default.homedir(), '.cache'); + } else if (process.platform === 'darwin') { + systemCacheDirectory = _path.default.join(_os.default.homedir(), 'Library', 'Caches'); + } else if (process.platform === 'win32') { + systemCacheDirectory = process.env.LOCALAPPDATA || _path.default.join(_os.default.homedir(), 'AppData', 'Local'); + } else { + /// Attempt to use generic tmp location for un-handled platform + if (!systemCacheDirectory) { + for (const dir of [ + _path.default.join(_os.default.homedir(), '.cache'), + _path.default.join(_os.default.tmpdir()) + ]){ + if (_fs.default.existsSync(dir)) { + systemCacheDirectory = dir; + break; + } + } + } + if (!systemCacheDirectory) { + console.error(new Error('Unsupported platform: ' + process.platform)); + process.exit(0); + } + } + result = _path.default.join(systemCacheDirectory, fileDirectory); + } + if (!_path.default.isAbsolute(result)) { + // It is important to resolve to the absolute path: + // - for unzipping to work correctly; + // - so that registry directory matches between installation and execution. + // INIT_CWD points to the root of `npm/yarn install` and is probably what + // the user meant when typing the relative path. + result = _path.default.resolve(process.env['INIT_CWD'] || process.cwd(), result); + } + return result; +} + +//# sourceMappingURL=get-cache-directory.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/helpers/get-cache-directory.js.map b/e-commerce/node_modules/next/dist/lib/helpers/get-cache-directory.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c415b237858cd3b969c68a52d0046948d375bdda --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/get-cache-directory.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/helpers/get-cache-directory.ts"],"sourcesContent":["import os from 'os'\nimport path from 'path'\nimport fs from 'fs'\n\n// get platform specific cache directory adapted from playwright's handling\n// https://github.com/microsoft/playwright/blob/7d924470d397975a74a19184c136b3573a974e13/packages/playwright-core/src/utils/registry.ts#L141\nexport function getCacheDirectory(fileDirectory: string, envPath?: string) {\n let result\n\n if (envPath) {\n result = envPath\n } else {\n let systemCacheDirectory\n if (process.platform === 'linux') {\n systemCacheDirectory =\n process.env.XDG_CACHE_HOME || path.join(os.homedir(), '.cache')\n } else if (process.platform === 'darwin') {\n systemCacheDirectory = path.join(os.homedir(), 'Library', 'Caches')\n } else if (process.platform === 'win32') {\n systemCacheDirectory =\n process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local')\n } else {\n /// Attempt to use generic tmp location for un-handled platform\n if (!systemCacheDirectory) {\n for (const dir of [\n path.join(os.homedir(), '.cache'),\n path.join(os.tmpdir()),\n ]) {\n if (fs.existsSync(dir)) {\n systemCacheDirectory = dir\n break\n }\n }\n }\n\n if (!systemCacheDirectory) {\n console.error(new Error('Unsupported platform: ' + process.platform))\n process.exit(0)\n }\n }\n result = path.join(systemCacheDirectory, fileDirectory)\n }\n\n if (!path.isAbsolute(result)) {\n // It is important to resolve to the absolute path:\n // - for unzipping to work correctly;\n // - so that registry directory matches between installation and execution.\n // INIT_CWD points to the root of `npm/yarn install` and is probably what\n // the user meant when typing the relative path.\n result = path.resolve(process.env['INIT_CWD'] || process.cwd(), result)\n }\n return result\n}\n"],"names":["getCacheDirectory","fileDirectory","envPath","result","systemCacheDirectory","process","platform","env","XDG_CACHE_HOME","path","join","os","homedir","LOCALAPPDATA","dir","tmpdir","fs","existsSync","console","error","Error","exit","isAbsolute","resolve","cwd"],"mappings":";;;;+BAMgBA;;;eAAAA;;;2DAND;6DACE;2DACF;;;;;;AAIR,SAASA,kBAAkBC,aAAqB,EAAEC,OAAgB;IACvE,IAAIC;IAEJ,IAAID,SAAS;QACXC,SAASD;IACX,OAAO;QACL,IAAIE;QACJ,IAAIC,QAAQC,QAAQ,KAAK,SAAS;YAChCF,uBACEC,QAAQE,GAAG,CAACC,cAAc,IAAIC,aAAI,CAACC,IAAI,CAACC,WAAE,CAACC,OAAO,IAAI;QAC1D,OAAO,IAAIP,QAAQC,QAAQ,KAAK,UAAU;YACxCF,uBAAuBK,aAAI,CAACC,IAAI,CAACC,WAAE,CAACC,OAAO,IAAI,WAAW;QAC5D,OAAO,IAAIP,QAAQC,QAAQ,KAAK,SAAS;YACvCF,uBACEC,QAAQE,GAAG,CAACM,YAAY,IAAIJ,aAAI,CAACC,IAAI,CAACC,WAAE,CAACC,OAAO,IAAI,WAAW;QACnE,OAAO;YACL,+DAA+D;YAC/D,IAAI,CAACR,sBAAsB;gBACzB,KAAK,MAAMU,OAAO;oBAChBL,aAAI,CAACC,IAAI,CAACC,WAAE,CAACC,OAAO,IAAI;oBACxBH,aAAI,CAACC,IAAI,CAACC,WAAE,CAACI,MAAM;iBACpB,CAAE;oBACD,IAAIC,WAAE,CAACC,UAAU,CAACH,MAAM;wBACtBV,uBAAuBU;wBACvB;oBACF;gBACF;YACF;YAEA,IAAI,CAACV,sBAAsB;gBACzBc,QAAQC,KAAK,CAAC,IAAIC,MAAM,2BAA2Bf,QAAQC,QAAQ;gBACnED,QAAQgB,IAAI,CAAC;YACf;QACF;QACAlB,SAASM,aAAI,CAACC,IAAI,CAACN,sBAAsBH;IAC3C;IAEA,IAAI,CAACQ,aAAI,CAACa,UAAU,CAACnB,SAAS;QAC5B,mDAAmD;QACnD,uCAAuC;QACvC,6EAA6E;QAC7E,yEAAyE;QACzE,gDAAgD;QAChDA,SAASM,aAAI,CAACc,OAAO,CAAClB,QAAQE,GAAG,CAAC,WAAW,IAAIF,QAAQmB,GAAG,IAAIrB;IAClE;IACA,OAAOA;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/helpers/get-npx-command.d.ts b/e-commerce/node_modules/next/dist/lib/helpers/get-npx-command.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9998d1eb750c25e63d9606b9c250abf49994ba4b --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/get-npx-command.d.ts @@ -0,0 +1 @@ +export declare function getNpxCommand(baseDir: string): string; diff --git a/e-commerce/node_modules/next/dist/lib/helpers/get-npx-command.js b/e-commerce/node_modules/next/dist/lib/helpers/get-npx-command.js new file mode 100644 index 0000000000000000000000000000000000000000..2ca2303ced3dda1840a06dc18b82ee43832de08c --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/get-npx-command.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "getNpxCommand", { + enumerable: true, + get: function() { + return getNpxCommand; + } +}); +const _child_process = require("child_process"); +const _getpkgmanager = require("./get-pkg-manager"); +function getNpxCommand(baseDir) { + const pkgManager = (0, _getpkgmanager.getPkgManager)(baseDir); + let command = 'npx --yes'; + if (pkgManager === 'pnpm') { + command = 'pnpm --loglevel=error dlx'; + } else if (pkgManager === 'yarn') { + try { + (0, _child_process.execSync)('yarn dlx --help', { + stdio: 'ignore' + }); + command = 'yarn --quiet dlx'; + } catch {} + } + return command; +} + +//# sourceMappingURL=get-npx-command.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/helpers/get-npx-command.js.map b/e-commerce/node_modules/next/dist/lib/helpers/get-npx-command.js.map new file mode 100644 index 0000000000000000000000000000000000000000..860694b9c8928be451d4d95e21eeea566a6529c8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/get-npx-command.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/helpers/get-npx-command.ts"],"sourcesContent":["import { execSync } from 'child_process'\nimport { getPkgManager } from './get-pkg-manager'\n\nexport function getNpxCommand(baseDir: string) {\n const pkgManager = getPkgManager(baseDir)\n let command = 'npx --yes'\n if (pkgManager === 'pnpm') {\n command = 'pnpm --loglevel=error dlx'\n } else if (pkgManager === 'yarn') {\n try {\n execSync('yarn dlx --help', { stdio: 'ignore' })\n command = 'yarn --quiet dlx'\n } catch {}\n }\n\n return command\n}\n"],"names":["getNpxCommand","baseDir","pkgManager","getPkgManager","command","execSync","stdio"],"mappings":";;;;+BAGgBA;;;eAAAA;;;+BAHS;+BACK;AAEvB,SAASA,cAAcC,OAAe;IAC3C,MAAMC,aAAaC,IAAAA,4BAAa,EAACF;IACjC,IAAIG,UAAU;IACd,IAAIF,eAAe,QAAQ;QACzBE,UAAU;IACZ,OAAO,IAAIF,eAAe,QAAQ;QAChC,IAAI;YACFG,IAAAA,uBAAQ,EAAC,mBAAmB;gBAAEC,OAAO;YAAS;YAC9CF,UAAU;QACZ,EAAE,OAAM,CAAC;IACX;IAEA,OAAOA;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/helpers/get-online.d.ts b/e-commerce/node_modules/next/dist/lib/helpers/get-online.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a89c565747295f97fb9ddee499eade76013b721d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/get-online.d.ts @@ -0,0 +1 @@ +export declare function getOnline(): Promise<boolean>; diff --git a/e-commerce/node_modules/next/dist/lib/helpers/get-online.js b/e-commerce/node_modules/next/dist/lib/helpers/get-online.js new file mode 100644 index 0000000000000000000000000000000000000000..225ceb52a1ddb89843db226f11ed3b2285b6f081 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/get-online.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "getOnline", { + enumerable: true, + get: function() { + return getOnline; + } +}); +const _child_process = require("child_process"); +const _promises = /*#__PURE__*/ _interop_require_default(require("dns/promises")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function getProxy() { + if (process.env.https_proxy) { + return process.env.https_proxy; + } + try { + const httpsProxy = (0, _child_process.execSync)('npm config get https-proxy', { + encoding: 'utf8' + }).trim(); + return httpsProxy !== 'null' ? httpsProxy : undefined; + } catch (e) { + return; + } +} +async function getOnline() { + try { + await _promises.default.lookup('registry.yarnpkg.com'); + return true; + } catch { + const proxy = getProxy(); + if (!proxy) { + return false; + } + try { + const { hostname } = new URL(proxy); + await _promises.default.lookup(hostname); + return true; + } catch { + return false; + } + } +} + +//# sourceMappingURL=get-online.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/helpers/get-online.js.map b/e-commerce/node_modules/next/dist/lib/helpers/get-online.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d03a103e7eb412353faaae3eb4605e18c26d8f29 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/get-online.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/helpers/get-online.ts"],"sourcesContent":["import { execSync } from 'child_process'\nimport dns from 'dns/promises'\n\nfunction getProxy(): string | undefined {\n if (process.env.https_proxy) {\n return process.env.https_proxy\n }\n\n try {\n const httpsProxy = execSync('npm config get https-proxy', {\n encoding: 'utf8',\n }).trim()\n return httpsProxy !== 'null' ? httpsProxy : undefined\n } catch (e) {\n return\n }\n}\n\nexport async function getOnline(): Promise<boolean> {\n try {\n await dns.lookup('registry.yarnpkg.com')\n return true\n } catch {\n const proxy = getProxy()\n if (!proxy) {\n return false\n }\n\n try {\n const { hostname } = new URL(proxy)\n await dns.lookup(hostname)\n return true\n } catch {\n return false\n }\n }\n}\n"],"names":["getOnline","getProxy","process","env","https_proxy","httpsProxy","execSync","encoding","trim","undefined","e","dns","lookup","proxy","hostname","URL"],"mappings":";;;;+BAkBsBA;;;eAAAA;;;+BAlBG;iEACT;;;;;;AAEhB,SAASC;IACP,IAAIC,QAAQC,GAAG,CAACC,WAAW,EAAE;QAC3B,OAAOF,QAAQC,GAAG,CAACC,WAAW;IAChC;IAEA,IAAI;QACF,MAAMC,aAAaC,IAAAA,uBAAQ,EAAC,8BAA8B;YACxDC,UAAU;QACZ,GAAGC,IAAI;QACP,OAAOH,eAAe,SAASA,aAAaI;IAC9C,EAAE,OAAOC,GAAG;QACV;IACF;AACF;AAEO,eAAeV;IACpB,IAAI;QACF,MAAMW,iBAAG,CAACC,MAAM,CAAC;QACjB,OAAO;IACT,EAAE,OAAM;QACN,MAAMC,QAAQZ;QACd,IAAI,CAACY,OAAO;YACV,OAAO;QACT;QAEA,IAAI;YACF,MAAM,EAAEC,QAAQ,EAAE,GAAG,IAAIC,IAAIF;YAC7B,MAAMF,iBAAG,CAACC,MAAM,CAACE;YACjB,OAAO;QACT,EAAE,OAAM;YACN,OAAO;QACT;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/helpers/get-pkg-manager.d.ts b/e-commerce/node_modules/next/dist/lib/helpers/get-pkg-manager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..eb20b43db3317dd43624bfcb7396e144c16b7f95 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/get-pkg-manager.d.ts @@ -0,0 +1,2 @@ +export type PackageManager = 'npm' | 'pnpm' | 'yarn'; +export declare function getPkgManager(baseDir: string): PackageManager; diff --git a/e-commerce/node_modules/next/dist/lib/helpers/get-pkg-manager.js b/e-commerce/node_modules/next/dist/lib/helpers/get-pkg-manager.js new file mode 100644 index 0000000000000000000000000000000000000000..c63371273b6bf82a6d357f5fa13def79e0a6380f --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/get-pkg-manager.js @@ -0,0 +1,65 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "getPkgManager", { + enumerable: true, + get: function() { + return getPkgManager; + } +}); +const _fs = /*#__PURE__*/ _interop_require_default(require("fs")); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +const _child_process = require("child_process"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function getPkgManager(baseDir) { + try { + const userAgent = process.env.npm_config_user_agent; + if (userAgent) { + if (userAgent.startsWith('yarn')) { + return 'yarn'; + } else if (userAgent.startsWith('pnpm')) { + return 'pnpm'; + } else if (userAgent.startsWith('npm')) { + return 'npm'; + } + } + for (const { lockFile, packageManager } of [ + { + lockFile: 'yarn.lock', + packageManager: 'yarn' + }, + { + lockFile: 'pnpm-lock.yaml', + packageManager: 'pnpm' + }, + { + lockFile: 'package-lock.json', + packageManager: 'npm' + } + ]){ + if (_fs.default.existsSync(_path.default.join(baseDir, lockFile))) { + return packageManager; + } + } + try { + (0, _child_process.execSync)('yarn --version', { + stdio: 'ignore' + }); + return 'yarn'; + } catch { + (0, _child_process.execSync)('pnpm --version', { + stdio: 'ignore' + }); + return 'pnpm'; + } + } catch { + return 'npm'; + } +} + +//# sourceMappingURL=get-pkg-manager.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/helpers/get-pkg-manager.js.map b/e-commerce/node_modules/next/dist/lib/helpers/get-pkg-manager.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f67ed6568a67e422f107231526fd4fa537552cef --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/get-pkg-manager.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/helpers/get-pkg-manager.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport { execSync } from 'child_process'\n\nexport type PackageManager = 'npm' | 'pnpm' | 'yarn'\n\nexport function getPkgManager(baseDir: string): PackageManager {\n try {\n const userAgent = process.env.npm_config_user_agent\n if (userAgent) {\n if (userAgent.startsWith('yarn')) {\n return 'yarn'\n } else if (userAgent.startsWith('pnpm')) {\n return 'pnpm'\n } else if (userAgent.startsWith('npm')) {\n return 'npm'\n }\n }\n for (const { lockFile, packageManager } of [\n { lockFile: 'yarn.lock', packageManager: 'yarn' },\n { lockFile: 'pnpm-lock.yaml', packageManager: 'pnpm' },\n { lockFile: 'package-lock.json', packageManager: 'npm' },\n ]) {\n if (fs.existsSync(path.join(baseDir, lockFile))) {\n return packageManager as PackageManager\n }\n }\n try {\n execSync('yarn --version', { stdio: 'ignore' })\n return 'yarn'\n } catch {\n execSync('pnpm --version', { stdio: 'ignore' })\n return 'pnpm'\n }\n } catch {\n return 'npm'\n }\n}\n"],"names":["getPkgManager","baseDir","userAgent","process","env","npm_config_user_agent","startsWith","lockFile","packageManager","fs","existsSync","path","join","execSync","stdio"],"mappings":";;;;+BAMgBA;;;eAAAA;;;2DAND;6DACE;+BACQ;;;;;;AAIlB,SAASA,cAAcC,OAAe;IAC3C,IAAI;QACF,MAAMC,YAAYC,QAAQC,GAAG,CAACC,qBAAqB;QACnD,IAAIH,WAAW;YACb,IAAIA,UAAUI,UAAU,CAAC,SAAS;gBAChC,OAAO;YACT,OAAO,IAAIJ,UAAUI,UAAU,CAAC,SAAS;gBACvC,OAAO;YACT,OAAO,IAAIJ,UAAUI,UAAU,CAAC,QAAQ;gBACtC,OAAO;YACT;QACF;QACA,KAAK,MAAM,EAAEC,QAAQ,EAAEC,cAAc,EAAE,IAAI;YACzC;gBAAED,UAAU;gBAAaC,gBAAgB;YAAO;YAChD;gBAAED,UAAU;gBAAkBC,gBAAgB;YAAO;YACrD;gBAAED,UAAU;gBAAqBC,gBAAgB;YAAM;SACxD,CAAE;YACD,IAAIC,WAAE,CAACC,UAAU,CAACC,aAAI,CAACC,IAAI,CAACX,SAASM,YAAY;gBAC/C,OAAOC;YACT;QACF;QACA,IAAI;YACFK,IAAAA,uBAAQ,EAAC,kBAAkB;gBAAEC,OAAO;YAAS;YAC7C,OAAO;QACT,EAAE,OAAM;YACND,IAAAA,uBAAQ,EAAC,kBAAkB;gBAAEC,OAAO;YAAS;YAC7C,OAAO;QACT;IACF,EAAE,OAAM;QACN,OAAO;IACT;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/helpers/get-registry.d.ts b/e-commerce/node_modules/next/dist/lib/helpers/get-registry.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..04fe7548301a8a20beb3150ed132aeaefc380716 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/get-registry.d.ts @@ -0,0 +1,6 @@ +/** + * Returns the package registry using the user's package manager. + * The URL will have a trailing slash. + * @default https://registry.npmjs.org/ + */ +export declare function getRegistry(baseDir?: string): string; diff --git a/e-commerce/node_modules/next/dist/lib/helpers/get-registry.js b/e-commerce/node_modules/next/dist/lib/helpers/get-registry.js new file mode 100644 index 0000000000000000000000000000000000000000..1d793074fc7efda458c3eded4c4519572c151bb6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/get-registry.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "getRegistry", { + enumerable: true, + get: function() { + return getRegistry; + } +}); +const _child_process = require("child_process"); +const _getpkgmanager = require("./get-pkg-manager"); +const _utils = require("../../server/lib/utils"); +function getRegistry(baseDir = process.cwd()) { + const pkgManager = (0, _getpkgmanager.getPkgManager)(baseDir); + // Since `npm config` command fails in npm workspace to prevent workspace config conflicts, + // add `--no-workspaces` flag to run under the context of the root project only. + // Safe for non-workspace projects as it's equivalent to default `--workspaces=false`. + // x-ref: https://github.com/vercel/next.js/issues/47121#issuecomment-1499044345 + // x-ref: https://github.com/npm/statusboard/issues/371#issue-920669998 + const resolvedFlags = pkgManager === 'npm' ? '--no-workspaces' : ''; + let registry = `https://registry.npmjs.org/`; + try { + const output = (0, _child_process.execSync)(`${pkgManager} config get registry ${resolvedFlags}`, { + env: { + ...process.env, + NODE_OPTIONS: (0, _utils.getFormattedNodeOptionsWithoutInspect)() + } + }).toString().trim(); + if (output.startsWith('http')) { + registry = output.endsWith('/') ? output : `${output}/`; + } + } catch (err) { + throw new Error(`Failed to get registry from "${pkgManager}".`, { + cause: err + }); + } + return registry; +} + +//# sourceMappingURL=get-registry.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/helpers/get-registry.js.map b/e-commerce/node_modules/next/dist/lib/helpers/get-registry.js.map new file mode 100644 index 0000000000000000000000000000000000000000..9bb7d4c9756851a52923824df38e2e3548ad8210 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/get-registry.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/helpers/get-registry.ts"],"sourcesContent":["import { execSync } from 'child_process'\nimport { getPkgManager } from './get-pkg-manager'\nimport { getFormattedNodeOptionsWithoutInspect } from '../../server/lib/utils'\n\n/**\n * Returns the package registry using the user's package manager.\n * The URL will have a trailing slash.\n * @default https://registry.npmjs.org/\n */\nexport function getRegistry(baseDir: string = process.cwd()) {\n const pkgManager = getPkgManager(baseDir)\n // Since `npm config` command fails in npm workspace to prevent workspace config conflicts,\n // add `--no-workspaces` flag to run under the context of the root project only.\n // Safe for non-workspace projects as it's equivalent to default `--workspaces=false`.\n // x-ref: https://github.com/vercel/next.js/issues/47121#issuecomment-1499044345\n // x-ref: https://github.com/npm/statusboard/issues/371#issue-920669998\n const resolvedFlags = pkgManager === 'npm' ? '--no-workspaces' : ''\n let registry = `https://registry.npmjs.org/`\n\n try {\n const output = execSync(\n `${pkgManager} config get registry ${resolvedFlags}`,\n {\n env: {\n ...process.env,\n NODE_OPTIONS: getFormattedNodeOptionsWithoutInspect(),\n },\n }\n )\n .toString()\n .trim()\n\n if (output.startsWith('http')) {\n registry = output.endsWith('/') ? output : `${output}/`\n }\n } catch (err) {\n throw new Error(`Failed to get registry from \"${pkgManager}\".`, {\n cause: err,\n })\n }\n\n return registry\n}\n"],"names":["getRegistry","baseDir","process","cwd","pkgManager","getPkgManager","resolvedFlags","registry","output","execSync","env","NODE_OPTIONS","getFormattedNodeOptionsWithoutInspect","toString","trim","startsWith","endsWith","err","Error","cause"],"mappings":";;;;+BASgBA;;;eAAAA;;;+BATS;+BACK;uBACwB;AAO/C,SAASA,YAAYC,UAAkBC,QAAQC,GAAG,EAAE;IACzD,MAAMC,aAAaC,IAAAA,4BAAa,EAACJ;IACjC,2FAA2F;IAC3F,gFAAgF;IAChF,sFAAsF;IACtF,gFAAgF;IAChF,uEAAuE;IACvE,MAAMK,gBAAgBF,eAAe,QAAQ,oBAAoB;IACjE,IAAIG,WAAW,CAAC,2BAA2B,CAAC;IAE5C,IAAI;QACF,MAAMC,SAASC,IAAAA,uBAAQ,EACrB,GAAGL,WAAW,qBAAqB,EAAEE,eAAe,EACpD;YACEI,KAAK;gBACH,GAAGR,QAAQQ,GAAG;gBACdC,cAAcC,IAAAA,4CAAqC;YACrD;QACF,GAECC,QAAQ,GACRC,IAAI;QAEP,IAAIN,OAAOO,UAAU,CAAC,SAAS;YAC7BR,WAAWC,OAAOQ,QAAQ,CAAC,OAAOR,SAAS,GAAGA,OAAO,CAAC,CAAC;QACzD;IACF,EAAE,OAAOS,KAAK;QACZ,MAAM,IAAIC,MAAM,CAAC,6BAA6B,EAAEd,WAAW,EAAE,CAAC,EAAE;YAC9De,OAAOF;QACT;IACF;IAEA,OAAOV;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/helpers/get-reserved-port.d.ts b/e-commerce/node_modules/next/dist/lib/helpers/get-reserved-port.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e21b2feff7eac0d801ea8d1cdad92e81ea574482 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/get-reserved-port.d.ts @@ -0,0 +1,87 @@ +/** https://fetch.spec.whatwg.org/#port-blocking */ +export declare const KNOWN_RESERVED_PORTS: { + readonly 1: "tcpmux"; + readonly 7: "echo"; + readonly 9: "discard"; + readonly 11: "systat"; + readonly 13: "daytime"; + readonly 15: "netstat"; + readonly 17: "qotd"; + readonly 19: "chargen"; + readonly 20: "ftp-data"; + readonly 21: "ftp"; + readonly 22: "ssh"; + readonly 23: "telnet"; + readonly 25: "smtp"; + readonly 37: "time"; + readonly 42: "name"; + readonly 43: "nicname"; + readonly 53: "domain"; + readonly 69: "tftp"; + readonly 77: "rje"; + readonly 79: "finger"; + readonly 87: "link"; + readonly 95: "supdup"; + readonly 101: "hostname"; + readonly 102: "iso-tsap"; + readonly 103: "gppitnp"; + readonly 104: "acr-nema"; + readonly 109: "pop2"; + readonly 110: "pop3"; + readonly 111: "sunrpc"; + readonly 113: "auth"; + readonly 115: "sftp"; + readonly 117: "uucp-path"; + readonly 119: "nntp"; + readonly 123: "ntp"; + readonly 135: "epmap"; + readonly 137: "netbios-ns"; + readonly 139: "netbios-ssn"; + readonly 143: "imap"; + readonly 161: "snmp"; + readonly 179: "bgp"; + readonly 389: "ldap"; + readonly 427: "svrloc"; + readonly 465: "submissions"; + readonly 512: "exec"; + readonly 513: "login"; + readonly 514: "shell"; + readonly 515: "printer"; + readonly 526: "tempo"; + readonly 530: "courier"; + readonly 531: "chat"; + readonly 532: "netnews"; + readonly 540: "uucp"; + readonly 548: "afp"; + readonly 554: "rtsp"; + readonly 556: "remotefs"; + readonly 563: "nntps"; + readonly 587: "submission"; + readonly 601: "syslog-conn"; + readonly 636: "ldaps"; + readonly 989: "ftps-data"; + readonly 990: "ftps"; + readonly 993: "imaps"; + readonly 995: "pop3s"; + readonly 1719: "h323gatestat"; + readonly 1720: "h323hostcall"; + readonly 1723: "pptp"; + readonly 2049: "nfs"; + readonly 3659: "apple-sasl"; + readonly 4045: "npp"; + readonly 5060: "sip"; + readonly 5061: "sips"; + readonly 6000: "x11"; + readonly 6566: "sane-port"; + readonly 6665: "ircu"; + readonly 6666: "ircu"; + readonly 6667: "ircu"; + readonly 6668: "ircu"; + readonly 6669: "ircu"; + readonly 6697: "ircs-u"; + readonly 10080: "amanda"; +}; +type ReservedPort = keyof typeof KNOWN_RESERVED_PORTS; +export declare function isPortIsReserved(port: number): port is ReservedPort; +export declare function getReservedPortExplanation(port: ReservedPort): string; +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/helpers/get-reserved-port.js b/e-commerce/node_modules/next/dist/lib/helpers/get-reserved-port.js new file mode 100644 index 0000000000000000000000000000000000000000..9c27f1a40cbed35be861d8bee4fa884cb1125ea0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/get-reserved-port.js @@ -0,0 +1,116 @@ +/** https://fetch.spec.whatwg.org/#port-blocking */ "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + KNOWN_RESERVED_PORTS: null, + getReservedPortExplanation: null, + isPortIsReserved: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + KNOWN_RESERVED_PORTS: function() { + return KNOWN_RESERVED_PORTS; + }, + getReservedPortExplanation: function() { + return getReservedPortExplanation; + }, + isPortIsReserved: function() { + return isPortIsReserved; + } +}); +const KNOWN_RESERVED_PORTS = { + 1: 'tcpmux', + 7: 'echo', + 9: 'discard', + 11: 'systat', + 13: 'daytime', + 15: 'netstat', + 17: 'qotd', + 19: 'chargen', + 20: 'ftp-data', + 21: 'ftp', + 22: 'ssh', + 23: 'telnet', + 25: 'smtp', + 37: 'time', + 42: 'name', + 43: 'nicname', + 53: 'domain', + 69: 'tftp', + 77: 'rje', + 79: 'finger', + 87: 'link', + 95: 'supdup', + 101: 'hostname', + 102: 'iso-tsap', + 103: 'gppitnp', + 104: 'acr-nema', + 109: 'pop2', + 110: 'pop3', + 111: 'sunrpc', + 113: 'auth', + 115: 'sftp', + 117: 'uucp-path', + 119: 'nntp', + 123: 'ntp', + 135: 'epmap', + 137: 'netbios-ns', + 139: 'netbios-ssn', + 143: 'imap', + 161: 'snmp', + 179: 'bgp', + 389: 'ldap', + 427: 'svrloc', + 465: 'submissions', + 512: 'exec', + 513: 'login', + 514: 'shell', + 515: 'printer', + 526: 'tempo', + 530: 'courier', + 531: 'chat', + 532: 'netnews', + 540: 'uucp', + 548: 'afp', + 554: 'rtsp', + 556: 'remotefs', + 563: 'nntps', + 587: 'submission', + 601: 'syslog-conn', + 636: 'ldaps', + 989: 'ftps-data', + 990: 'ftps', + 993: 'imaps', + 995: 'pop3s', + 1719: 'h323gatestat', + 1720: 'h323hostcall', + 1723: 'pptp', + 2049: 'nfs', + 3659: 'apple-sasl', + 4045: 'npp', + 5060: 'sip', + 5061: 'sips', + 6000: 'x11', + 6566: 'sane-port', + 6665: 'ircu', + 6666: 'ircu', + 6667: 'ircu', + 6668: 'ircu', + 6669: 'ircu', + 6697: 'ircs-u', + 10080: 'amanda' +}; +function isPortIsReserved(port) { + return port in KNOWN_RESERVED_PORTS; +} +function getReservedPortExplanation(port) { + return `Bad port: "${port}" is reserved for ${KNOWN_RESERVED_PORTS[port]}\n` + 'Read more: https://nextjs.org/docs/messages/reserved-port'; +} + +//# sourceMappingURL=get-reserved-port.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/helpers/get-reserved-port.js.map b/e-commerce/node_modules/next/dist/lib/helpers/get-reserved-port.js.map new file mode 100644 index 0000000000000000000000000000000000000000..92d5614564539d69acc084a8f691fdee48c58a16 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/get-reserved-port.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/helpers/get-reserved-port.ts"],"sourcesContent":["/** https://fetch.spec.whatwg.org/#port-blocking */\nexport const KNOWN_RESERVED_PORTS = {\n 1: 'tcpmux',\n 7: 'echo',\n 9: 'discard',\n 11: 'systat',\n 13: 'daytime',\n 15: 'netstat',\n 17: 'qotd',\n 19: 'chargen',\n 20: 'ftp-data',\n 21: 'ftp',\n 22: 'ssh',\n 23: 'telnet',\n 25: 'smtp',\n 37: 'time',\n 42: 'name',\n 43: 'nicname',\n 53: 'domain',\n 69: 'tftp',\n 77: 'rje',\n 79: 'finger',\n 87: 'link',\n 95: 'supdup',\n 101: 'hostname',\n 102: 'iso-tsap',\n 103: 'gppitnp',\n 104: 'acr-nema',\n 109: 'pop2',\n 110: 'pop3',\n 111: 'sunrpc',\n 113: 'auth',\n 115: 'sftp',\n 117: 'uucp-path',\n 119: 'nntp',\n 123: 'ntp',\n 135: 'epmap',\n 137: 'netbios-ns',\n 139: 'netbios-ssn',\n 143: 'imap',\n 161: 'snmp',\n 179: 'bgp',\n 389: 'ldap',\n 427: 'svrloc',\n 465: 'submissions',\n 512: 'exec',\n 513: 'login',\n 514: 'shell',\n 515: 'printer',\n 526: 'tempo',\n 530: 'courier',\n 531: 'chat',\n 532: 'netnews',\n 540: 'uucp',\n 548: 'afp',\n 554: 'rtsp',\n 556: 'remotefs',\n 563: 'nntps',\n 587: 'submission',\n 601: 'syslog-conn',\n 636: 'ldaps',\n 989: 'ftps-data',\n 990: 'ftps',\n 993: 'imaps',\n 995: 'pop3s',\n 1719: 'h323gatestat',\n 1720: 'h323hostcall',\n 1723: 'pptp',\n 2049: 'nfs',\n 3659: 'apple-sasl',\n 4045: 'npp',\n 5060: 'sip',\n 5061: 'sips',\n 6000: 'x11',\n 6566: 'sane-port',\n 6665: 'ircu',\n 6666: 'ircu',\n 6667: 'ircu',\n 6668: 'ircu',\n 6669: 'ircu',\n 6697: 'ircs-u',\n 10080: 'amanda',\n} as const\n\ntype ReservedPort = keyof typeof KNOWN_RESERVED_PORTS\n\nexport function isPortIsReserved(port: number): port is ReservedPort {\n return port in KNOWN_RESERVED_PORTS\n}\n\nexport function getReservedPortExplanation(port: ReservedPort): string {\n return (\n `Bad port: \"${port}\" is reserved for ${KNOWN_RESERVED_PORTS[port]}\\n` +\n 'Read more: https://nextjs.org/docs/messages/reserved-port'\n )\n}\n"],"names":["KNOWN_RESERVED_PORTS","getReservedPortExplanation","isPortIsReserved","port"],"mappings":"AAAA,iDAAiD;;;;;;;;;;;;;;;;IACpCA,oBAAoB;eAApBA;;IAyFGC,0BAA0B;eAA1BA;;IAJAC,gBAAgB;eAAhBA;;;AArFT,MAAMF,uBAAuB;IAClC,GAAG;IACH,GAAG;IACH,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;AACT;AAIO,SAASE,iBAAiBC,IAAY;IAC3C,OAAOA,QAAQH;AACjB;AAEO,SAASC,2BAA2BE,IAAkB;IAC3D,OACE,CAAC,WAAW,EAAEA,KAAK,kBAAkB,EAAEH,oBAAoB,CAACG,KAAK,CAAC,EAAE,CAAC,GACrE;AAEJ","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/helpers/git.d.ts b/e-commerce/node_modules/next/dist/lib/helpers/git.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4a26c5b792122e1c4daf1659c2050c5aea26f0ea --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/git.d.ts @@ -0,0 +1,23 @@ +/** + * Returns the current git branch name for the given working directory, or + * undefined if it cannot be determined (not a git repo, detached HEAD, + * git not installed, etc.). Prefers VERCEL_GIT_COMMIT_REF when set. + */ +export declare function getGitBranch(cwd: string): string | undefined; +/** + * Returns the current git commit SHA for the given working directory, or + * undefined if it cannot be determined. Prefers VERCEL_GIT_COMMIT_SHA when + * set. + */ +export declare function getGitCommit(cwd: string): string | undefined; +/** + * Returns true if the working tree has uncommitted changes. Returns undefined + * when the dirty status cannot be determined (not a git repo, git not + * installed, etc.). + */ +export declare function getGitDirty(cwd: string): boolean | undefined; +/** + * Returns the first line of the HEAD commit message, or undefined when it + * cannot be determined. Prefers VERCEL_GIT_COMMIT_MESSAGE when set. + */ +export declare function getGitMessage(cwd: string): string | undefined; diff --git a/e-commerce/node_modules/next/dist/lib/helpers/git.js b/e-commerce/node_modules/next/dist/lib/helpers/git.js new file mode 100644 index 0000000000000000000000000000000000000000..9e12752e2aeeec903a590838e46d867c687aaf98 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/git.js @@ -0,0 +1,104 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + getGitBranch: null, + getGitCommit: null, + getGitDirty: null, + getGitMessage: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + getGitBranch: function() { + return getGitBranch; + }, + getGitCommit: function() { + return getGitCommit; + }, + getGitDirty: function() { + return getGitDirty; + }, + getGitMessage: function() { + return getGitMessage; + } +}); +const _nodechild_process = require("node:child_process"); +function gitExec(args, cwd) { + const result = (0, _nodechild_process.spawnSync)('git', args, { + cwd, + timeout: 2000, + stdio: [ + 'ignore', + 'pipe', + 'ignore' + ], + encoding: 'utf8' + }); + if (result.error) throw result.error; + if (result.status !== 0) { + throw new Error(`git ${args[0]} exited with status ${result.status}`); + } + return result.stdout.trim(); +} +function getGitBranch(cwd) { + if (process.env.VERCEL_GIT_COMMIT_REF) { + return process.env.VERCEL_GIT_COMMIT_REF; + } + try { + // symbolic-ref --short HEAD: returns the branch name for regular branches, + // works on repos with no commits, and exits non-zero in detached HEAD state + // (caught below and treated as unknown). + return gitExec([ + 'symbolic-ref', + '--short', + 'HEAD' + ], cwd); + } catch { + return undefined; + } +} +function getGitCommit(cwd) { + if (process.env.VERCEL_GIT_COMMIT_SHA) { + return process.env.VERCEL_GIT_COMMIT_SHA; + } + try { + return gitExec([ + 'rev-parse', + 'HEAD' + ], cwd); + } catch { + return undefined; + } +} +function getGitDirty(cwd) { + try { + return gitExec([ + 'status', + '--porcelain' + ], cwd).length > 0; + } catch { + return undefined; + } +} +function getGitMessage(cwd) { + if (process.env.VERCEL_GIT_COMMIT_MESSAGE) { + return process.env.VERCEL_GIT_COMMIT_MESSAGE.split('\n')[0].trim(); + } + try { + return gitExec([ + 'log', + '-1', + '--pretty=%s' + ], cwd); + } catch { + return undefined; + } +} + +//# sourceMappingURL=git.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/helpers/git.js.map b/e-commerce/node_modules/next/dist/lib/helpers/git.js.map new file mode 100644 index 0000000000000000000000000000000000000000..50cf40e7371261efe259f583da85b7f1d37d6919 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/git.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/helpers/git.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process'\n\nfunction gitExec(args: string[], cwd: string): string {\n const result = spawnSync('git', args, {\n cwd,\n timeout: 2000,\n stdio: ['ignore', 'pipe', 'ignore'],\n encoding: 'utf8',\n })\n if (result.error) throw result.error\n if (result.status !== 0) {\n throw new Error(`git ${args[0]} exited with status ${result.status}`)\n }\n return result.stdout.trim()\n}\n\n/**\n * Returns the current git branch name for the given working directory, or\n * undefined if it cannot be determined (not a git repo, detached HEAD,\n * git not installed, etc.). Prefers VERCEL_GIT_COMMIT_REF when set.\n */\nexport function getGitBranch(cwd: string): string | undefined {\n if (process.env.VERCEL_GIT_COMMIT_REF) {\n return process.env.VERCEL_GIT_COMMIT_REF\n }\n try {\n // symbolic-ref --short HEAD: returns the branch name for regular branches,\n // works on repos with no commits, and exits non-zero in detached HEAD state\n // (caught below and treated as unknown).\n return gitExec(['symbolic-ref', '--short', 'HEAD'], cwd)\n } catch {\n return undefined\n }\n}\n\n/**\n * Returns the current git commit SHA for the given working directory, or\n * undefined if it cannot be determined. Prefers VERCEL_GIT_COMMIT_SHA when\n * set.\n */\nexport function getGitCommit(cwd: string): string | undefined {\n if (process.env.VERCEL_GIT_COMMIT_SHA) {\n return process.env.VERCEL_GIT_COMMIT_SHA\n }\n try {\n return gitExec(['rev-parse', 'HEAD'], cwd)\n } catch {\n return undefined\n }\n}\n\n/**\n * Returns true if the working tree has uncommitted changes. Returns undefined\n * when the dirty status cannot be determined (not a git repo, git not\n * installed, etc.).\n */\nexport function getGitDirty(cwd: string): boolean | undefined {\n try {\n return gitExec(['status', '--porcelain'], cwd).length > 0\n } catch {\n return undefined\n }\n}\n\n/**\n * Returns the first line of the HEAD commit message, or undefined when it\n * cannot be determined. Prefers VERCEL_GIT_COMMIT_MESSAGE when set.\n */\nexport function getGitMessage(cwd: string): string | undefined {\n if (process.env.VERCEL_GIT_COMMIT_MESSAGE) {\n return process.env.VERCEL_GIT_COMMIT_MESSAGE.split('\\n')[0].trim()\n }\n try {\n return gitExec(['log', '-1', '--pretty=%s'], cwd)\n } catch {\n return undefined\n }\n}\n"],"names":["getGitBranch","getGitCommit","getGitDirty","getGitMessage","gitExec","args","cwd","result","spawnSync","timeout","stdio","encoding","error","status","Error","stdout","trim","process","env","VERCEL_GIT_COMMIT_REF","undefined","VERCEL_GIT_COMMIT_SHA","length","VERCEL_GIT_COMMIT_MESSAGE","split"],"mappings":";;;;;;;;;;;;;;;;;IAqBgBA,YAAY;eAAZA;;IAmBAC,YAAY;eAAZA;;IAgBAC,WAAW;eAAXA;;IAYAC,aAAa;eAAbA;;;mCApEU;AAE1B,SAASC,QAAQC,IAAc,EAAEC,GAAW;IAC1C,MAAMC,SAASC,IAAAA,4BAAS,EAAC,OAAOH,MAAM;QACpCC;QACAG,SAAS;QACTC,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ce/node_modules/next/dist/lib/helpers/install.d.ts b/e-commerce/node_modules/next/dist/lib/helpers/install.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..16253e98dde4c63fb64ccbfcad2e52b2a093a8f0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/install.d.ts @@ -0,0 +1,22 @@ +import type { PackageManager } from './get-pkg-manager'; +interface InstallArgs { + /** + * Indicate whether to install packages using npm, pnpm, or yarn. + */ + packageManager: PackageManager; + /** + * Indicate whether there is an active internet connection. + */ + isOnline: boolean; + /** + * Indicate whether the given dependencies are devDependencies. + */ + devDependencies?: boolean; +} +/** + * Spawn a package manager installation with either npm, pnpm, or yarn. + * + * @returns A Promise that resolves once the installation is finished. + */ +export declare function install(root: string, dependencies: string[], { packageManager, isOnline, devDependencies }: InstallArgs): Promise<void>; +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/helpers/install.js b/e-commerce/node_modules/next/dist/lib/helpers/install.js new file mode 100644 index 0000000000000000000000000000000000000000..c96f48f30dfe06eb09165e15b95b3c22ccaa4b2a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/install.js @@ -0,0 +1,83 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "install", { + enumerable: true, + get: function() { + return install; + } +}); +const _picocolors = require("../picocolors"); +const _crossspawn = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/cross-spawn")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function install(root, dependencies, { packageManager, isOnline, devDependencies }) { + let args = []; + if (dependencies.length > 0) { + if (packageManager === 'yarn') { + args = [ + 'add', + '--exact' + ]; + if (devDependencies) args.push('--dev'); + } else if (packageManager === 'pnpm') { + args = [ + 'add', + '--save-exact' + ]; + args.push(devDependencies ? '--save-dev' : '--save-prod'); + } else { + // npm + args = [ + 'install', + '--save-exact' + ]; + args.push(devDependencies ? '--save-dev' : '--save'); + } + args.push(...dependencies); + } else { + args = [ + 'install' + ] // npm, pnpm, and yarn all support `install` + ; + if (!isOnline) { + args.push('--offline'); + console.log((0, _picocolors.yellow)('You appear to be offline.')); + if (packageManager !== 'npm') { + console.log((0, _picocolors.yellow)(`Falling back to the local ${packageManager} cache.`)); + } + console.log(); + } + } + return new Promise((resolve, reject)=>{ + /** + * Spawn the installation process. + */ const child = (0, _crossspawn.default)(packageManager, args, { + cwd: root, + stdio: 'inherit', + env: { + ...process.env, + ADBLOCK: '1', + // we set NODE_ENV to development as pnpm skips dev + // dependencies when production + NODE_ENV: 'development', + DISABLE_OPENCOLLECTIVE: '1' + } + }); + child.on('close', (code)=>{ + if (code !== 0) { + reject({ + command: `${packageManager} ${args.join(' ')}` + }); + return; + } + resolve(); + }); + }); +} + +//# sourceMappingURL=install.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/helpers/install.js.map b/e-commerce/node_modules/next/dist/lib/helpers/install.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b23bd0f3c275f57b8b89ce782883f9522a34dc22 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/helpers/install.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/helpers/install.ts"],"sourcesContent":["import { yellow } from '../picocolors'\nimport spawn from 'next/dist/compiled/cross-spawn'\nimport type { PackageManager } from './get-pkg-manager'\n\ninterface InstallArgs {\n /**\n * Indicate whether to install packages using npm, pnpm, or yarn.\n */\n packageManager: PackageManager\n /**\n * Indicate whether there is an active internet connection.\n */\n isOnline: boolean\n /**\n * Indicate whether the given dependencies are devDependencies.\n */\n devDependencies?: boolean\n}\n\n/**\n * Spawn a package manager installation with either npm, pnpm, or yarn.\n *\n * @returns A Promise that resolves once the installation is finished.\n */\nexport function install(\n root: string,\n dependencies: string[],\n { packageManager, isOnline, devDependencies }: InstallArgs\n): Promise<void> {\n let args: string[] = []\n\n if (dependencies.length > 0) {\n if (packageManager === 'yarn') {\n args = ['add', '--exact']\n if (devDependencies) args.push('--dev')\n } else if (packageManager === 'pnpm') {\n args = ['add', '--save-exact']\n args.push(devDependencies ? '--save-dev' : '--save-prod')\n } else {\n // npm\n args = ['install', '--save-exact']\n args.push(devDependencies ? '--save-dev' : '--save')\n }\n\n args.push(...dependencies)\n } else {\n args = ['install'] // npm, pnpm, and yarn all support `install`\n\n if (!isOnline) {\n args.push('--offline')\n console.log(yellow('You appear to be offline.'))\n if (packageManager !== 'npm') {\n console.log(\n yellow(`Falling back to the local ${packageManager} cache.`)\n )\n }\n console.log()\n }\n }\n\n return new Promise((resolve, reject) => {\n /**\n * Spawn the installation process.\n */\n const child = spawn(packageManager, args, {\n cwd: root,\n stdio: 'inherit',\n env: {\n ...process.env,\n ADBLOCK: '1',\n // we set NODE_ENV to development as pnpm skips dev\n // dependencies when production\n NODE_ENV: 'development',\n DISABLE_OPENCOLLECTIVE: '1',\n },\n })\n child.on('close', (code) => {\n if (code !== 0) {\n reject({ command: `${packageManager} ${args.join(' ')}` })\n return\n }\n resolve()\n })\n })\n}\n"],"names":["install","root","dependencies","packageManager","isOnline","devDependencies","args","length","push","console","log","yellow","Promise","resolve","reject","child","spawn","cwd","stdio","env","process","ADBLOCK","NODE_ENV","DISABLE_OPENCOLLECTIVE","on","code","command","join"],"mappings":";;;;+BAwBgBA;;;eAAAA;;;4BAxBO;mEACL;;;;;;AAuBX,SAASA,QACdC,IAAY,EACZC,YAAsB,EACtB,EAAEC,cAAc,EAAEC,QAAQ,EAAEC,eAAe,EAAe;IAE1D,IAAIC,OAAiB,EAAE;IAEvB,IAAIJ,aAAaK,MAAM,GAAG,GAAG;QAC3B,IAAIJ,mBAAmB,QAAQ;YAC7BG,OAAO;gBAAC;gBAAO;aAAU;YACzB,IAAID,iBAAiBC,KAAKE,IAAI,CAAC;QACjC,OAAO,IAAIL,mBAAmB,QAAQ;YACpCG,OAAO;gBAAC;gBAAO;aAAe;YAC9BA,KAAKE,IAAI,CAACH,kBAAkB,eAAe;QAC7C,OAAO;YACL,MAAM;YACNC,OAAO;gBAAC;gBAAW;aAAe;YAClCA,KAAKE,IAAI,CAACH,kBAAkB,eAAe;QAC7C;QAEAC,KAAKE,IAAI,IAAIN;IACf,OAAO;QACLI,OAAO;YAAC;SAAU,CAAC,4CAA4C;;QAE/D,IAAI,CAACF,UAAU;YACbE,KAAKE,IAAI,CAAC;YACVC,QAAQC,GAAG,CAACC,IAAAA,kBAAM,EAAC;YACnB,IAAIR,mBAAmB,OAAO;gBAC5BM,QAAQC,GAAG,CACTC,IAAAA,kBAAM,EAAC,CAAC,0BAA0B,EAAER,eAAe,OAAO,CAAC;YAE/D;YACAM,QAAQC,GAAG;QACb;IACF;IAEA,OAAO,IAAIE,QAAQ,CAACC,SAASC;QAC3B;;KAEC,GACD,MAAMC,QAAQC,IAAAA,mBAAK,EAACb,gBAAgBG,MAAM;YACxCW,KAAKhB;YACLiB,OAAO;YACPC,KAAK;gBACH,GAAGC,QAAQD,GAAG;gBACdE,SAAS;gBACT,mDAAmD;gBACnD,+BAA+B;gBAC/BC,UAAU;gBACVC,wBAAwB;YAC1B;QACF;QACAR,MAAMS,EAAE,CAAC,SAAS,CAACC;YACjB,IAAIA,SAAS,GAAG;gBACdX,OAAO;oBAAEY,SAAS,GAAGvB,eAAe,CAAC,EAAEG,KAAKqB,IAAI,CAAC,MAAM;gBAAC;gBACxD;YACF;YACAd;QACF;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/import-next-warning.d.ts b/e-commerce/node_modules/next/dist/lib/import-next-warning.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/import-next-warning.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/import-next-warning.js b/e-commerce/node_modules/next/dist/lib/import-next-warning.js new file mode 100644 index 0000000000000000000000000000000000000000..ce8d96e2ee86c9cced552c5330be3a86b5c877d6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/import-next-warning.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +const _log = /*#__PURE__*/ _interop_require_wildcard(require("../build/output/log")); +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +var _module_parent; +_log.warn(`"next" should not be imported directly, imported in ${(_module_parent = module.parent) == null ? void 0 : _module_parent.filename}\nSee more info here: https://nextjs.org/docs/messages/import-next`); + +//# sourceMappingURL=import-next-warning.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/import-next-warning.js.map b/e-commerce/node_modules/next/dist/lib/import-next-warning.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3fdda9ca71eec5b6d552c083f09b7caa553322ed --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/import-next-warning.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/import-next-warning.ts"],"sourcesContent":["import * as Log from '../build/output/log'\n\nLog.warn(\n `\"next\" should not be imported directly, imported in ${module.parent?.filename}\\nSee more info here: https://nextjs.org/docs/messages/import-next`\n)\n"],"names":["module","Log","warn","parent","filename"],"mappings":";;;;6DAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGoCA;AADzDC,KAAIC,IAAI,CACN,CAAC,oDAAoD,GAAEF,iBAAAA,OAAOG,MAAM,qBAAbH,eAAeI,QAAQ,CAAC,kEAAkE,CAAC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/inline-static-env.d.ts b/e-commerce/node_modules/next/dist/lib/inline-static-env.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e56e95971145f4214be8e33e1d12bc77c95ebc1e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/inline-static-env.d.ts @@ -0,0 +1,5 @@ +import type { NextConfigComplete } from '../server/config-shared'; +export declare function inlineStaticEnv({ distDir, config, }: { + distDir: string; + config: NextConfigComplete; +}): Promise<void>; diff --git a/e-commerce/node_modules/next/dist/lib/inline-static-env.js b/e-commerce/node_modules/next/dist/lib/inline-static-env.js new file mode 100644 index 0000000000000000000000000000000000000000..5b5f1f07ae43f281787cee85c72f1e512c825400 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/inline-static-env.js @@ -0,0 +1,108 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "inlineStaticEnv", { + enumerable: true, + get: function() { + return inlineStaticEnv; + } +}); +const _fs = /*#__PURE__*/ _interop_require_default(require("fs")); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +const _crypto = /*#__PURE__*/ _interop_require_default(require("crypto")); +const _util = require("util"); +const _glob = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/glob")); +const _asyncsema = require("next/dist/compiled/async-sema"); +const _staticenv = require("./static-env"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +const glob = (0, _util.promisify)(_glob.default); +async function inlineStaticEnv({ distDir, config }) { + const nextConfigEnv = (0, _staticenv.getNextConfigEnv)(config); + const staticEnv = (0, _staticenv.getStaticEnv)(config, config.deploymentId); + const serverDir = _path.default.join(distDir, 'server'); + const serverChunks = await glob('**/*.{js,json,js.map}', { + cwd: serverDir + }); + const clientDir = _path.default.join(distDir, 'static'); + const clientChunks = await glob('**/*.{js,json,js.map}', { + cwd: clientDir + }); + const manifestChunks = await glob('*.{js,json,js.map}', { + cwd: distDir + }); + const inlineSema = new _asyncsema.Sema(8); + const nextConfigEnvKeys = Object.keys(nextConfigEnv).map((item)=>item.split('process.env.').pop()); + const builtRegEx = new RegExp(`[\\w]{1,}(\\.env)?\\.(?:NEXT_PUBLIC_[\\w]{1,}${nextConfigEnvKeys.length ? '|' + nextConfigEnvKeys.join('|') : ''})`, 'g'); + const changedClientFiles = []; + const filesToCheck = new Set(manifestChunks.map((f)=>_path.default.join(distDir, f))); + for (const [parentDir, files] of [ + [ + serverDir, + serverChunks + ], + [ + clientDir, + clientChunks + ] + ]){ + await Promise.all(files.map(async (file)=>{ + await inlineSema.acquire(); + const filepath = _path.default.join(parentDir, file); + const content = await _fs.default.promises.readFile(filepath, 'utf8'); + const newContent = content.replace(builtRegEx, (match)=>{ + let normalizedMatch = `process.env.${match.split('.').pop()}`; + if (staticEnv[normalizedMatch]) { + return JSON.stringify(staticEnv[normalizedMatch]); + } + return match; + }); + await _fs.default.promises.writeFile(filepath, newContent); + if (content !== newContent && parentDir === clientDir) { + changedClientFiles.push({ + file, + content: newContent + }); + } + filesToCheck.add(filepath); + inlineSema.release(); + })); + } + const hashChanges = []; + // hashes need updating for any changed client files + for (const { file, content } of changedClientFiles){ + var _file_match; + // hash is 16 chars currently for all client chunks + const originalHash = ((_file_match = file.match(/([a-z0-9]{16})\./)) == null ? void 0 : _file_match[1]) || ''; + if (!originalHash) { + throw new Error(`Invariant: client chunk changed but failed to detect hash ${file}`); + } + const newHash = _crypto.default.createHash('sha256').update(content).digest('hex').substring(0, 16); + hashChanges.push({ + originalHash, + newHash + }); + const filepath = _path.default.join(clientDir, file); + const newFilepath = filepath.replace(originalHash, newHash); + filesToCheck.delete(filepath); + filesToCheck.add(newFilepath); + await _fs.default.promises.rename(filepath, newFilepath); + } + // update build-manifest and webpack-runtime with new hashes + for (let file of filesToCheck){ + const content = await _fs.default.promises.readFile(file, 'utf-8'); + let newContent = content; + for (const { originalHash, newHash } of hashChanges){ + newContent = newContent.replaceAll(originalHash, newHash); + } + if (content !== newContent) { + await _fs.default.promises.writeFile(file, newContent); + } + } +} + +//# sourceMappingURL=inline-static-env.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/inline-static-env.js.map b/e-commerce/node_modules/next/dist/lib/inline-static-env.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0f2e233acb8441d5925a1c33a3cc0d349b8be123 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/inline-static-env.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/inline-static-env.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport crypto from 'crypto'\nimport { promisify } from 'util'\nimport globOriginal from 'next/dist/compiled/glob'\nimport { Sema } from 'next/dist/compiled/async-sema'\nimport type { NextConfigComplete } from '../server/config-shared'\nimport { getNextConfigEnv, getStaticEnv } from './static-env'\n\nconst glob = promisify(globOriginal)\n\nexport async function inlineStaticEnv({\n distDir,\n config,\n}: {\n distDir: string\n config: NextConfigComplete\n}) {\n const nextConfigEnv = getNextConfigEnv(config)\n const staticEnv = getStaticEnv(config, config.deploymentId)\n\n const serverDir = path.join(distDir, 'server')\n const serverChunks = await glob('**/*.{js,json,js.map}', {\n cwd: serverDir,\n })\n const clientDir = path.join(distDir, 'static')\n const clientChunks = await glob('**/*.{js,json,js.map}', {\n cwd: clientDir,\n })\n const manifestChunks = await glob('*.{js,json,js.map}', {\n cwd: distDir,\n })\n\n const inlineSema = new Sema(8)\n const nextConfigEnvKeys = Object.keys(nextConfigEnv).map((item) =>\n item.split('process.env.').pop()\n )\n\n const builtRegEx = new RegExp(\n `[\\\\w]{1,}(\\\\.env)?\\\\.(?:NEXT_PUBLIC_[\\\\w]{1,}${nextConfigEnvKeys.length ? '|' + nextConfigEnvKeys.join('|') : ''})`,\n 'g'\n )\n const changedClientFiles: Array<{ file: string; content: string }> = []\n const filesToCheck = new Set<string>(\n manifestChunks.map((f) => path.join(distDir, f))\n )\n\n for (const [parentDir, files] of [\n [serverDir, serverChunks],\n [clientDir, clientChunks],\n ] as const) {\n await Promise.all(\n files.map(async (file) => {\n await inlineSema.acquire()\n const filepath = path.join(parentDir, file)\n const content = await fs.promises.readFile(filepath, 'utf8')\n const newContent = content.replace(builtRegEx, (match) => {\n let normalizedMatch = `process.env.${match.split('.').pop()}`\n\n if (staticEnv[normalizedMatch]) {\n return JSON.stringify(staticEnv[normalizedMatch])\n }\n return match\n })\n\n await fs.promises.writeFile(filepath, newContent)\n\n if (content !== newContent && parentDir === clientDir) {\n changedClientFiles.push({ file, content: newContent })\n }\n filesToCheck.add(filepath)\n inlineSema.release()\n })\n )\n }\n const hashChanges: Array<{\n originalHash: string\n newHash: string\n }> = []\n\n // hashes need updating for any changed client files\n for (const { file, content } of changedClientFiles) {\n // hash is 16 chars currently for all client chunks\n const originalHash = file.match(/([a-z0-9]{16})\\./)?.[1] || ''\n\n if (!originalHash) {\n throw new Error(\n `Invariant: client chunk changed but failed to detect hash ${file}`\n )\n }\n const newHash = crypto\n .createHash('sha256')\n .update(content)\n .digest('hex')\n .substring(0, 16)\n\n hashChanges.push({ originalHash, newHash })\n\n const filepath = path.join(clientDir, file)\n const newFilepath = filepath.replace(originalHash, newHash)\n\n filesToCheck.delete(filepath)\n filesToCheck.add(newFilepath)\n\n await fs.promises.rename(filepath, newFilepath)\n }\n\n // update build-manifest and webpack-runtime with new hashes\n for (let file of filesToCheck) {\n const content = await fs.promises.readFile(file, 'utf-8')\n let newContent = content\n\n for (const { originalHash, newHash } of hashChanges) {\n newContent = newContent.replaceAll(originalHash, newHash)\n }\n if (content !== newContent) {\n await fs.promises.writeFile(file, newContent)\n }\n }\n}\n"],"names":["inlineStaticEnv","glob","promisify","globOriginal","distDir","config","nextConfigEnv","getNextConfigEnv","staticEnv","getStaticEnv","deploymentId","serverDir","path","join","serverChunks","cwd","clientDir","clientChunks","manifestChunks","inlineSema","Sema","nextConfigEnvKeys","Object","keys","map","item","split","pop","builtRegEx","RegExp","length","changedClientFiles","filesToCheck","Set","f","parentDir","files","Promise","all","file","acquire","filepath","content","fs","promises","readFile","newContent","replace","match","normalizedMatch","JSON","stringify","writeFile","push","add","release","hashChanges","originalHash","Error","newHash","crypto","createHash","update","digest","substring","newFilepath","delete","rename","replaceAll"],"mappings":";;;;+BAWsBA;;;eAAAA;;;2DAXP;6DACE;+DACE;sBACO;6DACD;2BACJ;2BAE0B;;;;;;AAE/C,MAAMC,OAAOC,IAAAA,eAAS,EAACC,aAAY;AAE5B,eAAeH,gBAAgB,EACpCI,OAAO,EACPC,MAAM,EAIP;IACC,MAAMC,gBAAgBC,IAAAA,2BAAgB,EAACF;IACvC,MAAMG,YAAYC,IAAAA,uBAAY,EAACJ,QAAQA,OAAOK,YAAY;IAE1D,MAAMC,YAAYC,aAAI,CAACC,IAAI,CAACT,SAAS;IACrC,MAAMU,eAAe,MAAMb,KAAK,yBAAyB;QACvDc,KAAKJ;IACP;IACA,MAAMK,YAAYJ,aAAI,CAACC,IAAI,CAACT,SAAS;IACrC,MAAMa,eAAe,MAAMhB,KAAK,yBAAyB;QACvDc,KAAKC;IACP;IACA,MAAME,iBAAiB,MAAMjB,KAAK,sBAAsB;QACtDc,KAAKX;IACP;IAEA,MAAMe,aAAa,IAAIC,eAAI,CAAC;IAC5B,MAAMC,oBAAoBC,OAAOC,IAAI,CAACjB,eAAekB,GAAG,CAAC,CAACC,OACxDA,KAAKC,KAAK,CAAC,gBAAgBC,GAAG;IAGhC,MAAMC,aAAa,IAAIC,OACrB,CAAC,6CAA6C,EAAER,kBAA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EAAE,KAAI;QAE5D,IAAI,CAACkB,cAAc;YACjB,MAAM,IAAIC,MACR,CAAC,0DAA0D,EAAEnB,MAAM;QAEvE;QACA,MAAMoB,UAAUC,eAAM,CACnBC,UAAU,CAAC,UACXC,MAAM,CAACpB,SACPqB,MAAM,CAAC,OACPC,SAAS,CAAC,GAAG;QAEhBR,YAAYH,IAAI,CAAC;YAAEI;YAAcE;QAAQ;QAEzC,MAAMlB,WAAW7B,aAAI,CAACC,IAAI,CAACG,WAAWuB;QACtC,MAAM0B,cAAcxB,SAASM,OAAO,CAACU,cAAcE;QAEnD3B,aAAakC,MAAM,CAACzB;QACpBT,aAAasB,GAAG,CAACW;QAEjB,MAAMtB,WAAE,CAACC,QAAQ,CAACuB,MAAM,CAAC1B,UAAUwB;IACrC;IAEA,4DAA4D;IAC5D,KAAK,IAAI1B,QAAQP,aAAc;QAC7B,MAAMU,UAAU,MAAMC,WAAE,CAACC,QAAQ,CAACC,QAAQ,CAACN,MAAM;QACjD,IAAIO,aAAaJ;QAEjB,KAAK,MAAM,EAAEe,YAAY,EAAEE,OAAO,EAAE,IAAIH,YAAa;YACnDV,aAAaA,WAAWsB,UAAU,CAACX,cAAcE;QACnD;QACA,IAAIjB,YAAYI,YAAY;YAC1B,MAAMH,WAAE,CAACC,QAAQ,CAACQ,SAAS,CAACb,MAAMO;QACpC;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/install-dependencies.d.ts b/e-commerce/node_modules/next/dist/lib/install-dependencies.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3bec24cae11f36f7ca7382718f14beb20b500de5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/install-dependencies.d.ts @@ -0,0 +1,4 @@ +export type Dependencies = { + resolved: Map<string, string>; +}; +export declare function installDependencies(baseDir: string, deps: any, dev?: boolean): Promise<void>; diff --git a/e-commerce/node_modules/next/dist/lib/install-dependencies.js b/e-commerce/node_modules/next/dist/lib/install-dependencies.js new file mode 100644 index 0000000000000000000000000000000000000000..b329d8757e885e354ce00e4596ba66f9a3179c09 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/install-dependencies.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "installDependencies", { + enumerable: true, + get: function() { + return installDependencies; + } +}); +const _picocolors = require("./picocolors"); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +const _getpkgmanager = require("./helpers/get-pkg-manager"); +const _install = require("./helpers/install"); +const _getonline = require("./helpers/get-online"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +async function installDependencies(baseDir, deps, dev = false) { + const packageManager = (0, _getpkgmanager.getPkgManager)(baseDir); + const isOnline = await (0, _getonline.getOnline)(); + if (deps.length) { + console.log(); + console.log(`Installing ${dev ? 'devDependencies' : 'dependencies'} (${packageManager}):`); + for (const dep of deps){ + console.log(`- ${(0, _picocolors.cyan)(dep.pkg)}`); + } + console.log(); + await (0, _install.install)(_path.default.resolve(baseDir), deps.map((dep)=>dep.install ?? dep.pkg), { + devDependencies: dev, + isOnline, + packageManager + }); + console.log(); + } +} + +//# sourceMappingURL=install-dependencies.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/install-dependencies.js.map b/e-commerce/node_modules/next/dist/lib/install-dependencies.js.map new file mode 100644 index 0000000000000000000000000000000000000000..04e93049da42ae34dec033495ed0480f26bdea41 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/install-dependencies.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/install-dependencies.ts"],"sourcesContent":["import { cyan } from './picocolors'\nimport path from 'path'\n\nimport type { MissingDependency } from './has-necessary-dependencies'\nimport { getPkgManager } from './helpers/get-pkg-manager'\nimport { install } from './helpers/install'\nimport { getOnline } from './helpers/get-online'\n\nexport type Dependencies = {\n resolved: Map<string, string>\n}\n\nexport async function installDependencies(\n baseDir: string,\n deps: any,\n dev: boolean = false\n) {\n const packageManager = getPkgManager(baseDir)\n const isOnline = await getOnline()\n\n if (deps.length) {\n console.log()\n console.log(\n `Installing ${\n dev ? 'devDependencies' : 'dependencies'\n } (${packageManager}):`\n )\n for (const dep of deps) {\n console.log(`- ${cyan(dep.pkg)}`)\n }\n console.log()\n\n await install(\n path.resolve(baseDir),\n deps.map((dep: MissingDependency) => dep.install ?? dep.pkg),\n { devDependencies: dev, isOnline, packageManager }\n )\n console.log()\n }\n}\n"],"names":["installDependencies","baseDir","deps","dev","packageManager","getPkgManager","isOnline","getOnline","length","console","log","dep","cyan","pkg","install","path","resolve","map","devDependencies"],"mappings":";;;;+BAYsBA;;;eAAAA;;;4BAZD;6DACJ;+BAGa;yBACN;2BACE;;;;;;AAMnB,eAAeA,oBACpBC,OAAe,EACfC,IAAS,EACTC,MAAe,KAAK;IAEpB,MAAMC,iBAAiBC,IAAAA,4BAAa,EAACJ;IACrC,MAAMK,WAAW,MAAMC,IAAAA,oBAAS;IAEhC,IAAIL,KAAKM,MAAM,EAAE;QACfC,QAAQC,GAAG;QACXD,QAAQC,GAAG,CACT,CAAC,WAAW,EACVP,MAAM,oBAAoB,eAC3B,EAAE,EAAEC,eAAe,EAAE,CAAC;QAEzB,KAAK,MAAMO,OAAOT,KAAM;YACtBO,QAAQC,GAAG,CAAC,CAAC,EAAE,EAAEE,IAAAA,gBAAI,EAACD,IAAIE,GAAG,GAAG;QAClC;QACAJ,QAAQC,GAAG;QAEX,MAAMI,IAAAA,gBAAO,EACXC,aAAI,CAACC,OAAO,CAACf,UACbC,KAAKe,GAAG,CAAC,CAACN,MAA2BA,IAAIG,OAAO,IAAIH,IAAIE,GAAG,GAC3D;YAAEK,iBAAiBf;YAAKG;YAAUF;QAAe;QAEnDK,QAAQC,GAAG;IACb;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/interop-default.d.ts b/e-commerce/node_modules/next/dist/lib/interop-default.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f0b9b54a1d1748297aaf050a096ba5e4ea4b7fb5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/interop-default.d.ts @@ -0,0 +1,3 @@ +export declare function interopDefault<T>(mod: { + default: T; +} | T): T; diff --git a/e-commerce/node_modules/next/dist/lib/interop-default.js b/e-commerce/node_modules/next/dist/lib/interop-default.js new file mode 100644 index 0000000000000000000000000000000000000000..4e3c7acf4727a97a785c227e0db8456c0eb0982c --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/interop-default.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "interopDefault", { + enumerable: true, + get: function() { + return interopDefault; + } +}); +function interopDefault(mod) { + // @ts-ignore + return mod.default || mod; +} + +//# sourceMappingURL=interop-default.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/interop-default.js.map b/e-commerce/node_modules/next/dist/lib/interop-default.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e644cb3901c183fa9dd9ebe3d185ceee25f848ac --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/interop-default.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/interop-default.ts"],"sourcesContent":["export function interopDefault<T>(mod: { default: T } | T): T {\n // @ts-ignore\n return mod.default || mod\n}\n"],"names":["interopDefault","mod","default"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,eAAkBC,GAAuB;IACvD,aAAa;IACb,OAAOA,IAAIC,OAAO,IAAID;AACxB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/is-api-route.d.ts b/e-commerce/node_modules/next/dist/lib/is-api-route.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a5ffb85f628899462b26463e32d3e731ca3c764a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-api-route.d.ts @@ -0,0 +1 @@ +export declare function isAPIRoute(value?: string): boolean; diff --git a/e-commerce/node_modules/next/dist/lib/is-api-route.js b/e-commerce/node_modules/next/dist/lib/is-api-route.js new file mode 100644 index 0000000000000000000000000000000000000000..50adf8aa135485c1a2c1d1888bd6d7d435e55403 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-api-route.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "isAPIRoute", { + enumerable: true, + get: function() { + return isAPIRoute; + } +}); +function isAPIRoute(value) { + return value === '/api' || Boolean(value == null ? void 0 : value.startsWith('/api/')); +} + +//# sourceMappingURL=is-api-route.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/is-api-route.js.map b/e-commerce/node_modules/next/dist/lib/is-api-route.js.map new file mode 100644 index 0000000000000000000000000000000000000000..9c0083bccdccc09e8407691c9ef1b4477a30f738 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-api-route.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/is-api-route.ts"],"sourcesContent":["export function isAPIRoute(value?: string) {\n return value === '/api' || Boolean(value?.startsWith('/api/'))\n}\n"],"names":["isAPIRoute","value","Boolean","startsWith"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,WAAWC,KAAc;IACvC,OAAOA,UAAU,UAAUC,QAAQD,yBAAAA,MAAOE,UAAU,CAAC;AACvD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/is-app-page-route.d.ts b/e-commerce/node_modules/next/dist/lib/is-app-page-route.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..89ec8f49de4396a718ff1a0b0492b5223d1109cd --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-app-page-route.d.ts @@ -0,0 +1 @@ +export declare function isAppPageRoute(route: string): boolean; diff --git a/e-commerce/node_modules/next/dist/lib/is-app-page-route.js b/e-commerce/node_modules/next/dist/lib/is-app-page-route.js new file mode 100644 index 0000000000000000000000000000000000000000..e866d349fb35821b235c78f859f65c34c4576e8a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-app-page-route.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "isAppPageRoute", { + enumerable: true, + get: function() { + return isAppPageRoute; + } +}); +function isAppPageRoute(route) { + return route.endsWith('/page'); +} + +//# sourceMappingURL=is-app-page-route.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/is-app-page-route.js.map b/e-commerce/node_modules/next/dist/lib/is-app-page-route.js.map new file mode 100644 index 0000000000000000000000000000000000000000..80268725bc6099b8febf1f3245b8f810e015209b --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-app-page-route.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/is-app-page-route.ts"],"sourcesContent":["export function isAppPageRoute(route: string): boolean {\n return route.endsWith('/page')\n}\n"],"names":["isAppPageRoute","route","endsWith"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,eAAeC,KAAa;IAC1C,OAAOA,MAAMC,QAAQ,CAAC;AACxB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/is-app-route-route.d.ts b/e-commerce/node_modules/next/dist/lib/is-app-route-route.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6052fea59dd164f90d6868cca3811e896b9709b5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-app-route-route.d.ts @@ -0,0 +1 @@ +export declare function isAppRouteRoute(route: string): boolean; diff --git a/e-commerce/node_modules/next/dist/lib/is-app-route-route.js b/e-commerce/node_modules/next/dist/lib/is-app-route-route.js new file mode 100644 index 0000000000000000000000000000000000000000..7c901addf617456fe56694d58d6484d517a87344 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-app-route-route.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "isAppRouteRoute", { + enumerable: true, + get: function() { + return isAppRouteRoute; + } +}); +function isAppRouteRoute(route) { + return route.endsWith('/route'); +} + +//# sourceMappingURL=is-app-route-route.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/is-app-route-route.js.map b/e-commerce/node_modules/next/dist/lib/is-app-route-route.js.map new file mode 100644 index 0000000000000000000000000000000000000000..713b313baee2558a728f00926076ba188417cc32 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-app-route-route.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/is-app-route-route.ts"],"sourcesContent":["export function isAppRouteRoute(route: string): boolean {\n return route.endsWith('/route')\n}\n"],"names":["isAppRouteRoute","route","endsWith"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,gBAAgBC,KAAa;IAC3C,OAAOA,MAAMC,QAAQ,CAAC;AACxB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/is-edge-runtime.d.ts b/e-commerce/node_modules/next/dist/lib/is-edge-runtime.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b241803ee90c426900acfe5aa21f03080bf168e6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-edge-runtime.d.ts @@ -0,0 +1,2 @@ +import type { ServerRuntime } from '../types'; +export declare function isEdgeRuntime(value?: string): value is ServerRuntime; diff --git a/e-commerce/node_modules/next/dist/lib/is-edge-runtime.js b/e-commerce/node_modules/next/dist/lib/is-edge-runtime.js new file mode 100644 index 0000000000000000000000000000000000000000..ea85e136c6752ad1528221906b42f39ce8cc51cd --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-edge-runtime.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "isEdgeRuntime", { + enumerable: true, + get: function() { + return isEdgeRuntime; + } +}); +const _constants = require("./constants"); +function isEdgeRuntime(value) { + return value === _constants.SERVER_RUNTIME.experimentalEdge || value === _constants.SERVER_RUNTIME.edge; +} + +//# sourceMappingURL=is-edge-runtime.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/is-edge-runtime.js.map b/e-commerce/node_modules/next/dist/lib/is-edge-runtime.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7e2b65aa19fdde475078d1cca7f2e15ef18d32ad --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-edge-runtime.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/is-edge-runtime.ts"],"sourcesContent":["import type { ServerRuntime } from '../types'\nimport { SERVER_RUNTIME } from './constants'\n\nexport function isEdgeRuntime(value?: string): value is ServerRuntime {\n return (\n value === SERVER_RUNTIME.experimentalEdge || value === SERVER_RUNTIME.edge\n )\n}\n"],"names":["isEdgeRuntime","value","SERVER_RUNTIME","experimentalEdge","edge"],"mappings":";;;;+BAGgBA;;;eAAAA;;;2BAFe;AAExB,SAASA,cAAcC,KAAc;IAC1C,OACEA,UAAUC,yBAAc,CAACC,gBAAgB,IAAIF,UAAUC,yBAAc,CAACE,IAAI;AAE9E","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/is-error.d.ts b/e-commerce/node_modules/next/dist/lib/is-error.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5517ab8ecfa27c9b60a8ffc94afaa62a3e1aa0a5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-error.d.ts @@ -0,0 +1,13 @@ +export interface NextError extends Error { + type?: string; + page?: string; + code?: string | number; + cancelled?: boolean; + digest?: string; +} +/** + * Checks whether the given value is a NextError. + * This can be used to print a more detailed error message with properties like `code` & `digest`. + */ +export default function isError(err: unknown): err is NextError; +export declare function getProperError(err: unknown): Error; diff --git a/e-commerce/node_modules/next/dist/lib/is-error.js b/e-commerce/node_modules/next/dist/lib/is-error.js new file mode 100644 index 0000000000000000000000000000000000000000..55eb76b25fbe8cd68f7bf1f0fd1eb16300486d0a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-error.js @@ -0,0 +1,66 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + default: null, + getProperError: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + /** + * Checks whether the given value is a NextError. + * This can be used to print a more detailed error message with properties like `code` & `digest`. + */ default: function() { + return isError; + }, + getProperError: function() { + return getProperError; + } +}); +const _isplainobject = require("../shared/lib/is-plain-object"); +/** + * This is a safe stringify function that handles circular references. + * We're using a simpler version here to avoid introducing + * the dependency `safe-stable-stringify` into production bundle. + * + * This helper is used both in development and production. + */ function safeStringifyLite(obj) { + const seen = new WeakSet(); + return JSON.stringify(obj, (_key, value)=>{ + // If value is an object and already seen, replace with "[Circular]" + if (typeof value === 'object' && value !== null) { + if (seen.has(value)) { + return '[Circular]'; + } + seen.add(value); + } + return value; + }); +} +function isError(err) { + return typeof err === 'object' && err !== null && 'name' in err && 'message' in err; +} +function getProperError(err) { + if (isError(err)) { + return err; + } + if (process.env.NODE_ENV === 'development') { + // provide better error for case where `throw undefined` + // is called in development + if (typeof err === 'undefined') { + return new Error('An undefined error was thrown, ' + 'see here for more info: https://nextjs.org/docs/messages/threw-undefined'); + } + if (err === null) { + return new Error('A null error was thrown, ' + 'see here for more info: https://nextjs.org/docs/messages/threw-undefined'); + } + } + return new Error((0, _isplainobject.isPlainObject)(err) ? safeStringifyLite(err) : err + ''); +} + +//# sourceMappingURL=is-error.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/is-error.js.map b/e-commerce/node_modules/next/dist/lib/is-error.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6b9acf3ea67b88f80241f8b4f40d26b633b4f187 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-error.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/is-error.ts"],"sourcesContent":["import { isPlainObject } from '../shared/lib/is-plain-object'\n\n// We allow some additional attached properties for Next.js errors\nexport interface NextError extends Error {\n type?: string\n page?: string\n code?: string | number\n cancelled?: boolean\n digest?: string\n}\n\n/**\n * This is a safe stringify function that handles circular references.\n * We're using a simpler version here to avoid introducing\n * the dependency `safe-stable-stringify` into production bundle.\n *\n * This helper is used both in development and production.\n */\nfunction safeStringifyLite(obj: any) {\n const seen = new WeakSet()\n\n return JSON.stringify(obj, (_key, value) => {\n // If value is an object and already seen, replace with \"[Circular]\"\n if (typeof value === 'object' && value !== null) {\n if (seen.has(value)) {\n return '[Circular]'\n }\n seen.add(value)\n }\n return value\n })\n}\n\n/**\n * Checks whether the given value is a NextError.\n * This can be used to print a more detailed error message with properties like `code` & `digest`.\n */\nexport default function isError(err: unknown): err is NextError {\n return (\n typeof err === 'object' && err !== null && 'name' in err && 'message' in err\n )\n}\n\nexport function getProperError(err: unknown): Error {\n if (isError(err)) {\n return err\n }\n\n if (process.env.NODE_ENV === 'development') {\n // provide better error for case where `throw undefined`\n // is called in development\n if (typeof err === 'undefined') {\n return new Error(\n 'An undefined error was thrown, ' +\n 'see here for more info: https://nextjs.org/docs/messages/threw-undefined'\n )\n }\n\n if (err === null) {\n return new Error(\n 'A null error was thrown, ' +\n 'see here for more info: https://nextjs.org/docs/messages/threw-undefined'\n )\n }\n }\n\n return new Error(isPlainObject(err) ? safeStringifyLite(err) : err + '')\n}\n"],"names":["isError","getProperError","safeStringifyLite","obj","seen","WeakSet","JSON","stringify","_key","value","has","add","err","process","env","NODE_ENV","Error","isPlainObject"],"mappings":";;;;;;;;;;;;;;;IAiCA;;;CAGC,GACD,OAIC;eAJuBA;;IAMRC,cAAc;eAAdA;;;+BA3Cc;AAW9B;;;;;;CAMC,GACD,SAASC,kBAAkBC,GAAQ;IACjC,MAAMC,OAAO,IAAIC;IAEjB,OAAOC,KAAKC,SAAS,CAACJ,KAAK,CAACK,MAAMC;QAChC,oEAAoE;QACpE,IAAI,OAAOA,UAAU,YAAYA,UAAU,MAAM;YAC/C,IAAIL,KAAKM,GAAG,CAACD,QAAQ;gBACnB,OAAO;YACT;YACAL,KAAKO,GAAG,CAACF;QACX;QACA,OAAOA;IACT;AACF;AAMe,SAAST,QAAQY,GAAY;IAC1C,OACE,OAAOA,QAAQ,YAAYA,QAAQ,QAAQ,UAAUA,OAAO,aAAaA;AAE7E;AAEO,SAASX,eAAeW,GAAY;IACzC,IAAIZ,QAAQY,MAAM;QAChB,OAAOA;IACT;IAEA,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1C,wDAAwD;QACxD,2BAA2B;QAC3B,IAAI,OAAOH,QAAQ,aAAa;YAC9B,OAAO,IAAII,MACT,oCACE;QAEN;QAEA,IAAIJ,QAAQ,MAAM;YAChB,OAAO,IAAII,MACT,8BACE;QAEN;IACF;IAEA,OAAO,IAAIA,MAAMC,IAAAA,4BAAa,EAACL,OAAOV,kBAAkBU,OAAOA,MAAM;AACvE","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/is-interception-route-rewrite.d.ts b/e-commerce/node_modules/next/dist/lib/is-interception-route-rewrite.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d0c12d3bdb6e672cc0315c6cf9049aad0f2706ea --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-interception-route-rewrite.d.ts @@ -0,0 +1,3 @@ +import type { Rewrite } from './load-custom-routes'; +import type { DeepReadonly } from '../shared/lib/deep-readonly'; +export declare function isInterceptionRouteRewrite(route: DeepReadonly<Rewrite>): boolean; diff --git a/e-commerce/node_modules/next/dist/lib/is-interception-route-rewrite.js b/e-commerce/node_modules/next/dist/lib/is-interception-route-rewrite.js new file mode 100644 index 0000000000000000000000000000000000000000..e2217c12c0518fa7d72c8d2f257ecc36cc6c070a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-interception-route-rewrite.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "isInterceptionRouteRewrite", { + enumerable: true, + get: function() { + return isInterceptionRouteRewrite; + } +}); +const _approuterheaders = require("../client/components/app-router-headers"); +function isInterceptionRouteRewrite(route) { + var _route_has_, _route_has; + // When we generate interception rewrites in the above implementation, we always do so with only a single `has` condition. + return ((_route_has = route.has) == null ? void 0 : (_route_has_ = _route_has[0]) == null ? void 0 : _route_has_.key) === _approuterheaders.NEXT_URL; +} + +//# sourceMappingURL=is-interception-route-rewrite.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/is-interception-route-rewrite.js.map b/e-commerce/node_modules/next/dist/lib/is-interception-route-rewrite.js.map new file mode 100644 index 0000000000000000000000000000000000000000..646de6b2ec81dc2915c973d0870d9d18957c718e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-interception-route-rewrite.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/is-interception-route-rewrite.ts"],"sourcesContent":["import { NEXT_URL } from '../client/components/app-router-headers'\nimport type { Rewrite } from './load-custom-routes'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\n\nexport function isInterceptionRouteRewrite(route: DeepReadonly<Rewrite>) {\n // When we generate interception rewrites in the above implementation, we always do so with only a single `has` condition.\n return route.has?.[0]?.key === NEXT_URL\n}\n"],"names":["isInterceptionRouteRewrite","route","has","key","NEXT_URL"],"mappings":";;;;+BAIgBA;;;eAAAA;;;kCAJS;AAIlB,SAASA,2BAA2BC,KAA4B;QAE9DA,aAAAA;IADP,0HAA0H;IAC1H,OAAOA,EAAAA,aAAAA,MAAMC,GAAG,sBAATD,cAAAA,UAAW,CAAC,EAAE,qBAAdA,YAAgBE,GAAG,MAAKC,0BAAQ;AACzC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/is-internal-component.d.ts b/e-commerce/node_modules/next/dist/lib/is-internal-component.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9fa9d495a7c87156f37d878421c15d9f005a331e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-internal-component.d.ts @@ -0,0 +1,2 @@ +export declare function isInternalComponent(pathname: string): boolean; +export declare function isNonRoutePagesPage(pathname: string): boolean; diff --git a/e-commerce/node_modules/next/dist/lib/is-internal-component.js b/e-commerce/node_modules/next/dist/lib/is-internal-component.js new file mode 100644 index 0000000000000000000000000000000000000000..b0413f3cdb2cbbeb2a5dfd512ef7552d8f53093d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-internal-component.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + isInternalComponent: null, + isNonRoutePagesPage: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + isInternalComponent: function() { + return isInternalComponent; + }, + isNonRoutePagesPage: function() { + return isNonRoutePagesPage; + } +}); +function isInternalComponent(pathname) { + switch(pathname){ + case 'next/dist/pages/_app': + case 'next/dist/pages/_document': + return true; + default: + return false; + } +} +function isNonRoutePagesPage(pathname) { + return pathname === '/_app' || pathname === '/_document'; +} + +//# sourceMappingURL=is-internal-component.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/is-internal-component.js.map b/e-commerce/node_modules/next/dist/lib/is-internal-component.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ea2890c9204d9903bf9e7a2e8ad9115ea57fba20 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-internal-component.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/is-internal-component.ts"],"sourcesContent":["export function isInternalComponent(pathname: string): boolean {\n switch (pathname) {\n case 'next/dist/pages/_app':\n case 'next/dist/pages/_document':\n return true\n default:\n return false\n }\n}\n\nexport function isNonRoutePagesPage(pathname: string): boolean {\n return pathname === '/_app' || pathname === '/_document'\n}\n"],"names":["isInternalComponent","isNonRoutePagesPage","pathname"],"mappings":";;;;;;;;;;;;;;;IAAgBA,mBAAmB;eAAnBA;;IAUAC,mBAAmB;eAAnBA;;;AAVT,SAASD,oBAAoBE,QAAgB;IAClD,OAAQA;QACN,KAAK;QACL,KAAK;YACH,OAAO;QACT;YACE,OAAO;IACX;AACF;AAEO,SAASD,oBAAoBC,QAAgB;IAClD,OAAOA,aAAa,WAAWA,aAAa;AAC9C","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/is-serializable-props.d.ts b/e-commerce/node_modules/next/dist/lib/is-serializable-props.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..73f2ad693f2181f28728080f4232a510ed91968e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-serializable-props.d.ts @@ -0,0 +1,4 @@ +export declare class SerializableError extends Error { + constructor(page: string, method: string, path: string, message: string); +} +export declare function isSerializableProps(page: string, method: string, input: any): true; diff --git a/e-commerce/node_modules/next/dist/lib/is-serializable-props.js b/e-commerce/node_modules/next/dist/lib/is-serializable-props.js new file mode 100644 index 0000000000000000000000000000000000000000..9f3d9753aef36df3628b70a9d3d399a2b0ea7d7a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-serializable-props.js @@ -0,0 +1,82 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + SerializableError: null, + isSerializableProps: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + SerializableError: function() { + return SerializableError; + }, + isSerializableProps: function() { + return isSerializableProps; + } +}); +const _isplainobject = require("../shared/lib/is-plain-object"); +const regexpPlainIdentifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/; +class SerializableError extends Error { + constructor(page, method, path, message){ + super(path ? `Error serializing \`${path}\` returned from \`${method}\` in "${page}".\nReason: ${message}` : `Error serializing props returned from \`${method}\` in "${page}".\nReason: ${message}`); + } +} +function isSerializableProps(page, method, input) { + if (!(0, _isplainobject.isPlainObject)(input)) { + throw new SerializableError(page, method, '', `Props must be returned as a plain object from ${method}: \`{ props: { ... } }\` (received: \`${(0, _isplainobject.getObjectClassLabel)(input)}\`).`); + } + function visit(visited, value, path) { + if (visited.has(value)) { + throw new SerializableError(page, method, path, `Circular references cannot be expressed in JSON (references: \`${visited.get(value) || '(self)'}\`).`); + } + visited.set(value, path); + } + function isSerializable(refs, value, path) { + const type = typeof value; + if (// `null` can be serialized, but not `undefined`. + value === null || // n.b. `bigint`, `function`, `symbol`, and `undefined` cannot be + // serialized. + // + // `object` is special-cased below, as it may represent `null`, an Array, + // a plain object, a class, et al. + type === 'boolean' || type === 'number' || type === 'string') { + return true; + } + if (type === 'undefined') { + throw new SerializableError(page, method, path, '`undefined` cannot be serialized as JSON. Please use `null` or omit this value.'); + } + if ((0, _isplainobject.isPlainObject)(value)) { + visit(refs, value, path); + if (Object.entries(value).every(([key, nestedValue])=>{ + const nextPath = regexpPlainIdentifier.test(key) ? `${path}.${key}` : `${path}[${JSON.stringify(key)}]`; + const newRefs = new Map(refs); + return isSerializable(newRefs, key, nextPath) && isSerializable(newRefs, nestedValue, nextPath); + })) { + return true; + } + throw new SerializableError(page, method, path, `invariant: Unknown error encountered in Object.`); + } + if (Array.isArray(value)) { + visit(refs, value, path); + if (value.every((nestedValue, index)=>{ + const newRefs = new Map(refs); + return isSerializable(newRefs, nestedValue, `${path}[${index}]`); + })) { + return true; + } + throw new SerializableError(page, method, path, `invariant: Unknown error encountered in Array.`); + } + // None of these can be expressed as JSON: + // const type: "bigint" | "symbol" | "object" | "function" + throw new SerializableError(page, method, path, '`' + type + '`' + (type === 'object' ? ` ("${Object.prototype.toString.call(value)}")` : '') + ' cannot be serialized as JSON. Please only return JSON serializable data types.'); + } + return isSerializable(new Map(), input, ''); +} + +//# sourceMappingURL=is-serializable-props.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/is-serializable-props.js.map b/e-commerce/node_modules/next/dist/lib/is-serializable-props.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f7837fede0357605bbc0f2c939d9059d0b90a61c --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/is-serializable-props.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/is-serializable-props.ts"],"sourcesContent":["import {\n isPlainObject,\n getObjectClassLabel,\n} from '../shared/lib/is-plain-object'\n\nconst regexpPlainIdentifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/\n\nexport class SerializableError extends Error {\n constructor(page: string, method: string, path: string, message: string) {\n super(\n path\n ? `Error serializing \\`${path}\\` returned from \\`${method}\\` in \"${page}\".\\nReason: ${message}`\n : `Error serializing props returned from \\`${method}\\` in \"${page}\".\\nReason: ${message}`\n )\n }\n}\n\nexport function isSerializableProps(\n page: string,\n method: string,\n input: any\n): true {\n if (!isPlainObject(input)) {\n throw new SerializableError(\n page,\n method,\n '',\n `Props must be returned as a plain object from ${method}: \\`{ props: { ... } }\\` (received: \\`${getObjectClassLabel(\n input\n )}\\`).`\n )\n }\n\n function visit(visited: Map<any, string>, value: any, path: string) {\n if (visited.has(value)) {\n throw new SerializableError(\n page,\n method,\n path,\n `Circular references cannot be expressed in JSON (references: \\`${\n visited.get(value) || '(self)'\n }\\`).`\n )\n }\n\n visited.set(value, path)\n }\n\n function isSerializable(\n refs: Map<any, string>,\n value: any,\n path: string\n ): true {\n const type = typeof value\n if (\n // `null` can be serialized, but not `undefined`.\n value === null ||\n // n.b. `bigint`, `function`, `symbol`, and `undefined` cannot be\n // serialized.\n //\n // `object` is special-cased below, as it may represent `null`, an Array,\n // a plain object, a class, et al.\n type === 'boolean' ||\n type === 'number' ||\n type === 'string'\n ) {\n return true\n }\n\n if (type === 'undefined') {\n throw new SerializableError(\n page,\n method,\n path,\n '`undefined` cannot be serialized as JSON. Please use `null` or omit this value.'\n )\n }\n\n if (isPlainObject(value)) {\n visit(refs, value, path)\n\n if (\n Object.entries(value).every(([key, nestedValue]) => {\n const nextPath = regexpPlainIdentifier.test(key)\n ? `${path}.${key}`\n : `${path}[${JSON.stringify(key)}]`\n\n const newRefs = new Map(refs)\n return (\n isSerializable(newRefs, key, nextPath) &&\n isSerializable(newRefs, nestedValue, nextPath)\n )\n })\n ) {\n return true\n }\n\n throw new SerializableError(\n page,\n method,\n path,\n `invariant: Unknown error encountered in Object.`\n )\n }\n\n if (Array.isArray(value)) {\n visit(refs, value, path)\n\n if (\n value.every((nestedValue, index) => {\n const newRefs = new Map(refs)\n return isSerializable(newRefs, nestedValue, `${path}[${index}]`)\n })\n ) {\n return true\n }\n\n throw new SerializableError(\n page,\n method,\n path,\n `invariant: Unknown error encountered in Array.`\n )\n }\n\n // None of these can be expressed as JSON:\n // const type: \"bigint\" | \"symbol\" | \"object\" | \"function\"\n throw new SerializableError(\n page,\n method,\n path,\n '`' +\n type +\n '`' +\n (type === 'object'\n ? ` (\"${Object.prototype.toString.call(value)}\")`\n : '') +\n ' cannot be serialized as JSON. Please only return JSON serializable data types.'\n )\n }\n\n return isSerializable(new Map(), input, '')\n}\n"],"names":["SerializableError","isSerializableProps","regexpPlainIdentifier","Error","constructor","page","method","path","message","input","isPlainObject","getObjectClassLabel","visit","visited","value","has","get","set","isSerializable","refs","type","Object","entries","every","key","nestedValue","nextPath","test","JSON","stringify","newRefs","Map","Array","isArray","index","prototype","toString","call"],"mappings":";;;;;;;;;;;;;;;IAOaA,iBAAiB;eAAjBA;;IAUGC,mBAAmB;eAAnBA;;;+BAdT;AAEP,MAAMC,wBAAwB;AAEvB,MAAMF,0BAA0BG;IACrCC,YAAYC,IAAY,EAAEC,MAAc,EAAEC,IAAY,EAAEC,OAAe,CAAE;QACvE,KAAK,CACHD,OACI,CAAC,oBAAoB,EAAEA,KAAK,mBAAmB,EAAED,OAAO,OAAO,EAAED,KAAK,YAAY,EAAEG,SAAS,GAC7F,CAAC,wCAAwC,EAAEF,OAAO,OAAO,EAAED,KAAK,YAAY,EAAEG,SAAS;IAE/F;AACF;AAEO,SAASP,oBACdI,IAAY,EACZC,MAAc,EACdG,KAAU;IAEV,IAAI,CAACC,IAAAA,4BAAa,EA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,QAAQ;YACxBF,MAAMO,MAAML,OAAOP;YAEnB,IACEO,MAAMS,KAAK,CAAC,CAACE,aAAaS;gBACxB,MAAMJ,UAAU,IAAIC,IAAIZ;gBACxB,OAAOD,eAAeY,SAASL,aAAa,GAAGlB,KAAK,CAAC,EAAE2B,MAAM,CAAC,CAAC;YACjE,IACA;gBACA,OAAO;YACT;YAEA,MAAM,IAAIlC,kBACRK,MACAC,QACAC,MACA,CAAC,8CAA8C,CAAC;QAEpD;QAEA,0CAA0C;QAC1C,0DAA0D;QAC1D,MAAM,IAAIP,kBACRK,MACAC,QACAC,MACA,MACEa,OACA,MACCA,CAAAA,SAAS,WACN,CAAC,GAAG,EAAEC,OAAOc,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACvB,OAAO,EAAE,CAAC,GAC/C,EAAC,IACL;IAEN;IAEA,OAAOI,eAAe,IAAIa,OAAOtB,OAAO;AAC1C","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/known-edge-safe-packages.json b/e-commerce/node_modules/next/dist/lib/known-edge-safe-packages.json new file mode 100644 index 0000000000000000000000000000000000000000..be767c48edc8b208bcee72aff519f31d29d1d7a3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/known-edge-safe-packages.json @@ -0,0 +1 @@ +["function-bind"] diff --git a/e-commerce/node_modules/next/dist/lib/load-custom-routes.d.ts b/e-commerce/node_modules/next/dist/lib/load-custom-routes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5f3cf44b7caf9bc7d23607c0783db8f097536676 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/load-custom-routes.d.ts @@ -0,0 +1,64 @@ +import type { NextConfig } from '../server/config'; +export type RouteHas = { + type: 'header' | 'cookie' | 'query'; + key: string; + value?: string; +} | { + type: 'host'; + key?: undefined; + value: string; +}; +export type Rewrite = { + source: string; + destination: string; + basePath?: false; + locale?: false; + has?: RouteHas[]; + missing?: RouteHas[]; +}; +export type Header = { + source: string; + basePath?: false; + locale?: false; + headers: Array<{ + key: string; + value: string; + }>; + has?: RouteHas[]; + missing?: RouteHas[]; +}; +export type Redirect = { + source: string; + destination: string; + basePath?: false; + locale?: false; + has?: RouteHas[]; + missing?: RouteHas[]; + priority?: boolean; +} & ({ + statusCode?: never; + permanent: boolean; +} | { + statusCode: number; + permanent?: never; +}); +export type Middleware = { + source: string; + locale?: false; + has?: RouteHas[]; + missing?: RouteHas[]; +}; +export declare function normalizeRouteRegex(regex: string): string; +export type RouteType = 'rewrite' | 'redirect' | 'header'; +export declare function checkCustomRoutes(routes: Redirect[] | Header[] | Rewrite[] | Middleware[], type: RouteType | 'middleware'): void; +export interface CustomRoutes { + headers: Header[]; + onMatchHeaders: Header[]; + rewrites: { + fallback: Rewrite[]; + afterFiles: Rewrite[]; + beforeFiles: Rewrite[]; + }; + redirects: Redirect[]; +} +export default function loadCustomRoutes(config: NextConfig): Promise<CustomRoutes>; diff --git a/e-commerce/node_modules/next/dist/lib/load-custom-routes.js b/e-commerce/node_modules/next/dist/lib/load-custom-routes.js new file mode 100644 index 0000000000000000000000000000000000000000..6f29316fe254a044dc5c0aedd4250a6aae165139 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/load-custom-routes.js @@ -0,0 +1,594 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + checkCustomRoutes: null, + default: null, + normalizeRouteRegex: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + checkCustomRoutes: function() { + return checkCustomRoutes; + }, + default: function() { + return loadCustomRoutes; + }, + normalizeRouteRegex: function() { + return normalizeRouteRegex; + } +}); +const _picocolors = require("./picocolors"); +const _escaperegexp = require("../shared/lib/escape-regexp"); +const _trytoparsepath = require("./try-to-parse-path"); +const _redirectstatus = require("./redirect-status"); +const _url = require("./url"); +const _constants = require("./constants"); +const allowedHasTypes = new Set([ + 'header', + 'cookie', + 'query', + 'host' +]); +const namedGroupsRegex = /\(\?<([a-zA-Z][a-zA-Z0-9]*)>/g; +function normalizeRouteRegex(regex) { + // clean up un-necessary escaping from regex.source which turns / into \\/ + return regex.replace(/\\\//g, '/'); +} +function checkRedirect(route) { + const invalidParts = []; + let hadInvalidStatus = false; + if (route.statusCode && !_redirectstatus.allowedStatusCodes.has(route['statusCode'])) { + hadInvalidStatus = true; + invalidParts.push(`\`statusCode\` is not undefined or valid statusCode`); + } + if (typeof route.permanent !== 'boolean' && !route['statusCode']) { + invalidParts.push(`\`permanent\` is not set to \`true\` or \`false\``); + } + return { + invalidParts, + hadInvalidStatus + }; +} +function checkHeader(route) { + const invalidParts = []; + if (!Array.isArray(route.headers)) { + invalidParts.push('`headers` field must be an array'); + } else if (route.headers.length === 0) { + invalidParts.push('`headers` field cannot be empty'); + } else { + for (const header of route.headers){ + if (!header || typeof header !== 'object') { + invalidParts.push("`headers` items must be object with { key: '', value: '' }"); + break; + } + if (typeof header.key !== 'string') { + invalidParts.push('`key` in header item must be string'); + break; + } + if (typeof header.value !== 'string') { + invalidParts.push('`value` in header item must be string'); + break; + } + } + } + return invalidParts; +} +function checkCustomRoutes(routes, type) { + if (!Array.isArray(routes)) { + console.error(`Error: ${type}s must return an array, received ${typeof routes}.\n` + `See here for more info: https://nextjs.org/docs/messages/routes-must-be-array`); + process.exit(1); + } + let numInvalidRoutes = 0; + let hadInvalidStatus = false; + let hadInvalidHas = false; + let hadInvalidMissing = false; + const allowedKeys = new Set([ + 'source', + 'locale', + 'has', + 'missing' + ]); + if (type === 'rewrite') { + allowedKeys.add('basePath'); + allowedKeys.add('destination'); + } + if (type === 'redirect') { + allowedKeys.add('basePath'); + allowedKeys.add('statusCode'); + allowedKeys.add('permanent'); + allowedKeys.add('destination'); + } + if (type === 'header') { + allowedKeys.add('basePath'); + allowedKeys.add('headers'); + } + for (const route of routes){ + if (!route || typeof route !== 'object') { + console.error(`The route ${JSON.stringify(route)} is not a valid object with \`source\`${type !== 'middleware' ? ` and \`${type === 'header' ? 'headers' : 'destination'}\`` : ''}`); + numInvalidRoutes++; + continue; + } + if (type === 'rewrite' && route.basePath === false && !(route.destination.startsWith('http://') || route.destination.startsWith('https://'))) { + console.error(`The route ${route.source} rewrites urls outside of the basePath. Please use a destination that starts with \`http://\` or \`https://\` https://nextjs.org/docs/messages/invalid-external-rewrite`); + numInvalidRoutes++; + continue; + } + const keys = Object.keys(route); + const invalidKeys = keys.filter((key)=>!allowedKeys.has(key)); + const invalidParts = []; + if ('basePath' in route && typeof route.basePath !== 'undefined' && route.basePath !== false) { + invalidParts.push('`basePath` must be undefined or false'); + } + if (typeof route.locale !== 'undefined' && route.locale !== false) { + invalidParts.push('`locale` must be undefined or false'); + } + const checkInvalidHasMissing = (items, fieldName)=>{ + let hadInvalidItem = false; + if (typeof items !== 'undefined' && !Array.isArray(items)) { + invalidParts.push(`\`${fieldName}\` must be undefined or valid has object`); + hadInvalidItem = true; + } else if (items) { + const invalidHasItems = []; + for (const hasItem of items){ + let invalidHasParts = []; + if (!allowedHasTypes.has(hasItem.type)) { + invalidHasParts.push(`invalid type "${hasItem.type}"`); + } + if (typeof hasItem.key !== 'string' && hasItem.type !== 'host') { + invalidHasParts.push(`invalid key "${hasItem.key}"`); + } + if (typeof hasItem.value !== 'undefined' && typeof hasItem.value !== 'string') { + invalidHasParts.push(`invalid value "${hasItem.value}"`); + } + if (typeof hasItem.value === 'undefined' && hasItem.type === 'host') { + invalidHasParts.push(`value is required for "host" type`); + } + if (invalidHasParts.length > 0) { + invalidHasItems.push(`${invalidHasParts.join(', ')} for ${JSON.stringify(hasItem)}`); + } + } + if (invalidHasItems.length > 0) { + hadInvalidItem = true; + const itemStr = `item${invalidHasItems.length === 1 ? '' : 's'}`; + console.error(`Invalid \`${fieldName}\` ${itemStr}:\n` + invalidHasItems.join('\n')); + console.error(); + invalidParts.push(`invalid \`${fieldName}\` ${itemStr} found`); + } + } + return hadInvalidItem; + }; + if (checkInvalidHasMissing(route.has, 'has')) { + hadInvalidHas = true; + } + if (checkInvalidHasMissing(route.missing, 'missing')) { + hadInvalidMissing = true; + } + if (!route.source) { + invalidParts.push('`source` is missing'); + } else if (typeof route.source !== 'string') { + invalidParts.push('`source` is not a string'); + } else if (!route.source.startsWith('/')) { + invalidParts.push('`source` does not start with /'); + } + if (type === 'header') { + invalidParts.push(...checkHeader(route)); + } else if (type !== 'middleware') { + let _route = route; + if (!_route.destination) { + invalidParts.push('`destination` is missing'); + } else if (typeof _route.destination !== 'string') { + invalidParts.push('`destination` is not a string'); + } else if (type === 'rewrite' && !_route.destination.match(/^(\/|https:\/\/|http:\/\/)/)) { + invalidParts.push('`destination` does not start with `/`, `http://`, or `https://`'); + } + } + if (type === 'redirect') { + const result = checkRedirect(route); + hadInvalidStatus = hadInvalidStatus || result.hadInvalidStatus; + invalidParts.push(...result.invalidParts); + } + let sourceTokens; + if (typeof route.source === 'string' && route.source.startsWith('/')) { + // only show parse error if we didn't already show error + // for not being a string + const { tokens, error, regexStr } = (0, _trytoparsepath.tryToParsePath)(route.source); + if (error) { + invalidParts.push('`source` parse failed'); + } + if (regexStr && regexStr.length > 4096) { + invalidParts.push('`source` exceeds max built length of 4096'); + } + sourceTokens = tokens; + } + const hasSegments = new Set(); + if (route.has) { + for (const hasItem of route.has){ + if (!hasItem.value && hasItem.key) { + hasSegments.add(hasItem.key); + } + if (hasItem.value) { + for (const match of hasItem.value.matchAll(namedGroupsRegex)){ + if (match[1]) { + hasSegments.add(match[1]); + } + } + if (hasItem.type === 'host') { + hasSegments.add('host'); + } + } + } + } + // make sure no unnamed patterns are attempted to be used in the + // destination as this can cause confusion and is not allowed + if (typeof route.destination === 'string') { + if (route.destination.startsWith('/') && Array.isArray(sourceTokens)) { + const unnamedInDest = new Set(); + for (const token of sourceTokens){ + if (typeof token === 'object' && typeof token.name === 'number') { + const unnamedIndex = new RegExp(`:${token.name}(?!\\d)`); + if (route.destination.match(unnamedIndex)) { + unnamedInDest.add(`:${token.name}`); + } + } + } + if (unnamedInDest.size > 0) { + invalidParts.push(`\`destination\` has unnamed params ${[ + ...unnamedInDest + ].join(', ')}`); + } else { + const { tokens: destTokens, regexStr: destRegexStr, error: destinationParseFailed } = (0, _trytoparsepath.tryToParsePath)(route.destination, { + handleUrl: true + }); + if (destRegexStr && destRegexStr.length > 4096) { + invalidParts.push('`destination` exceeds max built length of 4096'); + } + if (destinationParseFailed) { + invalidParts.push('`destination` parse failed'); + } else { + const sourceSegments = new Set(sourceTokens.map((item)=>typeof item === 'object' && item.name).filter(Boolean)); + const invalidDestSegments = new Set(); + for (const token of destTokens){ + if (typeof token === 'object' && !sourceSegments.has(token.name) && !hasSegments.has(token.name)) { + invalidDestSegments.add(token.name); + } + } + if (invalidDestSegments.size) { + invalidParts.push(`\`destination\` has segments not in \`source\` or \`has\` (${[ + ...invalidDestSegments + ].join(', ')})`); + } + } + } + } + } + const hasInvalidKeys = invalidKeys.length > 0; + const hasInvalidParts = invalidParts.length > 0; + if (hasInvalidKeys || hasInvalidParts) { + console.error(`${invalidParts.join(', ')}${invalidKeys.length ? (hasInvalidParts ? ',' : '') + ` invalid field${invalidKeys.length === 1 ? '' : 's'}: ` + invalidKeys.join(',') : ''} for route ${JSON.stringify(route)}`); + console.error(); + numInvalidRoutes++; + } + } + if (numInvalidRoutes > 0) { + if (hadInvalidStatus) { + console.error(`\nValid redirect statusCode values are ${[ + ..._redirectstatus.allowedStatusCodes + ].join(', ')}`); + } + if (hadInvalidHas) { + console.error(`\nValid \`has\` object shape is ${JSON.stringify({ + type: [ + ...allowedHasTypes + ].join(', '), + key: 'the key to check for', + value: 'undefined or a value string to match against' + }, null, 2)}`); + } + if (hadInvalidMissing) { + console.error(`\nValid \`missing\` object shape is ${JSON.stringify({ + type: [ + ...allowedHasTypes + ].join(', '), + key: 'the key to check for', + value: 'undefined or a value string to match against' + }, null, 2)}`); + } + console.error(); + console.error(`Error: Invalid ${type}${numInvalidRoutes === 1 ? '' : 's'} found`); + process.exit(1); + } +} +function processRoutes(routes, config, type) { + const _routes = routes; + const newRoutes = []; + const defaultLocales = []; + if (config.i18n && type === 'redirect') { + var _config_i18n; + for (const item of ((_config_i18n = config.i18n) == null ? void 0 : _config_i18n.domains) || []){ + defaultLocales.push({ + locale: item.defaultLocale, + base: `http${item.http ? '' : 's'}://${item.domain}` + }); + } + defaultLocales.push({ + locale: config.i18n.defaultLocale, + base: '' + }); + } + for (const r of _routes){ + var _r_destination; + const srcBasePath = config.basePath && r.basePath !== false ? config.basePath : ''; + const isExternal = !((_r_destination = r.destination) == null ? void 0 : _r_destination.startsWith('/')); + const destBasePath = srcBasePath && !isExternal ? srcBasePath : ''; + if (config.i18n && r.locale !== false) { + var _r_destination1; + if (!isExternal) { + defaultLocales.forEach((item)=>{ + let destination; + if (r.destination) { + destination = item.base ? `${item.base}${destBasePath}${r.destination}` : `${destBasePath}${r.destination}`; + } + newRoutes.push({ + ...r, + destination, + source: `${srcBasePath}/${item.locale}${r.source === '/' && !config.trailingSlash ? '' : r.source}` + }); + }); + } + r.source = `/:nextInternalLocale(${config.i18n.locales.map((locale)=>(0, _escaperegexp.escapeStringRegexp)(locale)).join('|')})${r.source === '/' && !config.trailingSlash ? '' : r.source}`; + if (r.destination && ((_r_destination1 = r.destination) == null ? void 0 : _r_destination1.startsWith('/'))) { + r.destination = `/:nextInternalLocale${r.destination === '/' && !config.trailingSlash ? '' : r.destination}`; + } + } + r.source = `${srcBasePath}${r.source === '/' && srcBasePath ? '' : r.source}`; + if (r.destination) { + r.destination = `${destBasePath}${r.destination === '/' && destBasePath ? '' : r.destination}`; + } + newRoutes.push(r); + } + return newRoutes; +} +async function loadRedirects(config) { + if (typeof config.redirects !== 'function') { + return []; + } + let redirects = await config.redirects(); + // check before we process the routes and after to ensure + // they are still valid + checkCustomRoutes(redirects, 'redirect'); + // save original redirects before transforms + if (Array.isArray(redirects)) { + config._originalRedirects = redirects.map((r)=>({ + ...r + })); + } + redirects = processRoutes(redirects, config, 'redirect'); + checkCustomRoutes(redirects, 'redirect'); + return redirects; +} +async function loadRewrites(config) { + // If assetPrefix is set, add a rewrite for `/${assetPrefix}/_next/*` + // requests so that they are handled in any of dev, start, or deploy + // automatically without the user having to configure this. + // If the assetPrefix is an absolute URL, we still consider the path for automatic rewrite. + // but hostname routing must be handled by the user + let maybeAssetPrefixRewrite = []; + if (config.assetPrefix) { + let prefix = config.assetPrefix; + if ((0, _url.isFullStringUrl)(config.assetPrefix) && URL.canParse(config.assetPrefix)) { + prefix = new URL(config.assetPrefix).pathname; + } + if (prefix && prefix !== '/') { + const assetPrefix = prefix.startsWith('/') ? prefix : `/${prefix}`; + const basePath = config.basePath || ''; + // If these are the same, then this would result in an infinite rewrite. + if (assetPrefix !== basePath) { + maybeAssetPrefixRewrite.push({ + source: `${assetPrefix}/_next/:path+`, + destination: `${basePath}/_next/:path+` + }); + } + } + } + if (typeof config.rewrites !== 'function') { + return { + beforeFiles: [ + ...maybeAssetPrefixRewrite + ], + afterFiles: [], + fallback: [] + }; + } + const _rewrites = await config.rewrites(); + let beforeFiles = []; + let afterFiles = []; + let fallback = []; + if (!Array.isArray(_rewrites) && typeof _rewrites === 'object' && Object.keys(_rewrites).every((key)=>key === 'beforeFiles' || key === 'afterFiles' || key === 'fallback')) { + beforeFiles = _rewrites.beforeFiles || []; + afterFiles = _rewrites.afterFiles || []; + fallback = _rewrites.fallback || []; + } else { + afterFiles = _rewrites; + } + // check before we process the routes and after to ensure + // they are still valid + checkCustomRoutes(beforeFiles, 'rewrite'); + checkCustomRoutes(afterFiles, 'rewrite'); + checkCustomRoutes(fallback, 'rewrite'); + // save original rewrites before transforms + config._originalRewrites = { + beforeFiles: beforeFiles.map((r)=>({ + ...r + })), + afterFiles: afterFiles.map((r)=>({ + ...r + })), + fallback: fallback.map((r)=>({ + ...r + })) + }; + beforeFiles = [ + ...maybeAssetPrefixRewrite, + ...processRoutes(beforeFiles, config, 'rewrite') + ]; + afterFiles = processRoutes(afterFiles, config, 'rewrite'); + fallback = processRoutes(fallback, config, 'rewrite'); + checkCustomRoutes(beforeFiles, 'rewrite'); + checkCustomRoutes(afterFiles, 'rewrite'); + checkCustomRoutes(fallback, 'rewrite'); + return { + beforeFiles, + afterFiles, + fallback + }; +} +async function loadHeaders(config) { + if (typeof config.headers !== 'function') { + return []; + } + let headers = await config.headers(); + // check before we process the routes and after to ensure + // they are still valid + checkCustomRoutes(headers, 'header'); + headers = processRoutes(headers, config, 'header'); + checkCustomRoutes(headers, 'header'); + return headers; +} +async function loadCustomRoutes(config) { + const [headers, rewrites, redirects] = await Promise.all([ + loadHeaders(config), + loadRewrites(config), + loadRedirects(config) + ]); + const onMatchHeaders = []; + const totalRewrites = rewrites.beforeFiles.length + rewrites.afterFiles.length + rewrites.fallback.length; + const totalRoutes = headers.length + redirects.length + totalRewrites; + if (totalRoutes > 1000) { + console.warn((0, _picocolors.bold)((0, _picocolors.yellow)(`Warning: `)) + `total number of custom routes exceeds 1000, this can reduce performance. Route counts:\n` + `headers: ${headers.length}\n` + `rewrites: ${totalRewrites}\n` + `redirects: ${redirects.length}\n` + `See more info: https://nextjs.org/docs/messages/max-custom-routes-reached`); + } + const cacheControlSources = []; + for (const headerRoute of headers){ + if (!headerRoute.source.startsWith('/_next/')) { + continue; + } + for (const header of headerRoute.headers){ + if (header.key.toLowerCase() === 'cache-control') { + cacheControlSources.push(headerRoute.source); + break; + } + } + } + if (cacheControlSources.length > 0) { + console.warn((0, _picocolors.bold)((0, _picocolors.yellow)(`Warning: `)) + `Custom Cache-Control headers detected for the following routes:\n` + cacheControlSources.map((source)=>` - ${source}`).join('\n') + `\n\nSetting a custom Cache-Control header can break Next.js development behavior.`); + } + if (config.deploymentId) { + var _config_experimental; + if ((_config_experimental = config.experimental) == null ? void 0 : _config_experimental.useSkewCookie) { + headers.unshift({ + source: '/:path*', + headers: [ + { + key: 'Set-Cookie', + value: `__vdpl=${config.deploymentId}; Path=/; HttpOnly` + } + ] + }); + } + onMatchHeaders.push({ + source: '/:path*', + has: [ + { + type: 'header', + key: 'rsc', + value: '1' + } + ], + headers: [ + { + key: _constants.NEXT_NAV_DEPLOYMENT_ID_HEADER, + value: config.deploymentId + } + ] + }, { + source: '/_next/data/(.*)', + headers: [ + { + key: _constants.NEXT_NAV_DEPLOYMENT_ID_HEADER, + value: config.deploymentId + } + ] + }); + } + if (!config.skipTrailingSlashRedirect) { + if (config.trailingSlash) { + redirects.unshift({ + source: '/:file((?!\\.well-known(?:/.*)?)(?:[^/]+/)*[^/]+\\.\\w+)/', + destination: '/:file', + permanent: true, + locale: config.i18n ? false : undefined, + internal: true, + priority: true, + // don't run this redirect for _next/data requests + missing: [ + { + type: 'header', + key: 'x-nextjs-data' + } + ] + }, { + source: '/:notfile((?!\\.well-known(?:/.*)?)(?:[^/]+/)*[^/\\.]+)', + destination: '/:notfile/', + permanent: true, + locale: config.i18n ? false : undefined, + internal: true, + priority: true + }); + if (config.basePath) { + redirects.unshift({ + source: config.basePath, + destination: config.basePath + '/', + permanent: true, + basePath: false, + locale: config.i18n ? false : undefined, + internal: true, + priority: true + }); + } + } else { + redirects.unshift({ + source: '/:path+/', + destination: '/:path+', + permanent: true, + locale: config.i18n ? false : undefined, + internal: true, + priority: true + }); + if (config.basePath) { + redirects.unshift({ + source: config.basePath + '/', + destination: config.basePath, + permanent: true, + basePath: false, + locale: config.i18n ? false : undefined, + internal: true, + priority: true + }); + } + } + } + return { + headers, + onMatchHeaders, + rewrites, + redirects + }; +} + +//# sourceMappingURL=load-custom-routes.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/load-custom-routes.js.map b/e-commerce/node_modules/next/dist/lib/load-custom-routes.js.map new file mode 100644 index 0000000000000000000000000000000000000000..342651280b4542a7892f81d5ec1eb53573df69ff --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/load-custom-routes.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/load-custom-routes.ts"],"sourcesContent":["import type { NextConfig } from '../server/config'\nimport type { Token } from 'next/dist/compiled/path-to-regexp'\n\nimport { bold, yellow } from './picocolors'\nimport { escapeStringRegexp } from '../shared/lib/escape-regexp'\nimport { tryToParsePath } from './try-to-parse-path'\nimport { allowedStatusCodes } from './redirect-status'\nimport { isFullStringUrl } from './url'\nimport { NEXT_NAV_DEPLOYMENT_ID_HEADER } from './constants'\n\nexport type RouteHas =\n | {\n type: 'header' | 'cookie' | 'query'\n key: string\n value?: string\n }\n | {\n type: 'host'\n key?: undefined\n value: string\n }\n\nexport type Rewrite = {\n source: string\n destination: string\n basePath?: false\n locale?: false\n has?: RouteHas[]\n missing?: RouteHas[]\n\n /**\n * @internal - used internally for routing\n */\n internal?: boolean\n\n /**\n * @internal - used internally for routing\n */\n regex?: string\n}\n\nexport type Header = {\n source: string\n basePath?: false\n locale?: false\n headers: Array<{ key: string; value: string }>\n has?: RouteHas[]\n missing?: RouteHas[]\n\n /**\n * @internal - used internally for routing\n */\n internal?: boolean\n}\n\n// internal type used for validation (not user facing)\nexport type Redirect = {\n source: string\n destination: string\n basePath?: false\n locale?: false\n has?: RouteHas[]\n missing?: RouteHas[]\n priority?: boolean\n\n /**\n * @internal - used internally for routing\n */\n internal?: boolean\n} & (\n | {\n statusCode?: never\n permanent: boolean\n }\n | {\n statusCode: number\n permanent?: never\n }\n)\n\nexport type Middleware = {\n source: string\n locale?: false\n has?: RouteHas[]\n missing?: RouteHas[]\n}\n\nconst allowedHasTypes = new Set(['header', 'cookie', 'query', 'host'])\nconst namedGroupsRegex = /\\(\\?<([a-zA-Z][a-zA-Z0-9]*)>/g\n\nexport function normalizeRouteRegex(regex: string) {\n // clean up un-necessary escaping from regex.source which turns / into \\\\/\n return regex.replace(/\\\\\\//g, '/')\n}\n\nfunction checkRedirect(route: Redirect): {\n invalidParts: string[]\n hadInvalidStatus: boolean\n} {\n const invalidParts: string[] = []\n let hadInvalidStatus: boolean = false\n\n if (route.statusCode && !allowedStatusCodes.has(route['statusCode'])) {\n hadInvalidStatus = true\n invalidParts.push(`\\`statusCode\\` is not undefined or valid statusCode`)\n }\n if (typeof route.permanent !== 'boolean' && !route['statusCode']) {\n invalidParts.push(`\\`permanent\\` is not set to \\`true\\` or \\`false\\``)\n }\n\n return {\n invalidParts,\n hadInvalidStatus,\n }\n}\n\nfunction checkHeader(route: Header): string[] {\n const invalidParts: string[] = []\n\n if (!Array.isArray(route.headers)) {\n invalidParts.push('`headers` field must be an array')\n } else if (route.headers.length === 0) {\n invalidParts.push('`headers` field cannot be empty')\n } else {\n for (const header of route.headers) {\n if (!header || typeof header !== 'object') {\n invalidParts.push(\n \"`headers` items must be object with { key: '', value: '' }\"\n )\n break\n }\n if (typeof header.key !== 'string') {\n invalidParts.push('`key` in header item must be string')\n break\n }\n if (typeof header.value !== 'string') {\n invalidParts.push('`value` in header item must be string')\n break\n }\n }\n }\n return invalidParts\n}\n\nexport type RouteType = 'rewrite' | 'redirect' | 'header'\n\nexport function checkCustomRoutes(\n routes: Redirect[] | Header[] | Rewrite[] | Middleware[],\n type: RouteType | 'middleware'\n): void {\n if (!Array.isArray(routes)) {\n console.error(\n `Error: ${type}s must return an array, received ${typeof routes}.\\n` +\n `See here for more info: https://nextjs.org/docs/messages/routes-must-be-array`\n )\n process.exit(1)\n }\n\n let numInvalidRoutes = 0\n let hadInvalidStatus = false\n let hadInvalidHas = false\n let hadInvalidMissing = false\n\n const allowedKeys = new Set<string>(['source', 'locale', 'has', 'missing'])\n\n if (type === 'rewrite') {\n allowedKeys.add('basePath')\n allowedKeys.add('destination')\n }\n if (type === 'redirect') {\n allowedKeys.add('basePath')\n allowedKeys.add('statusCode')\n allowedKeys.add('permanent')\n allowedKeys.add('destination')\n }\n if (type === 'header') {\n allowedKeys.add('basePath')\n allowedKeys.add('headers')\n }\n\n for (const route of routes) {\n if (!route || typeof route !== 'object') {\n console.error(\n `The route ${JSON.stringify(\n route\n )} is not a valid object with \\`source\\`${\n type !== 'middleware'\n ? ` and \\`${type === 'header' ? 'headers' : 'destination'}\\``\n : ''\n }`\n )\n numInvalidRoutes++\n continue\n }\n\n if (\n type === 'rewrite' &&\n (route as Rewrite).basePath === false &&\n !(\n (route as Rewrite).destination.startsWith('http://') ||\n (route as Rewrite).destination.startsWith('https://')\n )\n ) {\n console.error(\n `The route ${\n (route as Rewrite).source\n } rewrites urls outside of the basePath. Please use a destination that starts with \\`http://\\` or \\`https://\\` https://nextjs.org/docs/messages/invalid-external-rewrite`\n )\n numInvalidRoutes++\n continue\n }\n\n const keys = Object.keys(route)\n const invalidKeys = keys.filter((key) => !allowedKeys.has(key))\n const invalidParts: string[] = []\n\n if (\n 'basePath' in route &&\n typeof route.basePath !== 'undefined' &&\n route.basePath !== false\n ) {\n invalidParts.push('`basePath` must be undefined or false')\n }\n\n if (typeof route.locale !== 'undefined' && route.locale !== false) {\n invalidParts.push('`locale` must be undefined or false')\n }\n\n const checkInvalidHasMissing = (\n items: any,\n fieldName: 'has' | 'missing'\n ) => {\n let hadInvalidItem = false\n\n if (typeof items !== 'undefined' && !Array.isArray(items)) {\n invalidParts.push(\n `\\`${fieldName}\\` must be undefined or valid has object`\n )\n hadInvalidItem = true\n } else if (items) {\n const invalidHasItems = []\n\n for (const hasItem of items) {\n let invalidHasParts = []\n\n if (!allowedHasTypes.has(hasItem.type)) {\n invalidHasParts.push(`invalid type \"${hasItem.type}\"`)\n }\n if (typeof hasItem.key !== 'string' && hasItem.type !== 'host') {\n invalidHasParts.push(`invalid key \"${hasItem.key}\"`)\n }\n if (\n typeof hasItem.value !== 'undefined' &&\n typeof hasItem.value !== 'string'\n ) {\n invalidHasParts.push(`invalid value \"${hasItem.value}\"`)\n }\n if (typeof hasItem.value === 'undefined' && hasItem.type === 'host') {\n invalidHasParts.push(`value is required for \"host\" type`)\n }\n\n if (invalidHasParts.length > 0) {\n invalidHasItems.push(\n `${invalidHasParts.join(', ')} for ${JSON.stringify(hasItem)}`\n )\n }\n }\n\n if (invalidHasItems.length > 0) {\n hadInvalidItem = true\n const itemStr = `item${invalidHasItems.length === 1 ? '' : 's'}`\n\n console.error(\n `Invalid \\`${fieldName}\\` ${itemStr}:\\n` +\n invalidHasItems.join('\\n')\n )\n console.error()\n invalidParts.push(`invalid \\`${fieldName}\\` ${itemStr} found`)\n }\n }\n return hadInvalidItem\n }\n if (checkInvalidHasMissing(route.has, 'has')) {\n hadInvalidHas = true\n }\n if (checkInvalidHasMissing(route.missing, 'missing')) {\n hadInvalidMissing = true\n }\n\n if (!route.source) {\n invalidParts.push('`source` is missing')\n } else if (typeof route.source !== 'string') {\n invalidParts.push('`source` is not a string')\n } else if (!route.source.startsWith('/')) {\n invalidParts.push('`source` does not start with /')\n }\n\n if (type === 'header') {\n invalidParts.push(...checkHeader(route as Header))\n } else if (type !== 'middleware') {\n let _route = route as Rewrite | Redirect\n if (!_route.destination) {\n invalidParts.push('`destination` is missing')\n } else if (typeof _route.destination !== 'string') {\n invalidParts.push('`destination` is not a string')\n } else if (\n type === 'rewrite' &&\n !_route.destination.match(/^(\\/|https:\\/\\/|http:\\/\\/)/)\n ) {\n invalidParts.push(\n '`destination` does not start with `/`, `http://`, or `https://`'\n )\n }\n }\n\n if (type === 'redirect') {\n const result = checkRedirect(route as Redirect)\n hadInvalidStatus = hadInvalidStatus || result.hadInvalidStatus\n invalidParts.push(...result.invalidParts)\n }\n\n let sourceTokens: Token[] | undefined\n\n if (typeof route.source === 'string' && route.source.startsWith('/')) {\n // only show parse error if we didn't already show error\n // for not being a string\n const { tokens, error, regexStr } = tryToParsePath(route.source)\n\n if (error) {\n invalidParts.push('`source` parse failed')\n }\n\n if (regexStr && regexStr.length > 4096) {\n invalidParts.push('`source` exceeds max built length of 4096')\n }\n\n sourceTokens = tokens\n }\n const hasSegments = new Set<string>()\n\n if (route.has) {\n for (const hasItem of route.has) {\n if (!hasItem.value && hasItem.key) {\n hasSegments.add(hasItem.key)\n }\n\n if (hasItem.value) {\n for (const match of hasItem.value.matchAll(namedGroupsRegex)) {\n if (match[1]) {\n hasSegments.add(match[1])\n }\n }\n\n if (hasItem.type === 'host') {\n hasSegments.add('host')\n }\n }\n }\n }\n\n // make sure no unnamed patterns are attempted to be used in the\n // destination as this can cause confusion and is not allowed\n if (typeof (route as Rewrite).destination === 'string') {\n if (\n (route as Rewrite).destination.startsWith('/') &&\n Array.isArray(sourceTokens)\n ) {\n const unnamedInDest = new Set()\n\n for (const token of sourceTokens) {\n if (typeof token === 'object' && typeof token.name === 'number') {\n const unnamedIndex = new RegExp(`:${token.name}(?!\\\\d)`)\n if ((route as Rewrite).destination.match(unnamedIndex)) {\n unnamedInDest.add(`:${token.name}`)\n }\n }\n }\n\n if (unnamedInDest.size > 0) {\n invalidParts.push(\n `\\`destination\\` has unnamed params ${[...unnamedInDest].join(\n ', '\n )}`\n )\n } else {\n const {\n tokens: destTokens,\n regexStr: destRegexStr,\n error: destinationParseFailed,\n } = tryToParsePath((route as Rewrite).destination, {\n handleUrl: true,\n })\n\n if (destRegexStr && destRegexStr.length > 4096) {\n invalidParts.push('`destination` exceeds max built length of 4096')\n }\n\n if (destinationParseFailed) {\n invalidParts.push('`destination` parse failed')\n } else {\n const sourceSegments = new Set(\n sourceTokens\n .map((item) => typeof item === 'object' && item.name)\n .filter(Boolean)\n )\n const invalidDestSegments = new Set()\n\n for (const token of destTokens!) {\n if (\n typeof token === 'object' &&\n !sourceSegments.has(token.name) &&\n !hasSegments.has(token.name as string)\n ) {\n invalidDestSegments.add(token.name)\n }\n }\n\n if (invalidDestSegments.size) {\n invalidParts.push(\n `\\`destination\\` has segments not in \\`source\\` or \\`has\\` (${[\n ...invalidDestSegments,\n ].join(', ')})`\n )\n }\n }\n }\n }\n }\n\n const hasInvalidKeys = invalidKeys.length > 0\n const hasInvalidParts = invalidParts.length > 0\n\n if (hasInvalidKeys || hasInvalidParts) {\n console.error(\n `${invalidParts.join(', ')}${\n invalidKeys.length\n ? (hasInvalidParts ? ',' : '') +\n ` invalid field${invalidKeys.length === 1 ? '' : 's'}: ` +\n invalidKeys.join(',')\n : ''\n } for route ${JSON.stringify(route)}`\n )\n console.error()\n numInvalidRoutes++\n }\n }\n\n if (numInvalidRoutes > 0) {\n if (hadInvalidStatus) {\n console.error(\n `\\nValid redirect statusCode values are ${[...allowedStatusCodes].join(\n ', '\n )}`\n )\n }\n if (hadInvalidHas) {\n console.error(\n `\\nValid \\`has\\` object shape is ${JSON.stringify(\n {\n type: [...allowedHasTypes].join(', '),\n key: 'the key to check for',\n value: 'undefined or a value string to match against',\n },\n null,\n 2\n )}`\n )\n }\n if (hadInvalidMissing) {\n console.error(\n `\\nValid \\`missing\\` object shape is ${JSON.stringify(\n {\n type: [...allowedHasTypes].join(', '),\n key: 'the key to check for',\n value: 'undefined or a value string to match against',\n },\n null,\n 2\n )}`\n )\n }\n console.error()\n console.error(\n `Error: Invalid ${type}${numInvalidRoutes === 1 ? '' : 's'} found`\n )\n process.exit(1)\n }\n}\n\nexport interface CustomRoutes {\n headers: Header[]\n onMatchHeaders: Header[]\n rewrites: {\n fallback: Rewrite[]\n afterFiles: Rewrite[]\n beforeFiles: Rewrite[]\n }\n redirects: Redirect[]\n}\n\nfunction processRoutes<T>(\n routes: T,\n config: NextConfig,\n type: 'redirect' | 'rewrite' | 'header'\n): T {\n const _routes = routes as any as Array<{\n source: string\n locale?: false\n basePath?: false\n destination?: string\n }>\n const newRoutes: typeof _routes = []\n const defaultLocales: Array<{\n locale: string\n base: string\n }> = []\n\n if (config.i18n && type === 'redirect') {\n for (const item of config.i18n?.domains || []) {\n defaultLocales.push({\n locale: item.defaultLocale,\n base: `http${item.http ? '' : 's'}://${item.domain}`,\n })\n }\n\n defaultLocales.push({\n locale: config.i18n.defaultLocale,\n base: '',\n })\n }\n\n for (const r of _routes) {\n const srcBasePath =\n config.basePath && r.basePath !== false ? config.basePath : ''\n const isExternal = !r.destination?.startsWith('/')\n const destBasePath = srcBasePath && !isExternal ? srcBasePath : ''\n\n if (config.i18n && r.locale !== false) {\n if (!isExternal) {\n defaultLocales.forEach((item) => {\n let destination\n\n if (r.destination) {\n destination = item.base\n ? `${item.base}${destBasePath}${r.destination}`\n : `${destBasePath}${r.destination}`\n }\n\n newRoutes.push({\n ...r,\n destination,\n source: `${srcBasePath}/${item.locale}${\n r.source === '/' && !config.trailingSlash ? '' : r.source\n }`,\n })\n })\n }\n\n r.source = `/:nextInternalLocale(${config.i18n.locales\n .map((locale: string) => escapeStringRegexp(locale))\n .join('|')})${\n r.source === '/' && !config.trailingSlash ? '' : r.source\n }`\n\n if (r.destination && r.destination?.startsWith('/')) {\n r.destination = `/:nextInternalLocale${\n r.destination === '/' && !config.trailingSlash ? '' : r.destination\n }`\n }\n }\n r.source = `${srcBasePath}${\n r.source === '/' && srcBasePath ? '' : r.source\n }`\n\n if (r.destination) {\n r.destination = `${destBasePath}${\n r.destination === '/' && destBasePath ? '' : r.destination\n }`\n }\n newRoutes.push(r)\n }\n return newRoutes as any as T\n}\n\nasync function loadRedirects(config: NextConfig) {\n if (typeof config.redirects !== 'function') {\n return []\n }\n let redirects = await config.redirects()\n // check before we process the routes and after to ensure\n // they are still valid\n checkCustomRoutes(redirects, 'redirect')\n\n // save original redirects before transforms\n if (Array.isArray(redirects)) {\n config._originalRedirects = redirects.map((r) => ({ ...r }))\n }\n redirects = processRoutes(redirects, config, 'redirect')\n checkCustomRoutes(redirects, 'redirect')\n return redirects\n}\n\nasync function loadRewrites(config: NextConfig) {\n // If assetPrefix is set, add a rewrite for `/${assetPrefix}/_next/*`\n // requests so that they are handled in any of dev, start, or deploy\n // automatically without the user having to configure this.\n // If the assetPrefix is an absolute URL, we still consider the path for automatic rewrite.\n // but hostname routing must be handled by the user\n let maybeAssetPrefixRewrite: Rewrite[] = []\n if (config.assetPrefix) {\n let prefix = config.assetPrefix\n if (\n isFullStringUrl(config.assetPrefix) &&\n URL.canParse(config.assetPrefix)\n ) {\n prefix = new URL(config.assetPrefix).pathname\n }\n\n if (prefix && prefix !== '/') {\n const assetPrefix = prefix.startsWith('/') ? prefix : `/${prefix}`\n const basePath = config.basePath || ''\n // If these are the same, then this would result in an infinite rewrite.\n if (assetPrefix !== basePath) {\n maybeAssetPrefixRewrite.push({\n source: `${assetPrefix}/_next/:path+`,\n destination: `${basePath}/_next/:path+`,\n })\n }\n }\n }\n\n if (typeof config.rewrites !== 'function') {\n return {\n beforeFiles: [...maybeAssetPrefixRewrite],\n afterFiles: [],\n fallback: [],\n }\n }\n const _rewrites = await config.rewrites()\n let beforeFiles: Rewrite[] = []\n let afterFiles: Rewrite[] = []\n let fallback: Rewrite[] = []\n\n if (\n !Array.isArray(_rewrites) &&\n typeof _rewrites === 'object' &&\n Object.keys(_rewrites).every(\n (key) =>\n key === 'beforeFiles' || key === 'afterFiles' || key === 'fallback'\n )\n ) {\n beforeFiles = _rewrites.beforeFiles || []\n afterFiles = _rewrites.afterFiles || []\n fallback = _rewrites.fallback || []\n } else {\n afterFiles = _rewrites as any\n }\n // check before we process the routes and after to ensure\n // they are still valid\n checkCustomRoutes(beforeFiles, 'rewrite')\n checkCustomRoutes(afterFiles, 'rewrite')\n checkCustomRoutes(fallback, 'rewrite')\n\n // save original rewrites before transforms\n config._originalRewrites = {\n beforeFiles: beforeFiles.map((r) => ({ ...r })),\n afterFiles: afterFiles.map((r) => ({ ...r })),\n fallback: fallback.map((r) => ({ ...r })),\n }\n\n beforeFiles = [\n ...maybeAssetPrefixRewrite,\n ...processRoutes(beforeFiles, config, 'rewrite'),\n ]\n afterFiles = processRoutes(afterFiles, config, 'rewrite')\n fallback = processRoutes(fallback, config, 'rewrite')\n\n checkCustomRoutes(beforeFiles, 'rewrite')\n checkCustomRoutes(afterFiles, 'rewrite')\n checkCustomRoutes(fallback, 'rewrite')\n\n return {\n beforeFiles,\n afterFiles,\n fallback,\n }\n}\n\nasync function loadHeaders(config: NextConfig) {\n if (typeof config.headers !== 'function') {\n return []\n }\n let headers = await config.headers()\n // check before we process the routes and after to ensure\n // they are still valid\n checkCustomRoutes(headers, 'header')\n\n headers = processRoutes(headers, config, 'header')\n checkCustomRoutes(headers, 'header')\n return headers\n}\n\nexport default async function loadCustomRoutes(\n config: NextConfig\n): Promise<CustomRoutes> {\n const [headers, rewrites, redirects] = await Promise.all([\n loadHeaders(config),\n loadRewrites(config),\n loadRedirects(config),\n ])\n\n const onMatchHeaders: Header[] = []\n\n const totalRewrites =\n rewrites.beforeFiles.length +\n rewrites.afterFiles.length +\n rewrites.fallback.length\n\n const totalRoutes = headers.length + redirects.length + totalRewrites\n\n if (totalRoutes > 1000) {\n console.warn(\n bold(yellow(`Warning: `)) +\n `total number of custom routes exceeds 1000, this can reduce performance. Route counts:\\n` +\n `headers: ${headers.length}\\n` +\n `rewrites: ${totalRewrites}\\n` +\n `redirects: ${redirects.length}\\n` +\n `See more info: https://nextjs.org/docs/messages/max-custom-routes-reached`\n )\n }\n\n const cacheControlSources: string[] = []\n for (const headerRoute of headers) {\n if (!headerRoute.source.startsWith('/_next/')) {\n continue\n }\n for (const header of headerRoute.headers) {\n if (header.key.toLowerCase() === 'cache-control') {\n cacheControlSources.push(headerRoute.source)\n break\n }\n }\n }\n if (cacheControlSources.length > 0) {\n console.warn(\n bold(yellow(`Warning: `)) +\n `Custom Cache-Control headers detected for the following routes:\\n` +\n cacheControlSources.map((source) => ` - ${source}`).join('\\n') +\n `\\n\\nSetting a custom Cache-Control header can break Next.js development behavior.`\n )\n }\n\n if (config.deploymentId) {\n if (config.experimental?.useSkewCookie) {\n headers.unshift({\n source: '/:path*',\n headers: [\n {\n key: 'Set-Cookie',\n value: `__vdpl=${config.deploymentId}; Path=/; HttpOnly`,\n },\n ],\n })\n }\n\n onMatchHeaders.push(\n {\n source: '/:path*',\n has: [\n {\n type: 'header',\n key: 'rsc',\n value: '1',\n },\n ],\n headers: [\n {\n key: NEXT_NAV_DEPLOYMENT_ID_HEADER,\n value: config.deploymentId,\n },\n ],\n },\n {\n source: '/_next/data/(.*)',\n headers: [\n {\n key: NEXT_NAV_DEPLOYMENT_ID_HEADER,\n value: config.deploymentId,\n },\n ],\n }\n )\n }\n\n if (!config.skipTrailingSlashRedirect) {\n if (config.trailingSlash) {\n redirects.unshift(\n {\n source: '/:file((?!\\\\.well-known(?:/.*)?)(?:[^/]+/)*[^/]+\\\\.\\\\w+)/',\n destination: '/:file',\n permanent: true,\n locale: config.i18n ? false : undefined,\n internal: true,\n priority: true,\n // don't run this redirect for _next/data requests\n missing: [\n {\n type: 'header',\n key: 'x-nextjs-data',\n },\n ],\n },\n {\n source: '/:notfile((?!\\\\.well-known(?:/.*)?)(?:[^/]+/)*[^/\\\\.]+)',\n destination: '/:notfile/',\n permanent: true,\n locale: config.i18n ? false : undefined,\n internal: true,\n priority: true,\n }\n )\n if (config.basePath) {\n redirects.unshift({\n source: config.basePath,\n destination: config.basePath + '/',\n permanent: true,\n basePath: false,\n locale: config.i18n ? false : undefined,\n internal: true,\n priority: true,\n })\n }\n } else {\n redirects.unshift({\n source: '/:path+/',\n destination: '/:path+',\n permanent: true,\n locale: config.i18n ? false : undefined,\n internal: true,\n priority: true,\n })\n if (config.basePath) {\n redirects.unshift({\n source: config.basePath + '/',\n destination: config.basePath,\n permanent: true,\n basePath: false,\n locale: config.i18n ? false : undefined,\n internal: true,\n priority: true,\n })\n }\n }\n }\n\n return {\n headers,\n onMatchHeaders,\n rewrites,\n redirects,\n }\n}\n"],"names":["checkCustomRoutes","loadCustomRoutes","normalizeRouteRegex","allowedHasTypes","Set","namedGroupsRegex","regex","replace","checkRedirect","route","invalidParts","hadInvalidStatus","statusCode","allowedStatusCodes","has","push","permanent","checkHeader","Array","isArray","headers","length","header","key","value","routes","type","console","error","process","exit","numInvalidRoutes","hadInvalidHas","hadInvalidMissing","allowedKeys","add","JSON","stringify","basePath","destination","startsWith","source","keys","Object","invalidKeys","filter","locale","checkInvalidHasMissing","items","fieldName","hadInvalidItem","invalidHasItems","hasItem","invalidHasParts","join","itemStr","missing","_route","match","result","sourceTokens","tokens","regexStr","tryToParsePath","hasSegments","matchAll","unnamedInDest","token","name","unnamedIndex","RegExp","size","destTokens","destRegexStr","destinationParseFailed","handleUrl","sourceSegments","map","item","Boolean","invalidDestSegments","hasInvalidKeys","hasInvalidParts","processRoutes","config","_routes","newRoutes","defaultLocales","i18n","domains","defaultLocale","base","http","domain","r","srcBasePath","isExternal","destBasePath","forEach","trailingSlash","locales","escapeStringRegexp","loadRedirects","redirects","_originalRedirects","loadRewrites","maybeAssetPrefixRewrite","assetPrefix","prefix","isFullStringUrl","URL","canParse","pathname","rewrites","beforeFiles","afterFiles","fallback","_rewrites","every","_originalRewrites","loadHeaders","Promise","all","onMatchHeaders","totalRewrites","totalRoutes","warn","bold","yellow","cacheControlSources","headerRoute","toLowerCase","deploymentId","experimental","useSkewCookie","unshift","NEXT_NAV_DEPLOYMENT_ID_HEADER","skipTrailingSlashRedirect","undefined","internal","priority"],"mappings":";;;;;;;;;;;;;;;;IAkJgBA,iBAAiB;eAAjBA;;IA4iBhB,OA+JC;eA/J6BC;;IApmBdC,mBAAmB;eAAnBA;;;4BAvFa;8BACM;gCACJ;gCACI;qBACH;2BACc;AA+E9C,MAAMC,kBAAkB,IAAIC,IAAI;IAAC;IAAU;IAAU;IAAS;CAAO;AACrE,MAAMC,mBAAmB;AAElB,SAASH,oBAAoBI,KAAa;IAC/C,0EAA0E;IAC1E,OAAOA,MAAMC,OAAO,CAAC,SAAS;AAChC;AAEA,SAASC,cAAcC,KAAe;IAIpC,MAAMC,eAAyB,EAAE;IACjC,IAAIC,mBAA4B;IAEhC,IAAIF,MAAMG,UAAU,IAAI,CAACC,kCAAkB,CAACC,GAAG,CAACL,KAAK,CAAC,aAAa,GAAG;QACpEE,mBAAmB;QACnBD,aAAaK,IAAI,CAAC,CAAC,mDAAmD,CAAC;IACzE;IACA,IAAI,OAAON,MAAMO,SAAS,KAAK,aAAa,CAACP,KAAK,CAAC,aAAa,EAAE;QAChEC,aAAaK,IAAI,CAAC,CAAC,iDAAiD,CAAC;IACvE;IAEA,OAAO;QACLL;QACAC;IACF;AACF;AAEA,SAASM,YAAYR,KAAa;IAChC,MAAMC,eAAyB,EAAE;IAEjC,IAAI,CAACQ,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BC,UAAU;oBACVC,UAAU;gBACZ;YACF;QACF;IACF;IAEA,OAAO;QACLxH;QACAuG;QACAV;QACAV;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/memory/gc-observer.d.ts b/e-commerce/node_modules/next/dist/lib/memory/gc-observer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..172914576ce92a92d9b562cc7970f049e36c9b54 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/memory/gc-observer.d.ts @@ -0,0 +1,12 @@ +/** + * Starts recording garbage collection events in the process and warn on long + * running GCs. To disable, call `stopObservingGc`. + */ +export declare function startObservingGc(): void; +export declare function stopObservingGc(): void; +/** + * Returns all recorded garbage collection events. This function will only + * return information from when `startObservingGc` was enabled and before + * `stopObservingGc` was called. + */ +export declare function getGcEvents(): PerformanceEntry[]; diff --git a/e-commerce/node_modules/next/dist/lib/memory/gc-observer.js b/e-commerce/node_modules/next/dist/lib/memory/gc-observer.js new file mode 100644 index 0000000000000000000000000000000000000000..7084afc35c6e041becc07cd26cb3f4a7ccf17fba --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/memory/gc-observer.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + getGcEvents: null, + startObservingGc: null, + stopObservingGc: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + getGcEvents: function() { + return getGcEvents; + }, + startObservingGc: function() { + return startObservingGc; + }, + stopObservingGc: function() { + return stopObservingGc; + } +}); +const _perf_hooks = require("perf_hooks"); +const _log = require("../../build/output/log"); +const _picocolors = require("../picocolors"); +const LONG_RUNNING_GC_THRESHOLD_MS = 15; +const gcEvents = []; +const obs = new _perf_hooks.PerformanceObserver((list)=>{ + const entry = list.getEntries()[0]; + gcEvents.push(entry); + if (entry.duration > LONG_RUNNING_GC_THRESHOLD_MS) { + (0, _log.warn)((0, _picocolors.bold)(`Long running GC detected: ${entry.duration.toFixed(2)}ms`)); + } +}); +function startObservingGc() { + obs.observe({ + entryTypes: [ + 'gc' + ] + }); +} +function stopObservingGc() { + obs.disconnect(); +} +function getGcEvents() { + return gcEvents; +} + +//# sourceMappingURL=gc-observer.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/memory/gc-observer.js.map b/e-commerce/node_modules/next/dist/lib/memory/gc-observer.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e86b74e6cda70d6ca08c0075bad5c4007354a622 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/memory/gc-observer.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/memory/gc-observer.ts"],"sourcesContent":["import { PerformanceObserver } from 'perf_hooks'\nimport { warn } from '../../build/output/log'\nimport { bold } from '../picocolors'\n\nconst LONG_RUNNING_GC_THRESHOLD_MS = 15\n\nconst gcEvents: PerformanceEntry[] = []\nconst obs = new PerformanceObserver((list) => {\n const entry = list.getEntries()[0]\n gcEvents.push(entry)\n\n if (entry.duration > LONG_RUNNING_GC_THRESHOLD_MS) {\n warn(bold(`Long running GC detected: ${entry.duration.toFixed(2)}ms`))\n }\n})\n\n/**\n * Starts recording garbage collection events in the process and warn on long\n * running GCs. To disable, call `stopObservingGc`.\n */\nexport function startObservingGc() {\n obs.observe({ entryTypes: ['gc'] })\n}\n\nexport function stopObservingGc() {\n obs.disconnect()\n}\n\n/**\n * Returns all recorded garbage collection events. This function will only\n * return information from when `startObservingGc` was enabled and before\n * `stopObservingGc` was called.\n */\nexport function getGcEvents() {\n return gcEvents\n}\n"],"names":["getGcEvents","startObservingGc","stopObservingGc","LONG_RUNNING_GC_THRESHOLD_MS","gcEvents","obs","PerformanceObserver","list","entry","getEntries","push","duration","warn","bold","toFixed","observe","entryTypes","disconnect"],"mappings":";;;;;;;;;;;;;;;;IAiCgBA,WAAW;eAAXA;;IAbAC,gBAAgB;eAAhBA;;IAIAC,eAAe;eAAfA;;;4BAxBoB;qBACf;4BACA;AAErB,MAAMC,+BAA+B;AAErC,MAAMC,WAA+B,EAAE;AACvC,MAAMC,MAAM,IAAIC,+BAAmB,CAAC,CAACC;IACnC,MAAMC,QAAQD,KAAKE,UAAU,EAAE,CAAC,EAAE;IAClCL,SAASM,IAAI,CAACF;IAEd,IAAIA,MAAMG,QAAQ,GAAGR,8BAA8B;QACjDS,IAAAA,SAAI,EAACC,IAAAA,gBAAI,EAAC,CAAC,0BAA0B,EAAEL,MAAMG,QAAQ,CAACG,OAAO,CAAC,GAAG,EAAE,CAAC;IACtE;AACF;AAMO,SAASb;IACdI,IAAIU,OAAO,CAAC;QAAEC,YAAY;YAAC;SAAK;IAAC;AACnC;AAEO,SAASd;IACdG,IAAIY,UAAU;AAChB;AAOO,SAASjB;IACd,OAAOI;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/memory/shutdown.d.ts b/e-commerce/node_modules/next/dist/lib/memory/shutdown.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d3ba71ed12e7a1adfb163c1ff79b57efbae39034 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/memory/shutdown.d.ts @@ -0,0 +1 @@ +export declare function disableMemoryDebuggingMode(): void; diff --git a/e-commerce/node_modules/next/dist/lib/memory/shutdown.js b/e-commerce/node_modules/next/dist/lib/memory/shutdown.js new file mode 100644 index 0000000000000000000000000000000000000000..81156549b1146e13a2a8cde4e23204740194f2f4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/memory/shutdown.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "disableMemoryDebuggingMode", { + enumerable: true, + get: function() { + return disableMemoryDebuggingMode; + } +}); +const _log = require("../../build/output/log"); +const _picocolors = require("../picocolors"); +const _gcobserver = require("./gc-observer"); +const _trace = require("./trace"); +function disableMemoryDebuggingMode() { + (0, _trace.stopPeriodicMemoryUsageTracing)(); + (0, _gcobserver.stopObservingGc)(); + (0, _log.info)((0, _picocolors.bold)('Memory usage report:')); + const gcEvents = (0, _gcobserver.getGcEvents)(); + const totalTimeInGcMs = gcEvents.reduce((acc, event)=>acc + event.duration, 0); + (0, _log.info)(` - Total time spent in GC: ${totalTimeInGcMs.toFixed(2)}ms`); + const allMemoryUsage = (0, _trace.getAllMemoryUsageSpans)(); + const peakHeapUsage = Math.max(...allMemoryUsage.map((usage)=>usage['memory.heapUsed'])); + const peakRssUsage = Math.max(...allMemoryUsage.map((usage)=>usage['memory.rss'])); + (0, _log.info)(` - Peak heap usage: ${(peakHeapUsage / 1024 / 1024).toFixed(2)} MB`); + (0, _log.info)(` - Peak RSS usage: ${(peakRssUsage / 1024 / 1024).toFixed(2)} MB`); +} + +//# sourceMappingURL=shutdown.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/memory/shutdown.js.map b/e-commerce/node_modules/next/dist/lib/memory/shutdown.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1a954a6dfe75d499abfccab5fa8b50cb40d658b8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/memory/shutdown.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/memory/shutdown.ts"],"sourcesContent":["import { info } from '../../build/output/log'\nimport { bold } from '../picocolors'\nimport { getGcEvents, stopObservingGc } from './gc-observer'\nimport { getAllMemoryUsageSpans, stopPeriodicMemoryUsageTracing } from './trace'\n\nexport function disableMemoryDebuggingMode(): void {\n stopPeriodicMemoryUsageTracing()\n stopObservingGc()\n\n info(bold('Memory usage report:'))\n\n const gcEvents = getGcEvents()\n const totalTimeInGcMs = gcEvents.reduce(\n (acc, event) => acc + event.duration,\n 0\n )\n info(` - Total time spent in GC: ${totalTimeInGcMs.toFixed(2)}ms`)\n\n const allMemoryUsage = getAllMemoryUsageSpans()\n const peakHeapUsage = Math.max(\n ...allMemoryUsage.map((usage) => usage['memory.heapUsed'])\n )\n const peakRssUsage = Math.max(\n ...allMemoryUsage.map((usage) => usage['memory.rss'])\n )\n info(` - Peak heap usage: ${(peakHeapUsage / 1024 / 1024).toFixed(2)} MB`)\n info(` - Peak RSS usage: ${(peakRssUsage / 1024 / 1024).toFixed(2)} MB`)\n}\n"],"names":["disableMemoryDebuggingMode","stopPeriodicMemoryUsageTracing","stopObservingGc","info","bold","gcEvents","getGcEvents","totalTimeInGcMs","reduce","acc","event","duration","toFixed","allMemoryUsage","getAllMemoryUsageSpans","peakHeapUsage","Math","max","map","usage","peakRssUsage"],"mappings":";;;;+BAKgBA;;;eAAAA;;;qBALK;4BACA;4BACwB;uBAC0B;AAEhE,SAASA;IACdC,IAAAA,qCAA8B;IAC9BC,IAAAA,2BAAe;IAEfC,IAAAA,SAAI,EAACC,IAAAA,gBAAI,EAAC;IAEV,MAAMC,WAAWC,IAAAA,uBAAW;IAC5B,MAAMC,kBAAkBF,SAASG,MAAM,CACrC,CAACC,KAAKC,QAAUD,MAAMC,MAAMC,QAAQ,EACpC;IAEFR,IAAAA,SAAI,EAAC,CAAC,2BAA2B,EAAEI,gBAAgBK,OAAO,CAAC,GAAG,EAAE,CAAC;IAEjE,MAAMC,iBAAiBC,IAAAA,6BAAsB;IAC7C,MAAMC,gBAAgBC,KAAKC,GAAG,IACzBJ,eAAeK,GAAG,CAAC,CAACC,QAAUA,KAAK,CAAC,kBAAkB;IAE3D,MAAMC,eAAeJ,KAAKC,GAAG,IACxBJ,eAAeK,GAAG,CAAC,CAACC,QAAUA,KAAK,CAAC,aAAa;IAEtDhB,IAAAA,SAAI,EAAC,CAAC,oBAAoB,EAAE,AAACY,CAAAA,gBAAgB,OAAO,IAAG,EAAGH,OAAO,CAAC,GAAG,GAAG,CAAC;IACzET,IAAAA,SAAI,EAAC,CAAC,mBAAmB,EAAE,AAACiB,CAAAA,eAAe,OAAO,IAAG,EAAGR,OAAO,CAAC,GAAG,GAAG,CAAC;AACzE","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/memory/startup.d.ts b/e-commerce/node_modules/next/dist/lib/memory/startup.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6b193d760cb844b0dca62b5529b8ac6eebd65fa --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/memory/startup.d.ts @@ -0,0 +1 @@ +export declare function enableMemoryDebuggingMode(): void; diff --git a/e-commerce/node_modules/next/dist/lib/memory/startup.js b/e-commerce/node_modules/next/dist/lib/memory/startup.js new file mode 100644 index 0000000000000000000000000000000000000000..e248ade85880a9f7d6ff5b28576b5b9a2206a0ea --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/memory/startup.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "enableMemoryDebuggingMode", { + enumerable: true, + get: function() { + return enableMemoryDebuggingMode; + } +}); +const _v8 = /*#__PURE__*/ _interop_require_default(require("v8")); +const _log = require("../../build/output/log"); +const _picocolors = require("../picocolors"); +const _gcobserver = require("./gc-observer"); +const _trace = require("./trace"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function enableMemoryDebuggingMode() { + // This will generate a heap snapshot when the program is close to the + // memory limit. It does not give any warning to the user though which + // can be jarring. If memory is large, this may take a long time. + if ('setHeapSnapshotNearHeapLimit' in _v8.default) { + _v8.default.setHeapSnapshotNearHeapLimit(1); + } + // This flag will kill the process when it starts to GC thrash when it's + // close to the memory limit rather than continuing to try to collect + // memory ineffectively. + _v8.default.setFlagsFromString('--detect-ineffective-gcs-near-heap-limit'); + // This allows users to generate a heap snapshot on demand just by sending + // a signal to the process. + process.on('SIGUSR2', ()=>{ + (0, _log.warn)(`Received SIGUSR2 signal. Generating heap snapshot. ${(0, _picocolors.italic)('Note: this will take some time.')}`); + _v8.default.writeHeapSnapshot(); + }); + (0, _gcobserver.startObservingGc)(); + (0, _trace.startPeriodicMemoryUsageTracing)(); + (0, _log.warn)(`Memory debugging mode is enabled. ${(0, _picocolors.italic)('Note: This will affect performance.')}`); + (0, _log.info)(' - Heap snapshots will be automatically generated when the process reaches more than 70% of the memory limit and again when the process is just about to run out of memory.'); + (0, _log.info)(` - To manually generate a heap snapshot, send the process a SIGUSR2 signal: \`kill -SIGUSR2 ${process.pid}\``); + (0, _log.info)(' - Heap snapshots when there is high memory will take a very long time to complete and may be difficult to analyze in tools.'); + (0, _log.info)(' - See https://nextjs.org/docs/app/building-your-application/optimizing/memory-usage for more information.'); +} + +//# sourceMappingURL=startup.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/memory/startup.js.map b/e-commerce/node_modules/next/dist/lib/memory/startup.js.map new file mode 100644 index 0000000000000000000000000000000000000000..41ccdc735339a5fcbe76559953aa86e75e081864 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/memory/startup.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/memory/startup.ts"],"sourcesContent":["import v8 from 'v8'\nimport { info, warn } from '../../build/output/log'\nimport { italic } from '../picocolors'\nimport { startObservingGc } from './gc-observer'\nimport { startPeriodicMemoryUsageTracing } from './trace'\n\nexport function enableMemoryDebuggingMode(): void {\n // This will generate a heap snapshot when the program is close to the\n // memory limit. It does not give any warning to the user though which\n // can be jarring. If memory is large, this may take a long time.\n if ('setHeapSnapshotNearHeapLimit' in v8) {\n v8.setHeapSnapshotNearHeapLimit(1)\n }\n\n // This flag will kill the process when it starts to GC thrash when it's\n // close to the memory limit rather than continuing to try to collect\n // memory ineffectively.\n v8.setFlagsFromString('--detect-ineffective-gcs-near-heap-limit')\n\n // This allows users to generate a heap snapshot on demand just by sending\n // a signal to the process.\n process.on('SIGUSR2', () => {\n warn(\n `Received SIGUSR2 signal. Generating heap snapshot. ${italic(\n 'Note: this will take some time.'\n )}`\n )\n v8.writeHeapSnapshot()\n })\n\n startObservingGc()\n startPeriodicMemoryUsageTracing()\n\n warn(\n `Memory debugging mode is enabled. ${italic(\n 'Note: This will affect performance.'\n )}`\n )\n info(\n ' - Heap snapshots will be automatically generated when the process reaches more than 70% of the memory limit and again when the process is just about to run out of memory.'\n )\n info(\n ` - To manually generate a heap snapshot, send the process a SIGUSR2 signal: \\`kill -SIGUSR2 ${process.pid}\\``\n )\n info(\n ' - Heap snapshots when there is high memory will take a very long time to complete and may be difficult to analyze in tools.'\n )\n info(\n ' - See https://nextjs.org/docs/app/building-your-application/optimizing/memory-usage for more information.'\n )\n}\n"],"names":["enableMemoryDebuggingMode","v8","setHeapSnapshotNearHeapLimit","setFlagsFromString","process","on","warn","italic","writeHeapSnapshot","startObservingGc","startPeriodicMemoryUsageTracing","info","pid"],"mappings":";;;;+BAMgBA;;;eAAAA;;;2DAND;qBACY;4BACJ;4BACU;uBACe;;;;;;AAEzC,SAASA;IACd,sEAAsE;IACtE,sEAAsE;IACtE,iEAAiE;IACjE,IAAI,kCAAkCC,WAAE,EAAE;QACxCA,WAAE,CAACC,4BAA4B,CAAC;IAClC;IAEA,wEAAwE;IACxE,qEAAqE;IACrE,wBAAwB;IACxBD,WAAE,CAACE,kBAAkB,CAAC;IAEtB,0EAA0E;IAC1E,2BAA2B;IAC3BC,QAAQC,EAAE,CAAC,WAAW;QACpBC,IAAAA,SAAI,EACF,CAAC,mDAAmD,EAAEC,IAAAA,kBAAM,EAC1D,oCACC;QAELN,WAAE,CAACO,iBAAiB;IACtB;IAEAC,IAAAA,4BAAgB;IAChBC,IAAAA,sCAA+B;IAE/BJ,IAAAA,SAAI,EACF,CAAC,kCAAkC,EAAEC,IAAAA,kBAAM,EACzC,wCACC;IAELI,IAAAA,SAAI,EACF;IAEFA,IAAAA,SAAI,EACF,CAAC,4FAA4F,EAAEP,QAAQQ,GAAG,CAAC,EAAE,CAAC;IAEhHD,IAAAA,SAAI,EACF;IAEFA,IAAAA,SAAI,EACF;AAEJ","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/memory/trace.d.ts b/e-commerce/node_modules/next/dist/lib/memory/trace.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c80fb0595644c2d93c4eaf734bad2e23c2009880 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/memory/trace.d.ts @@ -0,0 +1,23 @@ +import { type Span } from '../../trace'; +interface MemoryUsage { + 'memory.rss': number; + 'memory.heapUsed': number; + 'memory.heapTotal': number; + 'memory.heapMax': number; +} +/** + * Begins a timer that will record memory usage periodically to understand + * memory usage across the lifetime of the process. + */ +export declare function startPeriodicMemoryUsageTracing(): void; +export declare function stopPeriodicMemoryUsageTracing(): void; +/** + * Returns the list of all recorded memory usage snapshots from the process. + */ +export declare function getAllMemoryUsageSpans(): MemoryUsage[]; +/** + * Records a snapshot of memory usage at this moment in time to the .next/trace + * file. + */ +export declare function traceMemoryUsage(description: string, parentSpan?: Span | undefined): void; +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/memory/trace.js b/e-commerce/node_modules/next/dist/lib/memory/trace.js new file mode 100644 index 0000000000000000000000000000000000000000..1ec36a71f167e2817ddcf64536da2af358fd1cb1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/memory/trace.js @@ -0,0 +1,109 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + getAllMemoryUsageSpans: null, + startPeriodicMemoryUsageTracing: null, + stopPeriodicMemoryUsageTracing: null, + traceMemoryUsage: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + getAllMemoryUsageSpans: function() { + return getAllMemoryUsageSpans; + }, + startPeriodicMemoryUsageTracing: function() { + return startPeriodicMemoryUsageTracing; + }, + stopPeriodicMemoryUsageTracing: function() { + return stopPeriodicMemoryUsageTracing; + }, + traceMemoryUsage: function() { + return traceMemoryUsage; + } +}); +const _v8 = /*#__PURE__*/ _interop_require_default(require("v8")); +const _log = require("../../build/output/log"); +const _trace = require("../../trace"); +const _picocolors = require("../picocolors"); +const _path = require("path"); +const _shared = require("../../trace/shared"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +const HEAP_SNAPSHOT_THRESHOLD_PERCENT = 70; +let alreadyGeneratedHeapSnapshot = false; +const TRACE_MEMORY_USAGE_TIMER_MS = 20000; +let traceMemoryUsageTimer; +const allMemoryUsage = []; +function startPeriodicMemoryUsageTracing() { + traceMemoryUsageTimer = setTimeout(()=>{ + traceMemoryUsage('periodic memory snapshot'); + startPeriodicMemoryUsageTracing(); + }, TRACE_MEMORY_USAGE_TIMER_MS); +} +function stopPeriodicMemoryUsageTracing() { + if (traceMemoryUsageTimer) { + clearTimeout(traceMemoryUsageTimer); + } +} +function getAllMemoryUsageSpans() { + return allMemoryUsage; +} +function traceMemoryUsage(description, parentSpan) { + const memoryUsage = process.memoryUsage(); + const v8HeapStatistics = _v8.default.getHeapStatistics(); + const heapUsed = v8HeapStatistics.used_heap_size; + const heapMax = v8HeapStatistics.heap_size_limit; + const tracedMemoryUsage = { + 'memory.rss': memoryUsage.rss, + 'memory.heapUsed': heapUsed, + 'memory.heapTotal': memoryUsage.heapTotal, + 'memory.heapMax': heapMax + }; + allMemoryUsage.push(tracedMemoryUsage); + const tracedMemoryUsageAsStrings = Object.fromEntries(Object.entries(tracedMemoryUsage).map(([key, value])=>[ + key, + String(value) + ])); + if (parentSpan) { + parentSpan.traceChild('memory-usage', tracedMemoryUsageAsStrings); + } else { + (0, _trace.trace)('memory-usage', undefined, tracedMemoryUsageAsStrings); + } + if (process.env.EXPERIMENTAL_DEBUG_MEMORY_USAGE) { + const percentageHeapUsed = 100 * heapUsed / heapMax; + (0, _log.info)(''); + (0, _log.info)('***************************************'); + (0, _log.info)(`Memory usage report at "${description}":`); + (0, _log.info)(` - RSS: ${(memoryUsage.rss / 1024 / 1024).toFixed(2)} MB`); + (0, _log.info)(` - Heap Used: ${(heapUsed / 1024 / 1024).toFixed(2)} MB`); + (0, _log.info)(` - Heap Total Allocated: ${(memoryUsage.heapTotal / 1024 / 1024).toFixed(2)} MB`); + (0, _log.info)(` - Heap Max: ${(heapMax / 1024 / 1024).toFixed(2)} MB`); + (0, _log.info)(` - Percentage Heap Used: ${percentageHeapUsed.toFixed(2)}%`); + (0, _log.info)('***************************************'); + (0, _log.info)(''); + if (percentageHeapUsed > HEAP_SNAPSHOT_THRESHOLD_PERCENT) { + const distDir = _shared.traceGlobals.get('distDir'); + const heapFilename = (0, _path.join)(distDir, `${description.replace(' ', '-')}.heapsnapshot`); + (0, _log.warn)((0, _picocolors.bold)(`Heap usage is close to the limit. ${percentageHeapUsed.toFixed(2)}% of heap has been used.`)); + if (!alreadyGeneratedHeapSnapshot) { + (0, _log.warn)((0, _picocolors.bold)(`Saving heap snapshot to ${heapFilename}. ${(0, _picocolors.italic)('Note: this will take some time.')}`)); + _v8.default.writeHeapSnapshot(heapFilename); + alreadyGeneratedHeapSnapshot = true; + } else { + (0, _log.warn)('Skipping heap snapshot generation since heap snapshot has already been generated.'); + } + } + } +} + +//# sourceMappingURL=trace.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/memory/trace.js.map b/e-commerce/node_modules/next/dist/lib/memory/trace.js.map new file mode 100644 index 0000000000000000000000000000000000000000..06b8f4a202013f42b6c71d08f6fbf2fd20bf9e64 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/memory/trace.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/memory/trace.ts"],"sourcesContent":["import v8 from 'v8'\nimport { info, warn } from '../../build/output/log'\nimport { type Span, trace } from '../../trace'\nimport { bold, italic } from '../picocolors'\nimport { join } from 'path'\nimport { traceGlobals } from '../../trace/shared'\n\nconst HEAP_SNAPSHOT_THRESHOLD_PERCENT = 70\nlet alreadyGeneratedHeapSnapshot = false\n\nconst TRACE_MEMORY_USAGE_TIMER_MS = 20000\nlet traceMemoryUsageTimer: NodeJS.Timeout | undefined\n\ninterface MemoryUsage {\n 'memory.rss': number\n 'memory.heapUsed': number\n 'memory.heapTotal': number\n 'memory.heapMax': number\n}\n\nconst allMemoryUsage: MemoryUsage[] = []\n\n/**\n * Begins a timer that will record memory usage periodically to understand\n * memory usage across the lifetime of the process.\n */\nexport function startPeriodicMemoryUsageTracing(): void {\n traceMemoryUsageTimer = setTimeout(() => {\n traceMemoryUsage('periodic memory snapshot')\n startPeriodicMemoryUsageTracing()\n }, TRACE_MEMORY_USAGE_TIMER_MS)\n}\n\nexport function stopPeriodicMemoryUsageTracing(): void {\n if (traceMemoryUsageTimer) {\n clearTimeout(traceMemoryUsageTimer)\n }\n}\n\n/**\n * Returns the list of all recorded memory usage snapshots from the process.\n */\nexport function getAllMemoryUsageSpans(): MemoryUsage[] {\n return allMemoryUsage\n}\n\n/**\n * Records a snapshot of memory usage at this moment in time to the .next/trace\n * file.\n */\nexport function traceMemoryUsage(\n description: string,\n parentSpan?: Span | undefined\n): void {\n const memoryUsage = process.memoryUsage()\n const v8HeapStatistics = v8.getHeapStatistics()\n const heapUsed = v8HeapStatistics.used_heap_size\n const heapMax = v8HeapStatistics.heap_size_limit\n const tracedMemoryUsage: MemoryUsage = {\n 'memory.rss': memoryUsage.rss,\n 'memory.heapUsed': heapUsed,\n 'memory.heapTotal': memoryUsage.heapTotal,\n 'memory.heapMax': heapMax,\n }\n allMemoryUsage.push(tracedMemoryUsage)\n const tracedMemoryUsageAsStrings = Object.fromEntries(\n Object.entries(tracedMemoryUsage).map(([key, value]) => [\n key,\n String(value),\n ])\n )\n if (parentSpan) {\n parentSpan.traceChild('memory-usage', tracedMemoryUsageAsStrings)\n } else {\n trace('memory-usage', undefined, tracedMemoryUsageAsStrings)\n }\n if (process.env.EXPERIMENTAL_DEBUG_MEMORY_USAGE) {\n const percentageHeapUsed = (100 * heapUsed) / heapMax\n\n info('')\n info('***************************************')\n info(`Memory usage report at \"${description}\":`)\n info(` - RSS: ${(memoryUsage.rss / 1024 / 1024).toFixed(2)} MB`)\n info(` - Heap Used: ${(heapUsed / 1024 / 1024).toFixed(2)} MB`)\n info(\n ` - Heap Total Allocated: ${(memoryUsage.heapTotal / 1024 / 1024).toFixed(\n 2\n )} MB`\n )\n info(` - Heap Max: ${(heapMax / 1024 / 1024).toFixed(2)} MB`)\n info(` - Percentage Heap Used: ${percentageHeapUsed.toFixed(2)}%`)\n info('***************************************')\n info('')\n\n if (percentageHeapUsed > HEAP_SNAPSHOT_THRESHOLD_PERCENT) {\n const distDir = traceGlobals.get('distDir')\n const heapFilename = join(\n distDir,\n `${description.replace(' ', '-')}.heapsnapshot`\n )\n warn(\n bold(\n `Heap usage is close to the limit. ${percentageHeapUsed.toFixed(\n 2\n )}% of heap has been used.`\n )\n )\n if (!alreadyGeneratedHeapSnapshot) {\n warn(\n bold(\n `Saving heap snapshot to ${heapFilename}. ${italic(\n 'Note: this will take some time.'\n )}`\n )\n )\n v8.writeHeapSnapshot(heapFilename)\n alreadyGeneratedHeapSnapshot = true\n } else {\n warn(\n 'Skipping heap snapshot generation since heap snapshot has already been generated.'\n )\n }\n }\n }\n}\n"],"names":["getAllMemoryUsageSpans","startPeriodicMemoryUsageTracing","stopPeriodicMemoryUsageTracing","traceMemoryUsage","HEAP_SNAPSHOT_THRESHOLD_PERCENT","alreadyGeneratedHeapSnapshot","TRACE_MEMORY_USAGE_TIMER_MS","traceMemoryUsageTimer","allMemoryUsage","setTimeout","clearTimeout","description","parentSpan","memoryUsage","process","v8HeapStatistics","v8","getHeapStatistics","heapUsed","used_heap_size","heapMax","heap_size_limit","tracedMemoryUsage","rss","heapTotal","push","tracedMemoryUsageAsStrings","Object","fromEntries","entries","map","key","value","String","traceChild","trace","undefined","env","EXPERIMENTAL_DEBUG_MEMORY_USAGE","percentageHeapUsed","info","toFixed","distDir","traceGlobals","get","heapFilename","join","replace","warn","bold","italic","writeHeapSnapshot"],"mappings":";;;;;;;;;;;;;;;;;IA0CgBA,sBAAsB;eAAtBA;;IAhBAC,+BAA+B;eAA/BA;;IAOAC,8BAA8B;eAA9BA;;IAiBAC,gBAAgB;eAAhBA;;;2DAlDD;qBACY;uBACM;4BACJ;sB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C/DD,IAAAA,SAAI,EAAC,CAAC,cAAc,EAAE,AAACtB,CAAAA,WAAW,OAAO,IAAG,EAAGuB,OAAO,CAAC,GAAG,GAAG,CAAC;QAC9DD,IAAAA,SAAI,EACF,CAAC,yBAAyB,EAAE,AAAC3B,CAAAA,YAAYW,SAAS,GAAG,OAAO,IAAG,EAAGiB,OAAO,CACvE,GACA,GAAG,CAAC;QAERD,IAAAA,SAAI,EAAC,CAAC,aAAa,EAAE,AAACpB,CAAAA,UAAU,OAAO,IAAG,EAAGqB,OAAO,CAAC,GAAG,GAAG,CAAC;QAC5DD,IAAAA,SAAI,EAAC,CAAC,yBAAyB,EAAED,mBAAmBE,OAAO,CAAC,GAAG,CAAC,CAAC;QACjED,IAAAA,SAAI,EAAC;QACLA,IAAAA,SAAI,EAAC;QAEL,IAAID,qBAAqBnC,iCAAiC;YACxD,MAAMsC,UAAUC,oBAAY,CAACC,GAAG,CAAC;YACjC,MAAMC,eAAeC,IAAAA,UAAI,EACvBJ,SACA,GAAG/B,YAAYoC,OAAO,CAAC,KAAK,KAAK,aAAa,CAAC;YAEjDC,IAAAA,SAAI,EACFC,IAAAA,gBAAI,EACF,CAAC,kCAAkC,EAAEV,mBAAmBE,OAAO,CAC7D,GACA,wBAAwB,CAAC;YAG/B,IAAI,CAACpC,8BAA8B;gBACjC2C,IAAAA,SAAI,EACFC,IAAAA,gBAAI,EACF,CAAC,wBAAwB,EAAEJ,aAAa,GAAG,EAAEK,IAAAA,kBAAM,EACjD,oCACC;gBAGPlC,WAAE,CAACmC,iBAAiB,CAACN;gBACrBxC,+BAA+B;YACjC,OAAO;gBACL2C,IAAAA,SAAI,EACF;YAEJ;QACF;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/constants.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/constants.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3ef50656f9a1ce6da4a8d69c341bcf3938473d0a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/constants.d.ts @@ -0,0 +1,6 @@ +import type { ViewportLayout } from './types/extra-types'; +import type { Icons } from './types/metadata-types'; +export declare const ViewportMetaKeys: { + [k in keyof ViewportLayout]: string; +}; +export declare const IconKeys: (keyof Icons)[]; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/constants.js b/e-commerce/node_modules/next/dist/lib/metadata/constants.js new file mode 100644 index 0000000000000000000000000000000000000000..838b87cc4b6254f05f44bdb80136ae34b6ded289 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/constants.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + IconKeys: null, + ViewportMetaKeys: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + IconKeys: function() { + return IconKeys; + }, + ViewportMetaKeys: function() { + return ViewportMetaKeys; + } +}); +const ViewportMetaKeys = { + width: 'width', + height: 'height', + initialScale: 'initial-scale', + minimumScale: 'minimum-scale', + maximumScale: 'maximum-scale', + viewportFit: 'viewport-fit', + userScalable: 'user-scalable', + interactiveWidget: 'interactive-widget' +}; +const IconKeys = [ + 'icon', + 'shortcut', + 'apple', + 'other' +]; + +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/constants.js.map b/e-commerce/node_modules/next/dist/lib/metadata/constants.js.map new file mode 100644 index 0000000000000000000000000000000000000000..633461a1364e1b3627b20e646a66ab5ee45440ad --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/constants.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/metadata/constants.ts"],"sourcesContent":["import type { ViewportLayout } from './types/extra-types'\nimport type { Icons } from './types/metadata-types'\n\nexport const ViewportMetaKeys: { [k in keyof ViewportLayout]: string } = {\n width: 'width',\n height: 'height',\n initialScale: 'initial-scale',\n minimumScale: 'minimum-scale',\n maximumScale: 'maximum-scale',\n viewportFit: 'viewport-fit',\n userScalable: 'user-scalable',\n interactiveWidget: 'interactive-widget',\n} as const\n\nexport const IconKeys: (keyof Icons)[] = ['icon', 'shortcut', 'apple', 'other']\n"],"names":["IconKeys","ViewportMetaKeys","width","height","initialScale","minimumScale","maximumScale","viewportFit","userScalable","interactiveWidget"],"mappings":";;;;;;;;;;;;;;;IAcaA,QAAQ;eAARA;;IAXAC,gBAAgB;eAAhBA;;;AAAN,MAAMA,mBAA4D;IACvEC,OAAO;IACPC,QAAQ;IACRC,cAAc;IACdC,cAAc;IACdC,cAAc;IACdC,aAAa;IACbC,cAAc;IACdC,mBAAmB;AACrB;AAEO,MAAMT,WAA4B;IAAC;IAAQ;IAAY;IAAS;CAAQ","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/default-metadata.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/default-metadata.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3afc3802daa165a21ef60e3abdba6e07d44f697d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/default-metadata.d.ts @@ -0,0 +1,3 @@ +import type { ResolvedMetadata, ResolvedViewport } from './types/metadata-interface'; +export declare function createDefaultViewport(): ResolvedViewport; +export declare function createDefaultMetadata(): ResolvedMetadata; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/default-metadata.js b/e-commerce/node_modules/next/dist/lib/metadata/default-metadata.js new file mode 100644 index 0000000000000000000000000000000000000000..84d4f69d32638d76006073e8266301644fe9e98e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/default-metadata.js @@ -0,0 +1,82 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + createDefaultMetadata: null, + createDefaultViewport: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + createDefaultMetadata: function() { + return createDefaultMetadata; + }, + createDefaultViewport: function() { + return createDefaultViewport; + } +}); +function createDefaultViewport() { + return { + // name=viewport + width: 'device-width', + initialScale: 1, + // visual metadata + themeColor: null, + colorScheme: null + }; +} +function createDefaultMetadata() { + return { + // Deprecated ones + viewport: null, + themeColor: null, + colorScheme: null, + metadataBase: null, + // Other values are all null + title: null, + description: null, + applicationName: null, + authors: null, + generator: null, + keywords: null, + referrer: null, + creator: null, + publisher: null, + robots: null, + manifest: null, + alternates: { + canonical: null, + languages: null, + media: null, + types: null + }, + icons: null, + openGraph: null, + twitter: null, + verification: {}, + appleWebApp: null, + formatDetection: null, + itunes: null, + facebook: null, + pinterest: null, + abstract: null, + appLinks: null, + archives: null, + assets: null, + bookmarks: null, + category: null, + classification: null, + pagination: { + previous: null, + next: null + }, + other: {} + }; +} + +//# sourceMappingURL=default-metadata.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/default-metadata.js.map b/e-commerce/node_modules/next/dist/lib/metadata/default-metadata.js.map new file mode 100644 index 0000000000000000000000000000000000000000..4467e2038ee616c19d9cfaaecaa38e701d2af811 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/default-metadata.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/metadata/default-metadata.tsx"],"sourcesContent":["import type {\n ResolvedMetadata,\n ResolvedViewport,\n} from './types/metadata-interface'\n\nexport function createDefaultViewport(): ResolvedViewport {\n return {\n // name=viewport\n width: 'device-width',\n initialScale: 1,\n // visual metadata\n themeColor: null,\n colorScheme: null,\n }\n}\n\nexport function createDefaultMetadata(): ResolvedMetadata {\n return {\n // Deprecated ones\n viewport: null,\n themeColor: null,\n colorScheme: null,\n\n metadataBase: null,\n // Other values are all null\n title: null,\n description: null,\n applicationName: null,\n authors: null,\n generator: null,\n keywords: null,\n referrer: null,\n creator: null,\n publisher: null,\n robots: null,\n manifest: null,\n alternates: {\n canonical: null,\n languages: null,\n media: null,\n types: null,\n },\n icons: null,\n openGraph: null,\n twitter: null,\n verification: {},\n appleWebApp: null,\n formatDetection: null,\n itunes: null,\n facebook: null,\n pinterest: null,\n abstract: null,\n appLinks: null,\n archives: null,\n assets: null,\n bookmarks: null,\n category: null,\n classification: null,\n pagination: {\n previous: null,\n next: null,\n },\n other: {},\n }\n}\n"],"names":["createDefaultMetadata","createDefaultViewport","width","initialScale","themeColor","colorScheme","viewport","metadataBase","title","description","applicationName","authors","generator","keywords","referrer","creator","publisher","robots","manifest","alternates","canonical","languages","media","types","icons","openGraph","twitter","verification","appleWebApp","formatDetection","itunes","facebook","pinterest","abstract","appLinks","archives","assets","bookmarks","category","classification","pagination","previous","next","other"],"mappings":";;;;;;;;;;;;;;;IAgBgBA,qBAAqB;eAArBA;;IAXAC,qBAAqB;eAArBA;;;AAAT,SAASA;IACd,OAAO;QACL,gBAAgB;QAChBC,OAAO;QACPC,cAAc;QACd,kBAAkB;QAClBC,YAAY;QACZC,aAAa;IACf;AACF;AAEO,SAASL;IACd,OAAO;QACL,kBAAkB;QAClBM,UAAU;QACVF,YAAY;QACZC,aAAa;QAEbE,cAAc;QACd,4BAA4B;QAC5BC,OAAO;QACPC,aAAa;QACbC,iBAAiB;QACjBC,SAAS;QACTC,WAAW;QACXC,UAAU;QACVC,UAAU;QACVC,SAAS;QACTC,WAAW;QACXC,QAAQ;QACRC,UAAU;QACVC,YAAY;YACVC,WAAW;YACXC,WAAW;YACXC,OAAO;YACPC,OAAO;QACT;QACAC,OAAO;QACPC,WAAW;QACXC,SAAS;QACTC,cAAc,CAAC;QACfC,aAAa;QACbC,iBAAiB;QACjBC,QAAQ;QACRC,UAAU;QACVC,WAAW;QACXC,UAAU;QACVC,UAAU;QACVC,UAAU;QACVC,QAAQ;QACRC,WAAW;QACXC,UAAU;QACVC,gBAAgB;QAChBC,YAAY;YACVC,UAAU;YACVC,MAAM;QACR;QACAC,OAAO,CAAC;IACV;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/generate/icon-mark.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/generate/icon-mark.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c99555fc8072f70b4d1cf8e272ab600585471a21 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/generate/icon-mark.d.ts @@ -0,0 +1 @@ +export declare const IconMark: () => import("react").JSX.Element | null; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/generate/icon-mark.js b/e-commerce/node_modules/next/dist/lib/metadata/generate/icon-mark.js new file mode 100644 index 0000000000000000000000000000000000000000..b3d200b7df8d8f6ccd76c3563a81ae8ca49d5012 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/generate/icon-mark.js @@ -0,0 +1,22 @@ +'use client'; +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "IconMark", { + enumerable: true, + get: function() { + return IconMark; + } +}); +const _jsxruntime = require("react/jsx-runtime"); +const IconMark = ()=>{ + if (typeof window !== 'undefined') { + return null; + } + return /*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "\xabnxt-icon\xbb" + }); +}; + +//# sourceMappingURL=icon-mark.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/generate/icon-mark.js.map b/e-commerce/node_modules/next/dist/lib/metadata/generate/icon-mark.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1d5b5c799a176be42dc65c1a815ef3d3c7542580 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/generate/icon-mark.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/lib/metadata/generate/icon-mark.tsx"],"sourcesContent":["'use client'\n\n// This is a client component that only renders during SSR,\n// but will be replaced during streaming with an icon insertion script tag.\n// We don't want it to be presented anywhere so it's only visible during streaming,\n// right after the icon meta tags so that browser can pick it up as soon as it's rendered.\n// Note: we don't just emit the script here because we only need the script if it's not in the head,\n// and we need it to be hoistable alongside the other metadata but sync scripts are not hoistable.\nexport const IconMark = () => {\n if (typeof window !== 'undefined') {\n return null\n }\n return <meta name=\"«nxt-icon»\" />\n}\n"],"names":["IconMark","window","meta","name"],"mappings":"AAAA;;;;;+BAQaA;;;eAAAA;;;;AAAN,MAAMA,WAAW;IACtB,IAAI,OAAOC,WAAW,aAAa;QACjC,OAAO;IACT;IACA,qBAAO,qBAACC;QAAKC,MAAK;;AACpB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/generate/utils.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/generate/utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b900a7468f537716791e0a91cc649e72b91c14a4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/generate/utils.d.ts @@ -0,0 +1,4 @@ +declare function resolveArray<T>(value: T | T[]): T[]; +declare function resolveAsArrayOrUndefined<T>(value: T | T[] | undefined | null): T extends undefined | null ? undefined : T[]; +declare function getOrigin(url: string | URL): string | undefined; +export { resolveAsArrayOrUndefined, resolveArray, getOrigin }; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/generate/utils.js b/e-commerce/node_modules/next/dist/lib/metadata/generate/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..b373fe9a86e5a5fa90d92ee2bf622f428471744c --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/generate/utils.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + getOrigin: null, + resolveArray: null, + resolveAsArrayOrUndefined: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + getOrigin: function() { + return getOrigin; + }, + resolveArray: function() { + return resolveArray; + }, + resolveAsArrayOrUndefined: function() { + return resolveAsArrayOrUndefined; + } +}); +function resolveArray(value) { + if (Array.isArray(value)) { + return value; + } + return [ + value + ]; +} +function resolveAsArrayOrUndefined(value) { + if (typeof value === 'undefined' || value === null) { + return undefined; + } + return resolveArray(value); +} +function getOrigin(url) { + let origin = undefined; + if (typeof url === 'string') { + try { + url = new URL(url); + origin = url.origin; + } catch {} + } + return origin; +} + +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/generate/utils.js.map b/e-commerce/node_modules/next/dist/lib/metadata/generate/utils.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e1b1d4829bbf869b95eb48aa4a7ae94f3466d10c --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/generate/utils.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/lib/metadata/generate/utils.ts"],"sourcesContent":["function resolveArray<T>(value: T | T[]): T[] {\n if (Array.isArray(value)) {\n return value as any\n }\n return [value] as any\n}\n\nfunction resolveAsArrayOrUndefined<T>(\n value: T | T[] | undefined | null\n): T extends undefined | null ? undefined : T[] {\n if (typeof value === 'undefined' || value === null) {\n return undefined as any\n }\n return resolveArray(value) as any\n}\n\nfunction getOrigin(url: string | URL): string | undefined {\n let origin = undefined\n if (typeof url === 'string') {\n try {\n url = new URL(url)\n origin = url.origin\n } catch {}\n }\n return origin\n}\n\nexport { resolveAsArrayOrUndefined, resolveArray, getOrigin }\n"],"names":["getOrigin","resolveArray","resolveAsArrayOrUndefined","value","Array","isArray","undefined","url","origin","URL"],"mappings":";;;;;;;;;;;;;;;;IA2BkDA,SAAS;eAATA;;IAAdC,YAAY;eAAZA;;IAA3BC,yBAAyB;eAAzBA;;;AA3BT,SAASD,aAAgBE,KAAc;IACrC,IAAIC,MAAMC,OAAO,CAACF,QAAQ;QACxB,OAAOA;IACT;IACA,OAAO;QAACA;KAAM;AAChB;AAEA,SAASD,0BACPC,KAAiC;IAEjC,IAAI,OAAOA,UAAU,eAAeA,UAAU,MAAM;QAClD,OAAOG;IACT;IACA,OAAOL,aAAaE;AACtB;AAEA,SAASH,UAAUO,GAAiB;IAClC,IAAIC,SAASF;IACb,IAAI,OAAOC,QAAQ,UAAU;QAC3B,IAAI;YACFA,MAAM,IAAIE,IAAIF;YACdC,SAASD,IAAIC,MAAM;QACrB,EAAE,OAAM,CAAC;IACX;IACA,OAAOA;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/get-metadata-route.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/get-metadata-route.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3da39f31ac29fb8fa2588dd6878ec1ba0699e298 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/get-metadata-route.d.ts @@ -0,0 +1,30 @@ +export declare function fillStaticMetadataSegment(segment: string, lastSegment: string): string; +/** + * Returns the pathname used when prerendering static metadata files. Dynamic + * segments are replaced with "-" placeholders so the file is exported once. + */ +export declare function getStaticMetadataPrerenderPathname(pathname: string): string | null; +/** + * Fill the dynamic segment in the metadata route + * + * Example: + * fillMetadataSegment('/a/[slug]', { params: { slug: 'b' } }, 'open-graph', false) -> '/a/b/open-graph' + * + * When isStatic is true, all dynamic segments are filled with "-" placeholder + * since static metadata files have consistent responses regardless of params. + * Example: + * fillMetadataSegment('/a/[slug]', {}, 'icon.png', true) -> '/a/-/icon.png' + * + */ +export declare function fillMetadataSegment(segment: string, params: any, lastSegment: string, isStatic: boolean): string; +/** + * Map metadata page key to the corresponding route + * + * static file page key: /app/robots.txt -> /robots.xml -> /robots.txt/route + * dynamic route page key: /app/robots.tsx -> /robots -> /robots.txt/route + * + * @param page + * @returns + */ +export declare function normalizeMetadataRoute(page: string): string; +export declare function normalizeMetadataPageToRoute(page: string, isDynamic: boolean): string; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/get-metadata-route.js b/e-commerce/node_modules/next/dist/lib/metadata/get-metadata-route.js new file mode 100644 index 0000000000000000000000000000000000000000..f6a613529a2b92ac5109767e2975be63de0625dd --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/get-metadata-route.js @@ -0,0 +1,162 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + fillMetadataSegment: null, + fillStaticMetadataSegment: null, + getStaticMetadataPrerenderPathname: null, + normalizeMetadataPageToRoute: null, + normalizeMetadataRoute: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + fillMetadataSegment: function() { + return fillMetadataSegment; + }, + fillStaticMetadataSegment: function() { + return fillStaticMetadataSegment; + }, + getStaticMetadataPrerenderPathname: function() { + return getStaticMetadataPrerenderPathname; + }, + normalizeMetadataPageToRoute: function() { + return normalizeMetadataPageToRoute; + }, + normalizeMetadataRoute: function() { + return normalizeMetadataRoute; + } +}); +const _ismetadataroute = require("./is-metadata-route"); +const _path = /*#__PURE__*/ _interop_require_default(require("../../shared/lib/isomorphic/path")); +const _serverutils = require("../../server/server-utils"); +const _routeregex = require("../../shared/lib/router/utils/route-regex"); +const _getdynamicparam = require("../../shared/lib/router/utils/get-dynamic-param"); +const _hash = require("../../shared/lib/hash"); +const _apppaths = require("../../shared/lib/router/utils/app-paths"); +const _utils = require("../../shared/lib/router/utils"); +const _normalizepathsep = require("../../shared/lib/page-path/normalize-path-sep"); +const _segment = require("../../shared/lib/segment"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +/* + * If there's special convention like (...) or @ in the page path, + * Give it a unique hash suffix to avoid conflicts + * + * e.g. + * /opengraph-image -> /opengraph-image + * /(post)/opengraph-image.tsx -> /opengraph-image-[0-9a-z]{6} + * + * Sitemap is an exception, it should not have a suffix. + * Each sitemap contains all the urls of sub routes, we don't have the case of duplicates `/(group)/sitemap.[ext]` and `/sitemap.[ext]` since they should be the same. + * Hence we always normalize the urls for sitemap and do not append hash suffix, and ensure user-land only contains one sitemap per pathname. + * + * /sitemap -> /sitemap + * /(post)/sitemap -> /sitemap + */ function getMetadataRouteSuffix(page) { + // Remove the last segment and get the parent pathname + // e.g. /parent/a/b/c -> /parent/a/b + // e.g. /parent/opengraph-image -> /parent + const parentPathname = _path.default.dirname(page); + // Only apply suffix to metadata routes except for sitemaps + if (page.endsWith('/sitemap') || page.endsWith('/sitemap.xml')) { + return ''; + } + // Calculate the hash suffix based on the parent path + let suffix = ''; + // Check if there's any special characters in the parent pathname. + const segments = parentPathname.split('/'); + if (segments.some((seg)=>(0, _segment.isGroupSegment)(seg) || (0, _segment.isParallelRouteSegment)(seg))) { + // Hash the parent path to get a unique suffix + suffix = (0, _hash.djb2Hash)(parentPathname).toString(36).slice(0, 6); + } + return suffix; +} +function getMetadataRouteFilename(segment, lastSegment) { + const { name, ext } = _path.default.parse(lastSegment); + const pagePath = _path.default.posix.join(segment, name); + const suffix = getMetadataRouteSuffix(pagePath); + const routeSuffix = suffix ? `-${suffix}` : ''; + return `${name}${routeSuffix}${ext}`; +} +function normalizeStaticMetadataRouteSegment(segment) { + let normalizedSegment = segment; + let match = normalizedSegment.match(_getdynamicparam.PARAMETER_PATTERN); + while(match){ + normalizedSegment = `${match[1]}-${match[3]}`; + match = normalizedSegment.match(_getdynamicparam.PARAMETER_PATTERN); + } + return normalizedSegment; +} +function getStaticMetadataRoute(segment) { + const pathname = (0, _apppaths.normalizeAppPath)(segment); + return (0, _normalizepathsep.normalizePathSep)(_path.default.join('/', ...pathname.split('/').filter(Boolean).map((pathnameSegment)=>normalizeStaticMetadataRouteSegment(pathnameSegment)))); +} +function fillStaticMetadataSegment(segment, lastSegment) { + return (0, _normalizepathsep.normalizePathSep)(_path.default.join(getStaticMetadataRoute(segment), getMetadataRouteFilename(segment, lastSegment))); +} +function getStaticMetadataPrerenderPathname(pathname) { + const normalized = pathname.startsWith('/') ? pathname : `/${pathname}`; + if (!(0, _ismetadataroute.isMetadataRouteFile)(normalized, [], true)) { + return null; + } + if (!(0, _utils.isDynamicRoute)(normalized)) { + return normalized; + } + const lastSlash = normalized.lastIndexOf('/'); + if (lastSlash === -1) { + return normalized; + } + const segment = normalized.slice(0, lastSlash) || '/'; + const lastSegment = normalized.slice(lastSlash + 1); + return fillStaticMetadataSegment(segment, lastSegment); +} +function fillMetadataSegment(segment, params, lastSegment, isStatic) { + if (isStatic) { + return fillStaticMetadataSegment(segment, lastSegment); + } + const pathname = (0, _apppaths.normalizeAppPath)(segment); + const routeRegex = (0, _routeregex.getNamedRouteRegex)(pathname, { + prefixRouteKeys: false + }); + const route = (0, _serverutils.interpolateDynamicPath)(pathname, params, routeRegex); + return (0, _normalizepathsep.normalizePathSep)(_path.default.join(route, getMetadataRouteFilename(segment, lastSegment))); +} +function normalizeMetadataRoute(page) { + if (!(0, _ismetadataroute.isMetadataPage)(page)) { + return page; + } + let route = page; + let suffix = ''; + if (page === '/robots') { + route += '.txt'; + } else if (page === '/manifest') { + route += '.webmanifest'; + } else { + suffix = getMetadataRouteSuffix(page); + } + // Support both /<metadata-route.ext> and custom routes /<metadata-route>/route.ts. + // If it's a metadata file route, we need to append /[id]/route to the page. + if (!route.endsWith('/route')) { + const { dir, name: baseName, ext } = _path.default.parse(route); + route = _path.default.posix.join(dir, `${baseName}${suffix ? `-${suffix}` : ''}${ext}`, 'route'); + } + return route; +} +function normalizeMetadataPageToRoute(page, isDynamic) { + const isRoute = page.endsWith('/route'); + const routePagePath = isRoute ? page.slice(0, -'/route'.length) : page; + const metadataRouteExtension = routePagePath.endsWith('/sitemap') ? '.xml' : ''; + const mapped = isDynamic ? `${routePagePath}/[__metadata_id__]` : `${routePagePath}${metadataRouteExtension}`; + return mapped + (isRoute ? '/route' : ''); +} + +//# sourceMappingURL=get-metadata-route.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/get-metadata-route.js.map b/e-commerce/node_modules/next/dist/lib/metadata/get-metadata-route.js.map new file mode 100644 index 0000000000000000000000000000000000000000..9330bf0c092aad752a779adbf859a1fe1b5d4535 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/get-metadata-route.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/metadata/get-metadata-route.ts"],"sourcesContent":["import { isMetadataPage } from './is-metadata-route'\nimport path from '../../shared/lib/isomorphic/path'\nimport { interpolateDynamicPath } from '../../server/server-utils'\nimport { getNamedRouteRegex } from '../../shared/lib/router/utils/route-regex'\nimport { PARAMETER_PATTERN } from '../../shared/lib/router/utils/get-dynamic-param'\nimport { djb2Hash } from '../../shared/lib/hash'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { isDynamicRoute } from '../../shared/lib/router/utils'\nimport { normalizePathSep } from '../../shared/lib/page-path/normalize-path-sep'\nimport { isMetadataRouteFile } from './is-metadata-route'\nimport {\n isGroupSegment,\n isParallelRouteSegment,\n} from '../../shared/lib/segment'\n\n/*\n * If there's special convention like (...) or @ in the page path,\n * Give it a unique hash suffix to avoid conflicts\n *\n * e.g.\n * /opengraph-image -> /opengraph-image\n * /(post)/opengraph-image.tsx -> /opengraph-image-[0-9a-z]{6}\n *\n * Sitemap is an exception, it should not have a suffix.\n * Each sitemap contains all the urls of sub routes, we don't have the case of duplicates `/(group)/sitemap.[ext]` and `/sitemap.[ext]` since they should be the same.\n * Hence we always normalize the urls for sitemap and do not append hash suffix, and ensure user-land only contains one sitemap per pathname.\n *\n * /sitemap -> /sitemap\n * /(post)/sitemap -> /sitemap\n */\nfunction getMetadataRouteSuffix(page: string) {\n // Remove the last segment and get the parent pathname\n // e.g. /parent/a/b/c -> /parent/a/b\n // e.g. /parent/opengraph-image -> /parent\n const parentPathname = path.dirname(page)\n // Only apply suffix to metadata routes except for sitemaps\n if (page.endsWith('/sitemap') || page.endsWith('/sitemap.xml')) {\n return ''\n }\n\n // Calculate the hash suffix based on the parent path\n let suffix = ''\n // Check if there's any special characters in the parent pathname.\n const segments = parentPathname.split('/')\n if (\n segments.some((seg) => isGroupSegment(seg) || isParallelRouteSegment(seg))\n ) {\n // Hash the parent path to get a unique suffix\n suffix = djb2Hash(parentPathname).toString(36).slice(0, 6)\n }\n return suffix\n}\n\nfunction getMetadataRouteFilename(segment: string, lastSegment: string) {\n const { name, ext } = path.parse(lastSegment)\n const pagePath = path.posix.join(segment, name)\n const suffix = getMetadataRouteSuffix(pagePath)\n const routeSuffix = suffix ? `-${suffix}` : ''\n\n return `${name}${routeSuffix}${ext}`\n}\n\nfunction normalizeStaticMetadataRouteSegment(segment: string) {\n let normalizedSegment = segment\n let match = normalizedSegment.match(PARAMETER_PATTERN)\n\n while (match) {\n normalizedSegment = `${match[1]}-${match[3]}`\n match = normalizedSegment.match(PARAMETER_PATTERN)\n }\n\n return normalizedSegment\n}\n\nfunction getStaticMetadataRoute(segment: string) {\n const pathname = normalizeAppPath(segment)\n\n return normalizePathSep(\n path.join(\n '/',\n ...pathname\n .split('/')\n .filter(Boolean)\n .map((pathnameSegment) =>\n normalizeStaticMetadataRouteSegment(pathnameSegment)\n )\n )\n )\n}\n\nexport function fillStaticMetadataSegment(\n segment: string,\n lastSegment: string\n) {\n return normalizePathSep(\n path.join(\n getStaticMetadataRoute(segment),\n getMetadataRouteFilename(segment, lastSegment)\n )\n )\n}\n\n/**\n * Returns the pathname used when prerendering static metadata files. Dynamic\n * segments are replaced with \"-\" placeholders so the file is exported once.\n */\nexport function getStaticMetadataPrerenderPathname(\n pathname: string\n): string | null {\n const normalized = pathname.startsWith('/') ? pathname : `/${pathname}`\n if (!isMetadataRouteFile(normalized, [], true)) {\n return null\n }\n\n if (!isDynamicRoute(normalized)) {\n return normalized\n }\n\n const lastSlash = normalized.lastIndexOf('/')\n if (lastSlash === -1) {\n return normalized\n }\n\n const segment = normalized.slice(0, lastSlash) || '/'\n const lastSegment = normalized.slice(lastSlash + 1)\n return fillStaticMetadataSegment(segment, lastSegment)\n}\n\n/**\n * Fill the dynamic segment in the metadata route\n *\n * Example:\n * fillMetadataSegment('/a/[slug]', { params: { slug: 'b' } }, 'open-graph', false) -> '/a/b/open-graph'\n *\n * When isStatic is true, all dynamic segments are filled with \"-\" placeholder\n * since static metadata files have consistent responses regardless of params.\n * Example:\n * fillMetadataSegment('/a/[slug]', {}, 'icon.png', true) -> '/a/-/icon.png'\n *\n */\nexport function fillMetadataSegment(\n segment: string,\n params: any,\n lastSegment: string,\n isStatic: boolean\n) {\n if (isStatic) {\n return fillStaticMetadataSegment(segment, lastSegment)\n }\n\n const pathname = normalizeAppPath(segment)\n const routeRegex = getNamedRouteRegex(pathname, {\n prefixRouteKeys: false,\n })\n const route = interpolateDynamicPath(pathname, params, routeRegex)\n\n return normalizePathSep(\n path.join(route, getMetadataRouteFilename(segment, lastSegment))\n )\n}\n\n/**\n * Map metadata page key to the corresponding route\n *\n * static file page key: /app/robots.txt -> /robots.xml -> /robots.txt/route\n * dynamic route page key: /app/robots.tsx -> /robots -> /robots.txt/route\n *\n * @param page\n * @returns\n */\nexport function normalizeMetadataRoute(page: string) {\n if (!isMetadataPage(page)) {\n return page\n }\n let route = page\n let suffix = ''\n if (page === '/robots') {\n route += '.txt'\n } else if (page === '/manifest') {\n route += '.webmanifest'\n } else {\n suffix = getMetadataRouteSuffix(page)\n }\n // Support both /<metadata-route.ext> and custom routes /<metadata-route>/route.ts.\n // If it's a metadata file route, we need to append /[id]/route to the page.\n if (!route.endsWith('/route')) {\n const { dir, name: baseName, ext } = path.parse(route)\n route = path.posix.join(\n dir,\n `${baseName}${suffix ? `-${suffix}` : ''}${ext}`,\n 'route'\n )\n }\n\n return route\n}\n\n// Normalize metadata route page to either a single route or a dynamic route.\n// e.g. Input: /sitemap/route\n// when isDynamic is false, single route -> /sitemap.xml/route\n// when isDynamic is false, dynamic route -> /sitemap/[__metadata_id__]/route\n// also works for pathname such as /sitemap -> /sitemap.xml, but will not append /route suffix\nexport function normalizeMetadataPageToRoute(page: string, isDynamic: boolean) {\n const isRoute = page.endsWith('/route')\n const routePagePath = isRoute ? page.slice(0, -'/route'.length) : page\n const metadataRouteExtension = routePagePath.endsWith('/sitemap')\n ? '.xml'\n : ''\n const mapped = isDynamic\n ? `${routePagePath}/[__metadata_id__]`\n : `${routePagePath}${metadataRouteExtension}`\n\n return mapped + (isRoute ? '/route' : '')\n}\n"],"names":["fillMetadataSegment","fillStaticMetadataSegment","getStaticMetadataPrerenderPathname","normalizeMetadataPageToRoute","normalizeMetadataRoute","getMetadataRouteSuffix","page","parentPathname","path","dirname","endsWith","suffix","segments","split","some","seg","isGroupSegment","isParallelRouteSegment","djb2Hash","toString","slice","getMetadataRouteFilename","segment","lastSegment","name","ext","parse","pagePath","posix","join","routeSuffix","normalizeStaticMetadataRouteSegment","normalizedSegment","match","PARAMETER_PATTERN","getStaticMetadataRoute","pathname","normalizeAppPath","normalizePathSep","filter","Boolean","map","pathnameSegment","normalized","startsWith","isMetadataRouteFile","isDynamicRoute","lastSlash","lastIndexOf","params","isStatic","routeRegex","getNamedRouteRegex","prefixRouteKeys","route","interpolateDynamicPath","isMetadataPage","dir","baseName","isDynamic","isRoute","routePagePath","length","metadataRouteExtension","mapped"],"mappings":";;;;;;;;;;;;;;;;;;IA4IgBA,mBAAmB;eAAnBA;;IAlDAC,yBAAyB;eAAzBA;;IAgBAC,kCAAkC;eAAlCA;;IAgGAC,4BAA4B;eAA5BA;;IAhCAC,sBAAsB;eAAtBA;;;iCA1Ke;6DACd;6BACsB;4BACJ;iCACD;sBACT;0BACQ;uBACF;kCACE;yBAK1B;;;;;;AAEP;;;;;;;;;;;;;;CAcC,GACD,SAASC,uBAAuBC,IAAY;IAC1C,sDAAsD;IACtD,oCAAoC;IACpC,0CAA0C;IAC1C,MAAMC,iBAAiBC,aAAI,CAACC,OAAO,CAACH;IACpC,2DAA2D;IAC3D,IAAIA,KAAKI,QAAQ,CAAC,eAAeJ,KAAKI,QAAQ,CAAC,iBAAiB;QAC9D,OAAO;IACT;IAEA,qDAAqD;IACrD,IAAIC,SAAS;IACb,kEAAkE;IAClE,MAAMC,WAAWL,eAAeM,KAAK,CAAC;IACtC,IACED,SAASE,IAAI,CAAC,CAACC,MAAQC,IAAAA,uBAAc,EAACD,QAAQE,IAAAA,+BAAsB,EAACF,OACrE;QACA,8CAA8C;QAC9CJ,SAASO,IAAAA,c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,SAAS,CAAC,CAAC,EAAEA,QAAQ,GAAG,KAAKc,KAAK,EAChD;IAEJ;IAEA,OAAO6B;AACT;AAOO,SAASnD,6BAA6BG,IAAY,EAAEqD,SAAkB;IAC3E,MAAMC,UAAUtD,KAAKI,QAAQ,CAAC;IAC9B,MAAMmD,gBAAgBD,UAAUtD,KAAKc,KAAK,CAAC,GAAG,CAAC,SAAS0C,MAAM,IAAIxD;IAClE,MAAMyD,yBAAyBF,cAAcnD,QAAQ,CAAC,cAClD,SACA;IACJ,MAAMsD,SAASL,YACX,GAAGE,cAAc,kBAAkB,CAAC,GACpC,GAAGA,gBAAgBE,wBAAwB;IAE/C,OAAOC,SAAUJ,CAAAA,UAAU,WAAW,EAAC;AACzC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/index.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e86c06f557b0f21a84e1cf7a0d647147646a3275 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/index.d.ts @@ -0,0 +1,3 @@ +type CreateMetadataComponents = typeof import('./metadata').createMetadataComponents; +declare let createMetadataComponentsImpl: CreateMetadataComponents; +export { createMetadataComponentsImpl as createMetadataComponents }; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/index.js b/e-commerce/node_modules/next/dist/lib/metadata/index.js new file mode 100644 index 0000000000000000000000000000000000000000..6e4e4d9ce5a01ad25d427b49d0d28a8970515086 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/index.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "createMetadataComponents", { + enumerable: true, + get: function() { + return createMetadataComponentsImpl; + } +}); +let createMetadataComponentsImpl; +if (process.env.__NEXT_PARALLEL_ROUTE_METADATA) { + createMetadataComponentsImpl = require('./metadata-parallel').createMetadataComponents; +} else { + createMetadataComponentsImpl = require('./metadata').createMetadataComponents; +} + +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/index.js.map b/e-commerce/node_modules/next/dist/lib/metadata/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..054c57eb97d3a341af23256a5385fb8e780bbb66 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/metadata/index.ts"],"sourcesContent":["type CreateMetadataComponents =\n typeof import('./metadata').createMetadataComponents\n\nlet createMetadataComponentsImpl: CreateMetadataComponents\nif (process.env.__NEXT_PARALLEL_ROUTE_METADATA) {\n createMetadataComponentsImpl = (\n require('./metadata-parallel') as typeof import('./metadata-parallel')\n ).createMetadataComponents\n} else {\n createMetadataComponentsImpl = (\n require('./metadata') as typeof import('./metadata')\n ).createMetadataComponents\n}\n\nexport { createMetadataComponentsImpl as createMetadataComponents }\n"],"names":["createMetadataComponents","createMetadataComponentsImpl","process","env","__NEXT_PARALLEL_ROUTE_METADATA","require"],"mappings":";;;;+BAcyCA;;;eAAhCC;;;AAXT,IAAIA;AACJ,IAAIC,QAAQC,GAAG,CAACC,8BAA8B,EAAE;IAC9CH,+BAA+B,AAC7BI,QAAQ,uBACRL,wBAAwB;AAC5B,OAAO;IACLC,+BAA+B,AAC7BI,QAAQ,cACRL,wBAAwB;AAC5B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/is-metadata-route.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/is-metadata-route.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4859e80ca581dbb14c3b4159226074be474b5ac4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/is-metadata-route.d.ts @@ -0,0 +1,53 @@ +import type { PageExtensions } from '../../build/page-extensions-type'; +export declare const STATIC_METADATA_IMAGES: { + readonly icon: { + readonly filename: "icon"; + readonly extensions: readonly ["ico", "jpg", "jpeg", "png", "svg"]; + }; + readonly apple: { + readonly filename: "apple-icon"; + readonly extensions: readonly ["jpg", "jpeg", "png"]; + }; + readonly favicon: { + readonly filename: "favicon"; + readonly extensions: readonly ["ico"]; + }; + readonly openGraph: { + readonly filename: "opengraph-image"; + readonly extensions: readonly ["jpg", "jpeg", "png", "gif"]; + }; + readonly twitter: { + readonly filename: "twitter-image"; + readonly extensions: readonly ["jpg", "jpeg", "png", "gif"]; + }; +}; +export declare const DEFAULT_METADATA_ROUTE_EXTENSIONS: string[]; +export declare const getExtensionRegexString: (staticExtensions: readonly string[], dynamicExtensions: readonly string[] | null) => string; +/** + * Matches the static metadata files, e.g. /robots.txt, /sitemap.xml, /favicon.ico, etc. + * @param appDirRelativePath the relative file path to app/ + * @returns if the path is a static metadata file route + */ +export declare function isStaticMetadataFile(appDirRelativePath: string): boolean; +/** + * Determine if the file is a metadata route file entry + * @param appDirRelativePath the relative file path to app/ + * @param pageExtensions the js extensions, such as ['js', 'jsx', 'ts', 'tsx'] + * @param strictlyMatchExtensions if it's true, match the file with page extension, otherwise match the file with default corresponding extension + * @returns if the file is a metadata route file + */ +export declare function isMetadataRouteFile(appDirRelativePath: string, pageExtensions: PageExtensions, strictlyMatchExtensions: boolean): boolean; +export declare function isStaticMetadataRoute(route: string): boolean; +/** + * Determine if a page or pathname is a metadata page. + * + * The input is a page or pathname, which can be with or without page suffix /foo/page or /foo. + * But it will not contain the /route suffix. + * + * .e.g + * /robots -> true + * /sitemap -> true + * /foo -> false + */ +export declare function isMetadataPage(page: string): boolean; +export declare function isMetadataRoute(route: string): boolean; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/is-metadata-route.js b/e-commerce/node_modules/next/dist/lib/metadata/is-metadata-route.js new file mode 100644 index 0000000000000000000000000000000000000000..a481dd1b0df7bda94f26f595292587b696be3923 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/is-metadata-route.js @@ -0,0 +1,221 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + DEFAULT_METADATA_ROUTE_EXTENSIONS: null, + STATIC_METADATA_IMAGES: null, + getExtensionRegexString: null, + isMetadataPage: null, + isMetadataRoute: null, + isMetadataRouteFile: null, + isStaticMetadataFile: null, + isStaticMetadataRoute: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + DEFAULT_METADATA_ROUTE_EXTENSIONS: function() { + return DEFAULT_METADATA_ROUTE_EXTENSIONS; + }, + STATIC_METADATA_IMAGES: function() { + return STATIC_METADATA_IMAGES; + }, + getExtensionRegexString: function() { + return getExtensionRegexString; + }, + isMetadataPage: function() { + return isMetadataPage; + }, + isMetadataRoute: function() { + return isMetadataRoute; + }, + isMetadataRouteFile: function() { + return isMetadataRouteFile; + }, + isStaticMetadataFile: function() { + return isStaticMetadataFile; + }, + isStaticMetadataRoute: function() { + return isStaticMetadataRoute; + } +}); +const _normalizepathsep = require("../../shared/lib/page-path/normalize-path-sep"); +const _apppaths = require("../../shared/lib/router/utils/app-paths"); +const _isapprouteroute = require("../is-app-route-route"); +const STATIC_METADATA_IMAGES = { + icon: { + filename: 'icon', + extensions: [ + 'ico', + 'jpg', + 'jpeg', + 'png', + 'svg' + ] + }, + apple: { + filename: 'apple-icon', + extensions: [ + 'jpg', + 'jpeg', + 'png' + ] + }, + favicon: { + filename: 'favicon', + extensions: [ + 'ico' + ] + }, + openGraph: { + filename: 'opengraph-image', + extensions: [ + 'jpg', + 'jpeg', + 'png', + 'gif' + ] + }, + twitter: { + filename: 'twitter-image', + extensions: [ + 'jpg', + 'jpeg', + 'png', + 'gif' + ] + } +}; +const DEFAULT_METADATA_ROUTE_EXTENSIONS = [ + 'js', + 'jsx', + 'ts', + 'tsx' +]; +const getExtensionRegexString = (staticExtensions, dynamicExtensions)=>{ + let result; + // If there's no possible multi dynamic routes, will not match any <name>[].<ext> files + if (!dynamicExtensions || dynamicExtensions.length === 0) { + result = `(\\.(?:${staticExtensions.join('|')}))`; + } else { + result = `(?:\\.(${staticExtensions.join('|')})|(\\.(${dynamicExtensions.join('|')})))`; + } + return result; +}; +function isStaticMetadataFile(appDirRelativePath) { + return isMetadataRouteFile(appDirRelativePath, [], true); +} +// Pre-compiled static regexes for common cases +const FAVICON_REGEX = /^[\\/]favicon\.ico$/; +const ROBOTS_TXT_REGEX = /^[\\/]robots\.txt$/; +const MANIFEST_JSON_REGEX = /^[\\/]manifest\.json$/; +const MANIFEST_WEBMANIFEST_REGEX = /^[\\/]manifest\.webmanifest$/; +const SITEMAP_XML_REGEX = /[\\/]sitemap\.xml$/; +// Cache for compiled regex patterns based on parameters +const compiledRegexCache = new Map(); +// Fast path checks for common metadata files +function fastPathCheck(normalizedPath) { + // Check favicon.ico first (most common) + if (FAVICON_REGEX.test(normalizedPath)) return true; + // Check other common static files + if (ROBOTS_TXT_REGEX.test(normalizedPath)) return true; + if (MANIFEST_JSON_REGEX.test(normalizedPath)) return true; + if (MANIFEST_WEBMANIFEST_REGEX.test(normalizedPath)) return true; + if (SITEMAP_XML_REGEX.test(normalizedPath)) return true; + // Quick negative check - if it doesn't contain any metadata keywords, skip + if (!normalizedPath.includes('robots') && !normalizedPath.includes('manifest') && !normalizedPath.includes('sitemap') && !normalizedPath.includes('icon') && !normalizedPath.includes('apple-icon') && !normalizedPath.includes('opengraph-image') && !normalizedPath.includes('twitter-image') && !normalizedPath.includes('favicon')) { + return false; + } + return null // Continue with full regex matching + ; +} +function getCompiledRegexes(pageExtensions, strictlyMatchExtensions) { + // Create cache key + const cacheKey = `${pageExtensions.join(',')}|${strictlyMatchExtensions}`; + const cached = compiledRegexCache.get(cacheKey); + if (cached) { + return cached; + } + // Pre-compute common strings + const trailingMatcher = strictlyMatchExtensions ? '$' : '?$'; + const variantsMatcher = '\\d?'; + const groupSuffix = strictlyMatchExtensions ? '' : '(-\\w{6})?'; + const suffixMatcher = variantsMatcher + groupSuffix; + // Pre-compute extension arrays to avoid repeated concatenation + const robotsExts = pageExtensions.length > 0 ? [ + ...pageExtensions, + 'txt' + ] : [ + 'txt' + ]; + const manifestExts = pageExtensions.length > 0 ? [ + ...pageExtensions, + 'webmanifest', + 'json' + ] : [ + 'webmanifest', + 'json' + ]; + const regexes = [ + new RegExp(`^[\\\\/]robots${getExtensionRegexString(robotsExts, null)}${trailingMatcher}`), + new RegExp(`^[\\\\/]manifest${getExtensionRegexString(manifestExts, null)}${trailingMatcher}`), + // FAVICON_REGEX removed - already handled in fastPathCheck + new RegExp(`[\\\\/]sitemap${getExtensionRegexString([ + 'xml' + ], pageExtensions)}${trailingMatcher}`), + new RegExp(`[\\\\/]icon${suffixMatcher}${getExtensionRegexString(STATIC_METADATA_IMAGES.icon.extensions, pageExtensions)}${trailingMatcher}`), + new RegExp(`[\\\\/]apple-icon${suffixMatcher}${getExtensionRegexString(STATIC_METADATA_IMAGES.apple.extensions, pageExtensions)}${trailingMatcher}`), + new RegExp(`[\\\\/]opengraph-image${suffixMatcher}${getExtensionRegexString(STATIC_METADATA_IMAGES.openGraph.extensions, pageExtensions)}${trailingMatcher}`), + new RegExp(`[\\\\/]twitter-image${suffixMatcher}${getExtensionRegexString(STATIC_METADATA_IMAGES.twitter.extensions, pageExtensions)}${trailingMatcher}`) + ]; + compiledRegexCache.set(cacheKey, regexes); + return regexes; +} +function isMetadataRouteFile(appDirRelativePath, pageExtensions, strictlyMatchExtensions) { + // Early exit for empty or obviously non-metadata paths + if (!appDirRelativePath || appDirRelativePath.length < 2) { + return false; + } + const normalizedPath = (0, _normalizepathsep.normalizePathSep)(appDirRelativePath); + // Fast path check for common cases + const fastResult = fastPathCheck(normalizedPath); + if (fastResult !== null) { + return fastResult; + } + // Get compiled regexes from cache + const regexes = getCompiledRegexes(pageExtensions, strictlyMatchExtensions); + // Use for loop instead of .some() for better performance + for(let i = 0; i < regexes.length; i++){ + if (regexes[i].test(normalizedPath)) { + return true; + } + } + return false; +} +function isStaticMetadataRoute(route) { + // extract ext with regex + const pathname = route.replace(/\/route$/, ''); + const matched = (0, _isapprouteroute.isAppRouteRoute)(route) && isMetadataRouteFile(pathname, [], true) && // These routes can either be built by static or dynamic entrypoints, + // so we assume they're dynamic + pathname !== '/robots.txt' && pathname !== '/manifest.webmanifest' && !pathname.endsWith('/sitemap.xml'); + return matched; +} +function isMetadataPage(page) { + const matched = !(0, _isapprouteroute.isAppRouteRoute)(page) && isMetadataRouteFile(page, [], false); + return matched; +} +function isMetadataRoute(route) { + let page = (0, _apppaths.normalizeAppPath)(route).replace(/^\/?app\//, '')// Remove the dynamic route id + .replace('/[__metadata_id__]', '')// Remove the /route suffix + .replace(/\/route$/, ''); + if (page[0] !== '/') page = '/' + page; + const matched = (0, _isapprouteroute.isAppRouteRoute)(route) && isMetadataRouteFile(page, [], false); + return matched; +} + +//# sourceMappingURL=is-metadata-route.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/is-metadata-route.js.map b/e-commerce/node_modules/next/dist/lib/metadata/is-metadata-route.js.map new file mode 100644 index 0000000000000000000000000000000000000000..57a686c0431cb9cc51ad3056e180230360e8be62 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/is-metadata-route.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/metadata/is-metadata-route.ts"],"sourcesContent":["import type { PageExtensions } from '../../build/page-extensions-type'\nimport { normalizePathSep } from '../../shared/lib/page-path/normalize-path-sep'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { isAppRouteRoute } from '../is-app-route-route'\n\nexport const STATIC_METADATA_IMAGES = {\n icon: {\n filename: 'icon',\n extensions: ['ico', 'jpg', 'jpeg', 'png', 'svg'],\n },\n apple: {\n filename: 'apple-icon',\n extensions: ['jpg', 'jpeg', 'png'],\n },\n favicon: {\n filename: 'favicon',\n extensions: ['ico'],\n },\n openGraph: {\n filename: 'opengraph-image',\n extensions: ['jpg', 'jpeg', 'png', 'gif'],\n },\n twitter: {\n filename: 'twitter-image',\n extensions: ['jpg', 'jpeg', 'png', 'gif'],\n },\n} as const\n\n// Match routes that are metadata routes, e.g. /sitemap.xml, /favicon.<ext>, /<icon>.<ext>, etc.\n// TODO-METADATA: support more metadata routes with more extensions\nexport const DEFAULT_METADATA_ROUTE_EXTENSIONS = ['js', 'jsx', 'ts', 'tsx']\n\n// Match the file extension with the dynamic multi-routes extensions\n// e.g. ([xml, js], null) -> can match `/sitemap.xml/route`, `sitemap.js/route`\n// e.g. ([png], [ts]) -> can match `/opengraph-image.png`, `/opengraph-image.ts`\nexport const getExtensionRegexString = (\n staticExtensions: readonly string[],\n dynamicExtensions: readonly string[] | null\n) => {\n let result: string\n // If there's no possible multi dynamic routes, will not match any <name>[].<ext> files\n if (!dynamicExtensions || dynamicExtensions.length === 0) {\n result = `(\\\\.(?:${staticExtensions.join('|')}))`\n } else {\n result = `(?:\\\\.(${staticExtensions.join('|')})|(\\\\.(${dynamicExtensions.join('|')})))`\n }\n return result\n}\n\n/**\n * Matches the static metadata files, e.g. /robots.txt, /sitemap.xml, /favicon.ico, etc.\n * @param appDirRelativePath the relative file path to app/\n * @returns if the path is a static metadata file route\n */\nexport function isStaticMetadataFile(appDirRelativePath: string) {\n return isMetadataRouteFile(appDirRelativePath, [], true)\n}\n\n// Pre-compiled static regexes for common cases\nconst FAVICON_REGEX = /^[\\\\/]favicon\\.ico$/\nconst ROBOTS_TXT_REGEX = /^[\\\\/]robots\\.txt$/\nconst MANIFEST_JSON_REGEX = /^[\\\\/]manifest\\.json$/\nconst MANIFEST_WEBMANIFEST_REGEX = /^[\\\\/]manifest\\.webmanifest$/\nconst SITEMAP_XML_REGEX = /[\\\\/]sitemap\\.xml$/\n\n// Cache for compiled regex patterns based on parameters\nconst compiledRegexCache = new Map<string, RegExp[]>()\n\n// Fast path checks for common metadata files\nfunction fastPathCheck(normalizedPath: string): boolean | null {\n // Check favicon.ico first (most common)\n if (FAVICON_REGEX.test(normalizedPath)) return true\n\n // Check other common static files\n if (ROBOTS_TXT_REGEX.test(normalizedPath)) return true\n if (MANIFEST_JSON_REGEX.test(normalizedPath)) return true\n if (MANIFEST_WEBMANIFEST_REGEX.test(normalizedPath)) return true\n if (SITEMAP_XML_REGEX.test(normalizedPath)) return true\n\n // Quick negative check - if it doesn't contain any metadata keywords, skip\n if (\n !normalizedPath.includes('robots') &&\n !normalizedPath.includes('manifest') &&\n !normalizedPath.includes('sitemap') &&\n !normalizedPath.includes('icon') &&\n !normalizedPath.includes('apple-icon') &&\n !normalizedPath.includes('opengraph-image') &&\n !normalizedPath.includes('twitter-image') &&\n !normalizedPath.includes('favicon')\n ) {\n return false\n }\n\n return null // Continue with full regex matching\n}\n\nfunction getCompiledRegexes(\n pageExtensions: PageExtensions,\n strictlyMatchExtensions: boolean\n): RegExp[] {\n // Create cache key\n const cacheKey = `${pageExtensions.join(',')}|${strictlyMatchExtensions}`\n\n const cached = compiledRegexCache.get(cacheKey)\n if (cached) {\n return cached\n }\n\n // Pre-compute common strings\n const trailingMatcher = strictlyMatchExtensions ? '$' : '?$'\n const variantsMatcher = '\\\\d?'\n const groupSuffix = strictlyMatchExtensions ? '' : '(-\\\\w{6})?'\n const suffixMatcher = variantsMatcher + groupSuffix\n\n // Pre-compute extension arrays to avoid repeated concatenation\n const robotsExts =\n pageExtensions.length > 0 ? [...pageExtensions, 'txt'] : ['txt']\n const manifestExts =\n pageExtensions.length > 0\n ? [...pageExtensions, 'webmanifest', 'json']\n : ['webmanifest', 'json']\n\n const regexes = [\n new RegExp(\n `^[\\\\\\\\/]robots${getExtensionRegexString(robotsExts, null)}${trailingMatcher}`\n ),\n new RegExp(\n `^[\\\\\\\\/]manifest${getExtensionRegexString(manifestExts, null)}${trailingMatcher}`\n ),\n // FAVICON_REGEX removed - already handled in fastPathCheck\n new RegExp(\n `[\\\\\\\\/]sitemap${getExtensionRegexString(['xml'], pageExtensions)}${trailingMatcher}`\n ),\n new RegExp(\n `[\\\\\\\\/]icon${suffixMatcher}${getExtensionRegexString(\n STATIC_METADATA_IMAGES.icon.extensions,\n pageExtensions\n )}${trailingMatcher}`\n ),\n new RegExp(\n `[\\\\\\\\/]apple-icon${suffixMatcher}${getExtensionRegexString(\n STATIC_METADATA_IMAGES.apple.extensions,\n pageExtensions\n )}${trailingMatcher}`\n ),\n new RegExp(\n `[\\\\\\\\/]opengraph-image${suffixMatcher}${getExtensionRegexString(\n STATIC_METADATA_IMAGES.openGraph.extensions,\n pageExtensions\n )}${trailingMatcher}`\n ),\n new RegExp(\n `[\\\\\\\\/]twitter-image${suffixMatcher}${getExtensionRegexString(\n STATIC_METADATA_IMAGES.twitter.extensions,\n pageExtensions\n )}${trailingMatcher}`\n ),\n ]\n\n compiledRegexCache.set(cacheKey, regexes)\n return regexes\n}\n\n/**\n * Determine if the file is a metadata route file entry\n * @param appDirRelativePath the relative file path to app/\n * @param pageExtensions the js extensions, such as ['js', 'jsx', 'ts', 'tsx']\n * @param strictlyMatchExtensions if it's true, match the file with page extension, otherwise match the file with default corresponding extension\n * @returns if the file is a metadata route file\n */\nexport function isMetadataRouteFile(\n appDirRelativePath: string,\n pageExtensions: PageExtensions,\n strictlyMatchExtensions: boolean\n): boolean {\n // Early exit for empty or obviously non-metadata paths\n if (!appDirRelativePath || appDirRelativePath.length < 2) {\n return false\n }\n\n const normalizedPath = normalizePathSep(appDirRelativePath)\n\n // Fast path check for common cases\n const fastResult = fastPathCheck(normalizedPath)\n if (fastResult !== null) {\n return fastResult\n }\n\n // Get compiled regexes from cache\n const regexes = getCompiledRegexes(pageExtensions, strictlyMatchExtensions)\n\n // Use for loop instead of .some() for better performance\n for (let i = 0; i < regexes.length; i++) {\n if (regexes[i].test(normalizedPath)) {\n return true\n }\n }\n\n return false\n}\n\n// Check if the route is a static metadata route, with /route suffix\n// e.g. /favicon.ico/route, /icon.png/route, etc.\n// But skip the text routes like robots.txt since they might also be dynamic.\n// Checking route path is not enough to determine if text routes is dynamic.\nexport function isStaticMetadataRoute(route: string) {\n // extract ext with regex\n const pathname = route.replace(/\\/route$/, '')\n\n const matched =\n isAppRouteRoute(route) &&\n isMetadataRouteFile(pathname, [], true) &&\n // These routes can either be built by static or dynamic entrypoints,\n // so we assume they're dynamic\n pathname !== '/robots.txt' &&\n pathname !== '/manifest.webmanifest' &&\n !pathname.endsWith('/sitemap.xml')\n\n return matched\n}\n\n/**\n * Determine if a page or pathname is a metadata page.\n *\n * The input is a page or pathname, which can be with or without page suffix /foo/page or /foo.\n * But it will not contain the /route suffix.\n *\n * .e.g\n * /robots -> true\n * /sitemap -> true\n * /foo -> false\n */\nexport function isMetadataPage(page: string) {\n const matched = !isAppRouteRoute(page) && isMetadataRouteFile(page, [], false)\n\n return matched\n}\n\n/*\n * Determine if a Next.js route is a metadata route.\n * `route` will has a route suffix.\n *\n * e.g.\n * /app/robots/route -> true\n * /robots/route -> true\n * /sitemap/[__metadata_id__]/route -> true\n * /app/sitemap/page -> false\n * /icon-a102f4/route -> true\n */\nexport function isMetadataRoute(route: string): boolean {\n let page = normalizeAppPath(route)\n .replace(/^\\/?app\\//, '')\n // Remove the dynamic route id\n .replace('/[__metadata_id__]', '')\n // Remove the /route suffix\n .replace(/\\/route$/, '')\n\n if (page[0] !== '/') page = '/' + page\n\n const matched = isAppRouteRoute(route) && isMetadataRouteFile(page, [], false)\n\n return matched\n}\n"],"names":["DEFAULT_METADATA_ROUTE_EXTENSIONS","STATIC_METADATA_IMAGES","getExtensionRegexString","isMetadataPage","isMetadataRoute","isMetadataRouteFile","isStaticMetadataFile","isStaticMetadataRoute","icon","filename","extensions","apple","favicon","openGraph","twitter","staticExtensions","dynamicExtensions","result","length","join","appDirRelativePath","FAVICON_REGEX","ROBOTS_TXT_REGEX","MANIFEST_JSON_REGEX","MANIFEST_WEBMANIFEST_REGEX","SITEMAP_XML_REGEX","compiledRegexCache","Map","fastPathCheck","normalizedPath","test","includes","getCompiledRegexes","pageExtensions","strictlyMatchExtensions","cacheKey","cached","get","trailingMatcher","variantsMatcher","groupSuffix","suffixMatcher","robotsExts","manifestExts","regexes","RegExp","set","normalizePathSep","fastResult","i","route","pathname","replace","matched","isAppRouteRoute","endsWith","page","normalizeAppPath"],"mappings":";;;;;;;;;;;;;;;;;;;;;IA8BaA,iCAAiC;eAAjCA;;IAzBAC,sBAAsB;eAAtBA;;IA8BAC,uBAAuB;eAAvBA;;IAqMGC,cAAc;eAAdA;;IAiBAC,eAAe;eAAfA;;IA/EAC,mBAAmB;eAAnBA;;IApHAC,oBAAoB;eAApBA;;IAuJAC,qBAAqB;eAArBA;;;kCA5MiB;0BACA;iCACD;AAEzB,MAAMN,yBAAyB;IACpCO,MAAM;QACJC,UAAU;QACVC,YAAY;YAAC;YAAO;YAAO;YAAQ;YAAO;SAAM;IAClD;IACAC,OAAO;QACLF,UAAU;QACVC,YAAY;YAAC;YAAO;YAAQ;SAAM;IACpC;IACAE,SAAS;QACPH,UAAU;QACVC,YAAY;YAAC;SAAM;IACrB;IACAG,WAAW;QACTJ,UAAU;QACVC,YAAY;YAAC;YAAO;YAAQ;YAAO;SAAM;IAC3C;IACAI,SAAS;QACPL,UAAU;QACVC,YAAY;YAAC;YAAO;YAAQ;YAAO;SAAM;IAC3C;AACF;AAIO,MAAMV,oCAAoC;IAAC;IAAM;IAAO;IAAM;CAAM;AAKpE,MAAME,0BAA0B,CACrCa,kBACAC;IAEA,IAAIC;IACJ,uFAAuF;IACvF,IAAI,CAACD,qBAAqBA,kBAAkBE,MAAM,KAAK,GAAG;QACxDD,SAAS,CAAC,OAAO,EAAEF,iBAAiBI,IAAI,CAAC,KAAK,EAAE,CAAC;IACnD,OAAO;QACLF,SAAS,CAAC,OAAO,EAAEF,iBAAiBI,IAAI,CAAC,KAAK,OAAO,EAAEH,kBAAkBG,IAAI,CAAC,KAAK,GAAG,CAAC;IACzF;IACA,OAAOF;AACT;AAOO,SAASX,qBAAqBc,kBAA0B;IAC7D,OAAOf,oBAAoBe,oBAAoB,EAAE,EAAE;AACrD;AAEA,+CAA+C;AAC/C,MAAMC,gBAAgB;AACtB,MAAMC,mBAA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IAAK,IAAIe,IAAI,GAAGA,IAAIL,QAAQ1B,MAAM,EAAE+B,IAAK;QACvC,IAAIL,OAAO,CAACK,EAAE,CAACnB,IAAI,CAACD,iBAAiB;YACnC,OAAO;QACT;IACF;IAEA,OAAO;AACT;AAMO,SAAStB,sBAAsB2C,KAAa;IACjD,yBAAyB;IACzB,MAAMC,WAAWD,MAAME,OAAO,CAAC,YAAY;IAE3C,MAAMC,UACJC,IAAAA,gCAAe,EAACJ,UAChB7C,oBAAoB8C,UAAU,EAAE,EAAE,SAClC,qEAAqE;IACrE,+BAA+B;IAC/BA,aAAa,iBACbA,aAAa,2BACb,CAACA,SAASI,QAAQ,CAAC;IAErB,OAAOF;AACT;AAaO,SAASlD,eAAeqD,IAAY;IACzC,MAAMH,UAAU,CAACC,IAAAA,gCAAe,EAACE,SAASnD,oBAAoBmD,MAAM,EAAE,EAAE;IAExE,OAAOH;AACT;AAaO,SAASjD,gBAAgB8C,KAAa;IAC3C,IAAIM,OAAOC,IAAAA,0BAAgB,EAACP,OACzBE,OAAO,CAAC,aAAa,GACtB,8BAA8B;KAC7BA,OAAO,CAAC,sBAAsB,GAC/B,2BAA2B;KAC1BA,OAAO,CAAC,YAAY;IAEvB,IAAII,IAAI,CAAC,EAAE,KAAK,KAAKA,OAAO,MAAMA;IAElC,MAAMH,UAAUC,IAAAA,gCAAe,EAACJ,UAAU7C,oBAAoBmD,MAAM,EAAE,EAAE;IAExE,OAAOH;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/metadata-context.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/metadata-context.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3913fa21f1fe1a9667806fec26e82445087b0f2a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/metadata-context.d.ts @@ -0,0 +1,3 @@ +import type { AppRenderContext } from '../../server/app-render/app-render'; +import type { MetadataContext } from './types/resolvers'; +export declare function createMetadataContext(renderOpts: AppRenderContext['renderOpts']): MetadataContext; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/metadata-context.js b/e-commerce/node_modules/next/dist/lib/metadata/metadata-context.js new file mode 100644 index 0000000000000000000000000000000000000000..70271e74b5a57a4d2701a83b520ee0097753bc3b --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/metadata-context.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "createMetadataContext", { + enumerable: true, + get: function() { + return createMetadataContext; + } +}); +function createMetadataContext(renderOpts) { + return { + trailingSlash: renderOpts.trailingSlash, + isStaticMetadataRouteFile: false + }; +} + +//# sourceMappingURL=metadata-context.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/metadata-context.js.map b/e-commerce/node_modules/next/dist/lib/metadata/metadata-context.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f36887f537932690e2055029303e1b377485a61a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/metadata-context.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/metadata/metadata-context.tsx"],"sourcesContent":["import type { AppRenderContext } from '../../server/app-render/app-render'\nimport type { MetadataContext } from './types/resolvers'\n\nexport function createMetadataContext(\n renderOpts: AppRenderContext['renderOpts']\n): MetadataContext {\n return {\n trailingSlash: renderOpts.trailingSlash,\n isStaticMetadataRouteFile: false,\n }\n}\n"],"names":["createMetadataContext","renderOpts","trailingSlash","isStaticMetadataRouteFile"],"mappings":";;;;+BAGgBA;;;eAAAA;;;AAAT,SAASA,sBACdC,UAA0C;IAE1C,OAAO;QACLC,eAAeD,WAAWC,aAAa;QACvCC,2BAA2B;IAC7B;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/metadata-elements.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/metadata-elements.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3ef7fdb6a7237dfd805d4904de1d1cb978048944 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/metadata-elements.d.ts @@ -0,0 +1,5 @@ +import React from 'react'; +import type { SelectedMetadata } from './metadata-resolution-primitives'; +import type { ResolvedViewport } from './types/metadata-interface'; +export declare function createViewportElements(viewport: ResolvedViewport): React.ReactElement[]; +export declare function createMetadataElements(metadata: SelectedMetadata): React.ReactElement[]; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/metadata-elements.js b/e-commerce/node_modules/next/dist/lib/metadata/metadata-elements.js new file mode 100644 index 0000000000000000000000000000000000000000..a7721848d48a6c2edc13ba5dc5fff141321f0d84 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/metadata-elements.js @@ -0,0 +1,1498 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + createMetadataElements: null, + createViewportElements: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + createMetadataElements: function() { + return createMetadataElements; + }, + createViewportElements: function() { + return createViewportElements; + } +}); +const _jsxruntime = require("react/jsx-runtime"); +const _react = /*#__PURE__*/ _interop_require_default(require("react")); +const _utils = require("./generate/utils"); +const _iconmark = require("./generate/icon-mark"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function createViewportElements(viewport) { + const tags = []; + let i = 0; + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + charSet: "utf-8" + }, i++)); + // Build viewport content string from layout properties + const viewportParts = []; + if (viewport.width != null) { + viewportParts.push(`width=${viewport.width}`); + } + if (viewport.height != null) { + viewportParts.push(`height=${viewport.height}`); + } + if (viewport.initialScale != null) { + viewportParts.push(`initial-scale=${viewport.initialScale}`); + } + if (viewport.minimumScale != null) { + viewportParts.push(`minimum-scale=${viewport.minimumScale}`); + } + if (viewport.maximumScale != null) { + viewportParts.push(`maximum-scale=${viewport.maximumScale}`); + } + if (viewport.userScalable != null) { + viewportParts.push(`user-scalable=${viewport.userScalable ? 'yes' : 'no'}`); + } + if (viewport.viewportFit) { + viewportParts.push(`viewport-fit=${viewport.viewportFit}`); + } + if (viewport.interactiveWidget) { + viewportParts.push(`interactive-widget=${viewport.interactiveWidget}`); + } + if (viewportParts.length) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "viewport", + content: viewportParts.join(', ') + }, i++)); + } + if (viewport.themeColor) { + for (const themeColor of viewport.themeColor){ + if (themeColor.media) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "theme-color", + content: themeColor.color, + media: themeColor.media + }, i++)); + } else { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "theme-color", + content: themeColor.color + }, i++)); + } + } + } + if (viewport.colorScheme) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "color-scheme", + content: viewport.colorScheme + }, i++)); + } + return tags; +} +function createMetadataElements(metadata) { + var _metadata_robots, _metadata_robots1; + const tags = []; + let i = 0; + // --- Title --- + if (metadata.title) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("title", { + children: metadata.title + }, i++)); + } + // --- Basic meta tags --- + if (metadata.description) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "description", + content: metadata.description + }, i++)); + } + if (metadata.applicationName) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "application-name", + content: metadata.applicationName + }, i++)); + } + // --- Authors --- + if (metadata.authors) { + for (const author of metadata.authors){ + if (author.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", { + rel: "author", + href: author.url.toString() + }, i++)); + } + if (author.name) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "author", + content: author.name + }, i++)); + } + } + } + // --- Manifest --- + if (metadata.manifest) { + const manifestOrigin = (0, _utils.getOrigin)(metadata.manifest); + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", { + rel: "manifest", + href: metadata.manifest.toString(), + crossOrigin: !manifestOrigin && process.env.VERCEL_ENV === 'preview' ? 'use-credentials' : undefined + }, i++)); + } + if (metadata.generator) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "generator", + content: metadata.generator + }, i++)); + } + if (metadata.keywords && metadata.keywords.length) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "keywords", + content: metadata.keywords.join(',') + }, i++)); + } + if (metadata.referrer) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "referrer", + content: metadata.referrer + }, i++)); + } + if (metadata.creator) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "creator", + content: metadata.creator + }, i++)); + } + if (metadata.publisher) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "publisher", + content: metadata.publisher + }, i++)); + } + if ((_metadata_robots = metadata.robots) == null ? void 0 : _metadata_robots.basic) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "robots", + content: metadata.robots.basic + }, i++)); + } + if ((_metadata_robots1 = metadata.robots) == null ? void 0 : _metadata_robots1.googleBot) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "googlebot", + content: metadata.robots.googleBot + }, i++)); + } + if (metadata.abstract) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "abstract", + content: metadata.abstract + }, i++)); + } + // --- Link rel arrays --- + if (metadata.archives) { + for (const archive of metadata.archives){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", { + rel: "archives", + href: archive + }, i++)); + } + } + if (metadata.assets) { + for (const asset of metadata.assets){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", { + rel: "assets", + href: asset + }, i++)); + } + } + if (metadata.bookmarks) { + for (const bookmark of metadata.bookmarks){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", { + rel: "bookmarks", + href: bookmark + }, i++)); + } + } + // --- Pagination --- + if (metadata.pagination) { + if (metadata.pagination.previous) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", { + rel: "prev", + href: metadata.pagination.previous + }, i++)); + } + if (metadata.pagination.next) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", { + rel: "next", + href: metadata.pagination.next + }, i++)); + } + } + if (metadata.category) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "category", + content: metadata.category + }, i++)); + } + if (metadata.classification) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "classification", + content: metadata.classification + }, i++)); + } + // --- Other (arbitrary name/value pairs) --- + if (metadata.other) { + for (const [name, content] of Object.entries(metadata.other)){ + if (Array.isArray(content)) { + for (const contentItem of content){ + if (contentItem != null && contentItem !== '') { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: name, + content: String(contentItem) + }, i++)); + } + } + } else if (content != null && content !== '') { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: name, + content: String(content) + }, i++)); + } + } + } + // --- Alternates --- + if (metadata.alternates) { + const { canonical, languages, media, types } = metadata.alternates; + if (canonical && canonical.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", { + rel: "canonical", + href: canonical.url.toString(), + ...canonical.title ? { + title: canonical.title + } : undefined + }, i++)); + } + if (languages) { + for (const [locale, descriptors] of Object.entries(languages)){ + if (descriptors) { + for (const descriptor of descriptors){ + if (descriptor.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", { + rel: "alternate", + hrefLang: locale, + href: descriptor.url.toString(), + ...descriptor.title ? { + title: descriptor.title + } : undefined + }, i++)); + } + } + } + } + } + if (media) { + for (const [mediaName, descriptors] of Object.entries(media)){ + if (descriptors) { + for (const descriptor of descriptors){ + if (descriptor.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", { + rel: "alternate", + media: mediaName, + href: descriptor.url.toString(), + ...descriptor.title ? { + title: descriptor.title + } : undefined + }, i++)); + } + } + } + } + } + if (types) { + for (const [type, descriptors] of Object.entries(types)){ + if (descriptors) { + for (const descriptor of descriptors){ + if (descriptor.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", { + rel: "alternate", + type: type, + href: descriptor.url.toString(), + ...descriptor.title ? { + title: descriptor.title + } : undefined + }, i++)); + } + } + } + } + } + } + // --- iTunes --- + if (metadata.itunes) { + const { appId, appArgument } = metadata.itunes; + let itunesContent = `app-id=${appId}`; + if (appArgument) { + itunesContent += `, app-argument=${appArgument}`; + } + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "apple-itunes-app", + content: itunesContent + }, i++)); + } + // --- Facebook --- + if (metadata.facebook) { + if (metadata.facebook.appId) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "fb:app_id", + content: metadata.facebook.appId + }, i++)); + } + if (metadata.facebook.admins) { + for (const admin of metadata.facebook.admins){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "fb:admins", + content: admin + }, i++)); + } + } + } + // --- Pinterest --- + if (metadata.pinterest && metadata.pinterest.richPin !== undefined) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "pinterest-rich-pin", + content: metadata.pinterest.richPin.toString() + }, i++)); + } + // --- Format Detection --- + if (metadata.formatDetection) { + const formatDetectionKeys = [ + 'telephone', + 'date', + 'address', + 'email', + 'url' + ]; + let formatContent = ''; + for (const key of formatDetectionKeys){ + if (metadata.formatDetection[key] === false) { + if (formatContent) formatContent += ', '; + formatContent += `${key}=no`; + } + } + if (formatContent) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "format-detection", + content: formatContent + }, i++)); + } + } + // --- Verification --- + if (metadata.verification) { + const verification = metadata.verification; + if (verification.google) { + for (const value of verification.google){ + if (value != null && value !== '') { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "google-site-verification", + content: String(value) + }, i++)); + } + } + } + if (verification.yahoo) { + for (const value of verification.yahoo){ + if (value != null && value !== '') { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "y_key", + content: String(value) + }, i++)); + } + } + } + if (verification.yandex) { + for (const value of verification.yandex){ + if (value != null && value !== '') { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "yandex-verification", + content: String(value) + }, i++)); + } + } + } + if (verification.me) { + for (const value of verification.me){ + if (value != null && value !== '') { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "me", + content: String(value) + }, i++)); + } + } + } + if (verification.other) { + for (const [name, values] of Object.entries(verification.other)){ + for (const value of values){ + if (value != null && value !== '') { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: name, + content: String(value) + }, i++)); + } + } + } + } + } + // --- Apple Web App --- + if (metadata.appleWebApp) { + const { capable, title, startupImage, statusBarStyle } = metadata.appleWebApp; + if (capable) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "mobile-web-app-capable", + content: "yes" + }, i++)); + } + if (title) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "apple-mobile-web-app-title", + content: title + }, i++)); + } + if (startupImage) { + for (const image of startupImage){ + if (image.media) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", { + href: image.url, + media: image.media, + rel: "apple-touch-startup-image" + }, i++)); + } else { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", { + href: image.url, + rel: "apple-touch-startup-image" + }, i++)); + } + } + } + if (statusBarStyle) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "apple-mobile-web-app-status-bar-style", + content: statusBarStyle + }, i++)); + } + } + // --- Open Graph --- + if (metadata.openGraph) { + const og = metadata.openGraph; + if (og.determiner) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:determiner", + content: og.determiner + }, i++)); + } + if (og.title) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:title", + content: og.title + }, i++)); + } + if (og.description) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:description", + content: og.description + }, i++)); + } + if (og.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:url", + content: og.url.toString() + }, i++)); + } + if (og.siteName) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:site_name", + content: og.siteName + }, i++)); + } + if (og.locale) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:locale", + content: og.locale + }, i++)); + } + if (og.countryName) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:country_name", + content: og.countryName + }, i++)); + } + if (og.ttl != null) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:ttl", + content: og.ttl.toString() + }, i++)); + } + // OG images + if (og.images) { + for (const image of og.images){ + if (typeof image === 'string') { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:image", + content: image + }, i++)); + } else { + if (image.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:image", + content: String(image.url) + }, i++)); + } + if (image.secureUrl) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:image:secure_url", + content: String(image.secureUrl) + }, i++)); + } + if (image.type) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:image:type", + content: image.type + }, i++)); + } + if (image.width) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:image:width", + content: String(image.width) + }, i++)); + } + if (image.height) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:image:height", + content: String(image.height) + }, i++)); + } + if (image.alt) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:image:alt", + content: image.alt + }, i++)); + } + } + } + } + // OG videos + if (og.videos) { + for (const video of og.videos){ + if (typeof video === 'string') { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:video", + content: video + }, i++)); + } else { + if (video.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:video", + content: String(video.url) + }, i++)); + } + if (video.secureUrl) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:video:secure_url", + content: String(video.secureUrl) + }, i++)); + } + if (video.type) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:video:type", + content: video.type + }, i++)); + } + if (video.width) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:video:width", + content: String(video.width) + }, i++)); + } + if (video.height) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:video:height", + content: String(video.height) + }, i++)); + } + } + } + } + // OG audio + if (og.audio) { + for (const audio of og.audio){ + if (typeof audio === 'string') { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:audio", + content: audio + }, i++)); + } else { + if (audio.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:audio", + content: String(audio.url) + }, i++)); + } + if (audio.secureUrl) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:audio:secure_url", + content: String(audio.secureUrl) + }, i++)); + } + if (audio.type) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:audio:type", + content: audio.type + }, i++)); + } + } + } + } + // OG simple array properties + if (og.emails) { + for (const email of og.emails){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:email", + content: email + }, i++)); + } + } + if (og.phoneNumbers) { + for (const phone of og.phoneNumbers){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:phone_number", + content: phone + }, i++)); + } + } + if (og.faxNumbers) { + for (const fax of og.faxNumbers){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:fax_number", + content: fax + }, i++)); + } + } + if (og.alternateLocale) { + for (const locale of og.alternateLocale){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:locale:alternate", + content: locale + }, i++)); + } + } + // OG type-specific tags + if ('type' in og) { + const ogType = og.type; + switch(ogType){ + case 'website': + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:type", + content: "website" + }, i++)); + break; + case 'article': + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:type", + content: "article" + }, i++)); + if (og.publishedTime) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "article:published_time", + content: og.publishedTime.toString() + }, i++)); + } + if (og.modifiedTime) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "article:modified_time", + content: og.modifiedTime.toString() + }, i++)); + } + if (og.expirationTime) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "article:expiration_time", + content: og.expirationTime.toString() + }, i++)); + } + if (og.authors) { + for (const author of og.authors){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "article:author", + content: String(author) + }, i++)); + } + } + if (og.section) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "article:section", + content: og.section + }, i++)); + } + if (og.tags) { + for (const tag of og.tags){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "article:tag", + content: tag + }, i++)); + } + } + break; + case 'book': + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:type", + content: "book" + }, i++)); + if (og.isbn) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "book:isbn", + content: og.isbn + }, i++)); + } + if (og.releaseDate) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "book:release_date", + content: og.releaseDate + }, i++)); + } + if (og.authors) { + for (const author of og.authors){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "book:author", + content: String(author) + }, i++)); + } + } + if (og.tags) { + for (const tag of og.tags){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "book:tag", + content: tag + }, i++)); + } + } + break; + case 'profile': + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:type", + content: "profile" + }, i++)); + if (og.firstName) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "profile:first_name", + content: og.firstName + }, i++)); + } + if (og.lastName) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "profile:last_name", + content: og.lastName + }, i++)); + } + if (og.username) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "profile:username", + content: og.username + }, i++)); + } + if (og.gender) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "profile:gender", + content: og.gender + }, i++)); + } + break; + case 'music.song': + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:type", + content: "music.song" + }, i++)); + if (og.duration != null) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "music:duration", + content: og.duration.toString() + }, i++)); + } + if (og.albums) { + for (const album of og.albums){ + if (typeof album === 'string') { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "music:album", + content: album + }, i++)); + } else { + if (album.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "music:album", + content: String(album.url) + }, i++)); + } + if (album.disc != null) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "music:album:disc", + content: String(album.disc) + }, i++)); + } + if (album.track != null) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "music:album:track", + content: String(album.track) + }, i++)); + } + } + } + } + if (og.musicians) { + for (const musician of og.musicians){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "music:musician", + content: String(musician) + }, i++)); + } + } + break; + case 'music.album': + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:type", + content: "music.album" + }, i++)); + if (og.songs) { + for (const song of og.songs){ + if (typeof song === 'string') { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "music:song", + content: song + }, i++)); + } else { + if (song.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "music:song", + content: String(song.url) + }, i++)); + } + if (song.disc != null) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "music:song:disc", + content: String(song.disc) + }, i++)); + } + if (song.track != null) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "music:song:track", + content: String(song.track) + }, i++)); + } + } + } + } + if (og.musicians) { + for (const musician of og.musicians){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "music:musician", + content: String(musician) + }, i++)); + } + } + if (og.releaseDate) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "music:release_date", + content: og.releaseDate + }, i++)); + } + break; + case 'music.playlist': + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:type", + content: "music.playlist" + }, i++)); + if (og.songs) { + for (const song of og.songs){ + if (typeof song === 'string') { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "music:song", + content: song + }, i++)); + } else { + if (song.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "music:song", + content: String(song.url) + }, i++)); + } + if (song.disc != null) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "music:song:disc", + content: String(song.disc) + }, i++)); + } + if (song.track != null) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "music:song:track", + content: String(song.track) + }, i++)); + } + } + } + } + if (og.creators) { + for (const creator of og.creators){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "music:creator", + content: String(creator) + }, i++)); + } + } + break; + case 'music.radio_station': + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:type", + content: "music.radio_station" + }, i++)); + if (og.creators) { + for (const creator of og.creators){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "music:creator", + content: String(creator) + }, i++)); + } + } + break; + case 'video.movie': + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:type", + content: "video.movie" + }, i++)); + if (og.actors) { + for (const actor of og.actors){ + if (typeof actor === 'string') { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "video:actor", + content: actor + }, i++)); + } else { + if (actor.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "video:actor", + content: String(actor.url) + }, i++)); + } + if (actor.role) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "video:actor:role", + content: actor.role + }, i++)); + } + } + } + } + if (og.directors) { + for (const director of og.directors){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "video:director", + content: String(director) + }, i++)); + } + } + if (og.writers) { + for (const writer of og.writers){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "video:writer", + content: String(writer) + }, i++)); + } + } + if (og.duration != null) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "video:duration", + content: String(og.duration) + }, i++)); + } + if (og.releaseDate) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "video:release_date", + content: og.releaseDate + }, i++)); + } + if (og.tags) { + for (const tag of og.tags){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "video:tag", + content: tag + }, i++)); + } + } + break; + case 'video.episode': + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:type", + content: "video.episode" + }, i++)); + if (og.actors) { + for (const actor of og.actors){ + if (typeof actor === 'string') { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "video:actor", + content: actor + }, i++)); + } else { + if (actor.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "video:actor", + content: String(actor.url) + }, i++)); + } + if (actor.role) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "video:actor:role", + content: actor.role + }, i++)); + } + } + } + } + if (og.directors) { + for (const director of og.directors){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "video:director", + content: String(director) + }, i++)); + } + } + if (og.writers) { + for (const writer of og.writers){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "video:writer", + content: String(writer) + }, i++)); + } + } + if (og.duration != null) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "video:duration", + content: String(og.duration) + }, i++)); + } + if (og.releaseDate) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "video:release_date", + content: og.releaseDate + }, i++)); + } + if (og.tags) { + for (const tag of og.tags){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "video:tag", + content: tag + }, i++)); + } + } + if (og.series) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "video:series", + content: String(og.series) + }, i++)); + } + break; + case 'video.tv_show': + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:type", + content: "video.tv_show" + }, i++)); + break; + case 'video.other': + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "og:type", + content: "video.other" + }, i++)); + break; + default: + const _exhaustiveCheck = ogType; + throw new Error(`Invalid OpenGraph type: ${_exhaustiveCheck}`); + } + } + } + // --- Twitter --- + if (metadata.twitter) { + const tw = metadata.twitter; + const { card } = tw; + if (card) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "twitter:card", + content: card + }, i++)); + } + if (tw.site) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "twitter:site", + content: tw.site + }, i++)); + } + if (tw.siteId) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "twitter:site:id", + content: tw.siteId + }, i++)); + } + if (tw.creator) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "twitter:creator", + content: tw.creator + }, i++)); + } + if (tw.creatorId) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "twitter:creator:id", + content: tw.creatorId + }, i++)); + } + if (tw.title) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "twitter:title", + content: tw.title + }, i++)); + } + if (tw.description) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "twitter:description", + content: tw.description + }, i++)); + } + // Twitter images + if (tw.images) { + for (const image of tw.images){ + if (typeof image === 'string') { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "twitter:image", + content: image + }, i++)); + } else { + if (image.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "twitter:image", + content: String(image.url) + }, i++)); + } + if (image.alt) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "twitter:image:alt", + content: image.alt + }, i++)); + } + if (image.secureUrl) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "twitter:image:secure_url", + content: String(image.secureUrl) + }, i++)); + } + if (image.type) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "twitter:image:type", + content: image.type + }, i++)); + } + if (image.width) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "twitter:image:width", + content: String(image.width) + }, i++)); + } + if (image.height) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "twitter:image:height", + content: String(image.height) + }, i++)); + } + } + } + } + // Twitter player cards + if (card === 'player') { + for (const player of tw.players){ + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "twitter:player", + content: player.playerUrl.toString() + }, i++)); + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "twitter:player:stream", + content: player.streamUrl.toString() + }, i++)); + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "twitter:player:width", + content: String(player.width) + }, i++)); + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: "twitter:player:height", + content: String(player.height) + }, i++)); + } + } + // Twitter app cards + if (card === 'app') { + const { app } = tw; + for (const platform of [ + 'iphone', + 'ipad', + 'googleplay' + ]){ + var _app_url; + if (app.name) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: `twitter:app:name:${platform}`, + content: app.name + }, i++)); + } + if (app.id[platform]) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: `twitter:app:id:${platform}`, + content: String(app.id[platform]) + }, i++)); + } + if ((_app_url = app.url) == null ? void 0 : _app_url[platform]) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + name: `twitter:app:url:${platform}`, + content: app.url[platform].toString() + }, i++)); + } + } + } + } + // --- App Links --- + if (metadata.appLinks) { + const appLinks = metadata.appLinks; + // iOS / iPhone / iPad (AppLinksApple: url, app_store_id, app_name) + if (appLinks.ios) { + for (const item of appLinks.ios){ + if (item.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:ios:url", + content: String(item.url) + }, i++)); + } + if (item.app_store_id) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:ios:app_store_id", + content: String(item.app_store_id) + }, i++)); + } + if (item.app_name) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:ios:app_name", + content: item.app_name + }, i++)); + } + } + } + if (appLinks.iphone) { + for (const item of appLinks.iphone){ + if (item.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:iphone:url", + content: String(item.url) + }, i++)); + } + if (item.app_store_id) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:iphone:app_store_id", + content: String(item.app_store_id) + }, i++)); + } + if (item.app_name) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:iphone:app_name", + content: item.app_name + }, i++)); + } + } + } + if (appLinks.ipad) { + for (const item of appLinks.ipad){ + if (item.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:ipad:url", + content: String(item.url) + }, i++)); + } + if (item.app_store_id) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:ipad:app_store_id", + content: String(item.app_store_id) + }, i++)); + } + if (item.app_name) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:ipad:app_name", + content: item.app_name + }, i++)); + } + } + } + // Android (AppLinksAndroid: package, url, class, app_name) + if (appLinks.android) { + for (const item of appLinks.android){ + if (item.package) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:android:package", + content: item.package + }, i++)); + } + if (item.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:android:url", + content: String(item.url) + }, i++)); + } + if (item.class) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:android:class", + content: item.class + }, i++)); + } + if (item.app_name) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:android:app_name", + content: item.app_name + }, i++)); + } + } + } + // Windows Phone (AppLinksWindows: url, app_id, app_name) + if (appLinks.windows_phone) { + for (const item of appLinks.windows_phone){ + if (item.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:windows_phone:url", + content: String(item.url) + }, i++)); + } + if (item.app_id) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:windows_phone:app_id", + content: item.app_id + }, i++)); + } + if (item.app_name) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:windows_phone:app_name", + content: item.app_name + }, i++)); + } + } + } + // Windows (AppLinksWindows: url, app_id, app_name) + if (appLinks.windows) { + for (const item of appLinks.windows){ + if (item.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:windows:url", + content: String(item.url) + }, i++)); + } + if (item.app_id) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:windows:app_id", + content: item.app_id + }, i++)); + } + if (item.app_name) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:windows:app_name", + content: item.app_name + }, i++)); + } + } + } + // Windows Universal (AppLinksWindows: url, app_id, app_name) + if (appLinks.windows_universal) { + for (const item of appLinks.windows_universal){ + if (item.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:windows_universal:url", + content: String(item.url) + }, i++)); + } + if (item.app_id) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:windows_universal:app_id", + content: item.app_id + }, i++)); + } + if (item.app_name) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:windows_universal:app_name", + content: item.app_name + }, i++)); + } + } + } + // Web (AppLinksWeb: url, should_fallback) + if (appLinks.web) { + for (const item of appLinks.web){ + if (item.url) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:web:url", + content: String(item.url) + }, i++)); + } + if (item.should_fallback != null) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { + property: "al:web:should_fallback", + content: String(item.should_fallback) + }, i++)); + } + } + } + } + // --- Icons --- + if (metadata.icons) { + const { shortcut, icon, apple, other } = metadata.icons; + const hasIcon = Boolean((shortcut == null ? void 0 : shortcut.length) || (icon == null ? void 0 : icon.length) || (apple == null ? void 0 : apple.length) || (other == null ? void 0 : other.length)); + if (shortcut) { + for (const ic of shortcut){ + const { url, rel, ...props } = ic; + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", { + rel: rel || 'shortcut icon', + href: url.toString(), + ...props + }, i++)); + } + } + if (icon) { + for (const ic of icon){ + const { url, rel, ...props } = ic; + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", { + rel: rel || 'icon', + href: url.toString(), + ...props + }, i++)); + } + } + if (apple) { + for (const ic of apple){ + const { url, rel, ...props } = ic; + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", { + rel: rel || 'apple-touch-icon', + href: url.toString(), + ...props + }, i++)); + } + } + if (other) { + for (const ic of other){ + const { url, rel, ...props } = ic; + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("link", { + rel: rel || 'icon', + href: url.toString(), + ...props + }, i++)); + } + } + if (hasIcon) { + tags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)(_iconmark.IconMark, {}, i++)); + } + } + return tags; +} + +//# sourceMappingURL=metadata-elements.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/metadata-elements.js.map b/e-commerce/node_modules/next/dist/lib/metadata/metadata-elements.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d24929c377918c89ac35b67c6015e3c5baab9c4a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/metadata-elements.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/metadata/metadata-elements.tsx"],"sourcesContent":["import React from 'react'\nimport type { SelectedMetadata } from './metadata-resolution-primitives'\nimport type { ResolvedViewport } from './types/metadata-interface'\nimport { getOrigin } from './generate/utils'\nimport { IconMark } from './generate/icon-mark'\n\n// ---------------------------------------------------------------------------\n// Viewport tag rendering\n// ---------------------------------------------------------------------------\n\nexport function createViewportElements(\n viewport: ResolvedViewport\n): React.ReactElement[] {\n const tags: React.ReactElement[] = []\n let i = 0\n\n tags.push(<meta key={i++} charSet=\"utf-8\" />)\n\n // Build viewport content string from layout properties\n const viewportParts: string[] = []\n if (viewport.width != null) {\n viewportParts.push(`width=${viewport.width}`)\n }\n if (viewport.height != null) {\n viewportParts.push(`height=${viewport.height}`)\n }\n if (viewport.initialScale != null) {\n viewportParts.push(`initial-scale=${viewport.initialScale}`)\n }\n if (viewport.minimumScale != null) {\n viewportParts.push(`minimum-scale=${viewport.minimumScale}`)\n }\n if (viewport.maximumScale != null) {\n viewportParts.push(`maximum-scale=${viewport.maximumScale}`)\n }\n if (viewport.userScalable != null) {\n viewportParts.push(`user-scalable=${viewport.userScalable ? 'yes' : 'no'}`)\n }\n if (viewport.viewportFit) {\n viewportParts.push(`viewport-fit=${viewport.viewportFit}`)\n }\n if (viewport.interactiveWidget) {\n viewportParts.push(`interactive-widget=${viewport.interactiveWidget}`)\n }\n if (viewportParts.length) {\n tags.push(\n <meta key={i++} name=\"viewport\" content={viewportParts.join(', ')} />\n )\n }\n\n if (viewport.themeColor) {\n for (const themeColor of viewport.themeColor) {\n if (themeColor.media) {\n tags.push(\n <meta\n key={i++}\n name=\"theme-color\"\n content={themeColor.color}\n media={themeColor.media}\n />\n )\n } else {\n tags.push(\n <meta key={i++} name=\"theme-color\" content={themeColor.color} />\n )\n }\n }\n }\n\n if (viewport.colorScheme) {\n tags.push(\n <meta key={i++} name=\"color-scheme\" content={viewport.colorScheme} />\n )\n }\n\n return tags\n}\n\n// ---------------------------------------------------------------------------\n// Metadata tag rendering\n// ---------------------------------------------------------------------------\n\nexport function createMetadataElements(\n metadata: SelectedMetadata\n): React.ReactElement[] {\n const tags: React.ReactElement[] = []\n let i = 0\n\n // --- Title ---\n if (metadata.title) {\n tags.push(<title key={i++}>{metadata.title})\n }\n\n // --- Basic meta tags ---\n if (metadata.description) {\n tags.push(\n \n )\n }\n if (metadata.applicationName) {\n tags.push(\n \n )\n }\n\n // --- Authors ---\n if (metadata.authors) {\n for (const author of metadata.authors) {\n if (author.url) {\n tags.push()\n }\n if (author.name) {\n tags.push()\n }\n }\n }\n\n // --- Manifest ---\n if (metadata.manifest) {\n const manifestOrigin = getOrigin(metadata.manifest)\n tags.push(\n \n )\n }\n\n if (metadata.generator) {\n tags.push()\n }\n if (metadata.keywords && metadata.keywords.length) {\n tags.push(\n \n )\n }\n if (metadata.referrer) {\n tags.push()\n }\n if (metadata.creator) {\n tags.push()\n }\n if (metadata.publisher) {\n tags.push()\n }\n if (metadata.robots?.basic) {\n tags.push()\n }\n if (metadata.robots?.googleBot) {\n tags.push(\n \n )\n }\n if (metadata.abstract) {\n tags.push()\n }\n\n // --- Link rel arrays ---\n if (metadata.archives) {\n for (const archive of metadata.archives) {\n tags.push()\n }\n }\n if (metadata.assets) {\n for (const asset of metadata.assets) {\n tags.push()\n }\n }\n if (metadata.bookmarks) {\n for (const bookmark of metadata.bookmarks) {\n tags.push()\n }\n }\n\n // --- Pagination ---\n if (metadata.pagination) {\n if (metadata.pagination.previous) {\n tags.push(\n \n )\n }\n if (metadata.pagination.next) {\n tags.push()\n }\n }\n\n if (metadata.category) {\n tags.push()\n }\n if (metadata.classification) {\n tags.push(\n \n )\n }\n\n // --- Other (arbitrary name/value pairs) ---\n if (metadata.other) {\n for (const [name, content] of Object.entries(metadata.other)) {\n if (Array.isArray(content)) {\n for (const contentItem of content) {\n if (contentItem != null && contentItem !== '') {\n tags.push(\n \n )\n }\n }\n } else if (content != null && content !== '') {\n tags.push()\n }\n }\n }\n\n // --- Alternates ---\n if (metadata.alternates) {\n const { canonical, languages, media, types } = metadata.alternates\n\n if (canonical && canonical.url) {\n tags.push(\n \n )\n }\n\n if (languages) {\n for (const [locale, descriptors] of Object.entries(languages)) {\n if (descriptors) {\n for (const descriptor of descriptors) {\n if (descriptor.url) {\n tags.push(\n \n )\n }\n }\n }\n }\n }\n\n if (media) {\n for (const [mediaName, descriptors] of Object.entries(media)) {\n if (descriptors) {\n for (const descriptor of descriptors) {\n if (descriptor.url) {\n tags.push(\n \n )\n }\n }\n }\n }\n }\n\n if (types) {\n for (const [type, descriptors] of Object.entries(types)) {\n if (descriptors) {\n for (const descriptor of descriptors) {\n if (descriptor.url) {\n tags.push(\n \n )\n }\n }\n }\n }\n }\n }\n\n // --- iTunes ---\n if (metadata.itunes) {\n const { appId, appArgument } = metadata.itunes\n let itunesContent = `app-id=${appId}`\n if (appArgument) {\n itunesContent += `, app-argument=${appArgument}`\n }\n tags.push(\n \n )\n }\n\n // --- Facebook ---\n if (metadata.facebook) {\n if (metadata.facebook.appId) {\n tags.push(\n \n )\n }\n if (metadata.facebook.admins) {\n for (const admin of metadata.facebook.admins) {\n tags.push()\n }\n }\n }\n\n // --- Pinterest ---\n if (metadata.pinterest && metadata.pinterest.richPin !== undefined) {\n tags.push(\n \n )\n }\n\n // --- Format Detection ---\n if (metadata.formatDetection) {\n const formatDetectionKeys = [\n 'telephone',\n 'date',\n 'address',\n 'email',\n 'url',\n ] as const\n let formatContent = ''\n for (const key of formatDetectionKeys) {\n if (metadata.formatDetection[key] === false) {\n if (formatContent) formatContent += ', '\n formatContent += `${key}=no`\n }\n }\n if (formatContent) {\n tags.push(\n \n )\n }\n }\n\n // --- Verification ---\n if (metadata.verification) {\n const verification = metadata.verification\n\n if (verification.google) {\n for (const value of verification.google) {\n if (value != null && value !== '') {\n tags.push(\n \n )\n }\n }\n }\n if (verification.yahoo) {\n for (const value of verification.yahoo) {\n if (value != null && value !== '') {\n tags.push()\n }\n }\n }\n if (verification.yandex) {\n for (const value of verification.yandex) {\n if (value != null && value !== '') {\n tags.push(\n \n )\n }\n }\n }\n if (verification.me) {\n for (const value of verification.me) {\n if (value != null && value !== '') {\n tags.push()\n }\n }\n }\n if (verification.other) {\n for (const [name, values] of Object.entries(verification.other)) {\n for (const value of values) {\n if (value != null && value !== '') {\n tags.push()\n }\n }\n }\n }\n }\n\n // --- Apple Web App ---\n if (metadata.appleWebApp) {\n const { capable, title, startupImage, statusBarStyle } =\n metadata.appleWebApp\n\n if (capable) {\n tags.push()\n }\n if (title) {\n tags.push(\n \n )\n }\n if (startupImage) {\n for (const image of startupImage) {\n if (image.media) {\n tags.push(\n \n )\n } else {\n tags.push(\n \n )\n }\n }\n }\n if (statusBarStyle) {\n tags.push(\n \n )\n }\n }\n\n // --- Open Graph ---\n if (metadata.openGraph) {\n const og = metadata.openGraph\n\n if (og.determiner) {\n tags.push(\n \n )\n }\n if (og.title) {\n tags.push()\n }\n if (og.description) {\n tags.push(\n \n )\n }\n if (og.url) {\n tags.push(\n \n )\n }\n if (og.siteName) {\n tags.push(\n \n )\n }\n if (og.locale) {\n tags.push()\n }\n if (og.countryName) {\n tags.push(\n \n )\n }\n if (og.ttl != null) {\n tags.push(\n \n )\n }\n\n // OG images\n if (og.images) {\n for (const image of og.images) {\n if (typeof image === 'string') {\n tags.push()\n } else {\n if (image.url) {\n tags.push(\n \n )\n }\n if (image.secureUrl) {\n tags.push(\n \n )\n }\n if (image.type) {\n tags.push(\n \n )\n }\n if (image.width) {\n tags.push(\n \n )\n }\n if (image.height) {\n tags.push(\n \n )\n }\n if (image.alt) {\n tags.push(\n \n )\n }\n }\n }\n }\n\n // OG videos\n if (og.videos) {\n for (const video of og.videos) {\n if (typeof video === 'string') {\n tags.push()\n } else {\n if (video.url) {\n tags.push(\n \n )\n }\n if (video.secureUrl) {\n tags.push(\n \n )\n }\n if (video.type) {\n tags.push(\n \n )\n }\n if (video.width) {\n tags.push(\n \n )\n }\n if (video.height) {\n tags.push(\n \n )\n }\n }\n }\n }\n\n // OG audio\n if (og.audio) {\n for (const audio of og.audio) {\n if (typeof audio === 'string') {\n tags.push()\n } else {\n if (audio.url) {\n tags.push(\n \n )\n }\n if (audio.secureUrl) {\n tags.push(\n \n )\n }\n if (audio.type) {\n tags.push(\n \n )\n }\n }\n }\n }\n\n // OG simple array properties\n if (og.emails) {\n for (const email of og.emails) {\n tags.push()\n }\n }\n if (og.phoneNumbers) {\n for (const phone of og.phoneNumbers) {\n tags.push()\n }\n }\n if (og.faxNumbers) {\n for (const fax of og.faxNumbers) {\n tags.push()\n }\n }\n if (og.alternateLocale) {\n for (const locale of og.alternateLocale) {\n tags.push(\n \n )\n }\n }\n\n // OG type-specific tags\n if ('type' in og) {\n const ogType = og.type\n switch (ogType) {\n case 'website':\n tags.push()\n break\n\n case 'article':\n tags.push()\n if (og.publishedTime) {\n tags.push(\n \n )\n }\n if (og.modifiedTime) {\n tags.push(\n \n )\n }\n if (og.expirationTime) {\n tags.push(\n \n )\n }\n if (og.authors) {\n for (const author of og.authors) {\n tags.push(\n \n )\n }\n }\n if (og.section) {\n tags.push(\n \n )\n }\n if (og.tags) {\n for (const tag of og.tags) {\n tags.push()\n }\n }\n break\n\n case 'book':\n tags.push()\n if (og.isbn) {\n tags.push()\n }\n if (og.releaseDate) {\n tags.push(\n \n )\n }\n if (og.authors) {\n for (const author of og.authors) {\n tags.push(\n \n )\n }\n }\n if (og.tags) {\n for (const tag of og.tags) {\n tags.push()\n }\n }\n break\n\n case 'profile':\n tags.push()\n if (og.firstName) {\n tags.push(\n \n )\n }\n if (og.lastName) {\n tags.push(\n \n )\n }\n if (og.username) {\n tags.push(\n \n )\n }\n if (og.gender) {\n tags.push(\n \n )\n }\n break\n\n case 'music.song':\n tags.push()\n if (og.duration != null) {\n tags.push(\n \n )\n }\n if (og.albums) {\n for (const album of og.albums) {\n if (typeof album === 'string') {\n tags.push(\n \n )\n } else {\n if (album.url) {\n tags.push(\n \n )\n }\n if (album.disc != null) {\n tags.push(\n \n )\n }\n if (album.track != null) {\n tags.push(\n \n )\n }\n }\n }\n }\n if (og.musicians) {\n for (const musician of og.musicians) {\n tags.push(\n \n )\n }\n }\n break\n\n case 'music.album':\n tags.push()\n if (og.songs) {\n for (const song of og.songs) {\n if (typeof song === 'string') {\n tags.push(\n \n )\n } else {\n if (song.url) {\n tags.push(\n \n )\n }\n if (song.disc != null) {\n tags.push(\n \n )\n }\n if (song.track != null) {\n tags.push(\n \n )\n }\n }\n }\n }\n if (og.musicians) {\n for (const musician of og.musicians) {\n tags.push(\n \n )\n }\n }\n if (og.releaseDate) {\n tags.push(\n \n )\n }\n break\n\n case 'music.playlist':\n tags.push(\n \n )\n if (og.songs) {\n for (const song of og.songs) {\n if (typeof song === 'string') {\n tags.push(\n \n )\n } else {\n if (song.url) {\n tags.push(\n \n )\n }\n if (song.disc != null) {\n tags.push(\n \n )\n }\n if (song.track != null) {\n tags.push(\n \n )\n }\n }\n }\n }\n if (og.creators) {\n for (const creator of og.creators) {\n tags.push(\n \n )\n }\n }\n break\n\n case 'music.radio_station':\n tags.push(\n \n )\n if (og.creators) {\n for (const creator of og.creators) {\n tags.push(\n \n )\n }\n }\n break\n\n case 'video.movie':\n tags.push()\n if (og.actors) {\n for (const actor of og.actors) {\n if (typeof actor === 'string') {\n tags.push(\n \n )\n } else {\n if (actor.url) {\n tags.push(\n \n )\n }\n if (actor.role) {\n tags.push(\n \n )\n }\n }\n }\n }\n if (og.directors) {\n for (const director of og.directors) {\n tags.push(\n \n )\n }\n }\n if (og.writers) {\n for (const writer of og.writers) {\n tags.push(\n \n )\n }\n }\n if (og.duration != null) {\n tags.push(\n \n )\n }\n if (og.releaseDate) {\n tags.push(\n \n )\n }\n if (og.tags) {\n for (const tag of og.tags) {\n tags.push()\n }\n }\n break\n\n case 'video.episode':\n tags.push(\n \n )\n if (og.actors) {\n for (const actor of og.actors) {\n if (typeof actor === 'string') {\n tags.push(\n \n )\n } else {\n if (actor.url) {\n tags.push(\n \n )\n }\n if (actor.role) {\n tags.push(\n \n )\n }\n }\n }\n }\n if (og.directors) {\n for (const director of og.directors) {\n tags.push(\n \n )\n }\n }\n if (og.writers) {\n for (const writer of og.writers) {\n tags.push(\n \n )\n }\n }\n if (og.duration != null) {\n tags.push(\n \n )\n }\n if (og.releaseDate) {\n tags.push(\n \n )\n }\n if (og.tags) {\n for (const tag of og.tags) {\n tags.push()\n }\n }\n if (og.series) {\n tags.push(\n \n )\n }\n break\n\n case 'video.tv_show':\n tags.push(\n \n )\n break\n\n case 'video.other':\n tags.push()\n break\n\n default:\n const _exhaustiveCheck: never = ogType\n throw new Error(`Invalid OpenGraph type: ${_exhaustiveCheck}`)\n }\n }\n }\n\n // --- Twitter ---\n if (metadata.twitter) {\n const tw = metadata.twitter\n const { card } = tw\n\n if (card) {\n tags.push()\n }\n if (tw.site) {\n tags.push()\n }\n if (tw.siteId) {\n tags.push()\n }\n if (tw.creator) {\n tags.push()\n }\n if (tw.creatorId) {\n tags.push(\n \n )\n }\n if (tw.title) {\n tags.push()\n }\n if (tw.description) {\n tags.push(\n \n )\n }\n\n // Twitter images\n if (tw.images) {\n for (const image of tw.images) {\n if (typeof image === 'string') {\n tags.push()\n } else {\n if (image.url) {\n tags.push(\n \n )\n }\n if (image.alt) {\n tags.push(\n \n )\n }\n if (image.secureUrl) {\n tags.push(\n \n )\n }\n if (image.type) {\n tags.push(\n \n )\n }\n if (image.width) {\n tags.push(\n \n )\n }\n if (image.height) {\n tags.push(\n \n )\n }\n }\n }\n }\n\n // Twitter player cards\n if (card === 'player') {\n for (const player of tw.players) {\n tags.push(\n \n )\n tags.push(\n \n )\n tags.push(\n \n )\n tags.push(\n \n )\n }\n }\n\n // Twitter app cards\n if (card === 'app') {\n const { app } = tw\n for (const platform of ['iphone', 'ipad', 'googleplay'] as const) {\n if (app.name) {\n tags.push(\n \n )\n }\n if (app.id[platform]) {\n tags.push(\n \n )\n }\n if (app.url?.[platform]) {\n tags.push(\n \n )\n }\n }\n }\n }\n\n // --- App Links ---\n if (metadata.appLinks) {\n const appLinks = metadata.appLinks\n\n // iOS / iPhone / iPad (AppLinksApple: url, app_store_id, app_name)\n if (appLinks.ios) {\n for (const item of appLinks.ios) {\n if (item.url) {\n tags.push(\n \n )\n }\n if (item.app_store_id) {\n tags.push(\n \n )\n }\n if (item.app_name) {\n tags.push(\n \n )\n }\n }\n }\n if (appLinks.iphone) {\n for (const item of appLinks.iphone) {\n if (item.url) {\n tags.push(\n \n )\n }\n if (item.app_store_id) {\n tags.push(\n \n )\n }\n if (item.app_name) {\n tags.push(\n \n )\n }\n }\n }\n if (appLinks.ipad) {\n for (const item of appLinks.ipad) {\n if (item.url) {\n tags.push(\n \n )\n }\n if (item.app_store_id) {\n tags.push(\n \n )\n }\n if (item.app_name) {\n tags.push(\n \n )\n }\n }\n }\n\n // Android (AppLinksAndroid: package, url, class, app_name)\n if (appLinks.android) {\n for (const item of appLinks.android) {\n if (item.package) {\n tags.push(\n \n )\n }\n if (item.url) {\n tags.push(\n \n )\n }\n if (item.class) {\n tags.push(\n \n )\n }\n if (item.app_name) {\n tags.push(\n \n )\n }\n }\n }\n\n // Windows Phone (AppLinksWindows: url, app_id, app_name)\n if (appLinks.windows_phone) {\n for (const item of appLinks.windows_phone) {\n if (item.url) {\n tags.push(\n \n )\n }\n if (item.app_id) {\n tags.push(\n \n )\n }\n if (item.app_name) {\n tags.push(\n \n )\n }\n }\n }\n\n // Windows (AppLinksWindows: url, app_id, app_name)\n if (appLinks.windows) {\n for (const item of appLinks.windows) {\n if (item.url) {\n tags.push(\n \n )\n }\n if (item.app_id) {\n tags.push(\n \n )\n }\n if (item.app_name) {\n tags.push(\n \n )\n }\n }\n }\n\n // Windows Universal (AppLinksWindows: url, app_id, app_name)\n if (appLinks.windows_universal) {\n for (const item of appLinks.windows_universal) {\n if (item.url) {\n tags.push(\n \n )\n }\n if (item.app_id) {\n tags.push(\n \n )\n }\n if (item.app_name) {\n tags.push(\n \n )\n }\n }\n }\n\n // Web (AppLinksWeb: url, should_fallback)\n if (appLinks.web) {\n for (const item of appLinks.web) {\n if (item.url) {\n tags.push(\n \n )\n }\n if (item.should_fallback != null) {\n tags.push(\n \n )\n }\n }\n }\n }\n\n // --- Icons ---\n if (metadata.icons) {\n const { shortcut, icon, apple, other } = metadata.icons\n const hasIcon = Boolean(\n shortcut?.length || icon?.length || apple?.length || other?.length\n )\n\n if (shortcut) {\n for (const ic of shortcut) {\n const { url, rel, ...props } = ic\n tags.push(\n \n )\n }\n }\n if (icon) {\n for (const ic of icon) {\n const { url, rel, ...props } = ic\n tags.push(\n \n )\n }\n }\n if (apple) {\n for (const ic of apple) {\n const { url, rel, ...props } = ic\n tags.push(\n \n )\n }\n }\n if (other) {\n for (const ic of other) {\n const { url, rel, ...props } = ic\n tags.push(\n \n )\n }\n }\n\n if (hasIcon) {\n tags.push()\n }\n }\n\n return tags\n}\n"],"names":["createMetadataElements","createViewportElements","viewport","tags","i","push","meta","charSet","viewportParts","width","height","initialScale","minimumScale","maximumScale","userScalable","viewportFit","interactiveWidget","length","name","content","join","themeColor","media","color","colorScheme","metadata","title","description","applicationName","authors","author","url","link","rel","href","toString","manifest","manifestOrigin","getOrigin","crossOrigin","process","env","VERCEL_ENV","undefined","generator","keywords","referrer","creator","publisher","robots","basic","googleBot","abstract","archives","archive","assets","asset","bookmarks","bookmark","pagination","previous","next","category","classification","other","Object","entries","Array","isArray","contentItem","String","alternates","canonical","languages","types","locale","descriptors","descriptor","hrefLang","mediaName","type","itunes","appId","appArgument","itunesContent","facebook","property","admins","admin","pinterest","richPin","formatDetection","formatDetectionKeys","formatContent","key","verification","google","value","yahoo","yandex","me","values","appleWebApp","capable","startupImage","statusBarStyle","image","openGraph","og","determiner","siteName","countryName","ttl","images","secureUrl","alt","videos","video","audio","emails","email","phoneNumbers","phone","faxNumbers","fax","alternateLocale","ogType","publishedTime","modifiedTime","expirationTime","section","tag","isbn","releaseDate","firstName","lastName","username","gender","duration","albums","album","disc","track","musicians","musician","songs","song","creators","actors","actor","role","directors","director","writers","writer","series","_exhaustiveCheck","Error","twitter","tw","card","site","siteId","creatorId","player","players","playerUrl","streamUrl","app","platform","id","appLinks","ios","item","app_store_id","app_name","iphone","ipad","android","package","class","windows_phone","app_id","windows","windows_universal","web","should_fallback","icons","shortcut","icon","apple","hasIcon","Boolean","ic","props","IconMark"],"mappings":";;;;;;;;;;;;;;;IAkFgBA,sBAAsB;eAAtBA;;IAxEAC,sBAAsB;eAAtBA;;;;8DAVE;uBAGQ;0BACD;;;;;;AAMlB,SAASA,uBACdC,QAA0B;IAE1B,MAAMC,OAA6B,EAAE;IACrC,IAAIC,IAAI;IAERD,KAAKE,IAAI,eAAC,qBAACC;QAAeC,SAAQ;OAAbH;IAErB,uDAAuD;IACvD,MAAMI,gBAA0B,EAAE;IAClC,IAAIN,SAASO,KAAK,IAAI,MAAM;QAC1BD,cAAcH,IAAI,CAAC,CAAC,MAAM,EAAEH,SAASO,KAAK,EAAE;IAC9C;IACA,IAAIP,SAASQ,MAAM,IAAI,MAAM;QAC3BF,cAAcH,IAAI,CAAC,CAAC,OAAO,EAAEH,SAASQ,MAAM,EAAE;IAChD;IACA,IAAIR,SAASS,YAAY,IAAI,MAAM;QACjCH,cAAcH,IAAI,CAAC,CAAC,cAAc,EAAEH,SAASS,YAAY,EAAE;IAC7D;IACA,IAAIT,SAASU,YAAY,IAAI,MAAM;QACjCJ,cAAcH,IAAI,CAAC,CAAC,cAAc,EAAEH,SAASU,YAAY,EAAE;IAC7D;IACA,IAAIV,SAASW,YAAY,IAAI,MAAM;QACjCL,cAAcH,IAAI,CAAC,CAAC,cAAc,EAAEH,SAASW,YAAY,EAAE;IAC7D;IACA,IAAIX,SAASY,YAAY,IAAI,MAAM;QACjCN,cAAcH,IAAI,CAAC,CAAC,cAAc,EAAEH,SAASY,YAAY,GAAG,QAAQ,MAAM;IAC5E;IACA,IAAIZ,SAASa,WAAW,EAAE;QACxBP,cAAcH,IAAI,CAAC,CAAC,aAAa,EAAEH,SAASa,WAAW,EAAE;IAC3D;IACA,IAAIb,SAASc,iBAAiB,EAAE;QAC9BR,cAAcH,IA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 No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/metadata-parallel.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/metadata-parallel.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1738bb62503948f1fed32dcd7cf0e18b92f3392e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/metadata-parallel.d.ts @@ -0,0 +1,21 @@ +import React from 'react'; +import type { Params } from '../../server/request/params'; +import type { LoaderTree } from '../../server/lib/app-dir-module'; +import type { SearchParams } from '../../server/request/search-params'; +import type { MetadataErrorType } from './metadata-resolution-primitives'; +import type { MetadataContext } from './types/resolvers'; +export declare function createMetadataComponents({ tree, pathname, parsedQuery, metadataContext, interpolatedParams, errorType, serveStreamingMetadata, }: { + tree: LoaderTree; + pathname: string; + parsedQuery: SearchParams; + metadataContext: MetadataContext; + interpolatedParams: Params; + errorType?: MetadataErrorType | 'redirect'; + serveStreamingMetadata: boolean; +}): { + Viewport: React.ComponentType; + Metadata: React.ComponentType; + MetadataOutlet: React.ComponentType<{ + tree: LoaderTree; + }>; +}; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/metadata-parallel.js b/e-commerce/node_modules/next/dist/lib/metadata/metadata-parallel.js new file mode 100644 index 0000000000000000000000000000000000000000..c23f9f69f18bf6033acf614275190208cb4fd70a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/metadata-parallel.js @@ -0,0 +1,175 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "createMetadataComponents", { + enumerable: true, + get: function() { + return createMetadataComponents; + } +}); +const _jsxruntime = require("react/jsx-runtime"); +const _react = /*#__PURE__*/ _interop_require_wildcard(require("react")); +const _searchparams = require("../../server/request/search-params"); +const _pathname = require("../../server/request/pathname"); +const _resolvemetadataparallel = require("./resolve-metadata-parallel"); +const _metadataelements = require("./metadata-elements"); +const _boundarycomponents = require("../framework/boundary-components"); +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +function createMetadataComponents({ tree, pathname, parsedQuery, metadataContext, interpolatedParams, errorType, serveStreamingMetadata }) { + const searchParams = (0, _searchparams.createServerSearchParamsForMetadata)(parsedQuery); + const pathnameForMetadata = (0, _pathname.createServerPathnameForMetadata)(pathname); + async function Viewport() { + const tags = await getMetadataResolution(tree, pathnameForMetadata, searchParams, interpolatedParams, metadataContext, errorType).then(async (resolution)=>{ + const selected = await resolution.selectedViewport; + if (selected.status === 'resolved') { + return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, { + children: (0, _metadataelements.createViewportElements)(selected.value) + }); + } + if (!errorType && (selected.status === 'not-found' || selected.status === 'forbidden' || selected.status === 'unauthorized')) { + const convention = await getViewportForBranch(tree, pathnameForMetadata, searchParams, selected.status, interpolatedParams, metadataContext, resolution.selectedKeyPath); + if (convention.status === 'resolved') { + return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, { + children: (0, _metadataelements.createViewportElements)(convention.value) + }); + } + } + return null; + }).catch(()=>{ + // We're going to throw the error from the metadata outlet so we just render null here instead + return null; + }); + return tags; + } + Viewport.displayName = 'Next.Viewport'; + function ViewportWrapper() { + return /*#__PURE__*/ (0, _jsxruntime.jsx)(_boundarycomponents.ViewportBoundary, { + children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Viewport, {}) + }); + } + // Metadata resolution must start while rendering so it observes the current + // work unit store. + function getSelectedMetadata() { + return getResolvedParallelMetadata(tree, pathnameForMetadata, searchParams, interpolatedParams, metadataContext, errorType).catch(()=>{ + // We're going to throw the error from the metadata outlet so we just render null here instead + return null; + }); + } + async function Metadata() { + return await getSelectedMetadata(); + } + Metadata.displayName = 'Next.Metadata'; + function MetadataBlocker() { + return serveStreamingMetadata ? null : getSelectedMetadata().then(()=>null); + } + function MetadataWrapper() { + // Keep the same component structure in streaming and blocking renders. + // The blocker only holds the shell open when metadata must not stream. + // React requires top-level suspenseful metadata to be nested under a host + // element. Otherwise it becomes part of the document preamble and blocks + // shell flushing instead of streaming. Metadata tags are hoisted out, so + // this hidden wrapper remains empty. + return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_boundarycomponents.MetadataBoundary, { + children: [ + /*#__PURE__*/ (0, _jsxruntime.jsx)("div", { + hidden: true, + children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_react.Suspense, { + name: "Next.Metadata", + children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Metadata, {}) + }) + }), + /*#__PURE__*/ (0, _jsxruntime.jsx)(MetadataBlocker, {}) + ] + }); + } + function MetadataOutlet({ tree: outletTree }) { + const metadataResolution = getMetadataResolution(tree, pathnameForMetadata, searchParams, interpolatedParams, metadataContext, errorType); + const pendingOutlet = metadataResolution.then((resolution)=>resolution.outlets.get(outletTree) ?? null); + if (!serveStreamingMetadata) { + return /*#__PURE__*/ (0, _jsxruntime.jsx)(_boundarycomponents.OutletBoundary, { + children: pendingOutlet + }); + } + return /*#__PURE__*/ (0, _jsxruntime.jsx)(_boundarycomponents.OutletBoundary, { + children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_react.Suspense, { + name: "Next.MetadataOutlet", + children: pendingOutlet + }) + }); + } + MetadataOutlet.displayName = 'Next.MetadataOutlet'; + return { + Viewport: ViewportWrapper, + Metadata: MetadataWrapper, + MetadataOutlet + }; +} +const getResolvedParallelMetadata = (0, _react.cache)(getResolvedParallelMetadataImpl); +async function getResolvedParallelMetadataImpl(tree, pathname, searchParams, interpolatedParams, metadataContext, errorType) { + const resolution = await getMetadataResolution(tree, pathname, searchParams, interpolatedParams, metadataContext, errorType); + const selected = await resolution.selectedMetadata; + if (selected.status === 'resolved') { + return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, { + children: (0, _metadataelements.createMetadataElements)(selected.value) + }); + } + if (!errorType && (selected.status === 'not-found' || selected.status === 'forbidden' || selected.status === 'unauthorized')) { + const convention = await getMetadataForBranch(tree, pathname, searchParams, selected.status, interpolatedParams, metadataContext, resolution.selectedKeyPath); + if (convention.status === 'resolved') { + return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, { + children: (0, _metadataelements.createMetadataElements)(convention.value) + }); + } + } + return null; +} +const getMetadataResolution = (0, _react.cache)(resolveMetadataResolutionImpl); +async function resolveMetadataResolutionImpl(tree, pathname, searchParams, interpolatedParams, metadataContext, errorType) { + const errorConvention = errorType === 'redirect' ? undefined : errorType; + return (0, _resolvemetadataparallel.resolveMetadataResolution)(tree, pathname, searchParams, errorConvention, interpolatedParams, metadataContext); +} +const getMetadataForBranch = (0, _react.cache)(_resolvemetadataparallel.resolveMetadataForBranch); +const getViewportForBranch = (0, _react.cache)(_resolvemetadataparallel.resolveViewportForBranch); + +//# sourceMappingURL=metadata-parallel.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/metadata-parallel.js.map b/e-commerce/node_modules/next/dist/lib/metadata/metadata-parallel.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a9f257f8e165c8fd50b28426876abd8470fdee68 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/metadata-parallel.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/metadata/metadata-parallel.tsx"],"sourcesContent":["import React, { Suspense, cache } from 'react'\nimport type { ParsedUrlQuery } from 'querystring'\nimport type { Params } from '../../server/request/params'\nimport type { LoaderTree } from '../../server/lib/app-dir-module'\nimport type { SearchParams } from '../../server/request/search-params'\nimport { createServerSearchParamsForMetadata } from '../../server/request/search-params'\nimport { createServerPathnameForMetadata } from '../../server/request/pathname'\nimport type { MetadataErrorType } from './metadata-resolution-primitives'\nimport {\n resolveMetadataForBranch,\n resolveMetadataResolution,\n resolveViewportForBranch,\n} from './resolve-metadata-parallel'\nimport type { MetadataContext } from './types/resolvers'\nimport {\n createMetadataElements,\n createViewportElements,\n} from './metadata-elements'\nimport {\n MetadataBoundary,\n ViewportBoundary,\n OutletBoundary,\n} from '../framework/boundary-components'\n\nexport function createMetadataComponents({\n tree,\n pathname,\n parsedQuery,\n metadataContext,\n interpolatedParams,\n errorType,\n serveStreamingMetadata,\n}: {\n tree: LoaderTree\n pathname: string\n parsedQuery: SearchParams\n metadataContext: MetadataContext\n interpolatedParams: Params\n errorType?: MetadataErrorType | 'redirect'\n serveStreamingMetadata: boolean\n}): {\n Viewport: React.ComponentType\n Metadata: React.ComponentType\n MetadataOutlet: React.ComponentType<{ tree: LoaderTree }>\n} {\n const searchParams = createServerSearchParamsForMetadata(parsedQuery)\n const pathnameForMetadata = createServerPathnameForMetadata(pathname)\n\n async function Viewport() {\n const tags = await getMetadataResolution(\n tree,\n pathnameForMetadata,\n searchParams,\n interpolatedParams,\n metadataContext,\n errorType\n )\n .then(async (resolution) => {\n const selected = await resolution.selectedViewport\n if (selected.status === 'resolved') {\n return <>{createViewportElements(selected.value)}\n }\n if (\n !errorType &&\n (selected.status === 'not-found' ||\n selected.status === 'forbidden' ||\n selected.status === 'unauthorized')\n ) {\n const convention = await getViewportForBranch(\n tree,\n pathnameForMetadata,\n searchParams,\n selected.status,\n interpolatedParams,\n metadataContext,\n resolution.selectedKeyPath\n )\n if (convention.status === 'resolved') {\n return <>{createViewportElements(convention.value)}\n }\n }\n return null\n })\n .catch(() => {\n // We're going to throw the error from the metadata outlet so we just render null here instead\n return null\n })\n\n return tags\n }\n Viewport.displayName = 'Next.Viewport'\n\n function ViewportWrapper() {\n return (\n \n \n \n )\n }\n\n // Metadata resolution must start while rendering so it observes the current\n // work unit store.\n function getSelectedMetadata() {\n return getResolvedParallelMetadata(\n tree,\n pathnameForMetadata,\n searchParams,\n interpolatedParams,\n metadataContext,\n errorType\n ).catch(() => {\n // We're going to throw the error from the metadata outlet so we just render null here instead\n return null\n })\n }\n\n async function Metadata() {\n return await getSelectedMetadata()\n }\n Metadata.displayName = 'Next.Metadata'\n\n function MetadataBlocker() {\n return serveStreamingMetadata\n ? null\n : getSelectedMetadata().then(() => null)\n }\n\n function MetadataWrapper() {\n // Keep the same component structure in streaming and blocking renders.\n // The blocker only holds the shell open when metadata must not stream.\n // React requires top-level suspenseful metadata to be nested under a host\n // element. Otherwise it becomes part of the document preamble and blocks\n // shell flushing instead of streaming. Metadata tags are hoisted out, so\n // this hidden wrapper remains empty.\n return (\n \n

\n \n \n )\n }\n\n function MetadataOutlet({ tree: outletTree }: { tree: LoaderTree }) {\n const metadataResolution = getMetadataResolution(\n tree,\n pathnameForMetadata,\n searchParams,\n interpolatedParams,\n metadataContext,\n errorType\n )\n const pendingOutlet = metadataResolution.then(\n (resolution) => resolution.outlets.get(outletTree) ?? null\n )\n\n if (!serveStreamingMetadata) {\n return {pendingOutlet}\n }\n\n return (\n \n {pendingOutlet}\n \n )\n }\n MetadataOutlet.displayName = 'Next.MetadataOutlet'\n\n return {\n Viewport: ViewportWrapper,\n Metadata: MetadataWrapper,\n MetadataOutlet,\n }\n}\n\nconst getResolvedParallelMetadata = cache(getResolvedParallelMetadataImpl)\nasync function getResolvedParallelMetadataImpl(\n tree: LoaderTree,\n pathname: Promise,\n searchParams: Promise,\n interpolatedParams: Params,\n metadataContext: MetadataContext,\n errorType: MetadataErrorType | 'redirect' | undefined\n): Promise {\n const resolution = await getMetadataResolution(\n tree,\n pathname,\n searchParams,\n interpolatedParams,\n metadataContext,\n errorType\n )\n const selected = await resolution.selectedMetadata\n if (selected.status === 'resolved') {\n return <>{createMetadataElements(selected.value)}\n }\n if (\n !errorType &&\n (selected.status === 'not-found' ||\n selected.status === 'forbidden' ||\n selected.status === 'unauthorized')\n ) {\n const convention = await getMetadataForBranch(\n tree,\n pathname,\n searchParams,\n selected.status,\n interpolatedParams,\n metadataContext,\n resolution.selectedKeyPath\n )\n if (convention.status === 'resolved') {\n return <>{createMetadataElements(convention.value)}\n }\n }\n return null\n}\n\nconst getMetadataResolution = cache(resolveMetadataResolutionImpl)\nasync function resolveMetadataResolutionImpl(\n tree: LoaderTree,\n pathname: Promise,\n searchParams: Promise,\n interpolatedParams: Params,\n metadataContext: MetadataContext,\n errorType?: MetadataErrorType | 'redirect'\n) {\n const errorConvention = errorType === 'redirect' ? undefined : errorType\n return resolveMetadataResolution(\n tree,\n pathname,\n searchParams,\n errorConvention,\n interpolatedParams,\n metadataContext\n )\n}\n\nconst getMetadataForBranch = cache(resolveMetadataForBranch)\nconst getViewportForBranch = cache(resolveViewportForBranch)\n"],"names":["createMetadataComponents","tree","pathname","parsedQuery","metadataContext","interpolatedParams","errorType","serveStreamingMetadata","searchParams","createServerSearchParamsForMetadata","pathnameForMetadata","createServerPathnameForMetadata","Viewport","tags","getMetadataResolution","then","resolution","selected","selectedViewport","status","createViewportElements","value","convention","getViewportForBranch","selectedKeyPath","catch","displayName","ViewportWrapper","ViewportBoundary","getSelectedMetadata","getResolvedParallelMetadata","Metadata","MetadataBlocker","MetadataWrapper","MetadataBoundary","div","hidden","Suspense","name","MetadataOutlet","outletTree","metadataResolution","pendingOutlet","outlets","get","OutletBoundary","cache","getResolvedParallelMetadataImpl","selectedMetadata","createMetadataElements","getMetadataForBranch","resolveMetadataResolutionImpl","errorConvention","undefined","resolveMetadataResolution","resolveMetadataForBranch","resolveViewportForBranch"],"mappings":";;;;+BAwBgBA;;;eAAAA;;;;+DAxBuB;8BAKa;0BACJ;yCAMzC;kCAKA;oCAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAASA,yBAAyB,EACvCC,IAAI,EACJC,QAAQ,EACRC,WAAW,EACXC,eAAe,EACfC,kBAAkB,EAClBC,SAAS,EACTC,sBAAsB,EASvB;IAKC,MAAMC,eAAeC,IAAAA,iDAAmC,EAACN;IACzD,MAAMO,sBAAsBC,IAAAA,yCAA+B,EAACT;IAE5D,eAAeU;QACb,MAAMC,OAAO,MAAMC,sBACjBb,MACAS,qBACAF,cACAH,oBACAD,iBACAE,WAECS,IAAI,CAAC,OAAOC;YACX,MAAMC,WAAW,MAAMD,WAAWE,gBAAgB;YAClD,IAAID,SAASE,MAAM,KAAK,YAAY;gBAClC,qBAAO;8BAAGC,IAAAA,wCAAsB,EAACH,SAASI,KAAK;;YACjD;YACA,IACE,CAACf,aACAW,CAAAA,SAASE,MAAM,KAAK,eACnBF,SAASE,MAAM,KAAK,eACpBF,SAASE,MAAM,KAAK,cAAa,GACnC;gBACA,MAAMG,aAAa,MAAMC,qBACvBtB,MACAS,qBACAF,cACAS,SAASE,MAAM,EACfd,oBACAD,iBACAY,WAAWQ,eAAe;gBAE5B,IAAIF,WAAWH,MAAM,KAAK,YAAY;oBACpC,qBAAO;kCAAGC,IAAAA,wCAAsB,EAACE,WAAWD,KAAK;;gBACnD;YACF;YACA,OAAO;QACT,GACCI,KAAK,CAAC;YACL,8FAA8F;YAC9F,OAAO;QACT;QAEF,OAAOZ;IACT;IACAD,SAASc,WAAW,GAAG;IAEvB,SAASC;QACP,qBACE,qBAACC,oCAAgB;sBACf,cAAA,qBAAChB;;IAGP;IAEA,4EAA4E;IAC5E,mBAAmB;IACnB,SAASiB;QACP,OAAOC,4BACL7B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sBAAG8B,IAAAA,wCAAsB,EAAChC,SAASI,KAAK;;IACjD;IACA,IACE,CAACf,aACAW,CAAAA,SAASE,MAAM,KAAK,eACnBF,SAASE,MAAM,KAAK,eACpBF,SAASE,MAAM,KAAK,cAAa,GACnC;QACA,MAAMG,aAAa,MAAM4B,qBACvBjD,MACAC,UACAM,cACAS,SAASE,MAAM,EACfd,oBACAD,iBACAY,WAAWQ,eAAe;QAE5B,IAAIF,WAAWH,MAAM,KAAK,YAAY;YACpC,qBAAO;0BAAG8B,IAAAA,wCAAsB,EAAC3B,WAAWD,KAAK;;QACnD;IACF;IACA,OAAO;AACT;AAEA,MAAMP,wBAAwBgC,IAAAA,YAAK,EAACK;AACpC,eAAeA,8BACblD,IAAgB,EAChBC,QAAyB,EACzBM,YAAqC,EACrCH,kBAA0B,EAC1BD,eAAgC,EAChCE,SAA0C;IAE1C,MAAM8C,kBAAkB9C,cAAc,aAAa+C,YAAY/C;IAC/D,OAAOgD,IAAAA,kDAAyB,EAC9BrD,MACAC,UACAM,cACA4C,iBACA/C,oBACAD;AAEJ;AAEA,MAAM8C,uBAAuBJ,IAAAA,YAAK,EAACS,iDAAwB;AAC3D,MAAMhC,uBAAuBuB,IAAAA,YAAK,EAACU,iDAAwB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/metadata-resolution-primitives.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/metadata-resolution-primitives.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7576f76c8caaf92fc581119fc6fb0815fcaf848b --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/metadata-resolution-primitives.d.ts @@ -0,0 +1,86 @@ +import type { Metadata, ResolvedMetadata, ResolvedViewport, Viewport, WithStringifiedURLs } from './types/metadata-interface'; +import type { AppDirModules } from '../../build/webpack/loaders/next-app-loader'; +import type { MetadataContext } from './types/resolvers'; +import type { AbsoluteTemplateString, IconDescriptor, ResolvedIcons } from './types/metadata-types'; +import type { StaticMetadata } from './types/icons'; +import type { Params } from '../../server/request/params'; +import type { SearchParams } from '../../server/request/search-params'; +import 'server-only'; +import type { UseCacheLayoutProps, UseCachePageProps } from '../../server/use-cache/use-cache-wrapper'; +export type StaticIcons = Pick; +export type InstrumentedResolver = ((parent: Promise) => TData | Promise) & { + $$original: (props: unknown, parent: Promise) => TData | Promise; +}; +export type MetadataResolver = InstrumentedResolver; +export type ViewportResolver = InstrumentedResolver; +export type MetadataErrorType = 'not-found' | 'forbidden' | 'unauthorized'; +export type MetadataItems = Array<[ + Metadata | MetadataResolver | null, + StaticMetadata +]>; +export type ViewportItems = Array; +type WithSelectedTitle = T extends { + title: AbsoluteTemplateString; +} ? Omit & { + title: string; +} : T; +/** + * Metadata that has finished route-level resolution and post-processing. It + * contains only values that can be turned into metadata elements; it is never + * used as the parent of another metadata resolver. + */ +export type SelectedMetadata = Omit & { + title: string | null; + openGraph: WithSelectedTitle> | null; + twitter: WithSelectedTitle> | null; +}; +export type TitleTemplates = { + title: string | null; + twitter: string | null; + openGraph: string | null; +}; +export type BuildState = { + warnings: Set; +}; +export type LayoutProps = { + params: Promise; +}; +export type PageProps = { + params: Promise; + searchParams: Promise; +}; +export type SegmentProps = LayoutProps | PageProps; +export type UseCacheSegmentProps = UseCacheLayoutProps | UseCachePageProps; +export declare function isFavicon(icon: IconDescriptor | undefined): boolean; +export declare function convertUrlsToStrings(input: T): WithStringifiedURLs; +/** + * Merges the given metadata with the resolved metadata. Returns a new object. + */ +export declare function mergeMetadata(route: string, pathname: Promise, { metadata, resolvedMetadata, staticFilesMetadata, titleTemplates, metadataContext, buildState, leafSegmentStaticIcons, cloneResolvedMetadata, }: { + metadata: Metadata | null; + resolvedMetadata: ResolvedMetadata; + staticFilesMetadata: StaticMetadata; + titleTemplates: TitleTemplates; + metadataContext: MetadataContext; + buildState: BuildState; + leafSegmentStaticIcons: StaticIcons; + cloneResolvedMetadata?: boolean; +}): Promise; +/** + * Merges the given viewport with the resolved viewport. Returns a new object. + */ +export declare function mergeViewport({ resolvedViewport, viewport, cloneResolvedViewport, }: { + resolvedViewport: ResolvedViewport; + viewport: Viewport | null; + cloneResolvedViewport?: boolean; +}): ResolvedViewport; +export declare function getDefinedViewport(mod: any, props: SegmentProps, tracingProps: { + route: string; +}): Viewport | ViewportResolver | null; +export declare function getDefinedMetadata(mod: any, props: SegmentProps, tracingProps: { + route: string; +}): Metadata | MetadataResolver | null; +export declare function resolveStaticMetadata(modules: AppDirModules, props: SegmentProps): Promise; +export declare function postProcessMetadata(metadata: ResolvedMetadata, favicon: any, titleTemplates: TitleTemplates, metadataContext: MetadataContext): ResolvedMetadata; +export declare function createSelectedMetadata(metadata: ResolvedMetadata): SelectedMetadata; +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/metadata-resolution-primitives.js b/e-commerce/node_modules/next/dist/lib/metadata/metadata-resolution-primitives.js new file mode 100644 index 0000000000000000000000000000000000000000..2ae91126cebfc84eb5067dd1c71f9d87b531f65b --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/metadata-resolution-primitives.js @@ -0,0 +1,467 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + convertUrlsToStrings: null, + createSelectedMetadata: null, + getDefinedMetadata: null, + getDefinedViewport: null, + isFavicon: null, + mergeMetadata: null, + mergeViewport: null, + postProcessMetadata: null, + resolveStaticMetadata: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + convertUrlsToStrings: function() { + return convertUrlsToStrings; + }, + createSelectedMetadata: function() { + return createSelectedMetadata; + }, + getDefinedMetadata: function() { + return getDefinedMetadata; + }, + getDefinedViewport: function() { + return getDefinedViewport; + }, + isFavicon: function() { + return isFavicon; + }, + mergeMetadata: function() { + return mergeMetadata; + }, + mergeViewport: function() { + return mergeViewport; + }, + postProcessMetadata: function() { + return postProcessMetadata; + }, + resolveStaticMetadata: function() { + return resolveStaticMetadata; + } +}); +require("server-only"); +const _resolveopengraph = require("./resolvers/resolve-opengraph"); +const _resolvetitle = require("./resolvers/resolve-title"); +const _utils = require("./generate/utils"); +const _resolvebasics = require("./resolvers/resolve-basics"); +const _resolveicons = require("./resolvers/resolve-icons"); +const _tracer = require("../../server/lib/trace/tracer"); +const _constants = require("../../server/lib/trace/constants"); +const _clientandserverreferences = require("../client-and-server-references"); +function isFavicon(icon) { + if (!icon) { + return false; + } + // turbopack appends a hash to all images + return (icon.url === '/favicon.ico' || icon.url.toString().startsWith('/favicon.ico?')) && icon.type === 'image/x-icon'; +} +function convertUrlsToStrings(input) { + if (input instanceof URL) { + return input.toString(); + } else if (Array.isArray(input)) { + return input.map((item)=>convertUrlsToStrings(item)); + } else if (input && typeof input === 'object') { + const result = {}; + for (const [key, value] of Object.entries(input)){ + result[key] = convertUrlsToStrings(value); + } + return result; + } + return input; +} +function normalizeMetadataBase(metadataBase) { + if (typeof metadataBase === 'string') { + try { + metadataBase = new URL(metadataBase); + } catch { + throw new Error(`metadataBase is not a valid URL: ${metadataBase}`); + } + } + return metadataBase; +} +async function mergeStaticMetadata(metadataBase, source, target, staticFilesMetadata, metadataContext, titleTemplates, leafSegmentStaticIcons, pathname) { + var _source_twitter, _source_openGraph; + if (!staticFilesMetadata) return target; + const { icon, apple, openGraph, twitter, manifest } = staticFilesMetadata; + // Keep updating the static icons in the most leaf node + if (icon) { + leafSegmentStaticIcons.icon = icon; + } + if (apple) { + leafSegmentStaticIcons.apple = apple; + } + // file based metadata is specified and current level metadata twitter.images is not specified + if (twitter && !(source == null ? void 0 : (_source_twitter = source.twitter) == null ? void 0 : _source_twitter.hasOwnProperty('images'))) { + const resolvedTwitter = (0, _resolveopengraph.resolveTwitter)({ + ...target.twitter, + images: twitter + }, metadataBase, { + ...metadataContext, + isStaticMetadataRouteFile: true + }, titleTemplates.twitter); + target.twitter = convertUrlsToStrings(resolvedTwitter); + } + // file based metadata is specified and current level metadata openGraph.images is not specified + if (openGraph && !(source == null ? void 0 : (_source_openGraph = source.openGraph) == null ? void 0 : _source_openGraph.hasOwnProperty('images'))) { + const resolvedOpenGraph = await (0, _resolveopengraph.resolveOpenGraph)({ + ...target.openGraph, + images: openGraph + }, metadataBase, pathname, { + ...metadataContext, + isStaticMetadataRouteFile: true + }, titleTemplates.openGraph); + target.openGraph = convertUrlsToStrings(resolvedOpenGraph); + } + if (manifest) { + target.manifest = manifest; + } + return target; +} +async function mergeMetadata(route, pathname, { metadata, resolvedMetadata, staticFilesMetadata, titleTemplates, metadataContext, buildState, leafSegmentStaticIcons, cloneResolvedMetadata = true }) { + const newResolvedMetadata = cloneResolvedMetadata ? structuredClone(resolvedMetadata) : resolvedMetadata; + const metadataBase = normalizeMetadataBase((metadata == null ? void 0 : metadata.metadataBase) !== undefined ? metadata.metadataBase : resolvedMetadata.metadataBase); + for(const key_ in metadata){ + const key = key_; + switch(key){ + case 'title': + { + newResolvedMetadata.title = (0, _resolvetitle.resolveTitle)(metadata.title, titleTemplates.title); + break; + } + case 'alternates': + { + newResolvedMetadata.alternates = convertUrlsToStrings(await (0, _resolvebasics.resolveAlternates)(metadata.alternates, metadataBase, pathname, metadataContext)); + break; + } + case 'openGraph': + { + newResolvedMetadata.openGraph = convertUrlsToStrings(await (0, _resolveopengraph.resolveOpenGraph)(metadata.openGraph, metadataBase, pathname, metadataContext, titleTemplates.openGraph)); + break; + } + case 'twitter': + { + newResolvedMetadata.twitter = convertUrlsToStrings((0, _resolveopengraph.resolveTwitter)(metadata.twitter, metadataBase, metadataContext, titleTemplates.twitter)); + break; + } + case 'facebook': + newResolvedMetadata.facebook = (0, _resolvebasics.resolveFacebook)(metadata.facebook); + break; + case 'verification': + newResolvedMetadata.verification = (0, _resolvebasics.resolveVerification)(metadata.verification); + break; + case 'icons': + { + newResolvedMetadata.icons = convertUrlsToStrings((0, _resolveicons.resolveIcons)(metadata.icons)); + break; + } + case 'appleWebApp': + newResolvedMetadata.appleWebApp = (0, _resolvebasics.resolveAppleWebApp)(metadata.appleWebApp); + break; + case 'appLinks': + newResolvedMetadata.appLinks = convertUrlsToStrings((0, _resolvebasics.resolveAppLinks)(metadata.appLinks)); + break; + case 'robots': + { + newResolvedMetadata.robots = (0, _resolvebasics.resolveRobots)(metadata.robots); + break; + } + case 'archives': + case 'assets': + case 'bookmarks': + case 'keywords': + { + newResolvedMetadata[key] = (0, _utils.resolveAsArrayOrUndefined)(metadata[key]); + break; + } + case 'authors': + { + newResolvedMetadata[key] = convertUrlsToStrings((0, _utils.resolveAsArrayOrUndefined)(metadata.authors)); + break; + } + case 'itunes': + { + newResolvedMetadata[key] = await (0, _resolvebasics.resolveItunes)(metadata.itunes, metadataBase, pathname, metadataContext); + break; + } + case 'pagination': + { + newResolvedMetadata.pagination = await (0, _resolvebasics.resolvePagination)(metadata.pagination, metadataBase, pathname, metadataContext); + break; + } + // directly assign fields that fallback to null + case 'abstract': + newResolvedMetadata[key] = metadata[key] ?? null; + break; + case 'applicationName': + newResolvedMetadata[key] = metadata[key] ?? null; + break; + case 'description': + newResolvedMetadata[key] = metadata[key] ?? null; + break; + case 'generator': + newResolvedMetadata[key] = metadata[key] ?? null; + break; + case 'creator': + newResolvedMetadata[key] = metadata[key] ?? null; + break; + case 'publisher': + newResolvedMetadata[key] = metadata[key] ?? null; + break; + case 'category': + newResolvedMetadata[key] = metadata[key] ?? null; + break; + case 'classification': + newResolvedMetadata[key] = metadata[key] ?? null; + break; + case 'referrer': + newResolvedMetadata[key] = metadata[key] ?? null; + break; + case 'formatDetection': + newResolvedMetadata[key] = metadata[key] ?? null; + break; + case 'manifest': + newResolvedMetadata[key] = convertUrlsToStrings(metadata[key]) ?? null; + break; + case 'pinterest': + newResolvedMetadata[key] = convertUrlsToStrings(metadata[key]) ?? null; + break; + case 'other': + newResolvedMetadata.other = Object.assign({}, newResolvedMetadata.other, metadata.other); + if (metadata.other) { + if ('apple-touch-fullscreen' in metadata.other) { + buildState.warnings.add(`Use appleWebApp instead\nRead more: https://nextjs.org/docs/app/api-reference/functions/generate-metadata`); + } + if ('apple-touch-icon-precomposed' in metadata.other) { + buildState.warnings.add(`Use icons.apple instead\nRead more: https://nextjs.org/docs/app/api-reference/functions/generate-metadata`); + } + } + break; + case 'metadataBase': + newResolvedMetadata.metadataBase = metadataBase ? metadataBase.toString() : null; + break; + case 'apple-touch-fullscreen': + { + buildState.warnings.add(`Use appleWebApp instead\nRead more: https://nextjs.org/docs/app/api-reference/functions/generate-metadata`); + break; + } + case 'apple-touch-icon-precomposed': + { + buildState.warnings.add(`Use icons.apple instead\nRead more: https://nextjs.org/docs/app/api-reference/functions/generate-metadata`); + break; + } + case 'themeColor': + case 'colorScheme': + case 'viewport': + if (metadata[key] != null) { + buildState.warnings.add(`Unsupported metadata ${key} is configured in metadata export in ${route}. Please move it to viewport export instead.\nRead more: https://nextjs.org/docs/app/api-reference/functions/generate-viewport`); + } + break; + default: + { + key; + } + } + } + return mergeStaticMetadata(metadataBase, metadata, newResolvedMetadata, staticFilesMetadata, metadataContext, titleTemplates, leafSegmentStaticIcons, pathname); +} +function mergeViewport({ resolvedViewport, viewport, cloneResolvedViewport = true }) { + const newResolvedViewport = cloneResolvedViewport ? structuredClone(resolvedViewport) : resolvedViewport; + if (viewport) { + for(const key_ in viewport){ + const key = key_; + switch(key){ + case 'themeColor': + { + newResolvedViewport.themeColor = (0, _resolvebasics.resolveThemeColor)(viewport.themeColor); + break; + } + case 'colorScheme': + newResolvedViewport.colorScheme = viewport.colorScheme || null; + break; + case 'width': + case 'height': + case 'initialScale': + case 'minimumScale': + case 'maximumScale': + case 'userScalable': + case 'viewportFit': + case 'interactiveWidget': + // always override the target with the source + // @ts-ignore viewport properties + newResolvedViewport[key] = viewport[key]; + break; + default: + key; + } + } + } + return newResolvedViewport; +} +function getDefinedViewport(mod, props, tracingProps) { + if (typeof mod.generateViewport === 'function') { + const { route } = tracingProps; + const segmentProps = createSegmentProps(mod.generateViewport, props); + return Object.assign((parent)=>(0, _tracer.getTracer)().trace(_constants.ResolveMetadataSpan.generateViewport, { + spanName: `generateViewport ${route}`, + attributes: { + 'next.page': route + } + }, ()=>mod.generateViewport(segmentProps, parent)), { + $$original: mod.generateViewport + }); + } + return mod.viewport || null; +} +function getDefinedMetadata(mod, props, tracingProps) { + if (typeof mod.generateMetadata === 'function') { + const { route } = tracingProps; + const segmentProps = createSegmentProps(mod.generateMetadata, props); + return Object.assign((parent)=>(0, _tracer.getTracer)().trace(_constants.ResolveMetadataSpan.generateMetadata, { + spanName: `generateMetadata ${route}`, + attributes: { + 'next.page': route + } + }, ()=>mod.generateMetadata(segmentProps, parent)), { + $$original: mod.generateMetadata + }); + } + return mod.metadata || null; +} +/** + * If `fn` is a `'use cache'` function, we add special markers to the props, + * that the cache wrapper reads and removes, before passing the props to the + * user function. + */ function createSegmentProps(fn, props) { + return (0, _clientandserverreferences.isUseCacheFunction)(fn) ? 'searchParams' in props ? { + ...props, + $$isPage: true + } : { + ...props, + $$isLayout: true + } : props; +} +async function collectStaticImagesFiles(metadata, props, type) { + if (!(metadata == null ? void 0 : metadata[type])) return undefined; + const iconPromises = metadata[type].map(async (imageModule)=>await imageModule(props)); + return (iconPromises == null ? void 0 : iconPromises.length) > 0 ? (await Promise.all(iconPromises)).flat() : undefined; +} +async function resolveStaticMetadata(modules, props) { + const { metadata } = modules; + if (!metadata) return null; + const [icon, apple, openGraph, twitter] = await Promise.all([ + collectStaticImagesFiles(metadata, props, 'icon'), + collectStaticImagesFiles(metadata, props, 'apple'), + collectStaticImagesFiles(metadata, props, 'openGraph'), + collectStaticImagesFiles(metadata, props, 'twitter') + ]); + const staticMetadata = { + icon, + apple, + openGraph, + twitter, + manifest: metadata.manifest + }; + return staticMetadata; +} +const isTitleTruthy = (title)=>!!(title == null ? void 0 : title.absolute); +const hasTitle = (metadata)=>isTitleTruthy(metadata == null ? void 0 : metadata.title); +function inheritFromMetadata(target, metadata) { + if (target) { + if (!hasTitle(target) && hasTitle(metadata)) { + target.title = metadata.title; + } + if (!target.description && metadata.description) { + target.description = metadata.description; + } + } +} +// eslint-disable-next-line @typescript-eslint/no-unused-vars +const commonOgKeys = [ + 'title', + 'description', + 'images' +]; +function postProcessMetadata(metadata, favicon, titleTemplates, metadataContext) { + const { openGraph, twitter } = metadata; + if (openGraph) { + // If there's openGraph information but not configured in twitter, + // inherit them from openGraph metadata. + let autoFillProps = {}; + const hasTwTitle = hasTitle(twitter); + const hasTwDescription = twitter == null ? void 0 : twitter.description; + const hasTwImages = Boolean((twitter == null ? void 0 : twitter.hasOwnProperty('images')) && twitter.images); + if (!hasTwTitle) { + if (isTitleTruthy(openGraph.title)) { + autoFillProps.title = openGraph.title; + } else if (metadata.title && isTitleTruthy(metadata.title)) { + autoFillProps.title = metadata.title; + } + } + if (!hasTwDescription) autoFillProps.description = openGraph.description || metadata.description || undefined; + if (!hasTwImages) autoFillProps.images = openGraph.images; + if (Object.keys(autoFillProps).length > 0) { + const partialTwitter = (0, _resolveopengraph.resolveTwitter)(autoFillProps, normalizeMetadataBase(metadata.metadataBase), metadataContext, titleTemplates.twitter); + if (metadata.twitter) { + metadata.twitter = Object.assign({}, metadata.twitter, { + ...!hasTwTitle && { + title: partialTwitter == null ? void 0 : partialTwitter.title + }, + ...!hasTwDescription && { + description: partialTwitter == null ? void 0 : partialTwitter.description + }, + ...!hasTwImages && { + images: partialTwitter == null ? void 0 : partialTwitter.images + } + }); + } else { + metadata.twitter = convertUrlsToStrings(partialTwitter); + } + } + } + // If there's no title and description configured in openGraph or twitter, + // use the title and description from metadata. + inheritFromMetadata(openGraph, metadata); + inheritFromMetadata(twitter, metadata); + if (favicon) { + if (!metadata.icons) { + metadata.icons = { + icon: [], + apple: [] + }; + } + metadata.icons.icon.unshift(favicon); + } + return metadata; +} +function createSelectedMetadata(metadata) { + const { metadataBase, title, openGraph, twitter, themeColor, colorScheme, viewport, ...metadataTagFields } = metadata; + // These fields are only used while resolving metadata, or are rendered by + // the separate viewport pipeline. + void metadataBase; + void themeColor; + void colorScheme; + void viewport; + return { + ...metadataTagFields, + title: (title == null ? void 0 : title.absolute) || null, + openGraph: openGraph ? { + ...openGraph, + title: openGraph.title.absolute + } : null, + twitter: twitter ? { + ...twitter, + title: twitter.title.absolute + } : null + }; +} + +//# sourceMappingURL=metadata-resolution-primitives.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/metadata-resolution-primitives.js.map b/e-commerce/node_modules/next/dist/lib/metadata/metadata-resolution-primitives.js.map new file mode 100644 index 0000000000000000000000000000000000000000..acd4e819a45343bbac09053b25a528f631f89419 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/metadata-resolution-primitives.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/metadata/metadata-resolution-primitives.ts"],"sourcesContent":["import type {\n Metadata,\n ResolvedMetadata,\n ResolvedViewport,\n ResolvingMetadata,\n ResolvingViewport,\n Viewport,\n WithStringifiedURLs,\n} from './types/metadata-interface'\nimport type { MetadataImageModule } from '../../build/webpack/loaders/metadata/types'\nimport type { Twitter } from './types/twitter-types'\nimport type { OpenGraph } from './types/opengraph-types'\nimport type { AppDirModules } from '../../build/webpack/loaders/next-app-loader'\nimport type { MetadataContext } from './types/resolvers'\nimport type {\n AbsoluteTemplateString,\n IconDescriptor,\n ResolvedIcons,\n} from './types/metadata-types'\nimport type { StaticMetadata } from './types/icons'\nimport type { Params } from '../../server/request/params'\nimport type { SearchParams } from '../../server/request/search-params'\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport 'server-only'\n\nimport { resolveOpenGraph, resolveTwitter } from './resolvers/resolve-opengraph'\nimport { resolveTitle } from './resolvers/resolve-title'\nimport { resolveAsArrayOrUndefined } from './generate/utils'\nimport {\n resolveAlternates,\n resolveAppleWebApp,\n resolveAppLinks,\n resolveRobots,\n resolveThemeColor,\n resolveVerification,\n resolveItunes,\n resolveFacebook,\n resolvePagination,\n} from './resolvers/resolve-basics'\nimport { resolveIcons } from './resolvers/resolve-icons'\nimport { getTracer } from '../../server/lib/trace/tracer'\nimport { ResolveMetadataSpan } from '../../server/lib/trace/constants'\nimport type { MetadataBaseURL } from './resolvers/resolve-url'\nimport { isUseCacheFunction } from '../client-and-server-references'\nimport type {\n UseCacheLayoutProps,\n UseCachePageProps,\n} from '../../server/use-cache/use-cache-wrapper'\n\nexport type StaticIcons = Pick\n\nexport type InstrumentedResolver = ((\n parent: Promise\n) => TData | Promise) & {\n $$original: (\n props: unknown,\n parent: Promise\n ) => TData | Promise\n}\nexport type MetadataResolver = InstrumentedResolver\nexport type ViewportResolver = InstrumentedResolver\n\nexport type MetadataErrorType = 'not-found' | 'forbidden' | 'unauthorized'\n\nexport type MetadataItems = Array<\n [Metadata | MetadataResolver | null, StaticMetadata]\n>\n\nexport type ViewportItems = Array\n\ntype WithSelectedTitle = T extends { title: AbsoluteTemplateString }\n ? Omit & { title: string }\n : T\n\n/**\n * Metadata that has finished route-level resolution and post-processing. It\n * contains only values that can be turned into metadata elements; it is never\n * used as the parent of another metadata resolver.\n */\nexport type SelectedMetadata = Omit<\n ResolvedMetadata,\n | 'metadataBase'\n | 'title'\n | 'openGraph'\n | 'twitter'\n | 'themeColor'\n | 'colorScheme'\n | 'viewport'\n> & {\n title: string | null\n openGraph: WithSelectedTitle<\n NonNullable\n > | null\n twitter: WithSelectedTitle> | null\n}\n\nexport type TitleTemplates = {\n title: string | null\n twitter: string | null\n openGraph: string | null\n}\n\nexport type BuildState = {\n warnings: Set\n}\n\nexport type LayoutProps = {\n params: Promise\n}\n\nexport type PageProps = {\n params: Promise\n searchParams: Promise\n}\n\nexport type SegmentProps = LayoutProps | PageProps\nexport type UseCacheSegmentProps = UseCacheLayoutProps | UseCachePageProps\n\nexport function isFavicon(icon: IconDescriptor | undefined): boolean {\n if (!icon) {\n return false\n }\n\n // turbopack appends a hash to all images\n return (\n (icon.url === '/favicon.ico' ||\n icon.url.toString().startsWith('/favicon.ico?')) &&\n icon.type === 'image/x-icon'\n )\n}\n\nexport function convertUrlsToStrings(input: T): WithStringifiedURLs {\n if (input instanceof URL) {\n return input.toString() as unknown as WithStringifiedURLs\n } else if (Array.isArray(input)) {\n return input.map((item) =>\n convertUrlsToStrings(item)\n ) as WithStringifiedURLs\n } else if (input && typeof input === 'object') {\n const result: Record = {}\n for (const [key, value] of Object.entries(input)) {\n result[key] = convertUrlsToStrings(value)\n }\n return result as WithStringifiedURLs\n }\n return input as WithStringifiedURLs\n}\n\nfunction normalizeMetadataBase(metadataBase: string | URL | null): URL | null {\n if (typeof metadataBase === 'string') {\n try {\n metadataBase = new URL(metadataBase)\n } catch {\n throw new Error(`metadataBase is not a valid URL: ${metadataBase}`)\n }\n }\n return metadataBase\n}\n\nasync function mergeStaticMetadata(\n metadataBase: MetadataBaseURL,\n source: Metadata | null,\n target: ResolvedMetadata,\n staticFilesMetadata: StaticMetadata,\n metadataContext: MetadataContext,\n titleTemplates: TitleTemplates,\n leafSegmentStaticIcons: StaticIcons,\n pathname: Promise\n): Promise {\n if (!staticFilesMetadata) return target\n const { icon, apple, openGraph, twitter, manifest } = staticFilesMetadata\n\n // Keep updating the static icons in the most leaf node\n\n if (icon) {\n leafSegmentStaticIcons.icon = icon\n }\n if (apple) {\n leafSegmentStaticIcons.apple = apple\n }\n\n // file based metadata is specified and current level metadata twitter.images is not specified\n if (twitter && !source?.twitter?.hasOwnProperty('images')) {\n const resolvedTwitter = resolveTwitter(\n { ...target.twitter, images: twitter } as Twitter,\n metadataBase,\n { ...metadataContext, isStaticMetadataRouteFile: true },\n titleTemplates.twitter\n )\n target.twitter = convertUrlsToStrings(resolvedTwitter)\n }\n\n // file based metadata is specified and current level metadata openGraph.images is not specified\n if (openGraph && !source?.openGraph?.hasOwnProperty('images')) {\n const resolvedOpenGraph = await resolveOpenGraph(\n { ...target.openGraph, images: openGraph } as OpenGraph,\n metadataBase,\n pathname,\n { ...metadataContext, isStaticMetadataRouteFile: true },\n titleTemplates.openGraph\n )\n target.openGraph = convertUrlsToStrings(resolvedOpenGraph)\n }\n if (manifest) {\n target.manifest = manifest\n }\n\n return target\n}\n\n/**\n * Merges the given metadata with the resolved metadata. Returns a new object.\n */\nexport async function mergeMetadata(\n route: string,\n pathname: Promise,\n {\n metadata,\n resolvedMetadata,\n staticFilesMetadata,\n titleTemplates,\n metadataContext,\n buildState,\n leafSegmentStaticIcons,\n cloneResolvedMetadata = true,\n }: {\n metadata: Metadata | null\n resolvedMetadata: ResolvedMetadata\n staticFilesMetadata: StaticMetadata\n titleTemplates: TitleTemplates\n metadataContext: MetadataContext\n buildState: BuildState\n leafSegmentStaticIcons: StaticIcons\n cloneResolvedMetadata?: boolean\n }\n): Promise {\n const newResolvedMetadata = cloneResolvedMetadata\n ? structuredClone(resolvedMetadata)\n : resolvedMetadata\n\n const metadataBase = normalizeMetadataBase(\n metadata?.metadataBase !== undefined\n ? metadata.metadataBase\n : resolvedMetadata.metadataBase\n )\n\n for (const key_ in metadata) {\n const key = key_ as keyof Metadata\n\n switch (key) {\n case 'title': {\n newResolvedMetadata.title = resolveTitle(\n metadata.title,\n titleTemplates.title\n )\n break\n }\n case 'alternates': {\n newResolvedMetadata.alternates = convertUrlsToStrings(\n await resolveAlternates(\n metadata.alternates,\n metadataBase,\n pathname,\n metadataContext\n )\n )\n break\n }\n case 'openGraph': {\n newResolvedMetadata.openGraph = convertUrlsToStrings(\n await resolveOpenGraph(\n metadata.openGraph,\n metadataBase,\n pathname,\n metadataContext,\n titleTemplates.openGraph\n )\n )\n break\n }\n case 'twitter': {\n newResolvedMetadata.twitter = convertUrlsToStrings(\n resolveTwitter(\n metadata.twitter,\n metadataBase,\n metadataContext,\n titleTemplates.twitter\n )\n )\n break\n }\n case 'facebook':\n newResolvedMetadata.facebook = resolveFacebook(metadata.facebook)\n break\n case 'verification':\n newResolvedMetadata.verification = resolveVerification(\n metadata.verification\n )\n break\n\n case 'icons': {\n newResolvedMetadata.icons = convertUrlsToStrings(\n resolveIcons(metadata.icons)\n )\n break\n }\n case 'appleWebApp':\n newResolvedMetadata.appleWebApp = resolveAppleWebApp(\n metadata.appleWebApp\n )\n break\n case 'appLinks':\n newResolvedMetadata.appLinks = convertUrlsToStrings(\n resolveAppLinks(metadata.appLinks)\n )\n break\n case 'robots': {\n newResolvedMetadata.robots = resolveRobots(metadata.robots)\n break\n }\n case 'archives':\n case 'assets':\n case 'bookmarks':\n case 'keywords': {\n newResolvedMetadata[key] = resolveAsArrayOrUndefined(metadata[key])\n break\n }\n case 'authors': {\n newResolvedMetadata[key] = convertUrlsToStrings(\n resolveAsArrayOrUndefined(metadata.authors)\n )\n break\n }\n case 'itunes': {\n newResolvedMetadata[key] = await resolveItunes(\n metadata.itunes,\n metadataBase,\n pathname,\n metadataContext\n )\n break\n }\n case 'pagination': {\n newResolvedMetadata.pagination = await resolvePagination(\n metadata.pagination,\n metadataBase,\n pathname,\n metadataContext\n )\n break\n }\n // directly assign fields that fallback to null\n case 'abstract':\n newResolvedMetadata[key] = metadata[key] ?? null\n break\n case 'applicationName':\n newResolvedMetadata[key] = metadata[key] ?? null\n break\n case 'description':\n newResolvedMetadata[key] = metadata[key] ?? null\n break\n case 'generator':\n newResolvedMetadata[key] = metadata[key] ?? null\n break\n case 'creator':\n newResolvedMetadata[key] = metadata[key] ?? null\n break\n case 'publisher':\n newResolvedMetadata[key] = metadata[key] ?? null\n break\n case 'category':\n newResolvedMetadata[key] = metadata[key] ?? null\n break\n case 'classification':\n newResolvedMetadata[key] = metadata[key] ?? null\n break\n case 'referrer':\n newResolvedMetadata[key] = metadata[key] ?? null\n break\n case 'formatDetection':\n newResolvedMetadata[key] = metadata[key] ?? null\n break\n case 'manifest':\n newResolvedMetadata[key] = convertUrlsToStrings(metadata[key]) ?? null\n break\n case 'pinterest':\n newResolvedMetadata[key] = convertUrlsToStrings(metadata[key]) ?? null\n break\n case 'other':\n newResolvedMetadata.other = Object.assign(\n {},\n newResolvedMetadata.other,\n metadata.other\n )\n if (metadata.other) {\n if ('apple-touch-fullscreen' in metadata.other) {\n buildState.warnings.add(\n `Use appleWebApp instead\\nRead more: https://nextjs.org/docs/app/api-reference/functions/generate-metadata`\n )\n }\n if ('apple-touch-icon-precomposed' in metadata.other) {\n buildState.warnings.add(\n `Use icons.apple instead\\nRead more: https://nextjs.org/docs/app/api-reference/functions/generate-metadata`\n )\n }\n }\n break\n case 'metadataBase':\n newResolvedMetadata.metadataBase = metadataBase\n ? metadataBase.toString()\n : null\n break\n\n case 'apple-touch-fullscreen': {\n buildState.warnings.add(\n `Use appleWebApp instead\\nRead more: https://nextjs.org/docs/app/api-reference/functions/generate-metadata`\n )\n break\n }\n case 'apple-touch-icon-precomposed': {\n buildState.warnings.add(\n `Use icons.apple instead\\nRead more: https://nextjs.org/docs/app/api-reference/functions/generate-metadata`\n )\n break\n }\n case 'themeColor':\n case 'colorScheme':\n case 'viewport':\n if (metadata[key] != null) {\n buildState.warnings.add(\n `Unsupported metadata ${key} is configured in metadata export in ${route}. Please move it to viewport export instead.\\nRead more: https://nextjs.org/docs/app/api-reference/functions/generate-viewport`\n )\n }\n break\n default: {\n key satisfies never\n }\n }\n }\n\n return mergeStaticMetadata(\n metadataBase,\n metadata,\n newResolvedMetadata,\n staticFilesMetadata,\n metadataContext,\n titleTemplates,\n leafSegmentStaticIcons,\n pathname\n )\n}\n\n/**\n * Merges the given viewport with the resolved viewport. Returns a new object.\n */\nexport function mergeViewport({\n resolvedViewport,\n viewport,\n cloneResolvedViewport = true,\n}: {\n resolvedViewport: ResolvedViewport\n viewport: Viewport | null\n cloneResolvedViewport?: boolean\n}): ResolvedViewport {\n const newResolvedViewport = cloneResolvedViewport\n ? structuredClone(resolvedViewport)\n : resolvedViewport\n\n if (viewport) {\n for (const key_ in viewport) {\n const key = key_ as keyof Viewport\n\n switch (key) {\n case 'themeColor': {\n newResolvedViewport.themeColor = resolveThemeColor(\n viewport.themeColor\n )\n break\n }\n case 'colorScheme':\n newResolvedViewport.colorScheme = viewport.colorScheme || null\n break\n case 'width':\n case 'height':\n case 'initialScale':\n case 'minimumScale':\n case 'maximumScale':\n case 'userScalable':\n case 'viewportFit':\n case 'interactiveWidget':\n // always override the target with the source\n // @ts-ignore viewport properties\n newResolvedViewport[key] = viewport[key]\n break\n default:\n key satisfies never\n }\n }\n }\n\n return newResolvedViewport\n}\n\nexport function getDefinedViewport(\n mod: any,\n props: SegmentProps,\n tracingProps: { route: string }\n): Viewport | ViewportResolver | null {\n if (typeof mod.generateViewport === 'function') {\n const { route } = tracingProps\n const segmentProps = createSegmentProps(mod.generateViewport, props)\n\n return Object.assign(\n (parent: ResolvingViewport) =>\n getTracer().trace(\n ResolveMetadataSpan.generateViewport,\n {\n spanName: `generateViewport ${route}`,\n attributes: {\n 'next.page': route,\n },\n },\n () => mod.generateViewport(segmentProps, parent)\n ),\n { $$original: mod.generateViewport }\n )\n }\n return mod.viewport || null\n}\n\nexport function getDefinedMetadata(\n mod: any,\n props: SegmentProps,\n tracingProps: { route: string }\n): Metadata | MetadataResolver | null {\n if (typeof mod.generateMetadata === 'function') {\n const { route } = tracingProps\n const segmentProps = createSegmentProps(mod.generateMetadata, props)\n\n return Object.assign(\n (parent: ResolvingMetadata) =>\n getTracer().trace(\n ResolveMetadataSpan.generateMetadata,\n {\n spanName: `generateMetadata ${route}`,\n attributes: {\n 'next.page': route,\n },\n },\n () => mod.generateMetadata(segmentProps, parent)\n ),\n { $$original: mod.generateMetadata }\n )\n }\n return mod.metadata || null\n}\n\n/**\n * If `fn` is a `'use cache'` function, we add special markers to the props,\n * that the cache wrapper reads and removes, before passing the props to the\n * user function.\n */\nfunction createSegmentProps(\n fn: Function,\n props: SegmentProps\n): SegmentProps | UseCacheSegmentProps {\n return isUseCacheFunction(fn)\n ? 'searchParams' in props\n ? { ...props, $$isPage: true }\n : { ...props, $$isLayout: true }\n : props\n}\n\nasync function collectStaticImagesFiles(\n metadata: AppDirModules['metadata'],\n props: SegmentProps,\n type: keyof NonNullable\n) {\n if (!metadata?.[type]) return undefined\n\n const iconPromises = metadata[type as 'icon' | 'apple'].map(\n async (imageModule: (p: any) => Promise) =>\n await imageModule(props)\n )\n\n return iconPromises?.length > 0\n ? (await Promise.all(iconPromises)).flat()\n : undefined\n}\n\nexport async function resolveStaticMetadata(\n modules: AppDirModules,\n props: SegmentProps\n): Promise {\n const { metadata } = modules\n if (!metadata) return null\n\n const [icon, apple, openGraph, twitter] = await Promise.all([\n collectStaticImagesFiles(metadata, props, 'icon'),\n collectStaticImagesFiles(metadata, props, 'apple'),\n collectStaticImagesFiles(metadata, props, 'openGraph'),\n collectStaticImagesFiles(metadata, props, 'twitter'),\n ])\n\n const staticMetadata = {\n icon,\n apple,\n openGraph,\n twitter,\n manifest: metadata.manifest,\n }\n\n return staticMetadata\n}\n\ntype WithTitle = { title?: AbsoluteTemplateString | null }\ntype WithDescription = { description?: string | null }\n\nconst isTitleTruthy = (title: AbsoluteTemplateString | null | undefined) =>\n !!title?.absolute\nconst hasTitle = (metadata: WithTitle | null) => isTitleTruthy(metadata?.title)\n\nfunction inheritFromMetadata(\n target: (WithTitle & WithDescription) | null,\n metadata: ResolvedMetadata\n) {\n if (target) {\n if (!hasTitle(target) && hasTitle(metadata)) {\n target.title = metadata.title\n }\n if (!target.description && metadata.description) {\n target.description = metadata.description\n }\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst commonOgKeys = ['title', 'description', 'images'] as const\nexport function postProcessMetadata(\n metadata: ResolvedMetadata,\n favicon: any,\n titleTemplates: TitleTemplates,\n metadataContext: MetadataContext\n): ResolvedMetadata {\n const { openGraph, twitter } = metadata\n\n if (openGraph) {\n // If there's openGraph information but not configured in twitter,\n // inherit them from openGraph metadata.\n let autoFillProps: Partial<{\n [Key in (typeof commonOgKeys)[number]]: NonNullable<\n ResolvedMetadata['openGraph']\n >[Key]\n }> = {}\n const hasTwTitle = hasTitle(twitter)\n const hasTwDescription = twitter?.description\n const hasTwImages = Boolean(\n twitter?.hasOwnProperty('images') && twitter.images\n )\n if (!hasTwTitle) {\n if (isTitleTruthy(openGraph.title)) {\n autoFillProps.title = openGraph.title\n } else if (metadata.title && isTitleTruthy(metadata.title)) {\n autoFillProps.title = metadata.title\n }\n }\n if (!hasTwDescription)\n autoFillProps.description =\n openGraph.description || metadata.description || undefined\n if (!hasTwImages) autoFillProps.images = openGraph.images\n\n if (Object.keys(autoFillProps).length > 0) {\n const partialTwitter = resolveTwitter(\n autoFillProps,\n normalizeMetadataBase(metadata.metadataBase),\n metadataContext,\n titleTemplates.twitter\n )\n if (metadata.twitter) {\n metadata.twitter = Object.assign({}, metadata.twitter, {\n ...(!hasTwTitle && { title: partialTwitter?.title }),\n ...(!hasTwDescription && {\n description: partialTwitter?.description,\n }),\n ...(!hasTwImages && { images: partialTwitter?.images }),\n })\n } else {\n metadata.twitter = convertUrlsToStrings(partialTwitter)\n }\n }\n }\n\n // If there's no title and description configured in openGraph or twitter,\n // use the title and description from metadata.\n inheritFromMetadata(openGraph, metadata)\n inheritFromMetadata(twitter, metadata)\n\n if (favicon) {\n if (!metadata.icons) {\n metadata.icons = {\n icon: [],\n apple: [],\n }\n }\n\n metadata.icons.icon.unshift(favicon)\n }\n\n return metadata\n}\n\nexport function createSelectedMetadata(\n metadata: ResolvedMetadata\n): SelectedMetadata {\n const {\n metadataBase,\n title,\n openGraph,\n twitter,\n themeColor,\n colorScheme,\n viewport,\n ...metadataTagFields\n } = metadata\n\n // These fields are only used while resolving metadata, or are rendered by\n // the separate viewport pipeline.\n void metadataBase\n void themeColor\n void colorScheme\n void viewport\n\n return {\n ...metadataTagFields,\n title: title?.absolute || null,\n openGraph: openGraph\n ? { ...openGraph, title: openGraph.title.absolute }\n : null,\n twitter: twitter ? { ...twitter, title: twitter.title.absolute } : null,\n }\n}\n"],"names":["convertUrlsToStrings","createSelectedMetadata","getDefinedMetadata","getDefinedViewport","isFavicon","mergeMetadata","mergeViewport","postProcessMetadata","resolveStaticMetadata","icon","url","toString","startsWith","type","input","URL","Array","isArray","map","item","result","key","value","Object","entries","normalizeMetadataBase","metadataBase","Error","mergeStaticMetadata","source","target","staticFilesMetadata","metadataContext","titleTemplates","leafSegmentStaticIcons","pathname","apple","openGraph","twitter","manifest","hasOwnProperty","resolvedTwitter","resolveTwitter","images","isStaticMetadataRouteFile","resolvedOpenGraph","resolveOpenGraph","route","metadata","resolvedMetadata","buildState","cloneResolvedMetadata","newResolvedMetadata","structuredClone","undefined","key_","title","resolveTitle","alternates","resolveAlternates","facebook","resolveFacebook","verification","resolveVerification","icons","resolveIcons","appleWebApp","resolveAppleWebApp","appLinks","resolveAppLinks","robots","resolveRobots","resolveAsArrayOrUndefined","authors","resolveItunes","itunes","pagination","resolvePagination","other","assign","warnings","add","resolvedViewport","viewport","cloneResolvedViewport","newResolvedViewport","themeColor","resolveThemeColor","colorScheme","mod","props","tracingProps","generateViewport","segmentProps","createSegmentProps","parent","getTracer","trace","ResolveMetadataSpan","spanName","attributes","$$original","generateMetadata","fn","isUseCacheFunction","$$isPage","$$isLayout","collectStaticImagesFiles","iconPromises","imageModule","length","Promise","all","flat","modules","staticMetadata","isTitleTruthy","absolute","hasTitle","inheritFromMetadata","description","commonOgKeys","favicon","autoFillProps","hasTwTitle","hasTwDescription","hasTwImages","Boolean","keys","partialTwitter","unshift","metadataTagFields"],"mappings":";;;;;;;;;;;;;;;;;;;;;;IAoIgBA,oBAAoB;eAApBA;;IAokBAC,sBAAsB;eAAtBA;;IArLAC,kBAAkB;eAAlBA;;IA3BAC,kBAAkB;eAAlBA;;IAjYAC,SAAS;eAATA;;IA+FMC,aAAa;eAAbA;;IAkPNC,aAAa;eAAbA;;IAuLAC,mBAAmB;eAAnBA;;IAhDMC,qBAAqB;eAArBA;;;QAvjBf;kCAE0C;8BACpB;uBACa;+BAWnC;8BACsB;wBACH;2BACU;2CAED;AA2E5B,SAASJ,UAAUK,IAAgC;IACxD,IAAI,CAACA,MAAM;QACT,OAAO;IACT;IAEA,yCAAyC;IACzC,OACE,AAACA,CAAAA,KAAKC,GAAG,KAAK,kBACZD,KAAKC,GAAG,CAACC,QAAQ,GAAGC,UA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pB3E,OAAOA,CAAAA,yBAAAA,MAAO6D,QAAQ,KAAI;QAC1BhF,WAAWA,YACP;YAAE,GAAGA,SAAS;YAAEmB,OAAOnB,UAAUmB,KAAK,CAAC6D,QAAQ;QAAC,IAChD;QACJ/E,SAASA,UAAU;YAAE,GAAGA,OAAO;YAAEkB,OAAOlB,QAAQkB,KAAK,CAAC6D,QAAQ;QAAC,IAAI;IACrE;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/metadata.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/metadata.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e1a7ee832abd40a75056419e8922692ca15809a3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/metadata.d.ts @@ -0,0 +1,21 @@ +import React from 'react'; +import type { Params } from '../../server/request/params'; +import type { LoaderTree } from '../../server/lib/app-dir-module'; +import type { SearchParams } from '../../server/request/search-params'; +import { type MetadataErrorType } from './resolve-metadata'; +import type { MetadataContext } from './types/resolvers'; +export declare function createMetadataComponents({ tree, pathname, parsedQuery, metadataContext, interpolatedParams, errorType, serveStreamingMetadata, }: { + tree: LoaderTree; + pathname: string; + parsedQuery: SearchParams; + metadataContext: MetadataContext; + interpolatedParams: Params; + errorType?: MetadataErrorType | 'redirect'; + serveStreamingMetadata: boolean; +}): { + Viewport: React.ComponentType; + Metadata: React.ComponentType; + MetadataOutlet: React.ComponentType<{ + tree: LoaderTree; + }>; +}; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/metadata.js b/e-commerce/node_modules/next/dist/lib/metadata/metadata.js new file mode 100644 index 0000000000000000000000000000000000000000..cde6fa042b68bcb1ce91d294595261913566b706 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/metadata.js @@ -0,0 +1,174 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "createMetadataComponents", { + enumerable: true, + get: function() { + return createMetadataComponents; + } +}); +const _jsxruntime = require("react/jsx-runtime"); +const _react = /*#__PURE__*/ _interop_require_wildcard(require("react")); +const _resolvemetadata = require("./resolve-metadata"); +const _httpaccessfallback = require("../../client/components/http-access-fallback/http-access-fallback"); +const _searchparams = require("../../server/request/search-params"); +const _pathname = require("../../server/request/pathname"); +const _boundarycomponents = require("../framework/boundary-components"); +const _metadataelements = require("./metadata-elements"); +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +function createMetadataComponents({ tree, pathname, parsedQuery, metadataContext, interpolatedParams, errorType, serveStreamingMetadata }) { + const searchParams = (0, _searchparams.createServerSearchParamsForMetadata)(parsedQuery); + const pathnameForMetadata = (0, _pathname.createServerPathnameForMetadata)(pathname); + async function Viewport() { + const tags = await getResolvedViewport(tree, searchParams, interpolatedParams, errorType).catch((viewportErr)=>{ + if (!errorType && (0, _httpaccessfallback.isHTTPAccessFallbackError)(viewportErr)) { + return getNotFoundViewport(tree, searchParams, interpolatedParams).catch(()=>null); + } + // We're going to throw the error from the metadata outlet so we just render null here instead + return null; + }); + return tags; + } + Viewport.displayName = 'Next.Viewport'; + function ViewportWrapper() { + return /*#__PURE__*/ (0, _jsxruntime.jsx)(_boundarycomponents.ViewportBoundary, { + children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Viewport, {}) + }); + } + // Metadata resolution must start while rendering so it observes the current + // work unit store. + function getSelectedMetadata() { + return getResolvedMetadata(tree, pathnameForMetadata, searchParams, interpolatedParams, metadataContext, errorType).catch((metadataErr)=>{ + if (!errorType && (0, _httpaccessfallback.isHTTPAccessFallbackError)(metadataErr)) { + return getNotFoundMetadata(tree, pathnameForMetadata, searchParams, interpolatedParams, metadataContext).catch(()=>null); + } + // We're going to throw the error from the metadata outlet so we just render null here instead + return null; + }); + } + async function Metadata() { + return await getSelectedMetadata(); + } + Metadata.displayName = 'Next.Metadata'; + function MetadataBlocker() { + return serveStreamingMetadata ? null : getSelectedMetadata().then(()=>null); + } + function MetadataWrapper() { + // Keep the same component structure in streaming and blocking renders. + // The blocker only holds the shell open when metadata must not stream. + // React requires top-level suspenseful metadata to be nested under a host + // element. Otherwise it becomes part of the document preamble and blocks + // shell flushing instead of streaming. Metadata tags are hoisted out, so + // this hidden wrapper remains empty. + return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_boundarycomponents.MetadataBoundary, { + children: [ + /*#__PURE__*/ (0, _jsxruntime.jsx)("div", { + hidden: true, + children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_react.Suspense, { + name: "Next.Metadata", + children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Metadata, {}) + }) + }), + /*#__PURE__*/ (0, _jsxruntime.jsx)(MetadataBlocker, {}) + ] + }); + } + function MetadataOutlet() { + const pendingOutlet = Promise.all([ + getResolvedMetadata(tree, pathnameForMetadata, searchParams, interpolatedParams, metadataContext, errorType), + getResolvedViewport(tree, searchParams, interpolatedParams, errorType) + ]).then(()=>null); + if (!serveStreamingMetadata) { + return /*#__PURE__*/ (0, _jsxruntime.jsx)(_boundarycomponents.OutletBoundary, { + children: pendingOutlet + }); + } + return /*#__PURE__*/ (0, _jsxruntime.jsx)(_boundarycomponents.OutletBoundary, { + children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_react.Suspense, { + name: "Next.MetadataOutlet", + children: pendingOutlet + }) + }); + } + MetadataOutlet.displayName = 'Next.MetadataOutlet'; + return { + Viewport: ViewportWrapper, + Metadata: MetadataWrapper, + MetadataOutlet + }; +} +const getResolvedMetadata = (0, _react.cache)(getResolvedMetadataImpl); +async function getResolvedMetadataImpl(tree, pathname, searchParams, interpolatedParams, metadataContext, errorType) { + const errorConvention = errorType === 'redirect' ? undefined : errorType; + return renderMetadata(tree, pathname, searchParams, interpolatedParams, metadataContext, errorConvention); +} +const getNotFoundMetadata = (0, _react.cache)(getNotFoundMetadataImpl); +async function getNotFoundMetadataImpl(tree, pathname, searchParams, interpolatedParams, metadataContext) { + const notFoundErrorConvention = 'not-found'; + return renderMetadata(tree, pathname, searchParams, interpolatedParams, metadataContext, notFoundErrorConvention); +} +const getResolvedViewport = (0, _react.cache)(getResolvedViewportImpl); +async function getResolvedViewportImpl(tree, searchParams, interpolatedParams, errorType) { + const errorConvention = errorType === 'redirect' ? undefined : errorType; + return renderViewport(tree, searchParams, interpolatedParams, errorConvention); +} +const getNotFoundViewport = (0, _react.cache)(getNotFoundViewportImpl); +async function getNotFoundViewportImpl(tree, searchParams, interpolatedParams) { + const notFoundErrorConvention = 'not-found'; + return renderViewport(tree, searchParams, interpolatedParams, notFoundErrorConvention); +} +async function renderMetadata(tree, pathname, searchParams, interpolatedParams, metadataContext, errorConvention) { + const resolvedMetadata = await (0, _resolvemetadata.resolveMetadata)(tree, pathname, searchParams, errorConvention, interpolatedParams, metadataContext); + return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, { + children: (0, _metadataelements.createMetadataElements)((0, _resolvemetadata.createSelectedMetadata)(resolvedMetadata)) + }); +} +async function renderViewport(tree, searchParams, interpolatedParams, errorConvention) { + const resolvedViewport = await (0, _resolvemetadata.resolveViewport)(tree, searchParams, errorConvention, interpolatedParams); + return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, { + children: (0, _metadataelements.createViewportElements)(resolvedViewport) + }); +} + +//# sourceMappingURL=metadata.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/metadata.js.map b/e-commerce/node_modules/next/dist/lib/metadata/metadata.js.map new file mode 100644 index 0000000000000000000000000000000000000000..622aada7b87ea309d14e28e1e11a4859cf52fe69 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/metadata.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/metadata/metadata.tsx"],"sourcesContent":["import React, { Suspense, cache } from 'react'\nimport type { ParsedUrlQuery } from 'querystring'\nimport type { Params } from '../../server/request/params'\nimport type { LoaderTree } from '../../server/lib/app-dir-module'\nimport type { SearchParams } from '../../server/request/search-params'\nimport {\n type MetadataErrorType,\n createSelectedMetadata,\n resolveMetadata,\n resolveViewport,\n} from './resolve-metadata'\nimport { isHTTPAccessFallbackError } from '../../client/components/http-access-fallback/http-access-fallback'\nimport type { MetadataContext } from './types/resolvers'\nimport { createServerSearchParamsForMetadata } from '../../server/request/search-params'\nimport { createServerPathnameForMetadata } from '../../server/request/pathname'\n\nimport {\n MetadataBoundary,\n ViewportBoundary,\n OutletBoundary,\n} from '../framework/boundary-components'\nimport {\n createMetadataElements,\n createViewportElements,\n} from './metadata-elements'\n\n// Use a promise to share the status of the metadata resolving,\n// returning two components `MetadataTree` and `MetadataOutlet`\n// `MetadataTree` is the one that will be rendered at first in the content sequence for metadata tags.\n// `MetadataOutlet` is the one that will be rendered under error boundaries for metadata resolving errors.\n// In this way we can let the metadata tags always render successfully,\n// and the error will be caught by the error boundary and trigger fallbacks.\nexport function createMetadataComponents({\n tree,\n pathname,\n parsedQuery,\n metadataContext,\n interpolatedParams,\n errorType,\n serveStreamingMetadata,\n}: {\n tree: LoaderTree\n pathname: string\n parsedQuery: SearchParams\n metadataContext: MetadataContext\n interpolatedParams: Params\n errorType?: MetadataErrorType | 'redirect'\n serveStreamingMetadata: boolean\n}): {\n Viewport: React.ComponentType\n Metadata: React.ComponentType\n MetadataOutlet: React.ComponentType<{ tree: LoaderTree }>\n} {\n const searchParams = createServerSearchParamsForMetadata(parsedQuery)\n const pathnameForMetadata = createServerPathnameForMetadata(pathname)\n\n async function Viewport() {\n const tags = await getResolvedViewport(\n tree,\n searchParams,\n interpolatedParams,\n errorType\n ).catch((viewportErr) => {\n if (!errorType && isHTTPAccessFallbackError(viewportErr)) {\n return getNotFoundViewport(\n tree,\n searchParams,\n interpolatedParams\n ).catch(() => null)\n }\n // We're going to throw the error from the metadata outlet so we just render null here instead\n return null\n })\n\n return tags\n }\n Viewport.displayName = 'Next.Viewport'\n\n function ViewportWrapper() {\n return (\n \n \n \n )\n }\n\n // Metadata resolution must start while rendering so it observes the current\n // work unit store.\n function getSelectedMetadata() {\n return getResolvedMetadata(\n tree,\n pathnameForMetadata,\n searchParams,\n interpolatedParams,\n metadataContext,\n errorType\n ).catch((metadataErr) => {\n if (!errorType && isHTTPAccessFallbackError(metadataErr)) {\n return getNotFoundMetadata(\n tree,\n pathnameForMetadata,\n searchParams,\n interpolatedParams,\n metadataContext\n ).catch(() => null)\n }\n // We're going to throw the error from the metadata outlet so we just render null here instead\n return null\n })\n }\n\n async function Metadata() {\n return await getSelectedMetadata()\n }\n Metadata.displayName = 'Next.Metadata'\n\n function MetadataBlocker() {\n return serveStreamingMetadata\n ? null\n : getSelectedMetadata().then(() => null)\n }\n\n function MetadataWrapper() {\n // Keep the same component structure in streaming and blocking renders.\n // The blocker only holds the shell open when metadata must not stream.\n // React requires top-level suspenseful metadata to be nested under a host\n // element. Otherwise it becomes part of the document preamble and blocks\n // shell flushing instead of streaming. Metadata tags are hoisted out, so\n // this hidden wrapper remains empty.\n return (\n \n \n \n \n )\n }\n\n function MetadataOutlet() {\n const pendingOutlet = Promise.all([\n getResolvedMetadata(\n tree,\n pathnameForMetadata,\n searchParams,\n interpolatedParams,\n metadataContext,\n errorType\n ),\n getResolvedViewport(tree, searchParams, interpolatedParams, errorType),\n ]).then(() => null)\n\n if (!serveStreamingMetadata) {\n return {pendingOutlet}\n }\n\n return (\n \n {pendingOutlet}\n \n )\n }\n MetadataOutlet.displayName = 'Next.MetadataOutlet'\n\n return {\n Viewport: ViewportWrapper,\n Metadata: MetadataWrapper,\n MetadataOutlet,\n }\n}\n\nconst getResolvedMetadata = cache(getResolvedMetadataImpl)\nasync function getResolvedMetadataImpl(\n tree: LoaderTree,\n pathname: Promise,\n searchParams: Promise,\n interpolatedParams: Params,\n metadataContext: MetadataContext,\n errorType?: MetadataErrorType | 'redirect'\n): Promise {\n const errorConvention = errorType === 'redirect' ? undefined : errorType\n return renderMetadata(\n tree,\n pathname,\n searchParams,\n interpolatedParams,\n metadataContext,\n errorConvention\n )\n}\n\nconst getNotFoundMetadata = cache(getNotFoundMetadataImpl)\nasync function getNotFoundMetadataImpl(\n tree: LoaderTree,\n pathname: Promise,\n searchParams: Promise,\n interpolatedParams: Params,\n metadataContext: MetadataContext\n): Promise {\n const notFoundErrorConvention = 'not-found'\n return renderMetadata(\n tree,\n pathname,\n searchParams,\n interpolatedParams,\n metadataContext,\n notFoundErrorConvention\n )\n}\n\nconst getResolvedViewport = cache(getResolvedViewportImpl)\nasync function getResolvedViewportImpl(\n tree: LoaderTree,\n searchParams: Promise,\n interpolatedParams: Params,\n errorType?: MetadataErrorType | 'redirect'\n): Promise {\n const errorConvention = errorType === 'redirect' ? undefined : errorType\n return renderViewport(tree, searchParams, interpolatedParams, errorConvention)\n}\n\nconst getNotFoundViewport = cache(getNotFoundViewportImpl)\nasync function getNotFoundViewportImpl(\n tree: LoaderTree,\n searchParams: Promise,\n interpolatedParams: Params\n): Promise {\n const notFoundErrorConvention = 'not-found'\n return renderViewport(\n tree,\n searchParams,\n interpolatedParams,\n notFoundErrorConvention\n )\n}\n\nasync function renderMetadata(\n tree: LoaderTree,\n pathname: Promise,\n searchParams: Promise,\n interpolatedParams: Params,\n metadataContext: MetadataContext,\n errorConvention?: MetadataErrorType\n) {\n const resolvedMetadata = await resolveMetadata(\n tree,\n pathname,\n searchParams,\n errorConvention,\n interpolatedParams,\n metadataContext\n )\n return <>{createMetadataElements(createSelectedMetadata(resolvedMetadata))}\n}\n\nasync function renderViewport(\n tree: LoaderTree,\n searchParams: Promise,\n interpolatedParams: Params,\n errorConvention?: MetadataErrorType\n) {\n const resolvedViewport = await resolveViewport(\n tree,\n searchParams,\n errorConvention,\n interpolatedParams\n )\n return <>{createViewportElements(resolvedViewport)}\n}\n"],"names":["createMetadataComponents","tree","pathname","parsedQuery","metadataContext","interpolatedParams","errorType","serveStreamingMetadata","searchParams","createServerSearchParamsForMetadata","pathnameForMetadata","createServerPathnameForMetadata","Viewport","tags","getResolvedViewport","catch","viewportErr","isHTTPAccessFallbackError","getNotFoundViewport","displayName","ViewportWrapper","ViewportBoundary","getSelectedMetadata","getResolvedMetadata","metadataErr","getNotFoundMetadata","Metadata","MetadataBlocker","then","MetadataWrapper","MetadataBoundary","div","hidden","Suspense","name","MetadataOutlet","pendingOutlet","Promise","all","OutletBoundary","cache","getResolvedMetadataImpl","errorConvention","undefined","renderMetadata","getNotFoundMetadataImpl","notFoundErrorConvention","getResolvedViewportImpl","renderViewport","getNotFoundViewportImpl","resolvedMetadata","resolveMetadata","createMetadataElements","createSelectedMetadata","resolvedViewport","resolveViewport","createViewportElements"],"mappings":";;;;+BAgCgBA;;;eAAAA;;;;+DAhCuB;iCAUhC;oCACmC;8BAEU;0BACJ;oCAMzC;kCAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,SAASA,yBAAyB,EACvCC,IAAI,EACJC,QAAQ,EACRC,WAAW,EACXC,eAAe,EACfC,kBAAkB,EAClBC,SAAS,EACTC,sBAAsB,EASvB;IAKC,MAAMC,eAAeC,IAAAA,iDAAm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AmC;IAEnC,MAAMQ,mBAAmB,MAAMC,IAAAA,gCAAe,EAC5ClD,MACAC,UACAM,cACAkC,iBACArC,oBACAD;IAEF,qBAAO;kBAAGgD,IAAAA,wCAAsB,EAACC,IAAAA,uCAAsB,EAACH;;AAC1D;AAEA,eAAeF,eACb/C,IAAgB,EAChBO,YAAqC,EACrCH,kBAA0B,EAC1BqC,eAAmC;IAEnC,MAAMY,mBAAmB,MAAMC,IAAAA,gCAAe,EAC5CtD,MACAO,cACAkC,iBACArC;IAEF,qBAAO;kBAAGmD,IAAAA,wCAAsB,EAACF;;AACnC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolve-metadata-parallel.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/resolve-metadata-parallel.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d5f30307e0d608c8390f2b4c0ae2f52c9fbe7b72 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolve-metadata-parallel.d.ts @@ -0,0 +1,31 @@ +import type { ResolvedViewport } from './types/metadata-interface'; +import type { MetadataContext } from './types/resolvers'; +import type { LoaderTree } from '../../server/lib/app-dir-module'; +import type { ParsedUrlQuery } from 'querystring'; +import type { Params } from '../../server/request/params'; +import 'server-only'; +import { type MetadataErrorType, type SelectedMetadata } from './metadata-resolution-primitives'; +type RejectedMetadataResolutionStatus = MetadataErrorType | 'redirect' | 'error'; +type ResolvedOutcome = { + status: 'resolved'; + value: T; +}; +type RejectedOutcome = { + status: RejectedMetadataResolutionStatus; + reason: unknown; +}; +type ResolutionOutcome = ResolvedOutcome | RejectedOutcome; +type MetadataBranchOutcome = (ResolvedOutcome & { + warnings: Set; +}) | RejectedOutcome; +type ViewportBranchOutcome = ResolutionOutcome; +type MetadataResolution = { + selectedKeyPath: string[]; + selectedMetadata: Promise; + selectedViewport: Promise; + outlets: Map>; +}; +export declare function resolveMetadataResolution(tree: LoaderTree, pathname: Promise, searchParams: Promise, errorConvention: MetadataErrorType | undefined, interpolatedParams: Params, metadataContext: MetadataContext): Promise; +export declare function resolveMetadataForBranch(tree: LoaderTree, pathname: Promise, searchParams: Promise, errorConvention: MetadataErrorType, interpolatedParams: Params, metadataContext: MetadataContext, selectedKeyPath: string[]): Promise; +export declare function resolveViewportForBranch(tree: LoaderTree, pathname: Promise, searchParams: Promise, errorConvention: MetadataErrorType, interpolatedParams: Params, metadataContext: MetadataContext, selectedKeyPath: string[]): Promise; +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolve-metadata-parallel.js b/e-commerce/node_modules/next/dist/lib/metadata/resolve-metadata-parallel.js new file mode 100644 index 0000000000000000000000000000000000000000..b9d53e34c591d9712f67138dd275f86658675951 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolve-metadata-parallel.js @@ -0,0 +1,632 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + resolveMetadataForBranch: null, + resolveMetadataResolution: null, + resolveViewportForBranch: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + resolveMetadataForBranch: function() { + return resolveMetadataForBranch; + }, + resolveMetadataResolution: function() { + return resolveMetadataResolution; + }, + resolveViewportForBranch: function() { + return resolveViewportForBranch; + } +}); +require("server-only"); +const _defaultmetadata = require("./default-metadata"); +const _getsegmentparam = require("../../shared/lib/router/utils/get-segment-param"); +const _appdirmodule = require("../../server/lib/app-dir-module"); +const _params = require("../../server/request/params"); +const _segment = require("../../shared/lib/segment"); +const _default = require("../../client/components/builtin/default"); +const _defaultnull = require("../../client/components/builtin/default-null"); +const _workasyncstorageexternal = require("../../server/app-render/work-async-storage.external"); +const _invarianterror = require("../../shared/lib/invariant-error"); +const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../build/output/log")); +const _clientandserverreferences = require("../client-and-server-references"); +const _lazyresult = require("../../server/lib/lazy-result"); +const _httpaccessfallback = require("../../client/components/http-access-fallback/http-access-fallback"); +const _redirecterror = require("../../client/components/redirect-error"); +const _metadataresolutionprimitives = require("./metadata-resolution-primitives"); +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +const METADATA = 1; +const VIEWPORT = 2; +const METADATA_AND_VIEWPORT = 3; +async function collectMetadataAndViewport({ tree, props, route, errorConvention, resolutionTarget }) { + const shouldResolveMetadata = Boolean(resolutionTarget & METADATA); + const shouldResolveViewport = Boolean(resolutionTarget & VIEWPORT); + const moduleResultPromise = errorConvention ? (0, _appdirmodule.getComponentTypeModule)(tree, 'layout').then((mod)=>({ + mod, + modType: errorConvention + })) : (0, _appdirmodule.getLayoutOrPageModule)(tree); + const staticFilesMetadata = shouldResolveMetadata ? (0, _metadataresolutionprimitives.resolveStaticMetadata)(tree[2], props) : Promise.resolve(null); + // Static metadata is resolved eagerly, but its rejection belongs to this + // branch and will be replayed through the branch's metadata outlet. + staticFilesMetadata.catch(()=>null); + const moduleResult = await moduleResultPromise; + const hasStaticFilesMetadata = shouldResolveMetadata && hasStaticMetadataFiles(tree); + if (moduleResult.modType) { + route += `/${moduleResult.modType}`; + } + const metadata = shouldResolveMetadata && moduleResult.mod ? (0, _metadataresolutionprimitives.getDefinedMetadata)(moduleResult.mod, props, { + route + }) : null; + const viewport = shouldResolveViewport && moduleResult.mod ? (0, _metadataresolutionprimitives.getDefinedViewport)(moduleResult.mod, props, { + route + }) : null; + let errorLayer = null; + if (errorConvention && tree[2][errorConvention]) { + const errorMod = await (0, _appdirmodule.getComponentTypeModule)(tree, errorConvention); + errorLayer = { + metadata: shouldResolveMetadata && errorMod ? (0, _metadataresolutionprimitives.getDefinedMetadata)(errorMod, props, { + route + }) : null, + viewport: shouldResolveViewport && errorMod ? (0, _metadataresolutionprimitives.getDefinedViewport)(errorMod, props, { + route + }) : null, + staticFilesMetadata, + hasStaticFilesMetadata + }; + } + return { + metadata, + viewport, + staticFilesMetadata, + hasStaticFilesMetadata, + errorLayer + }; +} +function callResolver(resolver) { + let result; + try { + result = resolver(); + } catch (error) { + result = Promise.reject(error); + } + if (result instanceof Promise) { + // Generators are eagerly executed, so attach a rejection handler before + // an earlier layer can suspend or fail. + result.catch(()=>null); + } + return result; +} +function getResult(exportForResult) { + if (typeof exportForResult === 'function') { + // If the function is a 'use cache' function that uses the parent data as + // the second argument, we don't want to eagerly execute it during + // metadata/viewport pre-rendering, as the parent data might also be + // computed from another 'use cache' function. To ensure that the hanging + // input abort signal handling works in this case (i.e. the depending + // function waits for the cached input to resolve while encoding its args), + // they must be called sequentially. This can be accomplished by wrapping + // the call in a lazy promise, so that the original function is only called + // when the result is actually awaited. + const useCacheFunctionInfo = (0, _clientandserverreferences.getUseCacheFunctionInfo)(exportForResult.$$original); + if (useCacheFunctionInfo && !useCacheFunctionInfo.usedArgs[1]) { + return { + resolveParent: null, + result: callResolver(()=>{ + // @ts-expect-error We intentionally omit the parent argument, because + // we know this 'use cache' function does not use it. + return exportForResult(); + }) + }; + } + let resolveParent; + const parent = new Promise((resolve)=>{ + resolveParent = resolve; + }); + return { + resolveParent: resolveParent, + result: useCacheFunctionInfo ? (0, _lazyresult.createLazyResult)(()=>exportForResult(parent)) : callResolver(()=>exportForResult(parent)) + }; + } + return { + resolveParent: null, + result: typeof exportForResult === 'object' ? exportForResult : null + }; +} +function resolveParentResult(parentResult, resolveParent) { + if (process.env.NODE_ENV === 'development') { + parentResult = require('../../shared/lib/deep-freeze').deepFreeze(structuredClone(parentResult)); + } + resolveParent(parentResult); +} +function cloneStaticMetadata(metadata) { + if (!metadata) return null; + return { + ...metadata, + icon: metadata.icon ? [ + ...metadata.icon + ] : undefined, + apple: metadata.apple ? [ + ...metadata.apple + ] : undefined, + openGraph: metadata.openGraph ? [ + ...metadata.openGraph + ] : undefined, + twitter: metadata.twitter ? [ + ...metadata.twitter + ] : undefined + }; +} +function createMetadataAccumulator() { + return { + metadata: (0, _defaultmetadata.createDefaultMetadata)(), + titleTemplates: { + title: null, + twitter: null, + openGraph: null + }, + favicon: null, + leafSegmentStaticIcons: { + icon: [], + apple: [] + }, + buildState: { + warnings: new Set() + } + }; +} +function cloneMetadataAccumulator(accumulator) { + return { + metadata: structuredClone(accumulator.metadata), + titleTemplates: { + ...accumulator.titleTemplates + }, + favicon: accumulator.favicon ? structuredClone(accumulator.favicon) : null, + leafSegmentStaticIcons: { + icon: structuredClone(accumulator.leafSegmentStaticIcons.icon), + apple: structuredClone(accumulator.leafSegmentStaticIcons.apple) + }, + buildState: { + warnings: new Set(accumulator.buildState.warnings) + } + }; +} +function cloneViewportAccumulator(accumulator) { + return { + viewport: structuredClone(accumulator.viewport) + }; +} +async function accumulateMetadataLayer(parent, prerendered, staticMetadata, route, layerIndex, pathname, metadataContext) { + var _staticFilesMetadata_icon; + const accumulator = await parent; + const staticFilesMetadata = cloneStaticMetadata(await staticMetadata); + // Treat favicon as a special case. It should be the first icon in the list. + // layerIndex <= 1 represents the root layout and a page at the root. + if (layerIndex <= 1 && (0, _metadataresolutionprimitives.isFavicon)(staticFilesMetadata == null ? void 0 : (_staticFilesMetadata_icon = staticFilesMetadata.icon) == null ? void 0 : _staticFilesMetadata_icon[0])) { + var _staticFilesMetadata_icon1; + const icon = staticFilesMetadata == null ? void 0 : (_staticFilesMetadata_icon1 = staticFilesMetadata.icon) == null ? void 0 : _staticFilesMetadata_icon1.shift(); + if (layerIndex === 0 && icon) { + accumulator.favicon = (0, _metadataresolutionprimitives.convertUrlsToStrings)(icon); + } + } + if (prerendered.resolveParent) { + resolveParentResult(accumulator.metadata, prerendered.resolveParent); + } + let metadata; + if (isPromiseLike(prerendered.result)) { + metadata = await prerendered.result; + } else { + metadata = prerendered.result; + } + await (0, _metadataresolutionprimitives.mergeMetadata)(route, pathname, { + metadata, + resolvedMetadata: accumulator.metadata, + staticFilesMetadata, + titleTemplates: accumulator.titleTemplates, + metadataContext, + buildState: accumulator.buildState, + leafSegmentStaticIcons: accumulator.leafSegmentStaticIcons, + cloneResolvedMetadata: false + }); + return accumulator; +} +async function accumulateViewportLayer(parent, prerendered) { + const accumulator = await parent; + if (prerendered.resolveParent) { + resolveParentResult(accumulator.viewport, prerendered.resolveParent); + } + let viewport; + if (isPromiseLike(prerendered.result)) { + viewport = await prerendered.result; + } else { + viewport = prerendered.result; + } + (0, _metadataresolutionprimitives.mergeViewport)({ + resolvedViewport: accumulator.viewport, + viewport, + cloneResolvedViewport: false + }); + return accumulator; +} +function prepareMetadataAccumulatorForChild(parent, clone, childIsPage, errorConvention) { + return parent.then((parentAccumulator)=>{ + const accumulator = clone ? cloneMetadataAccumulator(parentAccumulator) : parentAccumulator; + // A title template applies to a descendant segment, but not to a page in + // the same segment. Error convention metadata is an additional terminal + // layer, so the leaf layout's template does apply to it. + if (!childIsPage || errorConvention) { + var _accumulator_metadata_title, _accumulator_metadata_openGraph, _accumulator_metadata_twitter; + accumulator.titleTemplates = { + title: ((_accumulator_metadata_title = accumulator.metadata.title) == null ? void 0 : _accumulator_metadata_title.template) || null, + openGraph: ((_accumulator_metadata_openGraph = accumulator.metadata.openGraph) == null ? void 0 : _accumulator_metadata_openGraph.title.template) || null, + twitter: ((_accumulator_metadata_twitter = accumulator.metadata.twitter) == null ? void 0 : _accumulator_metadata_twitter.title.template) || null + }; + } + return accumulator; + }); +} +function prepareViewportAccumulatorForChild(parent, clone) { + return clone ? parent.then(cloneViewportAccumulator) : parent; +} +function completeMetadataAccumulator(accumulator, metadataContext) { + const { leafSegmentStaticIcons, metadata } = accumulator; + if ((leafSegmentStaticIcons.icon.length > 0 || leafSegmentStaticIcons.apple.length > 0) && !metadata.icons) { + metadata.icons = { + icon: [], + apple: [] + }; + if (leafSegmentStaticIcons.icon.length > 0) { + metadata.icons.icon.unshift(...(0, _metadataresolutionprimitives.convertUrlsToStrings)(leafSegmentStaticIcons.icon)); + } + if (leafSegmentStaticIcons.apple.length > 0) { + metadata.icons.apple.unshift(...(0, _metadataresolutionprimitives.convertUrlsToStrings)(leafSegmentStaticIcons.apple)); + } + } + return (0, _metadataresolutionprimitives.postProcessMetadata)(metadata, accumulator.favicon, accumulator.titleTemplates, metadataContext); +} +function getResolutionStatus(reason) { + if ((0, _httpaccessfallback.isHTTPAccessFallbackError)(reason)) { + return (0, _httpaccessfallback.getAccessFallbackErrorTypeByStatus)((0, _httpaccessfallback.getAccessFallbackHTTPStatus)(reason)) || 'error'; + } + if ((0, _redirecterror.isRedirectError)(reason)) { + return 'redirect'; + } + return 'error'; +} +function createRejectedOutcome(reason) { + return { + status: getResolutionStatus(reason), + reason + }; +} +function createMetadataBranchOutcome(pendingAccumulator, metadataContext) { + const completed = pendingAccumulator.then((accumulator)=>({ + value: (0, _metadataresolutionprimitives.createSelectedMetadata)(completeMetadataAccumulator(accumulator, metadataContext)), + warnings: accumulator.buildState.warnings + })); + return completed.then(({ value, warnings })=>({ + status: 'resolved', + value, + warnings + }), createRejectedOutcome); +} +function createViewportBranchOutcome(pendingAccumulator) { + return pendingAccumulator.then((accumulator)=>({ + status: 'resolved', + value: accumulator.viewport + }), createRejectedOutcome); +} +function createOutletPromise(metadataOutcome, viewportOutcome) { + let pendingOutcomes = 2; + const outlet = new Promise((resolve, reject)=>{ + function settle(outcome) { + if (outcome.status !== 'resolved') { + reject(outcome.reason); + } else if (--pendingOutcomes === 0) { + resolve(null); + } + } + metadataOutcome.then(settle, reject); + viewportOutcome.then(settle, reject); + }); + // Outlet promises can reject before React renders the corresponding slot. + // Observe the rejection immediately while preserving it for React to replay. + outlet.catch(()=>null); + return outlet; +} +function appendTreeRoute(parentRoute, segment) { + if (segment === _segment.PAGE_SEGMENT_KEY) return parentRoute; + if (parentRoute === null) return segment; + return `${parentRoute}/${segment}`; +} +function isPageTree(tree) { + const { layout, page, defaultPage } = tree[2]; + return layout === undefined && (page !== undefined || defaultPage !== undefined && tree[0] === _segment.DEFAULT_SEGMENT_KEY); +} +function isBuiltinFallback(tree) { + const { defaultPage } = tree[2]; + return (defaultPage == null ? void 0 : defaultPage[1].endsWith(_default.PARALLEL_ROUTE_DEFAULT_PATH)) === true || (defaultPage == null ? void 0 : defaultPage[1].endsWith(_defaultnull.PARALLEL_ROUTE_DEFAULT_NULL_PATH)) === true; +} +function hasHeadDefinition(layer) { + if (layer === null) return false; + return layer.metadata !== null || layer.viewport !== null || layer.hasStaticFilesMetadata; +} +function hasStaticMetadataFiles(tree) { + var _metadata_icon, _metadata_apple, _metadata_openGraph, _metadata_twitter; + const metadata = tree[2].metadata; + return Boolean(metadata && ((((_metadata_icon = metadata.icon) == null ? void 0 : _metadata_icon.length) ?? 0) > 0 || (((_metadata_apple = metadata.apple) == null ? void 0 : _metadata_apple.length) ?? 0) > 0 || (((_metadata_openGraph = metadata.openGraph) == null ? void 0 : _metadata_openGraph.length) ?? 0) > 0 || (((_metadata_twitter = metadata.twitter) == null ? void 0 : _metadata_twitter.length) ?? 0) > 0 || metadata.manifest !== undefined)); +} +function selectDefaultMetadataBranch(branches, forkDepth) { + if (branches.length === 0) { + throw new _invarianterror.InvariantError('Expected at least one metadata branch'); + } + let selected = branches[0]; + for(let i = 1; i < branches.length; i++){ + const candidate = branches[i]; + if (selected.branch.isBuiltinFallback !== candidate.branch.isBuiltinFallback) { + if (!candidate.branch.isBuiltinFallback) { + selected = candidate; + } + continue; + } + const selectedIsChildren = selected.key === 'children'; + const candidateIsChildren = candidate.key === 'children'; + if (selectedIsChildren !== candidateIsChildren) { + const childrenBranch = selectedIsChildren ? selected : candidate; + const namedBranch = selectedIsChildren ? candidate : selected; + const childrenDefinesHead = childrenBranch.branch.definitionDepth > forkDepth; + const namedDefinesHead = namedBranch.branch.definitionDepth > forkDepth; + // Prefer children when it contributes to the head. Otherwise, allow a + // named slot with its own definition to provide the selected metadata. + selected = childrenDefinesHead || !namedDefinesHead ? childrenBranch : namedBranch; + continue; + } + if (candidate.branch.definitionDepth > selected.branch.definitionDepth) { + selected = candidate; + continue; + } + if (candidate.branch.definitionDepth < selected.branch.definitionDepth) { + continue; + } + const selectedDepth = selected.branch.keyPath.length; + const candidateDepth = candidate.branch.keyPath.length; + if (candidateDepth > selectedDepth) { + selected = candidate; + continue; + } + if (candidateDepth === selectedDepth && candidate.key < selected.key) { + selected = candidate; + } + } + return selected.branch; +} +async function walkMetadataTree(context, state) { + const [segment, parallelRoutes, { page }] = state.tree; + const treeRoute = appendTreeRoute(state.treeRoute, segment); + const isPage = page !== undefined; + const depth = state.keyPath.length; + const shouldResolveMetadata = Boolean(context.resolutionTarget & METADATA); + const shouldResolveViewport = Boolean(context.resolutionTarget & VIEWPORT); + let currentParams = state.parentParams; + const segmentParam = (0, _getsegmentparam.getSegmentParam)(segment); + if (segmentParam) { + const value = context.interpolatedParams[segmentParam.paramName]; + if (value !== null && value !== undefined) { + currentParams = { + ...state.parentParams, + [segmentParam.paramName]: value + }; + } + } + const optionalCatchAllParamName = (segmentParam == null ? void 0 : segmentParam.paramType) === 'optional-catchall' && (context.interpolatedParams[segmentParam.paramName] === null || context.interpolatedParams[segmentParam.paramName] === undefined) ? segmentParam.paramName : state.parentOptionalCatchAllParamName; + const params = (0, _params.createServerParamsForMetadata)(currentParams, optionalCatchAllParamName); + const props = isPage ? { + params, + searchParams: context.searchParams + } : { + params + }; + const layer = await collectMetadataAndViewport({ + tree: state.tree, + props, + route: treeRoute ?? '', + errorConvention: context.errorConvention, + resolutionTarget: context.resolutionTarget + }); + let definitionDepth = hasHeadDefinition(layer) ? depth : state.definitionDepth; + // Invoke each active generator as soon as this layer is discovered. Its + // parent promise is resolved later when the preceding accumulator is ready. + let metadata = state.metadataParent; + if (shouldResolveMetadata) { + const prerenderedMetadata = getResult(layer.metadata); + metadata = accumulateMetadataLayer(metadata, prerenderedMetadata, layer.staticFilesMetadata, context.route, depth, context.pathname, context.metadataContext); + } + let viewport = state.viewportParent; + if (shouldResolveViewport) { + const prerenderedViewport = getResult(layer.viewport); + viewport = accumulateViewportLayer(viewport, prerenderedViewport); + } + const errorLayer = layer.errorLayer || state.errorLayer; + let parallelRouteKeys = Object.keys(parallelRoutes); + if (context.selectedKeyPath !== null) { + const selectedKey = context.selectedKeyPath[depth]; + if (parallelRouteKeys.length === 0) { + if (selectedKey !== undefined) { + throw new _invarianterror.InvariantError('Expected selected metadata branch to end at a leaf'); + } + } else { + if (selectedKey === undefined || !parallelRoutes[selectedKey]) { + throw new _invarianterror.InvariantError('Expected selected metadata branch to match loader tree'); + } + parallelRouteKeys = [ + selectedKey + ]; + } + } + if (parallelRouteKeys.length === 0) { + if (context.errorConvention) { + if (hasHeadDefinition(errorLayer)) { + definitionDepth = depth + 1; + } + if (shouldResolveMetadata) { + const errorMetadata = getResult((errorLayer == null ? void 0 : errorLayer.metadata) || null); + metadata = accumulateMetadataLayer(metadata, errorMetadata, (errorLayer == null ? void 0 : errorLayer.staticFilesMetadata) || Promise.resolve(null), context.route, depth + 1, context.pathname, context.metadataContext); + } + if (shouldResolveViewport) { + const errorViewport = getResult((errorLayer == null ? void 0 : errorLayer.viewport) || null); + viewport = accumulateViewportLayer(viewport, errorViewport); + } + } + const metadataOutcome = createMetadataBranchOutcome(metadata, context.metadataContext); + const viewportOutcome = createViewportBranchOutcome(viewport); + context.outlets.set(state.tree, createOutletPromise(metadataOutcome, viewportOutcome)); + return { + metadata: metadataOutcome, + viewport: viewportOutcome, + keyPath: state.keyPath, + definitionDepth, + isBuiltinFallback: isBuiltinFallback(state.tree) + }; + } + const cloneAtFork = parallelRouteKeys.length > 1; + const pendingChildBranches = []; + for (const parallelRouteKey of parallelRouteKeys){ + const childTree = parallelRoutes[parallelRouteKey]; + const childKeyPath = [ + ...state.keyPath, + parallelRouteKey + ]; + const branch = walkMetadataTree(context, { + tree: childTree, + treeRoute, + parentParams: currentParams, + parentOptionalCatchAllParamName: optionalCatchAllParamName, + metadataParent: prepareMetadataAccumulatorForChild(metadata, cloneAtFork && shouldResolveMetadata, isPageTree(childTree), context.errorConvention), + viewportParent: prepareViewportAccumulatorForChild(viewport, cloneAtFork && shouldResolveViewport), + errorLayer, + definitionDepth, + keyPath: childKeyPath + }); + // Child walks start eagerly, but are awaited in order below. Observe each + // rejection now so a failure in one branch cannot leave a later sibling's + // rejection unhandled. + branch.catch(()=>null); + pendingChildBranches.push({ + key: parallelRouteKey, + branch + }); + } + const childBranches = []; + for (const pendingChildBranch of pendingChildBranches){ + childBranches.push({ + key: pendingChildBranch.key, + branch: await pendingChildBranch.branch + }); + } + return selectDefaultMetadataBranch(childBranches, depth); +} +async function resolveMetadataTree(tree, pathname, searchParams, errorConvention, interpolatedParams, metadataContext, selectedKeyPath, resolutionTarget) { + const workStore = _workasyncstorageexternal.workAsyncStorage.getStore(); + if (!workStore) { + throw new _invarianterror.InvariantError('Expected workStore to be initialized'); + } + const outlets = new Map(); + const selectedBranch = await walkMetadataTree({ + pathname, + searchParams, + errorConvention, + interpolatedParams, + metadataContext, + route: workStore.route, + selectedKeyPath, + resolutionTarget, + outlets + }, { + tree, + treeRoute: null, + parentParams: {}, + parentOptionalCatchAllParamName: null, + metadataParent: Promise.resolve(createMetadataAccumulator()), + viewportParent: Promise.resolve({ + viewport: (0, _defaultmetadata.createDefaultViewport)() + }), + errorLayer: null, + definitionDepth: -1, + keyPath: [] + }); + const selected = selectedBranch.metadata.then((outcome)=>{ + if (outcome.status === 'resolved') { + for (const warning of outcome.warnings){ + _log.warn(warning); + } + } + return outcome; + }); + return { + selectedKeyPath: selectedBranch.keyPath, + selectedMetadata: selected, + selectedViewport: selectedBranch.viewport, + outlets + }; +} +function resolveMetadataResolution(tree, pathname, searchParams, errorConvention, interpolatedParams, metadataContext) { + return resolveMetadataTree(tree, pathname, searchParams, errorConvention, interpolatedParams, metadataContext, null, METADATA_AND_VIEWPORT); +} +async function resolveMetadataForBranch(tree, pathname, searchParams, errorConvention, interpolatedParams, metadataContext, selectedKeyPath) { + const resolution = await resolveMetadataTree(tree, pathname, searchParams, errorConvention, interpolatedParams, metadataContext, selectedKeyPath, METADATA); + return resolution.selectedMetadata; +} +async function resolveViewportForBranch(tree, pathname, searchParams, errorConvention, interpolatedParams, metadataContext, selectedKeyPath) { + const resolution = await resolveMetadataTree(tree, pathname, searchParams, errorConvention, interpolatedParams, metadataContext, selectedKeyPath, VIEWPORT); + return resolution.selectedViewport; +} +function isPromiseLike(value) { + return typeof value === 'object' && value !== null && typeof value.then === 'function'; +} + +//# sourceMappingURL=resolve-metadata-parallel.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolve-metadata-parallel.js.map b/e-commerce/node_modules/next/dist/lib/metadata/resolve-metadata-parallel.js.map new file mode 100644 index 0000000000000000000000000000000000000000..547646f65bec1249330bb7c690a1e1a82bdde6a3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolve-metadata-parallel.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/metadata/resolve-metadata-parallel.ts"],"sourcesContent":["import type {\n Metadata,\n ResolvedMetadata,\n ResolvedViewport,\n Viewport,\n} from './types/metadata-interface'\nimport type { MetadataContext } from './types/resolvers'\nimport type { LoaderTree } from '../../server/lib/app-dir-module'\nimport type { ParsedUrlQuery } from 'querystring'\nimport type { StaticMetadata } from './types/icons'\nimport type { Params } from '../../server/request/params'\nimport type { IconDescriptor } from './types/metadata-types'\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport 'server-only'\n\nimport {\n createDefaultMetadata,\n createDefaultViewport,\n} from './default-metadata'\nimport { getSegmentParam } from '../../shared/lib/router/utils/get-segment-param'\nimport {\n getComponentTypeModule,\n getLayoutOrPageModule,\n} from '../../server/lib/app-dir-module'\nimport { createServerParamsForMetadata } from '../../server/request/params'\nimport { DEFAULT_SEGMENT_KEY, PAGE_SEGMENT_KEY } from '../../shared/lib/segment'\nimport { PARALLEL_ROUTE_DEFAULT_PATH } from '../../client/components/builtin/default'\nimport { PARALLEL_ROUTE_DEFAULT_NULL_PATH } from '../../client/components/builtin/default-null'\nimport { workAsyncStorage } from '../../server/app-render/work-async-storage.external'\nimport { InvariantError } from '../../shared/lib/invariant-error'\nimport * as Log from '../../build/output/log'\nimport { getUseCacheFunctionInfo } from '../client-and-server-references'\nimport { createLazyResult } from '../../server/lib/lazy-result'\nimport {\n getAccessFallbackErrorTypeByStatus,\n getAccessFallbackHTTPStatus,\n isHTTPAccessFallbackError,\n} from '../../client/components/http-access-fallback/http-access-fallback'\nimport { isRedirectError } from '../../client/components/redirect-error'\nimport {\n type BuildState,\n type InstrumentedResolver,\n type MetadataErrorType,\n type MetadataResolver,\n type SegmentProps,\n type SelectedMetadata,\n type StaticIcons,\n type TitleTemplates,\n type ViewportResolver,\n convertUrlsToStrings,\n createSelectedMetadata,\n getDefinedMetadata,\n getDefinedViewport,\n isFavicon,\n mergeMetadata,\n mergeViewport,\n postProcessMetadata,\n resolveStaticMetadata,\n} from './metadata-resolution-primitives'\n\nconst METADATA = 0b01 as const\nconst VIEWPORT = 0b10 as const\nconst METADATA_AND_VIEWPORT = 0b11 as const\n\ntype ResolutionTarget =\n | typeof METADATA\n | typeof VIEWPORT\n | typeof METADATA_AND_VIEWPORT\n\ntype RejectedMetadataResolutionStatus = MetadataErrorType | 'redirect' | 'error'\n\ntype ResolvedOutcome = {\n status: 'resolved'\n value: T\n}\n\ntype RejectedOutcome = {\n status: RejectedMetadataResolutionStatus\n reason: unknown\n}\n\ntype ResolutionOutcome = ResolvedOutcome | RejectedOutcome\n\ntype MetadataBranchOutcome =\n | (ResolvedOutcome & { warnings: Set })\n | RejectedOutcome\ntype ViewportBranchOutcome = ResolutionOutcome\n\ntype MetadataResolution = {\n selectedKeyPath: string[]\n selectedMetadata: Promise\n selectedViewport: Promise\n outlets: Map>\n}\n\ntype MetadataAccumulator = {\n metadata: ResolvedMetadata\n titleTemplates: TitleTemplates\n favicon: IconDescriptor | null\n leafSegmentStaticIcons: StaticIcons\n buildState: BuildState\n}\n\n// Keep viewport state in an accumulator so its layer and fork handling stays\n// structurally parallel to metadata, even though it currently has one field.\ntype ViewportAccumulator = {\n viewport: ResolvedViewport\n}\n\ntype MetadataLayer = {\n metadata: Metadata | MetadataResolver | null\n viewport: Viewport | ViewportResolver | null\n staticFilesMetadata: Promise\n hasStaticFilesMetadata: boolean\n}\n\ntype MetadataBranch = {\n metadata: Promise\n viewport: Promise\n keyPath: string[]\n definitionDepth: number\n isBuiltinFallback: boolean\n}\n\ntype CollectedMetadata = MetadataLayer & {\n errorLayer: MetadataLayer | null\n}\n\nasync function collectMetadataAndViewport({\n tree,\n props,\n route,\n errorConvention,\n resolutionTarget,\n}: {\n tree: LoaderTree\n props: SegmentProps\n route: string\n errorConvention: MetadataErrorType | undefined\n resolutionTarget: ResolutionTarget\n}): Promise {\n const shouldResolveMetadata = Boolean(resolutionTarget & METADATA)\n const shouldResolveViewport = Boolean(resolutionTarget & VIEWPORT)\n const moduleResultPromise = errorConvention\n ? getComponentTypeModule(tree, 'layout').then((mod) => ({\n mod,\n modType: errorConvention,\n }))\n : getLayoutOrPageModule(tree)\n const staticFilesMetadata = shouldResolveMetadata\n ? resolveStaticMetadata(tree[2], props)\n : Promise.resolve(null)\n\n // Static metadata is resolved eagerly, but its rejection belongs to this\n // branch and will be replayed through the branch's metadata outlet.\n staticFilesMetadata.catch(() => null)\n\n const moduleResult = await moduleResultPromise\n const hasStaticFilesMetadata =\n shouldResolveMetadata && hasStaticMetadataFiles(tree)\n\n if (moduleResult.modType) {\n route += `/${moduleResult.modType}`\n }\n\n const metadata =\n shouldResolveMetadata && moduleResult.mod\n ? getDefinedMetadata(moduleResult.mod, props, { route })\n : null\n const viewport =\n shouldResolveViewport && moduleResult.mod\n ? getDefinedViewport(moduleResult.mod, props, { route })\n : null\n\n let errorLayer: MetadataLayer | null = null\n if (errorConvention && tree[2][errorConvention]) {\n const errorMod = await getComponentTypeModule(tree, errorConvention)\n errorLayer = {\n metadata:\n shouldResolveMetadata && errorMod\n ? getDefinedMetadata(errorMod, props, { route })\n : null,\n viewport:\n shouldResolveViewport && errorMod\n ? getDefinedViewport(errorMod, props, { route })\n : null,\n staticFilesMetadata,\n hasStaticFilesMetadata,\n }\n }\n\n return {\n metadata,\n viewport,\n staticFilesMetadata,\n hasStaticFilesMetadata,\n errorLayer,\n }\n}\n\ntype Result = null | T | Promise | PromiseLike\ntype PrerenderedResult = {\n resolveParent: ((value: TResolved) => void) | null\n result: Result\n}\n\nfunction callResolver(resolver: () => T | Promise): T | Promise {\n let result: T | Promise\n try {\n result = resolver()\n } catch (error) {\n result = Promise.reject(error)\n }\n\n if (result instanceof Promise) {\n // Generators are eagerly executed, so attach a rejection handler before\n // an earlier layer can suspend or fail.\n result.catch(() => null)\n }\n return result\n}\n\nfunction getResult(\n exportForResult: null | TData | InstrumentedResolver\n): PrerenderedResult {\n if (typeof exportForResult === 'function') {\n // If the function is a 'use cache' function that uses the parent data as\n // the second argument, we don't want to eagerly execute it during\n // metadata/viewport pre-rendering, as the parent data might also be\n // computed from another 'use cache' function. To ensure that the hanging\n // input abort signal handling works in this case (i.e. the depending\n // function waits for the cached input to resolve while encoding its args),\n // they must be called sequentially. This can be accomplished by wrapping\n // the call in a lazy promise, so that the original function is only called\n // when the result is actually awaited.\n const useCacheFunctionInfo = getUseCacheFunctionInfo(\n exportForResult.$$original\n )\n if (useCacheFunctionInfo && !useCacheFunctionInfo.usedArgs[1]) {\n return {\n resolveParent: null,\n result: callResolver(() => {\n // @ts-expect-error We intentionally omit the parent argument, because\n // we know this 'use cache' function does not use it.\n return exportForResult()\n }),\n }\n }\n\n let resolveParent: (value: TResolved) => void\n const parent = new Promise((resolve) => {\n resolveParent = resolve\n })\n return {\n resolveParent: resolveParent!,\n result: useCacheFunctionInfo\n ? createLazyResult(() => exportForResult(parent))\n : callResolver(() => exportForResult(parent)),\n }\n }\n\n return {\n resolveParent: null,\n result: typeof exportForResult === 'object' ? exportForResult : null,\n }\n}\n\nfunction resolveParentResult(\n parentResult: T,\n resolveParent: (value: T) => void\n): void {\n if (process.env.NODE_ENV === 'development') {\n parentResult = (\n require('../../shared/lib/deep-freeze') as typeof import('../../shared/lib/deep-freeze')\n ).deepFreeze(structuredClone(parentResult)) as T\n }\n\n resolveParent(parentResult)\n}\n\nfunction cloneStaticMetadata(metadata: StaticMetadata): StaticMetadata {\n if (!metadata) return null\n\n return {\n ...metadata,\n icon: metadata.icon ? [...metadata.icon] : undefined,\n apple: metadata.apple ? [...metadata.apple] : undefined,\n openGraph: metadata.openGraph ? [...metadata.openGraph] : undefined,\n twitter: metadata.twitter ? [...metadata.twitter] : undefined,\n }\n}\n\nfunction createMetadataAccumulator(): MetadataAccumulator {\n return {\n metadata: createDefaultMetadata(),\n titleTemplates: {\n title: null,\n twitter: null,\n openGraph: null,\n },\n favicon: null,\n leafSegmentStaticIcons: {\n icon: [],\n apple: [],\n },\n buildState: {\n warnings: new Set(),\n },\n }\n}\n\nfunction cloneMetadataAccumulator(\n accumulator: MetadataAccumulator\n): MetadataAccumulator {\n return {\n metadata: structuredClone(accumulator.metadata),\n titleTemplates: { ...accumulator.titleTemplates },\n favicon: accumulator.favicon ? structuredClone(accumulator.favicon) : null,\n leafSegmentStaticIcons: {\n icon: structuredClone(accumulator.leafSegmentStaticIcons.icon),\n apple: structuredClone(accumulator.leafSegmentStaticIcons.apple),\n },\n buildState: {\n warnings: new Set(accumulator.buildState.warnings),\n },\n }\n}\n\nfunction cloneViewportAccumulator(\n accumulator: ViewportAccumulator\n): ViewportAccumulator {\n return {\n viewport: structuredClone(accumulator.viewport),\n }\n}\n\nasync function accumulateMetadataLayer(\n parent: Promise,\n prerendered: PrerenderedResult,\n staticMetadata: Promise,\n route: string,\n layerIndex: number,\n pathname: Promise,\n metadataContext: MetadataContext\n): Promise {\n const accumulator = await parent\n const staticFilesMetadata = cloneStaticMetadata(await staticMetadata)\n\n // Treat favicon as a special case. It should be the first icon in the list.\n // layerIndex <= 1 represents the root layout and a page at the root.\n if (layerIndex <= 1 && isFavicon(staticFilesMetadata?.icon?.[0])) {\n const icon = staticFilesMetadata?.icon?.shift()\n if (layerIndex === 0 && icon) {\n accumulator.favicon = convertUrlsToStrings(icon)\n }\n }\n\n if (prerendered.resolveParent) {\n resolveParentResult(accumulator.metadata, prerendered.resolveParent)\n }\n\n let metadata: Metadata | null\n if (isPromiseLike(prerendered.result)) {\n metadata = await prerendered.result\n } else {\n metadata = prerendered.result\n }\n\n await mergeMetadata(route, pathname, {\n metadata,\n resolvedMetadata: accumulator.metadata,\n staticFilesMetadata,\n titleTemplates: accumulator.titleTemplates,\n metadataContext,\n buildState: accumulator.buildState,\n leafSegmentStaticIcons: accumulator.leafSegmentStaticIcons,\n cloneResolvedMetadata: false,\n })\n\n return accumulator\n}\n\nasync function accumulateViewportLayer(\n parent: Promise,\n prerendered: PrerenderedResult\n): Promise {\n const accumulator = await parent\n\n if (prerendered.resolveParent) {\n resolveParentResult(accumulator.viewport, prerendered.resolveParent)\n }\n\n let viewport: Viewport | null\n if (isPromiseLike(prerendered.result)) {\n viewport = await prerendered.result\n } else {\n viewport = prerendered.result\n }\n\n mergeViewport({\n resolvedViewport: accumulator.viewport,\n viewport,\n cloneResolvedViewport: false,\n })\n return accumulator\n}\n\nfunction prepareMetadataAccumulatorForChild(\n parent: Promise,\n clone: boolean,\n childIsPage: boolean,\n errorConvention: MetadataErrorType | undefined\n): Promise {\n return parent.then((parentAccumulator) => {\n const accumulator = clone\n ? cloneMetadataAccumulator(parentAccumulator)\n : parentAccumulator\n\n // A title template applies to a descendant segment, but not to a page in\n // the same segment. Error convention metadata is an additional terminal\n // layer, so the leaf layout's template does apply to it.\n if (!childIsPage || errorConvention) {\n accumulator.titleTemplates = {\n title: accumulator.metadata.title?.template || null,\n openGraph: accumulator.metadata.openGraph?.title.template || null,\n twitter: accumulator.metadata.twitter?.title.template || null,\n }\n }\n\n return accumulator\n })\n}\n\nfunction prepareViewportAccumulatorForChild(\n parent: Promise,\n clone: boolean\n): Promise {\n return clone ? parent.then(cloneViewportAccumulator) : parent\n}\n\nfunction completeMetadataAccumulator(\n accumulator: MetadataAccumulator,\n metadataContext: MetadataContext\n): ResolvedMetadata {\n const { leafSegmentStaticIcons, metadata } = accumulator\n\n if (\n (leafSegmentStaticIcons.icon.length > 0 ||\n leafSegmentStaticIcons.apple.length > 0) &&\n !metadata.icons\n ) {\n metadata.icons = {\n icon: [],\n apple: [],\n }\n if (leafSegmentStaticIcons.icon.length > 0) {\n metadata.icons.icon.unshift(\n ...convertUrlsToStrings(leafSegmentStaticIcons.icon)\n )\n }\n if (leafSegmentStaticIcons.apple.length > 0) {\n metadata.icons.apple.unshift(\n ...convertUrlsToStrings(leafSegmentStaticIcons.apple)\n )\n }\n }\n\n return postProcessMetadata(\n metadata,\n accumulator.favicon,\n accumulator.titleTemplates,\n metadataContext\n )\n}\n\ntype MetadataTreeContext = {\n pathname: Promise\n searchParams: Promise\n errorConvention: MetadataErrorType | undefined\n interpolatedParams: Params\n metadataContext: MetadataContext\n route: string\n selectedKeyPath: string[] | null\n resolutionTarget: ResolutionTarget\n outlets: Map>\n}\n\ntype MetadataTreeState = {\n tree: LoaderTree\n treeRoute: string | null\n parentParams: Params\n parentOptionalCatchAllParamName: string | null\n metadataParent: Promise\n viewportParent: Promise\n errorLayer: MetadataLayer | null\n definitionDepth: number\n keyPath: string[]\n}\n\ntype MetadataBranchAtFork = {\n key: string\n branch: MetadataBranch\n}\n\nfunction getResolutionStatus(\n reason: unknown\n): RejectedMetadataResolutionStatus {\n if (isHTTPAccessFallbackError(reason)) {\n return (\n getAccessFallbackErrorTypeByStatus(getAccessFallbackHTTPStatus(reason)) ||\n 'error'\n )\n }\n if (isRedirectError(reason)) {\n return 'redirect'\n }\n return 'error'\n}\n\nfunction createRejectedOutcome(reason: unknown): RejectedOutcome {\n return {\n status: getResolutionStatus(reason),\n reason,\n }\n}\n\nfunction createMetadataBranchOutcome(\n pendingAccumulator: Promise,\n metadataContext: MetadataContext\n): Promise {\n const completed = pendingAccumulator.then((accumulator) => ({\n value: createSelectedMetadata(\n completeMetadataAccumulator(accumulator, metadataContext)\n ),\n warnings: accumulator.buildState.warnings,\n }))\n\n return completed.then(\n ({ value, warnings }) => ({\n status: 'resolved',\n value,\n warnings,\n }),\n createRejectedOutcome\n )\n}\n\nfunction createViewportBranchOutcome(\n pendingAccumulator: Promise\n): Promise {\n return pendingAccumulator.then(\n (accumulator) => ({\n status: 'resolved',\n value: accumulator.viewport,\n }),\n createRejectedOutcome\n )\n}\n\nfunction createOutletPromise(\n metadataOutcome: Promise,\n viewportOutcome: Promise\n): Promise {\n let pendingOutcomes = 2\n const outlet = new Promise((resolve, reject) => {\n function settle(outcome: ResolutionOutcome) {\n if (outcome.status !== 'resolved') {\n reject(outcome.reason)\n } else if (--pendingOutcomes === 0) {\n resolve(null)\n }\n }\n\n metadataOutcome.then(settle, reject)\n viewportOutcome.then(settle, reject)\n })\n\n // Outlet promises can reject before React renders the corresponding slot.\n // Observe the rejection immediately while preserving it for React to replay.\n outlet.catch(() => null)\n return outlet\n}\n\nfunction appendTreeRoute(\n parentRoute: string | null,\n segment: string\n): string | null {\n if (segment === PAGE_SEGMENT_KEY) return parentRoute\n if (parentRoute === null) return segment\n return `${parentRoute}/${segment}`\n}\n\nfunction isPageTree(tree: LoaderTree): boolean {\n const { layout, page, defaultPage } = tree[2]\n return (\n layout === undefined &&\n (page !== undefined ||\n (defaultPage !== undefined && tree[0] === DEFAULT_SEGMENT_KEY))\n )\n}\n\nfunction isBuiltinFallback(tree: LoaderTree): boolean {\n const { defaultPage } = tree[2]\n return (\n defaultPage?.[1].endsWith(PARALLEL_ROUTE_DEFAULT_PATH) === true ||\n defaultPage?.[1].endsWith(PARALLEL_ROUTE_DEFAULT_NULL_PATH) === true\n )\n}\n\nfunction hasHeadDefinition(layer: MetadataLayer | null): boolean {\n if (layer === null) return false\n\n return (\n layer.metadata !== null ||\n layer.viewport !== null ||\n layer.hasStaticFilesMetadata\n )\n}\n\nfunction hasStaticMetadataFiles(tree: LoaderTree): boolean {\n const metadata = tree[2].metadata\n return Boolean(\n metadata &&\n ((metadata.icon?.length ?? 0) > 0 ||\n (metadata.apple?.length ?? 0) > 0 ||\n (metadata.openGraph?.length ?? 0) > 0 ||\n (metadata.twitter?.length ?? 0) > 0 ||\n metadata.manifest !== undefined)\n )\n}\n\nfunction selectDefaultMetadataBranch(\n branches: MetadataBranchAtFork[],\n forkDepth: number\n): MetadataBranch {\n if (branches.length === 0) {\n throw new InvariantError('Expected at least one metadata branch')\n }\n\n let selected = branches[0]\n for (let i = 1; i < branches.length; i++) {\n const candidate = branches[i]\n if (\n selected.branch.isBuiltinFallback !== candidate.branch.isBuiltinFallback\n ) {\n if (!candidate.branch.isBuiltinFallback) {\n selected = candidate\n }\n continue\n }\n\n const selectedIsChildren = selected.key === 'children'\n const candidateIsChildren = candidate.key === 'children'\n if (selectedIsChildren !== candidateIsChildren) {\n const childrenBranch = selectedIsChildren ? selected : candidate\n const namedBranch = selectedIsChildren ? candidate : selected\n const childrenDefinesHead =\n childrenBranch.branch.definitionDepth > forkDepth\n const namedDefinesHead = namedBranch.branch.definitionDepth > forkDepth\n\n // Prefer children when it contributes to the head. Otherwise, allow a\n // named slot with its own definition to provide the selected metadata.\n selected =\n childrenDefinesHead || !namedDefinesHead ? childrenBranch : namedBranch\n continue\n }\n\n if (candidate.branch.definitionDepth > selected.branch.definitionDepth) {\n selected = candidate\n continue\n }\n if (candidate.branch.definitionDepth < selected.branch.definitionDepth) {\n continue\n }\n const selectedDepth = selected.branch.keyPath.length\n const candidateDepth = candidate.branch.keyPath.length\n if (candidateDepth > selectedDepth) {\n selected = candidate\n continue\n }\n if (candidateDepth === selectedDepth && candidate.key < selected.key) {\n selected = candidate\n }\n }\n\n return selected.branch\n}\n\nasync function walkMetadataTree(\n context: MetadataTreeContext,\n state: MetadataTreeState\n): Promise {\n const [segment, parallelRoutes, { page }] = state.tree\n const treeRoute = appendTreeRoute(state.treeRoute, segment)\n const isPage = page !== undefined\n const depth = state.keyPath.length\n const shouldResolveMetadata = Boolean(context.resolutionTarget & METADATA)\n const shouldResolveViewport = Boolean(context.resolutionTarget & VIEWPORT)\n\n let currentParams = state.parentParams\n const segmentParam = getSegmentParam(segment)\n if (segmentParam) {\n const value = context.interpolatedParams[segmentParam.paramName]\n if (value !== null && value !== undefined) {\n currentParams = {\n ...state.parentParams,\n [segmentParam.paramName]: value,\n }\n }\n }\n\n const optionalCatchAllParamName: string | null =\n segmentParam?.paramType === 'optional-catchall' &&\n (context.interpolatedParams[segmentParam.paramName] === null ||\n context.interpolatedParams[segmentParam.paramName] === undefined)\n ? segmentParam.paramName\n : state.parentOptionalCatchAllParamName\n\n const params = createServerParamsForMetadata(\n currentParams,\n optionalCatchAllParamName\n )\n const props: SegmentProps = isPage\n ? { params, searchParams: context.searchParams }\n : { params }\n const layer = await collectMetadataAndViewport({\n tree: state.tree,\n props,\n route: treeRoute ?? '',\n errorConvention: context.errorConvention,\n resolutionTarget: context.resolutionTarget,\n })\n let definitionDepth = hasHeadDefinition(layer) ? depth : state.definitionDepth\n\n // Invoke each active generator as soon as this layer is discovered. Its\n // parent promise is resolved later when the preceding accumulator is ready.\n let metadata = state.metadataParent\n if (shouldResolveMetadata) {\n const prerenderedMetadata = getResult(\n layer.metadata\n )\n metadata = accumulateMetadataLayer(\n metadata,\n prerenderedMetadata,\n layer.staticFilesMetadata,\n context.route,\n depth,\n context.pathname,\n context.metadataContext\n )\n }\n let viewport = state.viewportParent\n if (shouldResolveViewport) {\n const prerenderedViewport = getResult(\n layer.viewport\n )\n viewport = accumulateViewportLayer(viewport, prerenderedViewport)\n }\n const errorLayer = layer.errorLayer || state.errorLayer\n\n let parallelRouteKeys = Object.keys(parallelRoutes)\n if (context.selectedKeyPath !== null) {\n const selectedKey = context.selectedKeyPath[depth]\n if (parallelRouteKeys.length === 0) {\n if (selectedKey !== undefined) {\n throw new InvariantError(\n 'Expected selected metadata branch to end at a leaf'\n )\n }\n } else {\n if (selectedKey === undefined || !parallelRoutes[selectedKey]) {\n throw new InvariantError(\n 'Expected selected metadata branch to match loader tree'\n )\n }\n parallelRouteKeys = [selectedKey]\n }\n }\n\n if (parallelRouteKeys.length === 0) {\n if (context.errorConvention) {\n if (hasHeadDefinition(errorLayer)) {\n definitionDepth = depth + 1\n }\n if (shouldResolveMetadata) {\n const errorMetadata = getResult(\n errorLayer?.metadata || null\n )\n metadata = accumulateMetadataLayer(\n metadata,\n errorMetadata,\n errorLayer?.staticFilesMetadata || Promise.resolve(null),\n context.route,\n depth + 1,\n context.pathname,\n context.metadataContext\n )\n }\n if (shouldResolveViewport) {\n const errorViewport = getResult(\n errorLayer?.viewport || null\n )\n viewport = accumulateViewportLayer(viewport, errorViewport)\n }\n }\n\n const metadataOutcome = createMetadataBranchOutcome(\n metadata,\n context.metadataContext\n )\n const viewportOutcome = createViewportBranchOutcome(viewport)\n context.outlets.set(\n state.tree,\n createOutletPromise(metadataOutcome, viewportOutcome)\n )\n return {\n metadata: metadataOutcome,\n viewport: viewportOutcome,\n keyPath: state.keyPath,\n definitionDepth,\n isBuiltinFallback: isBuiltinFallback(state.tree),\n }\n }\n\n const cloneAtFork = parallelRouteKeys.length > 1\n const pendingChildBranches: Array<{\n key: string\n branch: Promise\n }> = []\n for (const parallelRouteKey of parallelRouteKeys) {\n const childTree = parallelRoutes[parallelRouteKey]\n const childKeyPath = [...state.keyPath, parallelRouteKey]\n const branch = walkMetadataTree(context, {\n tree: childTree,\n treeRoute,\n parentParams: currentParams,\n parentOptionalCatchAllParamName: optionalCatchAllParamName,\n metadataParent: prepareMetadataAccumulatorForChild(\n metadata,\n cloneAtFork && shouldResolveMetadata,\n isPageTree(childTree),\n context.errorConvention\n ),\n viewportParent: prepareViewportAccumulatorForChild(\n viewport,\n cloneAtFork && shouldResolveViewport\n ),\n errorLayer,\n definitionDepth,\n keyPath: childKeyPath,\n })\n\n // Child walks start eagerly, but are awaited in order below. Observe each\n // rejection now so a failure in one branch cannot leave a later sibling's\n // rejection unhandled.\n branch.catch(() => null)\n pendingChildBranches.push({\n key: parallelRouteKey,\n branch,\n })\n }\n\n const childBranches: MetadataBranchAtFork[] = []\n for (const pendingChildBranch of pendingChildBranches) {\n childBranches.push({\n key: pendingChildBranch.key,\n branch: await pendingChildBranch.branch,\n })\n }\n\n return selectDefaultMetadataBranch(childBranches, depth)\n}\n\nasync function resolveMetadataTree(\n tree: LoaderTree,\n pathname: Promise,\n searchParams: Promise,\n errorConvention: MetadataErrorType | undefined,\n interpolatedParams: Params,\n metadataContext: MetadataContext,\n selectedKeyPath: string[] | null,\n resolutionTarget: ResolutionTarget\n): Promise {\n const workStore = workAsyncStorage.getStore()\n if (!workStore) {\n throw new InvariantError('Expected workStore to be initialized')\n }\n\n const outlets = new Map>()\n const selectedBranch = await walkMetadataTree(\n {\n pathname,\n searchParams,\n errorConvention,\n interpolatedParams,\n metadataContext,\n route: workStore.route,\n selectedKeyPath,\n resolutionTarget,\n outlets,\n },\n {\n tree,\n treeRoute: null,\n parentParams: {},\n parentOptionalCatchAllParamName: null,\n metadataParent: Promise.resolve(createMetadataAccumulator()),\n viewportParent: Promise.resolve({\n viewport: createDefaultViewport(),\n }),\n errorLayer: null,\n definitionDepth: -1,\n keyPath: [],\n }\n )\n\n const selected = selectedBranch.metadata.then((outcome) => {\n if (outcome.status === 'resolved') {\n for (const warning of outcome.warnings) {\n Log.warn(warning)\n }\n }\n return outcome\n })\n\n return {\n selectedKeyPath: selectedBranch.keyPath,\n selectedMetadata: selected,\n selectedViewport: selectedBranch.viewport,\n outlets,\n }\n}\n\nexport function resolveMetadataResolution(\n tree: LoaderTree,\n pathname: Promise,\n searchParams: Promise,\n errorConvention: MetadataErrorType | undefined,\n interpolatedParams: Params,\n metadataContext: MetadataContext\n): Promise {\n return resolveMetadataTree(\n tree,\n pathname,\n searchParams,\n errorConvention,\n interpolatedParams,\n metadataContext,\n null,\n METADATA_AND_VIEWPORT\n )\n}\n\nexport async function resolveMetadataForBranch(\n tree: LoaderTree,\n pathname: Promise,\n searchParams: Promise,\n errorConvention: MetadataErrorType,\n interpolatedParams: Params,\n metadataContext: MetadataContext,\n selectedKeyPath: string[]\n): Promise {\n const resolution = await resolveMetadataTree(\n tree,\n pathname,\n searchParams,\n errorConvention,\n interpolatedParams,\n metadataContext,\n selectedKeyPath,\n METADATA\n )\n return resolution.selectedMetadata\n}\n\nexport async function resolveViewportForBranch(\n tree: LoaderTree,\n pathname: Promise,\n searchParams: Promise,\n errorConvention: MetadataErrorType,\n interpolatedParams: Params,\n metadataContext: MetadataContext,\n selectedKeyPath: string[]\n): Promise {\n const resolution = await resolveMetadataTree(\n tree,\n pathname,\n searchParams,\n errorConvention,\n interpolatedParams,\n metadataContext,\n selectedKeyPath,\n VIEWPORT\n )\n return resolution.selectedViewport\n}\n\nfunction isPromiseLike(\n value: unknown | PromiseLike\n): value is PromiseLike {\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof (value as PromiseLike).then === 'function'\n )\n}\n"],"names":["resolveMetadataForBranch","resolveMetadataResolution","resolveViewportForBranch","METADATA","VIEWPORT","METADATA_AND_VIEWPORT","collectMetadataAndViewport","tree","props","route","errorConvention","resolutionTarget","shouldResolveMetadata","Boolean","shouldResolveViewport","moduleResultPromise","getComponentTypeModule","then","mod","modType","getLayoutOrPageModule","staticFilesMetadata","resolveStaticMetadata","Promise","resolve","catch","moduleResult","hasStaticFilesMetadata","hasStaticMetadataFiles","metadata","getDefinedMetadata","viewport","getDefinedViewport","errorLayer","errorMod","callResolver","resolver","result","error","reject","getResult","exportForResult","useCacheFunctionInfo","getUseCacheFunctionInfo","$$original","usedArgs","resolveParent","parent","createLazyResult","resolveParentResult","parentResult","process","env","NODE_ENV","require","deepFreeze","structuredClone","cloneStaticMetadata","icon","undefined","apple","openGraph","twitter","createMetadataAccumulator","createDefaultMetadata","titleTemplates","title","favicon","leafSegmentStaticIcons","buildState","warnings","Set","cloneMetadataAccumulator","accumulator","cloneViewportAccumulator","accumulateMetadataLayer","prerendered","staticMetadata","layerIndex","pathname","metadataContext","isFavicon","shift","convertUrlsToStrings","isPromiseLike","mergeMetadata","resolvedMetadata","cloneResolvedMetadata","accumulateViewportLayer","mergeViewport","resolvedViewport","cloneResolvedViewport","prepareMetadataAccumulatorForChild","clone","childIsPage","parentAccumulator","template","prepareViewportAccumulatorForChild","completeMetadataAccumulator","length","icons","unshift","postProcessMetadata","getResolutionStatus","reason","isHTTPAccessFallbackError","getAccessFallbackErrorTypeByStatus","getAccessFallbackHTTPStatus","isRedirectError","createRejectedOutcome","status","createMetadataBranchOutcome","pendingAccumulator","completed","value","createSelectedMetadata","createViewportBranchOutcome","createOutletPromise","metadataOutcome","viewportOutcome","pendingOutcomes","outlet","settle","outcome","appendTreeRoute","parentRoute","segment","PAGE_SEGMENT_KEY","isPageTree","layout","page","defaultPage","DEFAULT_SEGMENT_KEY","isBuiltinFallback","endsWith","PARALLEL_ROUTE_DEFAULT_PATH","PARALLEL_ROUTE_DEFAULT_NULL_PATH","hasHeadDefinition","layer","manifest","selectDefaultMetadataBranch","branches","forkDepth","InvariantError","selected","i","candidate","branch","selectedIsChildren","key","candidateIsChildren","childrenBranch","namedBranch","childrenDefinesHead","definitionDepth","namedDefinesHead","selectedDepth","keyPath","candidateDepth","walkMetadataTree","context","state","parallelRoutes","treeRoute","isPage","depth","currentParams","parentParams","segmentParam","getSegmentParam","interpolatedParams","paramName","optionalCatchAllParamName","paramType","parentOptionalCatchAllParamName","params","createServerParamsForMetadata","searchParams","metadataParent","prerenderedMetadata","viewportParent","prerenderedViewport","parallelRouteKeys","Object","keys","selectedKeyPath","selectedKey","errorMetadata","errorViewport","outlets","set","cloneAtFork","pendingChildBranches","parallelRouteKey","childTree","childKeyPath","push","childBranches","pendingChildBranch","resolveMetadataTree","workStore","workAsyncStorage","getStore","Map","selectedBranch","createDefaultViewport","warning","Log","warn","selectedMetadata","selectedViewport","resolution"],"mappings":";;;;;;;;;;;;;;;;IAy7BsBA,wBAAwB;eAAxBA;;IApBNC,yBAAyB;eAAzBA;;IA0CMC,wBAAwB;eAAxBA;;;QAl8Bf;iCAKA;iCACyB;8BAIzB;wBACuC;yBACQ;yBACV;6BACK;0CAChB;gCACF;6DACV;2CACmB;4BACP;oCAK1B;+BACyB;8CAoBzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEP,MAAMC,WAAW;AACjB,MAAMC,WAAW;AACjB,MAAMC,wBAAwB;AAkE9B,eAAeC,2BAA2B,EACxCC,IAAI,EACJC,KAAK,EACLC,KAAK,EACLC,eAAe,EACfC,gBAAgB,EAOjB;IACC,MAAMC,wBAAwBC,QAAQF,mBAAmBR;IACzD,MAAMW,wBAAwBD,QAAQF,mBAAmBP;IACzD,MAAMW,sBAAsBL,kBACxBM,IAAAA,oCAAsB,EAACT,MAAM,UAAUU,IAAI,CAAC,CAACC,MAAS,CAAA;YACpDA;YACAC,SAAST;QACX,CAAA,KACAU,IAAAA,mCAAqB,EAACb;IAC1B,MAAMc,sBAAsBT,wBACxBU,IAAAA,mDAAqB,EAACf,IAAI,CAAC,EAAE,EAAEC,SAC/Be,QAAQC,OAAO,CAAC;IAEpB,yEAAyE;IACzE,oEAAoE;IACpEH,oBAAoBI,KAAK,CAAC,IAAM;IAEhC,MAAMC,e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kBN,eAAe7K,QAAQ;QACzC8J;IACF;AACF;AAEO,SAAS5L,0BACdM,IAAgB,EAChBwE,QAAyB,EACzBkG,YAAqC,EACrCvK,eAA8C,EAC9CgK,kBAA0B,EAC1B1F,eAAgC;IAEhC,OAAOuH,oBACLhM,MACAwE,UACAkG,cACAvK,iBACAgK,oBACA1F,iBACA,MACA3E;AAEJ;AAEO,eAAeL,yBACpBO,IAAgB,EAChBwE,QAAyB,EACzBkG,YAAqC,EACrCvK,eAAkC,EAClCgK,kBAA0B,EAC1B1F,eAAgC,EAChCyG,eAAyB;IAEzB,MAAM0B,aAAa,MAAMZ,oBACvBhM,MACAwE,UACAkG,cACAvK,iBACAgK,oBACA1F,iBACAyG,iBACAtL;IAEF,OAAOgN,WAAWF,gBAAgB;AACpC;AAEO,eAAe/M,yBACpBK,IAAgB,EAChBwE,QAAyB,EACzBkG,YAAqC,EACrCvK,eAAkC,EAClCgK,kBAA0B,EAC1B1F,eAAgC,EAChCyG,eAAyB;IAEzB,MAAM0B,aAAa,MAAMZ,oBACvBhM,MACAwE,UACAkG,cACAvK,iBACAgK,oBACA1F,iBACAyG,iBACArL;IAEF,OAAO+M,WAAWD,gBAAgB;AACpC;AAEA,SAAS9H,cACP8B,KAA+B;IAE/B,OACE,OAAOA,UAAU,YACjBA,UAAU,QACV,OAAO,AAACA,MAA+BjG,IAAI,KAAK;AAEpD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolve-metadata.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/resolve-metadata.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7bd4107b2526eb62be6c200564b9cb4edad076cd --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolve-metadata.d.ts @@ -0,0 +1,13 @@ +import type { ResolvedMetadata, ResolvedViewport } from './types/metadata-interface'; +import type { MetadataContext } from './types/resolvers'; +import type { LoaderTree } from '../../server/lib/app-dir-module'; +import type { ParsedUrlQuery } from 'querystring'; +import type { Params } from '../../server/request/params'; +import 'server-only'; +import { type MetadataErrorType, type MetadataItems, type SelectedMetadata, type ViewportItems, createSelectedMetadata } from './metadata-resolution-primitives'; +export type { MetadataErrorType, MetadataItems, SelectedMetadata, ViewportItems, }; +export { createSelectedMetadata }; +export declare function accumulateMetadata(route: string, metadataItems: MetadataItems, pathname: Promise, metadataContext: MetadataContext): Promise; +export declare function accumulateViewport(viewportItems: ViewportItems): Promise; +export declare function resolveMetadata(tree: LoaderTree, pathname: Promise, searchParams: Promise, errorConvention: MetadataErrorType | undefined, interpolatedParams: Params, metadataContext: MetadataContext): Promise; +export declare function resolveViewport(tree: LoaderTree, searchParams: Promise, errorConvention: MetadataErrorType | undefined, interpolatedParams: Params): Promise; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolve-metadata.js b/e-commerce/node_modules/next/dist/lib/metadata/resolve-metadata.js new file mode 100644 index 0000000000000000000000000000000000000000..43a145dbd457c738e6080f820481aee197da7d45 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolve-metadata.js @@ -0,0 +1,485 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + accumulateMetadata: null, + accumulateViewport: null, + createSelectedMetadata: null, + resolveMetadata: null, + resolveViewport: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + accumulateMetadata: function() { + return accumulateMetadata; + }, + accumulateViewport: function() { + return accumulateViewport; + }, + createSelectedMetadata: function() { + return _metadataresolutionprimitives.createSelectedMetadata; + }, + resolveMetadata: function() { + return resolveMetadata; + }, + resolveViewport: function() { + return resolveViewport; + } +}); +const _getsegmentparam = require("../../shared/lib/router/utils/get-segment-param"); +const _workasyncstorageexternal = require("../../server/app-render/work-async-storage.external"); +const _invarianterror = require("../../shared/lib/invariant-error"); +require("server-only"); +const _react = require("react"); +const _defaultmetadata = require("./default-metadata"); +const _appdirmodule = require("../../server/lib/app-dir-module"); +const _segment = require("../../shared/lib/segment"); +const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../build/output/log")); +const _params = require("../../server/request/params"); +const _clientandserverreferences = require("../client-and-server-references"); +const _lazyresult = require("../../server/lib/lazy-result"); +const _metadataresolutionprimitives = require("./metadata-resolution-primitives"); +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +// [layout.metadata, static files metadata] -> ... -> [page.metadata, static files metadata] +async function collectMetadata({ tree, metadataItems, errorMetadataItem, props, route, errorConvention }) { + let mod; + let modType; + const hasErrorConventionComponent = Boolean(errorConvention && tree[2][errorConvention]); + if (errorConvention) { + mod = await (0, _appdirmodule.getComponentTypeModule)(tree, 'layout'); + modType = errorConvention; + } else { + const { mod: layoutOrPageMod, modType: layoutOrPageModType } = await (0, _appdirmodule.getLayoutOrPageModule)(tree); + mod = layoutOrPageMod; + modType = layoutOrPageModType; + } + if (modType) { + route += `/${modType}`; + } + const staticFilesMetadata = await (0, _metadataresolutionprimitives.resolveStaticMetadata)(tree[2], props); + const metadataExport = mod ? (0, _metadataresolutionprimitives.getDefinedMetadata)(mod, props, { + route + }) : null; + metadataItems.push([ + metadataExport, + staticFilesMetadata + ]); + if (hasErrorConventionComponent && errorConvention) { + const errorMod = await (0, _appdirmodule.getComponentTypeModule)(tree, errorConvention); + const errorMetadataExport = errorMod ? (0, _metadataresolutionprimitives.getDefinedMetadata)(errorMod, props, { + route + }) : null; + errorMetadataItem[0] = errorMetadataExport; + errorMetadataItem[1] = staticFilesMetadata; + } +} +// [layout.metadata, static files metadata] -> ... -> [page.metadata, static files metadata] +async function collectViewport({ tree, viewportItems, errorViewportItemRef, props, route, errorConvention }) { + let mod; + let modType; + const hasErrorConventionComponent = Boolean(errorConvention && tree[2][errorConvention]); + if (errorConvention) { + mod = await (0, _appdirmodule.getComponentTypeModule)(tree, 'layout'); + modType = errorConvention; + } else { + const { mod: layoutOrPageMod, modType: layoutOrPageModType } = await (0, _appdirmodule.getLayoutOrPageModule)(tree); + mod = layoutOrPageMod; + modType = layoutOrPageModType; + } + if (modType) { + route += `/${modType}`; + } + const viewportExport = mod ? (0, _metadataresolutionprimitives.getDefinedViewport)(mod, props, { + route + }) : null; + viewportItems.push(viewportExport); + if (hasErrorConventionComponent && errorConvention) { + const errorMod = await (0, _appdirmodule.getComponentTypeModule)(tree, errorConvention); + const errorViewportExport = errorMod ? (0, _metadataresolutionprimitives.getDefinedViewport)(errorMod, props, { + route + }) : null; + errorViewportItemRef.current = errorViewportExport; + } +} +const resolveMetadataItems = (0, _react.cache)(async function(tree, searchParams, errorConvention, interpolatedParams) { + const parentParams = {}; + const metadataItems = []; + const errorMetadataItem = [ + null, + null + ]; + const treePrefix = undefined; + return resolveMetadataItemsImpl(metadataItems, tree, treePrefix, parentParams, null, searchParams, errorConvention, errorMetadataItem, interpolatedParams); +}); +async function resolveMetadataItemsImpl(metadataItems, tree, /** Provided tree can be nested subtree, this argument says what is the path of such subtree */ treePrefix, parentParams, parentOptionalCatchAllParamName, searchParams, errorConvention, errorMetadataItem, interpolatedParams) { + const [segment, parallelRoutes, { page }] = tree; + const currentTreePrefix = treePrefix && treePrefix.length ? [ + ...treePrefix, + segment + ] : [ + segment + ]; + const isPage = typeof page !== 'undefined'; + // Handle dynamic segment params. + let currentParams = parentParams; + const segmentParam = (0, _getsegmentparam.getSegmentParam)(segment); + if (segmentParam) { + const value = interpolatedParams[segmentParam.paramName]; + if (value !== null && value !== undefined) { + currentParams = { + ...parentParams, + [segmentParam.paramName]: value + }; + } + } + // Track optional catch-all params with no value (see comment in + // create-component-tree.tsx for full explanation). + const optionalCatchAllParamName = (segmentParam == null ? void 0 : segmentParam.paramType) === 'optional-catchall' && (interpolatedParams[segmentParam.paramName] === null || interpolatedParams[segmentParam.paramName] === undefined) ? segmentParam.paramName : parentOptionalCatchAllParamName; + const params = (0, _params.createServerParamsForMetadata)(currentParams, optionalCatchAllParamName); + const props = isPage ? { + params, + searchParams + } : { + params + }; + await collectMetadata({ + tree, + metadataItems, + errorMetadataItem, + errorConvention, + props, + route: currentTreePrefix// __PAGE__ shouldn't be shown in a route + .filter((s)=>s !== _segment.PAGE_SEGMENT_KEY).join('/') + }); + for(const key in parallelRoutes){ + const childTree = parallelRoutes[key]; + await resolveMetadataItemsImpl(metadataItems, childTree, currentTreePrefix, currentParams, optionalCatchAllParamName, searchParams, errorConvention, errorMetadataItem, interpolatedParams); + } + if (Object.keys(parallelRoutes).length === 0 && errorConvention) { + // If there are no parallel routes, place error metadata as the last item. + // e.g. layout -> layout -> not-found + metadataItems.push(errorMetadataItem); + } + return metadataItems; +} +const resolveViewportItems = (0, _react.cache)(async function(tree, searchParams, errorConvention, interpolatedParams) { + const parentParams = {}; + const viewportItems = []; + const errorViewportItemRef = { + current: null + }; + const treePrefix = undefined; + return resolveViewportItemsImpl(viewportItems, tree, treePrefix, parentParams, null, searchParams, errorConvention, errorViewportItemRef, interpolatedParams); +}); +async function resolveViewportItemsImpl(viewportItems, tree, /** Provided tree can be nested subtree, this argument says what is the path of such subtree */ treePrefix, parentParams, parentOptionalCatchAllParamName, searchParams, errorConvention, errorViewportItemRef, interpolatedParams) { + const [segment, parallelRoutes, { page }] = tree; + const currentTreePrefix = treePrefix && treePrefix.length ? [ + ...treePrefix, + segment + ] : [ + segment + ]; + const isPage = typeof page !== 'undefined'; + // Handle dynamic segment params. + let currentParams = parentParams; + const segmentParam = (0, _getsegmentparam.getSegmentParam)(segment); + if (segmentParam) { + const value = interpolatedParams[segmentParam.paramName]; + if (value !== null && value !== undefined) { + currentParams = { + ...parentParams, + [segmentParam.paramName]: value + }; + } + } + // Track optional catch-all params with no value (see comment in + // create-component-tree.tsx for full explanation). + const optionalCatchAllParamName = (segmentParam == null ? void 0 : segmentParam.paramType) === 'optional-catchall' && (interpolatedParams[segmentParam.paramName] === null || interpolatedParams[segmentParam.paramName] === undefined) ? segmentParam.paramName : parentOptionalCatchAllParamName; + const params = (0, _params.createServerParamsForMetadata)(currentParams, optionalCatchAllParamName); + let layerProps; + if (isPage) { + layerProps = { + params, + searchParams + }; + } else { + layerProps = { + params + }; + } + await collectViewport({ + tree, + viewportItems, + errorViewportItemRef, + errorConvention, + props: layerProps, + route: currentTreePrefix// __PAGE__ shouldn't be shown in a route + .filter((s)=>s !== _segment.PAGE_SEGMENT_KEY).join('/') + }); + for(const key in parallelRoutes){ + const childTree = parallelRoutes[key]; + await resolveViewportItemsImpl(viewportItems, childTree, currentTreePrefix, currentParams, optionalCatchAllParamName, searchParams, errorConvention, errorViewportItemRef, interpolatedParams); + } + if (Object.keys(parallelRoutes).length === 0 && errorConvention) { + // If there are no parallel routes, place error metadata as the last item. + // e.g. layout -> layout -> not-found + viewportItems.push(errorViewportItemRef.current); + } + return viewportItems; +} +function prerenderMetadata(metadataItems) { + // If the index is a function then it is a resolver and the next slot + // is the corresponding result. If the index is not a function it is the result + // itself. + const resolversAndResults = []; + for(let i = 0; i < metadataItems.length; i++){ + const metadataExport = metadataItems[i][0]; + getResult(resolversAndResults, metadataExport); + } + return resolversAndResults; +} +function prerenderViewport(viewportItems) { + // If the index is a function then it is a resolver and the next slot + // is the corresponding result. If the index is not a function it is the result + // itself. + const resolversAndResults = []; + for(let i = 0; i < viewportItems.length; i++){ + const viewportExport = viewportItems[i]; + getResult(resolversAndResults, viewportExport); + } + return resolversAndResults; +} +const noop = ()=>{}; +function getResult(resolversAndResults, exportForResult) { + if (typeof exportForResult === 'function') { + // If the function is a 'use cache' function that uses the parent data as + // the second argument, we don't want to eagerly execute it during + // metadata/viewport pre-rendering, as the parent data might also be + // computed from another 'use cache' function. To ensure that the hanging + // input abort signal handling works in this case (i.e. the depending + // function waits for the cached input to resolve while encoding its args), + // they must be called sequentially. This can be accomplished by wrapping + // the call in a lazy promise, so that the original function is only called + // when the result is actually awaited. + const useCacheFunctionInfo = (0, _clientandserverreferences.getUseCacheFunctionInfo)(exportForResult.$$original); + if (useCacheFunctionInfo && useCacheFunctionInfo.usedArgs[1]) { + const promise = new Promise((resolve)=>resolversAndResults.push(resolve)); + resolversAndResults.push((0, _lazyresult.createLazyResult)(async ()=>exportForResult(promise))); + } else { + let result; + if (useCacheFunctionInfo) { + resolversAndResults.push(noop); + // @ts-expect-error We intentionally omit the parent argument, because + // we know from the check above that the 'use cache' function does not + // use it. + result = exportForResult(); + } else { + result = exportForResult(new Promise((resolve)=>resolversAndResults.push(resolve))); + } + resolversAndResults.push(result); + if (result instanceof Promise) { + // since we eager execute generateMetadata and + // they can reject at anytime we need to ensure + // we attach the catch handler right away to + // prevent unhandled rejections crashing the process + result.catch((err)=>{ + return { + __nextError: err + }; + }); + } + } + } else if (typeof exportForResult === 'object') { + resolversAndResults.push(exportForResult); + } else { + resolversAndResults.push(null); + } +} +function freezeInDev(obj) { + if (process.env.NODE_ENV === 'development') { + return require('../../shared/lib/deep-freeze').deepFreeze(obj); + } + return obj; +} +async function accumulateMetadata(route, metadataItems, pathname, metadataContext) { + let resolvedMetadata = (0, _defaultmetadata.createDefaultMetadata)(); + let titleTemplates = { + title: null, + twitter: null, + openGraph: null + }; + const buildState = { + warnings: new Set() + }; + let favicon; + // Collect the static icons in the most leaf node, + // since we don't collect all the static metadata icons in the parent segments. + const leafSegmentStaticIcons = { + icon: [], + apple: [] + }; + const resolversAndResults = prerenderMetadata(metadataItems); + let resultIndex = 0; + for(let i = 0; i < metadataItems.length; i++){ + var _staticFilesMetadata_icon; + const staticFilesMetadata = metadataItems[i][1]; + // Treat favicon as special case, it should be the first icon in the list + // i <= 1 represents root layout, and if current page is also at root + if (i <= 1 && (0, _metadataresolutionprimitives.isFavicon)(staticFilesMetadata == null ? void 0 : (_staticFilesMetadata_icon = staticFilesMetadata.icon) == null ? void 0 : _staticFilesMetadata_icon[0])) { + var _staticFilesMetadata_icon1; + const iconMod = staticFilesMetadata == null ? void 0 : (_staticFilesMetadata_icon1 = staticFilesMetadata.icon) == null ? void 0 : _staticFilesMetadata_icon1.shift(); + if (i === 0) favicon = iconMod; + } + let pendingMetadata = resolversAndResults[resultIndex++]; + if (typeof pendingMetadata === 'function') { + // This metadata item had a `generateMetadata` and + // we need to provide the currently resolved metadata + // to it before we continue; + const resolveParentMetadata = pendingMetadata; + // we know that the next item is a result if this item + // was a resolver + pendingMetadata = resolversAndResults[resultIndex++]; + resolveParentMetadata(freezeInDev(resolvedMetadata)); + } + // Otherwise the item was either null or a static export + let metadata; + if (isPromiseLike(pendingMetadata)) { + metadata = await pendingMetadata; + } else { + metadata = pendingMetadata; + } + resolvedMetadata = await (0, _metadataresolutionprimitives.mergeMetadata)(route, pathname, { + resolvedMetadata, + metadata, + metadataContext, + staticFilesMetadata, + titleTemplates, + buildState, + leafSegmentStaticIcons + }); + // If the layout is the same layer with page, skip the leaf layout and leaf page + // The leaf layout and page are the last two items + if (i < metadataItems.length - 2) { + var _resolvedMetadata_title, _resolvedMetadata_openGraph, _resolvedMetadata_twitter; + titleTemplates = { + title: ((_resolvedMetadata_title = resolvedMetadata.title) == null ? void 0 : _resolvedMetadata_title.template) || null, + openGraph: ((_resolvedMetadata_openGraph = resolvedMetadata.openGraph) == null ? void 0 : _resolvedMetadata_openGraph.title.template) || null, + twitter: ((_resolvedMetadata_twitter = resolvedMetadata.twitter) == null ? void 0 : _resolvedMetadata_twitter.title.template) || null + }; + } + } + if (leafSegmentStaticIcons.icon.length > 0 || leafSegmentStaticIcons.apple.length > 0) { + if (!resolvedMetadata.icons) { + resolvedMetadata.icons = { + icon: [], + apple: [] + }; + if (leafSegmentStaticIcons.icon.length > 0) { + resolvedMetadata.icons.icon.unshift(...leafSegmentStaticIcons.icon); + } + if (leafSegmentStaticIcons.apple.length > 0) { + resolvedMetadata.icons.apple.unshift(...leafSegmentStaticIcons.apple); + } + } + } + // Only log warnings if there are any, and only once after the metadata resolving process is finished + if (buildState.warnings.size > 0) { + for (const warning of buildState.warnings){ + _log.warn(warning); + } + } + return (0, _metadataresolutionprimitives.postProcessMetadata)(resolvedMetadata, favicon, titleTemplates, metadataContext); +} +async function accumulateViewport(viewportItems) { + let resolvedViewport = (0, _defaultmetadata.createDefaultViewport)(); + const resolversAndResults = prerenderViewport(viewportItems); + let i = 0; + while(i < resolversAndResults.length){ + let pendingViewport = resolversAndResults[i++]; + if (typeof pendingViewport === 'function') { + // this viewport item had a `generateViewport` and + // we need to provide the currently resolved viewport + // to it before we continue; + const resolveParentViewport = pendingViewport; + // we know that the next item is a result if this item + // was a resolver + pendingViewport = resolversAndResults[i++]; + resolveParentViewport(freezeInDev(resolvedViewport)); + } + // Otherwise the item was either null or a static export + let viewport; + if (isPromiseLike(pendingViewport)) { + viewport = await pendingViewport; + } else { + viewport = pendingViewport; + } + resolvedViewport = (0, _metadataresolutionprimitives.mergeViewport)({ + resolvedViewport, + viewport + }); + } + return resolvedViewport; +} +async function resolveMetadata(tree, pathname, searchParams, errorConvention, interpolatedParams, metadataContext) { + const metadataItems = await resolveMetadataItems(tree, searchParams, errorConvention, interpolatedParams); + const workStore = _workasyncstorageexternal.workAsyncStorage.getStore(); + if (!workStore) { + throw new _invarianterror.InvariantError('Expected workStore to be initialized'); + } + return accumulateMetadata(workStore.route, metadataItems, pathname, metadataContext); +} +async function resolveViewport(tree, searchParams, errorConvention, interpolatedParams) { + const viewportItems = await resolveViewportItems(tree, searchParams, errorConvention, interpolatedParams); + return accumulateViewport(viewportItems); +} +function isPromiseLike(value) { + return typeof value === 'object' && value !== null && typeof value.then === 'function'; +} + +//# sourceMappingURL=resolve-metadata.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolve-metadata.js.map b/e-commerce/node_modules/next/dist/lib/metadata/resolve-metadata.js.map new file mode 100644 index 0000000000000000000000000000000000000000..71e6c42955f6d781292fb1cac07fdf0f861a2b6f --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolve-metadata.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/metadata/resolve-metadata.ts"],"sourcesContent":["import type {\n Metadata,\n ResolvedMetadata,\n ResolvedViewport,\n Viewport,\n} from './types/metadata-interface'\nimport { getSegmentParam } from '../../shared/lib/router/utils/get-segment-param'\nimport type { MetadataContext } from './types/resolvers'\nimport type { LoaderTree } from '../../server/lib/app-dir-module'\nimport type { ParsedUrlQuery } from 'querystring'\nimport { workAsyncStorage } from '../../server/app-render/work-async-storage.external'\nimport { InvariantError } from '../../shared/lib/invariant-error'\nimport type { Params } from '../../server/request/params'\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport 'server-only'\n\nimport { cache } from 'react'\nimport {\n createDefaultMetadata,\n createDefaultViewport,\n} from './default-metadata'\nimport {\n getComponentTypeModule,\n getLayoutOrPageModule,\n} from '../../server/lib/app-dir-module'\nimport { PAGE_SEGMENT_KEY } from '../../shared/lib/segment'\nimport * as Log from '../../build/output/log'\nimport { createServerParamsForMetadata } from '../../server/request/params'\nimport { getUseCacheFunctionInfo } from '../client-and-server-references'\nimport { createLazyResult } from '../../server/lib/lazy-result'\nimport {\n type InstrumentedResolver,\n type LayoutProps,\n type MetadataErrorType,\n type MetadataItems,\n type PageProps,\n type SegmentProps,\n type SelectedMetadata,\n type TitleTemplates,\n type ViewportItems,\n createSelectedMetadata,\n getDefinedMetadata,\n getDefinedViewport,\n isFavicon,\n mergeMetadata,\n mergeViewport,\n postProcessMetadata,\n resolveStaticMetadata,\n} from './metadata-resolution-primitives'\n\nexport type {\n MetadataErrorType,\n MetadataItems,\n SelectedMetadata,\n ViewportItems,\n}\nexport { createSelectedMetadata }\n\n// [layout.metadata, static files metadata] -> ... -> [page.metadata, static files metadata]\nasync function collectMetadata({\n tree,\n metadataItems,\n errorMetadataItem,\n props,\n route,\n errorConvention,\n}: {\n tree: LoaderTree\n metadataItems: MetadataItems\n errorMetadataItem: MetadataItems[number]\n props: SegmentProps\n route: string\n errorConvention?: MetadataErrorType\n}) {\n let mod\n let modType\n const hasErrorConventionComponent = Boolean(\n errorConvention && tree[2][errorConvention]\n )\n if (errorConvention) {\n mod = await getComponentTypeModule(tree, 'layout')\n modType = errorConvention\n } else {\n const { mod: layoutOrPageMod, modType: layoutOrPageModType } =\n await getLayoutOrPageModule(tree)\n mod = layoutOrPageMod\n modType = layoutOrPageModType\n }\n\n if (modType) {\n route += `/${modType}`\n }\n\n const staticFilesMetadata = await resolveStaticMetadata(tree[2], props)\n const metadataExport = mod ? getDefinedMetadata(mod, props, { route }) : null\n\n metadataItems.push([metadataExport, staticFilesMetadata])\n\n if (hasErrorConventionComponent && errorConvention) {\n const errorMod = await getComponentTypeModule(tree, errorConvention)\n const errorMetadataExport = errorMod\n ? getDefinedMetadata(errorMod, props, { route })\n : null\n\n errorMetadataItem[0] = errorMetadataExport\n errorMetadataItem[1] = staticFilesMetadata\n }\n}\n// [layout.metadata, static files metadata] -> ... -> [page.metadata, static files metadata]\nasync function collectViewport({\n tree,\n viewportItems,\n errorViewportItemRef,\n props,\n route,\n errorConvention,\n}: {\n tree: LoaderTree\n viewportItems: ViewportItems\n errorViewportItemRef: ErrorViewportItemRef\n props: SegmentProps\n route: string\n errorConvention?: MetadataErrorType\n}) {\n let mod\n let modType\n const hasErrorConventionComponent = Boolean(\n errorConvention && tree[2][errorConvention]\n )\n if (errorConvention) {\n mod = await getComponentTypeModule(tree, 'layout')\n modType = errorConvention\n } else {\n const { mod: layoutOrPageMod, modType: layoutOrPageModType } =\n await getLayoutOrPageModule(tree)\n mod = layoutOrPageMod\n modType = layoutOrPageModType\n }\n\n if (modType) {\n route += `/${modType}`\n }\n\n const viewportExport = mod ? getDefinedViewport(mod, props, { route }) : null\n\n viewportItems.push(viewportExport)\n\n if (hasErrorConventionComponent && errorConvention) {\n const errorMod = await getComponentTypeModule(tree, errorConvention)\n const errorViewportExport = errorMod\n ? getDefinedViewport(errorMod, props, { route })\n : null\n\n errorViewportItemRef.current = errorViewportExport\n }\n}\n\nconst resolveMetadataItems = cache(async function (\n tree: LoaderTree,\n searchParams: Promise,\n errorConvention: MetadataErrorType | undefined,\n interpolatedParams: Params\n) {\n const parentParams = {}\n const metadataItems: MetadataItems = []\n const errorMetadataItem: MetadataItems[number] = [null, null]\n const treePrefix = undefined\n return resolveMetadataItemsImpl(\n metadataItems,\n tree,\n treePrefix,\n parentParams,\n null,\n searchParams,\n errorConvention,\n errorMetadataItem,\n interpolatedParams\n )\n})\n\nasync function resolveMetadataItemsImpl(\n metadataItems: MetadataItems,\n tree: LoaderTree,\n /** Provided tree can be nested subtree, this argument says what is the path of such subtree */\n treePrefix: undefined | string[],\n parentParams: Params,\n parentOptionalCatchAllParamName: string | null,\n searchParams: Promise,\n errorConvention: MetadataErrorType | undefined,\n errorMetadataItem: MetadataItems[number],\n interpolatedParams: Params\n): Promise {\n const [segment, parallelRoutes, { page }] = tree\n const currentTreePrefix =\n treePrefix && treePrefix.length ? [...treePrefix, segment] : [segment]\n const isPage = typeof page !== 'undefined'\n\n // Handle dynamic segment params.\n let currentParams = parentParams\n const segmentParam = getSegmentParam(segment)\n if (segmentParam) {\n const value = interpolatedParams[segmentParam.paramName]\n if (value !== null && value !== undefined) {\n currentParams = {\n ...parentParams,\n [segmentParam.paramName]: value,\n }\n }\n }\n\n // Track optional catch-all params with no value (see comment in\n // create-component-tree.tsx for full explanation).\n const optionalCatchAllParamName: string | null =\n segmentParam?.paramType === 'optional-catchall' &&\n (interpolatedParams[segmentParam.paramName] === null ||\n interpolatedParams[segmentParam.paramName] === undefined)\n ? segmentParam.paramName\n : parentOptionalCatchAllParamName\n\n const params = createServerParamsForMetadata(\n currentParams,\n optionalCatchAllParamName\n )\n const props: SegmentProps = isPage ? { params, searchParams } : { params }\n\n await collectMetadata({\n tree,\n metadataItems,\n errorMetadataItem,\n errorConvention,\n props,\n route: currentTreePrefix\n // __PAGE__ shouldn't be shown in a route\n .filter((s) => s !== PAGE_SEGMENT_KEY)\n .join('/'),\n })\n\n for (const key in parallelRoutes) {\n const childTree = parallelRoutes[key]\n await resolveMetadataItemsImpl(\n metadataItems,\n childTree,\n currentTreePrefix,\n currentParams,\n optionalCatchAllParamName,\n searchParams,\n errorConvention,\n errorMetadataItem,\n interpolatedParams\n )\n }\n\n if (Object.keys(parallelRoutes).length === 0 && errorConvention) {\n // If there are no parallel routes, place error metadata as the last item.\n // e.g. layout -> layout -> not-found\n metadataItems.push(errorMetadataItem)\n }\n\n return metadataItems\n}\n\ntype ErrorViewportItemRef = { current: ViewportItems[number] }\nconst resolveViewportItems = cache(async function (\n tree: LoaderTree,\n searchParams: Promise,\n errorConvention: MetadataErrorType | undefined,\n interpolatedParams: Params\n) {\n const parentParams = {}\n const viewportItems: ViewportItems = []\n const errorViewportItemRef: ErrorViewportItemRef = {\n current: null,\n }\n const treePrefix = undefined\n return resolveViewportItemsImpl(\n viewportItems,\n tree,\n treePrefix,\n parentParams,\n null,\n searchParams,\n errorConvention,\n errorViewportItemRef,\n interpolatedParams\n )\n})\n\nasync function resolveViewportItemsImpl(\n viewportItems: ViewportItems,\n tree: LoaderTree,\n /** Provided tree can be nested subtree, this argument says what is the path of such subtree */\n treePrefix: undefined | string[],\n parentParams: Params,\n parentOptionalCatchAllParamName: string | null,\n searchParams: Promise,\n errorConvention: MetadataErrorType | undefined,\n errorViewportItemRef: ErrorViewportItemRef,\n interpolatedParams: Params\n): Promise {\n const [segment, parallelRoutes, { page }] = tree\n const currentTreePrefix =\n treePrefix && treePrefix.length ? [...treePrefix, segment] : [segment]\n const isPage = typeof page !== 'undefined'\n\n // Handle dynamic segment params.\n let currentParams = parentParams\n const segmentParam = getSegmentParam(segment)\n if (segmentParam) {\n const value = interpolatedParams[segmentParam.paramName]\n if (value !== null && value !== undefined) {\n currentParams = {\n ...parentParams,\n [segmentParam.paramName]: value,\n }\n }\n }\n\n // Track optional catch-all params with no value (see comment in\n // create-component-tree.tsx for full explanation).\n const optionalCatchAllParamName: string | null =\n segmentParam?.paramType === 'optional-catchall' &&\n (interpolatedParams[segmentParam.paramName] === null ||\n interpolatedParams[segmentParam.paramName] === undefined)\n ? segmentParam.paramName\n : parentOptionalCatchAllParamName\n\n const params = createServerParamsForMetadata(\n currentParams,\n optionalCatchAllParamName\n )\n\n let layerProps: LayoutProps | PageProps\n if (isPage) {\n layerProps = {\n params,\n searchParams,\n }\n } else {\n layerProps = {\n params,\n }\n }\n\n await collectViewport({\n tree,\n viewportItems,\n errorViewportItemRef,\n errorConvention,\n props: layerProps,\n route: currentTreePrefix\n // __PAGE__ shouldn't be shown in a route\n .filter((s) => s !== PAGE_SEGMENT_KEY)\n .join('/'),\n })\n\n for (const key in parallelRoutes) {\n const childTree = parallelRoutes[key]\n await resolveViewportItemsImpl(\n viewportItems,\n childTree,\n currentTreePrefix,\n currentParams,\n optionalCatchAllParamName,\n searchParams,\n errorConvention,\n errorViewportItemRef,\n interpolatedParams\n )\n }\n\n if (Object.keys(parallelRoutes).length === 0 && errorConvention) {\n // If there are no parallel routes, place error metadata as the last item.\n // e.g. layout -> layout -> not-found\n viewportItems.push(errorViewportItemRef.current)\n }\n\n return viewportItems\n}\n\ntype Result = null | T | Promise | PromiseLike\n\nfunction prerenderMetadata(metadataItems: MetadataItems) {\n // If the index is a function then it is a resolver and the next slot\n // is the corresponding result. If the index is not a function it is the result\n // itself.\n const resolversAndResults: Array<\n ((value: ResolvedMetadata) => void) | Result\n > = []\n for (let i = 0; i < metadataItems.length; i++) {\n const metadataExport = metadataItems[i][0]\n getResult(resolversAndResults, metadataExport)\n }\n return resolversAndResults\n}\n\nfunction prerenderViewport(viewportItems: ViewportItems) {\n // If the index is a function then it is a resolver and the next slot\n // is the corresponding result. If the index is not a function it is the result\n // itself.\n const resolversAndResults: Array<\n ((value: ResolvedViewport) => void) | Result\n > = []\n for (let i = 0; i < viewportItems.length; i++) {\n const viewportExport = viewportItems[i]\n getResult(resolversAndResults, viewportExport)\n }\n return resolversAndResults\n}\n\nconst noop = () => {}\n\nfunction getResult(\n resolversAndResults: Array<((value: TResolved) => void) | Result>,\n exportForResult: null | TData | InstrumentedResolver\n) {\n if (typeof exportForResult === 'function') {\n // If the function is a 'use cache' function that uses the parent data as\n // the second argument, we don't want to eagerly execute it during\n // metadata/viewport pre-rendering, as the parent data might also be\n // computed from another 'use cache' function. To ensure that the hanging\n // input abort signal handling works in this case (i.e. the depending\n // function waits for the cached input to resolve while encoding its args),\n // they must be called sequentially. This can be accomplished by wrapping\n // the call in a lazy promise, so that the original function is only called\n // when the result is actually awaited.\n const useCacheFunctionInfo = getUseCacheFunctionInfo(\n exportForResult.$$original\n )\n if (useCacheFunctionInfo && useCacheFunctionInfo.usedArgs[1]) {\n const promise = new Promise((resolve) =>\n resolversAndResults.push(resolve)\n )\n resolversAndResults.push(\n createLazyResult(async () => exportForResult(promise))\n )\n } else {\n let result: TData | Promise\n if (useCacheFunctionInfo) {\n resolversAndResults.push(noop)\n // @ts-expect-error We intentionally omit the parent argument, because\n // we know from the check above that the 'use cache' function does not\n // use it.\n result = exportForResult()\n } else {\n result = exportForResult(\n new Promise((resolve) => resolversAndResults.push(resolve))\n )\n }\n resolversAndResults.push(result)\n if (result instanceof Promise) {\n // since we eager execute generateMetadata and\n // they can reject at anytime we need to ensure\n // we attach the catch handler right away to\n // prevent unhandled rejections crashing the process\n result.catch((err) => {\n return {\n __nextError: err,\n }\n })\n }\n }\n } else if (typeof exportForResult === 'object') {\n resolversAndResults.push(exportForResult)\n } else {\n resolversAndResults.push(null)\n }\n}\n\nfunction freezeInDev(obj: T): T {\n if (process.env.NODE_ENV === 'development') {\n return (\n require('../../shared/lib/deep-freeze') as typeof import('../../shared/lib/deep-freeze')\n ).deepFreeze(obj) as T\n }\n\n return obj\n}\n\nexport async function accumulateMetadata(\n route: string,\n metadataItems: MetadataItems,\n pathname: Promise,\n metadataContext: MetadataContext\n): Promise {\n let resolvedMetadata = createDefaultMetadata()\n\n let titleTemplates: TitleTemplates = {\n title: null,\n twitter: null,\n openGraph: null,\n }\n\n const buildState = {\n warnings: new Set(),\n }\n\n let favicon\n\n // Collect the static icons in the most leaf node,\n // since we don't collect all the static metadata icons in the parent segments.\n const leafSegmentStaticIcons = {\n icon: [],\n apple: [],\n }\n\n const resolversAndResults = prerenderMetadata(metadataItems)\n let resultIndex = 0\n\n for (let i = 0; i < metadataItems.length; i++) {\n const staticFilesMetadata = metadataItems[i][1]\n // Treat favicon as special case, it should be the first icon in the list\n // i <= 1 represents root layout, and if current page is also at root\n if (i <= 1 && isFavicon(staticFilesMetadata?.icon?.[0])) {\n const iconMod = staticFilesMetadata?.icon?.shift()\n if (i === 0) favicon = iconMod\n }\n\n let pendingMetadata = resolversAndResults[resultIndex++]\n if (typeof pendingMetadata === 'function') {\n // This metadata item had a `generateMetadata` and\n // we need to provide the currently resolved metadata\n // to it before we continue;\n const resolveParentMetadata = pendingMetadata\n // we know that the next item is a result if this item\n // was a resolver\n pendingMetadata = resolversAndResults[resultIndex++] as Result\n\n resolveParentMetadata(freezeInDev(resolvedMetadata))\n }\n // Otherwise the item was either null or a static export\n\n let metadata: Metadata | null\n if (isPromiseLike(pendingMetadata)) {\n metadata = await pendingMetadata\n } else {\n metadata = pendingMetadata\n }\n\n resolvedMetadata = await mergeMetadata(route, pathname, {\n resolvedMetadata,\n metadata,\n metadataContext,\n staticFilesMetadata,\n titleTemplates,\n buildState,\n leafSegmentStaticIcons,\n })\n\n // If the layout is the same layer with page, skip the leaf layout and leaf page\n // The leaf layout and page are the last two items\n if (i < metadataItems.length - 2) {\n titleTemplates = {\n title: resolvedMetadata.title?.template || null,\n openGraph: resolvedMetadata.openGraph?.title.template || null,\n twitter: resolvedMetadata.twitter?.title.template || null,\n }\n }\n }\n\n if (\n leafSegmentStaticIcons.icon.length > 0 ||\n leafSegmentStaticIcons.apple.length > 0\n ) {\n if (!resolvedMetadata.icons) {\n resolvedMetadata.icons = {\n icon: [],\n apple: [],\n }\n if (leafSegmentStaticIcons.icon.length > 0) {\n resolvedMetadata.icons.icon.unshift(...leafSegmentStaticIcons.icon)\n }\n if (leafSegmentStaticIcons.apple.length > 0) {\n resolvedMetadata.icons.apple.unshift(...leafSegmentStaticIcons.apple)\n }\n }\n }\n\n // Only log warnings if there are any, and only once after the metadata resolving process is finished\n if (buildState.warnings.size > 0) {\n for (const warning of buildState.warnings) {\n Log.warn(warning)\n }\n }\n\n return postProcessMetadata(\n resolvedMetadata,\n favicon,\n titleTemplates,\n metadataContext\n )\n}\n\nexport async function accumulateViewport(\n viewportItems: ViewportItems\n): Promise {\n let resolvedViewport: ResolvedViewport = createDefaultViewport()\n\n const resolversAndResults = prerenderViewport(viewportItems)\n let i = 0\n\n while (i < resolversAndResults.length) {\n let pendingViewport = resolversAndResults[i++]\n if (typeof pendingViewport === 'function') {\n // this viewport item had a `generateViewport` and\n // we need to provide the currently resolved viewport\n // to it before we continue;\n const resolveParentViewport = pendingViewport\n // we know that the next item is a result if this item\n // was a resolver\n pendingViewport = resolversAndResults[i++] as Result\n\n resolveParentViewport(freezeInDev(resolvedViewport))\n }\n // Otherwise the item was either null or a static export\n\n let viewport: Viewport | null\n if (isPromiseLike(pendingViewport)) {\n viewport = await pendingViewport\n } else {\n viewport = pendingViewport\n }\n\n resolvedViewport = mergeViewport({ resolvedViewport, viewport })\n }\n\n return resolvedViewport\n}\n\n// Exposed API for metadata component, that directly resolve the loader tree and related context as resolved metadata.\nexport async function resolveMetadata(\n tree: LoaderTree,\n pathname: Promise,\n searchParams: Promise,\n errorConvention: MetadataErrorType | undefined,\n interpolatedParams: Params,\n metadataContext: MetadataContext\n): Promise {\n const metadataItems = await resolveMetadataItems(\n tree,\n searchParams,\n errorConvention,\n interpolatedParams\n )\n const workStore = workAsyncStorage.getStore()\n if (!workStore) {\n throw new InvariantError('Expected workStore to be initialized')\n }\n return accumulateMetadata(\n workStore.route,\n metadataItems,\n pathname,\n metadataContext\n )\n}\n\n// Exposed API for viewport component, that directly resolve the loader tree and related context as resolved viewport.\nexport async function resolveViewport(\n tree: LoaderTree,\n searchParams: Promise,\n errorConvention: MetadataErrorType | undefined,\n interpolatedParams: Params\n): Promise {\n const viewportItems = await resolveViewportItems(\n tree,\n searchParams,\n errorConvention,\n interpolatedParams\n )\n return accumulateViewport(viewportItems)\n}\n\nfunction isPromiseLike(\n value: unknown | PromiseLike\n): value is PromiseLike {\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof (value as PromiseLike).then === 'function'\n )\n}\n"],"names":["accumulateMetadata","accumulateViewport","createSelectedMetadata","resolveMetadata","resolveViewport","collectMetadata","tree","metadataItems","errorMetadataItem","props","route","errorConvention","mod","modType","hasErrorConventionComponent","Boolean","getComponentTypeModule","layoutOrPageMod","layoutOrPageModType","getLayoutOrPageModule","staticFilesMetadata","resolveStaticMetadata","metadataExport","getDefinedMetadata","push","errorMod","errorMetadataExport","collectViewport","viewportItems","errorViewportItemRef","viewportExport","getDefinedViewport","errorViewportExport","current","resolveMetadataItems","cache","searchParams","interpolatedParams","parentParams","treePrefix","undefined","resolveMetadataItemsImpl","parentOptionalCatchAllParamName","segment","parallelRoutes","page","currentTreePrefix","length","isPage","currentParams","segmentParam","getSegmentParam","value","paramName","optionalCatchAllParamName","paramType","params","createServerParamsForMetadata","filter","s","PAGE_SEGMENT_KEY","join","key","childTree","Object","keys","resolveViewportItems","resolveViewportItemsImpl","layerProps","prerenderMetadata","resolversAndResults","i","getResult","prerenderViewport","noop","exportForResult","useCacheFunctionInfo","getUseCacheFunctionInfo","$$original","usedArgs","promise","Promise","resolve","createLazyResult","result","catch","err","__nextError","freezeInDev","obj","process","env","NODE_ENV","require","deepFreeze","pathname","metadataContext","resolvedMetadata","createDefaultMetadata","titleTemplates","title","twitter","openGraph","buildState","warnings","Set","favicon","leafSegmentStaticIcons","icon","apple","resultIndex","isFavicon","iconMod","shift","pendingMetadata","resolveParentMetadata","metadata","isPromiseLike","mergeMetadata","template","icons","unshift","size","warning","Log","warn","postProcessMetadata","resolvedViewport","createDefaultViewport","pendingViewport","resolveParentViewport","viewport","mergeViewport","workStore","workAsyncStorage","getStore","InvariantError","then"],"mappings":";;;;;;;;;;;;;;;;;;IA+dsBA,kBAAkB;eAAlBA;;IAkHAC,kBAAkB;eAAlBA;;IAxhBbC,sBAAsB;eAAtBA,oDAAsB;;IA6jBTC,eAAe;eAAfA;;IA2BAC,eAAe;eAAfA;;;iCA3oBU;0CAIC;gCACF;QAIxB;uBAEe;iCAIf;8BAIA;yBAC0B;6DACZ;wBACyB;2CACN;4BACP;8CAmB1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUP,4FAA4F;AAC5F,eAAeC,gBAAgB,EAC7BC,IAAI,EACJC,aAAa,EACbC,iBAAiB,EACjBC,KAAK,EACLC,KAAK,EACLC,eAAe,EAQhB;IACC,IAAIC;IACJ,IAAIC;IACJ,MAAMC,8BAA8BC,QAClCJ,mBAAmBL,IAAI,CAAC,EAAE,CAACK,gBAAgB;IAE7C,IAAIA,iBAAiB;QACnBC,MAAM,MAAMI,IAAAA,oCAAsB,EAACV,MAAM;QACzCO,UAAUF;IACZ,OAAO;QACL,MAAM,EAAEC,KAAKK,eAAe,EAAEJ,SAASK,mBAAmB,EAAE,GAC1D,MAAMC,IAAAA,mCAAqB,EAACb;QAC9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YAAqC,EACrCzB,eAA8C,EAC9C0B,kBAA0B,EAC1B2D,eAAgC;IAEhC,MAAMzF,gBAAgB,MAAM2B,qBAC1B5B,MACA8B,cACAzB,iBACA0B;IAEF,MAAMgG,YAAYC,0CAAgB,CAACC,QAAQ;IAC3C,IAAI,CAACF,WAAW;QACd,MAAM,IAAIG,8BAAc,CAAC;IAC3B;IACA,OAAOxI,mBACLqI,UAAU3H,KAAK,EACfH,eACAwF,UACAC;AAEJ;AAGO,eAAe5F,gBACpBE,IAAgB,EAChB8B,YAAqC,EACrCzB,eAA8C,EAC9C0B,kBAA0B;IAE1B,MAAMT,gBAAgB,MAAMsC,qBAC1B5D,MACA8B,cACAzB,iBACA0B;IAEF,OAAOpC,mBAAmB2B;AAC5B;AAEA,SAASyF,cACPjE,KAA+B;IAE/B,OACE,OAAOA,UAAU,YACjBA,UAAU,QACV,OAAO,AAACA,MAA+BqF,IAAI,KAAK;AAEpD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-basics.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-basics.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3b80dc57c1e426834ea448c1c170b4152efcac91 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-basics.d.ts @@ -0,0 +1,24 @@ +import type { Viewport } from '../types/metadata-interface'; +import type { FieldResolver, AsyncFieldResolverExtraArgs, MetadataContext } from '../types/resolvers'; +import { type MetadataBaseURL } from './resolve-url'; +export declare const resolveThemeColor: FieldResolver<'themeColor', Viewport>; +export declare const resolveAlternates: AsyncFieldResolverExtraArgs<'alternates', [ + MetadataBaseURL, + Promise, + MetadataContext +]>; +export declare const resolveRobots: FieldResolver<'robots'>; +export declare const resolveVerification: FieldResolver<'verification'>; +export declare const resolveAppleWebApp: FieldResolver<'appleWebApp'>; +export declare const resolveAppLinks: FieldResolver<'appLinks'>; +export declare const resolveItunes: AsyncFieldResolverExtraArgs<'itunes', [ + MetadataBaseURL, + Promise, + MetadataContext +]>; +export declare const resolveFacebook: FieldResolver<'facebook'>; +export declare const resolvePagination: AsyncFieldResolverExtraArgs<'pagination', [ + MetadataBaseURL, + Promise, + MetadataContext +]>; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-basics.js b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-basics.js new file mode 100644 index 0000000000000000000000000000000000000000..c6d22d9aeb872f941a5e0495a26d1f1aa06f341d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-basics.js @@ -0,0 +1,232 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + resolveAlternates: null, + resolveAppLinks: null, + resolveAppleWebApp: null, + resolveFacebook: null, + resolveItunes: null, + resolvePagination: null, + resolveRobots: null, + resolveThemeColor: null, + resolveVerification: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + resolveAlternates: function() { + return resolveAlternates; + }, + resolveAppLinks: function() { + return resolveAppLinks; + }, + resolveAppleWebApp: function() { + return resolveAppleWebApp; + }, + resolveFacebook: function() { + return resolveFacebook; + }, + resolveItunes: function() { + return resolveItunes; + }, + resolvePagination: function() { + return resolvePagination; + }, + resolveRobots: function() { + return resolveRobots; + }, + resolveThemeColor: function() { + return resolveThemeColor; + }, + resolveVerification: function() { + return resolveVerification; + } +}); +const _utils = require("../generate/utils"); +const _resolveurl = require("./resolve-url"); +function resolveAlternateUrl(url, metadataBase, pathname, metadataContext) { + // If alter native url is an URL instance, + // we treat it as a URL base and resolve with current pathname + if (url instanceof URL) { + const newUrl = new URL(pathname, url); + url.searchParams.forEach((value, key)=>newUrl.searchParams.set(key, value)); + url = newUrl; + } + return (0, _resolveurl.resolveAbsoluteUrlWithPathname)(url, metadataBase, pathname, metadataContext); +} +const resolveThemeColor = (themeColor)=>{ + var _resolveAsArrayOrUndefined; + if (!themeColor) return null; + const themeColorDescriptors = []; + (_resolveAsArrayOrUndefined = (0, _utils.resolveAsArrayOrUndefined)(themeColor)) == null ? void 0 : _resolveAsArrayOrUndefined.forEach((descriptor)=>{ + if (typeof descriptor === 'string') themeColorDescriptors.push({ + color: descriptor + }); + else if (typeof descriptor === 'object') themeColorDescriptors.push({ + color: descriptor.color, + media: descriptor.media + }); + }); + return themeColorDescriptors; +}; +async function resolveUrlValuesOfObject(obj, metadataBase, pathname, metadataContext) { + if (!obj) return null; + const result = {}; + for (const [key, value] of Object.entries(obj)){ + if (typeof value === 'string' || value instanceof URL) { + const pathnameForUrl = await pathname; + result[key] = [ + { + url: resolveAlternateUrl(value, metadataBase, pathnameForUrl, metadataContext) + } + ]; + } else if (value && value.length) { + result[key] = []; + const pathnameForUrl = await pathname; + value.forEach((item, index)=>{ + const url = resolveAlternateUrl(item.url, metadataBase, pathnameForUrl, metadataContext); + result[key][index] = { + url, + title: item.title + }; + }); + } + } + return result; +} +async function resolveCanonicalUrl(urlOrDescriptor, metadataBase, pathname, metadataContext) { + if (!urlOrDescriptor) return null; + const url = typeof urlOrDescriptor === 'string' || urlOrDescriptor instanceof URL ? urlOrDescriptor : urlOrDescriptor.url; + const pathnameForUrl = await pathname; + // Return string url because structureClone can't handle URL instance + return { + url: resolveAlternateUrl(url, metadataBase, pathnameForUrl, metadataContext) + }; +} +const resolveAlternates = async (alternates, metadataBase, pathname, context)=>{ + if (!alternates) return null; + const canonical = await resolveCanonicalUrl(alternates.canonical, metadataBase, pathname, context); + const languages = await resolveUrlValuesOfObject(alternates.languages, metadataBase, pathname, context); + const media = await resolveUrlValuesOfObject(alternates.media, metadataBase, pathname, context); + const types = await resolveUrlValuesOfObject(alternates.types, metadataBase, pathname, context); + return { + canonical, + languages, + media, + types + }; +}; +const robotsKeys = [ + 'noarchive', + 'nosnippet', + 'noimageindex', + 'nocache', + 'notranslate', + 'indexifembedded', + 'nositelinkssearchbox', + 'unavailable_after', + 'max-video-preview', + 'max-image-preview', + 'max-snippet' +]; +const resolveRobotsValue = (robots)=>{ + if (!robots) return null; + if (typeof robots === 'string') return robots; + const values = []; + if (robots.index) values.push('index'); + else if (typeof robots.index === 'boolean') values.push('noindex'); + if (robots.follow) values.push('follow'); + else if (typeof robots.follow === 'boolean') values.push('nofollow'); + for (const key of robotsKeys){ + const value = robots[key]; + if (typeof value !== 'undefined' && value !== false) { + values.push(typeof value === 'boolean' ? key : `${key}:${value}`); + } + } + return values.join(', '); +}; +const resolveRobots = (robots)=>{ + if (!robots) return null; + return { + basic: resolveRobotsValue(robots), + googleBot: typeof robots !== 'string' ? resolveRobotsValue(robots.googleBot) : null + }; +}; +const VerificationKeys = [ + 'google', + 'yahoo', + 'yandex', + 'me', + 'other' +]; +const resolveVerification = (verification)=>{ + if (!verification) return null; + const res = {}; + for (const key of VerificationKeys){ + const value = verification[key]; + if (value) { + if (key === 'other') { + res.other = {}; + for(const otherKey in verification.other){ + const otherValue = (0, _utils.resolveAsArrayOrUndefined)(verification.other[otherKey]); + if (otherValue) res.other[otherKey] = otherValue; + } + } else res[key] = (0, _utils.resolveAsArrayOrUndefined)(value); + } + } + return res; +}; +const resolveAppleWebApp = (appWebApp)=>{ + var _resolveAsArrayOrUndefined; + if (!appWebApp) return null; + if (appWebApp === true) { + return { + capable: true + }; + } + const startupImages = appWebApp.startupImage ? (_resolveAsArrayOrUndefined = (0, _utils.resolveAsArrayOrUndefined)(appWebApp.startupImage)) == null ? void 0 : _resolveAsArrayOrUndefined.map((item)=>typeof item === 'string' ? { + url: item + } : item) : null; + return { + capable: 'capable' in appWebApp ? !!appWebApp.capable : true, + title: appWebApp.title || null, + startupImage: startupImages, + statusBarStyle: appWebApp.statusBarStyle || 'default' + }; +}; +const resolveAppLinks = (appLinks)=>{ + if (!appLinks) return null; + for(const key in appLinks){ + // @ts-ignore // TODO: type infer + appLinks[key] = (0, _utils.resolveAsArrayOrUndefined)(appLinks[key]); + } + return appLinks; +}; +const resolveItunes = async (itunes, metadataBase, pathname, context)=>{ + if (!itunes) return null; + return { + appId: itunes.appId, + appArgument: itunes.appArgument ? resolveAlternateUrl(itunes.appArgument, metadataBase, await pathname, context) : undefined + }; +}; +const resolveFacebook = (facebook)=>{ + if (!facebook) return null; + return { + appId: facebook.appId, + admins: (0, _utils.resolveAsArrayOrUndefined)(facebook.admins) + }; +}; +const resolvePagination = async (pagination, metadataBase, pathname, context)=>{ + return { + previous: (pagination == null ? void 0 : pagination.previous) ? resolveAlternateUrl(pagination.previous, metadataBase, await pathname, context) : null, + next: (pagination == null ? void 0 : pagination.next) ? resolveAlternateUrl(pagination.next, metadataBase, await pathname, context) : null + }; +}; + +//# sourceMappingURL=resolve-basics.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-basics.js.map b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-basics.js.map new file mode 100644 index 0000000000000000000000000000000000000000..13304b3df66c539a3006201961075b1c9ca2153f --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-basics.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/lib/metadata/resolvers/resolve-basics.ts"],"sourcesContent":["import type { AlternateLinkDescriptor } from '../types/alternative-urls-types'\nimport type {\n Metadata,\n ResolvedMetadataWithURLs,\n Viewport,\n} from '../types/metadata-interface'\nimport type { ResolvedVerification } from '../types/metadata-types'\nimport type {\n FieldResolver,\n AsyncFieldResolverExtraArgs,\n MetadataContext,\n} from '../types/resolvers'\nimport { resolveAsArrayOrUndefined } from '../generate/utils'\nimport {\n resolveAbsoluteUrlWithPathname,\n type MetadataBaseURL,\n} from './resolve-url'\n\nfunction resolveAlternateUrl(\n url: string | URL,\n metadataBase: MetadataBaseURL,\n pathname: string,\n metadataContext: MetadataContext\n) {\n // If alter native url is an URL instance,\n // we treat it as a URL base and resolve with current pathname\n if (url instanceof URL) {\n const newUrl = new URL(pathname, url)\n url.searchParams.forEach((value, key) =>\n newUrl.searchParams.set(key, value)\n )\n url = newUrl\n }\n return resolveAbsoluteUrlWithPathname(\n url,\n metadataBase,\n pathname,\n metadataContext\n )\n}\n\nexport const resolveThemeColor: FieldResolver<'themeColor', Viewport> = (\n themeColor\n) => {\n if (!themeColor) return null\n const themeColorDescriptors: Viewport['themeColor'] = []\n\n resolveAsArrayOrUndefined(themeColor)?.forEach((descriptor) => {\n if (typeof descriptor === 'string')\n themeColorDescriptors.push({ color: descriptor })\n else if (typeof descriptor === 'object')\n themeColorDescriptors.push({\n color: descriptor.color,\n media: descriptor.media,\n })\n })\n\n return themeColorDescriptors\n}\n\nasync function resolveUrlValuesOfObject(\n obj:\n | Record<\n string,\n string | URL | AlternateLinkDescriptor[] | null | undefined\n >\n | null\n | undefined,\n metadataBase: MetadataBaseURL,\n pathname: Promise,\n metadataContext: MetadataContext\n): Promise> {\n if (!obj) return null\n\n const result: Record = {}\n for (const [key, value] of Object.entries(obj)) {\n if (typeof value === 'string' || value instanceof URL) {\n const pathnameForUrl = await pathname\n result[key] = [\n {\n url: resolveAlternateUrl(\n value,\n metadataBase,\n pathnameForUrl,\n metadataContext\n ),\n },\n ]\n } else if (value && value.length) {\n result[key] = []\n const pathnameForUrl = await pathname\n value.forEach((item, index) => {\n const url = resolveAlternateUrl(\n item.url,\n metadataBase,\n pathnameForUrl,\n metadataContext\n )\n result[key][index] = {\n url,\n title: item.title,\n }\n })\n }\n }\n return result\n}\n\nasync function resolveCanonicalUrl(\n urlOrDescriptor: string | URL | null | AlternateLinkDescriptor | undefined,\n metadataBase: MetadataBaseURL,\n pathname: Promise,\n metadataContext: MetadataContext\n): Promise {\n if (!urlOrDescriptor) return null\n\n const url =\n typeof urlOrDescriptor === 'string' || urlOrDescriptor instanceof URL\n ? urlOrDescriptor\n : urlOrDescriptor.url\n\n const pathnameForUrl = await pathname\n\n // Return string url because structureClone can't handle URL instance\n return {\n url: resolveAlternateUrl(\n url,\n metadataBase,\n pathnameForUrl,\n metadataContext\n ),\n }\n}\n\nexport const resolveAlternates: AsyncFieldResolverExtraArgs<\n 'alternates',\n [MetadataBaseURL, Promise, MetadataContext]\n> = async (alternates, metadataBase, pathname, context) => {\n if (!alternates) return null\n\n const canonical = await resolveCanonicalUrl(\n alternates.canonical,\n metadataBase,\n pathname,\n context\n )\n const languages = await resolveUrlValuesOfObject(\n alternates.languages,\n metadataBase,\n pathname,\n context\n )\n const media = await resolveUrlValuesOfObject(\n alternates.media,\n metadataBase,\n pathname,\n context\n )\n const types = await resolveUrlValuesOfObject(\n alternates.types,\n metadataBase,\n pathname,\n context\n )\n\n return {\n canonical,\n languages,\n media,\n types,\n }\n}\n\nconst robotsKeys = [\n 'noarchive',\n 'nosnippet',\n 'noimageindex',\n 'nocache',\n 'notranslate',\n 'indexifembedded',\n 'nositelinkssearchbox',\n 'unavailable_after',\n 'max-video-preview',\n 'max-image-preview',\n 'max-snippet',\n] as const\nconst resolveRobotsValue: (robots: Metadata['robots']) => string | null = (\n robots\n) => {\n if (!robots) return null\n if (typeof robots === 'string') return robots\n\n const values: string[] = []\n\n if (robots.index) values.push('index')\n else if (typeof robots.index === 'boolean') values.push('noindex')\n\n if (robots.follow) values.push('follow')\n else if (typeof robots.follow === 'boolean') values.push('nofollow')\n\n for (const key of robotsKeys) {\n const value = robots[key]\n if (typeof value !== 'undefined' && value !== false) {\n values.push(typeof value === 'boolean' ? key : `${key}:${value}`)\n }\n }\n\n return values.join(', ')\n}\n\nexport const resolveRobots: FieldResolver<'robots'> = (robots) => {\n if (!robots) return null\n return {\n basic: resolveRobotsValue(robots),\n googleBot:\n typeof robots !== 'string' ? resolveRobotsValue(robots.googleBot) : null,\n }\n}\n\nconst VerificationKeys = ['google', 'yahoo', 'yandex', 'me', 'other'] as const\nexport const resolveVerification: FieldResolver<'verification'> = (\n verification\n) => {\n if (!verification) return null\n const res: ResolvedVerification = {}\n\n for (const key of VerificationKeys) {\n const value = verification[key]\n if (value) {\n if (key === 'other') {\n res.other = {}\n for (const otherKey in verification.other) {\n const otherValue = resolveAsArrayOrUndefined(\n verification.other[otherKey]\n )\n if (otherValue) res.other[otherKey] = otherValue\n }\n } else res[key] = resolveAsArrayOrUndefined(value) as (string | number)[]\n }\n }\n return res\n}\n\nexport const resolveAppleWebApp: FieldResolver<'appleWebApp'> = (appWebApp) => {\n if (!appWebApp) return null\n if (appWebApp === true) {\n return {\n capable: true,\n }\n }\n\n const startupImages = appWebApp.startupImage\n ? resolveAsArrayOrUndefined(appWebApp.startupImage)?.map((item) =>\n typeof item === 'string' ? { url: item } : item\n )\n : null\n\n return {\n capable: 'capable' in appWebApp ? !!appWebApp.capable : true,\n title: appWebApp.title || null,\n startupImage: startupImages,\n statusBarStyle: appWebApp.statusBarStyle || 'default',\n }\n}\n\nexport const resolveAppLinks: FieldResolver<'appLinks'> = (appLinks) => {\n if (!appLinks) return null\n for (const key in appLinks) {\n // @ts-ignore // TODO: type infer\n appLinks[key] = resolveAsArrayOrUndefined(appLinks[key])\n }\n return appLinks as ResolvedMetadataWithURLs['appLinks']\n}\n\nexport const resolveItunes: AsyncFieldResolverExtraArgs<\n 'itunes',\n [MetadataBaseURL, Promise, MetadataContext]\n> = async (itunes, metadataBase, pathname, context) => {\n if (!itunes) return null\n return {\n appId: itunes.appId,\n appArgument: itunes.appArgument\n ? resolveAlternateUrl(\n itunes.appArgument,\n metadataBase,\n await pathname,\n context\n )\n : undefined,\n }\n}\n\nexport const resolveFacebook: FieldResolver<'facebook'> = (facebook) => {\n if (!facebook) return null\n return {\n appId: facebook.appId,\n admins: resolveAsArrayOrUndefined(facebook.admins),\n }\n}\n\nexport const resolvePagination: AsyncFieldResolverExtraArgs<\n 'pagination',\n [MetadataBaseURL, Promise, MetadataContext]\n> = async (pagination, metadataBase, pathname, context) => {\n return {\n previous: pagination?.previous\n ? resolveAlternateUrl(\n pagination.previous,\n metadataBase,\n await pathname,\n context\n )\n : null,\n next: pagination?.next\n ? resolveAlternateUrl(\n pagination.next,\n metadataBase,\n await pathname,\n context\n )\n : null,\n }\n}\n"],"names":["resolveAlternates","resolveAppLinks","resolveAppleWebApp","resolveFacebook","resolveItunes","resolvePagination","resolveRobots","resolveThemeColor","resolveVerification","resolveAlternateUrl","url","metadataBase","pathname","metadataContext","URL","newUrl","searchParams","forEach","value","key","set","resolveAbsoluteUrlWithPathname","themeColor","resolveAsArrayOrUndefined","themeColorDescriptors","descriptor","push","color","media","resolveUrlValuesOfObject","obj","result","Object","entries","pathnameForUrl","length","item","index","title","resolveCanonicalUrl","urlOrDescriptor","alternates","context","canonical","languages","types","robotsKeys","resolveRobotsValue","robots","values","follow","join","basic","googleBot","VerificationKeys","verification","res","other","otherKey","otherValue","appWebApp","capable","startupImages","startupImage","map","statusBarStyle","appLinks","itunes","appId","appArgument","undefined","facebook","admins","pagination","previous","next"],"mappings":";;;;;;;;;;;;;;;;;;;;;;IAsIaA,iBAAiB;eAAjBA;;IAmIAC,eAAe;eAAfA;;IAtBAC,kBAAkB;eAAlBA;;IAiDAC,eAAe;eAAfA;;IAlBAC,aAAa;eAAbA;;IA0BAC,iBAAiB;eAAjBA;;IA1FAC,aAAa;eAAbA;;IAzKAC,iBAAiB;eAAjBA;;IAmLAC,mBAAmB;eAAnBA;;;uBAhN6B;4BAInC;AAEP,SAASC,oBACPC,GAAiB,EACjBC,YAA6B,EAC7BC,QAAgB,EAChBC,eAAgC;IAEhC,0CAA0C;IAC1C,8DAA8D;IAC9D,IAAIH,eAAeI,KAAK;QACtB,MAAMC,SAAS,IAAID,IAAIF,UAAUF;QACjCA,IAAIM,YAAY,CAACC,OAAO,CAAC,CAACC,OAAOC,MAC/BJ,OAAOC,YAAY,CAACI,GAAG,CAACD,KAAKD;QAE/BR,MAAMK;IACR;IACA,OAAOM,IAAAA,0CAA8B,EACnCX,KACAC,cACAC,UACAC;AAEJ;AAEO,MAAMN,oBAA2D,CACtEe;QAKAC;IAHA,IAAI,CAACD,YAAY,OAAO;IACxB,MAAME,wBAAgD,EAAE;KAExDD,6BAAAA,I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EO,MAAMhE,kBAA6C,CAACiE;IACzD,IAAI,CAACA,UAAU,OAAO;IACtB,IAAK,MAAM/C,OAAO+C,SAAU;QAC1B,iCAAiC;QACjCA,QAAQ,CAAC/C,IAAI,GAAGI,IAAAA,gCAAyB,EAAC2C,QAAQ,CAAC/C,IAAI;IACzD;IACA,OAAO+C;AACT;AAEO,MAAM9D,gBAGT,OAAO+D,QAAQxD,cAAcC,UAAU8B;IACzC,IAAI,CAACyB,QAAQ,OAAO;IACpB,OAAO;QACLC,OAAOD,OAAOC,KAAK;QACnBC,aAAaF,OAAOE,WAAW,GAC3B5D,oBACE0D,OAAOE,WAAW,EAClB1D,cACA,MAAMC,UACN8B,WAEF4B;IACN;AACF;AAEO,MAAMnE,kBAA6C,CAACoE;IACzD,IAAI,CAACA,UAAU,OAAO;IACtB,OAAO;QACLH,OAAOG,SAASH,KAAK;QACrBI,QAAQjD,IAAAA,gCAAyB,EAACgD,SAASC,MAAM;IACnD;AACF;AAEO,MAAMnE,oBAGT,OAAOoE,YAAY9D,cAAcC,UAAU8B;IAC7C,OAAO;QACLgC,UAAUD,CAAAA,8BAAAA,WAAYC,QAAQ,IAC1BjE,oBACEgE,WAAWC,QAAQ,EACnB/D,cACA,MAAMC,UACN8B,WAEF;QACJiC,MAAMF,CAAAA,8BAAAA,WAAYE,IAAI,IAClBlE,oBACEgE,WAAWE,IAAI,EACfhE,cACA,MAAMC,UACN8B,WAEF;IACN;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-icons.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-icons.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d278abf70113cf55fd7ab79e30ebdff5ec2598fa --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-icons.d.ts @@ -0,0 +1,4 @@ +import type { Icon, IconDescriptor } from '../types/metadata-types'; +import type { FieldResolver } from '../types/resolvers'; +export declare function resolveIcon(icon: Icon): IconDescriptor; +export declare const resolveIcons: FieldResolver<'icons'>; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-icons.js b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-icons.js new file mode 100644 index 0000000000000000000000000000000000000000..0ba0df0b13709e71ce3116916acb7c6333deaaa7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-icons.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + resolveIcon: null, + resolveIcons: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + resolveIcon: function() { + return resolveIcon; + }, + resolveIcons: function() { + return resolveIcons; + } +}); +const _utils = require("../generate/utils"); +const _resolveurl = require("./resolve-url"); +const _constants = require("../constants"); +function resolveIcon(icon) { + if ((0, _resolveurl.isStringOrURL)(icon)) return { + url: icon + }; + else if (Array.isArray(icon)) return icon; + return icon; +} +const resolveIcons = (icons)=>{ + if (!icons) { + return null; + } + const resolved = { + icon: [], + apple: [] + }; + if (Array.isArray(icons)) { + resolved.icon = icons.map(resolveIcon).filter(Boolean); + } else if ((0, _resolveurl.isStringOrURL)(icons)) { + resolved.icon = [ + resolveIcon(icons) + ]; + } else { + for (const key of _constants.IconKeys){ + const values = (0, _utils.resolveAsArrayOrUndefined)(icons[key]); + if (values) resolved[key] = values.map(resolveIcon); + } + } + return resolved; +}; + +//# sourceMappingURL=resolve-icons.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-icons.js.map b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-icons.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3a323851ee2603590ffafda2098125007bc0aadb --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-icons.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/lib/metadata/resolvers/resolve-icons.ts"],"sourcesContent":["import type { ResolvedMetadataWithURLs } from '../types/metadata-interface'\nimport type { Icon, IconDescriptor } from '../types/metadata-types'\nimport type { FieldResolver } from '../types/resolvers'\nimport { resolveAsArrayOrUndefined } from '../generate/utils'\nimport { isStringOrURL } from './resolve-url'\nimport { IconKeys } from '../constants'\n\nexport function resolveIcon(icon: Icon): IconDescriptor {\n if (isStringOrURL(icon)) return { url: icon }\n else if (Array.isArray(icon)) return icon\n return icon\n}\n\nexport const resolveIcons: FieldResolver<'icons'> = (icons) => {\n if (!icons) {\n return null\n }\n\n const resolved: ResolvedMetadataWithURLs['icons'] = {\n icon: [],\n apple: [],\n }\n if (Array.isArray(icons)) {\n resolved.icon = icons.map(resolveIcon).filter(Boolean)\n } else if (isStringOrURL(icons)) {\n resolved.icon = [resolveIcon(icons)]\n } else {\n for (const key of IconKeys) {\n const values = resolveAsArrayOrUndefined(icons[key])\n if (values) resolved[key] = values.map(resolveIcon)\n }\n }\n return resolved\n}\n"],"names":["resolveIcon","resolveIcons","icon","isStringOrURL","url","Array","isArray","icons","resolved","apple","map","filter","Boolean","key","IconKeys","values","resolveAsArrayOrUndefined"],"mappings":";;;;;;;;;;;;;;;IAOgBA,WAAW;eAAXA;;IAMHC,YAAY;eAAZA;;;uBAV6B;4BACZ;2BACL;AAElB,SAASD,YAAYE,IAAU;IACpC,IAAIC,IAAAA,yBAAa,EAACD,OAAO,OAAO;QAAEE,KAAKF;IAAK;SACvC,IAAIG,MAAMC,OAAO,CAACJ,OAAO,OAAOA;IACrC,OAAOA;AACT;AAEO,MAAMD,eAAuC,CAACM;IACnD,IAAI,CAACA,OAAO;QACV,OAAO;IACT;IAEA,MAAMC,WAA8C;QAClDN,MAAM,EAAE;QACRO,OAAO,EAAE;IACX;IACA,IAAIJ,MAAMC,OAAO,CAACC,QAAQ;QACxBC,SAASN,IAAI,GAAGK,MAAMG,GAAG,CAACV,aAAaW,MAAM,CAACC;IAChD,OAAO,IAAIT,IAAAA,yBAAa,EAACI,QAAQ;QAC/BC,SAASN,IAAI,GAAG;YAACF,YAAYO;SAAO;IACtC,OAAO;QACL,KAAK,MAAMM,OAAOC,mBAAQ,CAAE;YAC1B,MAAMC,SAASC,IAAAA,gCAAyB,EAACT,KAAK,CAACM,IAAI;YACnD,IAAIE,QAAQP,QAAQ,CAACK,IAAI,GAAGE,OAAOL,GAAG,CAACV;QACzC;IACF;IACA,OAAOQ;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-opengraph.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-opengraph.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d4d55326e29d2344200d9f343bc4dddbbafd5fa6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-opengraph.d.ts @@ -0,0 +1,18 @@ +import type { ResolvedMetadataWithURLs } from '../types/metadata-interface'; +import type { OpenGraph } from '../types/opengraph-types'; +import type { FieldResolverExtraArgs, AsyncFieldResolverExtraArgs, MetadataContext } from '../types/resolvers'; +import type { Twitter } from '../types/twitter-types'; +import { type MetadataBaseURL } from './resolve-url'; +export declare function resolveImages(images: Twitter['images'], metadataBase: MetadataBaseURL, isStaticMetadataRouteFile: boolean): NonNullable['images']; +export declare function resolveImages(images: OpenGraph['images'], metadataBase: MetadataBaseURL, isStaticMetadataRouteFile: boolean): NonNullable['images']; +export declare const resolveOpenGraph: AsyncFieldResolverExtraArgs<'openGraph', [ + MetadataBaseURL, + Promise, + MetadataContext, + string | null +]>; +export declare const resolveTwitter: FieldResolverExtraArgs<'twitter', [ + MetadataBaseURL, + MetadataContext, + string | null +]>; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-opengraph.js b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-opengraph.js new file mode 100644 index 0000000000000000000000000000000000000000..4d53a32df210330cb683a58cdd0a615c72090cd9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-opengraph.js @@ -0,0 +1,199 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + resolveImages: null, + resolveOpenGraph: null, + resolveTwitter: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + resolveImages: function() { + return resolveImages; + }, + resolveOpenGraph: function() { + return resolveOpenGraph; + }, + resolveTwitter: function() { + return resolveTwitter; + } +}); +const _utils = require("../generate/utils"); +const _resolveurl = require("./resolve-url"); +const _resolvetitle = require("./resolve-title"); +const _url = require("../../url"); +const _log = require("../../../build/output/log"); +const OgTypeFields = { + article: [ + 'authors', + 'tags' + ], + song: [ + 'albums', + 'musicians' + ], + playlist: [ + 'albums', + 'musicians' + ], + radio: [ + 'creators' + ], + video: [ + 'actors', + 'directors', + 'writers', + 'tags' + ], + basic: [ + 'emails', + 'phoneNumbers', + 'faxNumbers', + 'alternateLocale', + 'audio', + 'videos' + ] +}; +function resolveAndValidateImage(item, metadataBase, isStaticMetadataRouteFile) { + if (!item) return undefined; + const isItemUrl = (0, _resolveurl.isStringOrURL)(item); + const inputUrl = isItemUrl ? item : item.url; + if (!inputUrl) return undefined; + // process.env.VERCEL is set to "1" when System Environment Variables are + // exposed. When exposed, validation is not necessary since we are falling back to + // process.env.VERCEL_PROJECT_PRODUCTION_URL, process.env.VERCEL_BRANCH_URL, or + // process.env.VERCEL_URL for the `metadataBase`. process.env.VERCEL is undefined + // when System Environment Variables are not exposed. When not exposed, we cannot + // detect in the build environment if the deployment is a Vercel deployment or not. + // + // x-ref: https://vercel.com/docs/projects/environment-variables/system-environment-variables#system-environment-variables + const isUsingVercelSystemEnvironmentVariables = Boolean(process.env.VERCEL); + const isRelativeUrl = typeof inputUrl === 'string' && !(0, _url.isFullStringUrl)(inputUrl); + // When no explicit metadataBase is specified by the user, we'll override it with the fallback metadata + // under the following conditions: + // - The provided URL is relative (ie ./og-image). + // - The image is statically generated by Next.js (such as the special `opengraph-image` route) + // In both cases, we want to ensure that across all environments, the ogImage is a fully qualified URL. + // In the `opengraph-image` case, since the user isn't explicitly passing a relative path, this ensures + // the ogImage will be properly discovered across different environments without the user needing to + // have a bunch of `process.env` checks when defining their `metadataBase`. + if (isRelativeUrl && (!metadataBase || isStaticMetadataRouteFile)) { + const fallbackMetadataBase = (0, _resolveurl.getSocialImageMetadataBaseFallback)(metadataBase); + // When not using Vercel environment variables for URL injection, we aren't able to determine + // a fallback value for `metadataBase`. For self-hosted setups, we want to warn + // about this since the only fallback we'll be able to generate is `localhost`. + // In development, we'll only warn for relative metadata that isn't part of the static + // metadata conventions (eg `opengraph-image`), as otherwise it's currently very noisy + // for common cases. Eventually we should remove this warning all together in favor of + // devtools. + const shouldWarn = !isUsingVercelSystemEnvironmentVariables && !metadataBase && (process.env.NODE_ENV === 'production' || !isStaticMetadataRouteFile); + if (shouldWarn) { + (0, _log.warnOnce)(`metadataBase property in metadata export is not set for resolving social open graph or twitter images, using "${fallbackMetadataBase.origin}". See https://nextjs.org/docs/app/api-reference/functions/generate-metadata#metadatabase`); + } + metadataBase = fallbackMetadataBase; + } + return isItemUrl ? { + url: (0, _resolveurl.resolveUrl)(inputUrl, metadataBase) + } : { + ...item, + // Update image descriptor url + url: (0, _resolveurl.resolveUrl)(inputUrl, metadataBase) + }; +} +function resolveImages(images, metadataBase, isStaticMetadataRouteFile) { + const resolvedImages = (0, _utils.resolveAsArrayOrUndefined)(images); + if (!resolvedImages) return resolvedImages; + const nonNullableImages = []; + for (const item of resolvedImages){ + const resolvedItem = resolveAndValidateImage(item, metadataBase, isStaticMetadataRouteFile); + if (!resolvedItem) continue; + nonNullableImages.push(resolvedItem); + } + return nonNullableImages; +} +const ogTypeToFields = { + article: OgTypeFields.article, + book: OgTypeFields.article, + 'music.song': OgTypeFields.song, + 'music.album': OgTypeFields.song, + 'music.playlist': OgTypeFields.playlist, + 'music.radio_station': OgTypeFields.radio, + 'video.movie': OgTypeFields.video, + 'video.episode': OgTypeFields.video +}; +function getFieldsByOgType(ogType) { + if (!ogType || !(ogType in ogTypeToFields)) return OgTypeFields.basic; + return ogTypeToFields[ogType].concat(OgTypeFields.basic); +} +const resolveOpenGraph = async (openGraph, metadataBase, pathname, metadataContext, titleTemplate)=>{ + if (!openGraph) return null; + function resolveProps(target, og) { + const ogType = og && 'type' in og ? og.type : undefined; + const keys = getFieldsByOgType(ogType); + for (const k of keys){ + const key = k; + if (key in og && key !== 'url') { + const value = og[key]; + target[key] = value ? (0, _utils.resolveArray)(value) : null; + } + } + target.images = resolveImages(og.images, metadataBase, metadataContext.isStaticMetadataRouteFile); + } + const resolved = { + ...openGraph, + title: (0, _resolvetitle.resolveTitle)(openGraph.title, titleTemplate) + }; + resolveProps(resolved, openGraph); + resolved.url = openGraph.url ? (0, _resolveurl.resolveAbsoluteUrlWithPathname)(openGraph.url, metadataBase, await pathname, metadataContext) : null; + return resolved; +}; +const TwitterBasicInfoKeys = [ + 'site', + 'siteId', + 'creator', + 'creatorId', + 'description' +]; +const resolveTwitter = (twitter, metadataBase, metadataContext, titleTemplate)=>{ + var _resolved_images; + if (!twitter) return null; + let card = 'card' in twitter ? twitter.card : undefined; + const resolved = { + ...twitter, + title: (0, _resolvetitle.resolveTitle)(twitter.title, titleTemplate) + }; + for (const infoKey of TwitterBasicInfoKeys){ + resolved[infoKey] = twitter[infoKey] || null; + } + resolved.images = resolveImages(twitter.images, metadataBase, metadataContext.isStaticMetadataRouteFile); + card = card || (((_resolved_images = resolved.images) == null ? void 0 : _resolved_images.length) ? 'summary_large_image' : 'summary'); + resolved.card = card; + if ('card' in resolved) { + switch(resolved.card){ + case 'player': + { + resolved.players = (0, _utils.resolveAsArrayOrUndefined)(resolved.players) || []; + break; + } + case 'app': + { + resolved.app = resolved.app || {}; + break; + } + case 'summary': + case 'summary_large_image': + break; + default: + resolved; + } + } + return resolved; +}; + +//# sourceMappingURL=resolve-opengraph.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-opengraph.js.map b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-opengraph.js.map new file mode 100644 index 0000000000000000000000000000000000000000..21649d1dff54f346a6277edbed023e9c9f1a4184 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-opengraph.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/lib/metadata/resolvers/resolve-opengraph.ts"],"sourcesContent":["import type { ResolvedMetadataWithURLs } from '../types/metadata-interface'\nimport type {\n OpenGraphType,\n OpenGraph,\n ResolvedOpenGraph,\n} from '../types/opengraph-types'\nimport type {\n FieldResolverExtraArgs,\n AsyncFieldResolverExtraArgs,\n MetadataContext,\n} from '../types/resolvers'\nimport type { ResolvedTwitterMetadata, Twitter } from '../types/twitter-types'\nimport { resolveArray, resolveAsArrayOrUndefined } from '../generate/utils'\nimport {\n getSocialImageMetadataBaseFallback,\n isStringOrURL,\n resolveUrl,\n resolveAbsoluteUrlWithPathname,\n type MetadataBaseURL,\n} from './resolve-url'\nimport { resolveTitle } from './resolve-title'\nimport { isFullStringUrl } from '../../url'\nimport { warnOnce } from '../../../build/output/log'\n\ntype FlattenArray = T extends (infer U)[] ? U : T\n\nconst OgTypeFields = {\n article: ['authors', 'tags'],\n song: ['albums', 'musicians'],\n playlist: ['albums', 'musicians'],\n radio: ['creators'],\n video: ['actors', 'directors', 'writers', 'tags'],\n basic: [\n 'emails',\n 'phoneNumbers',\n 'faxNumbers',\n 'alternateLocale',\n 'audio',\n 'videos',\n ],\n} as const\n\nfunction resolveAndValidateImage(\n item: FlattenArray,\n metadataBase: MetadataBaseURL,\n isStaticMetadataRouteFile: boolean | undefined\n) {\n if (!item) return undefined\n const isItemUrl = isStringOrURL(item)\n const inputUrl = isItemUrl ? item : item.url\n if (!inputUrl) return undefined\n\n // process.env.VERCEL is set to \"1\" when System Environment Variables are\n // exposed. When exposed, validation is not necessary since we are falling back to\n // process.env.VERCEL_PROJECT_PRODUCTION_URL, process.env.VERCEL_BRANCH_URL, or\n // process.env.VERCEL_URL for the `metadataBase`. process.env.VERCEL is undefined\n // when System Environment Variables are not exposed. When not exposed, we cannot\n // detect in the build environment if the deployment is a Vercel deployment or not.\n //\n // x-ref: https://vercel.com/docs/projects/environment-variables/system-environment-variables#system-environment-variables\n const isUsingVercelSystemEnvironmentVariables = Boolean(process.env.VERCEL)\n\n const isRelativeUrl =\n typeof inputUrl === 'string' && !isFullStringUrl(inputUrl)\n\n // When no explicit metadataBase is specified by the user, we'll override it with the fallback metadata\n // under the following conditions:\n // - The provided URL is relative (ie ./og-image).\n // - The image is statically generated by Next.js (such as the special `opengraph-image` route)\n // In both cases, we want to ensure that across all environments, the ogImage is a fully qualified URL.\n // In the `opengraph-image` case, since the user isn't explicitly passing a relative path, this ensures\n // the ogImage will be properly discovered across different environments without the user needing to\n // have a bunch of `process.env` checks when defining their `metadataBase`.\n if (isRelativeUrl && (!metadataBase || isStaticMetadataRouteFile)) {\n const fallbackMetadataBase =\n getSocialImageMetadataBaseFallback(metadataBase)\n\n // When not using Vercel environment variables for URL injection, we aren't able to determine\n // a fallback value for `metadataBase`. For self-hosted setups, we want to warn\n // about this since the only fallback we'll be able to generate is `localhost`.\n // In development, we'll only warn for relative metadata that isn't part of the static\n // metadata conventions (eg `opengraph-image`), as otherwise it's currently very noisy\n // for common cases. Eventually we should remove this warning all together in favor of\n // devtools.\n const shouldWarn =\n !isUsingVercelSystemEnvironmentVariables &&\n !metadataBase &&\n (process.env.NODE_ENV === 'production' || !isStaticMetadataRouteFile)\n\n if (shouldWarn) {\n warnOnce(\n `metadataBase property in metadata export is not set for resolving social open graph or twitter images, using \"${fallbackMetadataBase.origin}\". See https://nextjs.org/docs/app/api-reference/functions/generate-metadata#metadatabase`\n )\n }\n\n metadataBase = fallbackMetadataBase\n }\n\n return isItemUrl\n ? {\n url: resolveUrl(inputUrl, metadataBase),\n }\n : {\n ...item,\n // Update image descriptor url\n url: resolveUrl(inputUrl, metadataBase),\n }\n}\n\nexport function resolveImages(\n images: Twitter['images'],\n metadataBase: MetadataBaseURL,\n isStaticMetadataRouteFile: boolean\n): NonNullable['images']\nexport function resolveImages(\n images: OpenGraph['images'],\n metadataBase: MetadataBaseURL,\n isStaticMetadataRouteFile: boolean\n): NonNullable['images']\nexport function resolveImages(\n images: OpenGraph['images'] | Twitter['images'],\n metadataBase: MetadataBaseURL,\n isStaticMetadataRouteFile: boolean\n):\n | NonNullable['images']\n | NonNullable['images'] {\n const resolvedImages = resolveAsArrayOrUndefined(images)\n if (!resolvedImages) return resolvedImages\n\n const nonNullableImages = []\n for (const item of resolvedImages) {\n const resolvedItem = resolveAndValidateImage(\n item,\n metadataBase,\n isStaticMetadataRouteFile\n )\n if (!resolvedItem) continue\n\n nonNullableImages.push(resolvedItem)\n }\n\n return nonNullableImages\n}\n\nconst ogTypeToFields: Record = {\n article: OgTypeFields.article,\n book: OgTypeFields.article,\n 'music.song': OgTypeFields.song,\n 'music.album': OgTypeFields.song,\n 'music.playlist': OgTypeFields.playlist,\n 'music.radio_station': OgTypeFields.radio,\n 'video.movie': OgTypeFields.video,\n 'video.episode': OgTypeFields.video,\n}\n\nfunction getFieldsByOgType(ogType: OpenGraphType | undefined) {\n if (!ogType || !(ogType in ogTypeToFields)) return OgTypeFields.basic\n return ogTypeToFields[ogType].concat(OgTypeFields.basic)\n}\n\nexport const resolveOpenGraph: AsyncFieldResolverExtraArgs<\n 'openGraph',\n [MetadataBaseURL, Promise, MetadataContext, string | null]\n> = async (\n openGraph,\n metadataBase,\n pathname,\n metadataContext,\n titleTemplate\n) => {\n if (!openGraph) return null\n\n function resolveProps(target: ResolvedOpenGraph, og: OpenGraph) {\n const ogType = og && 'type' in og ? og.type : undefined\n const keys = getFieldsByOgType(ogType)\n for (const k of keys) {\n const key = k as keyof ResolvedOpenGraph\n if (key in og && key !== 'url') {\n const value = og[key]\n // TODO: improve typing inferring\n ;(target as any)[key] = value ? resolveArray(value) : null\n }\n }\n target.images = resolveImages(\n og.images,\n metadataBase,\n metadataContext.isStaticMetadataRouteFile\n )\n }\n\n const resolved = {\n ...openGraph,\n title: resolveTitle(openGraph.title, titleTemplate),\n } as ResolvedOpenGraph\n resolveProps(resolved, openGraph)\n\n resolved.url = openGraph.url\n ? resolveAbsoluteUrlWithPathname(\n openGraph.url,\n metadataBase,\n await pathname,\n metadataContext\n )\n : null\n\n return resolved\n}\n\nconst TwitterBasicInfoKeys = [\n 'site',\n 'siteId',\n 'creator',\n 'creatorId',\n 'description',\n] as const\n\nexport const resolveTwitter: FieldResolverExtraArgs<\n 'twitter',\n [MetadataBaseURL, MetadataContext, string | null]\n> = (twitter, metadataBase, metadataContext, titleTemplate) => {\n if (!twitter) return null\n let card = 'card' in twitter ? twitter.card : undefined\n const resolved = {\n ...twitter,\n title: resolveTitle(twitter.title, titleTemplate),\n } as ResolvedTwitterMetadata\n for (const infoKey of TwitterBasicInfoKeys) {\n resolved[infoKey] = twitter[infoKey] || null\n }\n\n resolved.images = resolveImages(\n twitter.images,\n metadataBase,\n metadataContext.isStaticMetadataRouteFile\n )\n\n card = card || (resolved.images?.length ? 'summary_large_image' : 'summary')\n resolved.card = card\n\n if ('card' in resolved) {\n switch (resolved.card) {\n case 'player': {\n resolved.players = resolveAsArrayOrUndefined(resolved.players) || []\n break\n }\n case 'app': {\n resolved.app = resolved.app || {}\n break\n }\n case 'summary':\n case 'summary_large_image':\n break\n default:\n resolved satisfies never\n }\n }\n\n return resolved\n}\n"],"names":["resolveImages","resolveOpenGraph","resolveTwitter","OgTypeFields","article","song","playlist","radio","video","basic","resolveAndValidateImage","item","metadataBase","isStaticMetadataRouteFile","undefined","isItemUrl","isStringOrURL","inputUrl","url","isUsingVercelSystemEnvironmentVariables","Boolean","process","env","VERCEL","isRelativeUrl","isFullStringUrl","fallbackMetadataBase","getSocialImageMetadataBaseFallback","shouldWarn","NODE_ENV","warnOnce","origin","resolveUrl","images","resolvedImages","resolveAsArrayOrUndefined","nonNullableImages","resolvedItem","push","ogTypeToFields","book","getFieldsByOgType","ogType","concat","openGraph","pathname","metadataContext","titleTemplate","resolveProps","target","og","type","keys","k","key","value","resolveArray","resolved","title","resolveTitle","resolveAbsoluteUrlWithPathname","TwitterBasicInfoKeys","twitter","card","infoKey","length","players","app"],"mappings":";;;;;;;;;;;;;;;;IAuHgBA,aAAa;eAAbA;;IAyCHC,gBAAgB;eAAhBA;;IAwDAC,cAAc;eAAdA;;;uBA5M2C;4BAOjD;8BACsB;qBACG;qBACP;AAIzB,MAAMC,eAAe;IACnBC,SAAS;QAAC;QAAW;KAAO;IAC5BC,MAAM;QAAC;QAAU;KAAY;IAC7BC,UAAU;QAAC;QAAU;KAAY;IACjCC,OAAO;QAAC;KAAW;IACnBC,OAAO;QAAC;QAAU;QAAa;QAAW;KAAO;IACjDC,OAAO;QACL;QACA;QACA;QACA;QACA;QACA;KACD;AACH;AAEA,SAASC,wBACPC,IAA2D,EAC3DC,YAA6B,EAC7BC,yBAA8C;IAE9C,IAAI,CAACF,MAAM,OAAOG;IAClB,MAAMC,YAAYC,IAAAA,yBAAa,EAACL;IAChC,MAAMM,WAAWF,YAAYJ,OAAOA,KAAKO,GAAG;IAC5C,IAAI,CAACD,UAAU,OAAOH;IAEtB,yEAAyE;IACzE,kFAAkF;IAClF,+EAA+E;IAC/E,iFAAiF;IACjF,iFAAiF;IACjF,mFAAmF;IACnF,EAAE;IACF,0HAA0H;IAC1H,MAAMK,0CAA0CC,QAAQC,QAAQC,GAAG,CAACC,MAAM;IAE1E,MAAMC,gBACJ,OAAOP,aAAa,YAAY,CAACQ,IAAAA,oBAAe,EAACR;IAEnD,uGAAuG;IACvG,kCAAkC;IAClC,kDAAkD;IAClD,+FAA+F;IAC/F,uGAAuG;IACvG,uGAAuG;IACvG,oGAAoG;IACpG,2EAA2E;IAC3E,IAAIO,iBAAkB,CAAA,CAACZ,gBAAgBC,yBAAwB,GAAI;QACjE,MAAMa,u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GF,OAAO,CAACE,QAAQ,IAAI;IAC1C;IAEAP,SAASxB,MAAM,GAAGjC,cAChB8D,QAAQ7B,MAAM,EACdrB,cACAkC,gBAAgBjC,yBAAyB;IAG3CkD,OAAOA,QAASN,CAAAA,EAAAA,mBAAAA,SAASxB,MAAM,qBAAfwB,iBAAiBQ,MAAM,IAAG,wBAAwB,SAAQ;IAC1ER,SAASM,IAAI,GAAGA;IAEhB,IAAI,UAAUN,UAAU;QACtB,OAAQA,SAASM,IAAI;YACnB,KAAK;gBAAU;oBACbN,SAASS,OAAO,GAAG/B,IAAAA,gCAAyB,EAACsB,SAASS,OAAO,KAAK,EAAE;oBACpE;gBACF;YACA,KAAK;gBAAO;oBACVT,SAASU,GAAG,GAAGV,SAASU,GAAG,IAAI,CAAC;oBAChC;gBACF;YACA,KAAK;YACL,KAAK;gBACH;YACF;gBACEV;QACJ;IACF;IAEA,OAAOA;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-title.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-title.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..747977762c9a85411392821ee47a6523024c458e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-title.d.ts @@ -0,0 +1,3 @@ +import type { Metadata } from '../types/metadata-interface'; +import type { AbsoluteTemplateString } from '../types/metadata-types'; +export declare function resolveTitle(title: Metadata['title'], stashedTemplate: string | null | undefined): AbsoluteTemplateString; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-title.js b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-title.js new file mode 100644 index 0000000000000000000000000000000000000000..5489e566d058a745e59c2d2e925f681885ba41cb --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-title.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "resolveTitle", { + enumerable: true, + get: function() { + return resolveTitle; + } +}); +function resolveTitleTemplate(template, title) { + return template ? template.replace(/%s/g, title) : title; +} +function resolveTitle(title, stashedTemplate) { + let resolved; + const template = typeof title !== 'string' && title && 'template' in title ? title.template : null; + if (typeof title === 'string') { + resolved = resolveTitleTemplate(stashedTemplate, title); + } else if (title) { + if ('default' in title) { + resolved = resolveTitleTemplate(stashedTemplate, title.default); + } + if ('absolute' in title && title.absolute) { + resolved = title.absolute; + } + } + if (title && typeof title !== 'string') { + return { + template, + absolute: resolved || '' + }; + } else { + return { + absolute: resolved || title || '', + template + }; + } +} + +//# sourceMappingURL=resolve-title.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-title.js.map b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-title.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e3db9add4f8d175a723db4703b2d2b23260918ed --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-title.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/lib/metadata/resolvers/resolve-title.ts"],"sourcesContent":["import type { Metadata } from '../types/metadata-interface'\nimport type { AbsoluteTemplateString } from '../types/metadata-types'\n\nfunction resolveTitleTemplate(\n template: string | null | undefined,\n title: string\n) {\n return template ? template.replace(/%s/g, title) : title\n}\n\nexport function resolveTitle(\n title: Metadata['title'],\n stashedTemplate: string | null | undefined\n): AbsoluteTemplateString {\n let resolved\n const template =\n typeof title !== 'string' && title && 'template' in title\n ? title.template\n : null\n\n if (typeof title === 'string') {\n resolved = resolveTitleTemplate(stashedTemplate, title)\n } else if (title) {\n if ('default' in title) {\n resolved = resolveTitleTemplate(stashedTemplate, title.default)\n }\n if ('absolute' in title && title.absolute) {\n resolved = title.absolute\n }\n }\n\n if (title && typeof title !== 'string') {\n return {\n template,\n absolute: resolved || '',\n }\n } else {\n return { absolute: resolved || title || '', template }\n }\n}\n"],"names":["resolveTitle","resolveTitleTemplate","template","title","replace","stashedTemplate","resolved","default","absolute"],"mappings":";;;;+BAUgBA;;;eAAAA;;;AAPhB,SAASC,qBACPC,QAAmC,EACnCC,KAAa;IAEb,OAAOD,WAAWA,SAASE,OAAO,CAAC,OAAOD,SAASA;AACrD;AAEO,SAASH,aACdG,KAAwB,EACxBE,eAA0C;IAE1C,IAAIC;IACJ,MAAMJ,WACJ,OAAOC,UAAU,YAAYA,SAAS,cAAcA,QAChDA,MAAMD,QAAQ,GACd;IAEN,IAAI,OAAOC,UAAU,UAAU;QAC7BG,WAAWL,qBAAqBI,iBAAiBF;IACnD,OAAO,IAAIA,OAAO;QAChB,IAAI,aAAaA,OAAO;YACtBG,WAAWL,qBAAqBI,iBAAiBF,MAAMI,OAAO;QAChE;QACA,IAAI,cAAcJ,SAASA,MAAMK,QAAQ,EAAE;YACzCF,WAAWH,MAAMK,QAAQ;QAC3B;IACF;IAEA,IAAIL,SAAS,OAAOA,UAAU,UAAU;QACtC,OAAO;YACLD;YACAM,UAAUF,YAAY;QACxB;IACF,OAAO;QACL,OAAO;YAAEE,UAAUF,YAAYH,SAAS;YAAID;QAAS;IACvD;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-url.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-url.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..11989a4c94811bdfe12a7327e1361fd132b5b725 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-url.d.ts @@ -0,0 +1,18 @@ +import type { MetadataContext } from '../types/resolvers'; +export type MetadataBaseURL = URL | null; +declare function isStringOrURL(icon: any): icon is string | URL; +/** + * Given an optional user-provided metadataBase, this determines what the metadataBase should + * fallback to. Specifically: + * - In dev, it should always be localhost + * - In Vercel preview builds, it should be the preview build ID + * - In start, it should be the user-provided metadataBase value. Otherwise, + * it'll fall back to the Vercel production deployment, and localhost as a last resort. + */ +export declare function getSocialImageMetadataBaseFallback(metadataBase: MetadataBaseURL): URL; +declare function resolveUrl(url: null | undefined, metadataBase: MetadataBaseURL): null; +declare function resolveUrl(url: string | URL, metadataBase: MetadataBaseURL): URL; +declare function resolveUrl(url: string | MetadataBaseURL | undefined, metadataBase: MetadataBaseURL): MetadataBaseURL; +declare function resolveRelativeUrl(url: string | URL, pathname: string): string | URL; +declare function resolveAbsoluteUrlWithPathname(url: string | URL, metadataBase: MetadataBaseURL, pathname: string, { trailingSlash }: MetadataContext): string; +export { isStringOrURL, resolveUrl, resolveRelativeUrl, resolveAbsoluteUrlWithPathname, }; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-url.js b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-url.js new file mode 100644 index 0000000000000000000000000000000000000000..7f956f1ebe09696ea36beb9abf1e8598121fce01 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-url.js @@ -0,0 +1,135 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + getSocialImageMetadataBaseFallback: null, + isStringOrURL: null, + resolveAbsoluteUrlWithPathname: null, + resolveRelativeUrl: null, + resolveUrl: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + getSocialImageMetadataBaseFallback: function() { + return getSocialImageMetadataBaseFallback; + }, + isStringOrURL: function() { + return isStringOrURL; + }, + resolveAbsoluteUrlWithPathname: function() { + return resolveAbsoluteUrlWithPathname; + }, + resolveRelativeUrl: function() { + return resolveRelativeUrl; + }, + resolveUrl: function() { + return resolveUrl; + } +}); +const _path = /*#__PURE__*/ _interop_require_default(require("../../../shared/lib/isomorphic/path")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function isStringOrURL(icon) { + return typeof icon === 'string' || icon instanceof URL; +} +function createLocalMetadataBase() { + // Check if experimental HTTPS is enabled + const isExperimentalHttps = Boolean(process.env.__NEXT_EXPERIMENTAL_HTTPS); + const protocol = isExperimentalHttps ? 'https' : 'http'; + return new URL(`${protocol}://localhost:${process.env.PORT || 3000}`); +} +function getPreviewDeploymentUrl() { + const origin = process.env.VERCEL_BRANCH_URL || process.env.VERCEL_URL; + return origin ? new URL(`https://${origin}`) : undefined; +} +function getProductionDeploymentUrl() { + const origin = process.env.VERCEL_PROJECT_PRODUCTION_URL; + return origin ? new URL(`https://${origin}`) : undefined; +} +function getSocialImageMetadataBaseFallback(metadataBase) { + const defaultMetadataBase = createLocalMetadataBase(); + const previewDeploymentUrl = getPreviewDeploymentUrl(); + const productionDeploymentUrl = getProductionDeploymentUrl(); + let fallbackMetadataBase; + if (process.env.NODE_ENV === 'development') { + fallbackMetadataBase = defaultMetadataBase; + } else { + fallbackMetadataBase = process.env.NODE_ENV === 'production' && previewDeploymentUrl && process.env.VERCEL_ENV === 'preview' ? previewDeploymentUrl : metadataBase || productionDeploymentUrl || defaultMetadataBase; + } + return fallbackMetadataBase; +} +function resolveUrl(url, metadataBase) { + if (url instanceof URL) return url; + if (!url) return null; + try { + // If we can construct a URL instance from url, ignore metadataBase + const parsedUrl = new URL(url); + return parsedUrl; + } catch {} + if (!metadataBase) { + metadataBase = createLocalMetadataBase(); + } + // Handle relative or absolute paths + const pathname = metadataBase.pathname || ''; + const joinedPath = _path.default.posix.join(pathname, url); + return new URL(joinedPath, metadataBase); +} +// Resolve with `pathname` if `url` is a relative path. +function resolveRelativeUrl(url, pathname) { + if (typeof url === 'string' && url.startsWith('./')) { + return _path.default.posix.resolve(pathname, url); + } + return url; +} +// The regex is matching logic from packages/next/src/lib/load-custom-routes.ts +const FILE_REGEX = /^(?:\/((?!\.well-known(?:\/.*)?)(?:[^/]+\/)*[^/]+\.\w+))(\/?|$)/i; +function isFilePattern(pathname) { + return FILE_REGEX.test(pathname); +} +// Resolve `pathname` if `url` is a relative path the compose with `metadataBase`. +function resolveAbsoluteUrlWithPathname(url, metadataBase, pathname, { trailingSlash }) { + // Resolve url with pathname that always starts with `/` + url = resolveRelativeUrl(url, pathname); + // Convert string url or URL instance to absolute url string, + // if there's case needs to be resolved with metadataBase + let resolvedUrl = ''; + const result = metadataBase ? resolveUrl(url, metadataBase) : url; + if (typeof result === 'string') { + resolvedUrl = result; + } else { + resolvedUrl = result.pathname === '/' && result.searchParams.size === 0 ? result.origin : result.href; + } + // Add trailing slash if it's enabled for urls matches the condition + // - Not external, same origin with metadataBase + // - Doesn't have query + if (trailingSlash && !resolvedUrl.endsWith('/')) { + let isRelative = resolvedUrl.startsWith('/'); + let hasQuery = resolvedUrl.includes('?'); + let isExternal = false; + let isFileUrl = false; + if (!isRelative) { + try { + const parsedUrl = new URL(resolvedUrl); + isExternal = metadataBase != null && parsedUrl.origin !== metadataBase.origin; + isFileUrl = isFilePattern(parsedUrl.pathname); + } catch { + // If it's not a valid URL, treat it as external + isExternal = true; + } + if (// Do not apply trailing slash for file like urls, aligning with the behavior with `trailingSlash` + !isFileUrl && !isExternal && !hasQuery) return `${resolvedUrl}/`; + } + } + return resolvedUrl; +} + +//# sourceMappingURL=resolve-url.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-url.js.map b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-url.js.map new file mode 100644 index 0000000000000000000000000000000000000000..564fbc886fdbf53564624efe84dfade0b9deb20d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/resolvers/resolve-url.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/lib/metadata/resolvers/resolve-url.ts"],"sourcesContent":["import path from '../../../shared/lib/isomorphic/path'\nimport type { MetadataContext } from '../types/resolvers'\n\nexport type MetadataBaseURL = URL | null\n\nfunction isStringOrURL(icon: any): icon is string | URL {\n return typeof icon === 'string' || icon instanceof URL\n}\n\nfunction createLocalMetadataBase() {\n // Check if experimental HTTPS is enabled\n const isExperimentalHttps = Boolean(process.env.__NEXT_EXPERIMENTAL_HTTPS)\n const protocol = isExperimentalHttps ? 'https' : 'http'\n return new URL(`${protocol}://localhost:${process.env.PORT || 3000}`)\n}\n\nfunction getPreviewDeploymentUrl(): URL | undefined {\n const origin = process.env.VERCEL_BRANCH_URL || process.env.VERCEL_URL\n return origin ? new URL(`https://${origin}`) : undefined\n}\n\nfunction getProductionDeploymentUrl(): URL | undefined {\n const origin = process.env.VERCEL_PROJECT_PRODUCTION_URL\n return origin ? new URL(`https://${origin}`) : undefined\n}\n\n/**\n * Given an optional user-provided metadataBase, this determines what the metadataBase should\n * fallback to. Specifically:\n * - In dev, it should always be localhost\n * - In Vercel preview builds, it should be the preview build ID\n * - In start, it should be the user-provided metadataBase value. Otherwise,\n * it'll fall back to the Vercel production deployment, and localhost as a last resort.\n */\nexport function getSocialImageMetadataBaseFallback(\n metadataBase: MetadataBaseURL\n): URL {\n const defaultMetadataBase = createLocalMetadataBase()\n const previewDeploymentUrl = getPreviewDeploymentUrl()\n const productionDeploymentUrl = getProductionDeploymentUrl()\n\n let fallbackMetadataBase\n if (process.env.NODE_ENV === 'development') {\n fallbackMetadataBase = defaultMetadataBase\n } else {\n fallbackMetadataBase =\n process.env.NODE_ENV === 'production' &&\n previewDeploymentUrl &&\n process.env.VERCEL_ENV === 'preview'\n ? previewDeploymentUrl\n : metadataBase || productionDeploymentUrl || defaultMetadataBase\n }\n\n return fallbackMetadataBase\n}\n\nfunction resolveUrl(url: null | undefined, metadataBase: MetadataBaseURL): null\nfunction resolveUrl(url: string | URL, metadataBase: MetadataBaseURL): URL\nfunction resolveUrl(\n url: string | MetadataBaseURL | undefined,\n metadataBase: MetadataBaseURL\n): MetadataBaseURL\nfunction resolveUrl(\n url: string | MetadataBaseURL | undefined,\n metadataBase: MetadataBaseURL\n): MetadataBaseURL {\n if (url instanceof URL) return url\n if (!url) return null\n\n try {\n // If we can construct a URL instance from url, ignore metadataBase\n const parsedUrl = new URL(url)\n return parsedUrl\n } catch {}\n\n if (!metadataBase) {\n metadataBase = createLocalMetadataBase()\n }\n\n // Handle relative or absolute paths\n const pathname = metadataBase.pathname || ''\n const joinedPath = path.posix.join(pathname, url)\n\n return new URL(joinedPath, metadataBase)\n}\n\n// Resolve with `pathname` if `url` is a relative path.\nfunction resolveRelativeUrl(url: string | URL, pathname: string): string | URL {\n if (typeof url === 'string' && url.startsWith('./')) {\n return path.posix.resolve(pathname, url)\n }\n return url\n}\n\n// The regex is matching logic from packages/next/src/lib/load-custom-routes.ts\nconst FILE_REGEX =\n /^(?:\\/((?!\\.well-known(?:\\/.*)?)(?:[^/]+\\/)*[^/]+\\.\\w+))(\\/?|$)/i\nfunction isFilePattern(pathname: string): boolean {\n return FILE_REGEX.test(pathname)\n}\n\n// Resolve `pathname` if `url` is a relative path the compose with `metadataBase`.\nfunction resolveAbsoluteUrlWithPathname(\n url: string | URL,\n metadataBase: MetadataBaseURL,\n pathname: string,\n { trailingSlash }: MetadataContext\n): string {\n // Resolve url with pathname that always starts with `/`\n url = resolveRelativeUrl(url, pathname)\n\n // Convert string url or URL instance to absolute url string,\n // if there's case needs to be resolved with metadataBase\n let resolvedUrl = ''\n const result = metadataBase ? resolveUrl(url, metadataBase) : url\n if (typeof result === 'string') {\n resolvedUrl = result\n } else {\n resolvedUrl =\n result.pathname === '/' && result.searchParams.size === 0\n ? result.origin\n : result.href\n }\n\n // Add trailing slash if it's enabled for urls matches the condition\n // - Not external, same origin with metadataBase\n // - Doesn't have query\n if (trailingSlash && !resolvedUrl.endsWith('/')) {\n let isRelative = resolvedUrl.startsWith('/')\n let hasQuery = resolvedUrl.includes('?')\n let isExternal = false\n let isFileUrl = false\n\n if (!isRelative) {\n try {\n const parsedUrl = new URL(resolvedUrl)\n isExternal =\n metadataBase != null && parsedUrl.origin !== metadataBase.origin\n isFileUrl = isFilePattern(parsedUrl.pathname)\n } catch {\n // If it's not a valid URL, treat it as external\n isExternal = true\n }\n if (\n // Do not apply trailing slash for file like urls, aligning with the behavior with `trailingSlash`\n !isFileUrl &&\n !isExternal &&\n !hasQuery\n )\n return `${resolvedUrl}/`\n }\n }\n\n return resolvedUrl\n}\n\nexport {\n isStringOrURL,\n resolveUrl,\n resolveRelativeUrl,\n resolveAbsoluteUrlWithPathname,\n}\n"],"names":["getSocialImageMetadataBaseFallback","isStringOrURL","resolveAbsoluteUrlWithPathname","resolveRelativeUrl","resolveUrl","icon","URL","createLocalMetadataBase","isExperimentalHttps","Boolean","process","env","__NEXT_EXPERIMENTAL_HTTPS","protocol","PORT","getPreviewDeploymentUrl","origin","VERCEL_BRANCH_URL","VERCEL_URL","undefined","getProductionDeploymentUrl","VERCEL_PROJECT_PRODUCTION_URL","metadataBase","defaultMetadataBase","previewDeploymentUrl","productionDeploymentUrl","fallbackMetadataBase","NODE_ENV","VERCEL_ENV","url","parsedUrl","pathname","joinedPath","path","posix","join","startsWith","resolve","FILE_REGEX","isFilePattern","test","trailingSlash","resolvedUrl","result","searchParams","size","href","endsWith","isRelative","hasQuery","includes","isExternal","isFileUrl"],"mappings":";;;;;;;;;;;;;;;;;;IAkCgBA,kCAAkC;eAAlCA;;IA2HdC,aAAa;eAAbA;;IAGAC,8BAA8B;eAA9BA;;IADAC,kBAAkB;eAAlBA;;IADAC,UAAU;eAAVA;;;6DA9Je;;;;;;AAKjB,SAASH,cAAcI,IAAS;IAC9B,OAAO,OAAOA,SAAS,YAAYA,gBAAgBC;AACrD;AAEA,SAASC;IACP,yCAAyC;IACzC,MAAMC,sBAAsBC,QAAQC,QAAQC,GAAG,CAACC,yBAAyB;IACzE,MAAMC,WAAWL,sBAAsB,UAAU;IACjD,OAAO,IAAIF,IAAI,GAAGO,SAAS,aAAa,EAAEH,QAAQC,GAAG,CAACG,IAAI,IAAI,MAAM;AACtE;AAEA,SAASC;IACP,MAAMC,SAASN,QAAQC,GAAG,CAACM,iBAAiB,IAAIP,QAAQC,GAAG,CAACO,UAAU;IACtE,OAAOF,SAAS,IAAIV,IAAI,CAAC,QAAQ,EAAEU,QAAQ,IAAIG;AACjD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S7B,+BACP2B,GAAiB,EACjBP,YAA6B,EAC7BS,QAAgB,EAChB,EAAEU,aAAa,EAAmB;IAElC,wDAAwD;IACxDZ,MAAM1B,mBAAmB0B,KAAKE;IAE9B,6DAA6D;IAC7D,yDAAyD;IACzD,IAAIW,cAAc;IAClB,MAAMC,SAASrB,eAAelB,WAAWyB,KAAKP,gBAAgBO;IAC9D,IAAI,OAAOc,WAAW,UAAU;QAC9BD,cAAcC;IAChB,OAAO;QACLD,cACEC,OAAOZ,QAAQ,KAAK,OAAOY,OAAOC,YAAY,CAACC,IAAI,KAAK,IACpDF,OAAO3B,MAAM,GACb2B,OAAOG,IAAI;IACnB;IAEA,oEAAoE;IACpE,gDAAgD;IAChD,uBAAuB;IACvB,IAAIL,iBAAiB,CAACC,YAAYK,QAAQ,CAAC,MAAM;QAC/C,IAAIC,aAAaN,YAAYN,UAAU,CAAC;QACxC,IAAIa,WAAWP,YAAYQ,QAAQ,CAAC;QACpC,IAAIC,aAAa;QACjB,IAAIC,YAAY;QAEhB,IAAI,CAACJ,YAAY;YACf,IAAI;gBACF,MAAMlB,YAAY,IAAIxB,IAAIoC;gBAC1BS,aACE7B,gBAAgB,QAAQQ,UAAUd,MAAM,KAAKM,aAAaN,MAAM;gBAClEoC,YAAYb,cAAcT,UAAUC,QAAQ;YAC9C,EAAE,OAAM;gBACN,gDAAgD;gBAChDoB,aAAa;YACf;YACA,IACE,kGAAkG;YAClG,CAACC,aACD,CAACD,cACD,CAACF,UAED,OAAO,GAAGP,YAAY,CAAC,CAAC;QAC5B;IACF;IAEA,OAAOA;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/alternative-urls-types.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/types/alternative-urls-types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3e9e196cbb1687aa9eaaa69e6a06c585ff522980 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/alternative-urls-types.d.ts @@ -0,0 +1,31 @@ +type LangCode = 'aa' | 'ab' | 'ae' | 'af' | 'ak' | 'am' | 'an' | 'ar' | 'as' | 'av' | 'ay' | 'az' | 'ba' | 'be' | 'bg' | 'bh' | 'bi' | 'bm' | 'bn' | 'bo' | 'br' | 'bs' | 'ca' | 'ce' | 'ch' | 'co' | 'cr' | 'cs' | 'cu' | 'cv' | 'cy' | 'da' | 'de' | 'dv' | 'dz' | 'ee' | 'el' | 'en' | 'eo' | 'es' | 'et' | 'eu' | 'fa' | 'ff' | 'fi' | 'fj' | 'fo' | 'fr' | 'fy' | 'ga' | 'gd' | 'gl' | 'gn' | 'gu' | 'gv' | 'ha' | 'he' | 'hi' | 'ho' | 'hr' | 'ht' | 'hu' | 'hy' | 'hz' | 'ia' | 'id' | 'ie' | 'ig' | 'ii' | 'ik' | 'io' | 'is' | 'it' | 'iu' | 'ja' | 'jv' | 'ka' | 'kg' | 'ki' | 'kj' | 'kk' | 'kl' | 'km' | 'kn' | 'ko' | 'kr' | 'ks' | 'ku' | 'kv' | 'kw' | 'ky' | 'la' | 'lb' | 'lg' | 'li' | 'ln' | 'lo' | 'lt' | 'lu' | 'lv' | 'mg' | 'mh' | 'mi' | 'mk' | 'ml' | 'mn' | 'mr' | 'ms' | 'mt' | 'my' | 'na' | 'nb' | 'nd' | 'ne' | 'ng' | 'nl' | 'nn' | 'no' | 'nr' | 'nv' | 'ny' | 'oc' | 'oj' | 'om' | 'or' | 'os' | 'pa' | 'pi' | 'pl' | 'ps' | 'pt' | 'qu' | 'rm' | 'rn' | 'ro' | 'ru' | 'rw' | 'sa' | 'sc' | 'sd' | 'se' | 'sg' | 'si' | 'sk' | 'sl' | 'sm' | 'sn' | 'so' | 'sq' | 'sr' | 'ss' | 'st' | 'su' | 'sv' | 'sw' | 'ta' | 'te' | 'tg' | 'th' | 'ti' | 'tk' | 'tl' | 'tn' | 'to' | 'tr' | 'ts' | 'tt' | 'tw' | 'ty' | 'ug' | 'uk' | 'ur' | 'uz' | 've' | 'vi' | 'vo' | 'wa' | 'wo' | 'xh' | 'yi' | 'yo' | 'za' | 'zh' | 'zu' | 'af-ZA' | 'am-ET' | 'ar-AE' | 'ar-BH' | 'ar-DZ' | 'ar-EG' | 'ar-IQ' | 'ar-JO' | 'ar-KW' | 'ar-LB' | 'ar-LY' | 'ar-MA' | 'arn-CL' | 'ar-OM' | 'ar-QA' | 'ar-SA' | 'ar-SD' | 'ar-SY' | 'ar-TN' | 'ar-YE' | 'as-IN' | 'az-az' | 'az-Cyrl-AZ' | 'az-Latn-AZ' | 'ba-RU' | 'be-BY' | 'bg-BG' | 'bn-BD' | 'bn-IN' | 'bo-CN' | 'br-FR' | 'bs-Cyrl-BA' | 'bs-Latn-BA' | 'ca-ES' | 'co-FR' | 'cs-CZ' | 'cy-GB' | 'da-DK' | 'de-AT' | 'de-CH' | 'de-DE' | 'de-LI' | 'de-LU' | 'dsb-DE' | 'dv-MV' | 'el-CY' | 'el-GR' | 'en-029' | 'en-AU' | 'en-BZ' | 'en-CA' | 'en-cb' | 'en-GB' | 'en-IE' | 'en-IN' | 'en-JM' | 'en-MT' | 'en-MY' | 'en-NZ' | 'en-PH' | 'en-SG' | 'en-TT' | 'en-US' | 'en-ZA' | 'en-ZW' | 'es-AR' | 'es-BO' | 'es-CL' | 'es-CO' | 'es-CR' | 'es-DO' | 'es-EC' | 'es-ES' | 'es-GT' | 'es-HN' | 'es-MX' | 'es-NI' | 'es-PA' | 'es-PE' | 'es-PR' | 'es-PY' | 'es-SV' | 'es-US' | 'es-UY' | 'es-VE' | 'et-EE' | 'eu-ES' | 'fa-IR' | 'fi-FI' | 'fil-PH' | 'fo-FO' | 'fr-BE' | 'fr-CA' | 'fr-CH' | 'fr-FR' | 'fr-LU' | 'fr-MC' | 'fy-NL' | 'ga-IE' | 'gd-GB' | 'gd-ie' | 'gl-ES' | 'gsw-FR' | 'gu-IN' | 'ha-Latn-NG' | 'he-IL' | 'hi-IN' | 'hr-BA' | 'hr-HR' | 'hsb-DE' | 'hu-HU' | 'hy-AM' | 'id-ID' | 'ig-NG' | 'ii-CN' | 'in-ID' | 'is-IS' | 'it-CH' | 'it-IT' | 'iu-Cans-CA' | 'iu-Latn-CA' | 'iw-IL' | 'ja-JP' | 'ka-GE' | 'kk-KZ' | 'kl-GL' | 'km-KH' | 'kn-IN' | 'kok-IN' | 'ko-KR' | 'ky-KG' | 'lb-LU' | 'lo-LA' | 'lt-LT' | 'lv-LV' | 'mi-NZ' | 'mk-MK' | 'ml-IN' | 'mn-MN' | 'mn-Mong-CN' | 'moh-CA' | 'mr-IN' | 'ms-BN' | 'ms-MY' | 'mt-MT' | 'nb-NO' | 'ne-NP' | 'nl-BE' | 'nl-NL' | 'nn-NO' | 'no-no' | 'nso-ZA' | 'oc-FR' | 'or-IN' | 'pa-IN' | 'pl-PL' | 'prs-AF' | 'ps-AF' | 'pt-BR' | 'pt-PT' | 'qut-GT' | 'quz-BO' | 'quz-EC' | 'quz-PE' | 'rm-CH' | 'ro-mo' | 'ro-RO' | 'ru-mo' | 'ru-RU' | 'rw-RW' | 'sah-RU' | 'sa-IN' | 'se-FI' | 'se-NO' | 'se-SE' | 'si-LK' | 'sk-SK' | 'sl-SI' | 'sma-NO' | 'sma-SE' | 'smj-NO' | 'smj-SE' | 'smn-FI' | 'sms-FI' | 'sq-AL' | 'sr-BA' | 'sr-CS' | 'sr-Cyrl-BA' | 'sr-Cyrl-CS' | 'sr-Cyrl-ME' | 'sr-Cyrl-RS' | 'sr-Latn-BA' | 'sr-Latn-CS' | 'sr-Latn-ME' | 'sr-Latn-RS' | 'sr-ME' | 'sr-RS' | 'sr-sp' | 'sv-FI' | 'sv-SE' | 'sw-KE' | 'syr-SY' | 'ta-IN' | 'te-IN' | 'tg-Cyrl-TJ' | 'th-TH' | 'tk-TM' | 'tlh-QS' | 'tn-ZA' | 'tr-TR' | 'tt-RU' | 'tzm-Latn-DZ' | 'ug-CN' | 'uk-UA' | 'ur-PK' | 'uz-Cyrl-UZ' | 'uz-Latn-UZ' | 'uz-uz' | 'vi-VN' | 'wo-SN' | 'xh-ZA' | 'yo-NG' | 'zh-CN' | 'zh-HK' | 'zh-MO' | 'zh-SG' | 'zh-TW' | 'zh-Hans' | 'zh-Hant' | 'zu-ZA' | `${Lowercase}-${string}`; +type UnmatchedLang = 'x-default'; +type HrefLang = LangCode | UnmatchedLang; +export type Languages = { + [s in HrefLang]?: T | undefined; +}; +export type AlternateLinkDescriptor = { + title?: string | undefined; + url: string | URL; +}; +export type AlternateURLs = { + canonical?: null | string | URL | AlternateLinkDescriptor | undefined; + languages?: Languages | undefined; + media?: { + [media: string]: null | string | URL | AlternateLinkDescriptor[]; + } | undefined; + types?: { + [types: string]: null | string | URL | AlternateLinkDescriptor[]; + } | undefined; +}; +export type ResolvedAlternateURLs = { + canonical: null | AlternateLinkDescriptor; + languages: null | Languages; + media: null | { + [media: string]: null | AlternateLinkDescriptor[]; + }; + types: null | { + [types: string]: null | AlternateLinkDescriptor[]; + }; +}; +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/alternative-urls-types.js b/e-commerce/node_modules/next/dist/lib/metadata/types/alternative-urls-types.js new file mode 100644 index 0000000000000000000000000000000000000000..cd2c2538ac862bcb5d38329a7bde86f1fc1ecfcb --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/alternative-urls-types.js @@ -0,0 +1,7 @@ +// Reference: https://hreflang.org/what-is-a-valid-hreflang +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); + +//# sourceMappingURL=alternative-urls-types.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/alternative-urls-types.js.map b/e-commerce/node_modules/next/dist/lib/metadata/types/alternative-urls-types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..170d185100320b8d47795259d2155b99f104a439 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/alternative-urls-types.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/lib/metadata/types/alternative-urls-types.ts"],"sourcesContent":["// Reference: https://hreflang.org/what-is-a-valid-hreflang\n\ntype LangCode =\n | 'aa'\n | 'ab'\n | 'ae'\n | 'af'\n | 'ak'\n | 'am'\n | 'an'\n | 'ar'\n | 'as'\n | 'av'\n | 'ay'\n | 'az'\n | 'ba'\n | 'be'\n | 'bg'\n | 'bh'\n | 'bi'\n | 'bm'\n | 'bn'\n | 'bo'\n | 'br'\n | 'bs'\n | 'ca'\n | 'ce'\n | 'ch'\n | 'co'\n | 'cr'\n | 'cs'\n | 'cu'\n | 'cv'\n | 'cy'\n | 'da'\n | 'de'\n | 'dv'\n | 'dz'\n | 'ee'\n | 'el'\n | 'en'\n | 'eo'\n | 'es'\n | 'et'\n | 'eu'\n | 'fa'\n | 'ff'\n | 'fi'\n | 'fj'\n | 'fo'\n | 'fr'\n | 'fy'\n | 'ga'\n | 'gd'\n | 'gl'\n | 'gn'\n | 'gu'\n | 'gv'\n | 'ha'\n | 'he'\n | 'hi'\n | 'ho'\n | 'hr'\n | 'ht'\n | 'hu'\n | 'hy'\n | 'hz'\n | 'ia'\n | 'id'\n | 'ie'\n | 'ig'\n | 'ii'\n | 'ik'\n | 'io'\n | 'is'\n | 'it'\n | 'iu'\n | 'ja'\n | 'jv'\n | 'ka'\n | 'kg'\n | 'ki'\n | 'kj'\n | 'kk'\n | 'kl'\n | 'km'\n | 'kn'\n | 'ko'\n | 'kr'\n | 'ks'\n | 'ku'\n | 'kv'\n | 'kw'\n | 'ky'\n | 'la'\n | 'lb'\n | 'lg'\n | 'li'\n | 'ln'\n | 'lo'\n | 'lt'\n | 'lu'\n | 'lv'\n | 'mg'\n | 'mh'\n | 'mi'\n | 'mk'\n | 'ml'\n | 'mn'\n | 'mr'\n | 'ms'\n | 'mt'\n | 'my'\n | 'na'\n | 'nb'\n | 'nd'\n | 'ne'\n | 'ng'\n | 'nl'\n | 'nn'\n | 'no'\n | 'nr'\n | 'nv'\n | 'ny'\n | 'oc'\n | 'oj'\n | 'om'\n | 'or'\n | 'os'\n | 'pa'\n | 'pi'\n | 'pl'\n | 'ps'\n | 'pt'\n | 'qu'\n | 'rm'\n | 'rn'\n | 'ro'\n | 'ru'\n | 'rw'\n | 'sa'\n | 'sc'\n | 'sd'\n | 'se'\n | 'sg'\n | 'si'\n | 'sk'\n | 'sl'\n | 'sm'\n | 'sn'\n | 'so'\n | 'sq'\n | 'sr'\n | 'ss'\n | 'st'\n | 'su'\n | 'sv'\n | 'sw'\n | 'ta'\n | 'te'\n | 'tg'\n | 'th'\n | 'ti'\n | 'tk'\n | 'tl'\n | 'tn'\n | 'to'\n | 'tr'\n | 'ts'\n | 'tt'\n | 'tw'\n | 'ty'\n | 'ug'\n | 'uk'\n | 'ur'\n | 'uz'\n | 've'\n | 'vi'\n | 'vo'\n | 'wa'\n | 'wo'\n | 'xh'\n | 'yi'\n | 'yo'\n | 'za'\n | 'zh'\n | 'zu'\n | 'af-ZA'\n | 'am-ET'\n | 'ar-AE'\n | 'ar-BH'\n | 'ar-DZ'\n | 'ar-EG'\n | 'ar-IQ'\n | 'ar-JO'\n | 'ar-KW'\n | 'ar-LB'\n | 'ar-LY'\n | 'ar-MA'\n | 'arn-CL'\n | 'ar-OM'\n | 'ar-QA'\n | 'ar-SA'\n | 'ar-SD'\n | 'ar-SY'\n | 'ar-TN'\n | 'ar-YE'\n | 'as-IN'\n | 'az-az'\n | 'az-Cyrl-AZ'\n | 'az-Latn-AZ'\n | 'ba-RU'\n | 'be-BY'\n | 'bg-BG'\n | 'bn-BD'\n | 'bn-IN'\n | 'bo-CN'\n | 'br-FR'\n | 'bs-Cyrl-BA'\n | 'bs-Latn-BA'\n | 'ca-ES'\n | 'co-FR'\n | 'cs-CZ'\n | 'cy-GB'\n | 'da-DK'\n | 'de-AT'\n | 'de-CH'\n | 'de-DE'\n | 'de-LI'\n | 'de-LU'\n | 'dsb-DE'\n | 'dv-MV'\n | 'el-CY'\n | 'el-GR'\n | 'en-029'\n | 'en-AU'\n | 'en-BZ'\n | 'en-CA'\n | 'en-cb'\n | 'en-GB'\n | 'en-IE'\n | 'en-IN'\n | 'en-JM'\n | 'en-MT'\n | 'en-MY'\n | 'en-NZ'\n | 'en-PH'\n | 'en-SG'\n | 'en-TT'\n | 'en-US'\n | 'en-ZA'\n | 'en-ZW'\n | 'es-AR'\n | 'es-BO'\n | 'es-CL'\n | 'es-CO'\n | 'es-CR'\n | 'es-DO'\n | 'es-EC'\n | 'es-ES'\n | 'es-GT'\n | 'es-HN'\n | 'es-MX'\n | 'es-NI'\n | 'es-PA'\n | 'es-PE'\n | 'es-PR'\n | 'es-PY'\n | 'es-SV'\n | 'es-US'\n | 'es-UY'\n | 'es-VE'\n | 'et-EE'\n | 'eu-ES'\n | 'fa-IR'\n | 'fi-FI'\n | 'fil-PH'\n | 'fo-FO'\n | 'fr-BE'\n | 'fr-CA'\n | 'fr-CH'\n | 'fr-FR'\n | 'fr-LU'\n | 'fr-MC'\n | 'fy-NL'\n | 'ga-IE'\n | 'gd-GB'\n | 'gd-ie'\n | 'gl-ES'\n | 'gsw-FR'\n | 'gu-IN'\n | 'ha-Latn-NG'\n | 'he-IL'\n | 'hi-IN'\n | 'hr-BA'\n | 'hr-HR'\n | 'hsb-DE'\n | 'hu-HU'\n | 'hy-AM'\n | 'id-ID'\n | 'ig-NG'\n | 'ii-CN'\n | 'in-ID'\n | 'is-IS'\n | 'it-CH'\n | 'it-IT'\n | 'iu-Cans-CA'\n | 'iu-Latn-CA'\n | 'iw-IL'\n | 'ja-JP'\n | 'ka-GE'\n | 'kk-KZ'\n | 'kl-GL'\n | 'km-KH'\n | 'kn-IN'\n | 'kok-IN'\n | 'ko-KR'\n | 'ky-KG'\n | 'lb-LU'\n | 'lo-LA'\n | 'lt-LT'\n | 'lv-LV'\n | 'mi-NZ'\n | 'mk-MK'\n | 'ml-IN'\n | 'mn-MN'\n | 'mn-Mong-CN'\n | 'moh-CA'\n | 'mr-IN'\n | 'ms-BN'\n | 'ms-MY'\n | 'mt-MT'\n | 'nb-NO'\n | 'ne-NP'\n | 'nl-BE'\n | 'nl-NL'\n | 'nn-NO'\n | 'no-no'\n | 'nso-ZA'\n | 'oc-FR'\n | 'or-IN'\n | 'pa-IN'\n | 'pl-PL'\n | 'prs-AF'\n | 'ps-AF'\n | 'pt-BR'\n | 'pt-PT'\n | 'qut-GT'\n | 'quz-BO'\n | 'quz-EC'\n | 'quz-PE'\n | 'rm-CH'\n | 'ro-mo'\n | 'ro-RO'\n | 'ru-mo'\n | 'ru-RU'\n | 'rw-RW'\n | 'sah-RU'\n | 'sa-IN'\n | 'se-FI'\n | 'se-NO'\n | 'se-SE'\n | 'si-LK'\n | 'sk-SK'\n | 'sl-SI'\n | 'sma-NO'\n | 'sma-SE'\n | 'smj-NO'\n | 'smj-SE'\n | 'smn-FI'\n | 'sms-FI'\n | 'sq-AL'\n | 'sr-BA'\n | 'sr-CS'\n | 'sr-Cyrl-BA'\n | 'sr-Cyrl-CS'\n | 'sr-Cyrl-ME'\n | 'sr-Cyrl-RS'\n | 'sr-Latn-BA'\n | 'sr-Latn-CS'\n | 'sr-Latn-ME'\n | 'sr-Latn-RS'\n | 'sr-ME'\n | 'sr-RS'\n | 'sr-sp'\n | 'sv-FI'\n | 'sv-SE'\n | 'sw-KE'\n | 'syr-SY'\n | 'ta-IN'\n | 'te-IN'\n | 'tg-Cyrl-TJ'\n | 'th-TH'\n | 'tk-TM'\n | 'tlh-QS'\n | 'tn-ZA'\n | 'tr-TR'\n | 'tt-RU'\n | 'tzm-Latn-DZ'\n | 'ug-CN'\n | 'uk-UA'\n | 'ur-PK'\n | 'uz-Cyrl-UZ'\n | 'uz-Latn-UZ'\n | 'uz-uz'\n | 'vi-VN'\n | 'wo-SN'\n | 'xh-ZA'\n | 'yo-NG'\n | 'zh-CN'\n | 'zh-HK'\n | 'zh-MO'\n | 'zh-SG'\n | 'zh-TW'\n | 'zh-Hans'\n | 'zh-Hant'\n | 'zu-ZA'\n // We can't have all valid combinations of language-region-script listed here\n // as the list is too long and breaks the TypeScript compiler. So instead we\n // only add the most common ones with a general string pattern for the rest.\n // This way autocompletion still works and it is still possible to add custom\n // lang codes.\n | `${Lowercase}-${string}`\n\ntype UnmatchedLang = 'x-default'\n\ntype HrefLang = LangCode | UnmatchedLang\n\nexport type Languages = {\n [s in HrefLang]?: T | undefined\n}\n\nexport type AlternateLinkDescriptor = {\n title?: string | undefined\n url: string | URL\n}\n\nexport type AlternateURLs = {\n canonical?: null | string | URL | AlternateLinkDescriptor | undefined\n languages?:\n | Languages\n | undefined\n media?:\n | {\n [media: string]: null | string | URL | AlternateLinkDescriptor[]\n }\n | undefined\n types?:\n | {\n [types: string]: null | string | URL | AlternateLinkDescriptor[]\n }\n | undefined\n}\n\nexport type ResolvedAlternateURLs = {\n canonical: null | AlternateLinkDescriptor\n languages: null | Languages\n media: null | {\n [media: string]: null | AlternateLinkDescriptor[]\n }\n types: null | {\n [types: string]: null | AlternateLinkDescriptor[]\n }\n}\n"],"names":[],"mappings":"AAAA,2DAA2D","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/extra-types.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/types/extra-types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c0c89ef7243e57e9622a4d9524b9da5a775fc615 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/extra-types.d.ts @@ -0,0 +1,98 @@ +export type AppLinks = { + ios?: AppLinksApple | Array | undefined; + iphone?: AppLinksApple | Array | undefined; + ipad?: AppLinksApple | Array | undefined; + android?: AppLinksAndroid | Array | undefined; + windows_phone?: AppLinksWindows | Array | undefined; + windows?: AppLinksWindows | Array | undefined; + windows_universal?: AppLinksWindows | Array | undefined; + web?: AppLinksWeb | Array | undefined; +}; +export type ResolvedAppLinks = { + ios?: Array | undefined; + iphone?: Array | undefined; + ipad?: Array | undefined; + android?: Array | undefined; + windows_phone?: Array | undefined; + windows?: Array | undefined; + windows_universal?: Array | undefined; + web?: Array | undefined; +}; +export type AppLinksApple = { + url: string | URL; + app_store_id?: string | number | undefined; + app_name?: string | undefined; +}; +export type AppLinksAndroid = { + package: string; + url?: string | URL | undefined; + class?: string | undefined; + app_name?: string | undefined; +}; +export type AppLinksWindows = { + url: string | URL; + app_id?: string | undefined; + app_name?: string | undefined; +}; +export type AppLinksWeb = { + url: string | URL; + should_fallback?: boolean | undefined; +}; +export type ItunesApp = { + appId: string; + appArgument?: string | undefined; +}; +export type ViewportLayout = { + width?: string | number | undefined; + height?: string | number | undefined; + initialScale?: number | undefined; + minimumScale?: number | undefined; + maximumScale?: number | undefined; + userScalable?: boolean | undefined; + viewportFit?: 'auto' | 'cover' | 'contain' | undefined; + interactiveWidget?: 'resizes-visual' | 'resizes-content' | 'overlays-content' | undefined; +}; +export type AppleWebApp = { + capable?: boolean | undefined; + title?: string | undefined; + startupImage?: AppleImage | Array | undefined; + statusBarStyle?: 'default' | 'black' | 'black-translucent' | undefined; +}; +export type AppleImage = string | AppleImageDescriptor; +export type AppleImageDescriptor = { + url: string; + media?: string | undefined; +}; +export type ResolvedAppleWebApp = { + capable: boolean; + title?: string | null | undefined; + startupImage?: AppleImageDescriptor[] | null | undefined; + statusBarStyle?: 'default' | 'black' | 'black-translucent' | undefined; +}; +export type Facebook = FacebookAppId | FacebookAdmins | ResolvedFacebook; +export type FacebookAppId = { + appId: string; + admins?: never | undefined; +}; +export type FacebookAdmins = { + appId?: never | undefined; + admins: string | string[]; +}; +export type ResolvedFacebook = { + appId?: string | undefined; + admins?: string[] | undefined; +}; +export type Pinterest = PinterestRichPin | ResolvedPinterest; +export type PinterestRichPin = { + richPin: string | boolean; +}; +export type ResolvedPinterest = { + richPin?: string | boolean; +}; +export type FormatDetection = { + telephone?: boolean | undefined; + date?: boolean | undefined; + address?: boolean | undefined; + email?: boolean | undefined; + url?: boolean | undefined; +}; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/extra-types.js b/e-commerce/node_modules/next/dist/lib/metadata/types/extra-types.js new file mode 100644 index 0000000000000000000000000000000000000000..e91115205d46f20695c7ea75319936d90558a4db --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/extra-types.js @@ -0,0 +1,9 @@ +// When rendering applink meta tags add a namespace tag before each array instance +// if more than one member exists. +// ref: https://developers.facebook.com/docs/applinks/metadata-reference +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); + +//# sourceMappingURL=extra-types.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/extra-types.js.map b/e-commerce/node_modules/next/dist/lib/metadata/types/extra-types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b08597328d6109e6ab89e91dd8c5a7dd8e58e3f4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/extra-types.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/lib/metadata/types/extra-types.ts"],"sourcesContent":["// When rendering applink meta tags add a namespace tag before each array instance\n// if more than one member exists.\n// ref: https://developers.facebook.com/docs/applinks/metadata-reference\n\nexport type AppLinks = {\n ios?: AppLinksApple | Array | undefined\n iphone?: AppLinksApple | Array | undefined\n ipad?: AppLinksApple | Array | undefined\n android?: AppLinksAndroid | Array | undefined\n windows_phone?: AppLinksWindows | Array | undefined\n windows?: AppLinksWindows | Array | undefined\n windows_universal?: AppLinksWindows | Array | undefined\n web?: AppLinksWeb | Array | undefined\n}\nexport type ResolvedAppLinks = {\n ios?: Array | undefined\n iphone?: Array | undefined\n ipad?: Array | undefined\n android?: Array | undefined\n windows_phone?: Array | undefined\n windows?: Array | undefined\n windows_universal?: Array | undefined\n web?: Array | undefined\n}\nexport type AppLinksApple = {\n url: string | URL\n app_store_id?: string | number | undefined\n app_name?: string | undefined\n}\nexport type AppLinksAndroid = {\n package: string\n url?: string | URL | undefined\n class?: string | undefined\n app_name?: string | undefined\n}\nexport type AppLinksWindows = {\n url: string | URL\n app_id?: string | undefined\n app_name?: string | undefined\n}\nexport type AppLinksWeb = {\n url: string | URL\n should_fallback?: boolean | undefined\n}\n\n// Apple Itunes APp\n// https://developer.apple.com/documentation/webkit/promoting_apps_with_smart_app_banners\nexport type ItunesApp = {\n appId: string\n appArgument?: string | undefined\n}\n\n// Viewport meta structure\n// https://developer.mozilla.org/docs/Web/HTML/Viewport_meta_tag\n// intentionally leaving out user-scalable, use a string if you want that behavior\nexport type ViewportLayout = {\n width?: string | number | undefined\n height?: string | number | undefined\n initialScale?: number | undefined\n minimumScale?: number | undefined\n maximumScale?: number | undefined\n userScalable?: boolean | undefined\n viewportFit?: 'auto' | 'cover' | 'contain' | undefined\n interactiveWidget?:\n | 'resizes-visual'\n | 'resizes-content'\n | 'overlays-content'\n | undefined\n}\n\n// Apple Web App\n// https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html\n// https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html\nexport type AppleWebApp = {\n // default true\n capable?: boolean | undefined\n title?: string | undefined\n startupImage?: AppleImage | Array | undefined\n // default \"default\"\n statusBarStyle?: 'default' | 'black' | 'black-translucent' | undefined\n}\nexport type AppleImage = string | AppleImageDescriptor\nexport type AppleImageDescriptor = {\n url: string\n media?: string | undefined\n}\n\nexport type ResolvedAppleWebApp = {\n capable: boolean\n title?: string | null | undefined\n startupImage?: AppleImageDescriptor[] | null | undefined\n statusBarStyle?: 'default' | 'black' | 'black-translucent' | undefined\n}\n\nexport type Facebook = FacebookAppId | FacebookAdmins | ResolvedFacebook\nexport type FacebookAppId = {\n appId: string\n admins?: never | undefined\n}\nexport type FacebookAdmins = {\n appId?: never | undefined\n admins: string | string[]\n}\nexport type ResolvedFacebook = {\n appId?: string | undefined\n admins?: string[] | undefined\n}\n\nexport type Pinterest = PinterestRichPin | ResolvedPinterest\nexport type PinterestRichPin = {\n richPin: string | boolean\n}\n\nexport type ResolvedPinterest = {\n richPin?: string | boolean\n}\n\n// Format Detection\n// This is a poorly specified metadata export type that is supposed to\n// control whether the device attempts to conver text that matches\n// certain formats into links for action. The most supported example\n// is how mobile devices detect phone numbers and make them into links\n// that can initiate a phone call\n// https://www.goodemailcode.com/email-code/template.html\nexport type FormatDetection = {\n telephone?: boolean | undefined\n date?: boolean | undefined\n address?: boolean | undefined\n email?: boolean | undefined\n url?: boolean | undefined\n}\n"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,kCAAkC;AAClC,wEAAwE","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/icons.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/types/icons.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..eb0d2f26b6a0ca284bc77a4fc3ba7759af076e1e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/icons.d.ts @@ -0,0 +1,7 @@ +export type StaticMetadata = { + icon: any[] | undefined; + apple: any[] | undefined; + openGraph: any[] | undefined; + twitter: any[] | undefined; + manifest: string | undefined; +} | null; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/icons.js b/e-commerce/node_modules/next/dist/lib/metadata/types/icons.js new file mode 100644 index 0000000000000000000000000000000000000000..6e2259d88b86b55b156442804d6cac33983dde32 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/icons.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); + +//# sourceMappingURL=icons.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/icons.js.map b/e-commerce/node_modules/next/dist/lib/metadata/types/icons.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ad48a910f81e5873737ebce8e9fa87278c9f7cd9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/icons.js.map @@ -0,0 +1 @@ +{"version":3,"sources":[],"names":[],"mappings":"","ignoreList":[]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/manifest-types.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/types/manifest-types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..db1009e39258710eefe72f0b9391a4ee3a56d184 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/manifest-types.d.ts @@ -0,0 +1,74 @@ +type ClientModeEnum = 'auto' | 'focus-existing' | 'navigate-existing' | 'navigate-new'; +type File = { + name: string; + accept: string | string[]; +}; +type Icon = { + src: string; + type?: string | undefined; + sizes?: string | undefined; + purpose?: 'any' | 'maskable' | 'monochrome' | undefined; +}; +export type Manifest = { + background_color?: string | undefined; + categories?: string[] | undefined; + description?: string | undefined; + dir?: 'ltr' | 'rtl' | 'auto' | undefined; + display?: 'fullscreen' | 'standalone' | 'minimal-ui' | 'browser' | undefined; + display_override?: ('fullscreen' | 'standalone' | 'minimal-ui' | 'browser' | 'window-controls-overlay')[] | undefined; + file_handlers?: { + action: string; + accept: { + [mimeType: string]: string[]; + }; + }[] | undefined; + icons?: Icon[] | undefined; + id?: string | undefined; + lang?: string | undefined; + launch_handler?: { + client_mode: ClientModeEnum | ClientModeEnum[]; + } | undefined; + name?: string | undefined; + orientation?: 'any' | 'natural' | 'landscape' | 'portrait' | 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary' | undefined; + prefer_related_applications?: boolean | undefined; + protocol_handlers?: { + protocol: string; + url: string; + }[] | undefined; + related_applications?: { + platform: string; + url: string; + id?: string | undefined; + }[] | undefined; + scope?: string | undefined; + screenshots?: { + form_factor?: 'narrow' | 'wide' | undefined; + label?: string | undefined; + platform?: 'android' | 'chromeos' | 'ipados' | 'ios' | 'kaios' | 'macos' | 'windows' | 'xbox' | 'chrome_web_store' | 'itunes' | 'microsoft-inbox' | 'microsoft-store' | 'play' | undefined; + src: string; + type?: string | undefined; + sizes?: string | undefined; + }[] | undefined; + share_target?: { + action: string; + method?: 'get' | 'post' | 'GET' | 'POST' | undefined; + enctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | undefined; + params: { + title?: string | undefined; + text?: string | undefined; + url?: string | undefined; + files?: File | File[] | undefined; + }; + } | undefined; + short_name?: string | undefined; + shortcuts?: { + name: string; + short_name?: string | undefined; + description?: string | undefined; + url: string; + icons?: Icon[] | undefined; + }[] | undefined; + start_url?: string | undefined; + theme_color?: string | undefined; +}; +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/manifest-types.js b/e-commerce/node_modules/next/dist/lib/metadata/types/manifest-types.js new file mode 100644 index 0000000000000000000000000000000000000000..a5b59aaa9a957878bd4a0564cb8c5cd428c5e6a4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/manifest-types.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); + +//# sourceMappingURL=manifest-types.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/manifest-types.js.map b/e-commerce/node_modules/next/dist/lib/metadata/types/manifest-types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ad48a910f81e5873737ebce8e9fa87278c9f7cd9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/manifest-types.js.map @@ -0,0 +1 @@ +{"version":3,"sources":[],"names":[],"mappings":"","ignoreList":[]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/metadata-interface.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/types/metadata-interface.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a7220541257894ca12234be7c695ee7434e768f0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/metadata-interface.d.ts @@ -0,0 +1,651 @@ +/** + * Next.js Metadata API + * + * This file defines the types used by Next.js to configure metadata + * through static exports or dynamic `generateMetadata` functions in Server Components. + * + * @remarks + * - The static `metadata` object and `generateMetadata` function are only supported in Server Components. + * - Do not export both a `metadata` object and a `generateMetadata` function from the same route segment. + * - You can still render metadata in client components directly as part of the component's JSX. + * + * @see https://nextjs.org/docs/app/api-reference/metadata + */ +import type { AlternateURLs, Languages, ResolvedAlternateURLs } from './alternative-urls-types'; +import type { AppleWebApp, AppLinks, Facebook, FormatDetection, ItunesApp, Pinterest, ResolvedAppleWebApp, ResolvedAppLinks, ResolvedFacebook, ResolvedPinterest, ViewportLayout } from './extra-types'; +import type { DeprecatedMetadataFields, AbsoluteTemplateString, Author, ColorSchemeEnum, Icon, Icons, IconURL, ReferrerEnum, ResolvedIcons, ResolvedVerification, Robots, ResolvedRobots, TemplateString, Verification, ThemeColorDescriptor, Videos } from './metadata-types'; +import type { Manifest as ManifestFile } from './manifest-types'; +import type { OpenGraph, ResolvedOpenGraph } from './opengraph-types'; +import type { ResolvedTwitterMetadata, Twitter } from './twitter-types'; +/** + * Metadata interface to describe all the metadata fields that can be set in a document. + * + * @remarks + * This interface covers all the metadata fields available in Next.js including title, description, + * icons, openGraph, twitter, and more. Fields such as `metadataBase` help in composing absolute URLs + * from relative ones. The `title` field supports both simple strings and a template object with `default`, + * `template`, and `absolute` properties. + * + * @example + * ```tsx + * // Static metadata export in a layout or page: + * import type { Metadata } from 'next' + * + * export const metadata: Metadata = { + * metadataBase: new URL('https://example.com'), + * title: { default: 'My Site', template: '%s | My Site' }, + * description: 'Welcome to My Site', + * alternates: { + * canonical: 'https://example.com', + * languages: { + * 'en-US': 'https://example.com/en-US', + * 'de-DE': 'https://example.com/de-DE' + * } + * }, + * openGraph: { + * title: 'My Site', + * description: 'Welcome to My Site', + * url: 'https://example.com', + * siteName: 'My Site', + * images: [{ url: 'https://example.com/og.png' }] + * }, + * } + * ``` + */ +interface Metadata extends DeprecatedMetadataFields { + /** + * The base path and origin for absolute URLs in various metadata fields. + * + * @remarks + * When relative URLs (for Open Graph images, alternates, etc.) are used, they are composed with this base. + * If not provided, Next.js will populate a default value based on environment variables. + */ + metadataBase?: null | string | URL | undefined; + /** + * The document title. + * + * @remarks + * The title can be a simple string (e.g., `"My Blog"`) or an object with: + * - `default`: A fallback title for child segments. + * - `template`: A title template (e.g., `"%s | My Website"`) applied to child titles. + * - `absolute`: A title that overrides parent templates. + * + * @example + * ```tsx + * // As a simple string: + * title: "My Blog" + * + * // As a template object: + * title: { default: "Dashboard", template: "%s | My Website" } + * + * // Using absolute value (ignores parent template): + * title: { absolute: "My Blog", template: "%s | My Website" } + * ``` + */ + title?: null | string | TemplateString | undefined; + /** + * The document description, and optionally the Open Graph and Twitter descriptions. + * + * @example + * ```tsx + * description: "My Blog Description" + * // Renders: + * ``` + */ + description?: null | string | undefined; + /** + * The application name. + * + * @example + * ```tsx + * applicationName: "My Blog" + * // Renders: + * ``` + */ + applicationName?: null | string | undefined; + /** + * The authors of the document. + * + * @example + * ```tsx + * authors: [{ name: "Next.js Team", url: "https://nextjs.org" }] + * // Renders: + * // + * // + * ``` + */ + authors?: null | Author | Array | undefined; + /** + * The generator used for the document. + * + * @example + * ```tsx + * generator: "Next.js" + * // Renders: + * ``` + */ + generator?: null | string | undefined; + /** + * The keywords for the document. + * + * @remarks + * When an array is provided, keywords are flattened into a comma-separated string. + * + * @example + * ```tsx + * keywords: "nextjs, react, blog" + * // or + * keywords: ["react", "server components"] + * ``` + */ + keywords?: null | string | Array | undefined; + /** + * The referrer setting for the document. + * + * @example + * ```tsx + * referrer: "origin" + * // Renders: + * ``` + */ + referrer?: null | ReferrerEnum | undefined; + /** + * The theme color for the document. + * + * @deprecated Use the new viewport configuration (`export const viewport: Viewport = { ... }`) instead. + */ + themeColor?: null | string | ThemeColorDescriptor | ThemeColorDescriptor[] | undefined; + /** + * The color scheme for the document. + * + * @deprecated Use the new viewport configuration (`export const viewport: Viewport = { ... }`) instead. + */ + colorScheme?: null | ColorSchemeEnum | undefined; + /** + * The viewport setting for the document. + * + * @deprecated Use the new viewport configuration (`export const viewport: Viewport = { ... }`) instead. + */ + viewport?: null | string | ViewportLayout | undefined; + /** + * The creator of the document. + * + * @example + * ```tsx + * creator: "Next.js Team" + * // Renders: + * ``` + */ + creator?: null | string | undefined; + /** + * The publisher of the document. + * + * @example + * ```tsx + * publisher: "Vercel" + * // Renders: + * ``` + */ + publisher?: null | string | undefined; + /** + * The robots setting for the document. + * + * @remarks + * Can be a string (e.g., "index, follow") or an object with more granular rules. + * + * @example + * ```tsx + * robots: "index, follow" + * // or + * robots: { index: true, follow: true } + * ``` + * + * @see https://developer.mozilla.org/docs/Glossary/Robots.txt + */ + robots?: null | string | Robots | undefined; + /** + * The canonical and alternate URLs for the document. + * + * @remarks + * This field allows defining a canonical URL as well as alternate URLs (such as for multiple languages). + * + * @example + * ```tsx + * alternates: { + * canonical: "https://example.com", + * languages: { + * "en-US": "https://example.com/en-US" + * } + * } + * ``` + */ + alternates?: null | AlternateURLs | undefined; + /** + * The icons for the document. Defaults to rel="icon". + * + * @remarks + * You can specify a simple URL or an object to differentiate between icon types (e.g., apple-touch-icon). + * + * @example + * ```tsx + * icons: "https://example.com/icon.png" + * // or + * icons: { + * icon: "https://example.com/icon.png", + * apple: "https://example.com/apple-icon.png" + * } + * ``` + * + * @see https://developer.mozilla.org/docs/Web/HTML/Attributes/rel#attr-icon + */ + icons?: null | IconURL | Array | Icons | undefined; + /** + * A web application manifest, as defined in the Web Application Manifest specification. + * + * @example + * ```tsx + * manifest: "https://example.com/manifest.json" + * // Renders: + * ``` + * + * @see https://developer.mozilla.org/docs/Web/Manifest + */ + manifest?: null | string | URL | undefined; + /** + * The Open Graph metadata for the document. + * + * @remarks + * Follows the Open Graph protocol to enrich link previews. + * + * @example + * ```tsx + * openGraph: { + * type: "website", + * url: "https://example.com", + * title: "My Website", + * description: "My Website Description", + * siteName: "My Website", + * images: [{ url: "https://example.com/og.png" }] + * } + * ``` + * + * @see https://ogp.me/ + */ + openGraph?: null | OpenGraph | undefined; + /** + * The Twitter metadata for the document. + * + * @remarks + * - Used for configuring Twitter Cards and can include details such as `card`, `site`, and `creator`. + * - Notably, more sites than just Twitter (now X) use this format. + * + * @example + * ```tsx + * twitter: { + * card: "summary_large_image", + * site: "@site", + * creator: "@creator", + * images: "https://example.com/og.png" + * } + * ``` + */ + twitter?: null | Twitter | undefined; + /** + * The Facebook metadata for the document. + * + * @remarks + * Specify either `appId` or `admins` (but not both) to configure Facebook integration. + * + * @example + * ```tsx + * facebook: { appId: "12345678" } + * // Renders + * // or + * facebook: { admins: ["12345678"] } + * // Renders + * ``` + */ + facebook?: null | Facebook | undefined; + /** + * The Pinterest metadata for the document to choose whether opt out of rich pin data. + * + * @example + * ```tsx + * pinterest: { richPin: true } + * // Renders + * ``` + */ + pinterest?: null | Pinterest; + /** + * The common verification tokens for the document. + * + * @example + * ```tsx + * verification: { google: "1234567890", yandex: "1234567890", "me": "1234567890" } + * // Renders + * // + * // + * ``` + */ + verification?: Verification | undefined; + /** + * The Apple web app metadata for the document. + * + * @example + * ```tsx + * appleWebApp: { capable: true, title: "My Website", statusBarStyle: "black-translucent" } + * ``` + * + * @see https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html + */ + appleWebApp?: null | boolean | AppleWebApp | undefined; + /** + * Indicates whether devices should interpret certain formats (such as telephone numbers) as actionable links. + * + * @example + * ```tsx + * formatDetection: { telephone: false } + * // Renders: + * ``` + */ + formatDetection?: null | FormatDetection | undefined; + /** + * The metadata for the iTunes App. + * + * @remarks + * Adds the `name="apple-itunes-app"` meta tag. + * + * @example + * ```tsx + * itunes: { app: { id: "123456789", affiliateData: "123456789", appArguments: "123456789" } } + * // Renders + * ``` + */ + itunes?: null | ItunesApp | undefined; + /** + * A brief description of the web page. + * + * @remarks + * Rendered as the `abstract` meta tag. This is *not recommended* as it is superseded by `description`. + * + * @example + * ```tsx + * abstract: "My Website Description" + * // Renders + * ``` + */ + abstract?: null | string | undefined; + /** + * The Facebook AppLinks metadata for the document. + * + * @example + * ```tsx + * appLinks: { + * ios: { appStoreId: "123456789", url: "https://example.com" }, + * android: { packageName: "com.example", url: "https://example.com" } + * } + * + * // Renders + * + * + * + * + * ``` + */ + appLinks?: null | AppLinks | undefined; + /** + * The archives link rel property. + * + * @example + * ```tsx + * archives: "https://example.com/archives" + * // Renders + * ``` + */ + archives?: null | string | Array | undefined; + /** + * The assets link rel property. + * + * @example + * ```tsx + * assets: "https://example.com/assets" + * // Renders + * ``` + */ + assets?: null | string | Array | undefined; + /** + * The bookmarks link rel property. + * + * @remarks + * Although technically against the HTML spec, this is used in practice. + * + * @example + * ```tsx + * bookmarks: "https://example.com/bookmarks" + * // Renders + * ``` + */ + bookmarks?: null | string | Array | undefined; + /** + * The pagination link rel properties. + * + * @example + * ```tsx + * pagination: { + * previous: "https://example.com/items?page=1", + * next: "https://example.com/items?page=3" + * } + * + * // Renders + * + * + * ``` + * + * @see https://developers.google.com/search/blog/2011/09/pagination-with-relnext-and-relprev + */ + pagination?: { + previous?: null | string | URL | undefined; + next?: null | string | URL | undefined; + }; + /** + * The category meta name property. + * + * @example + * ```tsx + * category: "My Category" + * // Renders + * ``` + */ + category?: null | string | undefined; + /** + * The classification meta name property. + * + * @example + * ```tsx + * classification: "My Classification" + * // Renders + * ``` + */ + classification?: null | string | undefined; + /** + * Arbitrary name/value pairs for additional metadata. + * + * @remarks + * Use this field to define custom meta tags that are not directly supported. + * + * @example + * ```tsx + * other: { custom: ["meta1", "meta2"] } + * ``` + */ + other?: { + [name: string]: string | number | Array; + } | undefined; +} +/** + * ResolvedMetadataWithURLs represents the fully processed metadata after + * defaults are applied and relative URLs are composed with `metadataBase`. + */ +interface ResolvedMetadataWithURLs { + metadataBase: string | null | URL; + title: null | AbsoluteTemplateString; + description: null | string; + applicationName: null | string; + authors: null | Array; + generator: null | string; + keywords: null | Array; + referrer: null | ReferrerEnum; + /** + * @deprecated + */ + themeColor: null | ThemeColorDescriptor[]; + /** + * @deprecated + */ + colorScheme: null | ColorSchemeEnum; + /** + * @deprecated + */ + viewport: null | string; + creator: null | string; + publisher: null | string; + robots: null | ResolvedRobots; + alternates: null | ResolvedAlternateURLs; + icons: null | ResolvedIcons; + openGraph: null | ResolvedOpenGraph; + manifest: null | string | URL; + twitter: null | ResolvedTwitterMetadata; + facebook: null | ResolvedFacebook; + pinterest: null | ResolvedPinterest; + verification: null | ResolvedVerification; + appleWebApp: null | ResolvedAppleWebApp; + formatDetection: null | FormatDetection; + itunes: null | ItunesApp; + abstract: null | string; + appLinks: null | ResolvedAppLinks; + archives: null | Array; + assets: null | Array; + bookmarks: null | Array; + pagination: { + previous: null | string; + next: null | string; + }; + category: null | string; + classification: null | string; + other: null | { + [name: string]: string | number | Array; + }; +} +export type WithStringifiedURLs = T extends URL ? string : T extends object ? { + [K in keyof T]: WithStringifiedURLs; +} : T; +/** + * ResolvedMetadata represents the fully processed metadata after defaults are + * applied and relative URLs are composed with `metadataBase`. + */ +type ResolvedMetadata = WithStringifiedURLs; +type RobotsRuleBase = { + allow?: string | string[] | undefined; + disallow?: string | string[] | undefined; + crawlDelay?: number | undefined; + /** + * Non-standard per-user-agent directives passed through verbatim to the + * generated `robots.txt`. Keys preserve their casing and array values emit + * one line per entry. + * + * @example + * ```ts + * // Seznam rate-limiting + * // https://o-seznam.cz/napoveda/vyhledavani/en/crawling-control/ + * other: { 'Request-Rate': '10/1m' } + * + * // Yandex Clean-param (multiple values) + * other: { 'Clean-param': ['ref /articles/', 'utm_source /'] } + * ``` + */ + other?: Record> | undefined; +}; +type RobotsFile = { + rules: (RobotsRuleBase & { + userAgent?: string | string[] | undefined; + }) | Array; + sitemap?: string | string[] | undefined; + host?: string | undefined; +}; +type SitemapFile = Array<{ + url: string; + lastModified?: string | Date | undefined; + changeFrequency?: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never' | undefined; + priority?: number | undefined; + alternates?: { + languages?: Languages | undefined; + } | undefined; + images?: string[] | undefined; + videos?: Videos[] | undefined; +}>; +type ResolvingMetadata = Promise; +declare namespace MetadataRoute { + type Robots = RobotsFile; + type Sitemap = SitemapFile; + type Manifest = ManifestFile; +} +/** + * Interface for the viewport configuration. + * + * @remarks + * This configuration allows defining properties such as width, initial scale, theme colors, + * and color scheme. + * + * @example + * ```tsx + * export const viewport: Viewport = { + * width: "device-width", + * initialScale: 1, + * themeColor: [ + * { media: "(prefers-color-scheme: dark)", color: "#000000" }, + * { media: "(prefers-color-scheme: light)", color: "#ffffff" } + * ], + * colorScheme: "dark" + * } + * ``` + */ +interface Viewport extends ViewportLayout { + /** + * The theme color for the document. + * + * @example + * ```tsx + * themeColor: "#000000" + * // Renders + * + * themeColor: { media: "(prefers-color-scheme: dark)", color: "#000000" } + * // Renders + * + * themeColor: [ + * { media: "(prefers-color-scheme: dark)", color: "#000000" }, + * { media: "(prefers-color-scheme: light)", color: "#ffffff" } + * ] + * // Renders + * // Renders + * ``` + */ + themeColor?: null | string | ThemeColorDescriptor | ThemeColorDescriptor[] | undefined; + /** + * The color scheme for the document. + * + * @example + * ```tsx + * colorScheme: "dark" + * // Renders + * ``` + */ + colorScheme?: null | ColorSchemeEnum | undefined; +} +interface ResolvedViewport extends ViewportLayout { + themeColor: null | ThemeColorDescriptor[]; + colorScheme: null | ColorSchemeEnum; +} +type ResolvingViewport = Promise; +export type { Metadata, ResolvedMetadata, ResolvedMetadataWithURLs, ResolvingMetadata, MetadataRoute, Viewport, ResolvingViewport, ResolvedViewport, }; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/metadata-interface.js b/e-commerce/node_modules/next/dist/lib/metadata/types/metadata-interface.js new file mode 100644 index 0000000000000000000000000000000000000000..8ed5101569c46e14de77f9f338d247161b36884d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/metadata-interface.js @@ -0,0 +1,18 @@ +/** + * Next.js Metadata API + * + * This file defines the types used by Next.js to configure metadata + * through static exports or dynamic `generateMetadata` functions in Server Components. + * + * @remarks + * - The static `metadata` object and `generateMetadata` function are only supported in Server Components. + * - Do not export both a `metadata` object and a `generateMetadata` function from the same route segment. + * - You can still render metadata in client components directly as part of the component's JSX. + * + * @see https://nextjs.org/docs/app/api-reference/metadata + */ "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); + +//# sourceMappingURL=metadata-interface.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/metadata-interface.js.map b/e-commerce/node_modules/next/dist/lib/metadata/types/metadata-interface.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d591bc818af12bcc1336e2357e2ea61843d6e3a8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/metadata-interface.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/lib/metadata/types/metadata-interface.ts"],"sourcesContent":["/**\n * Next.js Metadata API\n *\n * This file defines the types used by Next.js to configure metadata\n * through static exports or dynamic `generateMetadata` functions in Server Components.\n *\n * @remarks\n * - The static `metadata` object and `generateMetadata` function are only supported in Server Components.\n * - Do not export both a `metadata` object and a `generateMetadata` function from the same route segment.\n * - You can still render metadata in client components directly as part of the component's JSX.\n *\n * @see https://nextjs.org/docs/app/api-reference/metadata\n */\n\nimport type {\n AlternateURLs,\n Languages,\n ResolvedAlternateURLs,\n} from './alternative-urls-types'\nimport type {\n AppleWebApp,\n AppLinks,\n Facebook,\n FormatDetection,\n ItunesApp,\n Pinterest,\n ResolvedAppleWebApp,\n ResolvedAppLinks,\n ResolvedFacebook,\n ResolvedPinterest,\n ViewportLayout,\n} from './extra-types'\nimport type {\n DeprecatedMetadataFields,\n AbsoluteTemplateString,\n Author,\n ColorSchemeEnum,\n Icon,\n Icons,\n IconURL,\n ReferrerEnum,\n ResolvedIcons,\n ResolvedVerification,\n Robots,\n ResolvedRobots,\n TemplateString,\n Verification,\n ThemeColorDescriptor,\n Videos,\n} from './metadata-types'\nimport type { Manifest as ManifestFile } from './manifest-types'\nimport type { OpenGraph, ResolvedOpenGraph } from './opengraph-types'\nimport type { ResolvedTwitterMetadata, Twitter } from './twitter-types'\n\n/**\n * Metadata interface to describe all the metadata fields that can be set in a document.\n *\n * @remarks\n * This interface covers all the metadata fields available in Next.js including title, description,\n * icons, openGraph, twitter, and more. Fields such as `metadataBase` help in composing absolute URLs\n * from relative ones. The `title` field supports both simple strings and a template object with `default`,\n * `template`, and `absolute` properties.\n *\n * @example\n * ```tsx\n * // Static metadata export in a layout or page:\n * import type { Metadata } from 'next'\n *\n * export const metadata: Metadata = {\n * metadataBase: new URL('https://example.com'),\n * title: { default: 'My Site', template: '%s | My Site' },\n * description: 'Welcome to My Site',\n * alternates: {\n * canonical: 'https://example.com',\n * languages: {\n * 'en-US': 'https://example.com/en-US',\n * 'de-DE': 'https://example.com/de-DE'\n * }\n * },\n * openGraph: {\n * title: 'My Site',\n * description: 'Welcome to My Site',\n * url: 'https://example.com',\n * siteName: 'My Site',\n * images: [{ url: 'https://example.com/og.png' }]\n * },\n * }\n * ```\n */\ninterface Metadata extends DeprecatedMetadataFields {\n /**\n * The base path and origin for absolute URLs in various metadata fields.\n *\n * @remarks\n * When relative URLs (for Open Graph images, alternates, etc.) are used, they are composed with this base.\n * If not provided, Next.js will populate a default value based on environment variables.\n */\n metadataBase?: null | string | URL | undefined\n\n /**\n * The document title.\n *\n * @remarks\n * The title can be a simple string (e.g., `\"My Blog\"`) or an object with:\n * - `default`: A fallback title for child segments.\n * - `template`: A title template (e.g., `\"%s | My Website\"`) applied to child titles.\n * - `absolute`: A title that overrides parent templates.\n *\n * @example\n * ```tsx\n * // As a simple string:\n * title: \"My Blog\"\n *\n * // As a template object:\n * title: { default: \"Dashboard\", template: \"%s | My Website\" }\n *\n * // Using absolute value (ignores parent template):\n * title: { absolute: \"My Blog\", template: \"%s | My Website\" }\n * ```\n */\n title?: null | string | TemplateString | undefined\n\n /**\n * The document description, and optionally the Open Graph and Twitter descriptions.\n *\n * @example\n * ```tsx\n * description: \"My Blog Description\"\n * // Renders: \n * ```\n */\n description?: null | string | undefined\n\n // Standard metadata names\n // https://developer.mozilla.org/docs/Web/HTML/Element/meta/name\n\n /**\n * The application name.\n *\n * @example\n * ```tsx\n * applicationName: \"My Blog\"\n * // Renders: \n * ```\n */\n applicationName?: null | string | undefined\n\n /**\n * The authors of the document.\n *\n * @example\n * ```tsx\n * authors: [{ name: \"Next.js Team\", url: \"https://nextjs.org\" }]\n * // Renders:\n * // \n * // \n * ```\n */\n authors?: null | Author | Array | undefined\n\n /**\n * The generator used for the document.\n *\n * @example\n * ```tsx\n * generator: \"Next.js\"\n * // Renders: \n * ```\n */\n generator?: null | string | undefined\n\n /**\n * The keywords for the document.\n *\n * @remarks\n * When an array is provided, keywords are flattened into a comma-separated string.\n *\n * @example\n * ```tsx\n * keywords: \"nextjs, react, blog\"\n * // or\n * keywords: [\"react\", \"server components\"]\n * ```\n */\n keywords?: null | string | Array | undefined\n\n /**\n * The referrer setting for the document.\n *\n * @example\n * ```tsx\n * referrer: \"origin\"\n * // Renders: \n * ```\n */\n referrer?: null | ReferrerEnum | undefined\n\n /**\n * The theme color for the document.\n *\n * @deprecated Use the new viewport configuration (`export const viewport: Viewport = { ... }`) instead.\n */\n themeColor?:\n | null\n | string\n | ThemeColorDescriptor\n | ThemeColorDescriptor[]\n | undefined\n\n /**\n * The color scheme for the document.\n *\n * @deprecated Use the new viewport configuration (`export const viewport: Viewport = { ... }`) instead.\n */\n colorScheme?: null | ColorSchemeEnum | undefined\n\n /**\n * The viewport setting for the document.\n *\n * @deprecated Use the new viewport configuration (`export const viewport: Viewport = { ... }`) instead.\n */\n viewport?: null | string | ViewportLayout | undefined\n\n /**\n * The creator of the document.\n *\n * @example\n * ```tsx\n * creator: \"Next.js Team\"\n * // Renders: \n * ```\n */\n creator?: null | string | undefined\n\n /**\n * The publisher of the document.\n *\n * @example\n * ```tsx\n * publisher: \"Vercel\"\n * // Renders: \n * ```\n */\n publisher?: null | string | undefined\n\n // https://developer.mozilla.org/docs/Web/HTML/Element/meta/name#other_metadata_names\n\n /**\n * The robots setting for the document.\n *\n * @remarks\n * Can be a string (e.g., \"index, follow\") or an object with more granular rules.\n *\n * @example\n * ```tsx\n * robots: \"index, follow\"\n * // or\n * robots: { index: true, follow: true }\n * ```\n *\n * @see https://developer.mozilla.org/docs/Glossary/Robots.txt\n */\n robots?: null | string | Robots | undefined\n\n /**\n * The canonical and alternate URLs for the document.\n *\n * @remarks\n * This field allows defining a canonical URL as well as alternate URLs (such as for multiple languages).\n *\n * @example\n * ```tsx\n * alternates: {\n * canonical: \"https://example.com\",\n * languages: {\n * \"en-US\": \"https://example.com/en-US\"\n * }\n * }\n * ```\n */\n alternates?: null | AlternateURLs | undefined\n\n /**\n * The icons for the document. Defaults to rel=\"icon\".\n *\n * @remarks\n * You can specify a simple URL or an object to differentiate between icon types (e.g., apple-touch-icon).\n *\n * @example\n * ```tsx\n * icons: \"https://example.com/icon.png\"\n * // or\n * icons: {\n * icon: \"https://example.com/icon.png\",\n * apple: \"https://example.com/apple-icon.png\"\n * }\n * ```\n *\n * @see https://developer.mozilla.org/docs/Web/HTML/Attributes/rel#attr-icon\n */\n icons?: null | IconURL | Array | Icons | undefined\n\n /**\n * A web application manifest, as defined in the Web Application Manifest specification.\n *\n * @example\n * ```tsx\n * manifest: \"https://example.com/manifest.json\"\n * // Renders: \n * ```\n *\n * @see https://developer.mozilla.org/docs/Web/Manifest\n */\n manifest?: null | string | URL | undefined\n\n /**\n * The Open Graph metadata for the document.\n *\n * @remarks\n * Follows the Open Graph protocol to enrich link previews.\n *\n * @example\n * ```tsx\n * openGraph: {\n * type: \"website\",\n * url: \"https://example.com\",\n * title: \"My Website\",\n * description: \"My Website Description\",\n * siteName: \"My Website\",\n * images: [{ url: \"https://example.com/og.png\" }]\n * }\n * ```\n *\n * @see https://ogp.me/\n */\n openGraph?: null | OpenGraph | undefined\n\n /**\n * The Twitter metadata for the document.\n *\n * @remarks\n * - Used for configuring Twitter Cards and can include details such as `card`, `site`, and `creator`.\n * - Notably, more sites than just Twitter (now X) use this format.\n *\n * @example\n * ```tsx\n * twitter: {\n * card: \"summary_large_image\",\n * site: \"@site\",\n * creator: \"@creator\",\n * images: \"https://example.com/og.png\"\n * }\n * ```\n */\n twitter?: null | Twitter | undefined\n\n /**\n * The Facebook metadata for the document.\n *\n * @remarks\n * Specify either `appId` or `admins` (but not both) to configure Facebook integration.\n *\n * @example\n * ```tsx\n * facebook: { appId: \"12345678\" }\n * // Renders \n * // or\n * facebook: { admins: [\"12345678\"] }\n * // Renders \n * ```\n */\n facebook?: null | Facebook | undefined\n\n /**\n * The Pinterest metadata for the document to choose whether opt out of rich pin data.\n *\n * @example\n * ```tsx\n * pinterest: { richPin: true }\n * // Renders \n * ```\n */\n pinterest?: null | Pinterest\n\n /**\n * The common verification tokens for the document.\n *\n * @example\n * ```tsx\n * verification: { google: \"1234567890\", yandex: \"1234567890\", \"me\": \"1234567890\" }\n * // Renders \n * // \n * // \n * ```\n */\n verification?: Verification | undefined\n\n /**\n * The Apple web app metadata for the document.\n *\n * @example\n * ```tsx\n * appleWebApp: { capable: true, title: \"My Website\", statusBarStyle: \"black-translucent\" }\n * ```\n *\n * @see https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html\n */\n appleWebApp?: null | boolean | AppleWebApp | undefined\n\n /**\n * Indicates whether devices should interpret certain formats (such as telephone numbers) as actionable links.\n *\n * @example\n * ```tsx\n * formatDetection: { telephone: false }\n * // Renders: \n * ```\n */\n formatDetection?: null | FormatDetection | undefined\n\n /**\n * The metadata for the iTunes App.\n *\n * @remarks\n * Adds the `name=\"apple-itunes-app\"` meta tag.\n *\n * @example\n * ```tsx\n * itunes: { app: { id: \"123456789\", affiliateData: \"123456789\", appArguments: \"123456789\" } }\n * // Renders \n * ```\n */\n itunes?: null | ItunesApp | undefined\n\n /**\n * A brief description of the web page.\n *\n * @remarks\n * Rendered as the `abstract` meta tag. This is *not recommended* as it is superseded by `description`.\n *\n * @example\n * ```tsx\n * abstract: \"My Website Description\"\n * // Renders \n * ```\n */\n abstract?: null | string | undefined\n\n /**\n * The Facebook AppLinks metadata for the document.\n *\n * @example\n * ```tsx\n * appLinks: {\n * ios: { appStoreId: \"123456789\", url: \"https://example.com\" },\n * android: { packageName: \"com.example\", url: \"https://example.com\" }\n * }\n *\n * // Renders\n * \n * \n * \n * \n * ```\n */\n appLinks?: null | AppLinks | undefined\n\n /**\n * The archives link rel property.\n *\n * @example\n * ```tsx\n * archives: \"https://example.com/archives\"\n * // Renders \n * ```\n */\n archives?: null | string | Array | undefined\n\n /**\n * The assets link rel property.\n *\n * @example\n * ```tsx\n * assets: \"https://example.com/assets\"\n * // Renders \n * ```\n */\n assets?: null | string | Array | undefined\n\n /**\n * The bookmarks link rel property.\n *\n * @remarks\n * Although technically against the HTML spec, this is used in practice.\n *\n * @example\n * ```tsx\n * bookmarks: \"https://example.com/bookmarks\"\n * // Renders \n * ```\n */\n bookmarks?: null | string | Array | undefined\n\n /**\n * The pagination link rel properties.\n *\n * @example\n * ```tsx\n * pagination: {\n * previous: \"https://example.com/items?page=1\",\n * next: \"https://example.com/items?page=3\"\n * }\n *\n * // Renders\n * \n * \n * ```\n *\n * @see https://developers.google.com/search/blog/2011/09/pagination-with-relnext-and-relprev\n */\n pagination?: {\n previous?: null | string | URL | undefined\n next?: null | string | URL | undefined\n }\n\n /**\n * The category meta name property.\n *\n * @example\n * ```tsx\n * category: \"My Category\"\n * // Renders \n * ```\n */\n category?: null | string | undefined\n\n /**\n * The classification meta name property.\n *\n * @example\n * ```tsx\n * classification: \"My Classification\"\n * // Renders \n * ```\n */\n classification?: null | string | undefined\n\n /**\n * Arbitrary name/value pairs for additional metadata.\n *\n * @remarks\n * Use this field to define custom meta tags that are not directly supported.\n *\n * @example\n * ```tsx\n * other: { custom: [\"meta1\", \"meta2\"] }\n * ```\n */\n other?:\n | {\n [name: string]: string | number | Array\n }\n | undefined\n}\n\n/**\n * ResolvedMetadataWithURLs represents the fully processed metadata after\n * defaults are applied and relative URLs are composed with `metadataBase`.\n */\ninterface ResolvedMetadataWithURLs {\n // origin and base path for absolute urls for various metadata links such as\n // opengraph-image\n metadataBase: string | null | URL\n\n // The Document title and template if defined\n title: null | AbsoluteTemplateString\n\n // The Document description, and optionally the opengraph and twitter descriptions\n description: null | string\n\n // Standard metadata names\n // https://developer.mozilla.org/docs/Web/HTML/Element/meta/name\n applicationName: null | string\n authors: null | Array\n generator: null | string\n // if you provide an array it will be flattened into a single tag with comma separation\n keywords: null | Array\n referrer: null | ReferrerEnum\n /**\n * @deprecated\n */\n themeColor: null | ThemeColorDescriptor[]\n /**\n * @deprecated\n */\n colorScheme: null | ColorSchemeEnum\n /**\n * @deprecated\n */\n viewport: null | string\n creator: null | string\n publisher: null | string\n\n // https://developer.mozilla.org/docs/Web/HTML/Element/meta/name#other_metadata_names\n robots: null | ResolvedRobots\n\n // The canonical and alternate URLs for this location\n alternates: null | ResolvedAlternateURLs\n\n // Defaults to rel=\"icon\" but the Icons type can be used\n // to get more specific about rel types\n icons: null | ResolvedIcons\n\n openGraph: null | ResolvedOpenGraph\n\n manifest: null | string | URL\n\n twitter: null | ResolvedTwitterMetadata\n\n facebook: null | ResolvedFacebook\n\n pinterest: null | ResolvedPinterest\n\n // common verification tokens\n verification: null | ResolvedVerification\n\n // Apple web app metadata\n // https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html\n appleWebApp: null | ResolvedAppleWebApp\n\n // Should devices try to interpret various formats and make actionable links\n // out of them? The canonical example is telephone numbers on mobile that can\n // be clicked to dial\n formatDetection: null | FormatDetection\n\n // meta name=\"apple-itunes-app\"\n itunes: null | ItunesApp\n\n // meta name=\"abstract\"\n // A brief description of what this web-page is about.\n // Not recommended, superceded by description.\n // https://www.metatags.org/all-meta-tags-overview/meta-name-abstract/\n abstract: null | string\n\n // Facebook AppLinks\n appLinks: null | ResolvedAppLinks\n\n // link rel properties\n archives: null | Array\n assets: null | Array\n bookmarks: null | Array // This is technically against HTML spec but is used in wild\n pagination: {\n previous: null | string\n next: null | string\n }\n\n // meta name properties\n category: null | string\n classification: null | string\n other: null | {\n [name: string]: string | number | Array\n }\n}\n\nexport type WithStringifiedURLs = T extends URL\n ? string\n : T extends object\n ? { [K in keyof T]: WithStringifiedURLs }\n : T\n\n/**\n * ResolvedMetadata represents the fully processed metadata after defaults are\n * applied and relative URLs are composed with `metadataBase`.\n */\ntype ResolvedMetadata = WithStringifiedURLs\n\ntype RobotsRuleBase = {\n allow?: string | string[] | undefined\n disallow?: string | string[] | undefined\n crawlDelay?: number | undefined\n /**\n * Non-standard per-user-agent directives passed through verbatim to the\n * generated `robots.txt`. Keys preserve their casing and array values emit\n * one line per entry.\n *\n * @example\n * ```ts\n * // Seznam rate-limiting\n * // https://o-seznam.cz/napoveda/vyhledavani/en/crawling-control/\n * other: { 'Request-Rate': '10/1m' }\n *\n * // Yandex Clean-param (multiple values)\n * other: { 'Clean-param': ['ref /articles/', 'utm_source /'] }\n * ```\n */\n other?: Record> | undefined\n}\n\ntype RobotsFile = {\n // Apply rules for all\n rules:\n | (RobotsRuleBase & {\n userAgent?: string | string[] | undefined\n })\n // Apply rules for specific user agents\n | Array<\n RobotsRuleBase & {\n userAgent: string | string[]\n }\n >\n sitemap?: string | string[] | undefined\n host?: string | undefined\n}\n\ntype SitemapFile = Array<{\n url: string\n lastModified?: string | Date | undefined\n changeFrequency?:\n | 'always'\n | 'hourly'\n | 'daily'\n | 'weekly'\n | 'monthly'\n | 'yearly'\n | 'never'\n | undefined\n priority?: number | undefined\n alternates?:\n | {\n languages?: Languages | undefined\n }\n | undefined\n images?: string[] | undefined\n videos?: Videos[] | undefined\n}>\n\ntype ResolvingMetadata = Promise\ndeclare namespace MetadataRoute {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n export type Robots = RobotsFile\n export type Sitemap = SitemapFile\n export type Manifest = ManifestFile\n}\n\n/**\n * Interface for the viewport configuration.\n *\n * @remarks\n * This configuration allows defining properties such as width, initial scale, theme colors,\n * and color scheme.\n *\n * @example\n * ```tsx\n * export const viewport: Viewport = {\n * width: \"device-width\",\n * initialScale: 1,\n * themeColor: [\n * { media: \"(prefers-color-scheme: dark)\", color: \"#000000\" },\n * { media: \"(prefers-color-scheme: light)\", color: \"#ffffff\" }\n * ],\n * colorScheme: \"dark\"\n * }\n * ```\n */\ninterface Viewport extends ViewportLayout {\n /**\n * The theme color for the document.\n *\n * @example\n * ```tsx\n * themeColor: \"#000000\"\n * // Renders \n *\n * themeColor: { media: \"(prefers-color-scheme: dark)\", color: \"#000000\" }\n * // Renders \n *\n * themeColor: [\n * { media: \"(prefers-color-scheme: dark)\", color: \"#000000\" },\n * { media: \"(prefers-color-scheme: light)\", color: \"#ffffff\" }\n * ]\n * // Renders \n * // Renders \n * ```\n */\n themeColor?:\n | null\n | string\n | ThemeColorDescriptor\n | ThemeColorDescriptor[]\n | undefined\n\n /**\n * The color scheme for the document.\n *\n * @example\n * ```tsx\n * colorScheme: \"dark\"\n * // Renders \n * ```\n */\n colorScheme?: null | ColorSchemeEnum | undefined\n}\n\ninterface ResolvedViewport extends ViewportLayout {\n themeColor: null | ThemeColorDescriptor[]\n colorScheme: null | ColorSchemeEnum\n}\n\ntype ResolvingViewport = Promise\n\nexport type {\n Metadata,\n ResolvedMetadata,\n ResolvedMetadataWithURLs,\n ResolvingMetadata,\n MetadataRoute,\n Viewport,\n ResolvingViewport,\n ResolvedViewport,\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;CAYC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/metadata-types.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/types/metadata-types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5413c5f16b1217102b1fcd0805276892489abd5b --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/metadata-types.d.ts @@ -0,0 +1,145 @@ +/** + * + * Metadata types + * + */ +export interface DeprecatedMetadataFields { + /** + * Deprecated options that have a preferred method + * @deprecated Use appleWebApp instead + */ + 'apple-touch-fullscreen'?: never | undefined; + /** + * Obsolete since iOS 7. + * @see https://web.dev/apple-touch-icon/ + * @deprecated Use icons.apple instead + */ + 'apple-touch-icon-precomposed'?: never | undefined; +} +export type TemplateString = DefaultTemplateString | AbsoluteTemplateString | AbsoluteString; +export type DefaultTemplateString = { + default: string; + template: string; +}; +export type AbsoluteTemplateString = { + absolute: string; + template: string | null; +}; +export type AbsoluteString = { + absolute: string; +}; +export type Author = { + url?: string | URL | undefined; + name?: string | undefined; +}; +export type ReferrerEnum = 'no-referrer' | 'origin' | 'no-referrer-when-downgrade' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin'; +export type ColorSchemeEnum = 'normal' | 'light' | 'dark' | 'light dark' | 'dark light' | 'only light'; +type RobotsInfo = { + index?: boolean | undefined; + follow?: boolean | undefined; + /** @deprecated set index to false instead */ + noindex?: never | undefined; + /** @deprecated set follow to false instead */ + nofollow?: never | undefined; + noarchive?: boolean | undefined; + nosnippet?: boolean | undefined; + noimageindex?: boolean | undefined; + nocache?: boolean | undefined; + notranslate?: boolean | undefined; + indexifembedded?: boolean | undefined; + nositelinkssearchbox?: boolean | undefined; + unavailable_after?: string | undefined; + 'max-video-preview'?: number | string | undefined; + 'max-image-preview'?: 'none' | 'standard' | 'large' | undefined; + 'max-snippet'?: number | undefined; +}; +export type Robots = RobotsInfo & { + googleBot?: string | RobotsInfo | undefined; +}; +export type ResolvedRobots = { + basic: string | null; + googleBot: string | null; +}; +export type IconURL = string | URL; +export type Icon = IconURL | IconDescriptor; +export type IconDescriptor = { + url: string | URL; + type?: string | undefined; + sizes?: string | undefined; + color?: string | undefined; + /** defaults to rel="icon" unless superseded by Icons map */ + rel?: string | undefined; + media?: string | undefined; + /** + * @see https://developer.mozilla.org/docs/Web/API/HTMLImageElement/fetchPriority + */ + fetchPriority?: 'high' | 'low' | 'auto' | undefined; +}; +export type Icons = { + /** rel="icon" */ + icon?: Icon | Icon[] | undefined; + /** rel="shortcut icon" */ + shortcut?: Icon | Icon[] | undefined; + /** + * @see https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html + * rel="apple-touch-icon" + */ + apple?: Icon | Icon[] | undefined; + /** rel inferred from descriptor, defaults to "icon" */ + other?: IconDescriptor | IconDescriptor[] | undefined; +}; +export type Verification = { + google?: null | string | number | (string | number)[] | undefined; + yahoo?: null | string | number | (string | number)[] | undefined; + yandex?: null | string | number | (string | number)[] | undefined; + me?: null | string | number | (string | number)[] | undefined; + other?: { + [name: string]: string | number | (string | number)[]; + } | undefined; +}; +export type ResolvedVerification = { + google?: null | (string | number)[] | undefined; + yahoo?: null | (string | number)[] | undefined; + yandex?: null | (string | number)[] | undefined; + me?: null | (string | number)[] | undefined; + other?: { + [name: string]: (string | number)[]; + } | undefined; +}; +export type ResolvedIcons = { + icon: IconDescriptor[]; + apple: IconDescriptor[]; + shortcut?: IconDescriptor[] | undefined; + other?: IconDescriptor[] | undefined; +}; +export type ThemeColorDescriptor = { + color: string; + media?: string | undefined; +}; +export type Restriction = { + relationship: 'allow' | 'deny'; + content: string; +}; +export type Videos = { + title: string; + thumbnail_loc: string; + description: string; + content_loc?: string | undefined; + player_loc?: string | undefined; + duration?: number | undefined; + expiration_date?: Date | string | undefined; + rating?: number | undefined; + view_count?: number | undefined; + publication_date?: Date | string | undefined; + family_friendly?: 'yes' | 'no' | undefined; + restriction?: Restriction | undefined; + platform?: Restriction | undefined; + requires_subscription?: 'yes' | 'no' | undefined; + uploader?: { + info?: string | undefined; + content?: string | undefined; + } | undefined; + live?: 'yes' | 'no' | undefined; + tag?: string | undefined; +}; +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/metadata-types.js b/e-commerce/node_modules/next/dist/lib/metadata/types/metadata-types.js new file mode 100644 index 0000000000000000000000000000000000000000..0163f77e2861e468db80e1bb4b910cb6eaafb6ba --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/metadata-types.js @@ -0,0 +1,10 @@ +/** + * + * Metadata types + * + */ "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); + +//# sourceMappingURL=metadata-types.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/metadata-types.js.map b/e-commerce/node_modules/next/dist/lib/metadata/types/metadata-types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..535da42f6201e3d735f41c293c3e5bc1a40df502 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/metadata-types.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/lib/metadata/types/metadata-types.ts"],"sourcesContent":["/**\n *\n * Metadata types\n *\n */\n\nexport interface DeprecatedMetadataFields {\n /**\n * Deprecated options that have a preferred method\n * @deprecated Use appleWebApp instead\n */\n 'apple-touch-fullscreen'?: never | undefined\n\n /**\n * Obsolete since iOS 7.\n * @see https://web.dev/apple-touch-icon/\n * @deprecated Use icons.apple instead\n */\n 'apple-touch-icon-precomposed'?: never | undefined\n}\n\nexport type TemplateString =\n | DefaultTemplateString\n | AbsoluteTemplateString\n | AbsoluteString\nexport type DefaultTemplateString = {\n default: string\n template: string\n}\nexport type AbsoluteTemplateString = {\n absolute: string\n template: string | null\n}\nexport type AbsoluteString = {\n absolute: string\n}\n\nexport type Author = {\n // renders as | undefined; + phoneNumbers?: string | Array | undefined; + faxNumbers?: string | Array | undefined; + siteName?: string | undefined; + locale?: Locale | undefined; + alternateLocale?: Locale | Array | undefined; + images?: OGImage | Array | undefined; + audio?: OGAudio | Array | undefined; + videos?: OGVideo | Array | undefined; + url?: null | string | URL | undefined; + countryName?: string | undefined; + ttl?: number | undefined; +}; +type OpenGraphWebsite = OpenGraphMetadata & { + type: 'website'; +}; +type OpenGraphArticle = OpenGraphMetadata & { + type: 'article'; + publishedTime?: string | undefined; + modifiedTime?: string | undefined; + expirationTime?: string | undefined; + authors?: null | string | URL | Array | undefined; + section?: null | string | undefined; + tags?: null | string | Array | undefined; +}; +type OpenGraphBook = OpenGraphMetadata & { + type: 'book'; + isbn?: null | string | undefined; + releaseDate?: null | string | undefined; + authors?: null | string | URL | Array | undefined; + tags?: null | string | Array | undefined; +}; +type OpenGraphProfile = OpenGraphMetadata & { + type: 'profile'; + firstName?: null | string | undefined; + lastName?: null | string | undefined; + username?: null | string | undefined; + gender?: null | string | undefined; +}; +type OpenGraphMusicSong = OpenGraphMetadata & { + type: 'music.song'; + duration?: null | number | undefined; + albums?: null | string | URL | OGAlbum | Array | undefined; + musicians?: null | string | URL | Array | undefined; +}; +type OpenGraphMusicAlbum = OpenGraphMetadata & { + type: 'music.album'; + songs?: null | string | URL | OGSong | Array | undefined; + musicians?: null | string | URL | Array | undefined; + releaseDate?: null | string | undefined; +}; +type OpenGraphMusicPlaylist = OpenGraphMetadata & { + type: 'music.playlist'; + songs?: null | string | URL | OGSong | Array | undefined; + creators?: null | string | URL | Array | undefined; +}; +type OpenGraphRadioStation = OpenGraphMetadata & { + type: 'music.radio_station'; + creators?: null | string | URL | Array | undefined; +}; +type OpenGraphVideoMovie = OpenGraphMetadata & { + type: 'video.movie'; + actors?: null | string | URL | OGActor | Array | undefined; + directors?: null | string | URL | Array | undefined; + writers?: null | string | URL | Array | undefined; + duration?: null | number | undefined; + releaseDate?: null | string | undefined; + tags?: null | string | Array | undefined; +}; +type OpenGraphVideoEpisode = OpenGraphMetadata & { + type: 'video.episode'; + actors?: null | string | URL | OGActor | Array | undefined; + directors?: null | string | URL | Array | undefined; + writers?: null | string | URL | Array | undefined; + duration?: null | number | undefined; + releaseDate?: null | string | undefined; + tags?: null | string | Array | undefined; + series?: null | string | URL | undefined; +}; +type OpenGraphVideoTVShow = OpenGraphMetadata & { + type: 'video.tv_show'; +}; +type OpenGraphVideoOther = OpenGraphMetadata & { + type: 'video.other'; +}; +type OGImage = string | OGImageDescriptor | URL; +type OGImageDescriptor = { + url: string | URL; + secureUrl?: string | URL | undefined; + alt?: string | undefined; + type?: string | undefined; + width?: string | number | undefined; + height?: string | number | undefined; +}; +type OGAudio = string | OGAudioDescriptor | URL; +type OGAudioDescriptor = { + url: string | URL; + secureUrl?: string | URL | undefined; + type?: string | undefined; +}; +type OGVideo = string | OGVideoDescriptor | URL; +type OGVideoDescriptor = { + url: string | URL; + secureUrl?: string | URL | undefined; + type?: string | undefined; + width?: string | number | undefined; + height?: string | number | undefined; +}; +export type ResolvedOpenGraph = ResolvedOpenGraphWebsite | ResolvedOpenGraphArticle | ResolvedOpenGraphBook | ResolvedOpenGraphProfile | ResolvedOpenGraphMusicSong | ResolvedOpenGraphMusicAlbum | ResolvedOpenGraphMusicPlaylist | ResolvedOpenGraphRadioStation | ResolvedOpenGraphVideoMovie | ResolvedOpenGraphVideoEpisode | ResolvedOpenGraphVideoTVShow | ResolvedOpenGraphVideoOther | ResolvedOpenGraphMetadata; +type ResolvedOpenGraphMetadata = { + determiner?: 'a' | 'an' | 'the' | 'auto' | '' | undefined; + title: AbsoluteTemplateString; + description?: string | undefined; + emails?: Array | undefined; + phoneNumbers?: Array | undefined; + faxNumbers?: Array | undefined; + siteName?: string | undefined; + locale?: Locale | undefined; + alternateLocale?: Array | undefined; + images?: Array | undefined; + audio?: Array | undefined; + videos?: Array | undefined; + url: null | URL | string; + countryName?: string | undefined; + ttl?: number | undefined; +}; +type ResolvedOpenGraphWebsite = ResolvedOpenGraphMetadata & { + type: 'website'; +}; +type ResolvedOpenGraphArticle = ResolvedOpenGraphMetadata & { + type: 'article'; + publishedTime?: string | undefined; + modifiedTime?: string | undefined; + expirationTime?: string | undefined; + authors?: Array | undefined; + section?: string | undefined; + tags?: Array | undefined; +}; +type ResolvedOpenGraphBook = ResolvedOpenGraphMetadata & { + type: 'book'; + isbn?: string | undefined; + releaseDate?: string | undefined; + authors?: Array | undefined; + tags?: Array | undefined; +}; +type ResolvedOpenGraphProfile = ResolvedOpenGraphMetadata & { + type: 'profile'; + firstName?: string | undefined; + lastName?: string | undefined; + username?: string | undefined; + gender?: string | undefined; +}; +type ResolvedOpenGraphMusicSong = ResolvedOpenGraphMetadata & { + type: 'music.song'; + duration?: number | undefined; + albums?: Array | undefined; + musicians?: Array | undefined; +}; +type ResolvedOpenGraphMusicAlbum = ResolvedOpenGraphMetadata & { + type: 'music.album'; + songs?: Array | undefined; + musicians?: Array | undefined; + releaseDate?: string | undefined; +}; +type ResolvedOpenGraphMusicPlaylist = ResolvedOpenGraphMetadata & { + type: 'music.playlist'; + songs?: Array | undefined; + creators?: Array | undefined; +}; +type ResolvedOpenGraphRadioStation = ResolvedOpenGraphMetadata & { + type: 'music.radio_station'; + creators?: Array | undefined; +}; +type ResolvedOpenGraphVideoMovie = ResolvedOpenGraphMetadata & { + type: 'video.movie'; + actors?: Array | undefined; + directors?: Array | undefined; + writers?: Array | undefined; + duration?: number | undefined; + releaseDate?: string | undefined; + tags?: Array | undefined; +}; +type ResolvedOpenGraphVideoEpisode = ResolvedOpenGraphMetadata & { + type: 'video.episode'; + actors?: Array | undefined; + directors?: Array | undefined; + writers?: Array | undefined; + duration?: number | undefined; + releaseDate?: string | undefined; + tags?: Array | undefined; + series?: string | URL | undefined; +}; +type ResolvedOpenGraphVideoTVShow = ResolvedOpenGraphMetadata & { + type: 'video.tv_show'; +}; +type ResolvedOpenGraphVideoOther = ResolvedOpenGraphMetadata & { + type: 'video.other'; +}; +type OGSong = { + url: string | URL; + disc?: number | undefined; + track?: number | undefined; +}; +type OGAlbum = { + url: string | URL; + disc?: number | undefined; + track?: number | undefined; +}; +type OGActor = { + url: string | URL; + role?: string | undefined; +}; +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/opengraph-types.js b/e-commerce/node_modules/next/dist/lib/metadata/types/opengraph-types.js new file mode 100644 index 0000000000000000000000000000000000000000..79081b8f0e42684f92a0624a5c95890bac68ea3d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/opengraph-types.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); + +//# sourceMappingURL=opengraph-types.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/opengraph-types.js.map b/e-commerce/node_modules/next/dist/lib/metadata/types/opengraph-types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ad48a910f81e5873737ebce8e9fa87278c9f7cd9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/opengraph-types.js.map @@ -0,0 +1 @@ +{"version":3,"sources":[],"names":[],"mappings":"","ignoreList":[]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/resolvers.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/types/resolvers.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..529d5107dba065c3c198a71b8b0a22b3450beb33 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/resolvers.d.ts @@ -0,0 +1,8 @@ +import type { Metadata, ResolvedMetadataWithURLs } from './metadata-interface'; +export type FieldResolver = (T: Data[Key]) => ResolvedData[Key]; +export type FieldResolverExtraArgs = (T: Data[Key], ...args: ExtraArgs) => ResolvedData[Key]; +export type AsyncFieldResolverExtraArgs = (T: Data[Key], ...args: ExtraArgs) => Promise; +export type MetadataContext = { + trailingSlash: boolean; + isStaticMetadataRouteFile: boolean; +}; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/resolvers.js b/e-commerce/node_modules/next/dist/lib/metadata/types/resolvers.js new file mode 100644 index 0000000000000000000000000000000000000000..955388195e0a95b3d9894862a6f0efc8aeb826b6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/resolvers.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); + +//# sourceMappingURL=resolvers.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/resolvers.js.map b/e-commerce/node_modules/next/dist/lib/metadata/types/resolvers.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ad48a910f81e5873737ebce8e9fa87278c9f7cd9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/resolvers.js.map @@ -0,0 +1 @@ +{"version":3,"sources":[],"names":[],"mappings":"","ignoreList":[]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/twitter-types.d.ts b/e-commerce/node_modules/next/dist/lib/metadata/types/twitter-types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..64fbd88198e86774aea7a125f3be1e6c5746508e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/twitter-types.d.ts @@ -0,0 +1,86 @@ +import type { AbsoluteTemplateString, TemplateString } from './metadata-types'; +export type Twitter = TwitterSummary | TwitterSummaryLargeImage | TwitterPlayer | TwitterApp | TwitterMetadata; +type TwitterMetadata = { + site?: null | string | undefined; + siteId?: null | string | undefined; + creator?: null | string | undefined; + creatorId?: null | string | undefined; + description?: null | string | undefined; + title?: string | TemplateString | undefined; + images?: TwitterImage | Array | undefined; +}; +type TwitterSummary = TwitterMetadata & { + card: 'summary'; +}; +type TwitterSummaryLargeImage = TwitterMetadata & { + card: 'summary_large_image'; +}; +type TwitterPlayer = TwitterMetadata & { + card: 'player'; + players: TwitterPlayerDescriptor | Array; +}; +type TwitterApp = TwitterMetadata & { + card: 'app'; + app: TwitterAppDescriptor; +}; +export type TwitterAppDescriptor = { + id: { + iphone?: string | number | undefined; + ipad?: string | number | undefined; + googleplay?: string | undefined; + }; + url?: { + iphone?: string | URL | undefined; + ipad?: string | URL | undefined; + googleplay?: string | URL | undefined; + } | undefined; + name?: string | undefined; +}; +type TwitterImage = string | TwitterImageDescriptor | URL; +type TwitterImageDescriptor = { + url: string | URL; + alt?: string | undefined; + secureUrl?: string | URL | undefined; + type?: string | undefined; + width?: string | number | undefined; + height?: string | number | undefined; +}; +type TwitterPlayerDescriptor = { + playerUrl: string | URL; + streamUrl: string | URL; + width: number; + height: number; +}; +type ResolvedTwitterImage = { + url: string | URL; + alt?: string | undefined; + secureUrl?: string | URL | undefined; + type?: string | undefined; + width?: string | number | undefined; + height?: string | number | undefined; +}; +type ResolvedTwitterSummary = { + site: string | null; + siteId: string | null; + creator: string | null; + creatorId: string | null; + description: string | null; + title: AbsoluteTemplateString; + images?: Array | undefined; +}; +type ResolvedTwitterPlayer = ResolvedTwitterSummary & { + players: Array; +}; +type ResolvedTwitterApp = ResolvedTwitterSummary & { + app: TwitterAppDescriptor; +}; +export type ResolvedTwitterMetadata = ({ + card: 'summary'; +} & ResolvedTwitterSummary) | ({ + card: 'summary_large_image'; +} & ResolvedTwitterSummary) | ({ + card: 'player'; +} & ResolvedTwitterPlayer) | ({ + card: 'app'; +} & ResolvedTwitterApp); +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/twitter-types.js b/e-commerce/node_modules/next/dist/lib/metadata/types/twitter-types.js new file mode 100644 index 0000000000000000000000000000000000000000..f1c4f9ec18e03669dbc06cff598d838b1f0e6361 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/twitter-types.js @@ -0,0 +1,7 @@ +// Reference: https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); + +//# sourceMappingURL=twitter-types.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/metadata/types/twitter-types.js.map b/e-commerce/node_modules/next/dist/lib/metadata/types/twitter-types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..651fdb12da66b8a76a518181627faf30a3889331 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/metadata/types/twitter-types.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../../src/lib/metadata/types/twitter-types.ts"],"sourcesContent":["// Reference: https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup\n\nimport type { AbsoluteTemplateString, TemplateString } from './metadata-types'\n\nexport type Twitter =\n | TwitterSummary\n | TwitterSummaryLargeImage\n | TwitterPlayer\n | TwitterApp\n | TwitterMetadata\n\ntype TwitterMetadata = {\n // defaults to card=\"summary\"\n site?: null | string | undefined // username for account associated to the site itself\n siteId?: null | string | undefined // id for account associated to the site itself\n creator?: null | string | undefined // username for the account associated to the creator of the content on the site\n creatorId?: null | string | undefined // id for the account associated to the creator of the content on the site\n description?: null | string | undefined\n title?: string | TemplateString | undefined\n images?: TwitterImage | Array | undefined\n}\ntype TwitterSummary = TwitterMetadata & {\n card: 'summary'\n}\ntype TwitterSummaryLargeImage = TwitterMetadata & {\n card: 'summary_large_image'\n}\ntype TwitterPlayer = TwitterMetadata & {\n card: 'player'\n players: TwitterPlayerDescriptor | Array\n}\ntype TwitterApp = TwitterMetadata & {\n card: 'app'\n app: TwitterAppDescriptor\n}\nexport type TwitterAppDescriptor = {\n id: {\n iphone?: string | number | undefined\n ipad?: string | number | undefined\n googleplay?: string | undefined\n }\n url?:\n | {\n iphone?: string | URL | undefined\n ipad?: string | URL | undefined\n googleplay?: string | URL | undefined\n }\n | undefined\n name?: string | undefined\n}\n\ntype TwitterImage = string | TwitterImageDescriptor | URL\ntype TwitterImageDescriptor = {\n url: string | URL\n alt?: string | undefined\n secureUrl?: string | URL | undefined\n type?: string | undefined\n width?: string | number | undefined\n height?: string | number | undefined\n}\ntype TwitterPlayerDescriptor = {\n playerUrl: string | URL\n streamUrl: string | URL\n width: number\n height: number\n}\n\ntype ResolvedTwitterImage = {\n url: string | URL\n alt?: string | undefined\n secureUrl?: string | URL | undefined\n type?: string | undefined\n width?: string | number | undefined\n height?: string | number | undefined\n}\ntype ResolvedTwitterSummary = {\n site: string | null\n siteId: string | null\n creator: string | null\n creatorId: string | null\n description: string | null\n title: AbsoluteTemplateString\n images?: Array | undefined\n}\ntype ResolvedTwitterPlayer = ResolvedTwitterSummary & {\n players: Array\n}\ntype ResolvedTwitterApp = ResolvedTwitterSummary & { app: TwitterAppDescriptor }\n\nexport type ResolvedTwitterMetadata =\n | ({ card: 'summary' } & ResolvedTwitterSummary)\n | ({ card: 'summary_large_image' } & ResolvedTwitterSummary)\n | ({ card: 'player' } & ResolvedTwitterPlayer)\n | ({ card: 'app' } & ResolvedTwitterApp)\n"],"names":[],"mappings":"AAAA,8FAA8F","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/mime-type.d.ts b/e-commerce/node_modules/next/dist/lib/mime-type.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1387747ece0ebe632ece00dc4440b94c59cba2d3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/mime-type.d.ts @@ -0,0 +1,9 @@ +/** + * Map of images extensions to MIME types + */ +export declare const imageExtMimeTypeMap: { + readonly jpeg: "image/jpeg"; + readonly png: "image/png"; + readonly ico: "image/x-icon"; + readonly svg: "image/svg+xml"; +}; diff --git a/e-commerce/node_modules/next/dist/lib/mime-type.js b/e-commerce/node_modules/next/dist/lib/mime-type.js new file mode 100644 index 0000000000000000000000000000000000000000..22742219c37a4733e2e2306f42a973fca6daf17e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/mime-type.js @@ -0,0 +1,20 @@ +/** + * Map of images extensions to MIME types + */ "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "imageExtMimeTypeMap", { + enumerable: true, + get: function() { + return imageExtMimeTypeMap; + } +}); +const imageExtMimeTypeMap = { + jpeg: 'image/jpeg', + png: 'image/png', + ico: 'image/x-icon', + svg: 'image/svg+xml' +}; + +//# sourceMappingURL=mime-type.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/mime-type.js.map b/e-commerce/node_modules/next/dist/lib/mime-type.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0b1fd83f8c85bf6ace380d26a69f374cb18552fd --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/mime-type.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/mime-type.ts"],"sourcesContent":["/**\n * Map of images extensions to MIME types\n */\nexport const imageExtMimeTypeMap = {\n jpeg: 'image/jpeg',\n png: 'image/png',\n ico: 'image/x-icon',\n svg: 'image/svg+xml',\n} as const\n"],"names":["imageExtMimeTypeMap","jpeg","png","ico","svg"],"mappings":"AAAA;;CAEC;;;;+BACYA;;;eAAAA;;;AAAN,MAAMA,sBAAsB;IACjCC,MAAM;IACNC,KAAK;IACLC,KAAK;IACLC,KAAK;AACP","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/mkcert.d.ts b/e-commerce/node_modules/next/dist/lib/mkcert.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f09ddb1cbf150475751a22c5dc948348008247d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/mkcert.d.ts @@ -0,0 +1,6 @@ +export interface SelfSignedCertificate { + key: string; + cert: string; + rootCA?: string; +} +export declare function createSelfSignedCertificate(host?: string, certDir?: string): Promise; diff --git a/e-commerce/node_modules/next/dist/lib/mkcert.js b/e-commerce/node_modules/next/dist/lib/mkcert.js new file mode 100644 index 0000000000000000000000000000000000000000..4b132238cffe73caf50fda44b39fac0986a1b9fe --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/mkcert.js @@ -0,0 +1,188 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "createSelfSignedCertificate", { + enumerable: true, + get: function() { + return createSelfSignedCertificate; + } +}); +const _nodefs = /*#__PURE__*/ _interop_require_default(require("node:fs")); +const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path")); +const _nodecrypto = require("node:crypto"); +const _getcachedirectory = require("./helpers/get-cache-directory"); +const _log = /*#__PURE__*/ _interop_require_wildcard(require("../build/output/log")); +const _nodechild_process = require("node:child_process"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +const { WritableStream } = require('node:stream/web'); +const MKCERT_VERSION = 'v1.4.4'; +function getBinaryName() { + const platform = process.platform; + const arch = process.arch === 'x64' ? 'amd64' : process.arch; + if (platform === 'win32') { + return `mkcert-${MKCERT_VERSION}-windows-${arch}.exe`; + } + if (platform === 'darwin') { + return `mkcert-${MKCERT_VERSION}-darwin-${arch}`; + } + if (platform === 'linux') { + return `mkcert-${MKCERT_VERSION}-linux-${arch}`; + } + throw new Error(`Unsupported platform: ${platform}`); +} +async function downloadBinary() { + try { + const binaryName = getBinaryName(); + const cacheDirectory = (0, _getcachedirectory.getCacheDirectory)('mkcert'); + const binaryPath = _nodepath.default.join(cacheDirectory, binaryName); + if (_nodefs.default.existsSync(binaryPath)) { + return binaryPath; + } + const downloadUrl = `https://github.com/FiloSottile/mkcert/releases/download/${MKCERT_VERSION}/${binaryName}`; + await _nodefs.default.promises.mkdir(cacheDirectory, { + recursive: true + }); + _log.info(`Downloading mkcert package...`); + const response = await fetch(downloadUrl); + if (!response.ok || !response.body) { + throw new Error(`request failed with status ${response.status}`); + } + _log.info(`Download response was successful, writing to disk`); + const binaryWriteStream = _nodefs.default.createWriteStream(binaryPath); + await response.body.pipeTo(new WritableStream({ + write (chunk) { + return new Promise((resolve, reject)=>{ + binaryWriteStream.write(chunk, (error)=>{ + if (error) { + reject(error); + return; + } + resolve(); + }); + }); + }, + close () { + return new Promise((resolve, reject)=>{ + binaryWriteStream.close((error)=>{ + if (error) { + reject(error); + return; + } + resolve(); + }); + }); + } + })); + await _nodefs.default.promises.chmod(binaryPath, 493); + return binaryPath; + } catch (err) { + _log.error('Error downloading mkcert:', err); + } +} +async function createSelfSignedCertificate(host, certDir = 'certificates') { + try { + const binaryPath = await downloadBinary(); + if (!binaryPath) throw new Error('missing mkcert binary'); + const resolvedCertDir = _nodepath.default.resolve(process.cwd(), `./${certDir}`); + await _nodefs.default.promises.mkdir(resolvedCertDir, { + recursive: true + }); + const keyPath = _nodepath.default.resolve(resolvedCertDir, 'localhost-key.pem'); + const certPath = _nodepath.default.resolve(resolvedCertDir, 'localhost.pem'); + if (_nodefs.default.existsSync(keyPath) && _nodefs.default.existsSync(certPath)) { + const cert = new _nodecrypto.X509Certificate(_nodefs.default.readFileSync(certPath)); + const key = _nodefs.default.readFileSync(keyPath); + if (cert.checkHost(host ?? 'localhost') && cert.checkPrivateKey((0, _nodecrypto.createPrivateKey)(key))) { + _log.info('Using already generated self signed certificate'); + const caLocation = (0, _nodechild_process.execSync)(`"${binaryPath}" -CAROOT`).toString().trim(); + return { + key: keyPath, + cert: certPath, + rootCA: `${caLocation}/rootCA.pem` + }; + } + } + _log.info('Attempting to generate self signed certificate. This may prompt for your password'); + const defaultHosts = [ + 'localhost', + '127.0.0.1', + '::1' + ]; + const hosts = host && !defaultHosts.includes(host) ? [ + ...defaultHosts, + host + ] : defaultHosts; + (0, _nodechild_process.execSync)(`"${binaryPath}" -install -key-file "${keyPath}" -cert-file "${certPath}" ${hosts.join(' ')}`, { + stdio: 'ignore' + }); + const caLocation = (0, _nodechild_process.execSync)(`"${binaryPath}" -CAROOT`).toString().trim(); + if (!_nodefs.default.existsSync(keyPath) || !_nodefs.default.existsSync(certPath)) { + throw new Error('Certificate files not found'); + } + _log.info(`CA Root certificate created in ${caLocation}`); + _log.info(`Certificates created in ${resolvedCertDir}`); + const gitignorePath = _nodepath.default.resolve(process.cwd(), './.gitignore'); + if (_nodefs.default.existsSync(gitignorePath)) { + const gitignore = await _nodefs.default.promises.readFile(gitignorePath, 'utf8'); + if (!gitignore.includes(certDir)) { + _log.info('Adding certificates to .gitignore'); + await _nodefs.default.promises.appendFile(gitignorePath, `\n${certDir}`); + } + } + return { + key: keyPath, + cert: certPath, + rootCA: `${caLocation}/rootCA.pem` + }; + } catch (err) { + _log.error('Failed to generate self-signed certificate. Falling back to http.', err); + } +} + +//# sourceMappingURL=mkcert.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/mkcert.js.map b/e-commerce/node_modules/next/dist/lib/mkcert.js.map new file mode 100644 index 0000000000000000000000000000000000000000..06b3b6da33043bd56598bc6e1ec43e7bedb6fdfd --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/mkcert.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/mkcert.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\nimport { X509Certificate, createPrivateKey } from 'node:crypto'\nimport { getCacheDirectory } from './helpers/get-cache-directory'\nimport * as Log from '../build/output/log'\nimport { execSync } from 'node:child_process'\nconst { WritableStream } =\n require('node:stream/web') as typeof import('node:stream/web')\n\nconst MKCERT_VERSION = 'v1.4.4'\n\nexport interface SelfSignedCertificate {\n key: string\n cert: string\n rootCA?: string\n}\n\nfunction getBinaryName() {\n const platform = process.platform\n const arch = process.arch === 'x64' ? 'amd64' : process.arch\n\n if (platform === 'win32') {\n return `mkcert-${MKCERT_VERSION}-windows-${arch}.exe`\n }\n if (platform === 'darwin') {\n return `mkcert-${MKCERT_VERSION}-darwin-${arch}`\n }\n if (platform === 'linux') {\n return `mkcert-${MKCERT_VERSION}-linux-${arch}`\n }\n\n throw new Error(`Unsupported platform: ${platform}`)\n}\n\nasync function downloadBinary() {\n try {\n const binaryName = getBinaryName()\n const cacheDirectory = getCacheDirectory('mkcert')\n const binaryPath = path.join(cacheDirectory, binaryName)\n\n if (fs.existsSync(binaryPath)) {\n return binaryPath\n }\n\n const downloadUrl = `https://github.com/FiloSottile/mkcert/releases/download/${MKCERT_VERSION}/${binaryName}`\n\n await fs.promises.mkdir(cacheDirectory, { recursive: true })\n\n Log.info(`Downloading mkcert package...`)\n\n const response = await fetch(downloadUrl)\n\n if (!response.ok || !response.body) {\n throw new Error(`request failed with status ${response.status}`)\n }\n\n Log.info(`Download response was successful, writing to disk`)\n\n const binaryWriteStream = fs.createWriteStream(binaryPath)\n\n await response.body.pipeTo(\n new WritableStream({\n write(chunk) {\n return new Promise((resolve, reject) => {\n binaryWriteStream.write(chunk, (error) => {\n if (error) {\n reject(error)\n return\n }\n\n resolve()\n })\n })\n },\n close() {\n return new Promise((resolve, reject) => {\n binaryWriteStream.close((error) => {\n if (error) {\n reject(error)\n return\n }\n\n resolve()\n })\n })\n },\n })\n )\n\n await fs.promises.chmod(binaryPath, 0o755)\n\n return binaryPath\n } catch (err) {\n Log.error('Error downloading mkcert:', err)\n }\n}\n\nexport async function createSelfSignedCertificate(\n host?: string,\n certDir: string = 'certificates'\n): Promise {\n try {\n const binaryPath = await downloadBinary()\n if (!binaryPath) throw new Error('missing mkcert binary')\n\n const resolvedCertDir = path.resolve(process.cwd(), `./${certDir}`)\n\n await fs.promises.mkdir(resolvedCertDir, {\n recursive: true,\n })\n\n const keyPath = path.resolve(resolvedCertDir, 'localhost-key.pem')\n const certPath = path.resolve(resolvedCertDir, 'localhost.pem')\n\n if (fs.existsSync(keyPath) && fs.existsSync(certPath)) {\n const cert = new X509Certificate(fs.readFileSync(certPath))\n const key = fs.readFileSync(keyPath)\n\n if (\n cert.checkHost(host ?? 'localhost') &&\n cert.checkPrivateKey(createPrivateKey(key))\n ) {\n Log.info('Using already generated self signed certificate')\n const caLocation = execSync(`\"${binaryPath}\" -CAROOT`).toString().trim()\n\n return {\n key: keyPath,\n cert: certPath,\n rootCA: `${caLocation}/rootCA.pem`,\n }\n }\n }\n\n Log.info(\n 'Attempting to generate self signed certificate. This may prompt for your password'\n )\n\n const defaultHosts = ['localhost', '127.0.0.1', '::1']\n\n const hosts =\n host && !defaultHosts.includes(host)\n ? [...defaultHosts, host]\n : defaultHosts\n\n execSync(\n `\"${binaryPath}\" -install -key-file \"${keyPath}\" -cert-file \"${certPath}\" ${hosts.join(\n ' '\n )}`,\n { stdio: 'ignore' }\n )\n\n const caLocation = execSync(`\"${binaryPath}\" -CAROOT`).toString().trim()\n\n if (!fs.existsSync(keyPath) || !fs.existsSync(certPath)) {\n throw new Error('Certificate files not found')\n }\n\n Log.info(`CA Root certificate created in ${caLocation}`)\n Log.info(`Certificates created in ${resolvedCertDir}`)\n\n const gitignorePath = path.resolve(process.cwd(), './.gitignore')\n\n if (fs.existsSync(gitignorePath)) {\n const gitignore = await fs.promises.readFile(gitignorePath, 'utf8')\n if (!gitignore.includes(certDir)) {\n Log.info('Adding certificates to .gitignore')\n\n await fs.promises.appendFile(gitignorePath, `\\n${certDir}`)\n }\n }\n\n return {\n key: keyPath,\n cert: certPath,\n rootCA: `${caLocation}/rootCA.pem`,\n }\n } catch (err) {\n Log.error(\n 'Failed to generate self-signed certificate. Falling back to http.',\n err\n )\n }\n}\n"],"names":["createSelfSignedCertificate","WritableStream","require","MKCERT_VERSION","getBinaryName","platform","process","arch","Error","downloadBinary","binaryName","cacheDirectory","getCacheDirectory","binaryPath","path","join","fs","existsSync","downloadUrl","promises","mkdir","recursive","Log","info","response","fetch","ok","body","status","binaryWriteStream","createWriteStream","pipeTo","write","chunk","Promise","resolve","reject","error","close","chmod","err","host","certDir","resolvedCertDir","cwd","keyPath","certPath","cert","X509Certificate","readFileSync","key","checkHost","checkPrivateKey","createPrivateKey","caLocation","execSync","toString","trim","rootCA","defaultHosts","hosts","includes","stdio","gitignorePath","gitignore","readFile","appendFile"],"mappings":";;;;+BAiGsBA;;;eAAAA;;;+DAjGP;iEACE;4BACiC;mCAChB;6DACb;mCACI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACzB,MAAM,EAAEC,cAAc,EAAE,GACtBC,QAAQ;AAEV,MAAMC,iBAAiB;AAQvB,SAASC;IACP,MAAMC,WAAWC,QAAQD,QAAQ;IACjC,MAAME,OAAOD,QAAQC,IAAI,KAAK,QAAQ,UAAUD,QAAQC,IAAI;IAE5D,IAAIF,aAAa,SAAS;QACxB,OAAO,CAAC,OAAO,EAAEF,eAAe,SAAS,EAAEI,KAAK,IAAI,CAAC;IACvD;IACA,IAAIF,aAAa,UAAU;QACzB,OAAO,CAAC,OAAO,EAAEF,eAAe,QAAQ,EAAEI,MAAM;IAClD;IACA,IAAIF,aAAa,SAAS;QACxB,OAAO,CAAC,OAAO,EAAEF,eAAe,OAAO,EAAEI,MAAM;IACjD;IAEA,MAAM,I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,cAAc,EAAEC,SAAS,EAAE,EAAEc,MAAM7C,IAAI,CACpF,MACC,EACH;YAAE+C,OAAO;QAAS;QAGpB,MAAMR,aAAaC,IAAAA,2BAAQ,EAAC,CAAC,CAAC,EAAE1C,WAAW,SAAS,CAAC,EAAE2C,QAAQ,GAAGC,IAAI;QAEtE,IAAI,CAACzC,eAAE,CAACC,UAAU,CAAC4B,YAAY,CAAC7B,eAAE,CAACC,UAAU,CAAC6B,WAAW;YACvD,MAAM,IAAItC,MAAM;QAClB;QAEAc,KAAIC,IAAI,CAAC,CAAC,+BAA+B,EAAE+B,YAAY;QACvDhC,KAAIC,IAAI,CAAC,CAAC,wBAAwB,EAAEoB,iBAAiB;QAErD,MAAMoB,gBAAgBjD,iBAAI,CAACqB,OAAO,CAAC7B,QAAQsC,GAAG,IAAI;QAElD,IAAI5B,eAAE,CAACC,UAAU,CAAC8C,gBAAgB;YAChC,MAAMC,YAAY,MAAMhD,eAAE,CAACG,QAAQ,CAAC8C,QAAQ,CAACF,eAAe;YAC5D,IAAI,CAACC,UAAUH,QAAQ,CAACnB,UAAU;gBAChCpB,KAAIC,IAAI,CAAC;gBAET,MAAMP,eAAE,CAACG,QAAQ,CAAC+C,UAAU,CAACH,eAAe,CAAC,EAAE,EAAErB,SAAS;YAC5D;QACF;QAEA,OAAO;YACLQ,KAAKL;YACLE,MAAMD;YACNY,QAAQ,GAAGJ,WAAW,WAAW,CAAC;QACpC;IACF,EAAE,OAAOd,KAAK;QACZlB,KAAIe,KAAK,CACP,qEACAG;IAEJ;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/multi-file-writer.d.ts b/e-commerce/node_modules/next/dist/lib/multi-file-writer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bbc87fee67f89b3beafa2a789f8f0c5730a5b5aa --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/multi-file-writer.d.ts @@ -0,0 +1,43 @@ +import type { CacheFs } from '../shared/lib/utils'; +/** + * MultiFileWriter is a utility for writing multiple files in parallel that + * guarantees that all files will be written after their containing directory + * is created, and that the directory will only be created once. + */ +export declare class MultiFileWriter { + /** + * The file system methods to use. + */ + private readonly fs; + /** + * The tasks to be written. + */ + private readonly tasks; + constructor( + /** + * The file system methods to use. + */ + fs: Pick); + /** + * Finds or creates a task for a directory. + * + * @param directory - The directory to find or create a task for. + * @returns The task for the directory. + */ + private findOrCreateTask; + /** + * Appends a file to the writer to be written after its containing directory + * is created. The file writer should be awaited after all the files have been + * appended. Any async operation that occurs between appending and awaiting + * may cause an unhandled promise rejection warning and potentially crash the + * process. + * + * @param filePath - The path to the file to write. + * @param data - The data to write to the file. + */ + append(filePath: string, data: Buffer | string): void; + /** + * Returns a promise that resolves when all the files have been written. + */ + wait(): Promise; +} diff --git a/e-commerce/node_modules/next/dist/lib/multi-file-writer.js b/e-commerce/node_modules/next/dist/lib/multi-file-writer.js new file mode 100644 index 0000000000000000000000000000000000000000..c92cbcb8943acd678c56b875863d8968146c518c --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/multi-file-writer.js @@ -0,0 +1,75 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "MultiFileWriter", { + enumerable: true, + get: function() { + return MultiFileWriter; + } +}); +const _path = /*#__PURE__*/ _interop_require_default(require("../shared/lib/isomorphic/path")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +class MultiFileWriter { + constructor(/** + * The file system methods to use. + */ fs){ + this.fs = fs; + this.tasks = []; + } + /** + * Finds or creates a task for a directory. + * + * @param directory - The directory to find or create a task for. + * @returns The task for the directory. + */ findOrCreateTask(directory) { + // See if this directory already has a task to create it. + for (const task of this.tasks){ + if (task[0] === directory) { + return task; + } + } + const promise = this.fs.mkdir(directory); + // Attach a catch handler so that it doesn't throw an unhandled promise + // rejection warning. + promise.catch(()=>{}); + // Otherwise, create a new task for this directory. + const task = [ + directory, + promise, + [] + ]; + this.tasks.push(task); + return task; + } + /** + * Appends a file to the writer to be written after its containing directory + * is created. The file writer should be awaited after all the files have been + * appended. Any async operation that occurs between appending and awaiting + * may cause an unhandled promise rejection warning and potentially crash the + * process. + * + * @param filePath - The path to the file to write. + * @param data - The data to write to the file. + */ append(filePath, data) { + // Find or create a task for the directory that contains the file. + const task = this.findOrCreateTask(_path.default.dirname(filePath)); + const promise = task[1].then(()=>this.fs.writeFile(filePath, data)); + // Attach a catch handler so that it doesn't throw an unhandled promise + // rejection warning. + promise.catch(()=>{}); + // Add the file write to the task AFTER the directory promise has resolved. + task[2].push(promise); + } + /** + * Returns a promise that resolves when all the files have been written. + */ wait() { + return Promise.all(this.tasks.flatMap((task)=>task[2])); + } +} + +//# sourceMappingURL=multi-file-writer.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/multi-file-writer.js.map b/e-commerce/node_modules/next/dist/lib/multi-file-writer.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0f0f947f76aba8a84c6de5cf671bcfc09702822c --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/multi-file-writer.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/multi-file-writer.ts"],"sourcesContent":["import path from '../shared/lib/isomorphic/path'\nimport type { CacheFs } from '../shared/lib/utils'\n\n/**\n * A task to be written.\n */\ntype Task = [\n /**\n * The directory to create.\n */\n directory: string,\n\n /**\n * The promise to create the directory.\n */\n mkdir: Promise,\n\n /**\n * The promises to write the files that are dependent on the directory being\n * created.\n */\n writeFile: Promise[],\n]\n/**\n * MultiFileWriter is a utility for writing multiple files in parallel that\n * guarantees that all files will be written after their containing directory\n * is created, and that the directory will only be created once.\n */\nexport class MultiFileWriter {\n /**\n * The tasks to be written.\n */\n private readonly tasks: Task[] = []\n\n constructor(\n /**\n * The file system methods to use.\n */\n private readonly fs: Pick\n ) {}\n\n /**\n * Finds or creates a task for a directory.\n *\n * @param directory - The directory to find or create a task for.\n * @returns The task for the directory.\n */\n private findOrCreateTask(directory: string): Task {\n // See if this directory already has a task to create it.\n for (const task of this.tasks) {\n if (task[0] === directory) {\n return task\n }\n }\n\n const promise = this.fs.mkdir(directory)\n\n // Attach a catch handler so that it doesn't throw an unhandled promise\n // rejection warning.\n promise.catch(() => {})\n\n // Otherwise, create a new task for this directory.\n const task: Task = [directory, promise, []]\n this.tasks.push(task)\n\n return task\n }\n\n /**\n * Appends a file to the writer to be written after its containing directory\n * is created. The file writer should be awaited after all the files have been\n * appended. Any async operation that occurs between appending and awaiting\n * may cause an unhandled promise rejection warning and potentially crash the\n * process.\n *\n * @param filePath - The path to the file to write.\n * @param data - The data to write to the file.\n */\n public append(filePath: string, data: Buffer | string): void {\n // Find or create a task for the directory that contains the file.\n const task = this.findOrCreateTask(path.dirname(filePath))\n\n const promise = task[1].then(() => this.fs.writeFile(filePath, data))\n\n // Attach a catch handler so that it doesn't throw an unhandled promise\n // rejection warning.\n promise.catch(() => {})\n\n // Add the file write to the task AFTER the directory promise has resolved.\n task[2].push(promise)\n }\n\n /**\n * Returns a promise that resolves when all the files have been written.\n */\n public wait(): Promise {\n return Promise.all(this.tasks.flatMap((task) => task[2]))\n }\n}\n"],"names":["MultiFileWriter","constructor","fs","tasks","findOrCreateTask","directory","task","promise","mkdir","catch","push","append","filePath","data","path","dirname","then","writeFile","wait","Promise","all","flatMap"],"mappings":";;;;+BA4BaA;;;eAAAA;;;6DA5BI;;;;;;AA4BV,MAAMA;IAMXC,YACE;;KAEC,GACD,AAAiBC,EAAwC,CACzD;aADiBA,KAAAA;aANFC,QAAgB,EAAE;IAOhC;IAEH;;;;;GAKC,GACD,AAAQC,iBAAiBC,SAAiB,EAAQ;QAChD,yDAAyD;QACzD,KAAK,MAAMC,QAAQ,IAAI,CAACH,KAAK,CAAE;YAC7B,IAAIG,IAAI,CAAC,EAAE,KAAKD,WAAW;gBACzB,OAAOC;YACT;QACF;QAEA,MAAMC,UAAU,IAAI,CAACL,EAAE,CAACM,KAAK,CAACH;QAE9B,uEAAuE;QACvE,qBAAqB;QACrBE,QAAQE,KAAK,CAAC,KAAO;QAErB,mDAAmD;QACnD,MAAMH,OAAa;YAACD;YAAWE;YAAS,EAAE;SAAC;QAC3C,IAAI,CAACJ,KAAK,CAACO,IAAI,CAACJ;QAEhB,OAAOA;IACT;IAEA;;;;;;;;;GASC,GACD,AAAOK,OAAOC,QAAgB,EAAEC,IAAqB,EAAQ;QAC3D,kEAAkE;QAClE,MAAMP,OAAO,IAAI,CAACF,gBAAgB,CAACU,aAAI,CAACC,OAAO,CAACH;QAEhD,MAAML,UAAUD,IAAI,CAAC,EAAE,CAACU,IAAI,CAAC,IAAM,IAAI,CAACd,EAAE,CAACe,SAAS,CAACL,UAAUC;QAE/D,uEAAuE;QACvE,qBAAqB;QACrBN,QAAQE,KAAK,CAAC,KAAO;QAErB,2EAA2E;QAC3EH,IAAI,CAAC,EAAE,CAACI,IAAI,CAACH;IACf;IAEA;;GAEC,GACD,AAAOW,OAAyB;QAC9B,OAAOC,QAAQC,GAAG,CAAC,IAAI,CAACjB,KAAK,CAACkB,OAAO,CAAC,CAACf,OAASA,IAAI,CAAC,EAAE;IACzD;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/needs-experimental-react.d.ts b/e-commerce/node_modules/next/dist/lib/needs-experimental-react.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2f54dc7d4a8b381dbea332acf52cb89f1d4d5448 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/needs-experimental-react.d.ts @@ -0,0 +1,2 @@ +import type { NextConfig } from '../server/config-shared'; +export declare function needsExperimentalReact(config: NextConfig): boolean; diff --git a/e-commerce/node_modules/next/dist/lib/needs-experimental-react.js b/e-commerce/node_modules/next/dist/lib/needs-experimental-react.js new file mode 100644 index 0000000000000000000000000000000000000000..9f4cbadde6d056d0cc68b37fcc1c2842e726b8f5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/needs-experimental-react.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "needsExperimentalReact", { + enumerable: true, + get: function() { + return needsExperimentalReact; + } +}); +function needsExperimentalReact(config) { + const { blockingSSR, taint, transitionIndicator, gestureTransition } = config.experimental || {}; + return Boolean(blockingSSR || taint || transitionIndicator || gestureTransition); +} + +//# sourceMappingURL=needs-experimental-react.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/needs-experimental-react.js.map b/e-commerce/node_modules/next/dist/lib/needs-experimental-react.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c0b4a3ae8861a6ff6834061d4db0f6ecc23a825b --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/needs-experimental-react.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/needs-experimental-react.ts"],"sourcesContent":["import type { NextConfig } from '../server/config-shared'\n\n// Keep in sync with Turbopack's experimental React switch: file://./../../../../crates/next-core/src/next_config.rs\nexport function needsExperimentalReact(config: NextConfig) {\n const { blockingSSR, taint, transitionIndicator, gestureTransition } =\n config.experimental || {}\n return Boolean(\n blockingSSR || taint || transitionIndicator || gestureTransition\n )\n}\n"],"names":["needsExperimentalReact","config","blockingSSR","taint","transitionIndicator","gestureTransition","experimental","Boolean"],"mappings":";;;;+BAGgBA;;;eAAAA;;;AAAT,SAASA,uBAAuBC,MAAkB;IACvD,MAAM,EAAEC,WAAW,EAAEC,KAAK,EAAEC,mBAAmB,EAAEC,iBAAiB,EAAE,GAClEJ,OAAOK,YAAY,IAAI,CAAC;IAC1B,OAAOC,QACLL,eAAeC,SAASC,uBAAuBC;AAEnD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/non-nullable.d.ts b/e-commerce/node_modules/next/dist/lib/non-nullable.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1c5c9638ab2d860b0024115c8bc2fb11ab62a02a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/non-nullable.d.ts @@ -0,0 +1 @@ +export declare function nonNullable(value: T): value is NonNullable; diff --git a/e-commerce/node_modules/next/dist/lib/non-nullable.js b/e-commerce/node_modules/next/dist/lib/non-nullable.js new file mode 100644 index 0000000000000000000000000000000000000000..30b607bdaa01f1737b19c8e76d580ede663e0d9d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/non-nullable.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "nonNullable", { + enumerable: true, + get: function() { + return nonNullable; + } +}); +function nonNullable(value) { + return value !== null && value !== undefined; +} + +//# sourceMappingURL=non-nullable.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/non-nullable.js.map b/e-commerce/node_modules/next/dist/lib/non-nullable.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7e7eadacabe6bb3d8bbde992baecaab09bd34c3c --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/non-nullable.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/non-nullable.ts"],"sourcesContent":["export function nonNullable(value: T): value is NonNullable {\n return value !== null && value !== undefined\n}\n"],"names":["nonNullable","value","undefined"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,YAAeC,KAAQ;IACrC,OAAOA,UAAU,QAAQA,UAAUC;AACrC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/normalize-path.d.ts b/e-commerce/node_modules/next/dist/lib/normalize-path.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e599553ed327c39871e7ebd0e2ce384a0fa9ccbe --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/normalize-path.d.ts @@ -0,0 +1 @@ +export declare function normalizePath(file: string): string; diff --git a/e-commerce/node_modules/next/dist/lib/normalize-path.js b/e-commerce/node_modules/next/dist/lib/normalize-path.js new file mode 100644 index 0000000000000000000000000000000000000000..1d52799e3cc4f403dd6222eec35159413c4dea90 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/normalize-path.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "normalizePath", { + enumerable: true, + get: function() { + return normalizePath; + } +}); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function normalizePath(file) { + return _path.default.sep === '\\' ? file.replace(/\\/g, '/') : file; +} + +//# sourceMappingURL=normalize-path.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/normalize-path.js.map b/e-commerce/node_modules/next/dist/lib/normalize-path.js.map new file mode 100644 index 0000000000000000000000000000000000000000..80b07c271252a9e594d006639229bfa6ffb42afc --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/normalize-path.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/normalize-path.ts"],"sourcesContent":["import path from 'path'\n\nexport function normalizePath(file: string) {\n return path.sep === '\\\\' ? file.replace(/\\\\/g, '/') : file\n}\n"],"names":["normalizePath","file","path","sep","replace"],"mappings":";;;;+BAEgBA;;;eAAAA;;;6DAFC;;;;;;AAEV,SAASA,cAAcC,IAAY;IACxC,OAAOC,aAAI,CAACC,GAAG,KAAK,OAAOF,KAAKG,OAAO,CAAC,OAAO,OAAOH;AACxD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/oxford-comma-list.d.ts b/e-commerce/node_modules/next/dist/lib/oxford-comma-list.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b8edb28256e96dc4e1f437800ba81d7d5e522fb --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/oxford-comma-list.d.ts @@ -0,0 +1 @@ +export declare function getOxfordCommaList(items: string[]): string; diff --git a/e-commerce/node_modules/next/dist/lib/oxford-comma-list.js b/e-commerce/node_modules/next/dist/lib/oxford-comma-list.js new file mode 100644 index 0000000000000000000000000000000000000000..f11033dbb00cf6f1e25af29d176ff724df5366c2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/oxford-comma-list.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "getOxfordCommaList", { + enumerable: true, + get: function() { + return getOxfordCommaList; + } +}); +function getOxfordCommaList(items) { + return items.map((v, index, { length })=>(index > 0 ? index === length - 1 ? length > 2 ? ', and ' : ' and ' : ', ' : '') + v).join(''); +} + +//# sourceMappingURL=oxford-comma-list.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/oxford-comma-list.js.map b/e-commerce/node_modules/next/dist/lib/oxford-comma-list.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e4d9ccd618a97685b8b309b2026d4add3d6c3647 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/oxford-comma-list.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/oxford-comma-list.ts"],"sourcesContent":["export function getOxfordCommaList(items: string[]): string {\n return items\n .map(\n (v, index, { length }) =>\n (index > 0\n ? index === length - 1\n ? length > 2\n ? ', and '\n : ' and '\n : ', '\n : '') + v\n )\n .join('')\n}\n"],"names":["getOxfordCommaList","items","map","v","index","length","join"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,mBAAmBC,KAAe;IAChD,OAAOA,MACJC,GAAG,CACF,CAACC,GAAGC,OAAO,EAAEC,MAAM,EAAE,GACnB,AAACD,CAAAA,QAAQ,IACLA,UAAUC,SAAS,IACjBA,SAAS,IACP,WACA,UACF,OACF,EAAC,IAAKF,GAEbG,IAAI,CAAC;AACV","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/page-types.d.ts b/e-commerce/node_modules/next/dist/lib/page-types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..db42bc9942c39faafd60abe45de79b683945ab96 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/page-types.d.ts @@ -0,0 +1,5 @@ +export declare const enum PAGE_TYPES { + PAGES = "pages", + ROOT = "root", + APP = "app" +} diff --git a/e-commerce/node_modules/next/dist/lib/page-types.js b/e-commerce/node_modules/next/dist/lib/page-types.js new file mode 100644 index 0000000000000000000000000000000000000000..a182598ad84376c018197f37b3ef4799ccb9cf2a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/page-types.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "PAGE_TYPES", { + enumerable: true, + get: function() { + return PAGE_TYPES; + } +}); +var PAGE_TYPES = /*#__PURE__*/ function(PAGE_TYPES) { + PAGE_TYPES["PAGES"] = "pages"; + PAGE_TYPES["ROOT"] = "root"; + PAGE_TYPES["APP"] = "app"; + return PAGE_TYPES; +}({}); + +//# sourceMappingURL=page-types.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/page-types.js.map b/e-commerce/node_modules/next/dist/lib/page-types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..cef18a47eb9b8fd0079e9c5d4cee6c55730918c9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/page-types.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/page-types.ts"],"sourcesContent":["export const enum PAGE_TYPES {\n PAGES = 'pages',\n ROOT = 'root',\n APP = 'app',\n}\n"],"names":["PAGE_TYPES"],"mappings":";;;;+BAAkBA;;;eAAAA;;;AAAX,IAAA,AAAWA,oCAAAA;;;;WAAAA","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/patch-incorrect-lockfile.d.ts b/e-commerce/node_modules/next/dist/lib/patch-incorrect-lockfile.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6f09e66d6c6b06d2a1252f5eaf21e1f179b9d852 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/patch-incorrect-lockfile.d.ts @@ -0,0 +1,7 @@ +/** + * Attempts to patch npm package-lock.json when it + * fails to include optionalDependencies for other platforms + * this can occur when the package-lock is rebuilt from a current + * node_modules install instead of pulling fresh package data + */ +export declare function patchIncorrectLockfile(dir: string): Promise; diff --git a/e-commerce/node_modules/next/dist/lib/patch-incorrect-lockfile.js b/e-commerce/node_modules/next/dist/lib/patch-incorrect-lockfile.js new file mode 100644 index 0000000000000000000000000000000000000000..d4349cff651efd1f605628289f8a5b1fd3f7eb8c --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/patch-incorrect-lockfile.js @@ -0,0 +1,181 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "patchIncorrectLockfile", { + enumerable: true, + get: function() { + return patchIncorrectLockfile; + } +}); +const _fs = require("fs"); +const _log = /*#__PURE__*/ _interop_require_wildcard(require("../build/output/log")); +const _findup = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/find-up")); +const _packagejson = require("next/package.json"); +const _ciinfo = require("../server/ci-info"); +const _getregistry = require("./helpers/get-registry"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +let registry; +async function fetchPkgInfo(pkg) { + if (!registry) registry = (0, _getregistry.getRegistry)(); + const res = await fetch(`${registry}${pkg}`); + if (!res.ok) { + throw new Error(`Failed to fetch registry info for ${pkg}, got status ${res.status}`); + } + const data = await res.json(); + const versionData = data.versions["16.4.0"]; + return { + os: versionData.os, + cpu: versionData.cpu, + engines: versionData.engines, + tarball: versionData.dist.tarball, + integrity: versionData.dist.integrity + }; +} +async function patchIncorrectLockfile(dir) { + if (process.env.NEXT_IGNORE_INCORRECT_LOCKFILE) { + return; + } + const lockfilePath = await (0, _findup.default)('package-lock.json', { + cwd: dir + }); + if (!lockfilePath) { + // if no lockfile present there is no action to take + return; + } + const content = (0, _fs.readFileSync)(lockfilePath, 'utf8'); + // maintain current line ending + const endingNewline = content.endsWith('\r\n') ? '\r\n' : content.endsWith('\n') ? '\n' : ''; + const lockfileParsed = JSON.parse(content); + const lockfileVersion = parseInt(lockfileParsed == null ? void 0 : lockfileParsed.lockfileVersion, 10); + const expectedSwcPkgs = Object.keys(_packagejson.optionalDependencies || {}).filter((pkg)=>pkg.startsWith('@next/swc-')); + const patchDependency = (pkg, pkgData)=>{ + lockfileParsed.dependencies[pkg] = { + version: "16.4.0", + resolved: pkgData.tarball, + integrity: pkgData.integrity, + optional: true + }; + }; + const patchPackage = (pkg, pkgData)=>{ + lockfileParsed.packages[pkg] = { + version: "16.4.0", + resolved: pkgData.tarball, + integrity: pkgData.integrity, + cpu: pkgData.cpu, + optional: true, + os: pkgData.os, + engines: pkgData.engines + }; + }; + try { + const supportedVersions = [ + 1, + 2, + 3 + ]; + if (!supportedVersions.includes(lockfileVersion)) { + // bail on unsupported version + return; + } + // v1 only uses dependencies + // v2 uses dependencies and packages + // v3 only uses packages + const shouldPatchDependencies = lockfileVersion === 1 || lockfileVersion === 2; + const shouldPatchPackages = lockfileVersion === 2 || lockfileVersion === 3; + if (shouldPatchDependencies && !lockfileParsed.dependencies || shouldPatchPackages && !lockfileParsed.packages) { + // invalid lockfile so bail + return; + } + const missingSwcPkgs = []; + let pkgPrefix; + if (shouldPatchPackages) { + pkgPrefix = ''; + for (const pkg of Object.keys(lockfileParsed.packages)){ + if (pkg.endsWith('node_modules/next')) { + pkgPrefix = pkg.substring(0, pkg.length - 4); + } + } + if (!pkgPrefix) { + // unable to locate the next package so bail + return; + } + } + for (const pkg of expectedSwcPkgs){ + if (shouldPatchDependencies && !lockfileParsed.dependencies[pkg] || shouldPatchPackages && !lockfileParsed.packages[`${pkgPrefix}${pkg}`]) { + missingSwcPkgs.push(pkg); + } + } + if (missingSwcPkgs.length === 0) { + return; + } + _log.warn(`Found lockfile missing swc dependencies,`, _ciinfo.isCI ? 'run next locally to automatically patch' : 'patching...'); + if (_ciinfo.isCI) { + // no point in updating in CI as the user can't save the patch + return; + } + const pkgsData = await Promise.all(missingSwcPkgs.map((pkg)=>fetchPkgInfo(pkg))); + for(let i = 0; i < pkgsData.length; i++){ + const pkg = missingSwcPkgs[i]; + const pkgData = pkgsData[i]; + if (shouldPatchDependencies) { + patchDependency(pkg, pkgData); + } + if (shouldPatchPackages) { + patchPackage(`${pkgPrefix}${pkg}`, pkgData); + } + } + (0, _fs.writeFileSync)(lockfilePath, JSON.stringify(lockfileParsed, null, 2) + endingNewline); + _log.warn('Lockfile was successfully patched, please run "npm install" to ensure @next/swc dependencies are downloaded'); + } catch (err) { + _log.error(`Failed to patch lockfile, please try uninstalling and reinstalling next in this workspace`); + console.error(err); + } +} + +//# sourceMappingURL=patch-incorrect-lockfile.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/patch-incorrect-lockfile.js.map b/e-commerce/node_modules/next/dist/lib/patch-incorrect-lockfile.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1b7ab1529faeb3028d2312080529f023f1b694e4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/patch-incorrect-lockfile.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/patch-incorrect-lockfile.ts"],"sourcesContent":["import { readFileSync, writeFileSync } from 'fs'\nimport * as Log from '../build/output/log'\nimport findUp from 'next/dist/compiled/find-up'\n// @ts-ignore no-json types\nimport { optionalDependencies as nextOptionalDeps } from 'next/package.json'\nimport type { UnwrapPromise } from './coalesced-function'\nimport { isCI } from '../server/ci-info'\nimport { getRegistry } from './helpers/get-registry'\n\nlet registry: string | undefined\n\nasync function fetchPkgInfo(pkg: string) {\n if (!registry) registry = getRegistry()\n const res = await fetch(`${registry}${pkg}`)\n\n if (!res.ok) {\n throw new Error(\n `Failed to fetch registry info for ${pkg}, got status ${res.status}`\n )\n }\n const data = await res.json()\n const versionData = data.versions[process.env.__NEXT_VERSION as string]\n\n return {\n os: versionData.os,\n cpu: versionData.cpu,\n engines: versionData.engines,\n tarball: versionData.dist.tarball,\n integrity: versionData.dist.integrity,\n }\n}\n\n/**\n * Attempts to patch npm package-lock.json when it\n * fails to include optionalDependencies for other platforms\n * this can occur when the package-lock is rebuilt from a current\n * node_modules install instead of pulling fresh package data\n */\nexport async function patchIncorrectLockfile(dir: string) {\n if (process.env.NEXT_IGNORE_INCORRECT_LOCKFILE) {\n return\n }\n const lockfilePath = await findUp('package-lock.json', { cwd: dir })\n\n if (!lockfilePath) {\n // if no lockfile present there is no action to take\n return\n }\n const content = readFileSync(lockfilePath, 'utf8')\n // maintain current line ending\n const endingNewline = content.endsWith('\\r\\n')\n ? '\\r\\n'\n : content.endsWith('\\n')\n ? '\\n'\n : ''\n\n const lockfileParsed = JSON.parse(content)\n const lockfileVersion = parseInt(lockfileParsed?.lockfileVersion, 10)\n const expectedSwcPkgs = Object.keys(nextOptionalDeps || {}).filter((pkg) =>\n pkg.startsWith('@next/swc-')\n )\n\n const patchDependency = (\n pkg: string,\n pkgData: UnwrapPromise>\n ) => {\n lockfileParsed.dependencies[pkg] = {\n version: process.env.__NEXT_VERSION as string,\n resolved: pkgData.tarball,\n integrity: pkgData.integrity,\n optional: true,\n }\n }\n\n const patchPackage = (\n pkg: string,\n pkgData: UnwrapPromise>\n ) => {\n lockfileParsed.packages[pkg] = {\n version: process.env.__NEXT_VERSION as string,\n resolved: pkgData.tarball,\n integrity: pkgData.integrity,\n cpu: pkgData.cpu,\n optional: true,\n os: pkgData.os,\n engines: pkgData.engines,\n }\n }\n\n try {\n const supportedVersions = [1, 2, 3]\n\n if (!supportedVersions.includes(lockfileVersion)) {\n // bail on unsupported version\n return\n }\n // v1 only uses dependencies\n // v2 uses dependencies and packages\n // v3 only uses packages\n const shouldPatchDependencies =\n lockfileVersion === 1 || lockfileVersion === 2\n const shouldPatchPackages = lockfileVersion === 2 || lockfileVersion === 3\n\n if (\n (shouldPatchDependencies && !lockfileParsed.dependencies) ||\n (shouldPatchPackages && !lockfileParsed.packages)\n ) {\n // invalid lockfile so bail\n return\n }\n const missingSwcPkgs = []\n let pkgPrefix: string | undefined\n\n if (shouldPatchPackages) {\n pkgPrefix = ''\n for (const pkg of Object.keys(lockfileParsed.packages)) {\n if (pkg.endsWith('node_modules/next')) {\n pkgPrefix = pkg.substring(0, pkg.length - 4)\n }\n }\n\n if (!pkgPrefix) {\n // unable to locate the next package so bail\n return\n }\n }\n\n for (const pkg of expectedSwcPkgs) {\n if (\n (shouldPatchDependencies && !lockfileParsed.dependencies[pkg]) ||\n (shouldPatchPackages && !lockfileParsed.packages[`${pkgPrefix}${pkg}`])\n ) {\n missingSwcPkgs.push(pkg)\n }\n }\n if (missingSwcPkgs.length === 0) {\n return\n }\n Log.warn(\n `Found lockfile missing swc dependencies,`,\n isCI ? 'run next locally to automatically patch' : 'patching...'\n )\n\n if (isCI) {\n // no point in updating in CI as the user can't save the patch\n return\n }\n const pkgsData = await Promise.all(\n missingSwcPkgs.map((pkg) => fetchPkgInfo(pkg))\n )\n\n for (let i = 0; i < pkgsData.length; i++) {\n const pkg = missingSwcPkgs[i]\n const pkgData = pkgsData[i]\n\n if (shouldPatchDependencies) {\n patchDependency(pkg, pkgData)\n }\n if (shouldPatchPackages) {\n patchPackage(`${pkgPrefix}${pkg}`, pkgData)\n }\n }\n\n writeFileSync(\n lockfilePath,\n JSON.stringify(lockfileParsed, null, 2) + endingNewline\n )\n Log.warn(\n 'Lockfile was successfully patched, please run \"npm install\" to ensure @next/swc dependencies are downloaded'\n )\n } catch (err) {\n Log.error(\n `Failed to patch lockfile, please try uninstalling and reinstalling next in this workspace`\n )\n console.error(err)\n }\n}\n"],"names":["patchIncorrectLockfile","registry","fetchPkgInfo","pkg","getRegistry","res","fetch","ok","Error","status","data","json","versionData","versions","process","env","__NEXT_VERSION","os","cpu","engines","tarball","dist","integrity","dir","NEXT_IGNORE_INCORRECT_LOCKFILE","lockfilePath","findUp","cwd","content","readFileSync","endingNewline","endsWith","lockfileParsed","JSON","parse","lockfileVersion","parseInt","expectedSwcPkgs","Object","keys","nextOptionalDeps","filter","startsWith","patchDependency","pkgData","dependencies","version","resolved","optional","patchPackage","packages","supportedVersions","includes","shouldPatchDependencies","shouldPatchPackages","missingSwcPkgs","pkgPrefix","substring","length","push","Log","warn","isCI","pkgsData","Promise","all","map","i","writeFileSync","stringify","err","error","console"],"mappings":";;;;+BAsCsBA;;;eAAAA;;;oBAtCsB;6DACvB;+DACF;6BAEsC;wBAEpC;6BACO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE5B,IAAIC;AAEJ,eAAeC,aAAaC,GAAW;IACrC,IAAI,CAACF,UAAUA,WAAWG,IAAAA,wBAAW;IACrC,MAAMC,MAAM,MAAMC,MAAM,GAAGL,WAAWE,KAAK;IAE3C,IAAI,CAACE,IAAIE,EAAE,EAAE;QACX,MAAM,IAAIC,MACR,CAAC,kCAAkC,EAAEL,IAAI,aAAa,EAAEE,IAAII,MAAM,EAAE;IAExE;IACA,MAAMC,OAAO,MAAML,IAAIM,IAAI;IAC3B,MAAMC,cAAcF,KAAKG,QAAQ,CAACC,QAAQC,GAAG,CAACC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/D,MAAQD,aAAaC;QAG3C,IAAK,IAAIgE,IAAI,GAAGA,IAAIJ,SAASL,MAAM,EAAES,IAAK;YACxC,MAAMhE,MAAMoD,cAAc,CAACY,EAAE;YAC7B,MAAMvB,UAAUmB,QAAQ,CAACI,EAAE;YAE3B,IAAId,yBAAyB;gBAC3BV,gBAAgBxC,KAAKyC;YACvB;YACA,IAAIU,qBAAqB;gBACvBL,aAAa,GAAGO,YAAYrD,KAAK,EAAEyC;YACrC;QACF;QAEAwB,IAAAA,iBAAa,EACX3C,cACAQ,KAAKoC,SAAS,CAACrC,gBAAgB,MAAM,KAAKF;QAE5C8B,KAAIC,IAAI,CACN;IAEJ,EAAE,OAAOS,KAAK;QACZV,KAAIW,KAAK,CACP,CAAC,yFAAyF,CAAC;QAE7FC,QAAQD,KAAK,CAACD;IAChB;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/pick.d.ts b/e-commerce/node_modules/next/dist/lib/pick.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..aeb296373e66396c1f62825fb407c4a1910deb3e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/pick.d.ts @@ -0,0 +1 @@ +export declare function pick(obj: T, keys: K[]): Pick; diff --git a/e-commerce/node_modules/next/dist/lib/pick.js b/e-commerce/node_modules/next/dist/lib/pick.js new file mode 100644 index 0000000000000000000000000000000000000000..1b083071437525a76fb08e030ee3472e9b4cceea --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/pick.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "pick", { + enumerable: true, + get: function() { + return pick; + } +}); +function pick(obj, keys) { + const newObj = {}; + for (const key of keys){ + newObj[key] = obj[key]; + } + return newObj; +} + +//# sourceMappingURL=pick.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/pick.js.map b/e-commerce/node_modules/next/dist/lib/pick.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7bf0bca408bc4a7883b926000ed6d4edf57c9265 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/pick.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/pick.ts"],"sourcesContent":["export function pick(obj: T, keys: K[]): Pick {\n const newObj = {} as Pick\n for (const key of keys) {\n newObj[key] = obj[key]\n }\n return newObj\n}\n"],"names":["pick","obj","keys","newObj","key"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,KAA2BC,GAAM,EAAEC,IAAS;IAC1D,MAAMC,SAAS,CAAC;IAChB,KAAK,MAAMC,OAAOF,KAAM;QACtBC,MAAM,CAACC,IAAI,GAAGH,GAAG,CAACG,IAAI;IACxB;IACA,OAAOD;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/picocolors.d.ts b/e-commerce/node_modules/next/dist/lib/picocolors.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ef3ba76146231a93ee8853a7cf9f700234599d08 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/picocolors.d.ts @@ -0,0 +1,28 @@ +export declare const isColorSupported: boolean; +export declare const stdoutIsTerminal: boolean; +export declare const reset: (s: string) => string; +export declare const bold: (input: string) => string; +export declare const dim: (input: string) => string; +export declare const italic: (input: string) => string; +export declare const underline: (input: string) => string; +export declare const inverse: (input: string) => string; +export declare const hidden: (input: string) => string; +export declare const strikethrough: (input: string) => string; +export declare const black: (input: string) => string; +export declare const red: (input: string) => string; +export declare const green: (input: string) => string; +export declare const yellow: (input: string) => string; +export declare const blue: (input: string) => string; +export declare const magenta: (input: string) => string; +export declare const purple: (input: string) => string; +export declare const cyan: (input: string) => string; +export declare const white: (input: string) => string; +export declare const gray: (input: string) => string; +export declare const bgBlack: (input: string) => string; +export declare const bgRed: (input: string) => string; +export declare const bgGreen: (input: string) => string; +export declare const bgYellow: (input: string) => string; +export declare const bgBlue: (input: string) => string; +export declare const bgMagenta: (input: string) => string; +export declare const bgCyan: (input: string) => string; +export declare const bgWhite: (input: string) => string; diff --git a/e-commerce/node_modules/next/dist/lib/picocolors.js b/e-commerce/node_modules/next/dist/lib/picocolors.js new file mode 100644 index 0000000000000000000000000000000000000000..01953d1aa03ddb8abe3bcd4361d798c4178d2843 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/picocolors.js @@ -0,0 +1,187 @@ +// ISC License +// Copyright (c) 2021 Alexey Raspopov, Kostiantyn Denysov, Anton Verinov +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// +// https://github.com/alexeyraspopov/picocolors/blob/b6261487e7b81aaab2440e397a356732cad9e342/picocolors.js#L1 +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + bgBlack: null, + bgBlue: null, + bgCyan: null, + bgGreen: null, + bgMagenta: null, + bgRed: null, + bgWhite: null, + bgYellow: null, + black: null, + blue: null, + bold: null, + cyan: null, + dim: null, + gray: null, + green: null, + hidden: null, + inverse: null, + isColorSupported: null, + italic: null, + magenta: null, + purple: null, + red: null, + reset: null, + stdoutIsTerminal: null, + strikethrough: null, + underline: null, + white: null, + yellow: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + bgBlack: function() { + return bgBlack; + }, + bgBlue: function() { + return bgBlue; + }, + bgCyan: function() { + return bgCyan; + }, + bgGreen: function() { + return bgGreen; + }, + bgMagenta: function() { + return bgMagenta; + }, + bgRed: function() { + return bgRed; + }, + bgWhite: function() { + return bgWhite; + }, + bgYellow: function() { + return bgYellow; + }, + black: function() { + return black; + }, + blue: function() { + return blue; + }, + bold: function() { + return bold; + }, + cyan: function() { + return cyan; + }, + dim: function() { + return dim; + }, + gray: function() { + return gray; + }, + green: function() { + return green; + }, + hidden: function() { + return hidden; + }, + inverse: function() { + return inverse; + }, + isColorSupported: function() { + return isColorSupported; + }, + italic: function() { + return italic; + }, + magenta: function() { + return magenta; + }, + purple: function() { + return purple; + }, + red: function() { + return red; + }, + reset: function() { + return reset; + }, + stdoutIsTerminal: function() { + return stdoutIsTerminal; + }, + strikethrough: function() { + return strikethrough; + }, + underline: function() { + return underline; + }, + white: function() { + return white; + }, + yellow: function() { + return yellow; + } +}); +var _globalThis; +const { env, stdout } = ((_globalThis = globalThis) == null ? void 0 : _globalThis.process) ?? {}; +const enabled = env && !env.NO_COLOR && (env.FORCE_COLOR || (stdout == null ? void 0 : stdout.isTTY) && !env.CI && env.TERM !== 'dumb'); +const isColorSupported = Boolean(enabled); +const stdoutIsTerminal = Boolean(stdout == null ? void 0 : stdout.isTTY) || env.NEXT_PRIVATE_PROMPT_OUTPUT === '1'; +const replaceClose = (str, close, replace, index)=>{ + const start = str.substring(0, index) + replace; + const end = str.substring(index + close.length); + const nextIndex = end.indexOf(close); + return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end; +}; +const formatter = (open, close, replace = open)=>{ + if (!enabled) return String; + return (input)=>{ + const string = '' + input; + const index = string.indexOf(close, open.length); + return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close; + }; +}; +const reset = enabled ? (s)=>`\x1b[0m${s}\x1b[0m` : String; +const bold = formatter('\x1b[1m', '\x1b[22m', '\x1b[22m\x1b[1m'); +const dim = formatter('\x1b[2m', '\x1b[22m', '\x1b[22m\x1b[2m'); +const italic = formatter('\x1b[3m', '\x1b[23m'); +const underline = formatter('\x1b[4m', '\x1b[24m'); +const inverse = formatter('\x1b[7m', '\x1b[27m'); +const hidden = formatter('\x1b[8m', '\x1b[28m'); +const strikethrough = formatter('\x1b[9m', '\x1b[29m'); +const black = formatter('\x1b[30m', '\x1b[39m'); +const red = formatter('\x1b[31m', '\x1b[39m'); +const green = formatter('\x1b[32m', '\x1b[39m'); +const yellow = formatter('\x1b[33m', '\x1b[39m'); +const blue = formatter('\x1b[34m', '\x1b[39m'); +const magenta = formatter('\x1b[35m', '\x1b[39m'); +const purple = formatter('\x1b[38;2;173;127;168m', '\x1b[39m'); +const cyan = formatter('\x1b[36m', '\x1b[39m'); +const white = formatter('\x1b[37m', '\x1b[39m'); +const gray = formatter('\x1b[90m', '\x1b[39m'); +const bgBlack = formatter('\x1b[40m', '\x1b[49m'); +const bgRed = formatter('\x1b[41m', '\x1b[49m'); +const bgGreen = formatter('\x1b[42m', '\x1b[49m'); +const bgYellow = formatter('\x1b[43m', '\x1b[49m'); +const bgBlue = formatter('\x1b[44m', '\x1b[49m'); +const bgMagenta = formatter('\x1b[45m', '\x1b[49m'); +const bgCyan = formatter('\x1b[46m', '\x1b[49m'); +const bgWhite = formatter('\x1b[47m', '\x1b[49m'); + +//# sourceMappingURL=picocolors.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/picocolors.js.map b/e-commerce/node_modules/next/dist/lib/picocolors.js.map new file mode 100644 index 0000000000000000000000000000000000000000..21ca8181ef5caddc5b03d280cf3c2cc69413975b --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/picocolors.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/picocolors.ts"],"sourcesContent":["// ISC License\n\n// Copyright (c) 2021 Alexey Raspopov, Kostiantyn Denysov, Anton Verinov\n\n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n//\n// https://github.com/alexeyraspopov/picocolors/blob/b6261487e7b81aaab2440e397a356732cad9e342/picocolors.js#L1\n\nconst { env, stdout } = globalThis?.process ?? {}\n\nconst enabled =\n env &&\n !env.NO_COLOR &&\n (env.FORCE_COLOR || (stdout?.isTTY && !env.CI && env.TERM !== 'dumb'))\n\nexport const isColorSupported = Boolean(enabled)\n\n// Whether stdout ends up on a terminal: directly, or through the CLI, which\n// pipes a child's output while the upgrade menu is open.\nexport const stdoutIsTerminal =\n Boolean(stdout?.isTTY) || env.NEXT_PRIVATE_PROMPT_OUTPUT === '1'\n\nconst replaceClose = (\n str: string,\n close: string,\n replace: string,\n index: number\n): string => {\n const start = str.substring(0, index) + replace\n const end = str.substring(index + close.length)\n const nextIndex = end.indexOf(close)\n return ~nextIndex\n ? start + replaceClose(end, close, replace, nextIndex)\n : start + end\n}\n\nconst formatter = (open: string, close: string, replace = open) => {\n if (!enabled) return String\n return (input: string) => {\n const string = '' + input\n const index = string.indexOf(close, open.length)\n return ~index\n ? open + replaceClose(string, close, replace, index) + close\n : open + string + close\n }\n}\n\nexport const reset = enabled ? (s: string) => `\\x1b[0m${s}\\x1b[0m` : String\nexport const bold = formatter('\\x1b[1m', '\\x1b[22m', '\\x1b[22m\\x1b[1m')\nexport const dim = formatter('\\x1b[2m', '\\x1b[22m', '\\x1b[22m\\x1b[2m')\nexport const italic = formatter('\\x1b[3m', '\\x1b[23m')\nexport const underline = formatter('\\x1b[4m', '\\x1b[24m')\nexport const inverse = formatter('\\x1b[7m', '\\x1b[27m')\nexport const hidden = formatter('\\x1b[8m', '\\x1b[28m')\nexport const strikethrough = formatter('\\x1b[9m', '\\x1b[29m')\nexport const black = formatter('\\x1b[30m', '\\x1b[39m')\nexport const red = formatter('\\x1b[31m', '\\x1b[39m')\nexport const green = formatter('\\x1b[32m', '\\x1b[39m')\nexport const yellow = formatter('\\x1b[33m', '\\x1b[39m')\nexport const blue = formatter('\\x1b[34m', '\\x1b[39m')\nexport const magenta = formatter('\\x1b[35m', '\\x1b[39m')\nexport const purple = formatter('\\x1b[38;2;173;127;168m', '\\x1b[39m')\nexport const cyan = formatter('\\x1b[36m', '\\x1b[39m')\nexport const white = formatter('\\x1b[37m', '\\x1b[39m')\nexport const gray = formatter('\\x1b[90m', '\\x1b[39m')\nexport const bgBlack = formatter('\\x1b[40m', '\\x1b[49m')\nexport const bgRed = formatter('\\x1b[41m', '\\x1b[49m')\nexport const bgGreen = formatter('\\x1b[42m', '\\x1b[49m')\nexport const bgYellow = formatter('\\x1b[43m', '\\x1b[49m')\nexport const bgBlue = formatter('\\x1b[44m', '\\x1b[49m')\nexport const bgMagenta = formatter('\\x1b[45m', '\\x1b[49m')\nexport const bgCyan = formatter('\\x1b[46m', '\\x1b[49m')\nexport const bgWhite = formatter('\\x1b[47m', '\\x1b[49m')\n"],"names":["bgBlack","bgBlue","bgCyan","bgGreen","bgMagenta","bgRed","bgWhite","bgYellow","black","blue","bold","cyan","dim","gray","green","hidden","inverse","isColorSupported","italic","magenta","purple","red","reset","stdoutIsTerminal","strikethrough","underline","white","yellow","globalThis","env","stdout","process","enabled","NO_COLOR","FORCE_COLOR","isTTY","CI","TERM","Boolean","NEXT_PRIVATE_PROMPT_OUTPUT","replaceClose","str","close","replace","index","start","substring","end","length","nextIndex","indexOf","formatter","open","String","input","string","s"],"mappings":"AAAA,cAAc;AAEd,wEAAwE;AAExE,2EAA2E;AAC3E,yEAAyE;AACzE,oEAAoE;AAEpE,2EAA2E;AAC3E,mEAAmE;AACnE,0EAA0E;AAC1E,yEAAyE;AACzE,wEAAwE;AACxE,0EAA0E;AAC1E,iEAAiE;AACjE,EAAE;AACF,8GAA8G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2DjGA,OAAO;eAAPA;;IAIAC,MAAM;eAANA;;IAEAC,MAAM;eAANA;;IAJAC,OAAO;eAAPA;;IAGAC,SAAS;eAATA;;IAJAC,KAAK;eAALA;;IAMAC,OAAO;eAAPA;;IAJAC,QAAQ;eAARA;;IAbAC,KAAK;eAALA;;IAIAC,IAAI;eAAJA;;IAXAC,IAAI;eAAJA;;IAcAC,IAAI;eAAJA;;IAbAC,GAAG;eAAHA;;IAeAC,IAAI;eAAJA;;IAPAC,KAAK;eAALA;;IAJAC,MAAM;eAANA;;IADAC,OAAO;eAAPA;;IArCAC,gBAAgB;eAAhBA;;IAmCAC,MAAM;eAANA;;IAUAC,OAAO;eAAPA;;IACAC,MAAM;eAANA;;IALAC,GAAG;eAAHA;;IATAC,KAAK;eAALA;;IA5BAC,gBAAgB;eAAhBA;;IAmCAC,aAAa;eAAbA;;IAHAC,SAAS;eAATA;;IAYAC,KAAK;eAALA;;IALAC,MAAM;eAANA;;;IAlDWC;AAAxB,MAAM,EAAEC,GAAG,EAAEC,MAAM,EAAE,GAAGF,EAAAA,cAAAA,+BAAAA,YAAYG,OAAO,KAAI,CAAC;AAEhD,MAAMC,UACJH,OACA,CAACA,IAAII,QAAQ,IACZJ,CAAAA,IAAIK,WAAW,IAAKJ,CAAAA,0BAAAA,OAAQK,KAAK,KAAI,CAACN,IAAIO,EAAE,IAAIP,IAAIQ,IAAI,KAAK,MAAM;AAE/D,MAAMpB,mBAAmBqB,QAAQN;AAIjC,MAA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AA0B;AACnD,MAAMxC,OAAOwC,UAAU,YAAY;AACnC,MAAMzB,QAAQyB,UAAU,YAAY;AACpC,MAAMtC,OAAOsC,UAAU,YAAY;AACnC,MAAMnD,UAAUmD,UAAU,YAAY;AACtC,MAAM9C,QAAQ8C,UAAU,YAAY;AACpC,MAAMhD,UAAUgD,UAAU,YAAY;AACtC,MAAM5C,WAAW4C,UAAU,YAAY;AACvC,MAAMlD,SAASkD,UAAU,YAAY;AACrC,MAAM/C,YAAY+C,UAAU,YAAY;AACxC,MAAMjD,SAASiD,UAAU,YAAY;AACrC,MAAM7C,UAAU6C,UAAU,YAAY","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/pretty-bytes.d.ts b/e-commerce/node_modules/next/dist/lib/pretty-bytes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2a3aae8bcd24cc09ba709804e6ddf2a022071eab --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/pretty-bytes.d.ts @@ -0,0 +1 @@ +export default function prettyBytes(number: number, options?: any): string; diff --git a/e-commerce/node_modules/next/dist/lib/pretty-bytes.js b/e-commerce/node_modules/next/dist/lib/pretty-bytes.js new file mode 100644 index 0000000000000000000000000000000000000000..598f8f5ab7987564b8fd086407b328134d9b8be4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/pretty-bytes.js @@ -0,0 +1,70 @@ +/* +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function() { + return prettyBytes; + } +}); +const UNITS = [ + 'B', + 'kB', + 'MB', + 'GB', + 'TB', + 'PB', + 'EB', + 'ZB', + 'YB' +]; +/* +Formats the given number using `Number#toLocaleString`. +- If locale is a string, the value is expected to be a locale-key (for example: `de`). +- If locale is true, the system default locale is used for translation. +- If no value for locale is specified, the number is returned unmodified. +*/ const toLocaleString = (number, locale)=>{ + let result = number; + if (typeof locale === 'string') { + result = number.toLocaleString(locale); + } else if (locale === true) { + result = number.toLocaleString(); + } + return result; +}; +function prettyBytes(number, options) { + if (!Number.isFinite(number)) { + throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`); + } + options = Object.assign({}, options); + if (options.signed && number === 0) { + return ' 0 B'; + } + const isNegative = number < 0; + const prefix = isNegative ? '-' : options.signed ? '+' : ''; + if (isNegative) { + number = -number; + } + if (number < 1) { + const numberString = toLocaleString(number, options.locale); + return prefix + numberString + ' B'; + } + const exponent = Math.min(Math.floor(Math.log10(number) / 3), UNITS.length - 1); + number = Number((number / Math.pow(1000, exponent)).toPrecision(3)); + const numberString = toLocaleString(number, options.locale); + const unit = UNITS[exponent]; + return prefix + numberString + ' ' + unit; +} + +//# sourceMappingURL=pretty-bytes.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/pretty-bytes.js.map b/e-commerce/node_modules/next/dist/lib/pretty-bytes.js.map new file mode 100644 index 0000000000000000000000000000000000000000..9736a9db4434ffde5fdee3b0dceb816823c06dcd --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/pretty-bytes.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/pretty-bytes.ts"],"sourcesContent":["/*\nMIT License\n\nCopyright (c) Sindre Sorhus (sindresorhus.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nconst UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']\n\n/*\nFormats the given number using `Number#toLocaleString`.\n- If locale is a string, the value is expected to be a locale-key (for example: `de`).\n- If locale is true, the system default locale is used for translation.\n- If no value for locale is specified, the number is returned unmodified.\n*/\nconst toLocaleString = (number: number, locale: any) => {\n let result: any = number\n if (typeof locale === 'string') {\n result = number.toLocaleString(locale)\n } else if (locale === true) {\n result = number.toLocaleString()\n }\n\n return result\n}\n\nexport default function prettyBytes(number: number, options?: any): string {\n if (!Number.isFinite(number)) {\n throw new TypeError(\n `Expected a finite number, got ${typeof number}: ${number}`\n )\n }\n\n options = Object.assign({}, options)\n\n if (options.signed && number === 0) {\n return ' 0 B'\n }\n\n const isNegative = number < 0\n const prefix = isNegative ? '-' : options.signed ? '+' : ''\n\n if (isNegative) {\n number = -number\n }\n\n if (number < 1) {\n const numberString = toLocaleString(number, options.locale)\n return prefix + numberString + ' B'\n }\n\n const exponent = Math.min(\n Math.floor(Math.log10(number) / 3),\n UNITS.length - 1\n )\n\n number = Number((number / Math.pow(1000, exponent)).toPrecision(3))\n const numberString = toLocaleString(number, options.locale)\n\n const unit = UNITS[exponent]\n\n return prefix + numberString + ' ' + unit\n}\n"],"names":["prettyBytes","UNITS","toLocaleString","number","locale","result","options","Number","isFinite","TypeError","Object","assign","signed","isNegative","prefix","numberString","exponent","Math","min","floor","log10","length","pow","toPrecision","unit"],"mappings":"AAAA;;;;;;;;;;AAUA;;;;+BAqBA;;;eAAwBA;;;AAnBxB,MAAMC,QAAQ;IAAC;IAAK;IAAM;IAAM;IAAM;IAAM;IAAM;IAAM;IAAM;CAAK;AAEnE;;;;;AAKA,GACA,MAAMC,iBAAiB,CAACC,QAAgBC;IACtC,IAAIC,SAAcF;IAClB,IAAI,OAAOC,WAAW,UAAU;QAC9BC,SAASF,OAAOD,cAAc,CAACE;IACjC,OAAO,IAAIA,WAAW,MAAM;QAC1BC,SAASF,OAAOD,cAAc;IAChC;IAEA,OAAOG;AACT;AAEe,SAASL,YAAYG,MAAc,EAAEG,OAAa;IAC/D,IAAI,CAACC,OAAOC,QAAQ,CAACL,SAAS;QAC5B,MAAM,IAAIM,UACR,CAAC,8BAA8B,EAAE,OAAON,OAAO,EAAE,EAAEA,QAAQ;IAE/D;IAEAG,UAAUI,OAAOC,MAAM,CAAC,CAAC,GAAGL;IAE5B,IAAIA,QAAQM,MAAM,IAAIT,WAAW,GAAG;QAClC,OAAO;IACT;IAEA,MAAMU,aAAaV,SAAS;IAC5B,MAAMW,SAASD,aAAa,MAAMP,QAAQM,MAAM,GAAG,MAAM;IAEzD,IAAIC,YAAY;QACdV,SAAS,CAACA;IACZ;IAEA,IAAIA,SAAS,GAAG;QACd,MAAMY,eAAeb,eAAeC,QAAQG,QAAQF,MAAM;QAC1D,OAAOU,SAASC,eAAe;IACjC;IAEA,MAAMC,WAAWC,KAAKC,GAAG,CACvBD,KAAKE,KAAK,CAACF,KAAKG,KAAK,CAACjB,UAAU,IAChCF,MAAMoB,MAAM,GAAG;IAGjBlB,SAASI,OAAO,AAACJ,CAAAA,SAASc,KAAKK,GAAG,CAAC,MAAMN,SAAQ,EAAGO,WAAW,CAAC;IAChE,MAAMR,eAAeb,eAAeC,QAAQG,QAAQF,MAAM;IAE1D,MAAMoB,OAAOvB,KAAK,CAACe,SAAS;IAE5B,OAAOF,SAASC,eAAe,MAAMS;AACvC","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/profiles-dir.d.ts b/e-commerce/node_modules/next/dist/lib/profiles-dir.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ea23445b3ca4ac44fdea91e6ee36e63b55ddb035 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/profiles-dir.d.ts @@ -0,0 +1,21 @@ +/** + * Name of the directory at the project root where profiling output (CPU + * profiles and Turbopack traces) is written when profiling is enabled (see the + * `--experimental-cpu-prof` and `--internal-trace` CLI flags). It is a + * fixed-name sibling of `distDir`, not configurable. + * + * Keep this in sync with `DIST_PROFILES_DIR_NAME` in + * `crates/next-core/src/next_config.rs`. + */ +export declare const PROFILES_DIR_NAME = ".next-profiles"; +/** + * Create the `.next-profiles` directory under `dir` and return its absolute + * path. This is the single place that creates the directory — the Rust trace + * writer relies on it already existing. + * + * Also writes a `.gitignore` containing `*` (if one isn't already there) so the + * potentially large profiling output is excluded from git and gitignore-aware + * tools (Tailwind, Turborepo, ...) skip the subtree instead of reading it and + * hanging/OOMing. + */ +export declare function ensureProfilesDir(dir: string): string; diff --git a/e-commerce/node_modules/next/dist/lib/profiles-dir.js b/e-commerce/node_modules/next/dist/lib/profiles-dir.js new file mode 100644 index 0000000000000000000000000000000000000000..77b1502ed53a23096ccd690ceb2d6f2e31ec3b35 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/profiles-dir.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + PROFILES_DIR_NAME: null, + ensureProfilesDir: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + PROFILES_DIR_NAME: function() { + return PROFILES_DIR_NAME; + }, + ensureProfilesDir: function() { + return ensureProfilesDir; + } +}); +const _fs = require("fs"); +const _path = require("path"); +const PROFILES_DIR_NAME = '.next-profiles'; +const GITIGNORE_CONTENTS = `# Created automatically by Next.js. Profiling output should not be committed. +* +`; +function ensureProfilesDir(dir) { + const profilesDir = (0, _path.join)(dir, PROFILES_DIR_NAME); + (0, _fs.mkdirSync)(profilesDir, { + recursive: true + }); + const gitignorePath = (0, _path.join)(profilesDir, '.gitignore'); + if (!(0, _fs.existsSync)(gitignorePath)) { + try { + (0, _fs.writeFileSync)(gitignorePath, GITIGNORE_CONTENTS); + } catch { + // A missing .gitignore must not abort a profiling run. + } + } + return profilesDir; +} + +//# sourceMappingURL=profiles-dir.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/profiles-dir.js.map b/e-commerce/node_modules/next/dist/lib/profiles-dir.js.map new file mode 100644 index 0000000000000000000000000000000000000000..656232cc2694f56fec423452ab832f19f60b6510 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/profiles-dir.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/profiles-dir.ts"],"sourcesContent":["import { existsSync, mkdirSync, writeFileSync } from 'fs'\nimport { join } from 'path'\n\n/**\n * Name of the directory at the project root where profiling output (CPU\n * profiles and Turbopack traces) is written when profiling is enabled (see the\n * `--experimental-cpu-prof` and `--internal-trace` CLI flags). It is a\n * fixed-name sibling of `distDir`, not configurable.\n *\n * Keep this in sync with `DIST_PROFILES_DIR_NAME` in\n * `crates/next-core/src/next_config.rs`.\n */\nexport const PROFILES_DIR_NAME = '.next-profiles'\n\nconst GITIGNORE_CONTENTS = `# Created automatically by Next.js. Profiling output should not be committed.\n*\n`\n\n/**\n * Create the `.next-profiles` directory under `dir` and return its absolute\n * path. This is the single place that creates the directory — the Rust trace\n * writer relies on it already existing.\n *\n * Also writes a `.gitignore` containing `*` (if one isn't already there) so the\n * potentially large profiling output is excluded from git and gitignore-aware\n * tools (Tailwind, Turborepo, ...) skip the subtree instead of reading it and\n * hanging/OOMing.\n */\nexport function ensureProfilesDir(dir: string): string {\n const profilesDir = join(dir, PROFILES_DIR_NAME)\n mkdirSync(profilesDir, { recursive: true })\n const gitignorePath = join(profilesDir, '.gitignore')\n if (!existsSync(gitignorePath)) {\n try {\n writeFileSync(gitignorePath, GITIGNORE_CONTENTS)\n } catch {\n // A missing .gitignore must not abort a profiling run.\n }\n }\n return profilesDir\n}\n"],"names":["PROFILES_DIR_NAME","ensureProfilesDir","GITIGNORE_CONTENTS","dir","profilesDir","join","mkdirSync","recursive","gitignorePath","existsSync","writeFileSync"],"mappings":";;;;;;;;;;;;;;;IAYaA,iBAAiB;eAAjBA;;IAgBGC,iBAAiB;eAAjBA;;;oBA5BqC;sBAChC;AAWd,MAAMD,oBAAoB;AAEjC,MAAME,qBAAqB,CAAC;;AAE5B,CAAC;AAYM,SAASD,kBAAkBE,GAAW;IAC3C,MAAMC,cAAcC,IAAAA,UAAI,EAACF,KAAKH;IAC9BM,IAAAA,aAAS,EAACF,aAAa;QAAEG,WAAW;IAAK;IACzC,MAAMC,gBAAgBH,IAAAA,UAAI,EAACD,aAAa;IACxC,IAAI,CAACK,IAAAA,cAAU,EAACD,gBAAgB;QAC9B,IAAI;YACFE,IAAAA,iBAAa,EAACF,eAAeN;QAC/B,EAAE,OAAM;QACN,uDAAuD;QACzD;IACF;IACA,OAAOE;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/realpath.d.ts b/e-commerce/node_modules/next/dist/lib/realpath.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6607cfe01e7fda96d968ea7f6e922ea48e994861 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/realpath.d.ts @@ -0,0 +1,2 @@ +import fs from 'fs'; +export declare const realpathSync: typeof fs.realpathSync.native; diff --git a/e-commerce/node_modules/next/dist/lib/realpath.js b/e-commerce/node_modules/next/dist/lib/realpath.js new file mode 100644 index 0000000000000000000000000000000000000000..7068767318d227acc6022f035a85a039dcf0ed2d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/realpath.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "realpathSync", { + enumerable: true, + get: function() { + return realpathSync; + } +}); +const _fs = /*#__PURE__*/ _interop_require_default(require("fs")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +const isWindows = process.platform === 'win32'; +const realpathSync = isWindows ? _fs.default.realpathSync : _fs.default.realpathSync.native; + +//# sourceMappingURL=realpath.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/realpath.js.map b/e-commerce/node_modules/next/dist/lib/realpath.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3fee15fb9ef05ad724de7693ba7815be345b70b2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/realpath.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/realpath.ts"],"sourcesContent":["import fs from 'fs'\n\nconst isWindows = process.platform === 'win32'\n\n// Interesting learning from this, that fs.realpathSync is 70x slower than fs.realpathSync.native:\n// https://sun0day.github.io/blog/vite/why-vite4_3-is-faster.html#fs-realpathsync-issue\n// https://github.com/nodejs/node/issues/2680\n// However, we can't use fs.realpathSync.native on Windows due to behavior differences.\nexport const realpathSync = isWindows ? fs.realpathSync : fs.realpathSync.native\n"],"names":["realpathSync","isWindows","process","platform","fs","native"],"mappings":";;;;+BAQaA;;;eAAAA;;;2DARE;;;;;;AAEf,MAAMC,YAAYC,QAAQC,QAAQ,KAAK;AAMhC,MAAMH,eAAeC,YAAYG,WAAE,CAACJ,YAAY,GAAGI,WAAE,CAACJ,YAAY,CAACK,MAAM","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/recursive-copy.d.ts b/e-commerce/node_modules/next/dist/lib/recursive-copy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dc31fbaecdcb7e9ff143cb3e44a6f22addd82b50 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/recursive-copy.d.ts @@ -0,0 +1,5 @@ +export declare function recursiveCopy(source: string, dest: string, { concurrency, overwrite, filter, }?: { + concurrency?: number; + overwrite?: boolean; + filter?(filePath: string): boolean; +}): Promise; diff --git a/e-commerce/node_modules/next/dist/lib/recursive-copy.js b/e-commerce/node_modules/next/dist/lib/recursive-copy.js new file mode 100644 index 0000000000000000000000000000000000000000..9317eb2e33e36c76bd6ffd4c746fb24ff57ba51e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/recursive-copy.js @@ -0,0 +1,76 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "recursiveCopy", { + enumerable: true, + get: function() { + return recursiveCopy; + } +}); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +const _fs = require("fs"); +const _asyncsema = require("next/dist/compiled/async-sema"); +const _iserror = /*#__PURE__*/ _interop_require_default(require("./is-error")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +const COPYFILE_EXCL = _fs.constants.COPYFILE_EXCL; +async function recursiveCopy(source, dest, { concurrency = 32, overwrite = false, filter = ()=>true } = {}) { + const cwdPath = process.cwd(); + const from = _path.default.resolve(cwdPath, source); + const to = _path.default.resolve(cwdPath, dest); + const sema = new _asyncsema.Sema(concurrency); + // deep copy the file/directory + async function _copy(item, lstats) { + const target = item.replace(from, to); + await sema.acquire(); + if (!lstats) { + // after lock on first run + lstats = await _fs.promises.lstat(from); + } + // readdir & lstat do not follow symbolic links + // if part is a symbolic link, follow it with stat + let isFile = lstats.isFile(); + let isDirectory = lstats.isDirectory(); + if (lstats.isSymbolicLink()) { + const stats = await _fs.promises.stat(item); + isFile = stats.isFile(); + isDirectory = stats.isDirectory(); + } + if (isDirectory) { + try { + await _fs.promises.mkdir(target, { + recursive: true + }); + } catch (err) { + // do not throw `folder already exists` errors + if ((0, _iserror.default)(err) && err.code !== 'EEXIST') { + throw err; + } + } + sema.release(); + const files = await _fs.promises.readdir(item, { + withFileTypes: true + }); + await Promise.all(files.map((file)=>_copy(_path.default.join(item, file.name), file))); + } else if (isFile && // before we send the path to filter + // we remove the base path (from) and replace \ by / (windows) + filter(item.replace(from, '').replace(/\\/g, '/'))) { + await _fs.promises.copyFile(item, target, overwrite ? undefined : COPYFILE_EXCL).catch((err)=>{ + // if overwrite is false we shouldn't fail on EEXIST + if (err.code !== 'EEXIST') { + throw err; + } + }); + sema.release(); + } else { + sema.release(); + } + } + await _copy(from); +} + +//# sourceMappingURL=recursive-copy.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/recursive-copy.js.map b/e-commerce/node_modules/next/dist/lib/recursive-copy.js.map new file mode 100644 index 0000000000000000000000000000000000000000..acefe0c1ec8d1fe625e2a309b32a6fd7319faf35 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/recursive-copy.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/recursive-copy.ts"],"sourcesContent":["import path from 'path'\nimport type { Dirent, Stats } from 'fs'\nimport { promises, constants } from 'fs'\nimport { Sema } from 'next/dist/compiled/async-sema'\nimport isError from './is-error'\n\nconst COPYFILE_EXCL = constants.COPYFILE_EXCL\n\nexport async function recursiveCopy(\n source: string,\n dest: string,\n {\n concurrency = 32,\n overwrite = false,\n filter = () => true,\n }: {\n concurrency?: number\n overwrite?: boolean\n filter?(filePath: string): boolean\n } = {}\n): Promise {\n const cwdPath = process.cwd()\n const from = path.resolve(cwdPath, source)\n const to = path.resolve(cwdPath, dest)\n\n const sema = new Sema(concurrency)\n\n // deep copy the file/directory\n async function _copy(item: string, lstats?: Stats | Dirent): Promise {\n const target = item.replace(from, to)\n\n await sema.acquire()\n\n if (!lstats) {\n // after lock on first run\n lstats = await promises.lstat(from)\n }\n\n // readdir & lstat do not follow symbolic links\n // if part is a symbolic link, follow it with stat\n let isFile = lstats.isFile()\n let isDirectory = lstats.isDirectory()\n if (lstats.isSymbolicLink()) {\n const stats = await promises.stat(item)\n isFile = stats.isFile()\n isDirectory = stats.isDirectory()\n }\n\n if (isDirectory) {\n try {\n await promises.mkdir(target, { recursive: true })\n } catch (err) {\n // do not throw `folder already exists` errors\n if (isError(err) && err.code !== 'EEXIST') {\n throw err\n }\n }\n sema.release()\n const files = await promises.readdir(item, { withFileTypes: true })\n await Promise.all(\n files.map((file) => _copy(path.join(item, file.name), file))\n )\n } else if (\n isFile &&\n // before we send the path to filter\n // we remove the base path (from) and replace \\ by / (windows)\n filter(item.replace(from, '').replace(/\\\\/g, '/'))\n ) {\n await promises\n .copyFile(item, target, overwrite ? undefined : COPYFILE_EXCL)\n .catch((err) => {\n // if overwrite is false we shouldn't fail on EEXIST\n if (err.code !== 'EEXIST') {\n throw err\n }\n })\n sema.release()\n } else {\n sema.release()\n }\n }\n\n await _copy(from)\n}\n"],"names":["recursiveCopy","COPYFILE_EXCL","constants","source","dest","concurrency","overwrite","filter","cwdPath","process","cwd","from","path","resolve","to","sema","Sema","_copy","item","lstats","target","replace","acquire","promises","lstat","isFile","isDirectory","isSymbolicLink","stats","stat","mkdir","recursive","err","isError","code","release","files","readdir","withFileTypes","Promise","all","map","file","join","name","copyFile","undefined","catch"],"mappings":";;;;+BAQsBA;;;eAAAA;;;6DARL;oBAEmB;2BACf;gEACD;;;;;;AAEpB,MAAMC,gBAAgBC,aAAS,CAACD,aAAa;AAEtC,eAAeD,cACpBG,MAAc,EACdC,IAAY,EACZ,EACEC,cAAc,EAAE,EAChBC,YAAY,KAAK,EACjBC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ACV,MAAM,IAAIU,OAAO,CAAC,OAAO,OAC7C;YACA,MAAME,YAAQ,CACXsB,QAAQ,CAAC3B,MAAME,QAAQd,YAAYwC,YAAY7C,eAC/C8C,KAAK,CAAC,CAACf;gBACN,oDAAoD;gBACpD,IAAIA,IAAIE,IAAI,KAAK,UAAU;oBACzB,MAAMF;gBACR;YACF;YACFjB,KAAKoB,OAAO;QACd,OAAO;YACLpB,KAAKoB,OAAO;QACd;IACF;IAEA,MAAMlB,MAAMN;AACd","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/recursive-delete.d.ts b/e-commerce/node_modules/next/dist/lib/recursive-delete.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a064a89354d472a1810f4aa2d71e8a44c9aa2dc5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/recursive-delete.d.ts @@ -0,0 +1,25 @@ +/** + * Used in unit test. + * @ignore + */ +export declare function calcBackoffMs(attempt: number): number; +/** + * Recursively delete directory contents. + * + * This is used when cleaning the `distDir`, and is part of the critical path + * for starting the server, so we use synchronous file IO, as we're always + * blocked on it anyways. + * + * Despite using sync IO, the function signature is still `async` because we + * asynchronously perform retries. + */ +export declare function recursiveDeleteSyncWithAsyncRetries( +/** Directory to delete the contents of */ +dir: string, +/** Exclude based on relative file path */ +exclude?: ReadonlySet, +/** + * Only delete files whose mtime is at least this old. Directories are + * removed once empty. + */ +maxAgeMs?: number): Promise; diff --git a/e-commerce/node_modules/next/dist/lib/recursive-delete.js b/e-commerce/node_modules/next/dist/lib/recursive-delete.js new file mode 100644 index 0000000000000000000000000000000000000000..bc8b15b406a4110390d5bd6abf4e42bdb0745d15 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/recursive-delete.js @@ -0,0 +1,176 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + calcBackoffMs: null, + recursiveDeleteSyncWithAsyncRetries: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + calcBackoffMs: function() { + return calcBackoffMs; + }, + recursiveDeleteSyncWithAsyncRetries: function() { + return recursiveDeleteSyncWithAsyncRetries; + } +}); +const _nodefs = /*#__PURE__*/ _interop_require_wildcard(require("node:fs")); +const _nodepath = require("node:path"); +const _iserror = /*#__PURE__*/ _interop_require_default(require("./is-error")); +const _wait = require("./wait"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +// We use an exponential backoff. See the unit test for example values. +// +// - Node's `fs` module uses a linear backoff, starting with 100ms. +// - Rust tries 64 times with only a `thread::yield_now` in between. +// +// We want something more aggressive, as `recursiveDelete` is in the critical +// path of `next dev` and `next build` startup. +const INITIAL_RETRY_MS = 8; +const MAX_RETRY_MS = 64; +const MAX_RETRIES = 6; +function calcBackoffMs(attempt) { + return Math.min(INITIAL_RETRY_MS * Math.pow(2, attempt), MAX_RETRY_MS); +} +function unlinkPath(p, isDir = false, attempt = 0) { + try { + if (isDir) { + _nodefs.rmdirSync(p); + } else { + _nodefs.unlinkSync(p); + } + } catch (e) { + const code = (0, _iserror.default)(e) && e.code; + if ((code === 'EBUSY' || code === 'ENOTEMPTY' || code === 'EPERM' || code === 'EMFILE') && attempt < MAX_RETRIES) { + // retrying is unlikely to succeed on POSIX platforms, but Windows can + // fail due to temporarily-open files + return (async ()=>{ + await (0, _wait.wait)(calcBackoffMs(attempt)); + return unlinkPath(p, isDir, attempt + 1); + })(); + } + if (code === 'ENOENT') { + return; + } + throw e; + } +} +const FUTURE_MTIME_TOLERANCE_MS = 60 * 60 * 1000; +/** Returns whether `p`'s own mtime falls outside the retained time range. */ function isStale(p, staleBefore, futureMtimeThreshold) { + try { + // lstat, not stat: a symlink is deleted based on its own age, not its + // target's. + const mtimeMs = _nodefs.lstatSync(p).mtimeMs; + return mtimeMs <= staleBefore || mtimeMs > futureMtimeThreshold; + } catch (e) { + if ((0, _iserror.default)(e) && e.code === 'ENOENT') { + return false; + } + throw e; + } +} +async function recursiveDeleteSyncWithAsyncRetries(/** Directory to delete the contents of */ dir, /** Exclude based on relative file path */ exclude, /** + * Only delete files whose mtime is at least this old. Directories are + * removed once empty. + */ maxAgeMs) { + const now = Date.now(); + await deleteContents(dir, { + exclude, + staleBefore: maxAgeMs === undefined ? undefined : now - maxAgeMs, + futureMtimeThreshold: now + FUTURE_MTIME_TOLERANCE_MS + }); +} +/** @returns whether anything was kept. */ async function deleteContents(dir, { exclude, staleBefore, futureMtimeThreshold, previousPath }) { + let result; + try { + result = _nodefs.readdirSync(dir, { + withFileTypes: true + }); + } catch (e) { + if ((0, _iserror.default)(e) && e.code === 'ENOENT') { + return false; + } + throw e; + } + let keptAnything = false; + await Promise.all(result.map(async (part)=>{ + const absolutePath = (0, _nodepath.join)(dir, part.name); + const pp = (0, _nodepath.join)(previousPath ?? '', part.name); + if (exclude == null ? void 0 : exclude.has(pp)) { + keptAnything = true; + return; + } + // Note: readdir does not follow symbolic links, that's good: we want to + // delete the links and not the destination. + const isDirectory = part.isDirectory(); + if (isDirectory) { + if (await deleteContents(absolutePath, { + exclude, + staleBefore, + futureMtimeThreshold, + previousPath: pp + })) { + keptAnything = true; + return; + } + } else if (staleBefore !== undefined && !isStale(absolutePath, staleBefore, futureMtimeThreshold)) { + keptAnything = true; + return; + } + return unlinkPath(absolutePath, isDirectory); + })); + return keptAnything; +} + +//# sourceMappingURL=recursive-delete.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/recursive-delete.js.map b/e-commerce/node_modules/next/dist/lib/recursive-delete.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d3bd03f19b0a4d36fd68bf12004b39406c1e637d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/recursive-delete.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/recursive-delete.ts"],"sourcesContent":["import type { Dirent } from 'node:fs'\nimport * as fs from 'node:fs'\nimport { join } from 'node:path'\nimport isError from './is-error'\nimport { wait } from './wait'\n\n// We use an exponential backoff. See the unit test for example values.\n//\n// - Node's `fs` module uses a linear backoff, starting with 100ms.\n// - Rust tries 64 times with only a `thread::yield_now` in between.\n//\n// We want something more aggressive, as `recursiveDelete` is in the critical\n// path of `next dev` and `next build` startup.\nconst INITIAL_RETRY_MS = 8\nconst MAX_RETRY_MS = 64\nconst MAX_RETRIES = 6\n\n/**\n * Used in unit test.\n * @ignore\n */\nexport function calcBackoffMs(attempt: number): number {\n return Math.min(INITIAL_RETRY_MS * Math.pow(2, attempt), MAX_RETRY_MS)\n}\n\nfunction unlinkPath(\n p: string,\n isDir = false,\n attempt = 0\n): Promise | void {\n try {\n if (isDir) {\n fs.rmdirSync(p)\n } else {\n fs.unlinkSync(p)\n }\n } catch (e) {\n const code = isError(e) && e.code\n if (\n (code === 'EBUSY' ||\n code === 'ENOTEMPTY' ||\n code === 'EPERM' ||\n code === 'EMFILE') &&\n attempt < MAX_RETRIES\n ) {\n // retrying is unlikely to succeed on POSIX platforms, but Windows can\n // fail due to temporarily-open files\n return (async () => {\n await wait(calcBackoffMs(attempt))\n return unlinkPath(p, isDir, attempt + 1)\n })()\n }\n\n if (code === 'ENOENT') {\n return\n }\n\n throw e\n }\n}\n\nconst FUTURE_MTIME_TOLERANCE_MS = 60 * 60 * 1000\n\n/** Returns whether `p`'s own mtime falls outside the retained time range. */\nfunction isStale(\n p: string,\n staleBefore: number,\n futureMtimeThreshold: number\n): boolean {\n try {\n // lstat, not stat: a symlink is deleted based on its own age, not its\n // target's.\n const mtimeMs = fs.lstatSync(p).mtimeMs\n return mtimeMs <= staleBefore || mtimeMs > futureMtimeThreshold\n } catch (e) {\n if (isError(e) && e.code === 'ENOENT') {\n return false\n }\n throw e\n }\n}\n\n/**\n * Recursively delete directory contents.\n *\n * This is used when cleaning the `distDir`, and is part of the critical path\n * for starting the server, so we use synchronous file IO, as we're always\n * blocked on it anyways.\n *\n * Despite using sync IO, the function signature is still `async` because we\n * asynchronously perform retries.\n */\nexport async function recursiveDeleteSyncWithAsyncRetries(\n /** Directory to delete the contents of */\n dir: string,\n /** Exclude based on relative file path */\n exclude?: ReadonlySet,\n /**\n * Only delete files whose mtime is at least this old. Directories are\n * removed once empty.\n */\n maxAgeMs?: number\n): Promise {\n const now = Date.now()\n await deleteContents(dir, {\n exclude,\n staleBefore: maxAgeMs === undefined ? undefined : now - maxAgeMs,\n futureMtimeThreshold: now + FUTURE_MTIME_TOLERANCE_MS,\n })\n}\n\n/** @returns whether anything was kept. */\nasync function deleteContents(\n dir: string,\n {\n exclude,\n staleBefore,\n futureMtimeThreshold,\n previousPath,\n }: {\n exclude: ReadonlySet | undefined\n staleBefore: number | undefined\n futureMtimeThreshold: number\n /** Relative path to the directory being deleted, used for exclude */\n previousPath?: string\n }\n): Promise {\n let result\n try {\n result = fs.readdirSync(dir, { withFileTypes: true })\n } catch (e) {\n if (isError(e) && e.code === 'ENOENT') {\n return false\n }\n throw e\n }\n\n let keptAnything = false\n\n await Promise.all(\n result.map(async (part: Dirent) => {\n const absolutePath = join(dir, part.name)\n const pp = join(previousPath ?? '', part.name)\n\n if (exclude?.has(pp)) {\n keptAnything = true\n return\n }\n\n // Note: readdir does not follow symbolic links, that's good: we want to\n // delete the links and not the destination.\n const isDirectory = part.isDirectory()\n if (isDirectory) {\n if (\n await deleteContents(absolutePath, {\n exclude,\n staleBefore,\n futureMtimeThreshold,\n previousPath: pp,\n })\n ) {\n keptAnything = true\n return\n }\n } else if (\n staleBefore !== undefined &&\n !isStale(absolutePath, staleBefore, futureMtimeThreshold)\n ) {\n keptAnything = true\n return\n }\n\n return unlinkPath(absolutePath, isDirectory)\n })\n )\n return keptAnything\n}\n"],"names":["calcBackoffMs","recursiveDeleteSyncWithAsyncRetries","INITIAL_RETRY_MS","MAX_RETRY_MS","MAX_RETRIES","attempt","Math","min","pow","unlinkPath","p","isDir","fs","rmdirSync","unlinkSync","e","code","isError","wait","FUTURE_MTIME_TOLERANCE_MS","isStale","staleBefore","futureMtimeThreshold","mtimeMs","lstatSync","dir","exclude","maxAgeMs","now","Date","deleteContents","undefined","previousPath","result","readdirSync","withFileTypes","keptAnything","Promise","all","map","part","absolutePath","join","name","pp","has","isDirectory"],"mappings":";;;;;;;;;;;;;;;IAqBgBA,aAAa;eAAbA;;IAuEMC,mCAAmC;eAAnCA;;;gEA3FF;0BACC;gEACD;sBACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErB,uEAAuE;AACvE,EAAE;AACF,mEAAmE;AACnE,oEAAoE;AACpE,EAAE;AACF,6EAA6E;AAC7E,+CAA+C;AAC/C,MAAMC,mBAAmB;AACzB,MAAMC,eAAe;AACrB,MAAMC,cAAc;AAMb,SAASJ,cAAcK,OAAe;IAC3C,OAAOC,KAAKC,GAAG,CAACL,mBAAmBI,KAAKE,GAAG,CAAC,GAAGH,UAAUF;AAC3D;AAEA,SAASM,WACPC,CAAS,EACTC,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;IACJ,IAAI;QACFA,SAASrB,QAAGsB,WAAW,CAACT,KAAK;YAAEU,eAAe;QAAK;IACrD,EAAE,OAAOpB,GAAG;QACV,IAAIE,IAAAA,gBAAO,EAACF,MAAMA,EAAEC,IAAI,KAAK,UAAU;YACrC,OAAO;QACT;QACA,MAAMD;IACR;IAEA,IAAIqB,eAAe;IAEnB,MAAMC,QAAQC,GAAG,CACfL,OAAOM,GAAG,CAAC,OAAOC;QAChB,MAAMC,eAAeC,IAAAA,cAAI,EAACjB,KAAKe,KAAKG,IAAI;QACxC,MAAMC,KAAKF,IAAAA,cAAI,EAACV,gBAAgB,IAAIQ,KAAKG,IAAI;QAE7C,IAAIjB,2BAAAA,QAASmB,GAAG,CAACD,KAAK;YACpBR,eAAe;YACf;QACF;QAEA,wEAAwE;QACxE,4CAA4C;QAC5C,MAAMU,cAAcN,KAAKM,WAAW;QACpC,IAAIA,aAAa;YACf,IACE,MAAMhB,eAAeW,cAAc;gBACjCf;gBACAL;gBACAC;gBACAU,cAAcY;YAChB,IACA;gBACAR,eAAe;gBACf;YACF;QACF,OAAO,IACLf,gBAAgBU,aAChB,CAACX,QAAQqB,cAAcpB,aAAaC,uBACpC;YACAc,eAAe;YACf;QACF;QAEA,OAAO3B,WAAWgC,cAAcK;IAClC;IAEF,OAAOV;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/recursive-readdir.d.ts b/e-commerce/node_modules/next/dist/lib/recursive-readdir.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..98cb2e628e25552e36f0f4a7f2de055798b21db6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/recursive-readdir.d.ts @@ -0,0 +1,34 @@ +type Filter = (pathname: string) => boolean; +export type RecursiveReadDirOptions = { + /** + * Filter to ignore files with absolute pathnames, false to ignore. + */ + pathnameFilter?: Filter; + /** + * Filter to ignore files and directories with absolute pathnames, false to + * ignore. + */ + ignoreFilter?: Filter; + /** + * Filter to ignore files and directories with the pathname part, false to + * ignore. + */ + ignorePartFilter?: Filter; + /** + * Whether to sort the results, true by default. + */ + sortPathnames?: boolean; + /** + * Whether to return relative pathnames, true by default. + */ + relativePathnames?: boolean; +}; +/** + * Recursively reads a directory and returns the list of pathnames. + * + * @param rootDirectory the directory to read + * @param options options to control the behavior of the recursive read + * @returns the list of pathnames + */ +export declare function recursiveReadDir(rootDirectory: string, options?: RecursiveReadDirOptions): Promise; +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/recursive-readdir.js b/e-commerce/node_modules/next/dist/lib/recursive-readdir.js new file mode 100644 index 0000000000000000000000000000000000000000..570e184254e78141b256042d4d867a0c4fbe5024 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/recursive-readdir.js @@ -0,0 +1,124 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "recursiveReadDir", { + enumerable: true, + get: function() { + return recursiveReadDir; + } +}); +const _promises = /*#__PURE__*/ _interop_require_default(require("fs/promises")); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +async function recursiveReadDir(rootDirectory, options = {}) { + // Grab our options. + const { pathnameFilter, ignoreFilter, ignorePartFilter, sortPathnames = true, relativePathnames = true } = options; + // The list of pathnames to return. + const pathnames = []; + /** + * Coerces the pathname to be relative if requested. + */ const coerce = relativePathnames ? (pathname)=>pathname.replace(rootDirectory, '') : (pathname)=>pathname; + // The queue of directories to scan. + let directories = [ + rootDirectory + ]; + while(directories.length > 0){ + // Load all the files in each directory at the same time. + const results = await Promise.all(directories.map(async (directory)=>{ + const result = { + directories: [], + pathnames: [], + links: [] + }; + try { + const dir = await _promises.default.readdir(directory, { + withFileTypes: true + }); + for (const file of dir){ + // If enabled, ignore the file if it matches the ignore filter. + if (ignorePartFilter && ignorePartFilter(file.name)) { + continue; + } + // Handle each file. + const absolutePathname = _path.default.join(directory, file.name); + // If enabled, ignore the file if it matches the ignore filter. + if (ignoreFilter && ignoreFilter(absolutePathname)) { + continue; + } + // If the file is a directory, then add it to the list of directories, + // they'll be scanned on a later pass. + if (file.isDirectory()) { + result.directories.push(absolutePathname); + } else if (file.isSymbolicLink()) { + result.links.push(absolutePathname); + } else if (!pathnameFilter || pathnameFilter(absolutePathname)) { + result.pathnames.push(coerce(absolutePathname)); + } + } + } catch (err) { + // This can only happen when the underlying directory was removed. If + // anything other than this error occurs, re-throw it. + // if (err.code !== 'ENOENT') throw err + if (err.code !== 'ENOENT' || directory === rootDirectory) throw err; + // The error occurred, so abandon reading this directory. + return null; + } + return result; + })); + // Empty the directories, we'll fill it later if some of the files are + // directories. + directories = []; + // Keep track of any symbolic links we find, we'll resolve them later. + const links = []; + // For each result of directory scans... + for (const result of results){ + // If the directory was removed, then skip it. + if (!result) continue; + // Add any directories to the list of directories to scan. + directories.push(...result.directories); + // Add any symbolic links to the list of symbolic links to resolve. + links.push(...result.links); + // Add any file pathnames to the list of pathnames. + pathnames.push(...result.pathnames); + } + // Resolve all the symbolic links we found if any. + if (links.length > 0) { + const resolved = await Promise.all(links.map(async (absolutePathname)=>{ + try { + return await _promises.default.stat(absolutePathname); + } catch (err) { + // This can only happen when the underlying link was removed. If + // anything other than this error occurs, re-throw it. + if (err.code !== 'ENOENT') throw err; + // The error occurred, so abandon reading this directory. + return null; + } + })); + for(let i = 0; i < links.length; i++){ + const stats = resolved[i]; + // If the link was removed, then skip it. + if (!stats) continue; + // We would have already ignored the file if it matched the ignore + // filter, so we don't need to check it again. + const absolutePathname = links[i]; + if (stats.isDirectory()) { + directories.push(absolutePathname); + } else if (!pathnameFilter || pathnameFilter(absolutePathname)) { + pathnames.push(coerce(absolutePathname)); + } + } + } + } + // Sort the pathnames in place if requested. + if (sortPathnames) { + pathnames.sort(); + } + return pathnames; +} + +//# sourceMappingURL=recursive-readdir.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/recursive-readdir.js.map b/e-commerce/node_modules/next/dist/lib/recursive-readdir.js.map new file mode 100644 index 0000000000000000000000000000000000000000..de6947def603e2d7988c6ea9cdc2c9c3613b18d8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/recursive-readdir.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/recursive-readdir.ts"],"sourcesContent":["import fs from 'fs/promises'\nimport path from 'path'\n\ntype Filter = (pathname: string) => boolean\n\ntype Result = {\n directories: string[]\n pathnames: string[]\n links: string[]\n}\n\nexport type RecursiveReadDirOptions = {\n /**\n * Filter to ignore files with absolute pathnames, false to ignore.\n */\n pathnameFilter?: Filter\n\n /**\n * Filter to ignore files and directories with absolute pathnames, false to\n * ignore.\n */\n ignoreFilter?: Filter\n\n /**\n * Filter to ignore files and directories with the pathname part, false to\n * ignore.\n */\n ignorePartFilter?: Filter\n\n /**\n * Whether to sort the results, true by default.\n */\n sortPathnames?: boolean\n\n /**\n * Whether to return relative pathnames, true by default.\n */\n relativePathnames?: boolean\n}\n\n/**\n * Recursively reads a directory and returns the list of pathnames.\n *\n * @param rootDirectory the directory to read\n * @param options options to control the behavior of the recursive read\n * @returns the list of pathnames\n */\nexport async function recursiveReadDir(\n rootDirectory: string,\n options: RecursiveReadDirOptions = {}\n): Promise {\n // Grab our options.\n const {\n pathnameFilter,\n ignoreFilter,\n ignorePartFilter,\n sortPathnames = true,\n relativePathnames = true,\n } = options\n\n // The list of pathnames to return.\n const pathnames: string[] = []\n\n /**\n * Coerces the pathname to be relative if requested.\n */\n const coerce = relativePathnames\n ? (pathname: string) => pathname.replace(rootDirectory, '')\n : (pathname: string) => pathname\n\n // The queue of directories to scan.\n let directories: string[] = [rootDirectory]\n\n while (directories.length > 0) {\n // Load all the files in each directory at the same time.\n const results = await Promise.all(\n directories.map(async (directory) => {\n const result: Result = { directories: [], pathnames: [], links: [] }\n\n try {\n const dir = await fs.readdir(directory, { withFileTypes: true })\n for (const file of dir) {\n // If enabled, ignore the file if it matches the ignore filter.\n if (ignorePartFilter && ignorePartFilter(file.name)) {\n continue\n }\n\n // Handle each file.\n const absolutePathname = path.join(directory, file.name)\n\n // If enabled, ignore the file if it matches the ignore filter.\n if (ignoreFilter && ignoreFilter(absolutePathname)) {\n continue\n }\n\n // If the file is a directory, then add it to the list of directories,\n // they'll be scanned on a later pass.\n if (file.isDirectory()) {\n result.directories.push(absolutePathname)\n } else if (file.isSymbolicLink()) {\n result.links.push(absolutePathname)\n } else if (!pathnameFilter || pathnameFilter(absolutePathname)) {\n result.pathnames.push(coerce(absolutePathname))\n }\n }\n } catch (err: any) {\n // This can only happen when the underlying directory was removed. If\n // anything other than this error occurs, re-throw it.\n // if (err.code !== 'ENOENT') throw err\n if (err.code !== 'ENOENT' || directory === rootDirectory) throw err\n\n // The error occurred, so abandon reading this directory.\n return null\n }\n\n return result\n })\n )\n\n // Empty the directories, we'll fill it later if some of the files are\n // directories.\n directories = []\n\n // Keep track of any symbolic links we find, we'll resolve them later.\n const links = []\n\n // For each result of directory scans...\n for (const result of results) {\n // If the directory was removed, then skip it.\n if (!result) continue\n\n // Add any directories to the list of directories to scan.\n directories.push(...result.directories)\n\n // Add any symbolic links to the list of symbolic links to resolve.\n links.push(...result.links)\n\n // Add any file pathnames to the list of pathnames.\n pathnames.push(...result.pathnames)\n }\n\n // Resolve all the symbolic links we found if any.\n if (links.length > 0) {\n const resolved = await Promise.all(\n links.map(async (absolutePathname) => {\n try {\n return await fs.stat(absolutePathname)\n } catch (err: any) {\n // This can only happen when the underlying link was removed. If\n // anything other than this error occurs, re-throw it.\n if (err.code !== 'ENOENT') throw err\n\n // The error occurred, so abandon reading this directory.\n return null\n }\n })\n )\n\n for (let i = 0; i < links.length; i++) {\n const stats = resolved[i]\n\n // If the link was removed, then skip it.\n if (!stats) continue\n\n // We would have already ignored the file if it matched the ignore\n // filter, so we don't need to check it again.\n const absolutePathname = links[i]\n\n if (stats.isDirectory()) {\n directories.push(absolutePathname)\n } else if (!pathnameFilter || pathnameFilter(absolutePathname)) {\n pathnames.push(coerce(absolutePathname))\n }\n }\n }\n }\n\n // Sort the pathnames in place if requested.\n if (sortPathnames) {\n pathnames.sort()\n }\n\n return pathnames\n}\n"],"names":["recursiveReadDir","rootDirectory","options","pathnameFilter","ignoreFilter","ignorePartFilter","sortPathnames","relativePathnames","pathnames","coerce","pathname","replace","directories","length","results","Promise","all","map","directory","result","links","dir","fs","readdir","withFileTypes","file","name","absolutePathname","path","join","isDirectory","push","isSymbolicLink","err","code","resolved","stat","i","stats","sort"],"mappings":";;;;+BA+CsBA;;;eAAAA;;;iEA/CP;6DACE;;;;;;AA8CV,eAAeA,iBACpBC,aAAqB,EACrBC,UAAmC,CAAC,CAAC;IAErC,oBAAoB;IACpB,MAAM,EACJC,cAAc,EACdC,YAAY,EACZC,gBAAgB,EAChBC,gBAAgB,IAAI,EACpBC,oBAAoB,IAAI,EACzB,GAAGL;IAEJ,mCAAmC;IACnC,MAAMM,YAAsB,EAAE;IAE9B;;GAEC,GACD,MAAMC,SAASF,oBACX,CAACG,WAAqBA,SAASC,OAAO,CAACV,eAAe,MACtD,CAACS,WAAqBA;IAE1B,oCAAoC;IACpC,IAAIE,cAAwB;QAACX;KAAc;IAE3C,MAAOW,YAAYC,MAAM,GAAG,EAAG;QAC7B,yDAAyD;QACzD,MAAMC,UAAU,MAAMC,QAAQC,GAAG,CAC/BJ,YAAYK,GAAG,CAAC,OAAOC;YACrB,MAAMC,SAAiB;gBAAEP,aAAa,EAAE;gBAAEJ,WAAW,EAAE;gBAAEY,OAAO,EAAE;YAAC;YAEnE,IAAI;gBACF,MAAMC,MAAM,MAAMC,iBAAE,CAACC,OAAO,CAACL,WAAW;oBAAEM,eAAe;gBAAK;gBAC9D,KAAK,MAAMC,QAAQJ,IAAK;oBACtB,+DAA+D;oBAC/D,IAAIhB,oBAAoBA,iBAAiBoB,KAAKC,IAAI,GAAG;wBACnD;oBACF;oBAEA,oBAAoB;oBACpB,MAAMC,mBAAmBC,aAAI,CAACC,IAAI,CAACX,WAAWO,KAAKC,I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DAAyD;oBACzD,OAAO;gBACT;YACF;YAGF,IAAK,IAAII,IAAI,GAAGA,IAAIjB,MAAMP,MAAM,EAAEwB,IAAK;gBACrC,MAAMC,QAAQH,QAAQ,CAACE,EAAE;gBAEzB,yCAAyC;gBACzC,IAAI,CAACC,OAAO;gBAEZ,kEAAkE;gBAClE,8CAA8C;gBAC9C,MAAMX,mBAAmBP,KAAK,CAACiB,EAAE;gBAEjC,IAAIC,MAAMR,WAAW,IAAI;oBACvBlB,YAAYmB,IAAI,CAACJ;gBACnB,OAAO,IAAI,CAACxB,kBAAkBA,eAAewB,mBAAmB;oBAC9DnB,UAAUuB,IAAI,CAACtB,OAAOkB;gBACxB;YACF;QACF;IACF;IAEA,4CAA4C;IAC5C,IAAIrB,eAAe;QACjBE,UAAU+B,IAAI;IAChB;IAEA,OAAO/B;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/redirect-status.d.ts b/e-commerce/node_modules/next/dist/lib/redirect-status.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7450ce25ce3c3e6ea3e20511aad0eac09c6f27c4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/redirect-status.d.ts @@ -0,0 +1,6 @@ +export declare const allowedStatusCodes: Set; +export declare function getRedirectStatus(route: { + statusCode?: number; + permanent?: boolean; +}): number; +export declare function modifyRouteRegex(regex: string, restrictedPaths?: string[]): string; diff --git a/e-commerce/node_modules/next/dist/lib/redirect-status.js b/e-commerce/node_modules/next/dist/lib/redirect-status.js new file mode 100644 index 0000000000000000000000000000000000000000..802b9b3d54ee8660b6bc94dbee82b68e59dc794e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/redirect-status.js @@ -0,0 +1,46 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + allowedStatusCodes: null, + getRedirectStatus: null, + modifyRouteRegex: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + allowedStatusCodes: function() { + return allowedStatusCodes; + }, + getRedirectStatus: function() { + return getRedirectStatus; + }, + modifyRouteRegex: function() { + return modifyRouteRegex; + } +}); +const _redirectstatuscode = require("../client/components/redirect-status-code"); +const allowedStatusCodes = new Set([ + 301, + 302, + 303, + 307, + 308 +]); +function getRedirectStatus(route) { + return route.statusCode || (route.permanent ? _redirectstatuscode.RedirectStatusCode.PermanentRedirect : _redirectstatuscode.RedirectStatusCode.TemporaryRedirect); +} +function modifyRouteRegex(regex, restrictedPaths) { + if (restrictedPaths) { + regex = regex.replace(/\^/, `^(?!${restrictedPaths.map((path)=>path.replace(/\//g, '\\/')).join('|')})`); + } + regex = regex.replace(/\$$/, '(?:\\/)?$'); + return regex; +} + +//# sourceMappingURL=redirect-status.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/redirect-status.js.map b/e-commerce/node_modules/next/dist/lib/redirect-status.js.map new file mode 100644 index 0000000000000000000000000000000000000000..bbf997754828bd0cd3132cd76ccf40120a1d02b0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/redirect-status.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/redirect-status.ts"],"sourcesContent":["import { RedirectStatusCode } from '../client/components/redirect-status-code'\n\nexport const allowedStatusCodes = new Set([301, 302, 303, 307, 308])\n\nexport function getRedirectStatus(route: {\n statusCode?: number\n permanent?: boolean\n}): number {\n return (\n route.statusCode ||\n (route.permanent\n ? RedirectStatusCode.PermanentRedirect\n : RedirectStatusCode.TemporaryRedirect)\n )\n}\n\n// for redirects we restrict matching /_next and for all routes\n// we add an optional trailing slash at the end for easier\n// configuring between trailingSlash: true/false\nexport function modifyRouteRegex(regex: string, restrictedPaths?: string[]) {\n if (restrictedPaths) {\n regex = regex.replace(\n /\\^/,\n `^(?!${restrictedPaths\n .map((path) => path.replace(/\\//g, '\\\\/'))\n .join('|')})`\n )\n }\n regex = regex.replace(/\\$$/, '(?:\\\\/)?$')\n return regex\n}\n"],"names":["allowedStatusCodes","getRedirectStatus","modifyRouteRegex","Set","route","statusCode","permanent","RedirectStatusCode","PermanentRedirect","TemporaryRedirect","regex","restrictedPaths","replace","map","path","join"],"mappings":";;;;;;;;;;;;;;;;IAEaA,kBAAkB;eAAlBA;;IAEGC,iBAAiB;eAAjBA;;IAeAC,gBAAgB;eAAhBA;;;oCAnBmB;AAE5B,MAAMF,qBAAqB,IAAIG,IAAI;IAAC;IAAK;IAAK;IAAK;IAAK;CAAI;AAE5D,SAASF,kBAAkBG,KAGjC;IACC,OACEA,MAAMC,UAAU,IACfD,CAAAA,MAAME,SAAS,GACZC,sCAAkB,CAACC,iBAAiB,GACpCD,sCAAkB,CAACE,iBAAiB,AAAD;AAE3C;AAKO,SAASP,iBAAiBQ,KAAa,EAAEC,eAA0B;IACxE,IAAIA,iBAAiB;QACnBD,QAAQA,MAAME,OAAO,CACnB,MACA,CAAC,IAAI,EAAED,gBACJE,GAAG,CAAC,CAACC,OAASA,KAAKF,OAAO,CAAC,OAAO,QAClCG,IAAI,CAAC,KAAK,CAAC,CAAC;IAEnB;IACAL,QAAQA,MAAME,OAAO,CAAC,OAAO;IAC7B,OAAOF;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/require-instrumentation-client.d.ts b/e-commerce/node_modules/next/dist/lib/require-instrumentation-client.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/e-commerce/node_modules/next/dist/lib/require-instrumentation-client.js b/e-commerce/node_modules/next/dist/lib/require-instrumentation-client.js new file mode 100644 index 0000000000000000000000000000000000000000..e447c407c781a3bd3dea11152c89dbe074d017ed --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/require-instrumentation-client.js @@ -0,0 +1,32 @@ +/** + * This module imports the configured client instrumentation modules. + * + * The `private-next-instrumentation-client` module is automatically aliased to + * either the user's instrumentation module or a generated module array. + */ "use strict"; +if (process.env.NODE_ENV === 'development') { + const measureName = 'Client Instrumentation Hook'; + const startTime = performance.now(); + // eslint-disable-next-line @next/internal/typechecked-require -- Not a module. + const instrumentationClient = require('private-next-instrumentation-client'); + module.exports = Array.isArray(instrumentationClient) ? instrumentationClient : [ + instrumentationClient + ]; + const endTime = performance.now(); + const duration = endTime - startTime; + // Using 16ms threshold as it represents one frame (1000ms/60fps) + // This helps identify if the instrumentation hook initialization + // could potentially cause frame drops during development. + const THRESHOLD = 16; + if (duration > THRESHOLD) { + console.log(`[${measureName}] Slow execution detected: ${duration.toFixed(0)}ms (Note: Code download overhead is not included in this measurement)`); + } +} else { + // eslint-disable-next-line @next/internal/typechecked-require -- Not a module. + const instrumentationClient = require('private-next-instrumentation-client'); + module.exports = Array.isArray(instrumentationClient) ? instrumentationClient : [ + instrumentationClient + ]; +} + +//# sourceMappingURL=require-instrumentation-client.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/require-instrumentation-client.js.map b/e-commerce/node_modules/next/dist/lib/require-instrumentation-client.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6d718e9b18be317210497e1c0e03126189c1f58b --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/require-instrumentation-client.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/require-instrumentation-client.ts"],"sourcesContent":["/**\n * This module imports the configured client instrumentation modules.\n *\n * The `private-next-instrumentation-client` module is automatically aliased to\n * either the user's instrumentation module or a generated module array.\n */\nif (process.env.NODE_ENV === 'development') {\n const measureName = 'Client Instrumentation Hook'\n const startTime = performance.now()\n // eslint-disable-next-line @next/internal/typechecked-require -- Not a module.\n const instrumentationClient = require('private-next-instrumentation-client')\n module.exports = Array.isArray(instrumentationClient)\n ? instrumentationClient\n : [instrumentationClient]\n const endTime = performance.now()\n const duration = endTime - startTime\n\n // Using 16ms threshold as it represents one frame (1000ms/60fps)\n // This helps identify if the instrumentation hook initialization\n // could potentially cause frame drops during development.\n const THRESHOLD = 16\n if (duration > THRESHOLD) {\n console.log(\n `[${measureName}] Slow execution detected: ${duration.toFixed(0)}ms (Note: Code download overhead is not included in this measurement)`\n )\n }\n} else {\n // eslint-disable-next-line @next/internal/typechecked-require -- Not a module.\n const instrumentationClient = require('private-next-instrumentation-client')\n module.exports = Array.isArray(instrumentationClient)\n ? instrumentationClient\n : [instrumentationClient]\n}\n"],"names":["process","env","NODE_ENV","measureName","startTime","performance","now","instrumentationClient","require","module","exports","Array","isArray","endTime","duration","THRESHOLD","console","log","toFixed"],"mappings":"AAAA;;;;;CAKC;AACD,IAAIA,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;IAC1C,MAAMC,cAAc;IACpB,MAAMC,YAAYC,YAAYC,GAAG;IACjC,+EAA+E;IAC/E,MAAMC,wBAAwBC,QAAQ;IACtCC,OAAOC,OAAO,GAAGC,MAAMC,OAAO,CAACL,yBAC3BA,wBACA;QAACA;KAAsB;IAC3B,MAAMM,UAAUR,YAAYC,GAAG;IAC/B,MAAMQ,WAAWD,UAAUT;IAE3B,iEAAiE;IACjE,iEAAiE;IACjE,0DAA0D;IAC1D,MAAMW,YAAY;IAClB,IAAID,WAAWC,WAAW;QACxBC,QAAQC,GAAG,CACT,CAAC,CAAC,EAAEd,YAAY,2BAA2B,EAAEW,SAASI,OAAO,CAAC,GAAG,qEAAqE,CAAC;IAE3I;AACF,OAAO;IACL,+EAA+E;IAC/E,MAAMX,wBAAwBC,QAAQ;IACtCC,OAAOC,OAAO,GAAGC,MAAMC,OAAO,CAACL,yBAC3BA,wBACA;QAACA;KAAsB;AAC7B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/resolve-build-paths.d.ts b/e-commerce/node_modules/next/dist/lib/resolve-build-paths.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c26f52dfd8f095ddd52a02f50a2a810e6a16b80e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/resolve-build-paths.d.ts @@ -0,0 +1,24 @@ +import type { PageExtensions } from '../build/page-extensions-type'; +interface ResolvedBuildPaths { + appPaths: string[]; + pagePaths: string[]; +} +/** + * Resolves glob patterns and explicit paths to actual file paths. + * Categorizes them into App Router and Pages Router paths. + * + * Supports negation patterns prefixed with "!" to exclude paths. + * e.g., "app/**,!app/[lang]/page.js" includes all App Router paths except + * app/[lang]/page.js + */ +export declare function resolveBuildPaths(patterns: string[], projectDir: string, pageExtensions: PageExtensions): Promise; +/** + * Parse build paths from comma-separated format + * Supports: + * - Comma-separated values: "app/page.tsx,app/about/page.tsx" + * + * @param input - String input to parse + * @returns Array of path patterns + */ +export declare function parseBuildPathsInput(input: string): string[]; +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/resolve-build-paths.js b/e-commerce/node_modules/next/dist/lib/resolve-build-paths.js new file mode 100644 index 0000000000000000000000000000000000000000..3ef54cfb8b468159d91f57f474daab16d10fd5b5 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/resolve-build-paths.js @@ -0,0 +1,178 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + parseBuildPathsInput: null, + resolveBuildPaths: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + parseBuildPathsInput: function() { + return parseBuildPathsInput; + }, + resolveBuildPaths: function() { + return resolveBuildPaths; + } +}); +const _util = require("util"); +const _glob = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/glob")); +const _log = /*#__PURE__*/ _interop_require_wildcard(require("../build/output/log")); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +const _fs = /*#__PURE__*/ _interop_require_default(require("fs")); +const _iserror = /*#__PURE__*/ _interop_require_default(require("./is-error")); +const _findpagefile = require("../server/lib/find-page-file"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +const glob = (0, _util.promisify)(_glob.default); +/** + * Escapes Next.js dynamic route bracket expressions so glob treats them as + * literal directory names rather than character classes. + * + * e.g., "app/blog/[slug]/** /page.tsx" → "app/blog/\[slug\]/** /page.tsx" + */ function escapeBrackets(pattern) { + // Match Next.js dynamic route patterns: [name], [...name], [[...name]] + return pattern.replace(/\[\[?\.\.\.[^\]]+\]?\]|\[[^\]]+\]/g, (match)=>match.replace(/\[/g, '\\[').replace(/\]/g, '\\]')); +} +async function resolveBuildPaths(patterns, projectDir, pageExtensions) { + const appPaths = new Set(); + const pagePaths = new Set(); + const validFileMatcher = (0, _findpagefile.createValidFileMatcher)(pageExtensions, undefined); + // Detect whether the project keeps its routes under `src/` so we can accept + // patterns written with or without that prefix (e.g. both `app/foo/page.tsx` + // and `src/app/foo/page.tsx`). + const useSrcApp = _fs.default.existsSync(_path.default.join(projectDir, 'src', 'app')); + const useSrcPages = _fs.default.existsSync(_path.default.join(projectDir, 'src', 'pages')); + const includePatterns = []; + const excludePatterns = []; + for (const pattern of patterns){ + const trimmed = pattern.trim(); + if (!trimmed) continue; + if (trimmed.startsWith('!')) { + excludePatterns.push(escapeBrackets(addSrcPrefixIfNeeded(trimmed.slice(1), useSrcApp, useSrcPages))); + } else { + includePatterns.push(escapeBrackets(addSrcPrefixIfNeeded(trimmed, useSrcApp, useSrcPages))); + } + } + // Default to matching all files when only negation patterns are provided. + if (includePatterns.length === 0 && excludePatterns.length > 0) { + includePatterns.push('**'); + } + // Combine patterns using brace expansion: {pattern1,pattern2} + const combinedPattern = includePatterns.length === 1 ? includePatterns[0] : `{${includePatterns.join(',')}}`; + try { + const matches = await glob(combinedPattern, { + cwd: projectDir, + ignore: excludePatterns + }); + if (matches.length === 0) { + _log.warn(`Pattern "${patterns.join(',')}" did not match any files`); + } + for (const file of matches){ + if (!_fs.default.statSync(_path.default.join(projectDir, file)).isDirectory()) { + categorizeAndAddPath(file, appPaths, pagePaths, validFileMatcher); + } + } + } catch (error) { + throw new Error(`Failed to resolve pattern "${patterns.join(',')}": ${(0, _iserror.default)(error) ? error.message : String(error)}`); + } + return { + appPaths: Array.from(appPaths).sort(), + pagePaths: Array.from(pagePaths).sort() + }; +} +/** + * When the project keeps its `app/` or `pages/` directory under `src/`, prepend + * `src/` to bare patterns so the glob actually matches files on disk. Patterns + * that already include the `src/` prefix are returned unchanged. + */ function addSrcPrefixIfNeeded(pattern, useSrcApp, useSrcPages) { + const normalized = pattern.replace(/\\/g, '/'); + if (useSrcApp && /^app\//.test(normalized)) { + return 'src/' + normalized; + } + if (useSrcPages && /^pages\//.test(normalized)) { + return 'src/' + normalized; + } + return pattern; +} +/** + * Categorizes a file path to either app or pages router based on its prefix. + * For app router, only route-defining files are included. + * + * Accepts both top-level (`app/...`, `pages/...`) and src-prefixed + * (`src/app/...`, `src/pages/...`) project structures. + * + * Examples: + * - "app/page.tsx" → appPaths.add("/page.tsx") + * - "src/app/page.tsx" → appPaths.add("/page.tsx") + * - "app/layout.tsx" → skipped (not a route file) + * - "pages/index.tsx" → pagePaths.add("/index.tsx") + */ function categorizeAndAddPath(filePath, appPaths, pagePaths, validFileMatcher) { + let normalized = filePath.replace(/\\/g, '/'); + if (normalized.startsWith('src/')) { + normalized = normalized.slice(4); + } + if (normalized.startsWith('app/')) { + const appRelativePath = '/' + normalized.slice(4); + if (validFileMatcher.isAppRouterPage(appRelativePath)) { + appPaths.add(appRelativePath); + } + } else if (normalized.startsWith('pages/')) { + pagePaths.add('/' + normalized.slice(6)); + } +} +function parseBuildPathsInput(input) { + // Comma-separated values + return input.split(',').map((p)=>p.trim()).filter((p)=>p.length > 0); +} + +//# sourceMappingURL=resolve-build-paths.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/resolve-build-paths.js.map b/e-commerce/node_modules/next/dist/lib/resolve-build-paths.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7b93074f52246c76f0ddc38335e6f70f60362cb4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/resolve-build-paths.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/resolve-build-paths.ts"],"sourcesContent":["import { promisify } from 'util'\nimport globOriginal from 'next/dist/compiled/glob'\nimport * as Log from '../build/output/log'\nimport path from 'path'\nimport fs from 'fs'\nimport isError from './is-error'\nimport { createValidFileMatcher } from '../server/lib/find-page-file'\nimport type { PageExtensions } from '../build/page-extensions-type'\n\nconst glob = promisify(globOriginal)\n\ninterface ResolvedBuildPaths {\n appPaths: string[]\n pagePaths: string[]\n}\n\n/**\n * Escapes Next.js dynamic route bracket expressions so glob treats them as\n * literal directory names rather than character classes.\n *\n * e.g., \"app/blog/[slug]/** /page.tsx\" → \"app/blog/\\[slug\\]/** /page.tsx\"\n */\nfunction escapeBrackets(pattern: string): string {\n // Match Next.js dynamic route patterns: [name], [...name], [[...name]]\n return pattern.replace(/\\[\\[?\\.\\.\\.[^\\]]+\\]?\\]|\\[[^\\]]+\\]/g, (match) =>\n match.replace(/\\[/g, '\\\\[').replace(/\\]/g, '\\\\]')\n )\n}\n\n/**\n * Resolves glob patterns and explicit paths to actual file paths.\n * Categorizes them into App Router and Pages Router paths.\n *\n * Supports negation patterns prefixed with \"!\" to exclude paths.\n * e.g., \"app/**,!app/[lang]/page.js\" includes all App Router paths except\n * app/[lang]/page.js\n */\nexport async function resolveBuildPaths(\n patterns: string[],\n projectDir: string,\n pageExtensions: PageExtensions\n): Promise {\n const appPaths: Set = new Set()\n const pagePaths: Set = new Set()\n const validFileMatcher = createValidFileMatcher(pageExtensions, undefined)\n\n // Detect whether the project keeps its routes under `src/` so we can accept\n // patterns written with or without that prefix (e.g. both `app/foo/page.tsx`\n // and `src/app/foo/page.tsx`).\n const useSrcApp = fs.existsSync(path.join(projectDir, 'src', 'app'))\n const useSrcPages = fs.existsSync(path.join(projectDir, 'src', 'pages'))\n\n const includePatterns: string[] = []\n const excludePatterns: string[] = []\n\n for (const pattern of patterns) {\n const trimmed = pattern.trim()\n if (!trimmed) continue\n\n if (trimmed.startsWith('!')) {\n excludePatterns.push(\n escapeBrackets(\n addSrcPrefixIfNeeded(trimmed.slice(1), useSrcApp, useSrcPages)\n )\n )\n } else {\n includePatterns.push(\n escapeBrackets(addSrcPrefixIfNeeded(trimmed, useSrcApp, useSrcPages))\n )\n }\n }\n\n // Default to matching all files when only negation patterns are provided.\n if (includePatterns.length === 0 && excludePatterns.length > 0) {\n includePatterns.push('**')\n }\n\n // Combine patterns using brace expansion: {pattern1,pattern2}\n const combinedPattern =\n includePatterns.length === 1\n ? includePatterns[0]\n : `{${includePatterns.join(',')}}`\n\n try {\n const matches = (await glob(combinedPattern, {\n cwd: projectDir,\n ignore: excludePatterns,\n })) as string[]\n\n if (matches.length === 0) {\n Log.warn(`Pattern \"${patterns.join(',')}\" did not match any files`)\n }\n\n for (const file of matches) {\n if (!fs.statSync(path.join(projectDir, file)).isDirectory()) {\n categorizeAndAddPath(file, appPaths, pagePaths, validFileMatcher)\n }\n }\n } catch (error) {\n throw new Error(\n `Failed to resolve pattern \"${patterns.join(',')}\": ${\n isError(error) ? error.message : String(error)\n }`\n )\n }\n\n return {\n appPaths: Array.from(appPaths).sort(),\n pagePaths: Array.from(pagePaths).sort(),\n }\n}\n\n/**\n * When the project keeps its `app/` or `pages/` directory under `src/`, prepend\n * `src/` to bare patterns so the glob actually matches files on disk. Patterns\n * that already include the `src/` prefix are returned unchanged.\n */\nfunction addSrcPrefixIfNeeded(\n pattern: string,\n useSrcApp: boolean,\n useSrcPages: boolean\n): string {\n const normalized = pattern.replace(/\\\\/g, '/')\n if (useSrcApp && /^app\\//.test(normalized)) {\n return 'src/' + normalized\n }\n if (useSrcPages && /^pages\\//.test(normalized)) {\n return 'src/' + normalized\n }\n return pattern\n}\n\n/**\n * Categorizes a file path to either app or pages router based on its prefix.\n * For app router, only route-defining files are included.\n *\n * Accepts both top-level (`app/...`, `pages/...`) and src-prefixed\n * (`src/app/...`, `src/pages/...`) project structures.\n *\n * Examples:\n * - \"app/page.tsx\" → appPaths.add(\"/page.tsx\")\n * - \"src/app/page.tsx\" → appPaths.add(\"/page.tsx\")\n * - \"app/layout.tsx\" → skipped (not a route file)\n * - \"pages/index.tsx\" → pagePaths.add(\"/index.tsx\")\n */\nfunction categorizeAndAddPath(\n filePath: string,\n appPaths: Set,\n pagePaths: Set,\n validFileMatcher: ReturnType\n): void {\n let normalized = filePath.replace(/\\\\/g, '/')\n\n if (normalized.startsWith('src/')) {\n normalized = normalized.slice(4)\n }\n\n if (normalized.startsWith('app/')) {\n const appRelativePath = '/' + normalized.slice(4)\n if (validFileMatcher.isAppRouterPage(appRelativePath)) {\n appPaths.add(appRelativePath)\n }\n } else if (normalized.startsWith('pages/')) {\n pagePaths.add('/' + normalized.slice(6))\n }\n}\n\n/**\n * Parse build paths from comma-separated format\n * Supports:\n * - Comma-separated values: \"app/page.tsx,app/about/page.tsx\"\n *\n * @param input - String input to parse\n * @returns Array of path patterns\n */\nexport function parseBuildPathsInput(input: string): string[] {\n // Comma-separated values\n return input\n .split(',')\n .map((p) => p.trim())\n .filter((p) => p.length > 0)\n}\n"],"names":["parseBuildPathsInput","resolveBuildPaths","glob","promisify","globOriginal","escapeBrackets","pattern","replace","match","patterns","projectDir","pageExtensions","appPaths","Set","pagePaths","validFileMatcher","createValidFileMatcher","undefined","useSrcApp","fs","existsSync","path","join","useSrcPages","includePatterns","excludePatterns","trimmed","trim","startsWith","push","addSrcPrefixIfNeeded","slice","length","combinedPattern","matches","cwd","ignore","Log","warn","file","statSync","isDirectory","categorizeAndAddPath","error","Error","isError","message","String","Array","from","sort","normalized","test","filePath","appRelativePath","isAppRouterPage","add","input","split","map","p","filter"],"mappings":";;;;;;;;;;;;;;;IA+KgBA,oBAAoB;eAApBA;;IA1IMC,iBAAiB;eAAjBA;;;sBArCI;6DACD;6DACJ;6DACJ;2DACF;gEACK;8BACmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGvC,MAAMC,OAAOC,IAAAA,eAAS,EAACC,aAAY;AAOnC;;;;;CAKC,GACD,SAASC,eAAeC,OAAe;IACrC,uEAAuE;IACvE,OAAOA,QAAQC,OAAO,CAAC,sCAAsC,CAACC,QAC5DA,MAAMD,OAAO,CAAC,OAAO,OAAOA,OAAO,CAAC,OAAO;AAE/C;AAUO,eAAeN,kBACpBQ,QAAkB,EAClBC,UAAkB,EAClBC,cAA8B;IAE9B,MAAMC,WAAwB,IAAIC;IAClC,MAAMC,YAAyB,IAAID;IACnC,MAAME,mBAAmBC,IAAAA,oCAAsB,EAACL,gBAAgBM;IAEhE,4EAA4E;IAC5E,6EAA6E;IAC7E,+BAA+B;IAC/B,MAAMC,YAAYC,WAAE,CAACC,UAAU,CAACC,aAAI,CAACC,IAAI,CAACZ,YAAY,OAAO;IAC7D,MAAMa,cAAcJ,WAAE,CAACC,UAAU,CAACC,aAAI,CAACC,IAAI,CAACZ,YAAY,OAAO;IAE/D,MAAMc,kBAA4B,EAAE;IACpC,MAAMC,kBAA4B,EAAE;IAEpC,KAAK,MAAMnB,WAAWG,SAAU;QAC9B,MAAMi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;IACvC;AACF;AAEA;;;;CAIC,GACD,SAASpB,qBACPxB,OAAe,EACfY,SAAkB,EAClBK,WAAoB;IAEpB,MAAM4B,aAAa7C,QAAQC,OAAO,CAAC,OAAO;IAC1C,IAAIW,aAAa,SAASkC,IAAI,CAACD,aAAa;QAC1C,OAAO,SAASA;IAClB;IACA,IAAI5B,eAAe,WAAW6B,IAAI,CAACD,aAAa;QAC9C,OAAO,SAASA;IAClB;IACA,OAAO7C;AACT;AAEA;;;;;;;;;;;;CAYC,GACD,SAASoC,qBACPW,QAAgB,EAChBzC,QAAqB,EACrBE,SAAsB,EACtBC,gBAA2D;IAE3D,IAAIoC,aAAaE,SAAS9C,OAAO,CAAC,OAAO;IAEzC,IAAI4C,WAAWvB,UAAU,CAAC,SAAS;QACjCuB,aAAaA,WAAWpB,KAAK,CAAC;IAChC;IAEA,IAAIoB,WAAWvB,UAAU,CAAC,SAAS;QACjC,MAAM0B,kBAAkB,MAAMH,WAAWpB,KAAK,CAAC;QAC/C,IAAIhB,iBAAiBwC,eAAe,CAACD,kBAAkB;YACrD1C,SAAS4C,GAAG,CAACF;QACf;IACF,OAAO,IAAIH,WAAWvB,UAAU,CAAC,WAAW;QAC1Cd,UAAU0C,GAAG,CAAC,MAAML,WAAWpB,KAAK,CAAC;IACvC;AACF;AAUO,SAAS/B,qBAAqByD,KAAa;IAChD,yBAAyB;IACzB,OAAOA,MACJC,KAAK,CAAC,KACNC,GAAG,CAAC,CAACC,IAAMA,EAAEjC,IAAI,IACjBkC,MAAM,CAAC,CAACD,IAAMA,EAAE5B,MAAM,GAAG;AAC9B","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/resolve-from.d.ts b/e-commerce/node_modules/next/dist/lib/resolve-from.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9d30b0b051a72e7e3efc9ef2363ac14410516105 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/resolve-from.d.ts @@ -0,0 +1 @@ +export declare const resolveFrom: (fromDirectory: string, moduleId: string, silent?: boolean) => any; diff --git a/e-commerce/node_modules/next/dist/lib/resolve-from.js b/e-commerce/node_modules/next/dist/lib/resolve-from.js new file mode 100644 index 0000000000000000000000000000000000000000..606a4ef5802a790af0ec462528686d197336f526 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/resolve-from.js @@ -0,0 +1,57 @@ +// source: https://github.com/sindresorhus/resolve-from +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "resolveFrom", { + enumerable: true, + get: function() { + return resolveFrom; + } +}); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +const _iserror = /*#__PURE__*/ _interop_require_default(require("./is-error")); +const _realpath = require("./realpath"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +const Module = require('module'); +const resolveFrom = (fromDirectory, moduleId, silent)=>{ + if (typeof fromDirectory !== 'string') { + throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``); + } + if (typeof moduleId !== 'string') { + throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``); + } + try { + fromDirectory = (0, _realpath.realpathSync)(fromDirectory); + } catch (error) { + if ((0, _iserror.default)(error) && error.code === 'ENOENT') { + fromDirectory = _path.default.resolve(fromDirectory); + } else if (silent) { + return; + } else { + throw error; + } + } + const fromFile = _path.default.join(fromDirectory, 'noop.js'); + const resolveFileName = ()=>// @ts-expect-error + Module._resolveFilename(moduleId, { + id: fromFile, + filename: fromFile, + paths: // @ts-expect-error + Module._nodeModulePaths(fromDirectory) + }); + if (silent) { + try { + return resolveFileName(); + } catch (error) { + return; + } + } + return resolveFileName(); +}; + +//# sourceMappingURL=resolve-from.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/resolve-from.js.map b/e-commerce/node_modules/next/dist/lib/resolve-from.js.map new file mode 100644 index 0000000000000000000000000000000000000000..8c7ab43948a2cd82c40c654ab8506c9aa6908878 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/resolve-from.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/resolve-from.ts"],"sourcesContent":["// source: https://github.com/sindresorhus/resolve-from\nimport path from 'path'\nimport isError from './is-error'\nimport { realpathSync } from './realpath'\n\nconst Module = require('module') as typeof import('module')\n\nexport const resolveFrom = (\n fromDirectory: string,\n moduleId: string,\n silent?: boolean\n) => {\n if (typeof fromDirectory !== 'string') {\n throw new TypeError(\n `Expected \\`fromDir\\` to be of type \\`string\\`, got \\`${typeof fromDirectory}\\``\n )\n }\n\n if (typeof moduleId !== 'string') {\n throw new TypeError(\n `Expected \\`moduleId\\` to be of type \\`string\\`, got \\`${typeof moduleId}\\``\n )\n }\n\n try {\n fromDirectory = realpathSync(fromDirectory)\n } catch (error: unknown) {\n if (isError(error) && error.code === 'ENOENT') {\n fromDirectory = path.resolve(fromDirectory)\n } else if (silent) {\n return\n } else {\n throw error\n }\n }\n\n const fromFile = path.join(fromDirectory, 'noop.js')\n\n const resolveFileName = () =>\n // @ts-expect-error\n Module._resolveFilename(moduleId, {\n id: fromFile,\n filename: fromFile,\n paths:\n // @ts-expect-error\n Module._nodeModulePaths(fromDirectory),\n })\n\n if (silent) {\n try {\n return resolveFileName()\n } catch (error) {\n return\n }\n }\n\n return resolveFileName()\n}\n"],"names":["resolveFrom","Module","require","fromDirectory","moduleId","silent","TypeError","realpathSync","error","isError","code","path","resolve","fromFile","join","resolveFileName","_resolveFilename","id","filename","paths","_nodeModulePaths"],"mappings":"AAAA,uDAAuD;;;;;+BAO1CA;;;eAAAA;;;6DANI;gEACG;0BACS;;;;;;AAE7B,MAAMC,SAASC,QAAQ;AAEhB,MAAMF,cAAc,CACzBG,eACAC,UACAC;IAEA,IAAI,OAAOF,kBAAkB,UAAU;QACrC,MAAM,IAAIG,UACR,CAAC,qDAAqD,EAAE,OAAOH,cAAc,EAAE,CAAC;IAEpF;IAEA,IAAI,OAAOC,aAAa,UAAU;QAChC,MAAM,IAAIE,UACR,CAAC,sDAAsD,EAAE,OAAOF,SAAS,EAAE,CAAC;IAEhF;IAEA,IAAI;QACFD,gBAAgBI,IAAAA,sBAAY,EAACJ;IAC/B,EAAE,OAAOK,OAAgB;QACvB,IAAIC,IAAAA,gBAAO,EAACD,UAAUA,MAAME,IAAI,KAAK,UAAU;YAC7CP,gBAAgBQ,aAAI,CAACC,OAAO,CAACT;QAC/B,OAAO,IAAIE,QAAQ;YACjB;QACF,OAAO;YACL,MAAMG;QACR;IACF;IAEA,MAAMK,WAAWF,aAAI,CAACG,IAAI,CAACX,eAAe;IAE1C,MAAMY,kBAAkB,IACtB,mBAAmB;QACnBd,OAAOe,gBAAgB,CAACZ,UAAU;YAChCa,IAAIJ;YACJK,UAAUL;YACVM,OACE,mBAAmB;YACnBlB,OAAOmB,gBAAgB,CAACjB;QAC5B;IAEF,IAAIE,QAAQ;QACV,IAAI;YACF,OAAOU;QACT,EAAE,OAAOP,OAAO;YACd;QACF;IACF;IAEA,OAAOO;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/route-pattern-normalizer.d.ts b/e-commerce/node_modules/next/dist/lib/route-pattern-normalizer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb7e161b4b40c3a8064d79b035c90396b4f3d1cb --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/route-pattern-normalizer.d.ts @@ -0,0 +1,50 @@ +import type { Token } from 'next/dist/compiled/path-to-regexp'; +/** + * Route pattern normalization utilities for path-to-regexp compatibility. + * + * path-to-regexp 6.3.0+ introduced stricter validation that rejects certain + * patterns commonly used in Next.js interception routes. This module provides + * normalization functions to make Next.js route patterns compatible with the + * updated library while preserving all functionality. + */ +/** + * Internal separator used to normalize adjacent parameter patterns. + * This unique marker is inserted between adjacent parameters and stripped out + * during parameter extraction to avoid conflicts with real URL content. + */ +export declare const PARAM_SEPARATOR = "_NEXTSEP_"; +/** + * Detects if a route pattern needs normalization for path-to-regexp compatibility. + */ +export declare function hasAdjacentParameterIssues(route: string): boolean; +/** + * Normalizes route patterns that have adjacent parameters without text between them. + * Inserts a unique separator that can be safely stripped out later. + */ +export declare function normalizeAdjacentParameters(route: string): string; +/** + * Normalizes tokens that have repeating modifiers (* or +) but empty prefix and suffix. + * + * path-to-regexp 6.3.0+ introduced validation that throws: + * "Can not repeat without prefix/suffix" + * + * This occurs when a token has modifier: '*' or '+' with both prefix: '' and suffix: '' + */ +export declare function normalizeTokensForRegexp(tokens: Token[]): Token[]; +/** + * Strips normalization separators from compiled pathname. + * This removes separators that were inserted by normalizeAdjacentParameters + * to satisfy path-to-regexp validation. + * + * Only removes separators in the specific contexts where they were inserted: + * - After interception route markers: (.)_NEXTSEP_ -> (.) + * + * This targeted approach ensures we don't accidentally remove the separator + * from legitimate user content. + */ +export declare function stripNormalizedSeparators(pathname: string): string; +/** + * Strips normalization separators from extracted route parameters. + * Used by both server and client code to clean up parameters after route matching. + */ +export declare function stripParameterSeparators(params: Record): Record; diff --git a/e-commerce/node_modules/next/dist/lib/route-pattern-normalizer.js b/e-commerce/node_modules/next/dist/lib/route-pattern-normalizer.js new file mode 100644 index 0000000000000000000000000000000000000000..4c5fa07fa3c28113cbe62cc16ceaae9d01181f0c --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/route-pattern-normalizer.js @@ -0,0 +1,107 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + PARAM_SEPARATOR: null, + hasAdjacentParameterIssues: null, + normalizeAdjacentParameters: null, + normalizeTokensForRegexp: null, + stripNormalizedSeparators: null, + stripParameterSeparators: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + PARAM_SEPARATOR: function() { + return PARAM_SEPARATOR; + }, + hasAdjacentParameterIssues: function() { + return hasAdjacentParameterIssues; + }, + normalizeAdjacentParameters: function() { + return normalizeAdjacentParameters; + }, + normalizeTokensForRegexp: function() { + return normalizeTokensForRegexp; + }, + stripNormalizedSeparators: function() { + return stripNormalizedSeparators; + }, + stripParameterSeparators: function() { + return stripParameterSeparators; + } +}); +const PARAM_SEPARATOR = '_NEXTSEP_'; +function hasAdjacentParameterIssues(route) { + if (typeof route !== 'string') return false; + // Check for interception route markers followed immediately by parameters + // Pattern: /(.):param, /(..):param, /(...):param, /(.)(.):param etc. + // These patterns cause "Must have text between two parameters" errors + if (/\/\(\.{1,3}\):[^/\s]+/.test(route)) { + return true; + } + // Check for basic adjacent parameters without separators + // Pattern: :param1:param2 (but not :param* or other URL patterns) + if (/:[a-zA-Z_][a-zA-Z0-9_]*:[a-zA-Z_][a-zA-Z0-9_]*/.test(route)) { + return true; + } + return false; +} +function normalizeAdjacentParameters(route) { + let normalized = route; + // Handle interception route patterns: (.):param -> (.)_NEXTSEP_:param + normalized = normalized.replace(/(\([^)]*\)):([^/\s]+)/g, `$1${PARAM_SEPARATOR}:$2`); + // Handle other adjacent parameter patterns: :param1:param2 -> :param1_NEXTSEP_:param2 + normalized = normalized.replace(/:([^:/\s)]+)(?=:)/g, `:$1${PARAM_SEPARATOR}`); + return normalized; +} +function normalizeTokensForRegexp(tokens) { + return tokens.map((token)=>{ + // Token union type: Token = string | TokenObject + // Literal path segments are strings, parameters/wildcards are objects + if (typeof token === 'object' && token !== null && // Not all token objects have 'modifier' property (e.g., simple text tokens) + 'modifier' in token && // Only repeating modifiers (* or +) cause the validation error + // Other modifiers like '?' (optional) are fine + (token.modifier === '*' || token.modifier === '+') && // Token objects can have different shapes depending on route pattern + 'prefix' in token && 'suffix' in token && // Both prefix and suffix must be empty strings + // This is what causes the validation error in path-to-regexp + token.prefix === '' && token.suffix === '') { + // Add minimal prefix to satisfy path-to-regexp validation + // We use '/' as it's the most common path delimiter and won't break route matching + // The prefix gets used in regex generation but doesn't affect parameter extraction + return { + ...token, + prefix: '/' + }; + } + return token; + }); +} +function stripNormalizedSeparators(pathname) { + // Remove separator after interception route markers + // Pattern: (.)_NEXTSEP_ -> (.), (..)_NEXTSEP_ -> (..), etc. + // The separator appears after the closing paren of interception markers + return pathname.replace(new RegExp(`\\)${PARAM_SEPARATOR}`, 'g'), ')'); +} +function stripParameterSeparators(params) { + const cleaned = {}; + for (const [key, value] of Object.entries(params)){ + if (typeof value === 'string') { + // Remove the separator if it appears at the start of parameter values + cleaned[key] = value.replace(new RegExp(`^${PARAM_SEPARATOR}`), ''); + } else if (Array.isArray(value)) { + // Handle array parameters (from repeated route segments) + cleaned[key] = value.map((item)=>typeof item === 'string' ? item.replace(new RegExp(`^${PARAM_SEPARATOR}`), '') : item); + } else { + cleaned[key] = value; + } + } + return cleaned; +} + +//# sourceMappingURL=route-pattern-normalizer.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/route-pattern-normalizer.js.map b/e-commerce/node_modules/next/dist/lib/route-pattern-normalizer.js.map new file mode 100644 index 0000000000000000000000000000000000000000..9c315eab16f3e36716ecf1f0d29429a9e7e0f7a9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/route-pattern-normalizer.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/route-pattern-normalizer.ts"],"sourcesContent":["import type { Token } from 'next/dist/compiled/path-to-regexp'\n\n/**\n * Route pattern normalization utilities for path-to-regexp compatibility.\n *\n * path-to-regexp 6.3.0+ introduced stricter validation that rejects certain\n * patterns commonly used in Next.js interception routes. This module provides\n * normalization functions to make Next.js route patterns compatible with the\n * updated library while preserving all functionality.\n */\n\n/**\n * Internal separator used to normalize adjacent parameter patterns.\n * This unique marker is inserted between adjacent parameters and stripped out\n * during parameter extraction to avoid conflicts with real URL content.\n */\nexport const PARAM_SEPARATOR = '_NEXTSEP_'\n\n/**\n * Detects if a route pattern needs normalization for path-to-regexp compatibility.\n */\nexport function hasAdjacentParameterIssues(route: string): boolean {\n if (typeof route !== 'string') return false\n\n // Check for interception route markers followed immediately by parameters\n // Pattern: /(.):param, /(..):param, /(...):param, /(.)(.):param etc.\n // These patterns cause \"Must have text between two parameters\" errors\n if (/\\/\\(\\.{1,3}\\):[^/\\s]+/.test(route)) {\n return true\n }\n\n // Check for basic adjacent parameters without separators\n // Pattern: :param1:param2 (but not :param* or other URL patterns)\n if (/:[a-zA-Z_][a-zA-Z0-9_]*:[a-zA-Z_][a-zA-Z0-9_]*/.test(route)) {\n return true\n }\n\n return false\n}\n\n/**\n * Normalizes route patterns that have adjacent parameters without text between them.\n * Inserts a unique separator that can be safely stripped out later.\n */\nexport function normalizeAdjacentParameters(route: string): string {\n let normalized = route\n\n // Handle interception route patterns: (.):param -> (.)_NEXTSEP_:param\n normalized = normalized.replace(\n /(\\([^)]*\\)):([^/\\s]+)/g,\n `$1${PARAM_SEPARATOR}:$2`\n )\n\n // Handle other adjacent parameter patterns: :param1:param2 -> :param1_NEXTSEP_:param2\n normalized = normalized.replace(/:([^:/\\s)]+)(?=:)/g, `:$1${PARAM_SEPARATOR}`)\n\n return normalized\n}\n\n/**\n * Normalizes tokens that have repeating modifiers (* or +) but empty prefix and suffix.\n *\n * path-to-regexp 6.3.0+ introduced validation that throws:\n * \"Can not repeat without prefix/suffix\"\n *\n * This occurs when a token has modifier: '*' or '+' with both prefix: '' and suffix: ''\n */\nexport function normalizeTokensForRegexp(tokens: Token[]): Token[] {\n return tokens.map((token) => {\n // Token union type: Token = string | TokenObject\n // Literal path segments are strings, parameters/wildcards are objects\n if (\n typeof token === 'object' &&\n token !== null &&\n // Not all token objects have 'modifier' property (e.g., simple text tokens)\n 'modifier' in token &&\n // Only repeating modifiers (* or +) cause the validation error\n // Other modifiers like '?' (optional) are fine\n (token.modifier === '*' || token.modifier === '+') &&\n // Token objects can have different shapes depending on route pattern\n 'prefix' in token &&\n 'suffix' in token &&\n // Both prefix and suffix must be empty strings\n // This is what causes the validation error in path-to-regexp\n token.prefix === '' &&\n token.suffix === ''\n ) {\n // Add minimal prefix to satisfy path-to-regexp validation\n // We use '/' as it's the most common path delimiter and won't break route matching\n // The prefix gets used in regex generation but doesn't affect parameter extraction\n return {\n ...token,\n prefix: '/',\n }\n }\n return token\n })\n}\n\n/**\n * Strips normalization separators from compiled pathname.\n * This removes separators that were inserted by normalizeAdjacentParameters\n * to satisfy path-to-regexp validation.\n *\n * Only removes separators in the specific contexts where they were inserted:\n * - After interception route markers: (.)_NEXTSEP_ -> (.)\n *\n * This targeted approach ensures we don't accidentally remove the separator\n * from legitimate user content.\n */\nexport function stripNormalizedSeparators(pathname: string): string {\n // Remove separator after interception route markers\n // Pattern: (.)_NEXTSEP_ -> (.), (..)_NEXTSEP_ -> (..), etc.\n // The separator appears after the closing paren of interception markers\n return pathname.replace(new RegExp(`\\\\)${PARAM_SEPARATOR}`, 'g'), ')')\n}\n\n/**\n * Strips normalization separators from extracted route parameters.\n * Used by both server and client code to clean up parameters after route matching.\n */\nexport function stripParameterSeparators(\n params: Record\n): Record {\n const cleaned: Record = {}\n\n for (const [key, value] of Object.entries(params)) {\n if (typeof value === 'string') {\n // Remove the separator if it appears at the start of parameter values\n cleaned[key] = value.replace(new RegExp(`^${PARAM_SEPARATOR}`), '')\n } else if (Array.isArray(value)) {\n // Handle array parameters (from repeated route segments)\n cleaned[key] = value.map((item) =>\n typeof item === 'string'\n ? item.replace(new RegExp(`^${PARAM_SEPARATOR}`), '')\n : item\n )\n } else {\n cleaned[key] = value\n }\n }\n\n return cleaned\n}\n"],"names":["PARAM_SEPARATOR","hasAdjacentParameterIssues","normalizeAdjacentParameters","normalizeTokensForRegexp","stripNormalizedSeparators","stripParameterSeparators","route","test","normalized","replace","tokens","map","token","modifier","prefix","suffix","pathname","RegExp","params","cleaned","key","value","Object","entries","Array","isArray","item"],"mappings":";;;;;;;;;;;;;;;;;;;IAgBaA,eAAe;eAAfA;;IAKGC,0BAA0B;eAA1BA;;IAuBAC,2BAA2B;eAA3BA;;IAuBAC,wBAAwB;eAAxBA;;IA2CAC,yBAAyB;eAAzBA;;IAWAC,wBAAwB;eAAxBA;;;AAzGT,MAAML,kBAAkB;AAK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C,UAA+B,CAAC;IAEtC,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACL,QAAS;QACjD,IAAI,OAAOG,UAAU,UAAU;YAC7B,sEAAsE;YACtEF,OAAO,CAACC,IAAI,GAAGC,MAAMZ,OAAO,CAAC,IAAIQ,OAAO,CAAC,CAAC,EAAEjB,iBAAiB,GAAG;QAClE,OAAO,IAAIwB,MAAMC,OAAO,CAACJ,QAAQ;YAC/B,yDAAyD;YACzDF,OAAO,CAACC,IAAI,GAAGC,MAAMV,GAAG,CAAC,CAACe,OACxB,OAAOA,SAAS,WACZA,KAAKjB,OAAO,CAAC,IAAIQ,OAAO,CAAC,CAAC,EAAEjB,iBAAiB,GAAG,MAChD0B;QAER,OAAO;YACLP,OAAO,CAACC,IAAI,GAAGC;QACjB;IACF;IAEA,OAAOF;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/scheduler.d.ts b/e-commerce/node_modules/next/dist/lib/scheduler.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c924a02ea9bc6cde838801ba06864bdf1cd4a644 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/scheduler.d.ts @@ -0,0 +1,32 @@ +export type ScheduledFn = () => T | PromiseLike; +export type SchedulerFn = (cb: ScheduledFn) => void; +/** + * Schedules a function to be called on the next tick after the other promises + * have been resolved. + * + * @param cb the function to schedule + */ +export declare const scheduleOnNextTick: (cb: ScheduledFn) => void; +/** + * Schedules a function to be called using `setImmediate` or `setTimeout` if + * `setImmediate` is not available (like in the Edge runtime). + * + * @param cb the function to schedule + */ +export declare const scheduleImmediate: (cb: ScheduledFn) => void; +/** + * returns a promise than resolves in a future task. There is no guarantee that the task it resolves in + * will be the next task but if you await it you can at least be sure that the current task is over and + * most usefully that the entire microtask queue of the current task has been emptied. + */ +export declare function atLeastOneTask(): Promise; +/** + * This utility function is extracted to make it easier to find places where we are doing + * specific timing tricks to try to schedule work after React has rendered. This is especially + * important at the moment because Next.js uses the edge builds of React which use setTimeout to + * schedule work when you might expect that something like setImmediate would do the trick. + * + * Long term we should switch to the node versions of React rendering when possible and then + * update this to use setImmediate rather than setTimeout + */ +export declare function waitAtLeastOneReactRenderTask(): Promise; diff --git a/e-commerce/node_modules/next/dist/lib/scheduler.js b/e-commerce/node_modules/next/dist/lib/scheduler.js new file mode 100644 index 0000000000000000000000000000000000000000..6a9be0c31f9a92406f6841bccce85db08422668c --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/scheduler.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + atLeastOneTask: null, + scheduleImmediate: null, + scheduleOnNextTick: null, + waitAtLeastOneReactRenderTask: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + atLeastOneTask: function() { + return atLeastOneTask; + }, + scheduleImmediate: function() { + return scheduleImmediate; + }, + scheduleOnNextTick: function() { + return scheduleOnNextTick; + }, + waitAtLeastOneReactRenderTask: function() { + return waitAtLeastOneReactRenderTask; + } +}); +const scheduleOnNextTick = (cb)=>{ + // We use Promise.resolve().then() here so that the operation is scheduled at + // the end of the promise job queue, we then add it to the next process tick + // to ensure it's evaluated afterwards. + // + // This was inspired by the implementation of the DataLoader interface: https://github.com/graphql/dataloader/blob/d336bd15282664e0be4b4a657cb796f09bafbc6b/src/index.js#L213-L255 + // + Promise.resolve().then(()=>{ + if (process.env.NEXT_RUNTIME === 'edge') { + setTimeout(cb, 0); + } else { + process.nextTick(cb); + } + }); +}; +const scheduleImmediate = (cb)=>{ + if (process.env.NEXT_RUNTIME === 'edge') { + setTimeout(cb, 0); + } else { + setImmediate(cb); + } +}; +function atLeastOneTask() { + return new Promise((resolve)=>scheduleImmediate(resolve)); +} +function waitAtLeastOneReactRenderTask() { + if (process.env.NEXT_RUNTIME === 'edge') { + return new Promise((r)=>setTimeout(r, 0)); + } else { + return new Promise((r)=>setImmediate(r)); + } +} + +//# sourceMappingURL=scheduler.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/scheduler.js.map b/e-commerce/node_modules/next/dist/lib/scheduler.js.map new file mode 100644 index 0000000000000000000000000000000000000000..5404d57c843c24e7ec5ceddaf6004b532bcfbf0d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/scheduler.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/scheduler.ts"],"sourcesContent":["export type ScheduledFn = () => T | PromiseLike\nexport type SchedulerFn = (cb: ScheduledFn) => void\n\n/**\n * Schedules a function to be called on the next tick after the other promises\n * have been resolved.\n *\n * @param cb the function to schedule\n */\nexport const scheduleOnNextTick = (cb: ScheduledFn) => {\n // We use Promise.resolve().then() here so that the operation is scheduled at\n // the end of the promise job queue, we then add it to the next process tick\n // to ensure it's evaluated afterwards.\n //\n // This was inspired by the implementation of the DataLoader interface: https://github.com/graphql/dataloader/blob/d336bd15282664e0be4b4a657cb796f09bafbc6b/src/index.js#L213-L255\n //\n Promise.resolve().then(() => {\n if (process.env.NEXT_RUNTIME === 'edge') {\n setTimeout(cb, 0)\n } else {\n process.nextTick(cb)\n }\n })\n}\n\n/**\n * Schedules a function to be called using `setImmediate` or `setTimeout` if\n * `setImmediate` is not available (like in the Edge runtime).\n *\n * @param cb the function to schedule\n */\nexport const scheduleImmediate = (cb: ScheduledFn): void => {\n if (process.env.NEXT_RUNTIME === 'edge') {\n setTimeout(cb, 0)\n } else {\n setImmediate(cb)\n }\n}\n\n/**\n * returns a promise than resolves in a future task. There is no guarantee that the task it resolves in\n * will be the next task but if you await it you can at least be sure that the current task is over and\n * most usefully that the entire microtask queue of the current task has been emptied.\n */\nexport function atLeastOneTask() {\n return new Promise((resolve) => scheduleImmediate(resolve))\n}\n\n/**\n * This utility function is extracted to make it easier to find places where we are doing\n * specific timing tricks to try to schedule work after React has rendered. This is especially\n * important at the moment because Next.js uses the edge builds of React which use setTimeout to\n * schedule work when you might expect that something like setImmediate would do the trick.\n *\n * Long term we should switch to the node versions of React rendering when possible and then\n * update this to use setImmediate rather than setTimeout\n */\nexport function waitAtLeastOneReactRenderTask(): Promise {\n if (process.env.NEXT_RUNTIME === 'edge') {\n return new Promise((r) => setTimeout(r, 0))\n } else {\n return new Promise((r) => setImmediate(r))\n }\n}\n"],"names":["atLeastOneTask","scheduleImmediate","scheduleOnNextTick","waitAtLeastOneReactRenderTask","cb","Promise","resolve","then","process","env","NEXT_RUNTIME","setTimeout","nextTick","setImmediate","r"],"mappings":";;;;;;;;;;;;;;;;;IA4CgBA,cAAc;eAAdA;;IAbHC,iBAAiB;eAAjBA;;IAtBAC,kBAAkB;eAAlBA;;IAgDGC,6BAA6B;eAA7BA;;;AAhDT,MAAMD,qBAAqB,CAACE;IACjC,6EAA6E;IAC7E,4EAA4E;IAC5E,uCAAuC;IACvC,EAAE;IACF,kLAAkL;IAClL,EAAE;IACFC,QAAQC,OAAO,GAAGC,IAAI,CAAC;QACrB,IAAIC,QAAQC,GAAG,CAACC,YAAY,KAAK,QAAQ;YACvCC,WAAWP,IAAI;QACjB,OAAO;YACLI,QAAQI,QAAQ,CAACR;QACnB;IACF;AACF;AAQO,MAAMH,oBAAoB,CAACG;IAChC,IAAII,QAAQC,GAAG,CAACC,YAAY,KAAK,QAAQ;QACvCC,WAAWP,IAAI;IACjB,OAAO;QACLS,aAAaT;IACf;AACF;AAOO,SAASJ;IACd,OAAO,IAAIK,QAAc,CAACC,UAAYL,kBAAkBK;AAC1D;AAWO,SAASH;IACd,IAAIK,QAAQC,GAAG,CAACC,YAAY,KAAK,QAAQ;QACvC,OAAO,IAAIL,QAAQ,CAACS,IAAMH,WAAWG,GAAG;IAC1C,OAAO;QACL,OAAO,IAAIT,QAAQ,CAACS,IAAMD,aAAaC;IACzC;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/semver-noop.d.ts b/e-commerce/node_modules/next/dist/lib/semver-noop.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2ccdf1ef11a7d7201b9171b79e2fbd4e6c028b1d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/semver-noop.d.ts @@ -0,0 +1 @@ +export declare function satisfies(): boolean; diff --git a/e-commerce/node_modules/next/dist/lib/semver-noop.js b/e-commerce/node_modules/next/dist/lib/semver-noop.js new file mode 100644 index 0000000000000000000000000000000000000000..720199e52f5f651d574ee6f925e0aaf5f59ff46f --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/semver-noop.js @@ -0,0 +1,18 @@ +// DO NOT MODIFY THIS FILE DIRECTLY +// It's for aliasing the `semver` package to be a noop for the `jsonwebtoken` package. +// We're trying to minimize the size of the worker bundle. +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "satisfies", { + enumerable: true, + get: function() { + return satisfies; + } +}); +function satisfies() { + return true; +} + +//# sourceMappingURL=semver-noop.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/semver-noop.js.map b/e-commerce/node_modules/next/dist/lib/semver-noop.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f5d99e432863f9835b7b3b1393363cc8674007b6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/semver-noop.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/semver-noop.ts"],"sourcesContent":["// DO NOT MODIFY THIS FILE DIRECTLY\n// It's for aliasing the `semver` package to be a noop for the `jsonwebtoken` package.\n// We're trying to minimize the size of the worker bundle.\n\nexport function satisfies() {\n return true\n}\n"],"names":["satisfies"],"mappings":"AAAA,mCAAmC;AACnC,sFAAsF;AACtF,0DAA0D;;;;;+BAE1CA;;;eAAAA;;;AAAT,SAASA;IACd,OAAO;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/server-external-packages.jsonc b/e-commerce/node_modules/next/dist/lib/server-external-packages.jsonc new file mode 100644 index 0000000000000000000000000000000000000000..fd596ddcb21a7e95607a01ee770a7053208096bd --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/server-external-packages.jsonc @@ -0,0 +1,103 @@ +[ + // alineacms.com generates this package at build time and it should not end up in a cache (much like the @prisma/client package) + "@alinea/generated", + "@appsignal/nodejs", + "@aws-sdk/client-s3", + "@aws-sdk/s3-presigned-post", + "@blockfrost/blockfrost-js", + "@highlight-run/node", + "@huggingface/transformers", + "@jpg-store/lucid-cardano", + "@libsql/client", + "@mikro-orm/core", + "@mikro-orm/knex", + "@node-rs/argon2", + "@node-rs/bcrypt", + "@prisma/client", + "@react-pdf/renderer", + // Native Node.js addons + "@sentry/profiling-node", + "@sparticuz/chromium", + "@sparticuz/chromium-min", + // Native Node.js addons + "@statsig/statsig-node-core", + // Native Node.js addons + "@swc/core", + "@xenova/transformers", + // Builds on top of @prisma/client so dynamically loads the version. + "@zenstackhq/runtime", + "argon2", + "autoprefixer", + "aws-crt", + "bcrypt", + "better-sqlite3", + "canvas", + "chromadb-default-embed", + // Contains an unconditional require to a undeclared dependency 'coffee-script' + "config", + // Native Node.js addons + "cpu-features", + "cypress", + "dd-trace", + "eslint", + "express", + "firebase-admin", + "htmlrewriter", + // Patches the module system to shim modules + "import-in-the-middle", + // Native Node.js addons + "isolated-vm", + "jest", + "jsdom", + // Used to contain a very dynamic require to load the DB backend: + // https://github.com/jaredwray/keyv/blob/78b247b5b7a8c9b12154fbfae4295d6fb29158cf/packages/keyv/src/index.js#L22 + "keyv", + "libsql", + "mdx-bundler", + "mongodb", + "mongoose", + "newrelic", + "next-mdx-remote", + "next-seo", + "node-cron", + "node-pty", + "node-web-audio-api", + "onnxruntime-node", + "oslo", + "pg", + // pino@10.1.0/lib/transport.js passes `join(__dirname, 'worker.js')` to thread-stream which ends + // up `require`ing that filepath, leading to + // `Cannot find module '/ROOT/node_modules/.pnpm/pino@10.1.0/node_modules/pino/lib/worker.js'` + "pino", + // A "plugin" that is passed to pino as a string (and is then required in a worker) + "pino-pretty", + // A "plugin" that is passed to pino as a string (and is then required in a worker) + "pino-roll", + "playwright", + "playwright-core", + "postcss", + "prettier", + "prisma", + "puppeteer", + "puppeteer-core", + "ravendb", + // Patches the module system to shim modules + "require-in-the-middle", + "rimraf", + // Native Node.js addons + "sharp", + "shiki", + "sqlite3", + // dynamic `new Worker` call in thread-stream@3.1.0/index.js which pulls in various non-code files + // as well (trying to parse README and invalid test files) + "thread-stream", + // Slow to compile because it pulls in typescript + "ts-morph", + "ts-node", + "typescript", + "vscode-oniguruma", + "webpack", + "websocket", + // Native Node.js addons + "zeromq", +] diff --git a/e-commerce/node_modules/next/dist/lib/setup-exception-listeners.d.ts b/e-commerce/node_modules/next/dist/lib/setup-exception-listeners.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/e-commerce/node_modules/next/dist/lib/setup-exception-listeners.js b/e-commerce/node_modules/next/dist/lib/setup-exception-listeners.js new file mode 100644 index 0000000000000000000000000000000000000000..3683cbc98420ddede64254118bfb06cb9ffe7338 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/setup-exception-listeners.js @@ -0,0 +1,11 @@ +"use strict"; +process.on('uncaughtException', (err)=>{ + console.error('uncaughtException', err); + process.exit(1); +}); +process.on('unhandledRejection', (err)=>{ + console.error('unhandledRejection', err); + process.exit(1); +}); + +//# sourceMappingURL=setup-exception-listeners.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/setup-exception-listeners.js.map b/e-commerce/node_modules/next/dist/lib/setup-exception-listeners.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1f2cd1d6394b41b15946012bf4bfed887472d6d6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/setup-exception-listeners.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/setup-exception-listeners.ts"],"sourcesContent":["process.on('uncaughtException', (err) => {\n console.error('uncaughtException', err)\n process.exit(1)\n})\n\nprocess.on('unhandledRejection', (err) => {\n console.error('unhandledRejection', err)\n process.exit(1)\n})\n"],"names":["process","on","err","console","error","exit"],"mappings":";AAAAA,QAAQC,EAAE,CAAC,qBAAqB,CAACC;IAC/BC,QAAQC,KAAK,CAAC,qBAAqBF;IACnCF,QAAQK,IAAI,CAAC;AACf;AAEAL,QAAQC,EAAE,CAAC,sBAAsB,CAACC;IAChCC,QAAQC,KAAK,CAAC,sBAAsBF;IACpCF,QAAQK,IAAI,CAAC;AACf","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/static-env.d.ts b/e-commerce/node_modules/next/dist/lib/static-env.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a472640cca3861b376969db426682128251e198b --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/static-env.d.ts @@ -0,0 +1,13 @@ +import type { NextConfigComplete, NextConfigRuntime } from '../server/config-shared'; +/** + * Collects all environment variables that are using the `NEXT_PUBLIC_` prefix. + */ +export declare function getNextPublicEnvironmentVariables(): { + [k: string]: string | undefined; +}; +/** + * Collects the `env` config value from the Next.js config. + */ +export declare function getNextConfigEnv(config: NextConfigComplete | NextConfigRuntime): Record; +export declare function getStaticEnv(config: NextConfigComplete | NextConfigRuntime, deploymentId: string): Record; +export declare function populateStaticEnv(config: NextConfigComplete | NextConfigRuntime, deploymentId: string): void; diff --git a/e-commerce/node_modules/next/dist/lib/static-env.js b/e-commerce/node_modules/next/dist/lib/static-env.js new file mode 100644 index 0000000000000000000000000000000000000000..43b75c4e8e2862f265d25f7e5c958230b4e82855 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/static-env.js @@ -0,0 +1,88 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + getNextConfigEnv: null, + getNextPublicEnvironmentVariables: null, + getStaticEnv: null, + populateStaticEnv: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + getNextConfigEnv: function() { + return getNextConfigEnv; + }, + getNextPublicEnvironmentVariables: function() { + return getNextPublicEnvironmentVariables; + }, + getStaticEnv: function() { + return getStaticEnv; + }, + populateStaticEnv: function() { + return populateStaticEnv; + } +}); +function errorIfEnvConflicted(config, key) { + const isPrivateKey = /^(?:NODE_.+)|^(?:__.+)$/i.test(key); + const hasNextRuntimeKey = key === 'NEXT_RUNTIME'; + if (isPrivateKey || hasNextRuntimeKey) { + throw new Error(`The key "${key}" under "env" in ${config.configFileName || 'config'} is not allowed. https://nextjs.org/docs/messages/env-key-not-allowed`); + } +} +function getNextPublicEnvironmentVariables() { + const defineEnv = []; + for(const key in process.env){ + if (key.startsWith('NEXT_PUBLIC_')) { + const value = process.env[key]; + if (value != null) { + defineEnv.push([ + `process.env.${key}`, + value + ]); + } + } + } + defineEnv.sort((a, b)=>a[0].localeCompare(b[0])); + return Object.fromEntries(defineEnv); +} +function getNextConfigEnv(config) { + // Refactored code below to use for-of + const defineEnv = {}; + const env = config.env; + for(const key in env){ + const value = env[key]; + if (value != null) { + errorIfEnvConflicted(config, key); + defineEnv[`process.env.${key}`] = value; + } + } + return defineEnv; +} +function getStaticEnv(config, deploymentId) { + const staticEnv = { + ...getNextPublicEnvironmentVariables(), + ...getNextConfigEnv(config), + 'process.env.NEXT_DEPLOYMENT_ID': deploymentId + }; + return staticEnv; +} +function populateStaticEnv(config, deploymentId) { + // since inlining comes after static generation we need + // to ensure this value is assigned to process env so it + // can still be accessed + const staticEnv = getStaticEnv(config, deploymentId); + for(const key in staticEnv){ + const innerKey = key.split('.').pop() || ''; + if (!process.env[innerKey]) { + process.env[innerKey] = staticEnv[key] || ''; + } + } +} + +//# sourceMappingURL=static-env.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/static-env.js.map b/e-commerce/node_modules/next/dist/lib/static-env.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f69ae0827b6debe7d2b67403d86589c0609724da --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/static-env.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/static-env.ts"],"sourcesContent":["import type {\n NextConfigComplete,\n NextConfigRuntime,\n} from '../server/config-shared'\n\nfunction errorIfEnvConflicted(\n config: NextConfigComplete | NextConfigRuntime,\n key: string\n) {\n const isPrivateKey = /^(?:NODE_.+)|^(?:__.+)$/i.test(key)\n const hasNextRuntimeKey = key === 'NEXT_RUNTIME'\n\n if (isPrivateKey || hasNextRuntimeKey) {\n throw new Error(\n `The key \"${key}\" under \"env\" in ${config.configFileName || 'config'} is not allowed. https://nextjs.org/docs/messages/env-key-not-allowed`\n )\n }\n}\n\n/**\n * Collects all environment variables that are using the `NEXT_PUBLIC_` prefix.\n */\nexport function getNextPublicEnvironmentVariables() {\n const defineEnv: [string, string | undefined][] = []\n for (const key in process.env) {\n if (key.startsWith('NEXT_PUBLIC_')) {\n const value = process.env[key]\n if (value != null) {\n defineEnv.push([`process.env.${key}`, value])\n }\n }\n }\n defineEnv.sort((a, b) => a[0].localeCompare(b[0]))\n return Object.fromEntries(defineEnv)\n}\n\n/**\n * Collects the `env` config value from the Next.js config.\n */\nexport function getNextConfigEnv(\n config: NextConfigComplete | NextConfigRuntime\n) {\n // Refactored code below to use for-of\n const defineEnv: Record = {}\n const env = config.env\n for (const key in env) {\n const value = env[key]\n if (value != null) {\n errorIfEnvConflicted(config, key)\n defineEnv[`process.env.${key}`] = value\n }\n }\n return defineEnv\n}\n\nexport function getStaticEnv(\n config: NextConfigComplete | NextConfigRuntime,\n deploymentId: string\n) {\n const staticEnv: Record = {\n ...getNextPublicEnvironmentVariables(),\n ...getNextConfigEnv(config),\n 'process.env.NEXT_DEPLOYMENT_ID': deploymentId,\n }\n return staticEnv\n}\n\nexport function populateStaticEnv(\n config: NextConfigComplete | NextConfigRuntime,\n deploymentId: string\n) {\n // since inlining comes after static generation we need\n // to ensure this value is assigned to process env so it\n // can still be accessed\n const staticEnv = getStaticEnv(config, deploymentId)\n for (const key in staticEnv) {\n const innerKey = key.split('.').pop() || ''\n if (!process.env[innerKey]) {\n process.env[innerKey] = staticEnv[key] || ''\n }\n }\n}\n"],"names":["getNextConfigEnv","getNextPublicEnvironmentVariables","getStaticEnv","populateStaticEnv","errorIfEnvConflicted","config","key","isPrivateKey","test","hasNextRuntimeKey","Error","configFileName","defineEnv","process","env","startsWith","value","push","sort","a","b","localeCompare","Object","fromEntries","deploymentId","staticEnv","innerKey","split","pop"],"mappings":";;;;;;;;;;;;;;;;;IAuCgBA,gBAAgB;eAAhBA;;IAjBAC,iCAAiC;eAAjCA;;IAiCAC,YAAY;eAAZA;;IAYAC,iBAAiB;eAAjBA;;;AA9DhB,SAASC,qBACPC,MAA8C,EAC9CC,GAAW;IAEX,MAAMC,eAAe,2BAA2BC,IAAI,CAACF;IACrD,MAAMG,oBAAoBH,QAAQ;IAElC,IAAIC,gBAAgBE,mBAAmB;QACrC,MAAM,IAAIC,MACR,CAAC,SAAS,EAAEJ,IAAI,iBAAiB,EAAED,OAAOM,cAAc,IAAI,SAAS,qEAAqE,CAAC;IAE/I;AACF;AAKO,SAASV;IACd,MAAMW,YAA4C,EAAE;IACpD,IAAK,MAAMN,OAAOO,QAAQC,GAAG,CAAE;QAC7B,IAAIR,IAAIS,UAAU,CAAC,iBAAiB;YAClC,MAAMC,QAAQH,QAAQC,GAAG,CAACR,IAAI;YAC9B,IAAIU,SAAS,MAAM;gBACjBJ,UAAUK,IAAI,CAAC;oBAAC,CAAC,YAAY,EAAEX,KAAK;oBAAEU;iBAAM;YAC9C;QACF;IACF;IACAJ,UAAUM,IAAI,CAAC,CAACC,GAAGC,IAAMD,CAAC,CAAC,EAAE,CAACE,aAAa,CAACD,CAAC,CAAC,EAAE;IAChD,OAAOE,OAAOC,WAAW,CAACX;AAC5B;AAKO,SAASZ,iBACdK,MAA8C;IAE9C,sCAAsC;IACtC,MAAMO,YAAgD,CAAC;IACvD,MAAME,MAAMT,OAAOS,GAAG;IACtB,IAAK,MAAMR,OAAOQ,IAAK;QACrB,MAAME,QAAQF,GAAG,CAACR,IAAI;QACtB,IAAIU,SAAS,MAAM;YACjBZ,qBAAqBC,QAAQC;YAC7BM,SAAS,CAAC,CAAC,YAAY,EAAEN,KAAK,CAAC,GAAGU;QACpC;IACF;IACA,OAAOJ;AACT;AAEO,SAASV,aACdG,MAA8C,EAC9CmB,YAAoB;IAEpB,MAAMC,YAAgD;QACpD,GAAGxB,mCAAmC;QACtC,GAAGD,iBAAiBK,OAAO;QAC3B,kCAAkCmB;IACpC;IACA,OAAOC;AACT;AAEO,SAAStB,kBACdE,MAA8C,EAC9CmB,YAAoB;IAEpB,uDAAuD;IACvD,wDAAwD;IACxD,wBAAwB;IACxB,MAAMC,YAAYvB,aAAaG,QAAQmB;IACvC,IAAK,MAAMlB,OAAOmB,UAAW;QAC3B,MAAMC,WAAWpB,IAAIqB,KAAK,CAAC,KAAKC,GAAG,MAAM;QACzC,IAAI,CAACf,QAAQC,GAAG,CAACY,SAAS,EAAE;YAC1Bb,QAAQC,GAAG,CAACY,SAAS,GAAGD,SAAS,CAACnB,IAAI,IAAI;QAC5C;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/try-to-parse-path.d.ts b/e-commerce/node_modules/next/dist/lib/try-to-parse-path.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..101524d667dada1b4be905a642dd600636ee5000 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/try-to-parse-path.d.ts @@ -0,0 +1,19 @@ +import type { Token } from 'next/dist/compiled/path-to-regexp'; +interface ParseResult { + error?: any; + parsedPath: string; + regexStr?: string; + route: string; + tokens?: Token[]; +} +/** + * Attempts to parse a given route with `path-to-regexp` and returns an object + * with the result. Whenever an error happens on parse, it will print an error + * attempting to find the error position and showing a link to the docs. When + * `handleUrl` is set to `true` it will also attempt to parse the route + * and use the resulting pathname to parse with `path-to-regexp`. + */ +export declare function tryToParsePath(route: string, options?: { + handleUrl?: boolean; +}): ParseResult; +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/try-to-parse-path.js b/e-commerce/node_modules/next/dist/lib/try-to-parse-path.js new file mode 100644 index 0000000000000000000000000000000000000000..eb860773311d1592166dae02d436eb2ff7759ee3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/try-to-parse-path.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "tryToParsePath", { + enumerable: true, + get: function() { + return tryToParsePath; + } +}); +const _pathtoregexp = require("next/dist/compiled/path-to-regexp"); +const _iserror = /*#__PURE__*/ _interop_require_default(require("./is-error")); +const _routepatternnormalizer = require("./route-pattern-normalizer"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +/** + * If there is an error show our error link but still show original error or + * a formatted one if we can + */ function reportError({ route, parsedPath }, err) { + let errMatches; + if ((0, _iserror.default)(err) && (errMatches = err.message.match(/at (\d{0,})/))) { + const position = parseInt(errMatches[1], 10); + console.error(`\nError parsing \`${route}\` ` + `https://nextjs.org/docs/messages/invalid-route-source\n` + `Reason: ${err.message}\n\n` + ` ${parsedPath}\n` + ` ${new Array(position).fill(' ').join('')}^\n`); + } else { + console.error(`\nError parsing ${route} https://nextjs.org/docs/messages/invalid-route-source`, err); + } +} +/** + * Safe wrapper around tokensToRegexp that handles path-to-regexp 6.3.0+ validation errors. + */ function safeTokensToRegexp(tokens) { + try { + return (0, _pathtoregexp.tokensToRegexp)(tokens); + } catch (error) { + if ((0, _iserror.default)(error)) { + // Try to normalize tokens with repeating modifiers but no prefix/suffix + const normalizedTokens = (0, _routepatternnormalizer.normalizeTokensForRegexp)(tokens); + return (0, _pathtoregexp.tokensToRegexp)(normalizedTokens); + } + throw error; + } +} +function tryToParsePath(route, options) { + const result = { + route, + parsedPath: route + }; + try { + if (options == null ? void 0 : options.handleUrl) { + const parsed = new URL(route, 'http://n'); + result.parsedPath = `${parsed.pathname}${parsed.hash || ''}`; + } + result.tokens = (0, _pathtoregexp.parse)(result.parsedPath); + // Use safe wrapper instead of proactive detection + if (result.tokens) { + result.regexStr = safeTokensToRegexp(result.tokens).source; + } + } catch (err) { + reportError(result, err); + result.error = err; + } + return result; +} + +//# sourceMappingURL=try-to-parse-path.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/try-to-parse-path.js.map b/e-commerce/node_modules/next/dist/lib/try-to-parse-path.js.map new file mode 100644 index 0000000000000000000000000000000000000000..46416ec9ed8046239a4b8e1f93ab21bb6376ca9e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/try-to-parse-path.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/try-to-parse-path.ts"],"sourcesContent":["import type { Token } from 'next/dist/compiled/path-to-regexp'\nimport { parse, tokensToRegexp } from 'next/dist/compiled/path-to-regexp'\nimport isError from './is-error'\nimport { normalizeTokensForRegexp } from './route-pattern-normalizer'\n\ninterface ParseResult {\n error?: any\n parsedPath: string\n regexStr?: string\n route: string\n tokens?: Token[]\n}\n\n/**\n * If there is an error show our error link but still show original error or\n * a formatted one if we can\n */\nfunction reportError({ route, parsedPath }: ParseResult, err: any) {\n let errMatches\n if (isError(err) && (errMatches = err.message.match(/at (\\d{0,})/))) {\n const position = parseInt(errMatches[1], 10)\n console.error(\n `\\nError parsing \\`${route}\\` ` +\n `https://nextjs.org/docs/messages/invalid-route-source\\n` +\n `Reason: ${err.message}\\n\\n` +\n ` ${parsedPath}\\n` +\n ` ${new Array(position).fill(' ').join('')}^\\n`\n )\n } else {\n console.error(\n `\\nError parsing ${route} https://nextjs.org/docs/messages/invalid-route-source`,\n err\n )\n }\n}\n\n/**\n * Safe wrapper around tokensToRegexp that handles path-to-regexp 6.3.0+ validation errors.\n */\nfunction safeTokensToRegexp(tokens: Token[]): RegExp {\n try {\n return tokensToRegexp(tokens)\n } catch (error) {\n if (isError(error)) {\n // Try to normalize tokens with repeating modifiers but no prefix/suffix\n const normalizedTokens = normalizeTokensForRegexp(tokens)\n return tokensToRegexp(normalizedTokens)\n }\n throw error\n }\n}\n\n/**\n * Attempts to parse a given route with `path-to-regexp` and returns an object\n * with the result. Whenever an error happens on parse, it will print an error\n * attempting to find the error position and showing a link to the docs. When\n * `handleUrl` is set to `true` it will also attempt to parse the route\n * and use the resulting pathname to parse with `path-to-regexp`.\n */\nexport function tryToParsePath(\n route: string,\n options?: {\n handleUrl?: boolean\n }\n): ParseResult {\n const result: ParseResult = { route, parsedPath: route }\n try {\n if (options?.handleUrl) {\n const parsed = new URL(route, 'http://n')\n result.parsedPath = `${parsed.pathname}${parsed.hash || ''}`\n }\n\n result.tokens = parse(result.parsedPath)\n\n // Use safe wrapper instead of proactive detection\n if (result.tokens) {\n result.regexStr = safeTokensToRegexp(result.tokens).source\n }\n } catch (err) {\n reportError(result, err)\n result.error = err\n }\n\n return result\n}\n"],"names":["tryToParsePath","reportError","route","parsedPath","err","errMatches","isError","message","match","position","parseInt","console","error","Array","fill","join","safeTokensToRegexp","tokens","tokensToRegexp","normalizedTokens","normalizeTokensForRegexp","options","result","handleUrl","parsed","URL","pathname","hash","parse","regexStr","source"],"mappings":";;;;+BA2DgBA;;;eAAAA;;;8BA1DsB;gEAClB;wCACqB;;;;;;AAUzC;;;CAGC,GACD,SAASC,YAAY,EAAEC,KAAK,EAAEC,UAAU,EAAe,EAAEC,GAAQ;IAC/D,IAAIC;IACJ,IAAIC,IAAAA,gBAAO,EAACF,QAASC,CAAAA,aAAaD,IAAIG,OAAO,CAACC,KAAK,CAAC,cAAa,GAAI;QACnE,MAAMC,WAAWC,SAASL,UAAU,CAAC,EAAE,EAAE;QACzCM,QAAQC,KAAK,CACX,CAAC,kBAAkB,EAAEV,MAAM,GAAG,CAAC,GAC7B,CAAC,uDAAuD,CAAC,GACzD,CAAC,QAAQ,EAAEE,IAAIG,OAAO,CAAC,IAAI,CAAC,GAC5B,CAAC,EAAE,EAAEJ,WAAW,EAAE,CAAC,GACnB,CAAC,EAAE,EAAE,IAAIU,MAAMJ,UAAUK,IAAI,CAAC,KAAKC,IAAI,CAAC,IAAI,GAAG,CAAC;IAEtD,OAAO;QACLJ,QAAQC,KAAK,CACX,CAAC,gBAAgB,EAAEV,MAAM,sDAAsD,CAAC,EAChFE;IAEJ;AACF;AAEA;;CAEC,GACD,SAASY,mBAAmBC,MAAe;IACzC,IAAI;QACF,OAAOC,IAAAA,4BAAc,EAACD;IACxB,EAAE,OAAOL,OAAO;QACd,IAAIN,IAAAA,gBAAO,EAACM,QAAQ;YAClB,wEAAwE;YACxE,MAAMO,mBAAmBC,IAAAA,gDAAwB,EAACH;YAClD,OAAOC,IAAAA,4BAAc,EAACC;QACxB;QACA,MAAMP;IACR;AACF;AASO,SAASZ,eACdE,KAAa,EACbmB,OAEC;IAED,MAAMC,SAAsB;QAAEpB;QAAOC,YAAYD;IAAM;IACvD,IAAI;QACF,IAAImB,2BAAAA,QAASE,SAAS,EAAE;YACtB,MAAMC,SAAS,IAAIC,IAAIvB,OAAO;YAC9BoB,OAAOnB,UAAU,GAAG,GAAGqB,OAAOE,QAAQ,GAAGF,OAAOG,IAAI,IAAI,IAAI;QAC9D;QAEAL,OAAOL,MAAM,GAAGW,IAAAA,mBAAK,EAACN,OAAOnB,UAAU;QAEvC,kDAAkD;QAClD,IAAImB,OAAOL,MAAM,EAAE;YACjBK,OAAOO,QAAQ,GAAGb,mBAAmBM,OAAOL,MAAM,EAAEa,MAAM;QAC5D;IACF,EAAE,OAAO1B,KAAK;QACZH,YAAYqB,QAAQlB;QACpBkB,OAAOV,KAAK,GAAGR;IACjB;IAEA,OAAOkB;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/turbopack-cache-seed.d.ts b/e-commerce/node_modules/next/dist/lib/turbopack-cache-seed.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..27f1b55dc70094cfefa80ae8ec108dffa9d2ccb7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/turbopack-cache-seed.d.ts @@ -0,0 +1,4 @@ +export declare function seedTurbopackCacheIfNeeded({ projectDir, distDir, }: { + projectDir: string; + distDir: string; +}): void; diff --git a/e-commerce/node_modules/next/dist/lib/turbopack-cache-seed.js b/e-commerce/node_modules/next/dist/lib/turbopack-cache-seed.js new file mode 100644 index 0000000000000000000000000000000000000000..a59ba02652c2feeab06456c92882f6da1a570c4d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/turbopack-cache-seed.js @@ -0,0 +1,171 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "seedTurbopackCacheIfNeeded", { + enumerable: true, + get: function() { + return seedTurbopackCacheIfNeeded; + } +}); +const _fs = /*#__PURE__*/ _interop_require_default(require("fs")); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +const _log = /*#__PURE__*/ _interop_require_wildcard(require("../build/output/log")); +const _swc = require("../build/swc"); +const _gitworktree = require("./git-worktree"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +function seedTurbopackCacheIfNeeded({ projectDir, distDir }) { + // This gets the version assuming that nothing is dirty. + // If things are dirty, turbopack would write things + // in a different location. There are other circumstances + // as well. This only matters for people developing turbopack + // see handle_db_versioning in turbotask backend for more details. + const version = (0, _swc.getTurbopackCacheVersion)(); + if (!version) return; + const worktreeInfo = (0, _gitworktree.getGitWorktreeInfo)(projectDir); + if (!worktreeInfo) return; + const cacheDir = _path.default.join(distDir, 'cache', 'turbopack'); + const targetVersionDir = _path.default.join(cacheDir, version); + if (dirHasEntries(targetVersionDir)) return; + let sourceVersionDir; + try { + sourceVersionDir = findSeedSource(worktreeInfo, projectDir, distDir, version); + } catch { + return; + } + if (!sourceVersionDir) return; + const tmpDir = `${targetVersionDir}.seeding`; + // Making sure we don't copy partial data if process interrupted + // There is a potential race condition here + // if someone wrote to the cache while we were seeding it + // but with the immutable design and all that, I'm not super worried + try { + _fs.default.mkdirSync(cacheDir, { + recursive: true + }); + _fs.default.rmSync(tmpDir, { + recursive: true, + force: true + }); + seedCacheDir(sourceVersionDir, tmpDir); + _fs.default.renameSync(tmpDir, targetVersionDir); + _log.info(`Seeded Turbopack cache from ${sourceVersionDir}.`); + } catch { + _fs.default.rmSync(tmpDir, { + recursive: true, + force: true + }); + _log.warn(`Failed to seed Turbopack cache from ${sourceVersionDir} to ${targetVersionDir}.`); + } +} +function findSeedSource(worktreeInfo, projectDir, distDir, version) { + const projectRelToWorktree = _path.default.relative(worktreeInfo.worktreeRoot, projectDir); + const distRelToProject = _path.default.relative(projectDir, distDir); + const currentWorktree = _path.default.resolve(worktreeInfo.worktreeRoot); + // We are going to find the best candidate worktree + // based on the most recently written cache directory. + // We only look at our version + let best; + for (const root of [ + worktreeInfo.mainRepoRoot, + ...(0, _gitworktree.listLinkedWorktreeRoots)(worktreeInfo.mainRepoRoot) + ]){ + if (_path.default.resolve(root) === currentWorktree) continue; + const versionDir = _path.default.join(root, projectRelToWorktree, distRelToProject, 'cache', 'turbopack', version); + const commitTimeMs = currentCommitTimeMs(versionDir); + if (commitTimeMs === undefined) continue; + if (!best || commitTimeMs > best.commitTimeMs) { + best = { + versionDir, + commitTimeMs + }; + } + } + return best == null ? void 0 : best.versionDir; +} +// When the cache in `versionDir` was last committed to, in epoch milliseconds, or undefined if +// there is no usable cache there. Read from the `commit_time` the persistence layer records in +// CURRENT. +function currentCommitTimeMs(versionDir) { + let commitTime; + try { + commitTime = JSON.parse(_fs.default.readFileSync(_path.default.join(versionDir, 'CURRENT'), 'utf8')).commit_time; + } catch { + // missing, unreadable, or not valid JSON - treat it as not a seed candidate + return undefined; + } + if (typeof commitTime !== 'string') return undefined; + const parsed = Date.parse(commitTime); + return Number.isNaN(parsed) ? undefined : parsed; +} +function dirHasEntries(dir) { + try { + return _fs.default.readdirSync(dir).length > 0; + } catch { + return false; + } +} +const IMMUTABLE_CACHE_FILE = /\.(sst|blob|meta|del)$/; +function seedCacheDir(src, dst) { + const stat = _fs.default.lstatSync(src); + if (stat.isDirectory()) { + _fs.default.mkdirSync(dst, { + recursive: true + }); + for (const name of _fs.default.readdirSync(src)){ + seedCacheDir(_path.default.join(src, name), _path.default.join(dst, name)); + } + } else if (IMMUTABLE_CACHE_FILE.test(src)) { + _fs.default.linkSync(src, dst); + } else { + // Mutable/unknown (CURRENT, LOG, …) - copy so it gets its own inode. + _fs.default.copyFileSync(src, dst); + } +} + +//# sourceMappingURL=turbopack-cache-seed.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/turbopack-cache-seed.js.map b/e-commerce/node_modules/next/dist/lib/turbopack-cache-seed.js.map new file mode 100644 index 0000000000000000000000000000000000000000..71d11aefb22bb5cbeabd54aafe240c0098cc69cc --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/turbopack-cache-seed.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/turbopack-cache-seed.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport * as Log from '../build/output/log'\nimport { getTurbopackCacheVersion } from '../build/swc'\nimport {\n getGitWorktreeInfo,\n listLinkedWorktreeRoots,\n type GitWorktreeInfo,\n} from './git-worktree'\n\nexport function seedTurbopackCacheIfNeeded({\n projectDir,\n distDir,\n}: {\n projectDir: string\n distDir: string\n}): void {\n // This gets the version assuming that nothing is dirty.\n // If things are dirty, turbopack would write things\n // in a different location. There are other circumstances\n // as well. This only matters for people developing turbopack\n // see handle_db_versioning in turbotask backend for more details.\n const version = getTurbopackCacheVersion()\n if (!version) return\n\n const worktreeInfo = getGitWorktreeInfo(projectDir)\n if (!worktreeInfo) return\n\n const cacheDir = path.join(distDir, 'cache', 'turbopack')\n const targetVersionDir = path.join(cacheDir, version)\n if (dirHasEntries(targetVersionDir)) return\n\n let sourceVersionDir: string | undefined\n try {\n sourceVersionDir = findSeedSource(\n worktreeInfo,\n projectDir,\n distDir,\n version\n )\n } catch {\n return\n }\n if (!sourceVersionDir) return\n\n const tmpDir = `${targetVersionDir}.seeding`\n // Making sure we don't copy partial data if process interrupted\n // There is a potential race condition here\n // if someone wrote to the cache while we were seeding it\n // but with the immutable design and all that, I'm not super worried\n try {\n fs.mkdirSync(cacheDir, { recursive: true })\n fs.rmSync(tmpDir, { recursive: true, force: true })\n seedCacheDir(sourceVersionDir, tmpDir)\n fs.renameSync(tmpDir, targetVersionDir)\n Log.info(`Seeded Turbopack cache from ${sourceVersionDir}.`)\n } catch {\n fs.rmSync(tmpDir, { recursive: true, force: true })\n Log.warn(\n `Failed to seed Turbopack cache from ${sourceVersionDir} to ${targetVersionDir}.`\n )\n }\n}\n\nfunction findSeedSource(\n worktreeInfo: GitWorktreeInfo,\n projectDir: string,\n distDir: string,\n version: string\n): string | undefined {\n const projectRelToWorktree = path.relative(\n worktreeInfo.worktreeRoot,\n projectDir\n )\n const distRelToProject = path.relative(projectDir, distDir)\n const currentWorktree = path.resolve(worktreeInfo.worktreeRoot)\n\n // We are going to find the best candidate worktree\n // based on the most recently written cache directory.\n // We only look at our version\n\n let best: { versionDir: string; commitTimeMs: number } | undefined\n for (const root of [\n worktreeInfo.mainRepoRoot,\n ...listLinkedWorktreeRoots(worktreeInfo.mainRepoRoot),\n ]) {\n if (path.resolve(root) === currentWorktree) continue\n const versionDir = path.join(\n root,\n projectRelToWorktree,\n distRelToProject,\n 'cache',\n 'turbopack',\n version\n )\n const commitTimeMs = currentCommitTimeMs(versionDir)\n if (commitTimeMs === undefined) continue\n if (!best || commitTimeMs > best.commitTimeMs) {\n best = { versionDir, commitTimeMs }\n }\n }\n return best?.versionDir\n}\n\n// When the cache in `versionDir` was last committed to, in epoch milliseconds, or undefined if\n// there is no usable cache there. Read from the `commit_time` the persistence layer records in\n// CURRENT.\nfunction currentCommitTimeMs(versionDir: string): number | undefined {\n let commitTime\n try {\n commitTime = JSON.parse(\n fs.readFileSync(path.join(versionDir, 'CURRENT'), 'utf8')\n ).commit_time\n } catch {\n // missing, unreadable, or not valid JSON - treat it as not a seed candidate\n return undefined\n }\n if (typeof commitTime !== 'string') return undefined\n const parsed = Date.parse(commitTime)\n return Number.isNaN(parsed) ? undefined : parsed\n}\n\nfunction dirHasEntries(dir: string): boolean {\n try {\n return fs.readdirSync(dir).length > 0\n } catch {\n return false\n }\n}\n\nconst IMMUTABLE_CACHE_FILE = /\\.(sst|blob|meta|del)$/\n\nfunction seedCacheDir(src: string, dst: string): void {\n const stat = fs.lstatSync(src)\n if (stat.isDirectory()) {\n fs.mkdirSync(dst, { recursive: true })\n for (const name of fs.readdirSync(src)) {\n seedCacheDir(path.join(src, name), path.join(dst, name))\n }\n } else if (IMMUTABLE_CACHE_FILE.test(src)) {\n fs.linkSync(src, dst)\n } else {\n // Mutable/unknown (CURRENT, LOG, …) - copy so it gets its own inode.\n fs.copyFileSync(src, dst)\n }\n}\n"],"names":["seedTurbopackCacheIfNeeded","projectDir","distDir","version","getTurbopackCacheVersion","worktreeInfo","getGitWorktreeInfo","cacheDir","path","join","targetVersionDir","dirHasEntries","sourceVersionDir","findSeedSource","tmpDir","fs","mkdirSync","recursive","rmSync","force","seedCacheDir","renameSync","Log","info","warn","projectRelToWorktree","relative","worktreeRoot","distRelToProject","currentWorktree","resolve","best","root","mainRepoRoot","listLinkedWorktreeRoots","versionDir","commitTimeMs","currentCommitTimeMs","undefined","commitTime","JSON","parse","readFileSync","commit_time","parsed","Date","Number","isNaN","dir","readdirSync","length","IMMUTABLE_CACHE_FILE","src","dst","stat","lstatSync","isDirectory","name","test","linkSync","copyFileSync"],"mappings":";;;;+BAUgBA;;;eAAAA;;;2DAVD;6DACE;6DACI;qBACoB;6BAKlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAASA,2BAA2B,EACzCC,UAAU,EACVC,OAAO,EAIR;IACC,wDAAwD;IACxD,oDAAoD;IACpD,yDAAyD;IACzD,6DAA6D;IAC7D,kEAAkE;IAClE,MAAMC,UAAUC,IAAAA,6BAAwB;IACxC,IAAI,CAACD,SAAS;IAEd,MAAME,eAAeC,IAAAA,+BAAkB,EAACL;IACxC,IAAI,CAACI,cAAc;IAEnB,MAAME,WAAWC,aAAI,CAACC,IAAI,CAACP,SAAS,SAAS;IAC7C,MAAMQ,mBAAmBF,aAAI,CAACC,IAAI,CAACF,UAAUJ;IAC7C,IAAIQ,cAAcD,mBAAmB;IAErC,IAAIE;IACJ,IAAI;QACFA,mBAAmBC,eACjBR,cACAJ,YACAC,SACAC;IAEJ,EAAE,OAAM;QACN;IACF;IACA,IAAI,CAACS,kBAAkB;IAEvB,MAAME,SAAS,GAAGJ,iBAAiB,QAAQ,CAAC;IAC5C,gEAAgE;IAChE,2CAA2C;IAC3C,yDAAyD;IACzD,oEAAoE;IACpE,IAAI;QACFK,WAAE,CAACC,SAAS,CAACT,UAAU;YAAEU,WAAW;QAAK;QACzCF,WAAE,CAACG,MAAM,CAACJ,QAAQ;YAAEG,WAAW;YAAME,OAAO;QAAK;QACjDC,aAAaR,kBAAkBE;QAC/BC,WAAE,CAACM,UAAU,CAACP,QAAQ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DQ,WAAW;IACf,EAAE,OAAM;QACN,4EAA4E;QAC5E,OAAOL;IACT;IACA,IAAI,OAAOC,eAAe,UAAU,OAAOD;IAC3C,MAAMM,SAASC,KAAKJ,KAAK,CAACF;IAC1B,OAAOO,OAAOC,KAAK,CAACH,UAAUN,YAAYM;AAC5C;AAEA,SAASjC,cAAcqC,GAAW;IAChC,IAAI;QACF,OAAOjC,WAAE,CAACkC,WAAW,CAACD,KAAKE,MAAM,GAAG;IACtC,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAEA,MAAMC,uBAAuB;AAE7B,SAAS/B,aAAagC,GAAW,EAAEC,GAAW;IAC5C,MAAMC,OAAOvC,WAAE,CAACwC,SAAS,CAACH;IAC1B,IAAIE,KAAKE,WAAW,IAAI;QACtBzC,WAAE,CAACC,SAAS,CAACqC,KAAK;YAAEpC,WAAW;QAAK;QACpC,KAAK,MAAMwC,QAAQ1C,WAAE,CAACkC,WAAW,CAACG,KAAM;YACtChC,aAAaZ,aAAI,CAACC,IAAI,CAAC2C,KAAKK,OAAOjD,aAAI,CAACC,IAAI,CAAC4C,KAAKI;QACpD;IACF,OAAO,IAAIN,qBAAqBO,IAAI,CAACN,MAAM;QACzCrC,WAAE,CAAC4C,QAAQ,CAACP,KAAKC;IACnB,OAAO;QACL,qEAAqE;QACrEtC,WAAE,CAAC6C,YAAY,CAACR,KAAKC;IACvB;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/turbopack-warning.d.ts b/e-commerce/node_modules/next/dist/lib/turbopack-warning.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dd21837c27eebf90b2f00d5fa0635bee792df092 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/turbopack-warning.d.ts @@ -0,0 +1,7 @@ +import type { NextConfigComplete } from '../server/config-shared'; +import loadConfig from '../server/config'; +/** */ +export declare function validateTurboNextConfig({ dir, configPhase, }: { + dir: string; + configPhase: Parameters[0]; +}): Promise; diff --git a/e-commerce/node_modules/next/dist/lib/turbopack-warning.js b/e-commerce/node_modules/next/dist/lib/turbopack-warning.js new file mode 100644 index 0000000000000000000000000000000000000000..77afa86cc061349b6f582401e9655c034031ce1e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/turbopack-warning.js @@ -0,0 +1,185 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "validateTurboNextConfig", { + enumerable: true, + get: function() { + return validateTurboNextConfig; + } +}); +const _config = /*#__PURE__*/ _interop_require_default(require("../server/config")); +const _log = /*#__PURE__*/ _interop_require_wildcard(require("../build/output/log")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +const unsupportedTurbopackNextConfigOptions = [ + // Left to be implemented (priority) + // 'experimental.clientRouterFilter', + // 'experimental.optimizePackageImports', + // 'compiler.emotion', + // 'compiler.reactRemoveProperties', + // 'compiler.relay', + // 'compiler.removeConsole', + // 'compiler.styledComponents', + 'experimental.fetchCacheKeyPrefix', + // Left to be implemented + // 'excludeDefaultMomentLocales', + // 'experimental.optimizeServerReact', + 'experimental.clientRouterFilterAllowedRate', + // 'experimental.serverMinification', + // 'experimental.serverSourceMaps', + 'experimental.allowedRevalidateHeaderKeys', + 'experimental.extensionAlias', + 'experimental.fallbackNodePolyfills', + 'experimental.swcTraceProfiling', + // Left to be implemented (Might not be needed for Turbopack) + 'experimental.craCompat', + 'experimental.disablePostcssPresetEnv', + 'experimental.esmExternals', + // This is used to force swc-loader to run regardless of finding Babel. + 'experimental.forceSwcTransforms', + 'experimental.fullySpecified', + 'experimental.urlImports', + 'experimental.slowModuleDetection' +]; +async function validateTurboNextConfig({ dir, configPhase }) { + const { defaultConfig } = require('../server/config-shared'); + const { cyan, red, underline } = require('../lib/picocolors'); + const { interopDefault } = require('../lib/interop-default'); + let unsupportedParts = ''; + let hasWebpackConfig = false; + let hasTurboConfig = false; + const unsupportedConfig = []; + let rawNextConfig = {}; + try { + rawNextConfig = interopDefault(await (0, _config.default)(configPhase, dir, { + rawConfig: true + })); + if (typeof rawNextConfig === 'function') { + rawNextConfig = rawNextConfig(configPhase, { + defaultConfig + }); + } + hasWebpackConfig = Boolean(rawNextConfig.webpack); + hasTurboConfig = Boolean(rawNextConfig.turbopack); + const flattenKeys = (obj, prefix = '')=>{ + let keys = []; + for(const key in obj){ + const value = obj == null ? void 0 : obj[key]; + if (typeof value === 'undefined') { + continue; + } + const pre = prefix.length ? `${prefix}.` : ''; + if (typeof value === 'object' && !Array.isArray(value) && value !== null) { + keys = keys.concat(flattenKeys(value, pre + key)); + } else { + keys.push(pre + key); + } + } + return keys; + }; + const getDeepValue = (obj, keys)=>{ + if (typeof keys === 'string') { + keys = keys.split('.'); + } + if (keys.length === 1) { + return obj == null ? void 0 : obj[keys == null ? void 0 : keys[0]]; + } + return getDeepValue(obj == null ? void 0 : obj[keys == null ? void 0 : keys[0]], keys.slice(1)); + }; + const customKeys = flattenKeys(rawNextConfig); + for (const key of customKeys){ + if (key.startsWith('experimental.turbo')) { + hasTurboConfig = true; + } + const isUnsupported = unsupportedTurbopackNextConfigOptions.some((unsupportedKey)=>// Either the key matches (or is a more specific subkey) of + // unsupportedKey, or the key is the path to a specific subkey. + // | key | unsupportedKey | + // |---------|----------------| + // | foo | foo | + // | foo.bar | foo | + // | foo | foo.bar | + key.startsWith(unsupportedKey) || unsupportedKey.startsWith(`${key}.`)) && getDeepValue(rawNextConfig, key) !== getDeepValue(defaultConfig, key); + if (isUnsupported) { + unsupportedConfig.push(key); + } + } + } catch (e) { + _log.error('Unexpected error occurred while checking config', e); + } + // If the build was defaulted to Turbopack, we want to warn about possibly ignored webpack + // configuration. Otherwise the user explicitly picked turbopack and thus we expect that + // they have configured it correctly. + if (process.env.TURBOPACK === 'auto' && hasWebpackConfig && !hasTurboConfig) { + const configFile = rawNextConfig.configFileName ?? 'your Next config file'; + _log.error(`ERROR: This build is using Turbopack, with a \`webpack\` config and no \`turbopack\` config. + This may be a mistake. + + As of Next.js 16 Turbopack is enabled by default and + custom webpack configurations may need to be migrated to Turbopack. + + NOTE: your \`webpack\` config may have been added by a configuration plugin. + + To configure Turbopack, see https://nextjs.org/docs/app/api-reference/next-config-js/turbopack + + TIP: Many applications work fine under Turbopack with no configuration, + if that is the case for you, you can silence this error by passing the + \`--turbopack\` or \`--webpack\` flag explicitly or simply setting an + empty turbopack config in ${configFile} (e.g. \`turbopack: {}\`).`); + process.exit(1); + } + if (unsupportedConfig.length) { + unsupportedParts += `\n\n- Unsupported Next.js configuration option(s) (${cyan('next.config.js')})\n Turbopack will ignore the following configuration options:\n${unsupportedConfig.map((name)=>` - ${red(name)}\n`).join('')}`; + } + if (unsupportedParts) { + _log.error(`You are using configuration and/or tools that are not yet\nsupported by Next.js with Turbopack:\n${unsupportedParts}\n`); + _log.warn('Learn more about how to configure Turbopack with Next.js:\n' + underline('https://nextjs.org/docs/app/api-reference/config/next-config-js/turbopack')); + } + return rawNextConfig; +} + +//# sourceMappingURL=turbopack-warning.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/turbopack-warning.js.map b/e-commerce/node_modules/next/dist/lib/turbopack-warning.js.map new file mode 100644 index 0000000000000000000000000000000000000000..65071ecbfb0ee815de0fb6576131511a157ef69d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/turbopack-warning.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/turbopack-warning.ts"],"sourcesContent":["import type { NextConfigComplete } from '../server/config-shared'\nimport loadConfig from '../server/config'\nimport * as Log from '../build/output/log'\n\nconst unsupportedTurbopackNextConfigOptions = [\n // Left to be implemented (priority)\n // 'experimental.clientRouterFilter',\n // 'experimental.optimizePackageImports',\n // 'compiler.emotion',\n // 'compiler.reactRemoveProperties',\n // 'compiler.relay',\n // 'compiler.removeConsole',\n // 'compiler.styledComponents',\n 'experimental.fetchCacheKeyPrefix',\n\n // Left to be implemented\n // 'excludeDefaultMomentLocales',\n // 'experimental.optimizeServerReact',\n 'experimental.clientRouterFilterAllowedRate',\n // 'experimental.serverMinification',\n // 'experimental.serverSourceMaps',\n\n 'experimental.allowedRevalidateHeaderKeys',\n 'experimental.extensionAlias',\n 'experimental.fallbackNodePolyfills',\n\n 'experimental.swcTraceProfiling',\n\n // Left to be implemented (Might not be needed for Turbopack)\n 'experimental.craCompat',\n 'experimental.disablePostcssPresetEnv',\n 'experimental.esmExternals',\n // This is used to force swc-loader to run regardless of finding Babel.\n 'experimental.forceSwcTransforms',\n 'experimental.fullySpecified',\n 'experimental.urlImports',\n 'experimental.slowModuleDetection',\n]\n\n/** */\nexport async function validateTurboNextConfig({\n dir,\n configPhase,\n}: {\n dir: string\n configPhase: Parameters[0]\n}) {\n const { defaultConfig } =\n require('../server/config-shared') as typeof import('../server/config-shared')\n const { cyan, red, underline } =\n require('../lib/picocolors') as typeof import('../lib/picocolors')\n const { interopDefault } =\n require('../lib/interop-default') as typeof import('../lib/interop-default')\n\n let unsupportedParts = ''\n\n let hasWebpackConfig = false\n let hasTurboConfig = false\n\n const unsupportedConfig: string[] = []\n let rawNextConfig: NextConfigComplete = {} as NextConfigComplete\n\n try {\n rawNextConfig = interopDefault(\n await loadConfig(configPhase, dir, {\n rawConfig: true,\n })\n )\n\n if (typeof rawNextConfig === 'function') {\n rawNextConfig = (rawNextConfig as any)(configPhase, {\n defaultConfig,\n })\n }\n hasWebpackConfig = Boolean(rawNextConfig.webpack)\n hasTurboConfig = Boolean(rawNextConfig.turbopack)\n\n const flattenKeys = (obj: any, prefix: string = ''): string[] => {\n let keys: string[] = []\n\n for (const key in obj) {\n const value = obj?.[key]\n if (typeof value === 'undefined') {\n continue\n }\n\n const pre = prefix.length ? `${prefix}.` : ''\n\n if (\n typeof value === 'object' &&\n !Array.isArray(value) &&\n value !== null\n ) {\n keys = keys.concat(flattenKeys(value, pre + key))\n } else {\n keys.push(pre + key)\n }\n }\n\n return keys\n }\n\n const getDeepValue = (obj: any, keys: string | string[]): any => {\n if (typeof keys === 'string') {\n keys = keys.split('.')\n }\n if (keys.length === 1) {\n return obj?.[keys?.[0]]\n }\n return getDeepValue(obj?.[keys?.[0]], keys.slice(1))\n }\n\n const customKeys = flattenKeys(rawNextConfig)\n\n for (const key of customKeys) {\n if (key.startsWith('experimental.turbo')) {\n hasTurboConfig = true\n }\n\n const isUnsupported =\n unsupportedTurbopackNextConfigOptions.some(\n (unsupportedKey) =>\n // Either the key matches (or is a more specific subkey) of\n // unsupportedKey, or the key is the path to a specific subkey.\n // | key | unsupportedKey |\n // |---------|----------------|\n // | foo | foo |\n // | foo.bar | foo |\n // | foo | foo.bar |\n key.startsWith(unsupportedKey) ||\n unsupportedKey.startsWith(`${key}.`)\n ) &&\n getDeepValue(rawNextConfig, key) !== getDeepValue(defaultConfig, key)\n\n if (isUnsupported) {\n unsupportedConfig.push(key)\n }\n }\n } catch (e) {\n Log.error('Unexpected error occurred while checking config', e)\n }\n\n // If the build was defaulted to Turbopack, we want to warn about possibly ignored webpack\n // configuration. Otherwise the user explicitly picked turbopack and thus we expect that\n // they have configured it correctly.\n if (process.env.TURBOPACK === 'auto' && hasWebpackConfig && !hasTurboConfig) {\n const configFile = rawNextConfig.configFileName ?? 'your Next config file'\n Log.error(\n `ERROR: This build is using Turbopack, with a \\`webpack\\` config and no \\`turbopack\\` config.\n This may be a mistake.\n\n As of Next.js 16 Turbopack is enabled by default and\n custom webpack configurations may need to be migrated to Turbopack.\n\n NOTE: your \\`webpack\\` config may have been added by a configuration plugin.\n\n To configure Turbopack, see https://nextjs.org/docs/app/api-reference/next-config-js/turbopack\n\n TIP: Many applications work fine under Turbopack with no configuration,\n if that is the case for you, you can silence this error by passing the\n \\`--turbopack\\` or \\`--webpack\\` flag explicitly or simply setting an \n empty turbopack config in ${configFile} (e.g. \\`turbopack: {}\\`).`\n )\n\n process.exit(1)\n }\n\n if (unsupportedConfig.length) {\n unsupportedParts += `\\n\\n- Unsupported Next.js configuration option(s) (${cyan(\n 'next.config.js'\n )})\\n Turbopack will ignore the following configuration options:\\n${unsupportedConfig\n .map((name) => ` - ${red(name)}\\n`)\n .join('')}`\n }\n\n if (unsupportedParts) {\n Log.error(\n `You are using configuration and/or tools that are not yet\\nsupported by Next.js with Turbopack:\\n${unsupportedParts}\\n`\n )\n\n Log.warn(\n 'Learn more about how to configure Turbopack with Next.js:\\n' +\n underline(\n 'https://nextjs.org/docs/app/api-reference/config/next-config-js/turbopack'\n )\n )\n }\n\n return rawNextConfig\n}\n"],"names":["validateTurboNextConfig","unsupportedTurbopackNextConfigOptions","dir","configPhase","defaultConfig","require","cyan","red","underline","interopDefault","unsupportedParts","hasWebpackConfig","hasTurboConfig","unsupportedConfig","rawNextConfig","loadConfig","rawConfig","Boolean","webpack","turbopack","flattenKeys","obj","prefix","keys","key","value","pre","length","Array","isArray","concat","push","getDeepValue","split","slice","customKeys","startsWith","isUnsupported","some","unsupportedKey","e","Log","error","process","env","TURBOPACK","configFile","configFileName","exit","map","name","join","warn"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AK,UAAUlC,oBAAoB,CAACC,gBAAgB;QAC3E,MAAMkC,aAAahC,cAAciC,cAAc,IAAI;QACnDN,KAAIC,KAAK,CACP,CAAC;;;;;;;;;;;;;6BAasB,EAAEI,WAAW,0BAA0B,CAAC;QAGjEH,QAAQK,IAAI,CAAC;IACf;IAEA,IAAInC,kBAAkBc,MAAM,EAAE;QAC5BjB,oBAAoB,CAAC,mDAAmD,EAAEJ,KACxE,kBACA,iEAAiE,EAAEO,kBAClEoC,GAAG,CAAC,CAACC,OAAS,CAAC,MAAM,EAAE3C,IAAI2C,MAAM,EAAE,CAAC,EACpCC,IAAI,CAAC,KAAK;IACf;IAEA,IAAIzC,kBAAkB;QACpB+B,KAAIC,KAAK,CACP,CAAC,iGAAiG,EAAEhC,iBAAiB,EAAE,CAAC;QAG1H+B,KAAIW,IAAI,CACN,gEACE5C,UACE;IAGR;IAEA,OAAOM;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/diagnosticFormatter.d.ts b/e-commerce/node_modules/next/dist/lib/typescript/diagnosticFormatter.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bedff370bf5158f19cabe1cd4630913649fc1d3b --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/diagnosticFormatter.d.ts @@ -0,0 +1 @@ +export declare function getFormattedDiagnostic(ts: typeof import('typescript'), baseDir: string, distDir: string, diagnostic: import('typescript').Diagnostic, isAppDirEnabled?: boolean): string; diff --git a/e-commerce/node_modules/next/dist/lib/typescript/diagnosticFormatter.js b/e-commerce/node_modules/next/dist/lib/typescript/diagnosticFormatter.js new file mode 100644 index 0000000000000000000000000000000000000000..764d8d126176508b3a1e3e1dd15e89867e2ef589 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/diagnosticFormatter.js @@ -0,0 +1,243 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "getFormattedDiagnostic", { + enumerable: true, + get: function() { + return getFormattedDiagnostic; + } +}); +const _codeframe = require("../../shared/lib/errors/code-frame"); +const _picocolors = require("../picocolors"); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function getFormattedLinkDiagnosticMessageText(diagnostic) { + const message = diagnostic.messageText; + if (typeof message === 'string' && diagnostic.code === 2322) { + const match = message.match(/Type '"(.+)"' is not assignable to type 'RouteImpl<.+> \| UrlObject'\./) || message.match(/Type '"(.+)"' is not assignable to type 'UrlObject \| RouteImpl<.+>'\./); + if (match) { + const [, href] = match; + return `"${(0, _picocolors.bold)(href)}" is not an existing route. If it is intentional, please type it explicitly with \`as Route\`.`; + } else if (message === "Type 'string' is not assignable to type 'UrlObject'.") { + var _diagnostic_relatedInformation_, _diagnostic_relatedInformation; + const relatedMessage = (_diagnostic_relatedInformation = diagnostic.relatedInformation) == null ? void 0 : (_diagnostic_relatedInformation_ = _diagnostic_relatedInformation[0]) == null ? void 0 : _diagnostic_relatedInformation_.messageText; + if (typeof relatedMessage === 'string' && relatedMessage.match(/The expected type comes from property 'href' which is declared here on type 'IntrinsicAttributes & /)) { + return `Invalid \`href\` property of \`Link\`: the route does not exist. If it is intentional, please type it explicitly with \`as Route\`.`; + } + } + } else if (typeof message === 'string' && diagnostic.code === 2820) { + const match = message.match(/Type '"(.+)"' is not assignable to type 'RouteImpl<.+> \| UrlObject'\. Did you mean '"(.+)"'?/) || message.match(/Type '"(.+)"' is not assignable to type 'UrlObject \| RouteImpl<.+>'\. Did you mean '"(.+)"'?/); + if (match) { + const [, href, suggestion] = match; + return `"${(0, _picocolors.bold)(href)}" is not an existing route. Did you mean "${(0, _picocolors.bold)(suggestion)}" instead? If it is intentional, please type it explicitly with \`as Route\`.`; + } + } +} +function getFormattedLayoutAndPageDiagnosticMessageText(relativeSourceFilepath, diagnostic) { + const message = typeof diagnostic.messageText === 'string' ? diagnostic : diagnostic.messageText; + const messageText = message.messageText; + if (typeof messageText === 'string') { + const type = /page\.[^.]+$/.test(relativeSourceFilepath) ? 'Page' : /route\.[^.]+$/.test(relativeSourceFilepath) ? 'Route' : 'Layout'; + // Reference of error codes: + // https://github.com/Microsoft/TypeScript/blob/main/src/compiler/diagnosticMessages.json + switch(message.code){ + case 2344: + const filepathAndType = messageText.match(/typeof import\("(.+)"\)/); + if (filepathAndType) { + let main = `${type} "${(0, _picocolors.bold)(relativeSourceFilepath)}" does not match the required types of a Next.js ${type}.`; + function processNext(indent, next) { + if (!next) return; + for (const item of next){ + switch(item.code){ + case 2200: + const mismatchedField = item.messageText.match(/The types of '(.+)'/); + if (mismatchedField) { + main += '\n' + ' '.repeat(indent * 2); + main += `"${(0, _picocolors.bold)(mismatchedField[1])}" has the wrong type:`; + } + break; + case 2322: + const types = item.messageText.match(/Type '(.+)' is not assignable to type '(.+)'./); + if (types) { + main += '\n' + ' '.repeat(indent * 2); + if (types[2] === 'PageComponent' || types[2] === 'LayoutComponent') { + main += `The exported ${type} component isn't correctly typed.`; + } else { + main += `Expected "${(0, _picocolors.bold)(types[2].replace('"__invalid_negative_number__"', 'number (>= 0)'))}", got "${(0, _picocolors.bold)(types[1])}".`; + } + } + break; + case 2326: + const invalidConfig = item.messageText.match(/Types of property '(.+)' are incompatible\./); + main += '\n' + ' '.repeat(indent * 2); + main += `Invalid configuration${invalidConfig ? ` "${(0, _picocolors.bold)(invalidConfig[1])}"` : ''}:`; + break; + case 2530: + const invalidField = item.messageText.match(/Property '(.+)' is incompatible with index signature/); + if (invalidField) { + main += '\n' + ' '.repeat(indent * 2); + main += `"${(0, _picocolors.bold)(invalidField[1])}" is not a valid ${type} export field.`; + } + return; + case 2739: + const invalidProp = item.messageText.match(/Type '(.+)' is missing the following properties from type '(.+)'/); + if (invalidProp) { + if (invalidProp[1] === 'LayoutProps' || invalidProp[1] === 'PageProps') { + main += '\n' + ' '.repeat(indent * 2); + main += `Prop "${invalidProp[2]}" is incompatible with the ${type}.`; + } + } + break; + case 2559: + const invalid = item.messageText.match(/Type '(.+)' has/); + if (invalid) { + main += '\n' + ' '.repeat(indent * 2); + main += `Type "${(0, _picocolors.bold)(invalid[1])}" isn't allowed.`; + } + break; + case 2741: + const incompatPageProp = item.messageText.match(/Property '(.+)' is missing in type 'PageProps'/); + if (incompatPageProp) { + main += '\n' + ' '.repeat(indent * 2); + main += `Prop "${(0, _picocolors.bold)(incompatPageProp[1])}" will never be passed. Remove it from the component's props.`; + } else { + const extraLayoutProp = item.messageText.match(/Property '(.+)' is missing in type 'LayoutProps' but required in type '(.+)'/); + if (extraLayoutProp) { + main += '\n' + ' '.repeat(indent * 2); + main += `Prop "${(0, _picocolors.bold)(extraLayoutProp[1])}" is not valid for this Layout, remove it to fix.`; + } + } + break; + default: + } + processNext(indent + 1, item.next); + } + } + if ('next' in message) processNext(1, message.next); + return main; + } + const invalidExportFnArg = messageText.match(/Type 'OmitWithTag<(.+), .+, "(.+)">' does not satisfy the constraint/); + if (invalidExportFnArg) { + const main = `${type} "${(0, _picocolors.bold)(relativeSourceFilepath)}" has an invalid "${(0, _picocolors.bold)(invalidExportFnArg[2])}" export:\n Type "${(0, _picocolors.bold)(invalidExportFnArg[1])}" is not valid.`; + return main; + } + function processNextItems(indent, next) { + if (!next) return ''; + let result = ''; + for (const item of next){ + switch(item.code){ + case 2322: + const types = item.messageText.match(/Type '(.+)' is not assignable to type '(.+)'./); + if (types) { + result += '\n' + ' '.repeat(indent * 2); + result += `Expected "${(0, _picocolors.bold)(types[2])}", got "${(0, _picocolors.bold)(types[1])}".`; + } + break; + default: + } + result += processNextItems(indent + 1, item.next); + } + return result; + } + const invalidParamFn = messageText.match(/Type '{ __tag__: (.+); __param_position__: "(.*)"; __param_type__: (.+); }' does not satisfy/); + if (invalidParamFn) { + let main = `${type} "${(0, _picocolors.bold)(relativeSourceFilepath)}" has an invalid ${invalidParamFn[1]} export:\n Type "${(0, _picocolors.bold)(invalidParamFn[3])}" is not a valid type for the function's ${invalidParamFn[2]} argument.`; + if ('next' in message) main += processNextItems(1, message.next); + return main; + } + const invalidExportFnReturn = messageText.match(/Type '{ __tag__: "(.+)"; __return_type__: (.+); }' does not satisfy/); + if (invalidExportFnReturn) { + let main = `${type} "${(0, _picocolors.bold)(relativeSourceFilepath)}" has an invalid export:\n "${(0, _picocolors.bold)(invalidExportFnReturn[2])}" is not a valid ${invalidExportFnReturn[1]} return type:`; + if ('next' in message) main += processNextItems(1, message.next); + return main; + } + break; + case 2345: + const filepathAndInvalidExport = messageText.match(/'typeof import\("(.+)"\)'.+Impossible<"(.+)">/); + if (filepathAndInvalidExport) { + const main = `${type} "${(0, _picocolors.bold)(relativeSourceFilepath)}" exports an invalid "${(0, _picocolors.bold)(filepathAndInvalidExport[2])}" field. ${type} should only export a default React component and configuration options. Learn more: https://nextjs.org/docs/messages/invalid-segment-export`; + return main; + } + break; + case 2559: + const invalid = messageText.match(/Type '(.+)' has no properties in common with type '(.+)'/); + if (invalid) { + const main = `${type} "${(0, _picocolors.bold)(relativeSourceFilepath)}" contains an invalid type "${(0, _picocolors.bold)(invalid[1])}" as ${invalid[2]}.`; + return main; + } + break; + default: + } + } +} +function getAppEntrySourceFilePath(baseDir, diagnostic) { + var _diagnostic_file_text_trim_match, _diagnostic_file; + const sourceFilepath = ((_diagnostic_file = diagnostic.file) == null ? void 0 : (_diagnostic_file_text_trim_match = _diagnostic_file.text.trim().match(/^\/\/ File: (.+)\n/)) == null ? void 0 : _diagnostic_file_text_trim_match[1]) || ''; + return _path.default.relative(baseDir, sourceFilepath); +} +function getFormattedDiagnostic(ts, baseDir, distDir, diagnostic, isAppDirEnabled) { + var _diagnostic_file; + // If the error comes from .next/types/, we handle it specially. + const isLayoutOrPageError = isAppDirEnabled && ((_diagnostic_file = diagnostic.file) == null ? void 0 : _diagnostic_file.fileName.startsWith(_path.default.join(baseDir, distDir, 'types'))); + let message = ''; + const appPath = isLayoutOrPageError ? getAppEntrySourceFilePath(baseDir, diagnostic) : null; + const linkReason = getFormattedLinkDiagnosticMessageText(diagnostic); + const appReason = !linkReason && isLayoutOrPageError && appPath ? getFormattedLayoutAndPageDiagnosticMessageText(appPath, diagnostic) : null; + const reason = linkReason || appReason || ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); + const category = diagnostic.category; + switch(category){ + // Warning + case ts.DiagnosticCategory.Warning: + { + message += (0, _picocolors.yellow)((0, _picocolors.bold)('Type warning')) + ': '; + break; + } + // Error + case ts.DiagnosticCategory.Error: + { + message += (0, _picocolors.red)((0, _picocolors.bold)('Type error')) + ': '; + break; + } + // 2 = Suggestion, 3 = Message + case ts.DiagnosticCategory.Suggestion: + case ts.DiagnosticCategory.Message: + message += (0, _picocolors.cyan)((0, _picocolors.bold)(category === 2 ? 'Suggestion' : 'Info')) + ': '; + break; + default: + { + category; + } + } + message += reason + '\n'; + if (!isLayoutOrPageError && diagnostic.file) { + const pos = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + const line = pos.line + 1; + const character = pos.character + 1; + let fileName = _path.default.posix.normalize(_path.default.relative(baseDir, diagnostic.file.fileName).replace(/\\/g, '/')); + if (!fileName.startsWith('.')) { + fileName = './' + fileName; + } + message = (0, _picocolors.cyan)(fileName) + ':' + (0, _picocolors.yellow)(line.toString()) + ':' + (0, _picocolors.yellow)(character.toString()) + '\n' + message; + const codeFrame = (0, _codeframe.codeFrameColumns)(diagnostic.file.getFullText(diagnostic.file.getSourceFile()), { + start: { + line: line, + column: character + } + }, { + color: true + }); + if (codeFrame) { + message += '\n' + codeFrame; + } + } else if (isLayoutOrPageError && appPath) { + message = (0, _picocolors.cyan)(appPath) + '\n' + message; + } + return message; +} + +//# sourceMappingURL=diagnosticFormatter.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/diagnosticFormatter.js.map b/e-commerce/node_modules/next/dist/lib/typescript/diagnosticFormatter.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ac012756e7f6aeebb2003b8d1f3b2d914f5c0cc9 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/diagnosticFormatter.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/typescript/diagnosticFormatter.ts"],"sourcesContent":["import { codeFrameColumns } from '../../shared/lib/errors/code-frame'\nimport { bold, cyan, red, yellow } from '../picocolors'\nimport path from 'path'\n\nfunction getFormattedLinkDiagnosticMessageText(\n diagnostic: import('typescript').Diagnostic\n) {\n const message = diagnostic.messageText\n if (typeof message === 'string' && diagnostic.code === 2322) {\n const match =\n message.match(\n /Type '\"(.+)\"' is not assignable to type 'RouteImpl<.+> \\| UrlObject'\\./\n ) ||\n message.match(\n /Type '\"(.+)\"' is not assignable to type 'UrlObject \\| RouteImpl<.+>'\\./\n )\n\n if (match) {\n const [, href] = match\n return `\"${bold(\n href\n )}\" is not an existing route. If it is intentional, please type it explicitly with \\`as Route\\`.`\n } else if (\n message === \"Type 'string' is not assignable to type 'UrlObject'.\"\n ) {\n const relatedMessage = diagnostic.relatedInformation?.[0]?.messageText\n if (\n typeof relatedMessage === 'string' &&\n relatedMessage.match(\n /The expected type comes from property 'href' which is declared here on type 'IntrinsicAttributes & /\n )\n ) {\n return `Invalid \\`href\\` property of \\`Link\\`: the route does not exist. If it is intentional, please type it explicitly with \\`as Route\\`.`\n }\n }\n } else if (typeof message === 'string' && diagnostic.code === 2820) {\n const match =\n message.match(\n /Type '\"(.+)\"' is not assignable to type 'RouteImpl<.+> \\| UrlObject'\\. Did you mean '\"(.+)\"'?/\n ) ||\n message.match(\n /Type '\"(.+)\"' is not assignable to type 'UrlObject \\| RouteImpl<.+>'\\. Did you mean '\"(.+)\"'?/\n )\n\n if (match) {\n const [, href, suggestion] = match\n return `\"${bold(href)}\" is not an existing route. Did you mean \"${bold(\n suggestion\n )}\" instead? If it is intentional, please type it explicitly with \\`as Route\\`.`\n }\n }\n}\n\nfunction getFormattedLayoutAndPageDiagnosticMessageText(\n relativeSourceFilepath: string,\n diagnostic: import('typescript').Diagnostic\n) {\n const message =\n typeof diagnostic.messageText === 'string'\n ? diagnostic\n : diagnostic.messageText\n const messageText = message.messageText\n\n if (typeof messageText === 'string') {\n const type = /page\\.[^.]+$/.test(relativeSourceFilepath)\n ? 'Page'\n : /route\\.[^.]+$/.test(relativeSourceFilepath)\n ? 'Route'\n : 'Layout'\n\n // Reference of error codes:\n // https://github.com/Microsoft/TypeScript/blob/main/src/compiler/diagnosticMessages.json\n switch (message.code) {\n case 2344:\n const filepathAndType = messageText.match(/typeof import\\(\"(.+)\"\\)/)\n if (filepathAndType) {\n let main = `${type} \"${bold(\n relativeSourceFilepath\n )}\" does not match the required types of a Next.js ${type}.`\n\n function processNext(\n indent: number,\n next?: import('typescript').DiagnosticMessageChain[]\n ) {\n if (!next) return\n\n for (const item of next) {\n switch (item.code) {\n case 2200:\n const mismatchedField =\n item.messageText.match(/The types of '(.+)'/)\n if (mismatchedField) {\n main += '\\n' + ' '.repeat(indent * 2)\n main += `\"${bold(mismatchedField[1])}\" has the wrong type:`\n }\n break\n case 2322:\n const types = item.messageText.match(\n /Type '(.+)' is not assignable to type '(.+)'./\n )\n if (types) {\n main += '\\n' + ' '.repeat(indent * 2)\n\n if (\n types[2] === 'PageComponent' ||\n types[2] === 'LayoutComponent'\n ) {\n main += `The exported ${type} component isn't correctly typed.`\n } else {\n main += `Expected \"${bold(\n types[2].replace(\n '\"__invalid_negative_number__\"',\n 'number (>= 0)'\n )\n )}\", got \"${bold(types[1])}\".`\n }\n }\n break\n case 2326:\n const invalidConfig = item.messageText.match(\n /Types of property '(.+)' are incompatible\\./\n )\n main += '\\n' + ' '.repeat(indent * 2)\n main += `Invalid configuration${\n invalidConfig ? ` \"${bold(invalidConfig[1])}\"` : ''\n }:`\n break\n case 2530:\n const invalidField = item.messageText.match(\n /Property '(.+)' is incompatible with index signature/\n )\n if (invalidField) {\n main += '\\n' + ' '.repeat(indent * 2)\n main += `\"${bold(\n invalidField[1]\n )}\" is not a valid ${type} export field.`\n }\n return\n case 2739:\n const invalidProp = item.messageText.match(\n /Type '(.+)' is missing the following properties from type '(.+)'/\n )\n if (invalidProp) {\n if (\n invalidProp[1] === 'LayoutProps' ||\n invalidProp[1] === 'PageProps'\n ) {\n main += '\\n' + ' '.repeat(indent * 2)\n main += `Prop \"${invalidProp[2]}\" is incompatible with the ${type}.`\n }\n }\n break\n case 2559:\n const invalid = item.messageText.match(/Type '(.+)' has/)\n if (invalid) {\n main += '\\n' + ' '.repeat(indent * 2)\n main += `Type \"${bold(invalid[1])}\" isn't allowed.`\n }\n break\n case 2741:\n const incompatPageProp = item.messageText.match(\n /Property '(.+)' is missing in type 'PageProps'/\n )\n if (incompatPageProp) {\n main += '\\n' + ' '.repeat(indent * 2)\n main += `Prop \"${bold(\n incompatPageProp[1]\n )}\" will never be passed. Remove it from the component's props.`\n } else {\n const extraLayoutProp = item.messageText.match(\n /Property '(.+)' is missing in type 'LayoutProps' but required in type '(.+)'/\n )\n if (extraLayoutProp) {\n main += '\\n' + ' '.repeat(indent * 2)\n main += `Prop \"${bold(\n extraLayoutProp[1]\n )}\" is not valid for this Layout, remove it to fix.`\n }\n }\n break\n default:\n }\n\n processNext(indent + 1, item.next)\n }\n }\n\n if ('next' in message) processNext(1, message.next)\n return main\n }\n\n const invalidExportFnArg = messageText.match(\n /Type 'OmitWithTag<(.+), .+, \"(.+)\">' does not satisfy the constraint/\n )\n if (invalidExportFnArg) {\n const main = `${type} \"${bold(\n relativeSourceFilepath\n )}\" has an invalid \"${bold(\n invalidExportFnArg[2]\n )}\" export:\\n Type \"${bold(invalidExportFnArg[1])}\" is not valid.`\n return main\n }\n\n function processNextItems(\n indent: number,\n next?: import('typescript').DiagnosticMessageChain[]\n ) {\n if (!next) return ''\n\n let result = ''\n\n for (const item of next) {\n switch (item.code) {\n case 2322:\n const types = item.messageText.match(\n /Type '(.+)' is not assignable to type '(.+)'./\n )\n if (types) {\n result += '\\n' + ' '.repeat(indent * 2)\n result += `Expected \"${bold(types[2])}\", got \"${bold(\n types[1]\n )}\".`\n }\n break\n default:\n }\n\n result += processNextItems(indent + 1, item.next)\n }\n\n return result\n }\n\n const invalidParamFn = messageText.match(\n /Type '{ __tag__: (.+); __param_position__: \"(.*)\"; __param_type__: (.+); }' does not satisfy/\n )\n if (invalidParamFn) {\n let main = `${type} \"${bold(\n relativeSourceFilepath\n )}\" has an invalid ${invalidParamFn[1]} export:\\n Type \"${bold(\n invalidParamFn[3]\n )}\" is not a valid type for the function's ${\n invalidParamFn[2]\n } argument.`\n\n if ('next' in message) main += processNextItems(1, message.next)\n return main\n }\n\n const invalidExportFnReturn = messageText.match(\n /Type '{ __tag__: \"(.+)\"; __return_type__: (.+); }' does not satisfy/\n )\n if (invalidExportFnReturn) {\n let main = `${type} \"${bold(\n relativeSourceFilepath\n )}\" has an invalid export:\\n \"${bold(\n invalidExportFnReturn[2]\n )}\" is not a valid ${invalidExportFnReturn[1]} return type:`\n\n if ('next' in message) main += processNextItems(1, message.next)\n return main\n }\n\n break\n case 2345:\n const filepathAndInvalidExport = messageText.match(\n /'typeof import\\(\"(.+)\"\\)'.+Impossible<\"(.+)\">/\n )\n if (filepathAndInvalidExport) {\n const main = `${type} \"${bold(\n relativeSourceFilepath\n )}\" exports an invalid \"${bold(\n filepathAndInvalidExport[2]\n )}\" field. ${type} should only export a default React component and configuration options. Learn more: https://nextjs.org/docs/messages/invalid-segment-export`\n return main\n }\n break\n case 2559:\n const invalid = messageText.match(\n /Type '(.+)' has no properties in common with type '(.+)'/\n )\n if (invalid) {\n const main = `${type} \"${bold(\n relativeSourceFilepath\n )}\" contains an invalid type \"${bold(invalid[1])}\" as ${invalid[2]}.`\n return main\n }\n break\n default:\n }\n }\n}\n\nfunction getAppEntrySourceFilePath(\n baseDir: string,\n diagnostic: import('typescript').Diagnostic\n) {\n const sourceFilepath =\n diagnostic.file?.text.trim().match(/^\\/\\/ File: (.+)\\n/)?.[1] || ''\n\n return path.relative(baseDir, sourceFilepath)\n}\n\nexport function getFormattedDiagnostic(\n ts: typeof import('typescript'),\n baseDir: string,\n distDir: string,\n diagnostic: import('typescript').Diagnostic,\n isAppDirEnabled?: boolean\n): string {\n // If the error comes from .next/types/, we handle it specially.\n const isLayoutOrPageError =\n isAppDirEnabled &&\n diagnostic.file?.fileName.startsWith(path.join(baseDir, distDir, 'types'))\n\n let message = ''\n\n const appPath = isLayoutOrPageError\n ? getAppEntrySourceFilePath(baseDir, diagnostic)\n : null\n const linkReason = getFormattedLinkDiagnosticMessageText(diagnostic)\n const appReason =\n !linkReason && isLayoutOrPageError && appPath\n ? getFormattedLayoutAndPageDiagnosticMessageText(appPath, diagnostic)\n : null\n\n const reason =\n linkReason ||\n appReason ||\n ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n')\n const category = diagnostic.category\n switch (category) {\n // Warning\n case ts.DiagnosticCategory.Warning: {\n message += yellow(bold('Type warning')) + ': '\n break\n }\n // Error\n case ts.DiagnosticCategory.Error: {\n message += red(bold('Type error')) + ': '\n break\n }\n // 2 = Suggestion, 3 = Message\n case ts.DiagnosticCategory.Suggestion:\n case ts.DiagnosticCategory.Message:\n message += cyan(bold(category === 2 ? 'Suggestion' : 'Info')) + ': '\n break\n default: {\n category satisfies never\n }\n }\n\n message += reason + '\\n'\n\n if (!isLayoutOrPageError && diagnostic.file) {\n const pos = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start!)\n const line = pos.line + 1\n const character = pos.character + 1\n\n let fileName = path.posix.normalize(\n path.relative(baseDir, diagnostic.file.fileName).replace(/\\\\/g, '/')\n )\n if (!fileName.startsWith('.')) {\n fileName = './' + fileName\n }\n\n message =\n cyan(fileName) +\n ':' +\n yellow(line.toString()) +\n ':' +\n yellow(character.toString()) +\n '\\n' +\n message\n\n const codeFrame = codeFrameColumns(\n diagnostic.file.getFullText(diagnostic.file.getSourceFile()),\n {\n start: { line: line, column: character },\n },\n { color: true }\n )\n if (codeFrame) {\n message += '\\n' + codeFrame\n }\n } else if (isLayoutOrPageError && appPath) {\n message = cyan(appPath) + '\\n' + message\n }\n\n return message\n}\n"],"names":["getFormattedDiagnostic","getFormattedLinkDiagnosticMessageText","diagnostic","message","messageText","code","match","href","bold","relatedMessage","relatedInformation","suggestion","getFormattedLayoutAndPageDiagnosticMessageText","relativeSourceFilepath","type","test","filepathAndType","main","processNext","indent","next","item","mismatchedField","repeat","types","replace","invalidConfig","invalidField","invalidProp","invalid","incompatPageProp","extraLayoutProp","invalidExportFnArg","processNextItems","result","invalidParamFn","invalidExportFnReturn","filepathAndInvalidExport","getAppEntrySourceFilePath","baseDir","sourceFilepath","file","text","trim","path","relative","ts","distDir","isAppDirEnabled","isLayoutOrPageError","fileName","startsWith","join","appPath","linkReason","appReason","reason","flattenDiagnosticMessageText","category","DiagnosticCategory","Warning","yellow","Error","red","Suggestion","Message","cyan","pos","getLineAndCharacterOfPosition","start","line","character","posix","normalize","toString","codeFrame","codeFrameColumns","getFullText","getSourceFile","column","color"],"mappings":";;;;+BA+SgBA;;;eAAAA;;;2BA/SiB;4BACO;6DACvB;;;;;;AAEjB,SAASC,sCACPC,UAA2C;IAE3C,MAAMC,UAAUD,WAAWE,WAAW;IACtC,IAAI,OAAOD,YAAY,YAAYD,WAAWG,IAAI,KAAK,MAAM;QAC3D,MAAMC,QACJH,QAAQG,KAAK,CACX,6EAEFH,QAAQG,KAAK,CACX;QAGJ,IAAIA,OAAO;YACT,MAAM,GAAGC,KAAK,GAAGD;YACjB,OAAO,CAAC,CAAC,EAAEE,IAAAA,gBAAI,EACbD,MACA,8FAA8F,CAAC;QACnG,OAAO,IACLJ,YAAY,wDACZ;gBACuBD,iCAAAA;YAAvB,MAAMO,kBAAiBP,iCAAAA,WAAWQ,kBAAkB,sBAA7BR,kCAAAA,8BAA+B,CAAC,EAAE,qBAAlCA,gCAAoCE,WAAW;YACtE,IACE,OAAOK,mBAAmB,YAC1BA,eAAeH,KAAK,CAClB,wGAEF;gBACA,OAAO,CAAC,mIAAmI,CAAC;YAC9I;QACF;IACF,OAAO,IAAI,OAAOH,YAAY,YAAYD,WAAWG,IAA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,kBAAM,EAACS,KAAKI,QAAQ,MACpB,MACAb,IAAAA,kBAAM,EAACU,UAAUG,QAAQ,MACzB,OACAvE;QAEF,MAAMwE,YAAYC,IAAAA,2BAAgB,EAChC1E,WAAWuC,IAAI,CAACoC,WAAW,CAAC3E,WAAWuC,IAAI,CAACqC,aAAa,KACzD;YACET,OAAO;gBAAEC,MAAMA;gBAAMS,QAAQR;YAAU;QACzC,GACA;YAAES,OAAO;QAAK;QAEhB,IAAIL,WAAW;YACbxE,WAAW,OAAOwE;QACpB;IACF,OAAO,IAAI1B,uBAAuBI,SAAS;QACzClD,UAAU+D,IAAAA,gBAAI,EAACb,WAAW,OAAOlD;IACnC;IAEA,OAAOA;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/getTypeScriptConfiguration.d.ts b/e-commerce/node_modules/next/dist/lib/typescript/getTypeScriptConfiguration.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b89a13569e75b04025c31bd1c27ad6565f69d8f8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/getTypeScriptConfiguration.d.ts @@ -0,0 +1 @@ +export declare function getTypeScriptConfiguration(typescript: typeof import('typescript'), tsConfigPath: string, metaOnly?: boolean): Promise; diff --git a/e-commerce/node_modules/next/dist/lib/typescript/getTypeScriptConfiguration.js b/e-commerce/node_modules/next/dist/lib/typescript/getTypeScriptConfiguration.js new file mode 100644 index 0000000000000000000000000000000000000000..ba2259650499fa9a5ed65d6614ef2945b2562ed2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/getTypeScriptConfiguration.js @@ -0,0 +1,61 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "getTypeScriptConfiguration", { + enumerable: true, + get: function() { + return getTypeScriptConfiguration; + } +}); +const _picocolors = require("../picocolors"); +const _os = /*#__PURE__*/ _interop_require_default(require("os")); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +const _iserror = /*#__PURE__*/ _interop_require_default(require("../is-error")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +async function getTypeScriptConfiguration(typescript, tsConfigPath, metaOnly) { + try { + var _result_errors; + const formatDiagnosticsHost = { + getCanonicalFileName: (fileName)=>fileName, + getCurrentDirectory: typescript.sys.getCurrentDirectory, + getNewLine: ()=>_os.default.EOL + }; + const { config, error } = typescript.readConfigFile(tsConfigPath, typescript.sys.readFile); + if (error) { + throw new Error(typescript.formatDiagnostic(error, formatDiagnosticsHost)); + } + let configToParse = config; + const result = typescript.parseJsonConfigFileContent(configToParse, // When only interested in meta info, + // avoid enumerating all files (for performance reasons) + metaOnly ? { + ...typescript.sys, + readDirectory (_path, extensions, _excludes, _includes, _depth) { + return [ + extensions ? `file${extensions[0]}` : `file.ts` + ]; + } + } : typescript.sys, _path.default.dirname(tsConfigPath)); + if (result.errors) { + result.errors = result.errors.filter(({ code })=>// No inputs were found in config file + code !== 18003); + } + if ((_result_errors = result.errors) == null ? void 0 : _result_errors.length) { + // TODO: Throw AggregateError for all diagnostics. + throw new Error(typescript.formatDiagnostic(result.errors[0], formatDiagnosticsHost)); + } + return result; + } catch (err) { + if ((0, _iserror.default)(err) && err.name === 'SyntaxError') { + const reason = '\n' + (err.message ?? ''); + throw new Error((0, _picocolors.bold)('Could not parse' + (0, _picocolors.cyan)('tsconfig.json') + '.' + ' Please make sure it contains syntactically correct JSON.') + reason); + } + throw err; + } +} + +//# sourceMappingURL=getTypeScriptConfiguration.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/getTypeScriptConfiguration.js.map b/e-commerce/node_modules/next/dist/lib/typescript/getTypeScriptConfiguration.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ed205b94fd4c96e1c3663ee79b25d14b0641eadb --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/getTypeScriptConfiguration.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/typescript/getTypeScriptConfiguration.ts"],"sourcesContent":["import { bold, cyan } from '../picocolors'\nimport os from 'os'\nimport path from 'path'\n\nimport isError from '../is-error'\n\nexport async function getTypeScriptConfiguration(\n typescript: typeof import('typescript'),\n tsConfigPath: string,\n metaOnly?: boolean\n): Promise {\n try {\n const formatDiagnosticsHost: import('typescript').FormatDiagnosticsHost = {\n getCanonicalFileName: (fileName: string) => fileName,\n getCurrentDirectory: typescript.sys.getCurrentDirectory,\n getNewLine: () => os.EOL,\n }\n\n const { config, error } = typescript.readConfigFile(\n tsConfigPath,\n typescript.sys.readFile\n )\n if (error) {\n throw new Error(typescript.formatDiagnostic(error, formatDiagnosticsHost))\n }\n\n let configToParse: any = config\n\n const result = typescript.parseJsonConfigFileContent(\n configToParse,\n // When only interested in meta info,\n // avoid enumerating all files (for performance reasons)\n metaOnly\n ? {\n ...typescript.sys,\n readDirectory(_path, extensions, _excludes, _includes, _depth) {\n return [extensions ? `file${extensions[0]}` : `file.ts`]\n },\n }\n : typescript.sys,\n path.dirname(tsConfigPath)\n )\n\n if (result.errors) {\n result.errors = result.errors.filter(\n ({ code }) =>\n // No inputs were found in config file\n code !== 18003\n )\n }\n\n if (result.errors?.length) {\n // TODO: Throw AggregateError for all diagnostics.\n throw new Error(\n typescript.formatDiagnostic(result.errors[0], formatDiagnosticsHost)\n )\n }\n\n return result\n } catch (err) {\n if (isError(err) && err.name === 'SyntaxError') {\n const reason = '\\n' + (err.message ?? '')\n throw new Error(\n bold(\n 'Could not parse' +\n cyan('tsconfig.json') +\n '.' +\n ' Please make sure it contains syntactically correct JSON.'\n ) + reason\n )\n }\n throw err\n }\n}\n"],"names":["getTypeScriptConfiguration","typescript","tsConfigPath","metaOnly","result","formatDiagnosticsHost","getCanonicalFileName","fileName","getCurrentDirectory","sys","getNewLine","os","EOL","config","error","readConfigFile","readFile","Error","formatDiagnostic","configToParse","parseJsonConfigFileContent","readDirectory","_path","extensions","_excludes","_includes","_depth","path","dirname","errors","filter","code","length","err","isError","name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6B,KAAK;QACZ,IAAIC,IAAAA,gBAAO,EAACD,QAAQA,IAAIE,IAAI,KAAK,eAAe;YAC9C,MAAMC,SAAS,OAAQH,CAAAA,IAAII,OAAO,IAAI,EAAC;YACvC,MAAM,IAAIpB,MACRqB,IAAAA,gBAAI,EACF,oBACEC,IAAAA,gBAAI,EAAC,mBACL,MACA,+DACAH;QAER;QACA,MAAMH;IACR;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/getTypeScriptIntent.d.ts b/e-commerce/node_modules/next/dist/lib/typescript/getTypeScriptIntent.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c935ae7b14809a33b703ac22537cacd305a69c12 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/getTypeScriptIntent.d.ts @@ -0,0 +1,4 @@ +export type TypeScriptIntent = { + firstTimeSetup: boolean; +}; +export declare function getTypeScriptIntent(baseDir: string, intentDirs: string[], tsconfigPath: string): Promise; diff --git a/e-commerce/node_modules/next/dist/lib/typescript/getTypeScriptIntent.js b/e-commerce/node_modules/next/dist/lib/typescript/getTypeScriptIntent.js new file mode 100644 index 0000000000000000000000000000000000000000..41fdc83381d27ff7eb697d3c8766381d0b80d8e3 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/getTypeScriptIntent.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "getTypeScriptIntent", { + enumerable: true, + get: function() { + return getTypeScriptIntent; + } +}); +const _fs = require("fs"); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +const _recursivereaddir = require("../recursive-readdir"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +async function getTypeScriptIntent(baseDir, intentDirs, tsconfigPath) { + const resolvedTsConfigPath = _path.default.join(baseDir, tsconfigPath); + // The integration turns on if we find a `tsconfig.json` in the user's + // project. + const hasTypeScriptConfiguration = (0, _fs.existsSync)(resolvedTsConfigPath); + if (hasTypeScriptConfiguration) { + const content = (0, _fs.readFileSync)(resolvedTsConfigPath, { + encoding: 'utf8' + }).trim(); + return { + firstTimeSetup: content === '' || content === '{}' + }; + } + // Next.js also offers a friendly setup mode that bootstraps a TypeScript + // project for the user when we detect TypeScript files. So, we need to check + // the `pages/` directory for a TypeScript file. + // Checking all directories is too slow, so this is a happy medium. + const tsFilesRegex = /.*\.(ts|tsx)$/; + const excludedRegex = /(node_modules|.*\.d\.ts$)/; + for (const dir of intentDirs){ + const typescriptFiles = await (0, _recursivereaddir.recursiveReadDir)(dir, { + pathnameFilter: (name)=>tsFilesRegex.test(name), + ignoreFilter: (name)=>excludedRegex.test(name) + }); + if (typescriptFiles.length) { + return { + firstTimeSetup: true + }; + } + } + return false; +} + +//# sourceMappingURL=getTypeScriptIntent.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/getTypeScriptIntent.js.map b/e-commerce/node_modules/next/dist/lib/typescript/getTypeScriptIntent.js.map new file mode 100644 index 0000000000000000000000000000000000000000..2abbdc7b1ea953ffa2d31fa691db2e0dded79da0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/getTypeScriptIntent.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/typescript/getTypeScriptIntent.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'fs'\nimport path from 'path'\nimport { recursiveReadDir } from '../recursive-readdir'\n\nexport type TypeScriptIntent = { firstTimeSetup: boolean }\n\nexport async function getTypeScriptIntent(\n baseDir: string,\n intentDirs: string[],\n tsconfigPath: string\n): Promise {\n const resolvedTsConfigPath = path.join(baseDir, tsconfigPath)\n\n // The integration turns on if we find a `tsconfig.json` in the user's\n // project.\n const hasTypeScriptConfiguration = existsSync(resolvedTsConfigPath)\n if (hasTypeScriptConfiguration) {\n const content = readFileSync(resolvedTsConfigPath, {\n encoding: 'utf8',\n }).trim()\n\n return { firstTimeSetup: content === '' || content === '{}' }\n }\n\n // Next.js also offers a friendly setup mode that bootstraps a TypeScript\n // project for the user when we detect TypeScript files. So, we need to check\n // the `pages/` directory for a TypeScript file.\n // Checking all directories is too slow, so this is a happy medium.\n const tsFilesRegex = /.*\\.(ts|tsx)$/\n const excludedRegex = /(node_modules|.*\\.d\\.ts$)/\n for (const dir of intentDirs) {\n const typescriptFiles = await recursiveReadDir(dir, {\n pathnameFilter: (name) => tsFilesRegex.test(name),\n ignoreFilter: (name) => excludedRegex.test(name),\n })\n if (typescriptFiles.length) {\n return { firstTimeSetup: true }\n }\n }\n\n return false\n}\n"],"names":["getTypeScriptIntent","baseDir","intentDirs","tsconfigPath","resolvedTsConfigPath","path","join","hasTypeScriptConfiguration","existsSync","content","readFileSync","encoding","trim","firstTimeSetup","tsFilesRegex","excludedRegex","dir","typescriptFiles","recursiveReadDir","pathnameFilter","name","test","ignoreFilter","length"],"mappings":";;;;+BAMsBA;;;eAAAA;;;oBANmB;6DACxB;kCACgB;;;;;;AAI1B,eAAeA,oBACpBC,OAAe,EACfC,UAAoB,EACpBC,YAAoB;IAEpB,MAAMC,uBAAuBC,aAAI,CAACC,IAAI,CAACL,SAASE;IAEhD,sEAAsE;IACtE,WAAW;IACX,MAAMI,6BAA6BC,IAAAA,cAAU,EAACJ;IAC9C,IAAIG,4BAA4B;QAC9B,MAAME,UAAUC,IAAAA,gBAAY,EAACN,sBAAsB;YACjDO,UAAU;QACZ,GAAGC,IAAI;QAEP,OAAO;YAAEC,gBAAgBJ,YAAY,MAAMA,YAAY;QAAK;IAC9D;IAEA,yEAAyE;IACzE,6EAA6E;IAC7E,gDAAgD;IAChD,mEAAmE;IACnE,MAAMK,eAAe;IACrB,MAAMC,gBAAgB;IACtB,KAAK,MAAMC,OAAOd,WAAY;QAC5B,MAAMe,kBAAkB,MAAMC,IAAAA,kCAAgB,EAACF,KAAK;YAClDG,gBAAgB,CAACC,OAASN,aAAaO,IAAI,CAACD;YAC5CE,cAAc,CAACF,OAASL,cAAcM,IAAI,CAACD;QAC7C;QACA,IAAIH,gBAAgBM,MAAM,EAAE;YAC1B,OAAO;gBAAEV,gBAAgB;YAAK;QAChC;IACF;IAEA,OAAO;AACT","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/loadTsConfig.d.ts b/e-commerce/node_modules/next/dist/lib/typescript/loadTsConfig.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ec6a69420767b6b5311b5d6fa4f9023e8c06b4d8 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/loadTsConfig.d.ts @@ -0,0 +1,13 @@ +export type RelevantCompilerOptions = { + paths?: Record; + /** Absolute path for an explicitly configured baseUrl. */ + baseUrl?: string; + /** Absolute directory containing an inherited paths option without baseUrl. */ + pathsBasePath?: string; +}; +/** + * Loads only the tsconfig options Next.js needs outside of the TypeScript API. + * Paths and baseUrl keep the directory they were declared in while resolving + * an extends chain, including arrays of extended configs. + */ +export declare function loadTsConfigOptions(configPath: string): RelevantCompilerOptions; diff --git a/e-commerce/node_modules/next/dist/lib/typescript/loadTsConfig.js b/e-commerce/node_modules/next/dist/lib/typescript/loadTsConfig.js new file mode 100644 index 0000000000000000000000000000000000000000..0188e1f0f7708d8e4e67188286c827546c33375a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/loadTsConfig.js @@ -0,0 +1,181 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "loadTsConfigOptions", { + enumerable: true, + get: function() { + return loadTsConfigOptions; + } +}); +const _nodefs = require("node:fs"); +const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path")); +const _commentjson = /*#__PURE__*/ _interop_require_wildcard(require("next/dist/compiled/comment-json")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +function resolveConfigDirValue(value, configDir, rootConfigDir) { + return _nodepath.default.resolve(configDir, value.replace(/\$\{configDir\}/g, rootConfigDir)); +} +function resolveConfigFile(candidate) { + for (const configPath of [ + candidate, + candidate.endsWith('.json') ? undefined : candidate + '.json' + ]){ + if (configPath && (0, _nodefs.existsSync)(configPath) && (0, _nodefs.statSync)(configPath).isFile()) { + return configPath; + } + } +} +function resolvePackageTsConfig(extendsPath, currentConfigDir) { + const parts = extendsPath.split('/'); + const isPackageRoot = extendsPath.startsWith('@') ? parts.length === 2 : parts.length === 1; + if (!isPackageRoot) { + return undefined; + } + try { + const packageJsonPath = require.resolve(extendsPath + '/package.json', { + paths: [ + currentConfigDir + ] + }); + const packageJson = JSON.parse((0, _nodefs.readFileSync)(packageJsonPath, 'utf8')); + if (packageJson.exports !== undefined) { + try { + const exportedConfig = require.resolve(extendsPath, { + paths: [ + currentConfigDir + ] + }); + if (_nodepath.default.extname(exportedConfig) === '.json') { + return exportedConfig; + } + } catch {} + } + if (typeof packageJson.tsconfig === 'string') { + return resolveConfigFile(_nodepath.default.resolve(_nodepath.default.dirname(packageJsonPath), packageJson.tsconfig)); + } + return resolveConfigFile(_nodepath.default.join(_nodepath.default.dirname(packageJsonPath), 'tsconfig')); + } catch {} +} +function resolveExtends(extendsPath, currentConfigDir) { + if (extendsPath.startsWith('./') || extendsPath.startsWith('../') || _nodepath.default.isAbsolute(extendsPath)) { + const resolved = _nodepath.default.resolve(currentConfigDir, extendsPath); + if ((0, _nodefs.existsSync)(resolved)) { + return resolved; + } + if (!resolved.endsWith('.json') && (0, _nodefs.existsSync)(resolved + '.json')) { + return resolved + '.json'; + } + return resolved; + } + const packageConfigPath = resolvePackageTsConfig(extendsPath, currentConfigDir); + if (packageConfigPath) { + return packageConfigPath; + } + try { + const resolved = require.resolve(extendsPath, { + paths: [ + currentConfigDir + ] + }); + if (_nodepath.default.extname(resolved) === '.json') { + return resolved; + } + } catch {} + try { + return require.resolve(extendsPath + '/tsconfig.json', { + paths: [ + currentConfigDir + ] + }); + } catch { + return _nodepath.default.resolve(currentConfigDir, extendsPath); + } +} +function loadTsConfigOptionsRecursive(configPath, visited, rootConfigDir) { + const resolvedPath = _nodepath.default.resolve(configPath); + if (visited.has(resolvedPath) || !(0, _nodefs.existsSync)(resolvedPath)) { + return {}; + } + const nextVisited = new Set(visited); + nextVisited.add(resolvedPath); + const configContent = (0, _nodefs.readFileSync)(resolvedPath, 'utf8'); + const config = _commentjson.parse(configContent); + const configDir = _nodepath.default.dirname(resolvedPath); + let mergedOptions = {}; + if (config.extends) { + const extendsList = Array.isArray(config.extends) ? config.extends : [ + config.extends + ]; + for (const extendsPath of extendsList){ + const parentConfigPath = resolveExtends(extendsPath, configDir); + const parentOptions = loadTsConfigOptionsRecursive(parentConfigPath, nextVisited, rootConfigDir); + mergedOptions = { + ...mergedOptions, + ...parentOptions + }; + } + } + const currentOptions = config.compilerOptions ?? {}; + if (Object.hasOwn(currentOptions, 'paths')) { + mergedOptions.paths = currentOptions.paths; + mergedOptions.pathsBasePath = configDir; + } + if (Object.hasOwn(currentOptions, 'baseUrl') && typeof currentOptions.baseUrl === 'string') { + mergedOptions.baseUrl = resolveConfigDirValue(currentOptions.baseUrl, configDir, rootConfigDir); + } + if (mergedOptions.baseUrl) { + mergedOptions.pathsBasePath = undefined; + } + return mergedOptions; +} +function loadTsConfigOptions(configPath) { + const resolvedPath = _nodepath.default.resolve(configPath); + return loadTsConfigOptionsRecursive(resolvedPath, new Set(), _nodepath.default.dirname(resolvedPath)); +} + +//# sourceMappingURL=loadTsConfig.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/loadTsConfig.js.map b/e-commerce/node_modules/next/dist/lib/typescript/loadTsConfig.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c620d6b7c0473d17796fb15ec61416ed7fb21264 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/loadTsConfig.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/typescript/loadTsConfig.ts"],"sourcesContent":["import { existsSync, readFileSync, statSync } from 'node:fs'\nimport path from 'node:path'\n\nimport * as CommentJson from 'next/dist/compiled/comment-json'\n\nexport type RelevantCompilerOptions = {\n paths?: Record\n /** Absolute path for an explicitly configured baseUrl. */\n baseUrl?: string\n /** Absolute directory containing an inherited paths option without baseUrl. */\n pathsBasePath?: string\n}\n\nfunction resolveConfigDirValue(\n value: string,\n configDir: string,\n rootConfigDir: string\n): string {\n return path.resolve(\n configDir,\n value.replace(/\\$\\{configDir\\}/g, rootConfigDir)\n )\n}\n\nfunction resolveConfigFile(candidate: string): string | undefined {\n for (const configPath of [\n candidate,\n candidate.endsWith('.json') ? undefined : candidate + '.json',\n ]) {\n if (configPath && existsSync(configPath) && statSync(configPath).isFile()) {\n return configPath\n }\n }\n}\n\nfunction resolvePackageTsConfig(\n extendsPath: string,\n currentConfigDir: string\n): string | undefined {\n const parts = extendsPath.split('/')\n const isPackageRoot = extendsPath.startsWith('@')\n ? parts.length === 2\n : parts.length === 1\n\n if (!isPackageRoot) {\n return undefined\n }\n\n try {\n const packageJsonPath = require.resolve(extendsPath + '/package.json', {\n paths: [currentConfigDir],\n })\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'))\n if (packageJson.exports !== undefined) {\n try {\n const exportedConfig = require.resolve(extendsPath, {\n paths: [currentConfigDir],\n })\n if (path.extname(exportedConfig) === '.json') {\n return exportedConfig\n }\n } catch {}\n }\n if (typeof packageJson.tsconfig === 'string') {\n return resolveConfigFile(\n path.resolve(path.dirname(packageJsonPath), packageJson.tsconfig)\n )\n }\n return resolveConfigFile(\n path.join(path.dirname(packageJsonPath), 'tsconfig')\n )\n } catch {}\n}\n\nfunction resolveExtends(extendsPath: string, currentConfigDir: string): string {\n if (\n extendsPath.startsWith('./') ||\n extendsPath.startsWith('../') ||\n path.isAbsolute(extendsPath)\n ) {\n const resolved = path.resolve(currentConfigDir, extendsPath)\n if (existsSync(resolved)) {\n return resolved\n }\n if (!resolved.endsWith('.json') && existsSync(resolved + '.json')) {\n return resolved + '.json'\n }\n return resolved\n }\n\n const packageConfigPath = resolvePackageTsConfig(\n extendsPath,\n currentConfigDir\n )\n if (packageConfigPath) {\n return packageConfigPath\n }\n\n try {\n const resolved = require.resolve(extendsPath, { paths: [currentConfigDir] })\n if (path.extname(resolved) === '.json') {\n return resolved\n }\n } catch {}\n\n try {\n return require.resolve(extendsPath + '/tsconfig.json', {\n paths: [currentConfigDir],\n })\n } catch {\n return path.resolve(currentConfigDir, extendsPath)\n }\n}\n\nfunction loadTsConfigOptionsRecursive(\n configPath: string,\n visited: Set,\n rootConfigDir: string\n): RelevantCompilerOptions {\n const resolvedPath = path.resolve(configPath)\n\n if (visited.has(resolvedPath) || !existsSync(resolvedPath)) {\n return {}\n }\n\n const nextVisited = new Set(visited)\n nextVisited.add(resolvedPath)\n\n const configContent = readFileSync(resolvedPath, 'utf8')\n const config = CommentJson.parse(configContent)\n const configDir = path.dirname(resolvedPath)\n\n let mergedOptions: RelevantCompilerOptions = {}\n\n if (config.extends) {\n const extendsList = Array.isArray(config.extends)\n ? config.extends\n : [config.extends]\n\n for (const extendsPath of extendsList) {\n const parentConfigPath = resolveExtends(extendsPath, configDir)\n const parentOptions = loadTsConfigOptionsRecursive(\n parentConfigPath,\n nextVisited,\n rootConfigDir\n )\n mergedOptions = { ...mergedOptions, ...parentOptions }\n }\n }\n\n const currentOptions = config.compilerOptions ?? {}\n\n if (Object.hasOwn(currentOptions, 'paths')) {\n mergedOptions.paths = currentOptions.paths\n mergedOptions.pathsBasePath = configDir\n }\n\n if (\n Object.hasOwn(currentOptions, 'baseUrl') &&\n typeof currentOptions.baseUrl === 'string'\n ) {\n mergedOptions.baseUrl = resolveConfigDirValue(\n currentOptions.baseUrl,\n configDir,\n rootConfigDir\n )\n }\n\n if (mergedOptions.baseUrl) {\n mergedOptions.pathsBasePath = undefined\n }\n\n return mergedOptions\n}\n\n/**\n * Loads only the tsconfig options Next.js needs outside of the TypeScript API.\n * Paths and baseUrl keep the directory they were declared in while resolving\n * an extends chain, including arrays of extended configs.\n */\nexport function loadTsConfigOptions(\n configPath: string\n): RelevantCompilerOptions {\n const resolvedPath = path.resolve(configPath)\n return loadTsConfigOptionsRecursive(\n resolvedPath,\n new Set(),\n path.dirname(resolvedPath)\n )\n}\n"],"names":["loadTsConfigOptions","resolveConfigDirValue","value","configDir","rootConfigDir","path","resolve","replace","resolveConfigFile","candidate","configPath","endsWith","undefined","existsSync","statSync","isFile","resolvePackageTsConfig","extendsPath","currentConfigDir","parts","split","isPackageRoot","startsWith","length","packageJsonPath","require","paths","packageJson","JSON","parse","readFileSync","exports","exportedConfig","extname","tsconfig","dirname","join","resolveExtends","isAbsolute","resolved","packageConfigPath","loadTsConfigOptionsRecursive","visited","resolvedPath","has","nextVisited","Set","add","configContent","config","CommentJson","mergedOptions","extends","extendsList","Array","isArray","parentConfigPath","parentOptions","currentOptions","compilerOptions","Object","hasOwn","pathsBasePath","baseUrl"],"mappings":";;;;+BAoLgBA;;;eAAAA;;;wBApLmC;iEAClC;qEAEY;;;;;;;;;;;;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jD,MAAMM,SAASC,aAAYrB,KAAK,CAACmB;IACjC,MAAM7C,YAAYE,iBAAI,CAAC8B,OAAO,CAACQ;IAE/B,IAAIQ,gBAAyC,CAAC;IAE9C,IAAIF,OAAOG,OAAO,EAAE;QAClB,MAAMC,cAAcC,MAAMC,OAAO,CAACN,OAAOG,OAAO,IAC5CH,OAAOG,OAAO,GACd;YAACH,OAAOG,OAAO;SAAC;QAEpB,KAAK,MAAMnC,eAAeoC,YAAa;YACrC,MAAMG,mBAAmBnB,eAAepB,aAAad;YACrD,MAAMsD,gBAAgBhB,6BACpBe,kBACAX,aACAzC;YAEF+C,gBAAgB;gBAAE,GAAGA,aAAa;gBAAE,GAAGM,aAAa;YAAC;QACvD;IACF;IAEA,MAAMC,iBAAiBT,OAAOU,eAAe,IAAI,CAAC;IAElD,IAAIC,OAAOC,MAAM,CAACH,gBAAgB,UAAU;QAC1CP,cAAczB,KAAK,GAAGgC,eAAehC,KAAK;QAC1CyB,cAAcW,aAAa,GAAG3D;IAChC;IAEA,IACEyD,OAAOC,MAAM,CAACH,gBAAgB,cAC9B,OAAOA,eAAeK,OAAO,KAAK,UAClC;QACAZ,cAAcY,OAAO,GAAG9D,sBACtByD,eAAeK,OAAO,EACtB5D,WACAC;IAEJ;IAEA,IAAI+C,cAAcY,OAAO,EAAE;QACzBZ,cAAcW,aAAa,GAAGlD;IAChC;IAEA,OAAOuC;AACT;AAOO,SAASnD,oBACdU,UAAkB;IAElB,MAAMiC,eAAetC,iBAAI,CAACC,OAAO,CAACI;IAClC,OAAO+B,6BACLE,cACA,IAAIG,OACJzC,iBAAI,CAAC8B,OAAO,CAACQ;AAEjB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/missingDependencyError.d.ts b/e-commerce/node_modules/next/dist/lib/typescript/missingDependencyError.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5e42fce15f720b6d81a99472516c9e1bb4bf3a6c --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/missingDependencyError.d.ts @@ -0,0 +1,2 @@ +import type { MissingDependency } from '../has-necessary-dependencies'; +export declare function missingDepsError(dir: string, missingPackages: MissingDependency[]): never; diff --git a/e-commerce/node_modules/next/dist/lib/typescript/missingDependencyError.js b/e-commerce/node_modules/next/dist/lib/typescript/missingDependencyError.js new file mode 100644 index 0000000000000000000000000000000000000000..7faa823ef9face9ee221555a0e150c79d3fc9380 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/missingDependencyError.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "missingDepsError", { + enumerable: true, + get: function() { + return missingDepsError; + } +}); +const _picocolors = require("../picocolors"); +const _oxfordcommalist = require("../oxford-comma-list"); +const _getpkgmanager = require("../helpers/get-pkg-manager"); +function missingDepsError(dir, missingPackages) { + const packagesHuman = (0, _oxfordcommalist.getOxfordCommaList)(missingPackages.map((p)=>p.pkg)); + const packagesCli = missingPackages.map((p)=>p.install ?? p.pkg).join(' '); + const packageManager = (0, _getpkgmanager.getPkgManager)(dir); + const removalMsg = '\n\n' + (0, _picocolors.bold)('If you are not trying to use TypeScript, please remove the ' + (0, _picocolors.cyan)('tsconfig.json') + ' file from your package root (and any TypeScript files in your app and pages directories).'); + throw new Error((0, _picocolors.bold)((0, _picocolors.red)(`It looks like you're trying to use TypeScript but do not have the required package(s) installed.`)) + '\n\n' + (0, _picocolors.bold)(`Please install ${(0, _picocolors.bold)(packagesHuman)} by running:`) + '\n\n' + `\t${(0, _picocolors.bold)((0, _picocolors.cyan)((packageManager === 'yarn' ? 'yarn add --dev' : packageManager === 'pnpm' ? 'pnpm install --save-dev' : 'npm install --save-dev') + ' ' + packagesCli))}` + removalMsg + '\n'); +} + +//# sourceMappingURL=missingDependencyError.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/missingDependencyError.js.map b/e-commerce/node_modules/next/dist/lib/typescript/missingDependencyError.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7029362652e7a371cc9323cbe371c7acd4a801cb --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/missingDependencyError.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/typescript/missingDependencyError.ts"],"sourcesContent":["import { bold, cyan, red } from '../picocolors'\n\nimport { getOxfordCommaList } from '../oxford-comma-list'\nimport type { MissingDependency } from '../has-necessary-dependencies'\nimport { getPkgManager } from '../helpers/get-pkg-manager'\n\nexport function missingDepsError(\n dir: string,\n missingPackages: MissingDependency[]\n): never {\n const packagesHuman = getOxfordCommaList(missingPackages.map((p) => p.pkg))\n const packagesCli = missingPackages.map((p) => p.install ?? p.pkg).join(' ')\n const packageManager = getPkgManager(dir)\n\n const removalMsg =\n '\\n\\n' +\n bold(\n 'If you are not trying to use TypeScript, please remove the ' +\n cyan('tsconfig.json') +\n ' file from your package root (and any TypeScript files in your app and pages directories).'\n )\n\n throw new Error(\n bold(\n red(\n `It looks like you're trying to use TypeScript but do not have the required package(s) installed.`\n )\n ) +\n '\\n\\n' +\n bold(`Please install ${bold(packagesHuman)} by running:`) +\n '\\n\\n' +\n `\\t${bold(\n cyan(\n (packageManager === 'yarn'\n ? 'yarn add --dev'\n : packageManager === 'pnpm'\n ? 'pnpm install --save-dev'\n : 'npm install --save-dev') +\n ' ' +\n packagesCli\n )\n )}` +\n removalMsg +\n '\\n'\n )\n}\n"],"names":["missingDepsError","dir","missingPackages","packagesHuman","getOxfordCommaList","map","p","pkg","packagesCli","install","join","packageManager","getPkgManager","removalMsg","bold","cyan","Error","red"],"mappings":";;;;+BAMgBA;;;eAAAA;;;4BANgB;iCAEG;+BAEL;AAEvB,SAASA,iBACdC,GAAW,EACXC,eAAoC;IAEpC,MAAMC,gBAAgBC,IAAAA,mCAAkB,EAACF,gBAAgBG,GAAG,CAAC,CAACC,IAAMA,EAAEC,GAAG;IACzE,MAAMC,cAAcN,gBAAgBG,GAAG,CAAC,CAACC,IAAMA,EAAEG,OAAO,IAAIH,EAAEC,GAAG,EAAEG,IAAI,CAAC;IACxE,MAAMC,iBAAiBC,IAAAA,4BAAa,EAACX;IAErC,MAAMY,aACJ,SACAC,IAAAA,gBAAI,EACF,gEACEC,IAAAA,gBAAI,EAAC,mBACL;IAGN,MAAM,IAAIC,MACRF,IAAAA,gBAAI,EACFG,IAAAA,eAAG,EACD,CAAC,gGAAgG,CAAC,KAGpG,SACAH,IAAAA,gBAAI,EAAC,CAAC,eAAe,EAAEA,IAAAA,gBAAI,EAACX,eAAe,YAAY,CAAC,IACxD,SACA,CAAC,EAAE,EAAEW,IAAAA,gBAAI,EACPC,IAAAA,gBAAI,EACF,AAACJ,CAAAA,mBAAmB,SAChB,mBACAA,mBAAmB,SACjB,4BACA,wBAAuB,IAC3B,MACAH,eAEH,GACHK,aACA;AAEN","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/runTypeCheck.d.ts b/e-commerce/node_modules/next/dist/lib/typescript/runTypeCheck.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6af44106c59e71f95cb433bc757782a5228db193 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/runTypeCheck.d.ts @@ -0,0 +1,14 @@ +export interface TypeCheckResult { + inputFilesCount?: number; + totalFilesCount?: number; + incremental: boolean; +} +export interface TypeCheckDirs { + app?: string; + pages?: string; +} +export interface DebugBuildPaths { + app?: string[]; + pages?: string[]; +} +export declare function runTypeCheck(typescript: typeof import('typescript'), baseDir: string, distDir: string, tsConfigPath: string, cacheDir?: string, isAppDirEnabled?: boolean, dirs?: TypeCheckDirs, debugBuildPaths?: DebugBuildPaths): Promise; diff --git a/e-commerce/node_modules/next/dist/lib/typescript/runTypeCheck.js b/e-commerce/node_modules/next/dist/lib/typescript/runTypeCheck.js new file mode 100644 index 0000000000000000000000000000000000000000..1881a1de3572f2f36d99b3d4a34ec9c4ab03fef1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/runTypeCheck.js @@ -0,0 +1,141 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "runTypeCheck", { + enumerable: true, + get: function() { + return runTypeCheck; + } +}); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +const _diagnosticFormatter = require("./diagnosticFormatter"); +const _getTypeScriptConfiguration = require("./getTypeScriptConfiguration"); +const _writeConfigurationDefaults = require("./writeConfigurationDefaults"); +const _typepaths = require("./type-paths"); +const _compileerror = require("../compile-error"); +const _log = require("../../build/output/log"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +/** + * Check if a file path matches any of the debug build paths. + * Both filePath and debugPaths are resolved file paths from glob. + */ function fileMatchesDebugPaths(filePath, debugPaths) { + return debugPaths.includes(filePath); +} +async function runTypeCheck(typescript, baseDir, distDir, tsConfigPath, cacheDir, isAppDirEnabled, dirs, debugBuildPaths) { + const effectiveConfiguration = await (0, _getTypeScriptConfiguration.getTypeScriptConfiguration)(typescript, tsConfigPath); + // tsconfig includes both .next/types and .next/dev/types to avoid config churn + // between dev/build modes. During build, we filter out .next/dev/types files to + // prevent stale dev types from causing errors when routes have been deleted since + // the last dev session. + let fileNames = effectiveConfiguration.fileNames; + // Get the dev types path to filter (null if not applicable) + const devTypesDir = (0, _typepaths.getDevTypesPath)(baseDir, distDir); + if (devTypesDir) { + fileNames = fileNames.filter((fileName)=>!fileName.startsWith(devTypesDir)); + } + // Apply debug build paths filter if specified + if (dirs && debugBuildPaths) { + const { app: appDir, pages: pagesDir } = dirs; + const { app: debugAppPaths, pages: debugPagePaths } = debugBuildPaths; + fileNames = fileNames.filter((fileName)=>{ + // Check if file is in app directory + if (appDir && fileName.startsWith(appDir + _path.default.sep)) { + // If debugAppPaths is undefined, include all app files + if (debugAppPaths === undefined) { + return true; + } + // If debugAppPaths is empty array, exclude all app files + if (debugAppPaths.length === 0) { + return false; + } + // Check if file matches any of the debug paths + const relativeToApp = fileName.slice(appDir.length); + return fileMatchesDebugPaths(relativeToApp, debugAppPaths); + } + // Check if file is in pages directory + if (pagesDir && fileName.startsWith(pagesDir + _path.default.sep)) { + // If debugPagePaths is undefined, include all pages files + if (debugPagePaths === undefined) { + return true; + } + // If debugPagePaths is empty array, exclude all pages files + if (debugPagePaths.length === 0) { + return false; + } + // Check if file matches any of the debug paths + const relativeToPages = fileName.slice(pagesDir.length); + return fileMatchesDebugPaths(relativeToPages, debugPagePaths); + } + // Keep files outside app/pages directories (shared code, etc.) + return true; + }); + } + if (fileNames.length < 1) { + return { + inputFilesCount: 0, + totalFilesCount: 0, + incremental: false + }; + } + const requiredConfig = (0, _writeConfigurationDefaults.getRequiredConfiguration)(typescript); + const options = { + ...requiredConfig, + ...effectiveConfiguration.options, + declarationMap: false, + emitDeclarationOnly: false, + noEmit: true + }; + let program; + let incremental = false; + if ((options.incremental || options.composite) && cacheDir) { + if (options.composite) { + (0, _log.warn)('TypeScript project references are not fully supported. Attempting to build in incremental mode.'); + } + incremental = true; + program = typescript.createIncrementalProgram({ + rootNames: fileNames, + options: { + ...options, + composite: false, + incremental: true, + tsBuildInfoFile: _path.default.join(cacheDir, '.tsbuildinfo') + } + }); + } else { + program = typescript.createProgram(fileNames, options); + } + const result = program.emit(); + const ignoreRegex = [ + // matches **/__(tests|mocks)__/** + /[\\/]__(?:tests|mocks)__[\\/]/, + // matches **/*.(spec|test).* + /(?<=[\\/.])(?:spec|test)\.[^\\/]+$/ + ]; + const regexIgnoredFile = new RegExp(ignoreRegex.map((r)=>r.source).join('|')); + const allDiagnostics = typescript.getPreEmitDiagnostics(program).concat(result.diagnostics).filter((d)=>!(d.file && regexIgnoredFile.test(d.file.fileName))); + const firstError = allDiagnostics.find((d)=>d.category === typescript.DiagnosticCategory.Error && Boolean(d.file)) ?? allDiagnostics.find((d)=>d.category === typescript.DiagnosticCategory.Error); + // In test mode, we want to check all diagnostics, not just the first one. + if (process.env.__NEXT_TEST_MODE) { + if (firstError) { + const allErrors = allDiagnostics.filter((d)=>d.category === typescript.DiagnosticCategory.Error).map((d)=>'[Test Mode] ' + (0, _diagnosticFormatter.getFormattedDiagnostic)(typescript, baseDir, distDir, d, isAppDirEnabled)); + console.error('\n\n===== TS errors =====\n\n' + allErrors.join('\n\n') + '\n\n===== TS errors =====\n\n'); + // Make sure all stdout is flushed before we exit. + await new Promise((resolve)=>setTimeout(resolve, 100)); + } + } + if (firstError) { + throw new _compileerror.CompileError((0, _diagnosticFormatter.getFormattedDiagnostic)(typescript, baseDir, distDir, firstError, isAppDirEnabled)); + } + return { + inputFilesCount: fileNames.length, + totalFilesCount: program.getSourceFiles().length, + incremental + }; +} + +//# sourceMappingURL=runTypeCheck.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/runTypeCheck.js.map b/e-commerce/node_modules/next/dist/lib/typescript/runTypeCheck.js.map new file mode 100644 index 0000000000000000000000000000000000000000..64cdebb021b58e28b33a153d246d38cb9c433685 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/runTypeCheck.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/typescript/runTypeCheck.ts"],"sourcesContent":["import path from 'path'\nimport { getFormattedDiagnostic } from './diagnosticFormatter'\nimport { getTypeScriptConfiguration } from './getTypeScriptConfiguration'\nimport { getRequiredConfiguration } from './writeConfigurationDefaults'\nimport { getDevTypesPath } from './type-paths'\n\nimport { CompileError } from '../compile-error'\nimport { warn } from '../../build/output/log'\n\nexport interface TypeCheckResult {\n inputFilesCount?: number\n totalFilesCount?: number\n incremental: boolean\n}\n\nexport interface TypeCheckDirs {\n app?: string\n pages?: string\n}\n\nexport interface DebugBuildPaths {\n app?: string[]\n pages?: string[]\n}\n\n/**\n * Check if a file path matches any of the debug build paths.\n * Both filePath and debugPaths are resolved file paths from glob.\n */\nfunction fileMatchesDebugPaths(\n filePath: string,\n debugPaths: string[]\n): boolean {\n return debugPaths.includes(filePath)\n}\n\nexport async function runTypeCheck(\n typescript: typeof import('typescript'),\n baseDir: string,\n distDir: string,\n tsConfigPath: string,\n cacheDir?: string,\n isAppDirEnabled?: boolean,\n dirs?: TypeCheckDirs,\n debugBuildPaths?: DebugBuildPaths\n): Promise {\n const effectiveConfiguration = await getTypeScriptConfiguration(\n typescript,\n tsConfigPath\n )\n\n // tsconfig includes both .next/types and .next/dev/types to avoid config churn\n // between dev/build modes. During build, we filter out .next/dev/types files to\n // prevent stale dev types from causing errors when routes have been deleted since\n // the last dev session.\n let fileNames = effectiveConfiguration.fileNames\n\n // Get the dev types path to filter (null if not applicable)\n const devTypesDir = getDevTypesPath(baseDir, distDir)\n if (devTypesDir) {\n fileNames = fileNames.filter(\n (fileName) => !fileName.startsWith(devTypesDir)\n )\n }\n\n // Apply debug build paths filter if specified\n if (dirs && debugBuildPaths) {\n const { app: appDir, pages: pagesDir } = dirs\n const { app: debugAppPaths, pages: debugPagePaths } = debugBuildPaths\n\n fileNames = fileNames.filter((fileName) => {\n // Check if file is in app directory\n if (appDir && fileName.startsWith(appDir + path.sep)) {\n // If debugAppPaths is undefined, include all app files\n if (debugAppPaths === undefined) {\n return true\n }\n // If debugAppPaths is empty array, exclude all app files\n if (debugAppPaths.length === 0) {\n return false\n }\n // Check if file matches any of the debug paths\n const relativeToApp = fileName.slice(appDir.length)\n return fileMatchesDebugPaths(relativeToApp, debugAppPaths)\n }\n\n // Check if file is in pages directory\n if (pagesDir && fileName.startsWith(pagesDir + path.sep)) {\n // If debugPagePaths is undefined, include all pages files\n if (debugPagePaths === undefined) {\n return true\n }\n // If debugPagePaths is empty array, exclude all pages files\n if (debugPagePaths.length === 0) {\n return false\n }\n // Check if file matches any of the debug paths\n const relativeToPages = fileName.slice(pagesDir.length)\n return fileMatchesDebugPaths(relativeToPages, debugPagePaths)\n }\n\n // Keep files outside app/pages directories (shared code, etc.)\n return true\n })\n }\n\n if (fileNames.length < 1) {\n return {\n inputFilesCount: 0,\n totalFilesCount: 0,\n incremental: false,\n }\n }\n const requiredConfig = getRequiredConfiguration(typescript)\n\n const options = {\n ...requiredConfig,\n ...effectiveConfiguration.options,\n declarationMap: false,\n emitDeclarationOnly: false,\n noEmit: true,\n }\n\n let program:\n | import('typescript').Program\n | import('typescript').BuilderProgram\n let incremental = false\n if ((options.incremental || options.composite) && cacheDir) {\n if (options.composite) {\n warn(\n 'TypeScript project references are not fully supported. Attempting to build in incremental mode.'\n )\n }\n incremental = true\n program = typescript.createIncrementalProgram({\n rootNames: fileNames,\n options: {\n ...options,\n composite: false,\n incremental: true,\n tsBuildInfoFile: path.join(cacheDir, '.tsbuildinfo'),\n },\n })\n } else {\n program = typescript.createProgram(fileNames, options)\n }\n\n const result = program.emit()\n\n const ignoreRegex = [\n // matches **/__(tests|mocks)__/**\n /[\\\\/]__(?:tests|mocks)__[\\\\/]/,\n // matches **/*.(spec|test).*\n /(?<=[\\\\/.])(?:spec|test)\\.[^\\\\/]+$/,\n ]\n const regexIgnoredFile = new RegExp(\n ignoreRegex.map((r) => r.source).join('|')\n )\n\n const allDiagnostics = typescript\n .getPreEmitDiagnostics(program as import('typescript').Program)\n .concat(result.diagnostics)\n .filter((d) => !(d.file && regexIgnoredFile.test(d.file.fileName)))\n\n const firstError =\n allDiagnostics.find(\n (d) =>\n d.category === typescript.DiagnosticCategory.Error && Boolean(d.file)\n ) ??\n allDiagnostics.find(\n (d) => d.category === typescript.DiagnosticCategory.Error\n )\n\n // In test mode, we want to check all diagnostics, not just the first one.\n if (process.env.__NEXT_TEST_MODE) {\n if (firstError) {\n const allErrors = allDiagnostics\n .filter((d) => d.category === typescript.DiagnosticCategory.Error)\n .map(\n (d) =>\n '[Test Mode] ' +\n getFormattedDiagnostic(\n typescript,\n baseDir,\n distDir,\n d,\n isAppDirEnabled\n )\n )\n\n console.error(\n '\\n\\n===== TS errors =====\\n\\n' +\n allErrors.join('\\n\\n') +\n '\\n\\n===== TS errors =====\\n\\n'\n )\n\n // Make sure all stdout is flushed before we exit.\n await new Promise((resolve) => setTimeout(resolve, 100))\n }\n }\n\n if (firstError) {\n throw new CompileError(\n getFormattedDiagnostic(\n typescript,\n baseDir,\n distDir,\n firstError,\n isAppDirEnabled\n )\n )\n }\n\n return {\n inputFilesCount: fileNames.length,\n totalFilesCount: program.getSourceFiles().length,\n incremental,\n }\n}\n"],"names":["runTypeCheck","fileMatchesDebugPaths","filePath","debugPaths","includes","typescript","baseDir","distDir","tsConfigPath","cacheDir","isAppDirEnabled","dirs","debugBuildPaths","effectiveConfiguration","getTypeScriptConfiguration","fileNames","devTypesDir","getDevTypesPath","filter","fileName","startsWith","app","appDir","pages","pagesDir","debugAppPaths","debugPagePaths","path","sep","undefined","length","relativeToApp","slice","relativeToPages","inputFilesCount","totalFilesCount","incremental","requiredConfig","getRequiredConfiguration","options","declarationMap","emitDeclarationOnly","noEmit","program","composite","warn","createIncrementalProgram","rootNames","tsBuildInfoFile","join","createProgram","result","emit","ignoreRegex","regexIgnoredFile","RegExp","map","r","source","allDiagnostics","getPreEmitDiagnostics","concat","diagnostics","d","file","test","firstError","find","category","DiagnosticCategory","Error","Boolean","process","env","__NEXT_TEST_MODE","allErrors","getFormattedDiagnostic","console","error","Promise","resolve","setTimeout","CompileError","getSourceFiles"],"mappings":";;;;+BAoCsBA;;;eAAAA;;;6DApCL;qCACsB;4CACI;4CACF;2BACT;8BAEH;qBACR;;;;;;AAkBrB;;;CAGC,GACD,SAASC,sBACPC,QAAgB,EAChBC,UAAoB;IAEpB,OAAOA,WAAWC,QAAQ,CAACF;AAC7B;AAEO,eAAeF,aACpBK,UAAuC,EACvCC,OAAe,EACfC,OAAe,EACfC,YAAoB,EACpBC,QAAiB,EACjBC,eAAyB,EACzBC,IAAoB,EACpBC,eAAiC;IAEjC,MAAMC,yBAAyB,MAAMC,IAAAA,sDAA0B,EAC7DT,YACAG;IAGF,+EAA+E;IAC/E,gFAAgF;IAChF,kFAAkF;IAClF,wBAAwB;IACxB,IAAIO,YAAYF,uBAAuBE,SAAS;IAEhD,4DAA4D;IAC5D,MAAM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E;QAChC,IAAIR,YAAY;YACd,MAAMS,YAAYhB,eACfzC,MAAM,CAAC,CAAC6C,IAAMA,EAAEK,QAAQ,KAAK/D,WAAWgE,kBAAkB,CAACC,KAAK,EAChEd,GAAG,CACF,CAACO,IACC,iBACAa,IAAAA,2CAAsB,EACpBvE,YACAC,SACAC,SACAwD,GACArD;YAIRmE,QAAQC,KAAK,CACX,kCACEH,UAAU1B,IAAI,CAAC,UACf;YAGJ,kDAAkD;YAClD,MAAM,IAAI8B,QAAQ,CAACC,UAAYC,WAAWD,SAAS;QACrD;IACF;IAEA,IAAId,YAAY;QACd,MAAM,IAAIgB,0BAAY,CACpBN,IAAAA,2CAAsB,EACpBvE,YACAC,SACAC,SACA2D,YACAxD;IAGN;IAEA,OAAO;QACLwB,iBAAiBnB,UAAUe,MAAM;QACjCK,iBAAiBQ,QAAQwC,cAAc,GAAGrD,MAAM;QAChDM;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/runTypeCheckCli.d.ts b/e-commerce/node_modules/next/dist/lib/typescript/runTypeCheckCli.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..70f407e4bb222f4dd202d369dd8c63bb13e989a0 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/runTypeCheckCli.d.ts @@ -0,0 +1,12 @@ +import type { TypeCheckResult } from './runTypeCheck'; +export declare function runTypeCheckCli({ baseDir, tsConfigPath, tscPath, cacheDir, onFirstOutput, }: { + baseDir: string; + tsConfigPath: string; + tscPath: string; + cacheDir?: string; + /** + * Called once when `tsc` first produces output. Used to stop the build + * spinner so it does not sit above the diagnostics. + */ + onFirstOutput?: () => void; +}): Promise; diff --git a/e-commerce/node_modules/next/dist/lib/typescript/runTypeCheckCli.js b/e-commerce/node_modules/next/dist/lib/typescript/runTypeCheckCli.js new file mode 100644 index 0000000000000000000000000000000000000000..52b026f3c91e4a7c66c9aeaa3a350e624498f673 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/runTypeCheckCli.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "runTypeCheckCli", { + enumerable: true, + get: function() { + return runTypeCheckCli; + } +}); +const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path")); +const _compileerror = require("../compile-error"); +const _runTypeScriptCli = require("./runTypeScriptCli"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +async function runTypeCheckCli({ baseDir, tsConfigPath, tscPath, cacheDir, onFirstOutput }) { + const configuration = await (0, _runTypeScriptCli.getTypeScriptConfigurationCli)({ + baseDir, + tsConfigPath, + tscPath + }); + const incremental = Boolean(configuration.compilerOptions.incremental || configuration.compilerOptions.composite); + const args = [ + '--project', + tsConfigPath, + '--noEmit', + '--declarationMap', + 'false', + '--emitDeclarationOnly', + 'false' + ]; + if (incremental && cacheDir) { + args.push('--tsBuildInfoFile', _nodepath.default.join(cacheDir, '.tsbuildinfo')); + } + const result = await (0, _runTypeScriptCli.runTypeScriptCli)({ + cwd: baseDir, + tscPath, + args, + onFirstOutput + }); + if (result.exitCode !== 0) { + throw new _compileerror.CompileError(); + } + return { + incremental + }; +} + +//# sourceMappingURL=runTypeCheckCli.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/runTypeCheckCli.js.map b/e-commerce/node_modules/next/dist/lib/typescript/runTypeCheckCli.js.map new file mode 100644 index 0000000000000000000000000000000000000000..05cf1e7f63970e88cf3e9a4aaab54cfee83d77bc --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/runTypeCheckCli.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/typescript/runTypeCheckCli.ts"],"sourcesContent":["import path from 'node:path'\n\nimport { CompileError } from '../compile-error'\nimport type { TypeCheckResult } from './runTypeCheck'\nimport {\n getTypeScriptConfigurationCli,\n runTypeScriptCli,\n} from './runTypeScriptCli'\n\nexport async function runTypeCheckCli({\n baseDir,\n tsConfigPath,\n tscPath,\n cacheDir,\n onFirstOutput,\n}: {\n baseDir: string\n tsConfigPath: string\n tscPath: string\n cacheDir?: string\n /**\n * Called once when `tsc` first produces output. Used to stop the build\n * spinner so it does not sit above the diagnostics.\n */\n onFirstOutput?: () => void\n}): Promise {\n const configuration = await getTypeScriptConfigurationCli({\n baseDir,\n tsConfigPath,\n tscPath,\n })\n const incremental = Boolean(\n configuration.compilerOptions.incremental ||\n configuration.compilerOptions.composite\n )\n const args = [\n '--project',\n tsConfigPath,\n '--noEmit',\n '--declarationMap',\n 'false',\n '--emitDeclarationOnly',\n 'false',\n ]\n\n if (incremental && cacheDir) {\n args.push('--tsBuildInfoFile', path.join(cacheDir, '.tsbuildinfo'))\n }\n\n const result = await runTypeScriptCli({\n cwd: baseDir,\n tscPath,\n args,\n onFirstOutput,\n })\n\n if (result.exitCode !== 0) {\n throw new CompileError()\n }\n\n return {\n incremental,\n }\n}\n"],"names":["runTypeCheckCli","baseDir","tsConfigPath","tscPath","cacheDir","onFirstOutput","configuration","getTypeScriptConfigurationCli","incremental","Boolean","compilerOptions","composite","args","push","path","join","result","runTypeScriptCli","cwd","exitCode","CompileError"],"mappings":";;;;+BASsBA;;;eAAAA;;;iEATL;8BAEY;kCAKtB;;;;;;AAEA,eAAeA,gBAAgB,EACpCC,OAAO,EACPC,YAAY,EACZC,OAAO,EACPC,QAAQ,EACRC,aAAa,EAWd;IACC,MAAMC,gBAAgB,MAAMC,IAAAA,+CAA6B,EAAC;QACxDN;QACAC;QACAC;IACF;IACA,MAAMK,cAAcC,QAClBH,cAAcI,eAAe,CAACF,WAAW,IACvCF,cAAcI,eAAe,CAACC,SAAS;IAE3C,MAAMC,OAAO;QACX;QACAV;QACA;QACA;QACA;QACA;QACA;KACD;IAED,IAAIM,eAAeJ,UAAU;QAC3BQ,KAAKC,IAAI,CAAC,qBAAqBC,iBAAI,CAACC,IAAI,CAACX,UAAU;IACrD;IAEA,MAAMY,SAAS,MAAMC,IAAAA,kCAAgB,EAAC;QACpCC,KAAKjB;QACLE;QACAS;QACAP;IACF;IAEA,IAAIW,OAAOG,QAAQ,KAAK,GAAG;QACzB,MAAM,IAAIC,0BAAY;IACxB;IAEA,OAAO;QACLZ;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/runTypeScriptCli.d.ts b/e-commerce/node_modules/next/dist/lib/typescript/runTypeScriptCli.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..99f8eef970ce31cd2b0a80e0ded307217d1021da --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/runTypeScriptCli.d.ts @@ -0,0 +1,38 @@ +export interface TypeScriptPackageInfo { + packageJsonPath: string; + packageDir: string; + version: string; + apiPath?: string; + tscPath?: string; +} +export declare function getTypeScriptPackageInfo(baseDir: string): TypeScriptPackageInfo | null; +export declare function hasNativeTypeScriptPreview(baseDir: string): boolean; +export declare function getTypeScriptApiMissingError(version: string): Error; +export interface TypeScriptCliResult { + exitCode: number; + signal: NodeJS.Signals | null; + stdout: string; + stderr: string; +} +export declare function runTypeScriptCli({ cwd, tscPath, args, captureOutput, onFirstOutput, }: { + cwd: string; + tscPath: string; + args: string[]; + /** + * Accumulate stdout/stderr into the resolved result instead of forwarding it + * to this process's stdout/stderr (for e.g. parsing `--showConfig` output). + */ + captureOutput?: boolean; + /** + * Called once, on the first chunk of forwarded output. Used to stop the build + * spinner before `tsc`'s diagnostics appear. Not called when capturing. + */ + onFirstOutput?: () => void; +}): Promise; +export declare function getTypeScriptConfigurationCli({ baseDir, tsConfigPath, tscPath, }: { + baseDir: string; + tsConfigPath: string; + tscPath: string; +}): Promise<{ + compilerOptions: Record; +}>; diff --git a/e-commerce/node_modules/next/dist/lib/typescript/runTypeScriptCli.js b/e-commerce/node_modules/next/dist/lib/typescript/runTypeScriptCli.js new file mode 100644 index 0000000000000000000000000000000000000000..4e0dd714310e588648bef4669d8604bfc8bc639e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/runTypeScriptCli.js @@ -0,0 +1,244 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + getTypeScriptApiMissingError: null, + getTypeScriptConfigurationCli: null, + getTypeScriptPackageInfo: null, + hasNativeTypeScriptPreview: null, + runTypeScriptCli: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + getTypeScriptApiMissingError: function() { + return getTypeScriptApiMissingError; + }, + getTypeScriptConfigurationCli: function() { + return getTypeScriptConfigurationCli; + }, + getTypeScriptPackageInfo: function() { + return getTypeScriptPackageInfo; + }, + hasNativeTypeScriptPreview: function() { + return hasNativeTypeScriptPreview; + }, + runTypeScriptCli: function() { + return runTypeScriptCli; + } +}); +const _nodefs = require("node:fs"); +const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path")); +const _nodechild_process = require("node:child_process"); +const _crossspawn = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/cross-spawn")); +const _picocolors = require("../picocolors"); +const _resolvefrom = require("../resolve-from"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function getTypeScriptPackageInfo(baseDir) { + var _packageJson_bin, _Object_entries_find; + let packageJsonPath; + try { + packageJsonPath = (0, _resolvefrom.resolveFrom)(baseDir, 'typescript/package.json'); + } catch { + return null; + } + const packageJson = JSON.parse((0, _nodefs.readFileSync)(packageJsonPath, 'utf8')); + const packageDir = _nodepath.default.dirname(packageJsonPath); + const apiPath = _nodepath.default.join(packageDir, 'lib', 'typescript.js'); + const tscBin = typeof packageJson.bin === 'string' ? packageJson.bin : ((_packageJson_bin = packageJson.bin) == null ? void 0 : _packageJson_bin.tsc) ?? ((_Object_entries_find = Object.entries(packageJson.bin ?? {}).find(([name])=>/^tsc\d+$/.test(name))) == null ? void 0 : _Object_entries_find[1]); + const tscBinPath = tscBin ? _nodepath.default.resolve(packageDir, tscBin) : undefined; + let tscPath = tscBinPath; + if (tscBinPath && (0, _nodefs.existsSync)(tscBinPath) && packageJson.type === 'module' && _nodepath.default.extname(tscBinPath) === '') { + // TypeScript 7's extensionless ESM bin wrapper cannot be used as Node's + // main entry point on Node.js 20.9. Its imported JS entry is the same CLI + // wrapper and works across all supported Node.js versions. + const tscJsPath = _nodepath.default.join(packageDir, 'lib', 'tsc.js'); + if ((0, _nodefs.existsSync)(tscJsPath)) { + tscPath = tscJsPath; + } + } + return { + packageJsonPath, + packageDir, + version: packageJson.version, + apiPath: (0, _nodefs.existsSync)(apiPath) ? apiPath : undefined, + tscPath: tscPath && (0, _nodefs.existsSync)(tscPath) ? tscPath : undefined + }; +} +function hasNativeTypeScriptPreview(baseDir) { + try { + (0, _resolvefrom.resolveFrom)(baseDir, '@typescript/native-preview/package.json'); + return true; + } catch { + return false; + } +} +function getTypeScriptApiMissingError(version) { + return new Error(`TypeScript ${version} does not provide the compiler API required by Next.js. ` + `Set ${(0, _picocolors.bold)('experimental.useTypeScriptCli')} back to true in your Next.js config to use the TypeScript CLI, ` + `or install TypeScript 6 instead.`); +} +const terminationSignals = [ + 'SIGINT', + 'SIGTERM', + 'SIGHUP' +]; +function runTypeScriptCli({ cwd, tscPath, args, captureOutput = false, onFirstOutput }) { + return new Promise((resolve, reject)=>{ + var _child_stdout, _child_stderr; + const child = (0, _crossspawn.default)(process.execPath, [ + tscPath, + ...args + ], { + cwd, + // TypeScript 7's Node wrapper starts the native compiler synchronously + // on older Node.js releases. A separate process group lets termination + // reach both processes instead of orphaning the native compiler. + detached: process.platform !== 'win32', + shell: false, + stdio: [ + 'ignore', + 'pipe', + 'pipe' + ], + env: { + ...process.env, + // Piping stdio makes `tsc` disable colored/pretty diagnostics. Restore + // them when we are forwarding output to a TTY (not capturing it for + // parsing, e.g. `--showConfig`). + ...!captureOutput && process.stdout.isTTY ? { + FORCE_COLOR: '1' + } : undefined + } + }); + let stdout = ''; + let stderr = ''; + (_child_stdout = child.stdout) == null ? void 0 : _child_stdout.setEncoding('utf8'); + (_child_stderr = child.stderr) == null ? void 0 : _child_stderr.setEncoding('utf8'); + if (captureOutput) { + var _child_stdout1, _child_stderr1; + (_child_stdout1 = child.stdout) == null ? void 0 : _child_stdout1.on('data', (chunk)=>{ + stdout += chunk; + }); + (_child_stderr1 = child.stderr) == null ? void 0 : _child_stderr1.on('data', (chunk)=>{ + stderr += chunk; + }); + } else { + var _child_stdout2, _child_stderr2; + const forward = (dest, chunk)=>{ + onFirstOutput == null ? void 0 : onFirstOutput(); + onFirstOutput = undefined // ensure we don't call it again + ; + dest.write(chunk); + }; + (_child_stdout2 = child.stdout) == null ? void 0 : _child_stdout2.on('data', (chunk)=>{ + forward(process.stdout, chunk); + }); + (_child_stderr2 = child.stderr) == null ? void 0 : _child_stderr2.on('data', (chunk)=>{ + forward(process.stderr, chunk); + }); + } + let terminationRequested = false; + const terminateChild = ()=>{ + if (terminationRequested || child.killed || child.pid === undefined) { + return; + } + terminationRequested = true; + // The native compiler ignores SIGTERM and SIGINT, so send a kill signal. + // Target the whole process group so the signal reaches the native compiler whether + // it is a grandchild or a direct child. + // https://github.com/microsoft/typescript-go/pull/4592 should improve this in the long run + if (process.platform === 'win32') { + (0, _nodechild_process.spawnSync)('taskkill', [ + '/pid', + String(child.pid), + '/T', + '/F' + ], { + stdio: 'ignore', + windowsHide: true + }); + } else { + try { + // https://www.youtube.com/watch?v=Fow7iUaKrq4 + process.kill(-child.pid, 'SIGKILL'); + } catch { + // The process may have exited between the lifecycle event and kill. + } + } + }; + const terminateOnExit = ()=>terminateChild(); + process.once('exit', terminateOnExit); + const handler = ()=>{ + terminateChild(); + process.exit(1); + }; + for (const signal of terminationSignals){ + process.once(signal, handler); + } + const cleanup = ()=>{ + process.off('exit', terminateOnExit); + for (const signal of terminationSignals){ + process.off(signal, handler); + } + }; + let settled = false; + const finish = (settle)=>{ + if (settled) { + return; + } + settled = true; + cleanup(); + settle(); + }; + child.on('error', (error)=>{ + finish(()=>reject(error)); + }); + child.on('close', (code, signal)=>{ + finish(()=>{ + resolve({ + exitCode: code ?? 1, + signal, + stdout, + stderr + }); + }); + }); + }); +} +async function getTypeScriptConfigurationCli({ baseDir, tsConfigPath, tscPath }) { + const result = await runTypeScriptCli({ + cwd: baseDir, + tscPath, + args: [ + '--showConfig', + '--project', + tsConfigPath, + '--pretty', + 'false' + ], + captureOutput: true + }); + if (result.exitCode !== 0) { + throw new Error([ + result.stdout, + result.stderr + ].filter(Boolean).join('\n').trim()); + } + try { + return JSON.parse(result.stdout); + } catch (cause) { + throw new Error(`Could not parse output from TypeScript's --showConfig.`, { + cause + }); + } +} + +//# sourceMappingURL=runTypeScriptCli.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/runTypeScriptCli.js.map b/e-commerce/node_modules/next/dist/lib/typescript/runTypeScriptCli.js.map new file mode 100644 index 0000000000000000000000000000000000000000..930b8f6b775f9a15e8df986dfec9fc47bb4da9a4 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/runTypeScriptCli.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/typescript/runTypeScriptCli.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs'\nimport path from 'node:path'\nimport { spawnSync } from 'node:child_process'\n\nimport spawn from 'next/dist/compiled/cross-spawn'\n\nimport { bold } from '../picocolors'\nimport { resolveFrom } from '../resolve-from'\n\nexport interface TypeScriptPackageInfo {\n packageJsonPath: string\n packageDir: string\n version: string\n apiPath?: string\n tscPath?: string\n}\n\nexport function getTypeScriptPackageInfo(\n baseDir: string\n): TypeScriptPackageInfo | null {\n let packageJsonPath: string\n try {\n packageJsonPath = resolveFrom(baseDir, 'typescript/package.json')\n } catch {\n return null\n }\n\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')) as {\n version: string\n type?: string\n bin?: string | Record\n }\n const packageDir = path.dirname(packageJsonPath)\n const apiPath = path.join(packageDir, 'lib', 'typescript.js')\n const tscBin =\n typeof packageJson.bin === 'string'\n ? packageJson.bin\n : (packageJson.bin?.tsc ??\n Object.entries(packageJson.bin ?? {}).find(([name]) =>\n /^tsc\\d+$/.test(name)\n )?.[1])\n const tscBinPath = tscBin ? path.resolve(packageDir, tscBin) : undefined\n let tscPath = tscBinPath\n\n if (\n tscBinPath &&\n existsSync(tscBinPath) &&\n packageJson.type === 'module' &&\n path.extname(tscBinPath) === ''\n ) {\n // TypeScript 7's extensionless ESM bin wrapper cannot be used as Node's\n // main entry point on Node.js 20.9. Its imported JS entry is the same CLI\n // wrapper and works across all supported Node.js versions.\n const tscJsPath = path.join(packageDir, 'lib', 'tsc.js')\n if (existsSync(tscJsPath)) {\n tscPath = tscJsPath\n }\n }\n\n return {\n packageJsonPath,\n packageDir,\n version: packageJson.version,\n apiPath: existsSync(apiPath) ? apiPath : undefined,\n tscPath: tscPath && existsSync(tscPath) ? tscPath : undefined,\n }\n}\n\nexport function hasNativeTypeScriptPreview(baseDir: string): boolean {\n try {\n resolveFrom(baseDir, '@typescript/native-preview/package.json')\n return true\n } catch {\n return false\n }\n}\n\nexport function getTypeScriptApiMissingError(version: string): Error {\n return new Error(\n `TypeScript ${version} does not provide the compiler API required by Next.js. ` +\n `Set ${bold('experimental.useTypeScriptCli')} back to true in your Next.js config to use the TypeScript CLI, ` +\n `or install TypeScript 6 instead.`\n )\n}\n\nexport interface TypeScriptCliResult {\n exitCode: number\n signal: NodeJS.Signals | null\n stdout: string\n stderr: string\n}\n\nconst terminationSignals: NodeJS.Signals[] = ['SIGINT', 'SIGTERM', 'SIGHUP']\n\nexport function runTypeScriptCli({\n cwd,\n tscPath,\n args,\n captureOutput = false,\n onFirstOutput,\n}: {\n cwd: string\n tscPath: string\n args: string[]\n /**\n * Accumulate stdout/stderr into the resolved result instead of forwarding it\n * to this process's stdout/stderr (for e.g. parsing `--showConfig` output).\n */\n captureOutput?: boolean\n /**\n * Called once, on the first chunk of forwarded output. Used to stop the build\n * spinner before `tsc`'s diagnostics appear. Not called when capturing.\n */\n onFirstOutput?: () => void\n}): Promise {\n return new Promise((resolve, reject) => {\n const child = spawn(process.execPath, [tscPath, ...args], {\n cwd,\n // TypeScript 7's Node wrapper starts the native compiler synchronously\n // on older Node.js releases. A separate process group lets termination\n // reach both processes instead of orphaning the native compiler.\n detached: process.platform !== 'win32',\n shell: false,\n stdio: ['ignore', 'pipe', 'pipe'],\n env: {\n ...process.env,\n // Piping stdio makes `tsc` disable colored/pretty diagnostics. Restore\n // them when we are forwarding output to a TTY (not capturing it for\n // parsing, e.g. `--showConfig`).\n ...(!captureOutput && process.stdout.isTTY\n ? { FORCE_COLOR: '1' }\n : undefined),\n },\n })\n\n let stdout = ''\n let stderr = ''\n\n child.stdout?.setEncoding('utf8')\n child.stderr?.setEncoding('utf8')\n\n if (captureOutput) {\n child.stdout?.on('data', (chunk: string) => {\n stdout += chunk\n })\n child.stderr?.on('data', (chunk: string) => {\n stderr += chunk\n })\n } else {\n const forward = (dest: NodeJS.WriteStream, chunk: string) => {\n onFirstOutput?.()\n onFirstOutput = undefined // ensure we don't call it again\n dest.write(chunk)\n }\n\n child.stdout?.on('data', (chunk: string) => {\n forward(process.stdout, chunk)\n })\n child.stderr?.on('data', (chunk: string) => {\n forward(process.stderr, chunk)\n })\n }\n\n let terminationRequested = false\n const terminateChild = () => {\n if (terminationRequested || child.killed || child.pid === undefined) {\n return\n }\n terminationRequested = true\n\n // The native compiler ignores SIGTERM and SIGINT, so send a kill signal.\n // Target the whole process group so the signal reaches the native compiler whether\n // it is a grandchild or a direct child.\n // https://github.com/microsoft/typescript-go/pull/4592 should improve this in the long run\n if (process.platform === 'win32') {\n spawnSync('taskkill', ['/pid', String(child.pid), '/T', '/F'], {\n stdio: 'ignore',\n windowsHide: true,\n })\n } else {\n try {\n // https://www.youtube.com/watch?v=Fow7iUaKrq4\n process.kill(-child.pid, 'SIGKILL')\n } catch {\n // The process may have exited between the lifecycle event and kill.\n }\n }\n }\n const terminateOnExit = () => terminateChild()\n process.once('exit', terminateOnExit)\n\n const handler = () => {\n terminateChild()\n process.exit(1)\n }\n for (const signal of terminationSignals) {\n process.once(signal, handler)\n }\n\n const cleanup = () => {\n process.off('exit', terminateOnExit)\n for (const signal of terminationSignals) {\n process.off(signal, handler)\n }\n }\n\n let settled = false\n const finish = (settle: () => void) => {\n if (settled) {\n return\n }\n settled = true\n cleanup()\n settle()\n }\n\n child.on('error', (error) => {\n finish(() => reject(error))\n })\n child.on('close', (code, signal) => {\n finish(() => {\n resolve({\n exitCode: code ?? 1,\n signal,\n stdout,\n stderr,\n })\n })\n })\n })\n}\n\nexport async function getTypeScriptConfigurationCli({\n baseDir,\n tsConfigPath,\n tscPath,\n}: {\n baseDir: string\n tsConfigPath: string\n tscPath: string\n}): Promise<{ compilerOptions: Record }> {\n const result = await runTypeScriptCli({\n cwd: baseDir,\n tscPath,\n args: ['--showConfig', '--project', tsConfigPath, '--pretty', 'false'],\n captureOutput: true,\n })\n\n if (result.exitCode !== 0) {\n throw new Error(\n [result.stdout, result.stderr].filter(Boolean).join('\\n').trim()\n )\n }\n\n try {\n return JSON.parse(result.stdout)\n } catch (cause) {\n throw new Error(`Could not parse output from TypeScript's --showConfig.`, {\n cause,\n })\n }\n}\n"],"names":["getTypeScriptApiMissingError","getTypeScriptConfigurationCli","getTypeScriptPackageInfo","hasNativeTypeScriptPreview","runTypeScriptCli","baseDir","packageJson","Object","packageJsonPath","resolveFrom","JSON","parse","readFileSync","packageDir","path","dirname","apiPath","join","tscBin","bin","tsc","entries","find","name","test","tscBinPath","resolve","undefined","tscPath","existsSync","type","extname","tscJsPath","version","Error","bold","terminationSignals","cwd","args","captureOutput","onFirstOutput","Promise","reject","child","spawn","process","execPath","detached","platform","shell","stdio","env","stdout","isTTY","FORCE_COLOR","stderr","setEncoding","on","chunk","forward","dest","write","terminationRequested","terminateChild","killed","pid","spawnSync","String","windowsHide","kill","terminateOnExit","once","handler","exit","signal","cleanup","off","settled","finish","settle","error","code","exitCode","tsConfigPath","result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YACdT;YACAlB,QAAQ4B,IAAI,CAAC;QACf;QACA,KAAK,MAAMC,UAAUtC,mBAAoB;YACvCS,QAAQ0B,IAAI,CAACG,QAAQF;QACvB;QAEA,MAAMG,UAAU;YACd9B,QAAQ+B,GAAG,CAAC,QAAQN;YACpB,KAAK,MAAMI,UAAUtC,mBAAoB;gBACvCS,QAAQ+B,GAAG,CAACF,QAAQF;YACtB;QACF;QAEA,IAAIK,UAAU;QACd,MAAMC,SAAS,CAACC;YACd,IAAIF,SAAS;gBACX;YACF;YACAA,UAAU;YACVF;YACAI;QACF;QAEApC,MAAMc,EAAE,CAAC,SAAS,CAACuB;YACjBF,OAAO,IAAMpC,OAAOsC;QACtB;QACArC,MAAMc,EAAE,CAAC,SAAS,CAACwB,MAAMP;YACvBI,OAAO;gBACLpD,QAAQ;oBACNwD,UAAUD,QAAQ;oBAClBP;oBACAtB;oBACAG;gBACF;YACF;QACF;IACF;AACF;AAEO,eAAetD,8BAA8B,EAClDI,OAAO,EACP8E,YAAY,EACZvD,OAAO,EAKR;IACC,MAAMwD,SAAS,MAAMhF,iBAAiB;QACpCiC,KAAKhC;QACLuB;QACAU,MAAM;YAAC;YAAgB;YAAa6C;YAAc;YAAY;SAAQ;QACtE5C,eAAe;IACjB;IAEA,IAAI6C,OAAOF,QAAQ,KAAK,GAAG;QACzB,MAAM,IAAIhD,MACR;YAACkD,OAAOhC,MAAM;YAAEgC,OAAO7B,MAAM;SAAC,CAAC8B,MAAM,CAACC,SAASrE,IAAI,CAAC,MAAMsE,IAAI;IAElE;IAEA,IAAI;QACF,OAAO7E,KAAKC,KAAK,CAACyE,OAAOhC,MAAM;IACjC,EAAE,OAAOoC,OAAO;QACd,MAAM,IAAItD,MAAM,CAAC,sDAAsD,CAAC,EAAE;YACxEsD;QACF;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/type-paths.d.ts b/e-commerce/node_modules/next/dist/lib/typescript/type-paths.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8492cccd7ff5294d596a0d4f4f908a4675978355 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/type-paths.d.ts @@ -0,0 +1,12 @@ +/** + * Gets the glob patterns for type definition directories in tsconfig. + * Next.js uses different distDir paths in development vs production: + * - Development: "{distDir}/dev" + * - Production: "{distDir}" + */ +export declare function getTypeDefinitionGlobPatterns(distDir: string): string[]; +/** + * Gets the absolute path to the dev types directory for filtering during type-checking. + * Returns null in dev mode (where dev types are the main types). + */ +export declare function getDevTypesPath(baseDir: string, distDir: string): string | null; diff --git a/e-commerce/node_modules/next/dist/lib/typescript/type-paths.js b/e-commerce/node_modules/next/dist/lib/typescript/type-paths.js new file mode 100644 index 0000000000000000000000000000000000000000..38ad3534250ac49df27fa14b1498d3627d65d893 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/type-paths.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + getDevTypesPath: null, + getTypeDefinitionGlobPatterns: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + getDevTypesPath: function() { + return getDevTypesPath; + }, + getTypeDefinitionGlobPatterns: function() { + return getTypeDefinitionGlobPatterns; + } +}); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function getTypeDefinitionGlobPatterns(distDir) { + const distDirPosix = _path.default.win32.sep === _path.default.sep ? distDir.replaceAll(_path.default.win32.sep, _path.default.posix.sep) : distDir; + const typeGlobPatterns = [ + `${distDirPosix}/types/**/*.ts` + ]; + // Include both .next/types and .next/dev/types to avoid tsconfig churn when switching + // between dev/build modes + typeGlobPatterns.push(process.env.NODE_ENV === 'development' ? `${distDirPosix.replace(/\/dev$/, '')}/types/**/*.ts` : `${distDirPosix}/dev/types/**/*.ts`); + // Sort for consistent order + typeGlobPatterns.sort((a, b)=>a.length - b.length); + return typeGlobPatterns; +} +function getDevTypesPath(baseDir, distDir) { + const isDev = process.env.NODE_ENV === 'development'; + if (isDev) { + // In dev mode, dev types are the main types, so no need to filter + return null; + } + // In build mode, dev types are at "{baseDir}/{distDir}/dev/types" and should be filtered + return _path.default.join(baseDir, distDir, 'dev', 'types'); +} + +//# sourceMappingURL=type-paths.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/type-paths.js.map b/e-commerce/node_modules/next/dist/lib/typescript/type-paths.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1aa3490da7b0b1ae050eabb402f93103d37aeeaf --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/type-paths.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/typescript/type-paths.ts"],"sourcesContent":["import path from 'path'\n\n/**\n * Gets the glob patterns for type definition directories in tsconfig.\n * Next.js uses different distDir paths in development vs production:\n * - Development: \"{distDir}/dev\"\n * - Production: \"{distDir}\"\n */\nexport function getTypeDefinitionGlobPatterns(distDir: string): string[] {\n const distDirPosix =\n path.win32.sep === path.sep\n ? distDir.replaceAll(path.win32.sep, path.posix.sep)\n : distDir\n\n const typeGlobPatterns: string[] = [`${distDirPosix}/types/**/*.ts`]\n\n // Include both .next/types and .next/dev/types to avoid tsconfig churn when switching\n // between dev/build modes\n typeGlobPatterns.push(\n process.env.NODE_ENV === 'development'\n ? // In dev, distDir is \"{distDir}/dev\", so also include \"{distDir}/types\"\n `${distDirPosix.replace(/\\/dev$/, '')}/types/**/*.ts`\n : // In build, distDir is \"{distDir}\", so also include \"{distDir}/dev/types\"\n `${distDirPosix}/dev/types/**/*.ts`\n )\n // Sort for consistent order\n typeGlobPatterns.sort((a, b) => a.length - b.length)\n\n return typeGlobPatterns\n}\n\n/**\n * Gets the absolute path to the dev types directory for filtering during type-checking.\n * Returns null in dev mode (where dev types are the main types).\n */\nexport function getDevTypesPath(\n baseDir: string,\n distDir: string\n): string | null {\n const isDev = process.env.NODE_ENV === 'development'\n if (isDev) {\n // In dev mode, dev types are the main types, so no need to filter\n return null\n }\n\n // In build mode, dev types are at \"{baseDir}/{distDir}/dev/types\" and should be filtered\n return path.join(baseDir, distDir, 'dev', 'types')\n}\n"],"names":["getDevTypesPath","getTypeDefinitionGlobPatterns","distDir","distDirPosix","path","win32","sep","replaceAll","posix","typeGlobPatterns","push","process","env","NODE_ENV","replace","sort","a","b","length","baseDir","isDev","join"],"mappings":";;;;;;;;;;;;;;;IAmCgBA,eAAe;eAAfA;;IA3BAC,6BAA6B;eAA7BA;;;6DARC;;;;;;AAQV,SAASA,8BAA8BC,OAAe;IAC3D,MAAMC,eACJC,aAAI,CAACC,KAAK,CAACC,GAAG,KAAKF,aAAI,CAACE,GAAG,GACvBJ,QAAQK,UAAU,CAACH,aAAI,CAACC,KAAK,CAACC,GAAG,EAAEF,aAAI,CAACI,KAAK,CAACF,GAAG,IACjDJ;IAEN,MAAMO,mBAA6B;QAAC,GAAGN,aAAa,cAAc,CAAC;KAAC;IAEpE,sFAAsF;IACtF,0BAA0B;IAC1BM,iBAAiBC,IAAI,CACnBC,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBAErB,GAAGV,aAAaW,OAAO,CAAC,UAAU,IAAI,cAAc,CAAC,GAErD,GAAGX,aAAa,kBAAkB,CAAC;IAEzC,4BAA4B;IAC5BM,iBAAiBM,IAAI,CAAC,CAACC,GAAGC,IAAMD,EAAEE,MAAM,GAAGD,EAAEC,MAAM;IAEnD,OAAOT;AACT;AAMO,SAAST,gBACdmB,OAAe,EACfjB,OAAe;IAEf,MAAMkB,QAAQT,QAAQC,GAAG,CAACC,QAAQ,KAAK;IACvC,IAAIO,OAAO;QACT,kEAAkE;QAClE,OAAO;IACT;IAEA,yFAAyF;IACzF,OAAOhB,aAAI,CAACiB,IAAI,CAACF,SAASjB,SAAS,OAAO;AAC5C","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/writeAppTypeDeclarations.d.ts b/e-commerce/node_modules/next/dist/lib/typescript/writeAppTypeDeclarations.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..04d7685dcd4b4039b0ebf64367c42e20166a2a27 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/writeAppTypeDeclarations.d.ts @@ -0,0 +1,9 @@ +export declare function writeAppTypeDeclarations({ baseDir, distDir, imageImportsEnabled, hasPagesDir, hasAppDir, strictRouteTypes, typedRoutes, }: { + baseDir: string; + distDir: string; + imageImportsEnabled: boolean; + hasPagesDir: boolean; + hasAppDir: boolean; + strictRouteTypes: boolean; + typedRoutes: boolean; +}): Promise; diff --git a/e-commerce/node_modules/next/dist/lib/typescript/writeAppTypeDeclarations.js b/e-commerce/node_modules/next/dist/lib/typescript/writeAppTypeDeclarations.js new file mode 100644 index 0000000000000000000000000000000000000000..b8faec3ed848472ee143504c4fb2dbe63c11481d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/writeAppTypeDeclarations.js @@ -0,0 +1,77 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "writeAppTypeDeclarations", { + enumerable: true, + get: function() { + return writeAppTypeDeclarations; + } +}); +const _os = /*#__PURE__*/ _interop_require_default(require("os")); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +const _fs = require("fs"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +async function writeAppTypeDeclarations({ baseDir, distDir, imageImportsEnabled, hasPagesDir, hasAppDir, strictRouteTypes, typedRoutes }) { + // Reference `next` types + const appTypeDeclarations = _path.default.join(baseDir, 'next-env.d.ts'); + // Defaults EOL to system default + let eol = _os.default.EOL; + let currentContent; + try { + currentContent = await _fs.promises.readFile(appTypeDeclarations, 'utf8'); + // If file already exists then preserve its line ending + const lf = currentContent.indexOf('\n', /* skip first so we can lf - 1 */ 1); + if (lf !== -1) { + if (currentContent[lf - 1] === '\r') { + eol = '\r\n'; + } else { + eol = '\n'; + } + } + } catch {} + /** + * "Triple-slash directives" used to create typings files for Next.js projects + * using Typescript . + * + * @see https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html + */ const lines = [ + // Include the core Next.js typings. + '/// ' + ]; + if (imageImportsEnabled) { + lines.push('/// '); + } + if (hasAppDir && hasPagesDir) { + lines.push('/// '); + } + const routeTypesPath = _path.default.posix.join(distDir.replaceAll(_path.default.win32.sep, _path.default.posix.sep), 'types/routes.d.ts'); + // Use ESM import instead of triple-slash reference for better ESLint compatibility + lines.push(`import "./${routeTypesPath}";`); + const rootParamsTypesPath = _path.default.posix.join(distDir.replaceAll(_path.default.win32.sep, _path.default.posix.sep), 'types/root-params.d.ts'); + lines.push(`import "./${rootParamsTypesPath}";`); + if (strictRouteTypes) { + const cacheLifePath = _path.default.posix.join(distDir.replaceAll(_path.default.win32.sep, _path.default.posix.sep), 'types/cache-life.d.ts'); + lines.push(`import "./${cacheLifePath}";`); + const routeValidatorPath = _path.default.posix.join(distDir.replaceAll(_path.default.win32.sep, _path.default.posix.sep), 'types/validator.ts'); + lines.push(`import "./${routeValidatorPath}";`); + if (typedRoutes === true) { + const linkTypesPath = _path.default.posix.join(distDir.replaceAll(_path.default.win32.sep, _path.default.posix.sep), 'types/link.d.ts'); + lines.push(`import "./${linkTypesPath}";`); + } + } + // Push the notice in. + lines.push('', '// NOTE: This file should not be edited', `// see https://nextjs.org/docs/${hasAppDir ? 'app' : 'pages'}/api-reference/config/typescript for more information.`); + const content = lines.join(eol) + eol; + // Avoids an un-necessary write on read-only fs + if (currentContent === content) { + return; + } + await _fs.promises.writeFile(appTypeDeclarations, content); +} + +//# sourceMappingURL=writeAppTypeDeclarations.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/writeAppTypeDeclarations.js.map b/e-commerce/node_modules/next/dist/lib/typescript/writeAppTypeDeclarations.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b8f4a05831514205d590b44e8a94223cc33d928a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/writeAppTypeDeclarations.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/typescript/writeAppTypeDeclarations.ts"],"sourcesContent":["import os from 'os'\nimport path from 'path'\nimport { promises as fs } from 'fs'\n\nexport async function writeAppTypeDeclarations({\n baseDir,\n distDir,\n imageImportsEnabled,\n hasPagesDir,\n hasAppDir,\n strictRouteTypes,\n typedRoutes,\n}: {\n baseDir: string\n distDir: string\n imageImportsEnabled: boolean\n hasPagesDir: boolean\n hasAppDir: boolean\n strictRouteTypes: boolean\n typedRoutes: boolean\n}): Promise {\n // Reference `next` types\n const appTypeDeclarations = path.join(baseDir, 'next-env.d.ts')\n\n // Defaults EOL to system default\n let eol = os.EOL\n let currentContent: string | undefined\n\n try {\n currentContent = await fs.readFile(appTypeDeclarations, 'utf8')\n // If file already exists then preserve its line ending\n const lf = currentContent.indexOf('\\n', /* skip first so we can lf - 1 */ 1)\n\n if (lf !== -1) {\n if (currentContent[lf - 1] === '\\r') {\n eol = '\\r\\n'\n } else {\n eol = '\\n'\n }\n }\n } catch {}\n\n /**\n * \"Triple-slash directives\" used to create typings files for Next.js projects\n * using Typescript .\n *\n * @see https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html\n */\n const lines: string[] = [\n // Include the core Next.js typings.\n '/// ',\n ]\n\n if (imageImportsEnabled) {\n lines.push('/// ')\n }\n\n if (hasAppDir && hasPagesDir) {\n lines.push(\n '/// '\n )\n }\n\n const routeTypesPath = path.posix.join(\n distDir.replaceAll(path.win32.sep, path.posix.sep),\n 'types/routes.d.ts'\n )\n\n // Use ESM import instead of triple-slash reference for better ESLint compatibility\n lines.push(`import \"./${routeTypesPath}\";`)\n\n const rootParamsTypesPath = path.posix.join(\n distDir.replaceAll(path.win32.sep, path.posix.sep),\n 'types/root-params.d.ts'\n )\n lines.push(`import \"./${rootParamsTypesPath}\";`)\n\n if (strictRouteTypes) {\n const cacheLifePath = path.posix.join(\n distDir.replaceAll(path.win32.sep, path.posix.sep),\n 'types/cache-life.d.ts'\n )\n lines.push(`import \"./${cacheLifePath}\";`)\n\n const routeValidatorPath = path.posix.join(\n distDir.replaceAll(path.win32.sep, path.posix.sep),\n 'types/validator.ts'\n )\n lines.push(`import \"./${routeValidatorPath}\";`)\n\n if (typedRoutes === true) {\n const linkTypesPath = path.posix.join(\n distDir.replaceAll(path.win32.sep, path.posix.sep),\n 'types/link.d.ts'\n )\n lines.push(`import \"./${linkTypesPath}\";`)\n }\n }\n\n // Push the notice in.\n lines.push(\n '',\n '// NOTE: This file should not be edited',\n `// see https://nextjs.org/docs/${hasAppDir ? 'app' : 'pages'}/api-reference/config/typescript for more information.`\n )\n\n const content = lines.join(eol) + eol\n\n // Avoids an un-necessary write on read-only fs\n if (currentContent === content) {\n return\n }\n await fs.writeFile(appTypeDeclarations, content)\n}\n"],"names":["writeAppTypeDeclarations","baseDir","distDir","imageImportsEnabled","hasPagesDir","hasAppDir","strictRouteTypes","typedRoutes","appTypeDeclarations","path","join","eol","os","EOL","currentContent","fs","readFile","lf","indexOf","lines","push","routeTypesPath","posix","replaceAll","win32","sep","rootParamsTypesPath","cacheLifePath","routeValidatorPath","linkTypesPath","content","writeFile"],"mappings":";;;;+BAIsBA;;;eAAAA;;;2DAJP;6DACE;oBACc;;;;;;AAExB,eAAeA,yBAAyB,EAC7CC,OAAO,EACPC,OAAO,EACPC,mBAAmB,EACnBC,WAAW,EACXC,SAAS,EACTC,gBAAgB,EAChBC,WAAW,EASZ;IACC,yBAAyB;IACzB,MAAMC,sBAAsBC,aAAI,CAACC,IAAI,CAACT,SAAS;IAE/C,iCAAiC;IACjC,IAAIU,MAAMC,WAAE,CAACC,GAAG;IAChB,IAAIC;IAEJ,IAAI;QACFA,iBAAiB,MAAMC,YAAE,CAACC,QAAQ,CAACR,qBAAqB;QACxD,uDAAuD;QACvD,MAAMS,KAAKH,eAAeI,OAAO,CAAC,MAAM,+BAA+B,GAAG;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AAEQ,mBAAmB,EAAE,CAAC;QAE9C,IAAIrB,gBAAgB,MAAM;YACxB,MAAMsB,gBAAgBpB,aAAI,CAACa,KAAK,CAACZ,IAAI,CACnCR,QAAQqB,UAAU,CAACd,aAAI,CAACe,KAAK,CAACC,GAAG,EAAEhB,aAAI,CAACa,KAAK,CAACG,GAAG,GACjD;YAEFN,MAAMC,IAAI,CAAC,CAAC,UAAU,EAAES,cAAc,EAAE,CAAC;QAC3C;IACF;IAEA,sBAAsB;IACtBV,MAAMC,IAAI,CACR,IACA,2CACA,CAAC,+BAA+B,EAAEf,YAAY,QAAQ,QAAQ,sDAAsD,CAAC;IAGvH,MAAMyB,UAAUX,MAAMT,IAAI,CAACC,OAAOA;IAElC,+CAA+C;IAC/C,IAAIG,mBAAmBgB,SAAS;QAC9B;IACF;IACA,MAAMf,YAAE,CAACgB,SAAS,CAACvB,qBAAqBsB;AAC1C","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/writeConfigurationDefaults.d.ts b/e-commerce/node_modules/next/dist/lib/typescript/writeConfigurationDefaults.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..604519ad3807dee98617b23ba17b87c33374d301 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/writeConfigurationDefaults.d.ts @@ -0,0 +1,2 @@ +export declare function getRequiredConfiguration(typescript: typeof import('typescript')): Partial; +export declare function writeConfigurationDefaults(typescriptVersion: string, tsConfigPath: string, isFirstTimeSetup: boolean, hasAppDir: boolean, distDir: string, hasPagesDir: boolean, strictRouteTypes: boolean): Promise; diff --git a/e-commerce/node_modules/next/dist/lib/typescript/writeConfigurationDefaults.js b/e-commerce/node_modules/next/dist/lib/typescript/writeConfigurationDefaults.js new file mode 100644 index 0000000000000000000000000000000000000000..66293b37f8bf031fcb07419e923357bcf2d58941 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/writeConfigurationDefaults.js @@ -0,0 +1,395 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + getRequiredConfiguration: null, + writeConfigurationDefaults: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + getRequiredConfiguration: function() { + return getRequiredConfiguration; + }, + writeConfigurationDefaults: function() { + return writeConfigurationDefaults; + } +}); +const _fs = require("fs"); +const _picocolors = require("../picocolors"); +const _commentjson = /*#__PURE__*/ _interop_require_wildcard(require("next/dist/compiled/comment-json")); +const _semver = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/semver")); +const _os = /*#__PURE__*/ _interop_require_default(require("os")); +const _typepaths = require("./type-paths"); +const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../build/output/log")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +function getDesiredCompilerOptions(typescriptVersion, userTsConfig) { + var _userTsConfig_compilerOptions, _userTsConfig_compilerOptions_module, _userTsConfig_compilerOptions1, _userTsConfig_compilerOptions2; + // ModuleKind + const moduleKindESNext = 'esnext'; + const moduleKindES2020 = 'es2020'; + const moduleKindPreserve = 'preserve'; + const moduleKindNodeNext = 'nodenext'; + const moduleKindNode16 = 'node16'; + const moduleKindCommonJS = 'commonjs'; + const moduleKindAMD = 'amd'; + // ModuleResolutionKind + const moduleResolutionKindBundler = 'bundler'; + const moduleResolutionKindNode16 = 'node16'; + const moduleResolutionKindNodeNext = 'nodenext'; + const moduleResolutionKindNode12 = 'node12'; + const moduleResolutionKindNode = 'node'; + const configuredModule = typeof (userTsConfig == null ? void 0 : (_userTsConfig_compilerOptions = userTsConfig.compilerOptions) == null ? void 0 : _userTsConfig_compilerOptions.module) === 'string' ? userTsConfig.compilerOptions.module.toLowerCase() : undefined; + const preferBundlerResolution = _semver.default.gte(typescriptVersion, '5.0.0') && configuredModule !== moduleKindCommonJS && configuredModule !== moduleKindAMD; + // Jsx + const jsxEmitReactJSX = 'react-jsx'; + return { + target: { + suggested: 'ES2017', + reason: 'For top-level `await`. Note: Next.js only polyfills for the esmodules target.' + }, + // These are suggested values and will be set when not present in the + // tsconfig.json + lib: { + suggested: [ + 'dom', + 'dom.iterable', + 'esnext' + ] + }, + allowJs: { + suggested: true + }, + skipLibCheck: { + suggested: true + }, + strict: { + suggested: false + }, + noEmit: { + suggested: true + }, + incremental: { + suggested: true + }, + // These values are required and cannot be changed by the user + // Keep this in sync with the webpack config + // 'parsedValue' matches the output value from ts.parseJsonConfigFileContent() + module: { + parsedValue: moduleKindESNext, + // All of these values work: + parsedValues: [ + _semver.default.gte(typescriptVersion, '5.4.0') && moduleKindPreserve, + moduleKindES2020, + moduleKindESNext, + moduleKindCommonJS, + moduleKindAMD, + moduleKindNodeNext, + moduleKindNode16 + ], + value: 'esnext', + reason: 'for dynamic import() support' + }, + // TODO: Semver check not needed once Next.js repo uses 5.4. + ..._semver.default.gte(typescriptVersion, '5.4.0') && (userTsConfig == null ? void 0 : (_userTsConfig_compilerOptions1 = userTsConfig.compilerOptions) == null ? void 0 : (_userTsConfig_compilerOptions_module = _userTsConfig_compilerOptions1.module) == null ? void 0 : _userTsConfig_compilerOptions_module.toLowerCase()) === moduleKindPreserve ? { + } : { + esModuleInterop: { + value: true, + reason: 'requirement for SWC / babel' + }, + moduleResolution: { + parsedValue: preferBundlerResolution ? moduleResolutionKindBundler : moduleResolutionKindNode, + // All of these values work: + parsedValues: preferBundlerResolution ? [ + moduleResolutionKindNode16, + moduleResolutionKindNodeNext, + moduleResolutionKindBundler + ] : [ + moduleResolutionKindNode, + // only older TypeScript versions have this field + moduleResolutionKindNode12, + moduleResolutionKindNode16, + moduleResolutionKindNodeNext + ], + value: preferBundlerResolution ? moduleResolutionKindBundler : moduleResolutionKindNode, + reason: preferBundlerResolution ? 'to match modern bundler resolution' : 'to match webpack resolution' + }, + resolveJsonModule: { + value: true, + reason: 'to match webpack resolution' + } + }, + ...(userTsConfig == null ? void 0 : (_userTsConfig_compilerOptions2 = userTsConfig.compilerOptions) == null ? void 0 : _userTsConfig_compilerOptions2.verbatimModuleSyntax) === true ? undefined : { + isolatedModules: { + value: true, + reason: 'requirement for SWC / Babel' + } + }, + jsx: { + parsedValue: jsxEmitReactJSX, + value: 'react-jsx', + reason: 'next.js uses the React automatic runtime' + } + }; +} +function getRequiredConfiguration(typescript) { + const res = {}; + const typescriptVersion = typescript.version; + const desiredCompilerOptions = getDesiredCompilerOptions(typescriptVersion); + for (const optionKey of Object.keys(desiredCompilerOptions)){ + const ev = desiredCompilerOptions[optionKey]; + if (!('value' in ev)) { + continue; + } + const value = ev.parsedValue ?? ev.value; + // Convert string values back to TypeScript enum values + if (optionKey === 'module' && typeof value === 'string') { + const moduleMap = { + esnext: typescript.ModuleKind.ESNext, + es2020: typescript.ModuleKind.ES2020, + ...typescript.ModuleKind.Preserve !== undefined ? { + preserve: typescript.ModuleKind.Preserve + } : {}, + nodenext: typescript.ModuleKind.NodeNext, + node16: typescript.ModuleKind.Node16, + commonjs: typescript.ModuleKind.CommonJS, + amd: typescript.ModuleKind.AMD + }; + res[optionKey] = moduleMap[value.toLowerCase()] ?? value; + } else if (optionKey === 'moduleResolution' && typeof value === 'string') { + const moduleResolutionMap = { + bundler: typescript.ModuleResolutionKind.Bundler, + node16: typescript.ModuleResolutionKind.Node16, + nodenext: typescript.ModuleResolutionKind.NodeNext, + node12: typescript.ModuleResolutionKind.Node12, + node: typescript.ModuleResolutionKind.Node10 ?? typescript.ModuleResolutionKind.NodeJs + }; + res[optionKey] = moduleResolutionMap[value.toLowerCase()] ?? value; + } else if (optionKey === 'jsx' && typeof value === 'string') { + const jsxMap = { + 'react-jsx': typescript.JsxEmit.ReactJSX + }; + res[optionKey] = jsxMap[value.toLowerCase()] ?? value; + } else { + res[optionKey] = value; + } + } + return res; +} +const localDevTestFilesExcludeAction = 'NEXT_PRIVATE_LOCAL_DEV_TEST_FILES_EXCLUDE'; +async function writeConfigurationDefaults(typescriptVersion, tsConfigPath, isFirstTimeSetup, hasAppDir, distDir, hasPagesDir, strictRouteTypes) { + var _userTsConfig_compilerOptions; + if (isFirstTimeSetup) { + (0, _fs.writeFileSync)(tsConfigPath, '{}' + _os.default.EOL); + } + const userTsConfigContent = (0, _fs.readFileSync)(tsConfigPath, 'utf8'); + const userTsConfig = _commentjson.parse(userTsConfigContent); + // Bail automatic setup when the user has extended or referenced another config + if ('extends' in userTsConfig || 'references' in userTsConfig) { + return; + } + if ((userTsConfig == null ? void 0 : userTsConfig.compilerOptions) == null) { + userTsConfig.compilerOptions = {}; + isFirstTimeSetup = true; + } + const desiredCompilerOptions = getDesiredCompilerOptions(typescriptVersion, userTsConfig); + const suggestedActions = []; + const requiredActions = []; + for(const optionKey in desiredCompilerOptions){ + const check = desiredCompilerOptions[optionKey]; + if ('suggested' in check) { + if (!(optionKey in (userTsConfig == null ? void 0 : userTsConfig.compilerOptions))) { + userTsConfig.compilerOptions[optionKey] = check.suggested; + suggestedActions.push((0, _picocolors.cyan)(optionKey) + ' was set to ' + (0, _picocolors.bold)(check.suggested) + (check.reason ? ` (${check.reason})` : '')); + } + } else if ('value' in check) { + var _userTsConfig_compilerOptions1; + let existingValue = userTsConfig == null ? void 0 : (_userTsConfig_compilerOptions1 = userTsConfig.compilerOptions) == null ? void 0 : _userTsConfig_compilerOptions1[optionKey]; + if (typeof existingValue === 'string') { + existingValue = existingValue.toLowerCase(); + } + const shouldWriteRequiredValue = ()=>{ + // Check if the option has multiple allowed values + if (check.parsedValues) { + return !check.parsedValues.includes(existingValue); + } + // Check if the option has a single parsed value + if (check.parsedValue) { + return check.parsedValue !== existingValue; + } + // Fall back to direct value comparison + return check.value !== existingValue; + }; + if (shouldWriteRequiredValue()) { + if (!userTsConfig.compilerOptions) { + userTsConfig.compilerOptions = {}; + } + userTsConfig.compilerOptions[optionKey] = check.value; + requiredActions.push((0, _picocolors.cyan)(optionKey) + ' was set to ' + (0, _picocolors.bold)(check.value) + ` (${check.reason})`); + } + } else { + const _ = check; + } + } + // Get type definition glob patterns using shared utility to ensure consistency + // with other TypeScript infrastructure (e.g., runTypeCheck.ts) + const nextTypes = (0, _typepaths.getTypeDefinitionGlobPatterns)(distDir); + if (!('include' in userTsConfig)) { + const defaultInclude = hasAppDir && !strictRouteTypes ? [ + 'next-env.d.ts', + ...nextTypes, + '**/*.mts', + '**/*.ts', + '**/*.tsx' + ] : [ + 'next-env.d.ts', + '**/*.mts', + '**/*.ts', + '**/*.tsx' + ]; + userTsConfig.include = defaultInclude; + suggestedActions.push((0, _picocolors.cyan)('include') + ' was set to [' + (0, _picocolors.bold)(defaultInclude.map((type)=>`'${type}'`).join(', ')) + ']'); + } else if (hasAppDir && !strictRouteTypes) { + const missingFromResolved = []; + for (const type of nextTypes){ + if (!userTsConfig.include.includes(type)) { + missingFromResolved.push(type); + } + } + if (missingFromResolved.length > 0) { + if (!Array.isArray(userTsConfig.include)) { + userTsConfig.include = []; + } + missingFromResolved.forEach((item)=>{ + userTsConfig.include.push(item); + suggestedActions.push((0, _picocolors.cyan)('include') + ' was updated to add ' + (0, _picocolors.bold)(`'${item}'`)); + }); + } + } + // Enable the Next.js typescript plugin. + if (hasAppDir) { + var _userTsConfig_compilerOptions2; + // Check if the config or the resolved config has the plugin already. + const plugins = [ + ...Array.isArray(userTsConfig == null ? void 0 : userTsConfig.plugins) ? userTsConfig.plugins : [], + ...userTsConfig.compilerOptions && Array.isArray(userTsConfig.compilerOptions.plugins) ? userTsConfig.compilerOptions.plugins : [] + ]; + const hasNextPlugin = plugins.some(({ name })=>name === 'next'); + // If the TS config extends on another config, we can't add the `plugin` field + // because that will override the parent config's plugins. + // Instead we have to show a message to the user to add the plugin manually. + if (!userTsConfig.compilerOptions || plugins.length && !hasNextPlugin && 'extends' in userTsConfig && (!userTsConfig.compilerOptions || !userTsConfig.compilerOptions.plugins)) { + _log.info(`\nYour ${(0, _picocolors.bold)('tsconfig.json')} extends another configuration, which means we cannot add the Next.js TypeScript plugin automatically. To improve your development experience, we recommend adding the Next.js plugin (\`${(0, _picocolors.cyan)('"plugins": [{ "name": "next" }]')}\`) manually to your TypeScript configuration. Learn more: https://nextjs.org/docs/app/api-reference/config/typescript#the-typescript-plugin\n`); + } else if (!hasNextPlugin) { + if (!('plugins' in userTsConfig.compilerOptions)) { + userTsConfig.compilerOptions.plugins = []; + } + userTsConfig.compilerOptions.plugins.push({ + name: 'next' + }); + suggestedActions.push((0, _picocolors.cyan)('plugins') + ' was updated to add ' + (0, _picocolors.bold)(`{ name: 'next' }`)); + } + // If `strict` is set to `false` and `strictNullChecks` is set to `false`, + // then set `strictNullChecks` to `true`. + if (hasPagesDir && hasAppDir && !(userTsConfig == null ? void 0 : (_userTsConfig_compilerOptions2 = userTsConfig.compilerOptions) == null ? void 0 : _userTsConfig_compilerOptions2.strict) && !('strictNullChecks' in (userTsConfig == null ? void 0 : userTsConfig.compilerOptions))) { + userTsConfig.compilerOptions.strictNullChecks = true; + suggestedActions.push((0, _picocolors.cyan)('strictNullChecks') + ' was set to ' + (0, _picocolors.bold)(`true`)); + } + } + if (!('exclude' in userTsConfig)) { + userTsConfig.exclude = [ + 'node_modules' + ]; + suggestedActions.push((0, _picocolors.cyan)('exclude') + ' was set to ' + (0, _picocolors.bold)(`['node_modules']`)); + } + // During local development inside Next.js repo, exclude the test files coverage by the local tsconfig + if (process.env.NEXT_PRIVATE_LOCAL_DEV && userTsConfig.exclude) { + const tsGlob = '**/*.test.ts'; + const tsxGlob = '**/*.test.tsx'; + let hasUpdates = false; + if (!userTsConfig.exclude.includes(tsGlob)) { + userTsConfig.exclude.push(tsGlob); + hasUpdates = true; + } + if (!userTsConfig.exclude.includes(tsxGlob)) { + userTsConfig.exclude.push(tsxGlob); + hasUpdates = true; + } + if (hasUpdates) { + requiredActions.push(localDevTestFilesExcludeAction); + } + } + if (suggestedActions.length < 1 && requiredActions.length < 1) { + return; + } + (0, _fs.writeFileSync)(tsConfigPath, _commentjson.stringify(userTsConfig, null, 2) + _os.default.EOL); + _log.info(''); + if (isFirstTimeSetup) { + _log.info(`We detected TypeScript in your project and created a ${(0, _picocolors.cyan)('tsconfig.json')} file for you.`); + return; + } + _log.info(`We detected TypeScript in your project and reconfigured your ${(0, _picocolors.cyan)('tsconfig.json')} file for you.${((_userTsConfig_compilerOptions = userTsConfig.compilerOptions) == null ? void 0 : _userTsConfig_compilerOptions.strict) ? '' : ` Strict-mode is set to ${(0, _picocolors.cyan)('false')} by default.`}`); + if (suggestedActions.length) { + _log.info(`The following suggested values were added to your ${(0, _picocolors.cyan)('tsconfig.json')}. These values ${(0, _picocolors.cyan)('can be changed')} to fit your project's needs:\n`); + suggestedActions.forEach((action)=>_log.info(`\t- ${action}`)); + _log.info(''); + } + const requiredActionsToBeLogged = process.env.NEXT_PRIVATE_LOCAL_DEV ? requiredActions.filter((action)=>action !== localDevTestFilesExcludeAction) : requiredActions; + if (requiredActionsToBeLogged.length) { + _log.info(`The following ${(0, _picocolors.white)('mandatory changes')} were made to your ${(0, _picocolors.cyan)('tsconfig.json')}:\n`); + requiredActionsToBeLogged.forEach((action)=>_log.info(`\t- ${action}`)); + _log.info(''); + } +} + +//# sourceMappingURL=writeConfigurationDefaults.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/typescript/writeConfigurationDefaults.js.map b/e-commerce/node_modules/next/dist/lib/typescript/writeConfigurationDefaults.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f39a14e4de68192b3d3a0ff8d2dc9f5549a1c300 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/typescript/writeConfigurationDefaults.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/typescript/writeConfigurationDefaults.ts"],"sourcesContent":["import { readFileSync, writeFileSync } from 'fs'\nimport { bold, cyan, white } from '../picocolors'\nimport * as CommentJson from 'next/dist/compiled/comment-json'\nimport semver from 'next/dist/compiled/semver'\nimport os from 'os'\nimport type { CompilerOptions } from 'typescript'\nimport { getTypeDefinitionGlobPatterns } from './type-paths'\nimport * as Log from '../../build/output/log'\n\ntype DesiredCompilerOptionsShape = {\n [K in keyof CompilerOptions]:\n | { suggested: any; reason?: string }\n | {\n parsedValue?: any\n parsedValues?: Array\n value: any\n reason: string\n }\n}\n\nfunction getDesiredCompilerOptions(\n typescriptVersion: string,\n userTsConfig?: Record\n): DesiredCompilerOptionsShape {\n // ModuleKind\n const moduleKindESNext = 'esnext'\n const moduleKindES2020 = 'es2020'\n const moduleKindPreserve = 'preserve'\n const moduleKindNodeNext = 'nodenext'\n const moduleKindNode16 = 'node16'\n const moduleKindCommonJS = 'commonjs'\n const moduleKindAMD = 'amd'\n\n // ModuleResolutionKind\n const moduleResolutionKindBundler = 'bundler'\n const moduleResolutionKindNode16 = 'node16'\n const moduleResolutionKindNodeNext = 'nodenext'\n const moduleResolutionKindNode12 = 'node12'\n const moduleResolutionKindNode = 'node'\n const configuredModule =\n typeof userTsConfig?.compilerOptions?.module === 'string'\n ? userTsConfig.compilerOptions.module.toLowerCase()\n : undefined\n const preferBundlerResolution =\n semver.gte(typescriptVersion, '5.0.0') &&\n configuredModule !== moduleKindCommonJS &&\n configuredModule !== moduleKindAMD\n\n // Jsx\n const jsxEmitReactJSX = 'react-jsx'\n\n return {\n target: {\n suggested: 'ES2017',\n reason:\n 'For top-level `await`. Note: Next.js only polyfills for the esmodules target.',\n },\n // These are suggested values and will be set when not present in the\n // tsconfig.json\n lib: { suggested: ['dom', 'dom.iterable', 'esnext'] },\n allowJs: { suggested: true },\n skipLibCheck: { suggested: true },\n strict: { suggested: false },\n noEmit: { suggested: true },\n incremental: { suggested: true },\n\n // These values are required and cannot be changed by the user\n // Keep this in sync with the webpack config\n // 'parsedValue' matches the output value from ts.parseJsonConfigFileContent()\n module: {\n parsedValue: moduleKindESNext,\n // All of these values work:\n parsedValues: [\n semver.gte(typescriptVersion, '5.4.0') && moduleKindPreserve,\n moduleKindES2020,\n moduleKindESNext,\n moduleKindCommonJS,\n moduleKindAMD,\n moduleKindNodeNext,\n moduleKindNode16,\n ],\n value: 'esnext',\n reason: 'for dynamic import() support',\n },\n // TODO: Semver check not needed once Next.js repo uses 5.4.\n ...(semver.gte(typescriptVersion, '5.4.0') &&\n userTsConfig?.compilerOptions?.module?.toLowerCase() === moduleKindPreserve\n ? {\n // TypeScript 5.4 introduced `Preserve`. Using `Preserve` implies\n // - `moduleResolution` is `Bundler`\n // - `esModuleInterop` is `true`\n // - `resolveJsonModule` is `true`\n // This means that if the user is using Preserve, they don't need these options\n }\n : {\n esModuleInterop: {\n value: true,\n reason: 'requirement for SWC / babel',\n },\n moduleResolution: {\n parsedValue: preferBundlerResolution\n ? moduleResolutionKindBundler\n : moduleResolutionKindNode,\n // All of these values work:\n parsedValues: preferBundlerResolution\n ? [\n moduleResolutionKindNode16,\n moduleResolutionKindNodeNext,\n moduleResolutionKindBundler,\n ]\n : [\n moduleResolutionKindNode,\n // only older TypeScript versions have this field\n moduleResolutionKindNode12,\n moduleResolutionKindNode16,\n moduleResolutionKindNodeNext,\n ],\n value: preferBundlerResolution\n ? moduleResolutionKindBundler\n : moduleResolutionKindNode,\n reason: preferBundlerResolution\n ? 'to match modern bundler resolution'\n : 'to match webpack resolution',\n },\n resolveJsonModule: {\n value: true,\n reason: 'to match webpack resolution',\n },\n }),\n ...(userTsConfig?.compilerOptions?.verbatimModuleSyntax === true\n ? undefined\n : {\n isolatedModules: {\n value: true,\n reason: 'requirement for SWC / Babel',\n },\n }),\n jsx: {\n parsedValue: jsxEmitReactJSX,\n value: 'react-jsx',\n reason: 'next.js uses the React automatic runtime',\n },\n } satisfies DesiredCompilerOptionsShape\n}\n\nexport function getRequiredConfiguration(\n typescript: typeof import('typescript')\n): Partial {\n const res: Partial = {}\n const typescriptVersion = typescript.version\n\n const desiredCompilerOptions = getDesiredCompilerOptions(typescriptVersion)\n for (const optionKey of Object.keys(desiredCompilerOptions)) {\n const ev = desiredCompilerOptions[optionKey]\n if (!('value' in ev)) {\n continue\n }\n\n const value = ev.parsedValue ?? ev.value\n\n // Convert string values back to TypeScript enum values\n if (optionKey === 'module' && typeof value === 'string') {\n const moduleMap: Record = {\n esnext: typescript.ModuleKind.ESNext,\n es2020: typescript.ModuleKind.ES2020,\n ...(typescript.ModuleKind.Preserve !== undefined\n ? { preserve: typescript.ModuleKind.Preserve }\n : {}),\n nodenext: typescript.ModuleKind.NodeNext,\n node16: typescript.ModuleKind.Node16,\n commonjs: typescript.ModuleKind.CommonJS,\n amd: typescript.ModuleKind.AMD,\n }\n res[optionKey] = moduleMap[value.toLowerCase()] ?? value\n } else if (optionKey === 'moduleResolution' && typeof value === 'string') {\n const moduleResolutionMap: Record<\n string,\n import('typescript').ModuleResolutionKind\n > = {\n bundler: typescript.ModuleResolutionKind.Bundler,\n node16: typescript.ModuleResolutionKind.Node16,\n nodenext: typescript.ModuleResolutionKind.NodeNext,\n node12: (typescript.ModuleResolutionKind as any).Node12,\n node:\n (typescript.ModuleResolutionKind as any).Node10 ??\n typescript.ModuleResolutionKind.NodeJs,\n }\n res[optionKey] = moduleResolutionMap[value.toLowerCase()] ?? value\n } else if (optionKey === 'jsx' && typeof value === 'string') {\n const jsxMap: Record = {\n 'react-jsx': typescript.JsxEmit.ReactJSX,\n }\n res[optionKey] = jsxMap[value.toLowerCase()] ?? value\n } else {\n res[optionKey] = value\n }\n }\n\n return res\n}\n\nconst localDevTestFilesExcludeAction =\n 'NEXT_PRIVATE_LOCAL_DEV_TEST_FILES_EXCLUDE'\n\nexport async function writeConfigurationDefaults(\n typescriptVersion: string,\n tsConfigPath: string,\n isFirstTimeSetup: boolean,\n hasAppDir: boolean,\n distDir: string,\n hasPagesDir: boolean,\n strictRouteTypes: boolean\n): Promise {\n if (isFirstTimeSetup) {\n writeFileSync(tsConfigPath, '{}' + os.EOL)\n }\n\n const userTsConfigContent = readFileSync(tsConfigPath, 'utf8')\n const userTsConfig = CommentJson.parse(userTsConfigContent)\n\n // Bail automatic setup when the user has extended or referenced another config\n if ('extends' in userTsConfig || 'references' in userTsConfig) {\n return\n }\n\n if (userTsConfig?.compilerOptions == null) {\n userTsConfig.compilerOptions = {}\n isFirstTimeSetup = true\n }\n\n const desiredCompilerOptions = getDesiredCompilerOptions(\n typescriptVersion,\n userTsConfig\n )\n\n const suggestedActions: string[] = []\n const requiredActions: string[] = []\n for (const optionKey in desiredCompilerOptions) {\n const check = desiredCompilerOptions[optionKey]\n if ('suggested' in check) {\n if (!(optionKey in userTsConfig?.compilerOptions)) {\n userTsConfig.compilerOptions[optionKey] = check.suggested\n suggestedActions.push(\n cyan(optionKey) +\n ' was set to ' +\n bold(check.suggested) +\n (check.reason ? ` (${check.reason})` : '')\n )\n }\n } else if ('value' in check) {\n let existingValue = userTsConfig?.compilerOptions?.[optionKey]\n\n if (typeof existingValue === 'string') {\n existingValue = existingValue.toLowerCase()\n }\n\n const shouldWriteRequiredValue = () => {\n // Check if the option has multiple allowed values\n if (check.parsedValues) {\n return !check.parsedValues.includes(existingValue)\n }\n\n // Check if the option has a single parsed value\n if (check.parsedValue) {\n return check.parsedValue !== existingValue\n }\n\n // Fall back to direct value comparison\n return check.value !== existingValue\n }\n\n if (shouldWriteRequiredValue()) {\n if (!userTsConfig.compilerOptions) {\n userTsConfig.compilerOptions = {}\n }\n userTsConfig.compilerOptions[optionKey] = check.value\n requiredActions.push(\n cyan(optionKey) +\n ' was set to ' +\n bold(check.value) +\n ` (${check.reason})`\n )\n }\n } else {\n const _: never = check\n }\n }\n\n // Get type definition glob patterns using shared utility to ensure consistency\n // with other TypeScript infrastructure (e.g., runTypeCheck.ts)\n const nextTypes = getTypeDefinitionGlobPatterns(distDir)\n\n if (!('include' in userTsConfig)) {\n const defaultInclude =\n hasAppDir && !strictRouteTypes\n ? ['next-env.d.ts', ...nextTypes, '**/*.mts', '**/*.ts', '**/*.tsx']\n : ['next-env.d.ts', '**/*.mts', '**/*.ts', '**/*.tsx']\n\n userTsConfig.include = defaultInclude\n suggestedActions.push(\n cyan('include') +\n ' was set to [' +\n bold(defaultInclude.map((type) => `'${type}'`).join(', ')) +\n ']'\n )\n } else if (hasAppDir && !strictRouteTypes) {\n const missingFromResolved = []\n for (const type of nextTypes) {\n if (!userTsConfig.include.includes(type)) {\n missingFromResolved.push(type)\n }\n }\n\n if (missingFromResolved.length > 0) {\n if (!Array.isArray(userTsConfig.include)) {\n userTsConfig.include = []\n }\n\n missingFromResolved.forEach((item) => {\n userTsConfig.include.push(item)\n suggestedActions.push(\n cyan('include') + ' was updated to add ' + bold(`'${item}'`)\n )\n })\n }\n }\n\n // Enable the Next.js typescript plugin.\n if (hasAppDir) {\n // Check if the config or the resolved config has the plugin already.\n const plugins = [\n ...(Array.isArray(userTsConfig?.plugins) ? userTsConfig.plugins : []),\n ...(userTsConfig.compilerOptions &&\n Array.isArray(userTsConfig.compilerOptions.plugins)\n ? userTsConfig.compilerOptions.plugins\n : []),\n ]\n const hasNextPlugin = plugins.some(\n ({ name }: { name: string }) => name === 'next'\n )\n\n // If the TS config extends on another config, we can't add the `plugin` field\n // because that will override the parent config's plugins.\n // Instead we have to show a message to the user to add the plugin manually.\n if (\n !userTsConfig.compilerOptions ||\n (plugins.length &&\n !hasNextPlugin &&\n 'extends' in userTsConfig &&\n (!userTsConfig.compilerOptions ||\n !userTsConfig.compilerOptions.plugins))\n ) {\n Log.info(\n `\\nYour ${bold(\n 'tsconfig.json'\n )} extends another configuration, which means we cannot add the Next.js TypeScript plugin automatically. To improve your development experience, we recommend adding the Next.js plugin (\\`${cyan(\n '\"plugins\": [{ \"name\": \"next\" }]'\n )}\\`) manually to your TypeScript configuration. Learn more: https://nextjs.org/docs/app/api-reference/config/typescript#the-typescript-plugin\\n`\n )\n } else if (!hasNextPlugin) {\n if (!('plugins' in userTsConfig.compilerOptions)) {\n userTsConfig.compilerOptions.plugins = []\n }\n userTsConfig.compilerOptions.plugins.push({ name: 'next' })\n suggestedActions.push(\n cyan('plugins') + ' was updated to add ' + bold(`{ name: 'next' }`)\n )\n }\n\n // If `strict` is set to `false` and `strictNullChecks` is set to `false`,\n // then set `strictNullChecks` to `true`.\n if (\n hasPagesDir &&\n hasAppDir &&\n !userTsConfig?.compilerOptions?.strict &&\n !('strictNullChecks' in userTsConfig?.compilerOptions)\n ) {\n userTsConfig.compilerOptions.strictNullChecks = true\n suggestedActions.push(\n cyan('strictNullChecks') + ' was set to ' + bold(`true`)\n )\n }\n }\n\n if (!('exclude' in userTsConfig)) {\n userTsConfig.exclude = ['node_modules']\n suggestedActions.push(\n cyan('exclude') + ' was set to ' + bold(`['node_modules']`)\n )\n }\n\n // During local development inside Next.js repo, exclude the test files coverage by the local tsconfig\n if (process.env.NEXT_PRIVATE_LOCAL_DEV && userTsConfig.exclude) {\n const tsGlob = '**/*.test.ts'\n const tsxGlob = '**/*.test.tsx'\n let hasUpdates = false\n if (!userTsConfig.exclude.includes(tsGlob)) {\n userTsConfig.exclude.push(tsGlob)\n hasUpdates = true\n }\n if (!userTsConfig.exclude.includes(tsxGlob)) {\n userTsConfig.exclude.push(tsxGlob)\n hasUpdates = true\n }\n\n if (hasUpdates) {\n requiredActions.push(localDevTestFilesExcludeAction)\n }\n }\n\n if (suggestedActions.length < 1 && requiredActions.length < 1) {\n return\n }\n\n writeFileSync(\n tsConfigPath,\n CommentJson.stringify(userTsConfig, null, 2) + os.EOL\n )\n\n Log.info('')\n if (isFirstTimeSetup) {\n Log.info(\n `We detected TypeScript in your project and created a ${cyan(\n 'tsconfig.json'\n )} file for you.`\n )\n return\n }\n\n Log.info(\n `We detected TypeScript in your project and reconfigured your ${cyan(\n 'tsconfig.json'\n )} file for you.${\n userTsConfig.compilerOptions?.strict\n ? ''\n : ` Strict-mode is set to ${cyan('false')} by default.`\n }`\n )\n\n if (suggestedActions.length) {\n Log.info(\n `The following suggested values were added to your ${cyan(\n 'tsconfig.json'\n )}. These values ${cyan('can be changed')} to fit your project's needs:\\n`\n )\n\n suggestedActions.forEach((action) => Log.info(`\\t- ${action}`))\n\n Log.info('')\n }\n\n const requiredActionsToBeLogged = process.env.NEXT_PRIVATE_LOCAL_DEV\n ? requiredActions.filter(\n (action) => action !== localDevTestFilesExcludeAction\n )\n : requiredActions\n\n if (requiredActionsToBeLogged.length) {\n Log.info(\n `The following ${white('mandatory changes')} were made to your ${cyan(\n 'tsconfig.json'\n )}:\\n`\n )\n\n requiredActionsToBeLogged.forEach((action) => Log.info(`\\t- ${action}`))\n\n Log.info('')\n }\n}\n"],"names":["getRequiredConfiguration","writeConfigurationDefaults","getDesiredCompilerOptions","typescriptVersion","userTsConfig","moduleKindESNext","moduleKindES2020","moduleKindPreserve","moduleKindNodeNext","moduleKindNode16","moduleKindCommonJS","moduleKindAMD","moduleResolutionKindBundler","moduleResolutionKindNode16","moduleResolutionKindNodeNext","moduleResolutionKindNode12","moduleResolutionKindNode","configuredModule","compilerOptions","module","toLowerCase","undefined","preferBundlerResolution","semver","gte","jsxEmitReactJSX","target","suggested","reason","lib","allowJs","skipLibCheck","strict","noEmit","incremental","parsedValue","parsedValues","value","esModuleInterop","moduleResolution","resolveJsonModule","verbatimModuleSyntax","isolatedModules","jsx","typescript","res","version","desiredCompilerOptions","optionKey","Object","keys","ev","moduleMap","esnext","ModuleKind","ESNext","es2020","ES2020","Preserve","preserve","nodenext","NodeNext","node16","Node16","commonjs","CommonJS","amd","AMD","moduleResolutionMap","bundler","ModuleResolutionKind","Bundler","node12","Node12","node","Node10","NodeJs","jsxMap","JsxEmit","ReactJSX","localDevTestFilesExcludeAction","tsConfigPath","isFirstTimeSetup","hasAppDir","distDir","hasPagesDir","strictRouteTypes","writeFileSync","os","EOL","userTsConfigContent","readFileSync","CommentJson","parse","suggestedActions","requiredActions","check","push","cyan","bold","existingValue","shouldWriteRequiredValue","includes","_","nextTypes","getTypeDefinitionGlobPatterns","defaultInclude","include","map","type","join","missingFromResolved","length","Array","isArray","forEach","item","plugins","hasNextPlugin","some","name","Log","info","strictNullChecks","exclude","process","env","NEXT_PRIVATE_LOCAL_DEV","tsGlob","tsxGlob","hasUpdates","stringify","action","requiredActionsToBeLogged","filter","white"],"mappings":";;;;;;;;;;;;;;;IAiJgBA,wBAAwB;eAAxBA;;IA2DMC,0BAA0B;eAA1BA;;;oBA5MsB;4BACV;qEACL;+DACV;2DACJ;2BAE+B;6DACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAarB,SAASC,0BACPC,iBAAyB,EACzBC,YAAkC;QAkBzBA,+BA8CPA,sCAAAA,gCA2CIA;IAzGN,aAAa;IACb,MAAMC,mBAAmB;IACzB,MAAMC,mBAAmB;IACzB,MAAMC,qBAAqB;IAC3B,MAAMC,qBAAqB;IAC3B,MAAMC,mBAAmB;IACzB,MAAMC,qBAAqB;IAC3B,MAAMC,gBAAgB;IAEtB,uBAAuB;IACvB,MAAMC,8BAA8B;IACpC,MAAMC,6BAA6B;IACnC,MAAMC,+BAA+B;IACrC,MAAMC,6BAA6B;IACnC,MAAMC,2BAA2B;IACjC,MAAMC,mBACJ,QAAOb,iCAAAA,gCAAAA,aAAcc,eAAe,qBA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C,EACzD;IAGJ,IAAIJ,iBAAiBkB,MAAM,EAAE;QAC3BS,KAAIC,IAAI,CACN,CAAC,kDAAkD,EAAExB,IAAAA,gBAAI,EACvD,iBACA,eAAe,EAAEA,IAAAA,gBAAI,EAAC,kBAAkB,+BAA+B,CAAC;QAG5EJ,iBAAiBqB,OAAO,CAAC,CAACiB,SAAWX,KAAIC,IAAI,CAAC,CAAC,IAAI,EAAEU,QAAQ;QAE7DX,KAAIC,IAAI,CAAC;IACX;IAEA,MAAMW,4BAA4BR,QAAQC,GAAG,CAACC,sBAAsB,GAChEhC,gBAAgBuC,MAAM,CACpB,CAACF,SAAWA,WAAWpD,kCAEzBe;IAEJ,IAAIsC,0BAA0BrB,MAAM,EAAE;QACpCS,KAAIC,IAAI,CACN,CAAC,cAAc,EAAEa,IAAAA,iBAAK,EAAC,qBAAqB,mBAAmB,EAAErC,IAAAA,gBAAI,EACnE,iBACA,GAAG,CAAC;QAGRmC,0BAA0BlB,OAAO,CAAC,CAACiB,SAAWX,KAAIC,IAAI,CAAC,CAAC,IAAI,EAAEU,QAAQ;QAEtEX,KAAIC,IAAI,CAAC;IACX;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/different-major.md b/e-commerce/node_modules/next/dist/lib/upgrade/different-major.md new file mode 100644 index 0000000000000000000000000000000000000000..2f929e72a987db48dea7fb3a973881ed56a0e122 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/different-major.md @@ -0,0 +1,58 @@ +Each section has a checklist of items to complete. Read line by line and complete +each item before moving on to the next section. + +When a security gate stops a command during another task, rerun that command once +as instructed so the original task can continue with a warning. Tell the user +about the finding and ask whether they want to run the upgrade. Continue +independent work while waiting. If approved, complete the upgrade. + +For `latest`, the CLI pins npm's `canary` dist-tag for canary installations. +Stable, RC, beta, and numbered preview installations use the stable `latest` +dist-tag when it is newer than the installed version. + +Security upgrades and advisory checks are supported only for stable installations. +Canary installations support `latest` and `experimental-future` without advisory assessment. + +## 1. Make a checklist + +- [ ] Read `../docs/01-app/02-guides/upgrading/codemods.md` and + `../docs/01-app/02-guides/upgrading/version-.md` for each crossed major + from version 14 onward. Include each **Review migration checklist**. +- [ ] For crossed majors through version 13, read the Pages Router guide under + `../docs/02-pages/02-guides/upgrading/` and derive the checklist from it. +- [ ] Stop if a required guide is missing. + +## 2. Upgrade and repair + +- [ ] Run the exact command prepared for this upgrade: + +```text + +``` + +- [ ] Run the codemod once, directly to the exact target. Do not install + intermediate Next.js versions or rerun the codemod for each crossed + major. +- [ ] If a required option is unavailable, correct the tool version or stop. +- [ ] Complete the codemod's manual steps, resolve its review markers, and + complete every applicable migration item. Keep only changes required by + the final target. +- [ ] Set `experimental.agentUpgrade` to the policy specified in the + prompt, preserving unrelated configuration. If the target Next.js version + does not support this option, skip the setting and report why. + +## 3. Verify + +**This is the most important step.** + +- [ ] Review the checklist created in step 1 and verify that every item has been + completed. Iterate until every item is addressed as applied or blocked + with a reason. +- [ ] Run the repository's checks, build when supported, and test affected + runtime behavior. +- [ ] Complete the verification checklist in `shared.md`. + +## Deliver + +- [ ] After verifying the migration and any requested Future Defaults adoption, + return to `shared.md` and complete its delivery checklist. diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/future-defaults.d.ts b/e-commerce/node_modules/next/dist/lib/upgrade/future-defaults.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..42f1dbe48610553a27c5d5969f05dbb917468b87 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/future-defaults.d.ts @@ -0,0 +1,19 @@ +import type { NextConfigComplete } from '../../server/config-shared'; +export type UpgradeDocument = `docs/${string}.md` | `skills/${string}/SKILL.md`; +export declare const futureDefaults: readonly [{ + readonly name: "Cache Components"; + readonly availableSince: "16.3.0"; + readonly isAdopted: (config: Pick) => boolean; + readonly adoptionDoc: readonly ["docs/01-app/02-guides/migrating-to-cache-components.md", "skills/next-cache-components-adoption/SKILL.md"]; + readonly optimizationDoc: readonly ["skills/next-cache-components-optimizer/SKILL.md"]; + readonly isApplicable: (directory: string) => boolean; +}]; +export type FutureDefaultEntry = (typeof futureDefaults)[number]; +export declare function getPendingFutureDefaults(directory: string, config: Pick, version: string): { + readonly name: "Cache Components"; + readonly availableSince: "16.3.0"; + readonly isAdopted: (config: Pick) => boolean; + readonly adoptionDoc: readonly ["docs/01-app/02-guides/migrating-to-cache-components.md", "skills/next-cache-components-adoption/SKILL.md"]; + readonly optimizationDoc: readonly ["skills/next-cache-components-optimizer/SKILL.md"]; + readonly isApplicable: (directory: string) => boolean; +}[]; diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/future-defaults.js b/e-commerce/node_modules/next/dist/lib/upgrade/future-defaults.js new file mode 100644 index 0000000000000000000000000000000000000000..150eebcdfe791dfebfcd659ad11a90af643534a7 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/future-defaults.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + futureDefaults: null, + getPendingFutureDefaults: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + futureDefaults: function() { + return futureDefaults; + }, + getPendingFutureDefaults: function() { + return getPendingFutureDefaults; + } +}); +const _semver = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/semver")); +const _findpagesdir = require("../find-pages-dir"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +const futureDefaults = [ + // TODO: Add `partialPrefetching` after the Cache Components Future Default + // workflow is proven end to end. + { + name: 'Cache Components', + availableSince: '16.3.0', + isAdopted: (config)=>config.cacheComponents === true, + adoptionDoc: [ + 'docs/01-app/02-guides/migrating-to-cache-components.md', + 'skills/next-cache-components-adoption/SKILL.md' + ], + optimizationDoc: [ + 'skills/next-cache-components-optimizer/SKILL.md' + ], + // TODO: Support Pages -> App migration before offering adoption to Pages-only apps. + isApplicable: (directory)=>(0, _findpagesdir.findDir)(directory, 'app') !== null + } +]; +function getPendingFutureDefaults(directory, config, version) { + var _semver_prerelease; + if (!_semver.default.valid(version) || _semver.default.prerelease(version) && ((_semver_prerelease = _semver.default.prerelease(version)) == null ? void 0 : _semver_prerelease[0]) !== 'canary') { + return []; + } + return futureDefaults.filter((entry)=>_semver.default.gte(version, entry.availableSince) && !entry.isAdopted(config) && entry.isApplicable(directory)); +} + +//# sourceMappingURL=future-defaults.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/future-defaults.js.map b/e-commerce/node_modules/next/dist/lib/upgrade/future-defaults.js.map new file mode 100644 index 0000000000000000000000000000000000000000..9cfa7ca28ba43aab91488df1d16a0280466b25f2 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/future-defaults.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/upgrade/future-defaults.ts"],"sourcesContent":["import type { NextConfigComplete } from '../../server/config-shared'\nimport semver from 'next/dist/compiled/semver'\nimport { findDir } from '../find-pages-dir'\n\nexport type UpgradeDocument = `docs/${string}.md` | `skills/${string}/SKILL.md`\n\ntype FutureDefault = {\n name: string\n availableSince: string\n isAdopted(config: Pick): boolean\n adoptionDoc: readonly UpgradeDocument[]\n optimizationDoc: readonly UpgradeDocument[]\n isApplicable(directory: string): boolean\n}\n\nexport const futureDefaults = [\n // TODO: Add `partialPrefetching` after the Cache Components Future Default\n // workflow is proven end to end.\n {\n name: 'Cache Components',\n availableSince: '16.3.0',\n isAdopted: (config) => config.cacheComponents === true,\n adoptionDoc: [\n 'docs/01-app/02-guides/migrating-to-cache-components.md',\n 'skills/next-cache-components-adoption/SKILL.md',\n ],\n optimizationDoc: ['skills/next-cache-components-optimizer/SKILL.md'],\n // TODO: Support Pages -> App migration before offering adoption to Pages-only apps.\n isApplicable: (directory) => findDir(directory, 'app') !== null,\n },\n] as const satisfies readonly FutureDefault[]\n\nexport type FutureDefaultEntry = (typeof futureDefaults)[number]\n\nexport function getPendingFutureDefaults(\n directory: string,\n config: Pick,\n version: string\n) {\n if (\n !semver.valid(version) ||\n (semver.prerelease(version) && semver.prerelease(version)?.[0] !== 'canary')\n ) {\n return []\n }\n return futureDefaults.filter(\n (entry) =>\n semver.gte(version, entry.availableSince) &&\n !entry.isAdopted(config) &&\n entry.isApplicable(directory)\n )\n}\n"],"names":["futureDefaults","getPendingFutureDefaults","name","availableSince","isAdopted","config","cacheComponents","adoptionDoc","optimizationDoc","isApplicable","directory","findDir","version","semver","valid","prerelease","filter","entry","gte"],"mappings":";;;;;;;;;;;;;;;IAeaA,cAAc;eAAdA;;IAmBGC,wBAAwB;eAAxBA;;;+DAjCG;8BACK;;;;;;AAajB,MAAMD,iBAAiB;IAC5B,2EAA2E;IAC3E,iCAAiC;IACjC;QACEE,MAAM;QACNC,gBAAgB;QAChBC,WAAW,CAACC,SAAWA,OAAOC,eAAe,KAAK;QAClDC,aAAa;YACX;YACA;SACD;QACDC,iBAAiB;YAAC;SAAkD;QACpE,oFAAoF;QACpFC,cAAc,CAACC,YAAcC,IAAAA,qBAAO,EAACD,WAAW,WAAW;IAC7D;CACD;AAIM,SAAST,yBACdS,SAAiB,EACjBL,MAAmD,EACnDO,OAAe;QAIkBC;IAFjC,IACE,CAACA,eAAM,CAACC,KAAK,CAACF,YACbC,eAAM,CAACE,UAAU,CAACH,YAAYC,EAAAA,qBAAAA,eAAM,CAACE,UAAU,CAACH,6BAAlBC,kBAA4B,CAAC,EAAE,MAAK,UACnE;QACA,OAAO,EAAE;IACX;IACA,OAAOb,eAAegB,MAAM,CAC1B,CAACC,QACCJ,eAAM,CAACK,GAAG,CAACN,SAASK,MAAMd,cAAc,KACxC,CAACc,MAAMb,SAAS,CAACC,WACjBY,MAAMR,YAAY,CAACC;AAEzB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/future-defaults.md b/e-commerce/node_modules/next/dist/lib/upgrade/future-defaults.md new file mode 100644 index 0000000000000000000000000000000000000000..b47b9a0cce42ec6436cfbade2a69279d6ad10524 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/future-defaults.md @@ -0,0 +1,20 @@ +Follow the Future Default adoption documents listed in the prompt. If the +installed and target Next.js versions differ, complete the version guide first. + +## Adopt and verify + +- [ ] Set `experimental.agentUpgrade` to the policy specified in the + prompt, preserving unrelated configuration. If the installed Next.js + version does not support this option, skip the setting and report why. +- [ ] Read and follow each adoption document in the prompt, in order. If none + are listed, continue to delivery. Complete each adoption; remove temporary + opt-outs and TODO markers after repair. +- [ ] Run the repository's checks, build when supported, and test affected + runtime behavior. Verify each adoption before moving to the next. +- [ ] Complete the verification checklist in `shared.md` for each adoption + before moving to the next. + +## Deliver + +- [ ] After verifying the adoption, return to `shared.md` and complete its + delivery checklist. diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/harness.d.ts b/e-commerce/node_modules/next/dist/lib/upgrade/harness.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..81cc66f727778c9640ff3c476d0767f4924313f1 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/harness.d.ts @@ -0,0 +1,4 @@ +import type { AgentUpgradeHandoffMethod } from '../../telemetry/events/agent-upgrade'; +type UpgradePrompt = string | ((useWorktree: boolean | null) => string); +export declare function handoffUpgrade(prompt: UpgradePrompt, directory: string, onHandoff: ((method: AgentUpgradeHandoffMethod, selectedAgentProduct: string | null) => void) | null): Promise<'handed_off' | 'cancelled' | 'failed'>; +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/harness.js b/e-commerce/node_modules/next/dist/lib/upgrade/harness.js new file mode 100644 index 0000000000000000000000000000000000000000..311eaed9a642f10012d588a657165c7b7e75dfed --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/harness.js @@ -0,0 +1,458 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "handoffUpgrade", { + enumerable: true, + get: function() { + return handoffUpgrade; + } +}); +const _fs = require("fs"); +const _promises = require("fs/promises"); +const _path = require("path"); +const _cliselect = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/cli-select")); +const _crossspawn = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/cross-spawn")); +const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../build/output/log")); +const _agentname = require("../../telemetry/agent-name"); +const _picocolors = require("../picocolors"); +const _modeldiscovery = require("./model-discovery"); +const _runchildprocess = require("./run-child-process"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +const CODEX_APPROVAL_ARGS = [ + '--sandbox', + 'workspace-write', + '--ask-for-approval', + 'on-request' +]; +function resolvePrompt(prompt, useWorktree) { + return typeof prompt === 'string' ? prompt : prompt(useWorktree); +} +async function chooseOption(question, values, defaultValue, firstPrompt = false) { + _log.bootstrap(''); + _log.bootstrap(` ${question}`); + _log.bootstrap(` ${(0, _picocolors.dim)(`Use ↑/↓ to choose, Enter to confirm, or Esc to ${firstPrompt ? 'cancel' : 'go back'}.`)}\n`); + let interrupted = false; + const onKeypress = (_text, key)=>{ + if (key.ctrl && key.name === 'c') { + interrupted = true; + } + }; + process.stdin.on('keypress', onKeypress); + try { + const { id } = await (0, _cliselect.default)({ + values, + defaultValue, + selected: (0, _picocolors.cyan)('❯'), + unselected: ' ', + indentation: 2, + valueRenderer: (value, selected)=>selected ? (0, _picocolors.cyan)((0, _picocolors.bold)(value)) : value + }); + if (typeof id === 'string') { + _log.bootstrap(` ${(0, _picocolors.cyan)('❯')} ${(0, _picocolors.cyan)((0, _picocolors.bold)(values[id]))}`); + return id; + } + return undefined; + } catch (error) { + if (error !== undefined) { + throw error; + } + return interrupted ? null : undefined; + } finally{ + process.stdin.removeListener('keypress', onKeypress); + } +} +async function chooseWorktree() { + const choice = await chooseOption('Open the upgrade in a separate Git worktree?', { + yes: 'Yes', + no: 'No' + }, 0); + if (choice === null || choice === undefined) { + return choice; + } + if (choice === 'yes') { + return true; + } + if (choice === 'no') { + return false; + } + throw new Error(`Unknown worktree choice: ${choice}`); +} +function getHarnessDisplayName(name) { + return name === 'codex' ? 'Codex' : 'Claude Code'; +} +function supportsCodexAutoReview(path) { + const result = _crossspawn.default.sync(path, [ + '--help' + ], { + encoding: 'utf8', + timeout: 5000 + }); + return result.status === 0 && /--approve-for-me\b/.test(result.stdout ?? ''); +} +function getClaudePermissionSupport(path) { + var _result_stdout_match, _result_stdout, _permissionModeHelp_match; + const result = _crossspawn.default.sync(path, [ + '--help' + ], { + encoding: 'utf8', + timeout: 5000 + }); + const permissionModeHelp = result.status === 0 ? (_result_stdout = result.stdout) == null ? void 0 : (_result_stdout_match = _result_stdout.match(/--permission-mode[^\n]*(?:\n[ \t]{8,}[^\n]*){0,4}/)) == null ? void 0 : _result_stdout_match[0] : null; + const choices = permissionModeHelp == null ? void 0 : (_permissionModeHelp_match = permissionModeHelp.match(/\(choices:\s*([^)]+)\)/)) == null ? void 0 : _permissionModeHelp_match[1]; + const supportedModes = new Set((choices == null ? void 0 : choices.match(/[A-Za-z]+/g)) ?? []); + return { + auto: supportedModes.has('auto'), + approvalMode: supportedModes.has('manual') ? 'manual' : supportedModes.has('default') ? 'default' : null + }; +} +async function findHarnesses() { + const names = [ + 'codex', + 'claude' + ]; + const directories = (process.env.PATH ?? '').split(_path.delimiter).filter(Boolean); + const extensions = process.platform === 'win32' ? (process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM').split(';').filter(Boolean) : [ + '' + ]; + // Probe agents independently, preserving menu order and each detected path. + const installed = await Promise.all(names.map(async (name)=>{ + for (const directory of directories){ + for (const extension of extensions){ + const file = (0, _path.resolve)(directory, `${name}${extension}`); + try { + await (0, _promises.access)(file, process.platform === 'win32' ? _fs.constants.F_OK : _fs.constants.X_OK); + if ((await (0, _promises.stat)(file)).isFile()) { + return { + name, + path: file + }; + } + } catch (error) { + const code = error.code; + if (code === 'ENOENT' || code === 'EACCES' || code === 'ENOTDIR' || code === 'ELOOP') { + continue; + } + throw new Error(`Could not inspect coding agent at ${file}.`, { + cause: error + }); + } + } + } + return null; + })); + return installed.filter((harness)=>harness !== null); +} +async function chooseHarness(harnesses, previousName) { + const question = harnesses.length === 1 ? `${getHarnessDisplayName(harnesses[0].name)} detected. Would you like to proceed?` : 'Multiple coding agents detected. Which one would you like to use?'; + const id = await chooseOption(question, { + ...Object.fromEntries(harnesses.map(({ name })=>[ + name, + `Continue with ${getHarnessDisplayName(name)}` + ])), + copy: 'Copy prompt for another coding agent' + }, Math.max(0, harnesses.findIndex(({ name })=>name === previousName)), true); + return id === 'copy' ? 'copy' : harnesses.find(({ name })=>name === id); +} +function copyUpgradePrompt(prompt, noHarness) { + const commands = process.platform === 'darwin' ? [ + [ + 'pbcopy' + ] + ] : process.platform === 'win32' ? [ + [ + 'clip.exe' + ] + ] : [ + [ + 'wl-copy' + ], + [ + 'xclip', + '-selection', + 'clipboard' + ], + [ + 'xsel', + '--clipboard', + '--input' + ] + ]; + for (const [command, ...args] of commands){ + const result = _crossspawn.default.sync(command, args, { + input: process.platform === 'win32' ? Buffer.from(prompt, 'utf16le') : prompt, + stdio: [ + 'pipe', + 'ignore', + 'ignore' + ], + timeout: 1000, + windowsHide: true + }); + if (!result.error && result.status === 0) { + _log.info(noHarness ? 'No supported coding agent found. The upgrade prompt was copied to your clipboard.' : 'Upgrade prompt copied. Paste it into your coding agent.'); + return 'copied_prompt'; + } + } + _log.info(noHarness ? 'No supported coding agent found. Copy this upgrade prompt:' : 'Could not access the clipboard. Copy this upgrade prompt:'); + _log.bootstrap(prompt); + return 'printed_prompt'; +} +function launchHarness(harness, prompt, directory, model, effort, permissionArgs, onSpawn) { + // Windows shell shims cannot carry literal line breaks in an argument. + if (process.platform === 'win32' && /\.(cmd|bat)$/i.test(harness.path)) { + prompt = prompt.replace(/[\r\n]+/g, ' '); + } + const args = model === null ? [] : [ + '--model', + model + ]; + if (effort !== 'default') { + if (harness.name === 'codex') { + args.push('-c', `model_reasoning_effort=${effort}`); + } else { + args.push('--effort', effort); + } + } + args.push(...permissionArgs); + args.push(prompt); + return (0, _runchildprocess.runChildProcess)(harness.path, args, { + cwd: directory, + stdio: 'inherit' + }, onSpawn); +} +async function handoffUpgrade(prompt, directory, onHandoff) { + // Existing agents keep their session and permissions. + const existingAgent = await (0, _agentname.getAgentName)(); + if (existingAgent) { + _log.bootstrap(resolvePrompt(prompt, null)); + onHandoff == null ? void 0 : onHandoff('existing_agent', existingAgent); + return 'handed_off'; + } + if (!process.stdin.isTTY || !process.stdout.isTTY) { + _log.info('Copy this upgrade prompt into your coding agent:'); + _log.bootstrap(resolvePrompt(prompt, null)); + onHandoff == null ? void 0 : onHandoff('printed_prompt', null); + return 'handed_off'; + } + _log.info((0, _picocolors.dim)('Looking for coding agents...')); + const installed = await findHarnesses(); + if (installed.length === 0) { + const method = copyUpgradePrompt(resolvePrompt(prompt, null), true); + onHandoff == null ? void 0 : onHandoff(method, null); + return 'handed_off'; + } + const discoveryController = new AbortController(); + const modelCatalogs = new Map(installed.map(({ name, path })=>[ + name, + (0, _modeldiscovery.getHarnessModels)(name, path, directory, discoveryController.signal) + ])); + const stopDiscovery = async ()=>{ + discoveryController.abort(); + await Promise.all(modelCatalogs.values()); + }; + try { + let stage = 'harness'; + let harness; + let model; + let effort; + let autoPermissionArgs = null; + let approvalPermissionArgs = []; + let permissionArgs = []; + let useAuto = true; + let useWorktree = true; + const previousModelStage = ()=>model ? model.efforts.length > 0 ? 'effort' : 'model' : 'harness'; + let codexAutoReview; + let claudePermissionSupport; + while(true){ + if (stage === 'harness') { + const choice = await chooseHarness(installed, harness == null ? void 0 : harness.name); + if (choice === 'copy') { + const method = copyUpgradePrompt(resolvePrompt(prompt, null), false); + onHandoff == null ? void 0 : onHandoff(method, null); + return 'handed_off'; + } + if (!choice) { + break; + } + harness = choice; + stage = 'model'; + } else if (stage === 'model') { + const models = await modelCatalogs.get(harness.name); + if (models === null) { + break; + } + if (models.length === 0) { + model = undefined; + effort = 'default'; + stage = 'effort'; + continue; + } + const selectedModelId = model == null ? void 0 : model.id; + const previousModelId = models.some(({ id })=>id === selectedModelId) ? selectedModelId : undefined; + const modelId = await chooseOption(`Which ${getHarnessDisplayName(harness.name)} model should run the upgrade?`, Object.fromEntries(models.map(({ id, label, description })=>[ + id, + description ? `${label} — ${description}` : label + ])), Math.max(0, models.findIndex(({ id, isDefault })=>previousModelId ? id === previousModelId : isDefault))); + if (modelId === null) { + break; + } + if (modelId === undefined) { + stage = 'harness'; + continue; + } + model = models.find(({ id })=>id === modelId); + if (!model) { + throw new Error(`Unknown upgrade model: ${modelId}`); + } + if (!model.efforts.includes(effort ?? 'default')) { + effort = 'default'; + } + stage = 'effort'; + } else if (stage === 'effort') { + if (model && model.efforts.length > 0) { + const efforts = [ + 'default', + ...model.efforts + ]; + const previousEffortIndex = efforts.indexOf(effort ?? 'default'); + const selectedEffort = await chooseOption('Which reasoning effort should the upgrade use?', Object.fromEntries(efforts.map((value)=>[ + value, + value === 'default' ? 'Model default' : value + ])), Math.max(0, previousEffortIndex)); + if (selectedEffort === null) { + break; + } + if (selectedEffort === undefined) { + stage = 'model'; + continue; + } + if (!efforts.includes(selectedEffort)) { + throw new Error(`Unknown upgrade effort: ${selectedEffort}`); + } + effort = selectedEffort; + } + if (harness.name === 'codex') { + codexAutoReview ??= supportsCodexAutoReview(harness.path); + autoPermissionArgs = codexAutoReview ? [ + '--approve-for-me' + ] : null; + approvalPermissionArgs = [ + ...CODEX_APPROVAL_ARGS + ]; + } else { + const { auto, approvalMode } = claudePermissionSupport ??= getClaudePermissionSupport(harness.path); + if (!approvalMode) { + _log.error('Could not determine a supported Claude approval mode.'); + process.exitCode = 1; + return 'failed'; + } + autoPermissionArgs = auto ? [ + '--permission-mode', + 'auto' + ] : null; + approvalPermissionArgs = [ + '--permission-mode', + approvalMode + ]; + } + if (autoPermissionArgs) { + stage = 'permission'; + } else { + _log.info((0, _picocolors.dim)('Auto permission mode is unavailable; using approval requests.')); + permissionArgs = approvalPermissionArgs; + stage = 'worktree'; + } + } else if (stage === 'permission') { + const permissionChoice = await chooseOption(`Use Auto permission mode for ${getHarnessDisplayName(harness.name)}?`, { + yes: 'Yes', + no: 'No, ask for approval' + }, useAuto ? 0 : 1); + if (permissionChoice === null) { + break; + } + if (permissionChoice === undefined) { + stage = previousModelStage(); + continue; + } + useAuto = permissionChoice === 'yes'; + permissionArgs = useAuto ? autoPermissionArgs : approvalPermissionArgs; + stage = 'worktree'; + } else { + const choice = await chooseWorktree(); + if (choice === null) { + break; + } + if (choice === undefined) { + stage = autoPermissionArgs ? 'permission' : previousModelStage(); + continue; + } + useWorktree = choice; + _log.bootstrap(` Continuing with ${(0, _picocolors.cyan)((0, _picocolors.bold)(getHarnessDisplayName(harness.name)))}...\n`); + // Capture the selected agent before the launch callback runs. + const agentProduct = harness.name; + await stopDiscovery(); + try { + process.exitCode = await launchHarness(harness, resolvePrompt(prompt, useWorktree), directory, (model == null ? void 0 : model.id) ?? null, effort, permissionArgs, ()=>onHandoff == null ? void 0 : onHandoff('launched_agent', agentProduct)); + } catch { + _log.error(`Could not start ${getHarnessDisplayName(harness.name)}.`); + process.exitCode = 1; + return 'failed'; + } + return 'handed_off'; + } + } + _log.bootstrap(` ${(0, _picocolors.dim)('Upgrade cancelled.')}\n`); + process.exitCode = 1; + return 'cancelled'; + } finally{ + await stopDiscovery(); + } +} + +//# sourceMappingURL=harness.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/harness.js.map b/e-commerce/node_modules/next/dist/lib/upgrade/harness.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f220c952241397f4f53ec50fab2e0c6c551d497b --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/harness.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/upgrade/harness.ts"],"sourcesContent":["import { constants } from 'fs'\nimport { access, stat } from 'fs/promises'\nimport { delimiter, resolve } from 'path'\nimport type { Key } from 'readline'\n\nimport cliSelect from 'next/dist/compiled/cli-select'\nimport spawn from 'next/dist/compiled/cross-spawn'\n\nimport * as Log from '../../build/output/log'\nimport { getAgentName } from '../../telemetry/agent-name'\nimport type { AgentUpgradeHandoffMethod } from '../../telemetry/events/agent-upgrade'\nimport { bold, cyan, dim } from '../picocolors'\nimport { getHarnessModels, type UpgradeModel } from './model-discovery'\nimport { runChildProcess } from './run-child-process'\n\nconst CODEX_APPROVAL_ARGS = [\n '--sandbox',\n 'workspace-write',\n '--ask-for-approval',\n 'on-request',\n] as const\n\ntype UpgradeHarness = {\n name: 'codex' | 'claude'\n path: string\n}\n\ntype UpgradePrompt = string | ((useWorktree: boolean | null) => string)\n\nfunction resolvePrompt(\n prompt: UpgradePrompt,\n useWorktree: boolean | null\n): string {\n return typeof prompt === 'string' ? prompt : prompt(useWorktree)\n}\n\nasync function chooseOption(\n question: string,\n values: Record,\n defaultValue: number,\n firstPrompt = false\n): Promise {\n Log.bootstrap('')\n Log.bootstrap(` ${question}`)\n Log.bootstrap(\n ` ${dim(`Use ↑/↓ to choose, Enter to confirm, or Esc to ${firstPrompt ? 'cancel' : 'go back'}.`)}\\n`\n )\n\n let interrupted = false\n const onKeypress = (_text: string, key: Key) => {\n if (key.ctrl && key.name === 'c') {\n interrupted = true\n }\n }\n process.stdin.on('keypress', onKeypress)\n try {\n const { id } = await cliSelect({\n values,\n defaultValue,\n selected: cyan('❯'),\n unselected: ' ',\n indentation: 2,\n valueRenderer: (value: string, selected: boolean) =>\n selected ? cyan(bold(value)) : value,\n })\n if (typeof id === 'string') {\n Log.bootstrap(` ${cyan('❯')} ${cyan(bold(values[id]))}`)\n return id\n }\n return undefined\n } catch (error) {\n if (error !== undefined) {\n throw error\n }\n return interrupted ? null : undefined\n } finally {\n process.stdin.removeListener('keypress', onKeypress)\n }\n}\n\nasync function chooseWorktree(): Promise {\n const choice = await chooseOption(\n 'Open the upgrade in a separate Git worktree?',\n { yes: 'Yes', no: 'No' },\n 0\n )\n if (choice === null || choice === undefined) {\n return choice\n }\n if (choice === 'yes') {\n return true\n }\n if (choice === 'no') {\n return false\n }\n throw new Error(`Unknown worktree choice: ${choice}`)\n}\n\nfunction getHarnessDisplayName(name: UpgradeHarness['name']): string {\n return name === 'codex' ? 'Codex' : 'Claude Code'\n}\n\nfunction supportsCodexAutoReview(path: string): boolean {\n const result = spawn.sync(path, ['--help'], {\n encoding: 'utf8',\n timeout: 5000,\n })\n return result.status === 0 && /--approve-for-me\\b/.test(result.stdout ?? '')\n}\n\nfunction getClaudePermissionSupport(path: string) {\n const result = spawn.sync(path, ['--help'], {\n encoding: 'utf8',\n timeout: 5000,\n })\n const permissionModeHelp =\n result.status === 0\n ? result.stdout?.match(\n /--permission-mode[^\\n]*(?:\\n[ \\t]{8,}[^\\n]*){0,4}/\n )?.[0]\n : null\n const choices = permissionModeHelp?.match(/\\(choices:\\s*([^)]+)\\)/)?.[1]\n const supportedModes = new Set(choices?.match(/[A-Za-z]+/g) ?? [])\n\n return {\n auto: supportedModes.has('auto'),\n approvalMode: supportedModes.has('manual')\n ? 'manual'\n : supportedModes.has('default')\n ? 'default'\n : null,\n }\n}\n\nasync function findHarnesses(): Promise {\n const names: UpgradeHarness['name'][] = ['codex', 'claude']\n const directories = (process.env.PATH ?? '').split(delimiter).filter(Boolean)\n const extensions =\n process.platform === 'win32'\n ? (process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM')\n .split(';')\n .filter(Boolean)\n : ['']\n\n // Probe agents independently, preserving menu order and each detected path.\n const installed = await Promise.all(\n names.map(async (name): Promise => {\n for (const directory of directories) {\n for (const extension of extensions) {\n const file = resolve(directory, `${name}${extension}`)\n\n try {\n await access(\n file,\n process.platform === 'win32' ? constants.F_OK : constants.X_OK\n )\n\n if ((await stat(file)).isFile()) {\n return { name, path: file }\n }\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code\n if (\n code === 'ENOENT' ||\n code === 'EACCES' ||\n code === 'ENOTDIR' ||\n code === 'ELOOP'\n ) {\n continue\n }\n throw new Error(`Could not inspect coding agent at ${file}.`, {\n cause: error,\n })\n }\n }\n }\n\n return null\n })\n )\n\n return installed.filter(\n (harness): harness is UpgradeHarness => harness !== null\n )\n}\n\nasync function chooseHarness(\n harnesses: UpgradeHarness[],\n previousName: UpgradeHarness['name'] | undefined\n): Promise {\n const question =\n harnesses.length === 1\n ? `${getHarnessDisplayName(harnesses[0].name)} detected. Would you like to proceed?`\n : 'Multiple coding agents detected. Which one would you like to use?'\n\n const id = await chooseOption(\n question,\n {\n ...Object.fromEntries(\n harnesses.map(({ name }) => [\n name,\n `Continue with ${getHarnessDisplayName(name)}`,\n ])\n ),\n copy: 'Copy prompt for another coding agent',\n },\n Math.max(\n 0,\n harnesses.findIndex(({ name }) => name === previousName)\n ),\n true\n )\n return id === 'copy' ? 'copy' : harnesses.find(({ name }) => name === id)\n}\n\nfunction copyUpgradePrompt(\n prompt: string,\n noHarness: boolean\n): AgentUpgradeHandoffMethod {\n const commands =\n process.platform === 'darwin'\n ? [['pbcopy']]\n : process.platform === 'win32'\n ? [['clip.exe']]\n : [\n ['wl-copy'],\n ['xclip', '-selection', 'clipboard'],\n ['xsel', '--clipboard', '--input'],\n ]\n\n for (const [command, ...args] of commands) {\n const result = spawn.sync(command, args, {\n input:\n process.platform === 'win32' ? Buffer.from(prompt, 'utf16le') : prompt,\n stdio: ['pipe', 'ignore', 'ignore'],\n timeout: 1000,\n windowsHide: true,\n })\n\n if (!result.error && result.status === 0) {\n Log.info(\n noHarness\n ? 'No supported coding agent found. The upgrade prompt was copied to your clipboard.'\n : 'Upgrade prompt copied. Paste it into your coding agent.'\n )\n return 'copied_prompt'\n }\n }\n\n Log.info(\n noHarness\n ? 'No supported coding agent found. Copy this upgrade prompt:'\n : 'Could not access the clipboard. Copy this upgrade prompt:'\n )\n Log.bootstrap(prompt)\n return 'printed_prompt'\n}\n\nfunction launchHarness(\n harness: UpgradeHarness,\n prompt: string,\n directory: string,\n model: string | null,\n effort: string,\n permissionArgs: readonly string[],\n onSpawn: () => void\n): Promise {\n // Windows shell shims cannot carry literal line breaks in an argument.\n if (process.platform === 'win32' && /\\.(cmd|bat)$/i.test(harness.path)) {\n prompt = prompt.replace(/[\\r\\n]+/g, ' ')\n }\n\n const args = model === null ? [] : ['--model', model]\n if (effort !== 'default') {\n if (harness.name === 'codex') {\n args.push('-c', `model_reasoning_effort=${effort}`)\n } else {\n args.push('--effort', effort)\n }\n }\n args.push(...permissionArgs)\n args.push(prompt)\n return runChildProcess(\n harness.path,\n args,\n {\n cwd: directory,\n stdio: 'inherit',\n },\n onSpawn\n )\n}\n\nexport async function handoffUpgrade(\n prompt: UpgradePrompt,\n directory: string,\n onHandoff:\n | ((\n method: AgentUpgradeHandoffMethod,\n selectedAgentProduct: string | null\n ) => void)\n | null\n): Promise<'handed_off' | 'cancelled' | 'failed'> {\n // Existing agents keep their session and permissions.\n const existingAgent = await getAgentName()\n if (existingAgent) {\n Log.bootstrap(resolvePrompt(prompt, null))\n onHandoff?.('existing_agent', existingAgent)\n return 'handed_off'\n }\n\n if (!process.stdin.isTTY || !process.stdout.isTTY) {\n Log.info('Copy this upgrade prompt into your coding agent:')\n Log.bootstrap(resolvePrompt(prompt, null))\n onHandoff?.('printed_prompt', null)\n return 'handed_off'\n }\n\n Log.info(dim('Looking for coding agents...'))\n const installed = await findHarnesses()\n\n if (installed.length === 0) {\n const method = copyUpgradePrompt(resolvePrompt(prompt, null), true)\n onHandoff?.(method, null)\n return 'handed_off'\n }\n\n const discoveryController = new AbortController()\n const modelCatalogs = new Map(\n installed.map(({ name, path }) => [\n name,\n getHarnessModels(name, path, directory, discoveryController.signal),\n ])\n )\n const stopDiscovery = async () => {\n discoveryController.abort()\n await Promise.all(modelCatalogs.values())\n }\n\n try {\n let stage: 'harness' | 'model' | 'effort' | 'permission' | 'worktree' =\n 'harness'\n let harness: UpgradeHarness | undefined\n let model: UpgradeModel | undefined\n let effort: string | undefined\n let autoPermissionArgs: string[] | null = null\n let approvalPermissionArgs: string[] = []\n let permissionArgs: string[] = []\n let useAuto = true\n let useWorktree = true\n const previousModelStage = () =>\n model ? (model.efforts.length > 0 ? 'effort' : 'model') : 'harness'\n let codexAutoReview: boolean | undefined\n let claudePermissionSupport:\n | ReturnType\n | undefined\n\n while (true) {\n if (stage === 'harness') {\n const choice = await chooseHarness(installed, harness?.name)\n if (choice === 'copy') {\n const method = copyUpgradePrompt(resolvePrompt(prompt, null), false)\n onHandoff?.(method, null)\n return 'handed_off'\n }\n if (!choice) {\n break\n }\n harness = choice\n stage = 'model'\n } else if (stage === 'model') {\n const models = await modelCatalogs.get(harness!.name)!\n if (models === null) {\n break\n }\n if (models.length === 0) {\n model = undefined\n effort = 'default'\n stage = 'effort'\n continue\n }\n const selectedModelId = model?.id\n const previousModelId = models.some(({ id }) => id === selectedModelId)\n ? selectedModelId\n : undefined\n const modelId = await chooseOption(\n `Which ${getHarnessDisplayName(harness!.name)} model should run the upgrade?`,\n Object.fromEntries(\n models.map(({ id, label, description }) => [\n id,\n description ? `${label} — ${description}` : label,\n ])\n ),\n Math.max(\n 0,\n models.findIndex(({ id, isDefault }) =>\n previousModelId ? id === previousModelId : isDefault\n )\n )\n )\n if (modelId === null) {\n break\n }\n if (modelId === undefined) {\n stage = 'harness'\n continue\n }\n model = models.find(({ id }) => id === modelId)\n if (!model) {\n throw new Error(`Unknown upgrade model: ${modelId}`)\n }\n if (!model.efforts.includes(effort ?? 'default')) {\n effort = 'default'\n }\n stage = 'effort'\n } else if (stage === 'effort') {\n if (model && model.efforts.length > 0) {\n const efforts = ['default', ...model.efforts]\n const previousEffortIndex = efforts.indexOf(effort ?? 'default')\n const selectedEffort = await chooseOption(\n 'Which reasoning effort should the upgrade use?',\n Object.fromEntries(\n efforts.map((value) => [\n value,\n value === 'default' ? 'Model default' : value,\n ])\n ),\n Math.max(0, previousEffortIndex)\n )\n if (selectedEffort === null) {\n break\n }\n if (selectedEffort === undefined) {\n stage = 'model'\n continue\n }\n if (!efforts.includes(selectedEffort)) {\n throw new Error(`Unknown upgrade effort: ${selectedEffort}`)\n }\n effort = selectedEffort\n }\n if (harness!.name === 'codex') {\n codexAutoReview ??= supportsCodexAutoReview(harness!.path)\n autoPermissionArgs = codexAutoReview ? ['--approve-for-me'] : null\n approvalPermissionArgs = [...CODEX_APPROVAL_ARGS]\n } else {\n const { auto, approvalMode } = (claudePermissionSupport ??=\n getClaudePermissionSupport(harness!.path))\n if (!approvalMode) {\n Log.error('Could not determine a supported Claude approval mode.')\n process.exitCode = 1\n return 'failed'\n }\n autoPermissionArgs = auto ? ['--permission-mode', 'auto'] : null\n approvalPermissionArgs = ['--permission-mode', approvalMode]\n }\n if (autoPermissionArgs) {\n stage = 'permission'\n } else {\n Log.info(\n dim('Auto permission mode is unavailable; using approval requests.')\n )\n permissionArgs = approvalPermissionArgs\n stage = 'worktree'\n }\n } else if (stage === 'permission') {\n const permissionChoice = await chooseOption(\n `Use Auto permission mode for ${getHarnessDisplayName(harness!.name)}?`,\n { yes: 'Yes', no: 'No, ask for approval' },\n useAuto ? 0 : 1\n )\n if (permissionChoice === null) {\n break\n }\n if (permissionChoice === undefined) {\n stage = previousModelStage()\n continue\n }\n useAuto = permissionChoice === 'yes'\n permissionArgs = useAuto ? autoPermissionArgs! : approvalPermissionArgs\n stage = 'worktree'\n } else {\n const choice = await chooseWorktree()\n if (choice === null) {\n break\n }\n if (choice === undefined) {\n stage = autoPermissionArgs ? 'permission' : previousModelStage()\n continue\n }\n useWorktree = choice\n Log.bootstrap(\n ` Continuing with ${cyan(bold(getHarnessDisplayName(harness!.name)))}...\\n`\n )\n // Capture the selected agent before the launch callback runs.\n const agentProduct = harness!.name\n await stopDiscovery()\n\n try {\n process.exitCode = await launchHarness(\n harness!,\n resolvePrompt(prompt, useWorktree),\n directory,\n model?.id ?? null,\n effort!,\n permissionArgs,\n () => onHandoff?.('launched_agent', agentProduct)\n )\n } catch {\n Log.error(`Could not start ${getHarnessDisplayName(harness!.name)}.`)\n process.exitCode = 1\n return 'failed'\n }\n return 'handed_off'\n }\n }\n\n Log.bootstrap(` ${dim('Upgrade cancelled.')}\\n`)\n process.exitCode = 1\n return 'cancelled'\n } finally {\n await stopDiscovery()\n }\n}\n"],"names":["handoffUpgrade","CODEX_APPROVAL_ARGS","resolvePrompt","prompt","useWorktree","chooseOption","question","values","defaultValue","firstPrompt","Log","bootstrap","dim","interrupted","onKeypress","_text","key","ctrl","name","process","stdin","on","id","cliSelect","selected","cyan","unselected","indentation","valueRenderer","value","bold","undefined","error","removeListener","chooseWorktree","choice","yes","no","Error","getHarnessDisplayName","supportsCodexAutoReview","path","result","spawn","sync","encoding","timeout","status","test","stdout","getClaudePermissionSupport","permissionModeHelp","match","choices","supportedModes","Set","auto","has","approvalMode","findHarnesses","names","directories","env","PATH","split","delimiter","filter","Boolean","extensions","platform","PATHEXT","installed","Promise","all","map","directory","extension","file","resolve","access","constants","F_OK","X_OK","stat","isFile","code","cause","harness","chooseHarness","harnesses","previousName","length","Object","fromEntries","copy","Math","max","findIndex","find","copyUpgradePrompt","noHarness","commands","command","args","input","Buffer","from","stdio","windowsHide","info","launchHarness","model","effort","permissionArgs","onSpawn","replace","push","runChildProcess","cwd","onHandoff","existingAgent","getAgentName","isTTY","method","discoveryController","AbortController","modelCatalogs","Map","getHarnessModels","signal","stopDiscovery","abort","stage","autoPermissionArgs","approvalPermissionArgs","useAuto","previousModelStage","efforts","codexAutoReview","claudePermissionSupport","models","get","selectedModelId","previousModelId","some","modelId","label","description","isDefault","includes","previousEffortIndex","indexOf","selectedEffort","exitCode","permissionChoice","agentProduct"],"mappings":";;;;+BAqSsBA;;;eAAAA;;;oBArSI;0BACG;sBACM;kEAGb;mEACJ;6DAEG;2BACQ;4BAEG;gCACoB;iCACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhC,MAAMC,sBAAsB;IAC1B;IACA;IACA;IACA;CACD;AASD,SAASC,cACPC,MAAqB,EACrBC,WAA2B;IAE3B,OAAO,OAAOD,WAAW,WAAWA,SAASA,OAAOC;AACtD;AAEA,eAAeC,aACbC,QAAgB,EAChBC,MAA8B,EAC9BC,YAAoB,EACpBC,cAAc,KAAK;IAEnBC,KAAIC,SAAS,CAAC;IACdD,KAAIC,SAAS,CAAC,CAAC,EAAE,EAAEL,UAAU;IAC7BI,KAAIC,SAAS,CACX,CAAC,EAAE,EAAEC,IAAAA,eAAG,EAAC,CAAC,+CAA+C,EAAEH,cAAc,WAAW,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC;IAGvG,IAAII,cAAc;IAClB,MAAMC,aAAa,CAACC,OAAeC;QACjC,IAAIA,IAAIC,IAAI,IAAID,IAAIE,IAAI,KAAK,KAAK;YAChCL,cAAc;QAChB;IACF;IACAM,QAAQC,KAAK,CAACC,EAAE,CAAC,YAAYP;IAC7B,IAAI;QACF,MAAM,EAAEQ,EAAE,EAAE,GAAG,MAAMC,IAAAA,kBAAS,EAAC;YAC7BhB;YACAC;YACA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AAC,CAAC,gBAAgB,EAAEO,sBAAsBgD,QAASrE,IAAI,EAAE,CAAC,CAAC;oBACpEC,QAAQsI,QAAQ,GAAG;oBACnB,OAAO;gBACT;gBACA,OAAO;YACT;QACF;QAEA/I,KAAIC,SAAS,CAAC,CAAC,EAAE,EAAEC,IAAAA,eAAG,EAAC,sBAAsB,EAAE,CAAC;QAChDO,QAAQsI,QAAQ,GAAG;QACnB,OAAO;IACT,SAAU;QACR,MAAMvB;IACR;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/model-discovery.d.ts b/e-commerce/node_modules/next/dist/lib/upgrade/model-discovery.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..68b3398da86d4d4d9b59af3e8d39fdb08c1af76d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/model-discovery.d.ts @@ -0,0 +1,10 @@ +export type UpgradeModel = { + id: string; + label: string; + description: string; + efforts: string[]; + isDefault: boolean; +}; +export declare function getCodexModels(path: string, cwd: string, signal?: AbortSignal): Promise; +export declare function getClaudeModels(path: string, cwd: string, signal?: AbortSignal): Promise; +export declare function getHarnessModels(name: 'codex' | 'claude', path: string, cwd: string, signal?: AbortSignal): Promise; diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/model-discovery.js b/e-commerce/node_modules/next/dist/lib/upgrade/model-discovery.js new file mode 100644 index 0000000000000000000000000000000000000000..5500319561b79b2fbffe235db4a20eff8cfbf2cb --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/model-discovery.js @@ -0,0 +1,259 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + getClaudeModels: null, + getCodexModels: null, + getHarnessModels: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + getClaudeModels: function() { + return getClaudeModels; + }, + getCodexModels: function() { + return getCodexModels; + }, + getHarnessModels: function() { + return getHarnessModels; + } +}); +const _crypto = require("crypto"); +const _crossspawn = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/cross-spawn")); +const _debug = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/debug")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +const debug = (0, _debug.default)('next:upgrade'); +function record(value) { + return value !== null && typeof value === 'object' && !Array.isArray(value) ? value : {}; +} +function string(value) { + return typeof value === 'string' ? value : ''; +} +function efforts(value) { + return Array.isArray(value) ? [ + ...new Set(value.map(string).filter((level)=>level && level !== 'default')) + ] : []; +} +function parseModels(value, parse) { + if (!Array.isArray(value)) { + throw new Error('unexpected model catalog format'); + } + return value.map((entry)=>parse(record(entry))).filter((model)=>model !== null); +} +function getCodexModels(path, cwd, signal) { + return discoverModels('codex', path, [ + 'app-server' + ], cwd, signal, (send, complete)=>{ + const initializeId = (0, _crypto.randomUUID)(); + let listId; + const models = []; + const cursors = new Set(); + const list = (cursor)=>{ + listId = (0, _crypto.randomUUID)(); + send({ + id: listId, + method: 'model/list', + params: { + includeHidden: false, + ...cursor ? { + cursor + } : {} + } + }); + }; + return { + initialize () { + send({ + id: initializeId, + method: 'initialize', + params: { + clientInfo: { + name: 'next_upgrade', + version: '1' + } + } + }); + }, + receive (message) { + if (message.id !== initializeId && (listId === undefined || message.id !== listId)) return; + if (message.error) throw new Error('CLI returned a protocol error'); + if (message.id === initializeId) { + if (!message.result) throw new Error('missing initialization result'); + send({ + method: 'initialized' + }); + list(); + return; + } + const response = record(message.result); + models.push(...parseModels(response.data, (model)=>{ + const id = string(model.model); + if (!id || model.hidden === true) return null; + return { + id, + label: string(model.displayName) || id, + description: string(model.description), + efforts: efforts(Array.isArray(model.supportedReasoningEfforts) ? model.supportedReasoningEfforts.map((level)=>record(level).reasoningEffort) : undefined), + isDefault: model.isDefault === true + }; + })); + const cursor = response.nextCursor; + if (cursor !== null && cursor !== undefined) { + if (typeof cursor !== 'string' || !cursor || cursors.has(cursor)) { + throw new Error('invalid pagination cursor'); + } + cursors.add(cursor); + list(cursor); + return; + } + complete(models); + } + }; + }); +} +function getClaudeModels(path, cwd, signal) { + return discoverModels('claude', path, [ + '-p', + '--input-format', + 'stream-json', + '--output-format', + 'stream-json', + '--verbose', + '--no-session-persistence' + ], cwd, signal, (send, complete)=>{ + const initializeId = (0, _crypto.randomUUID)(); + return { + initialize () { + send({ + type: 'control_request', + request_id: initializeId, + request: { + subtype: 'initialize' + } + }); + }, + receive (message) { + if (message.type !== 'control_response') return; + const response = record(message.response); + if (response.request_id !== initializeId) return; + if (response.subtype !== 'success') throw new Error('CLI returned an initialization error'); + complete(parseModels(record(response.response).models, (model)=>{ + const id = string(model.value); + if (!id) return null; + return { + id, + label: string(model.displayName) || id, + description: string(model.description), + efforts: model.supportsEffort === false ? [] : efforts(model.supportedEffortLevels), + isDefault: id === 'default' + }; + })); + } + }; + }); +} +function getHarnessModels(name, path, cwd, signal) { + return name === 'codex' ? getCodexModels(path, cwd, signal) : getClaudeModels(path, cwd, signal); +} +// null means discovery was cancelled, rather than an unavailable catalog. +async function discoverModels(name, path, args, cwd, signal, createProtocol) { + if (signal == null ? void 0 : signal.aborted) return null; + let child; + try { + child = (0, _crossspawn.default)(path, args, { + cwd, + stdio: 'pipe' + }); + } catch { + debug('%s model discovery failed: could not start CLI', name); + return []; + } + return new Promise((resolve)=>{ + var _child_stdout, _child_stdout1, // Drain stderr, but never log raw CLI output (which may contain credentials). + _child_stderr, _child_stdin; + let buffer = ''; + let bytes = 0; + let stopping = false; + let result = []; + let killTimer; + const stop = (value, reason)=>{ + var _child_stdin; + if (stopping) return; + stopping = true; + result = value; + clearTimeout(timeout); + if (reason) debug('%s model discovery failed: %s', name, reason); + (_child_stdin = child.stdin) == null ? void 0 : _child_stdin.end(); + child.kill('SIGTERM'); + killTimer = setTimeout(()=>child.kill('SIGKILL'), 250); + }; + const timeout = setTimeout(()=>stop([], 'timed out'), 5000); + const interrupt = ()=>stop(null); + process.on('SIGINT', interrupt); + process.on('SIGTERM', interrupt); + process.on('SIGHUP', interrupt); + const send = (message)=>{ + var _child_stdin; + if (!stopping) (_child_stdin = child.stdin) == null ? void 0 : _child_stdin.write(JSON.stringify(message) + '\n'); + }; + const protocol = createProtocol(send, (models)=>{ + const unique = [ + ...new Map(models.map((model)=>[ + model.id, + model + ])).values() + ]; + stop(unique, unique.length ? undefined : 'no usable models'); + }); + signal == null ? void 0 : signal.addEventListener('abort', interrupt, { + once: true + }); + const countOutput = (chunk)=>{ + bytes += Buffer.byteLength(chunk); + if (bytes > 20 * 1024 * 1024) stop([], 'output limit exceeded'); + }; + (_child_stdout = child.stdout) == null ? void 0 : _child_stdout.setEncoding('utf8'); + (_child_stdout1 = child.stdout) == null ? void 0 : _child_stdout1.on('data', (chunk)=>{ + countOutput(chunk); + if (stopping) return; + buffer += chunk; + let newline; + while(!stopping && (newline = buffer.indexOf('\n')) !== -1){ + const line = buffer.slice(0, newline).trim(); + buffer = buffer.slice(newline + 1); + if (!line) continue; + try { + protocol.receive(record(JSON.parse(line))); + } catch { + stop([], 'invalid discovery response'); + } + } + }); + (_child_stderr = child.stderr) == null ? void 0 : _child_stderr.on('data', countOutput); + (_child_stdin = child.stdin) == null ? void 0 : _child_stdin.on('error', ()=>stop([], 'could not write discovery request')); + child.on('error', ()=>stop([], 'could not start CLI')); + child.once('close', ()=>{ + clearTimeout(timeout); + clearTimeout(killTimer); + process.removeListener('SIGINT', interrupt); + process.removeListener('SIGTERM', interrupt); + process.removeListener('SIGHUP', interrupt); + signal == null ? void 0 : signal.removeEventListener('abort', interrupt); + if (!stopping) debug('%s model discovery failed: CLI exited early', name); + resolve(result); + }); + child.once('spawn', protocol.initialize); + }); +} + +//# sourceMappingURL=model-discovery.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/model-discovery.js.map b/e-commerce/node_modules/next/dist/lib/upgrade/model-discovery.js.map new file mode 100644 index 0000000000000000000000000000000000000000..94b7ed5f39853f135810c91e7bdc7dcfac15ee45 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/model-discovery.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/upgrade/model-discovery.ts"],"sourcesContent":["import { randomUUID } from 'crypto'\nimport spawn from 'next/dist/compiled/cross-spawn'\nimport createDebug from 'next/dist/compiled/debug'\n\nconst debug = createDebug('next:upgrade')\n\nexport type UpgradeModel = {\n id: string\n label: string\n description: string\n efforts: string[]\n isDefault: boolean\n}\n\nfunction record(value: unknown): Record {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n ? (value as Record)\n : {}\n}\n\nfunction string(value: unknown): string {\n return typeof value === 'string' ? value : ''\n}\n\nfunction efforts(value: unknown): string[] {\n return Array.isArray(value)\n ? [\n ...new Set(\n value.map(string).filter((level) => level && level !== 'default')\n ),\n ]\n : []\n}\n\nfunction parseModels(\n value: unknown,\n parse: (model: Record) => UpgradeModel | null\n): UpgradeModel[] {\n if (!Array.isArray(value)) {\n throw new Error('unexpected model catalog format')\n }\n return value\n .map((entry) => parse(record(entry)))\n .filter((model) => model !== null)\n}\n\ntype DiscoveryProtocol = {\n initialize(): void\n receive(message: Record): void\n}\n\nexport function getCodexModels(\n path: string,\n cwd: string,\n signal?: AbortSignal\n) {\n return discoverModels(\n 'codex',\n path,\n ['app-server'],\n cwd,\n signal,\n (send, complete) => {\n const initializeId = randomUUID()\n let listId: string | undefined\n const models: UpgradeModel[] = []\n const cursors = new Set()\n const list = (cursor?: string) => {\n listId = randomUUID()\n send({\n id: listId,\n method: 'model/list',\n params: { includeHidden: false, ...(cursor ? { cursor } : {}) },\n })\n }\n return {\n initialize() {\n send({\n id: initializeId,\n method: 'initialize',\n params: { clientInfo: { name: 'next_upgrade', version: '1' } },\n })\n },\n receive(message) {\n if (\n message.id !== initializeId &&\n (listId === undefined || message.id !== listId)\n )\n return\n if (message.error) throw new Error('CLI returned a protocol error')\n if (message.id === initializeId) {\n if (!message.result)\n throw new Error('missing initialization result')\n send({ method: 'initialized' })\n list()\n return\n }\n const response = record(message.result)\n models.push(\n ...parseModels(response.data, (model) => {\n const id = string(model.model)\n if (!id || model.hidden === true) return null\n return {\n id,\n label: string(model.displayName) || id,\n description: string(model.description),\n efforts: efforts(\n Array.isArray(model.supportedReasoningEfforts)\n ? model.supportedReasoningEfforts.map(\n (level) => record(level).reasoningEffort\n )\n : undefined\n ),\n isDefault: model.isDefault === true,\n }\n })\n )\n const cursor = response.nextCursor\n if (cursor !== null && cursor !== undefined) {\n if (typeof cursor !== 'string' || !cursor || cursors.has(cursor)) {\n throw new Error('invalid pagination cursor')\n }\n cursors.add(cursor)\n list(cursor)\n return\n }\n complete(models)\n },\n }\n }\n )\n}\n\nexport function getClaudeModels(\n path: string,\n cwd: string,\n signal?: AbortSignal\n) {\n return discoverModels(\n 'claude',\n path,\n [\n '-p',\n '--input-format',\n 'stream-json',\n '--output-format',\n 'stream-json',\n '--verbose',\n '--no-session-persistence',\n ],\n cwd,\n signal,\n (send, complete) => {\n const initializeId = randomUUID()\n return {\n initialize() {\n send({\n type: 'control_request',\n request_id: initializeId,\n request: { subtype: 'initialize' },\n })\n },\n receive(message) {\n if (message.type !== 'control_response') return\n const response = record(message.response)\n if (response.request_id !== initializeId) return\n if (response.subtype !== 'success')\n throw new Error('CLI returned an initialization error')\n complete(\n parseModels(record(response.response).models, (model) => {\n const id = string(model.value)\n if (!id) return null\n return {\n id,\n label: string(model.displayName) || id,\n description: string(model.description),\n efforts:\n model.supportsEffort === false\n ? []\n : efforts(model.supportedEffortLevels),\n isDefault: id === 'default',\n }\n })\n )\n },\n }\n }\n )\n}\n\nexport function getHarnessModels(\n name: 'codex' | 'claude',\n path: string,\n cwd: string,\n signal?: AbortSignal\n): Promise {\n return name === 'codex'\n ? getCodexModels(path, cwd, signal)\n : getClaudeModels(path, cwd, signal)\n}\n\n// null means discovery was cancelled, rather than an unavailable catalog.\nasync function discoverModels(\n name: string,\n path: string,\n args: string[],\n cwd: string,\n signal: AbortSignal | undefined,\n createProtocol: (\n send: (message: unknown) => void,\n complete: (models: UpgradeModel[]) => void\n ) => DiscoveryProtocol\n): Promise {\n if (signal?.aborted) return null\n let child: ReturnType\n try {\n child = spawn(path, args, { cwd, stdio: 'pipe' })\n } catch {\n debug('%s model discovery failed: could not start CLI', name)\n return []\n }\n\n return new Promise((resolve) => {\n let buffer = ''\n let bytes = 0\n let stopping = false\n let result: UpgradeModel[] | null = []\n let killTimer: ReturnType | undefined\n\n const stop = (value: UpgradeModel[] | null, reason?: string) => {\n if (stopping) return\n stopping = true\n result = value\n clearTimeout(timeout)\n if (reason) debug('%s model discovery failed: %s', name, reason)\n child.stdin?.end()\n child.kill('SIGTERM')\n killTimer = setTimeout(() => child.kill('SIGKILL'), 250)\n }\n const timeout = setTimeout(() => stop([], 'timed out'), 5000)\n const interrupt = () => stop(null)\n process.on('SIGINT', interrupt)\n process.on('SIGTERM', interrupt)\n process.on('SIGHUP', interrupt)\n\n const send = (message: unknown) => {\n if (!stopping) child.stdin?.write(JSON.stringify(message) + '\\n')\n }\n const protocol = createProtocol(send, (models) => {\n const unique = [\n ...new Map(models.map((model) => [model.id, model])).values(),\n ]\n stop(unique, unique.length ? undefined : 'no usable models')\n })\n signal?.addEventListener('abort', interrupt, { once: true })\n const countOutput = (chunk: Buffer | string) => {\n bytes += Buffer.byteLength(chunk)\n if (bytes > 20 * 1024 * 1024) stop([], 'output limit exceeded')\n }\n child.stdout?.setEncoding('utf8')\n child.stdout?.on('data', (chunk: string) => {\n countOutput(chunk)\n if (stopping) return\n buffer += chunk\n let newline: number\n while (!stopping && (newline = buffer.indexOf('\\n')) !== -1) {\n const line = buffer.slice(0, newline).trim()\n buffer = buffer.slice(newline + 1)\n if (!line) continue\n try {\n protocol.receive(record(JSON.parse(line)))\n } catch {\n stop([], 'invalid discovery response')\n }\n }\n })\n // Drain stderr, but never log raw CLI output (which may contain credentials).\n child.stderr?.on('data', countOutput)\n child.stdin?.on('error', () =>\n stop([], 'could not write discovery request')\n )\n child.on('error', () => stop([], 'could not start CLI'))\n child.once('close', () => {\n clearTimeout(timeout)\n clearTimeout(killTimer)\n process.removeListener('SIGINT', interrupt)\n process.removeListener('SIGTERM', interrupt)\n process.removeListener('SIGHUP', interrupt)\n signal?.removeEventListener('abort', interrupt)\n if (!stopping) debug('%s model discovery failed: CLI exited early', name)\n resolve(result)\n })\n child.once('spawn', protocol.initialize)\n })\n}\n"],"names":["getClaudeModels","getCodexModels","getHarnessModels","debug","createDebug","record","value","Array","isArray","string","efforts","Set","map","filter","level","parseModels","parse","Error","entry","model","path","cwd","signal","discoverModels","send","complete","initializeId","randomUUID","listId","models","cursors","list","cursor","id","method","params","includeHidden","initialize","clientInfo","name","version","receive","message","undefined","error","result","response","push","data","hidden","label","displayName","description","supportedReasoningEfforts","reasoningEffort","isDefault","nextCursor","has","add","type","request_id","request","subtype","supportsEffort","supportedEffortLevels","args","createProtocol","aborted","child","spawn","stdio","Promise","resolve","buffer","bytes","stopping","killTimer","stop","reason","clearTimeout","timeout","stdin","end","kill","setTimeout","interrupt","process","on","write","JSON","stringify","protocol","unique","Map","values","length","addEventListener","once","countOutput","chunk","Buffer","byteLength","stdout","setEncoding","newline","indexOf","line","slice","trim","stderr","removeListener","removeEventListener"],"mappings":";;;;;;;;;;;;;;;;IAqIgBA,eAAe;eAAfA;;IAlFAC,cAAc;eAAdA;;IA2IAC,gBAAgB;eAAhBA;;;wBA9LW;mEACT;8DACM;;;;;;AAExB,MAAMC,QAAQC,IAAAA,cAAW,EAAC;AAU1B,SAASC,OAAOC,KAAc;IAC5B,OAAOA,UAAU,QAAQ,OAAOA,UAAU,YAAY,CAACC,MAAMC,OAAO,CAACF,SAChEA,QACD,CAAC;AACP;AAEA,SAASG,OAAOH,KAAc;IAC5B,OAAO,OAAOA,UAAU,WAAWA,QAAQ;AAC7C;AAEA,SAASI,QAAQJ,KAAc;IAC7B,OAAOC,MAAMC,OAAO,CAACF,SACjB;WACK,IAAIK,IACLL,MAAMM,GAAG,CAAC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,OAAOkC,KAAK,CAAC,GAAGH,SAASI,IAAI;gBAC1CnC,SAASA,OAAOkC,KAAK,CAACH,UAAU;gBAChC,IAAI,CAACE,MAAM;gBACX,IAAI;oBACFf,SAASlD,OAAO,CAACpC,OAAOoF,KAAKzE,KAAK,CAAC0F;gBACrC,EAAE,OAAM;oBACN7B,KAAK,EAAE,EAAE;gBACX;YACF;QACF;SAEAT,gBAAAA,MAAMyC,MAAM,qBAAZzC,cAAcmB,EAAE,CAAC,QAAQW;SACzB9B,eAAAA,MAAMa,KAAK,qBAAXb,aAAamB,EAAE,CAAC,SAAS,IACvBV,KAAK,EAAE,EAAE;QAEXT,MAAMmB,EAAE,CAAC,SAAS,IAAMV,KAAK,EAAE,EAAE;QACjCT,MAAM6B,IAAI,CAAC,SAAS;YAClBlB,aAAaC;YACbD,aAAaH;YACbU,QAAQwB,cAAc,CAAC,UAAUzB;YACjCC,QAAQwB,cAAc,CAAC,WAAWzB;YAClCC,QAAQwB,cAAc,CAAC,UAAUzB;YACjC/D,0BAAAA,OAAQyF,mBAAmB,CAAC,SAAS1B;YACrC,IAAI,CAACV,UAAUxE,MAAM,+CAA+CoC;YACpEiC,QAAQ3B;QACV;QACAuB,MAAM6B,IAAI,CAAC,SAASN,SAAStD,UAAU;IACzC;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/nudge.d.ts b/e-commerce/node_modules/next/dist/lib/upgrade/nudge.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d76ddde1c8bed5fc5b8c264c0054ca991d9e2287 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/nudge.d.ts @@ -0,0 +1,34 @@ +import type { NextConfigComplete } from '../../server/config-shared'; +import type { Telemetry } from '../../telemetry/storage'; +import type { UpgradeAction } from './prompt'; +export type NudgeKind = 'security' | 'latest' | 'experimental-future'; +export type UpgradeContext = Pick & { + configuredPolicy: NudgeKind | false | null; + experimental: { + agentUpgrade: NudgeKind | false; + }; +}; +export type UpgradeReminder = { + policy: NudgeKind; + installedVersion: string; +} & ({ + kind: 'security'; + reference: string | null; + targetVersion: string; +} | { + kind: 'latest'; + latestVersion: string | null; + names: string[]; +} | { + kind: 'experimental-future'; + targetVersion: string; + names: string[]; +}); +export declare function getUpgradeContext(config: NextConfigComplete): UpgradeContext; +export declare function assessUpgrade(directory: string, config: UpgradeContext, installedVersion?: string, stopBefore?: NudgeKind | null, forceVersionReminder?: boolean): Promise; +export declare function runUpgrade(directory: string, policy: NudgeKind, nudgeId: string | null): Promise; +export declare function shouldPromptForUpgrade(): Promise; +export declare function nudgeUpgrade(directory: string, config: UpgradeContext, command: 'dev' | 'build', signal: AbortSignal | null, initialAssessment: Promise | null, telemetryOptions: { + telemetry: Telemetry; + onNudgeId: ((nudgeId: string) => void) | null; +} | null): Promise; diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/nudge.js b/e-commerce/node_modules/next/dist/lib/upgrade/nudge.js new file mode 100644 index 0000000000000000000000000000000000000000..fcf707bd2f6ba7ae16db19b64760cd5bc588fc19 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/nudge.js @@ -0,0 +1,548 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + assessUpgrade: null, + getUpgradeContext: null, + nudgeUpgrade: null, + runUpgrade: null, + shouldPromptForUpgrade: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + assessUpgrade: function() { + return assessUpgrade; + }, + getUpgradeContext: function() { + return getUpgradeContext; + }, + nudgeUpgrade: function() { + return nudgeUpgrade; + }, + runUpgrade: function() { + return runUpgrade; + }, + shouldPromptForUpgrade: function() { + return shouldPromptForUpgrade; + } +}); +const _child_process = require("child_process"); +const _crypto = require("crypto"); +const _promises = require("fs/promises"); +const _path = require("path"); +const _util = require("util"); +const _env = require("@next/env"); +const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../build/output/log")); +const _agentupgrade = require("../../telemetry/events/agent-upgrade"); +const _semver = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/semver")); +const _agentname = require("../../telemetry/agent-name"); +const _futuredefaults = require("./future-defaults"); +const _ciinfo = require("../../server/ci-info"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +function getRequestedUpgrade() { + const policy = process.env.__NEXT_AGENT_UPGRADE; + return policy === 'security' || policy === 'latest' || policy === 'experimental-future' ? policy : null; +} +const RETRY_TTL = 5 * 60 * 1000; +const allowedRetries = new Set(process.env.NEXT_PRIVATE_WORKER === '1' ? (process.env.NEXT_PRIVATE_ALLOWED_UPGRADE_RETRIES ?? '').split(',').filter((identity)=>/^[a-f0-9]{64}$/.test(identity)) : []); +function hasCode(error, code) { + return typeof error === 'object' && error !== null && 'code' in error && error.code === code; +} +async function writeRetry(path, issuedAt) { + const temporary = `${path}.${(0, _crypto.randomUUID)()}.tmp`; + try { + await (0, _promises.writeFile)(temporary, JSON.stringify({ + issuedAt + }), { + mode: 384 + }); + await (0, _promises.rename)(temporary, path); + } finally{ + await (0, _promises.rm)(temporary, { + force: true + }); + } +} +async function allowNudgeRetry({ directory, distDir, command }, version, kind) { + const project = await (0, _promises.realpath)(directory); + const identity = (0, _crypto.createHash)('sha256').update(`${project}\0${version}\0${command}\0${kind}`).digest('hex'); + if (allowedRetries.has(identity)) { + return true; + } + const cache = (0, _path.resolve)(project, distDir, 'cache', 'next-agentic-upgrade-retries'); + const receipt = (0, _path.join)(cache, `${identity}.json`); + const claimed = `${receipt}.${(0, _crypto.randomUUID)()}.claim`; + await (0, _promises.mkdir)(cache, { + recursive: true + }); + try { + await (0, _promises.rename)(receipt, claimed); + } catch (error) { + if (!hasCode(error, 'ENOENT')) { + throw error; + } + await writeRetry(receipt, Date.now()); + return false; + } + let issuedAt; + try { + const value = JSON.parse(await (0, _promises.readFile)(claimed, 'utf8')); + issuedAt = typeof value === 'object' && value !== null ? Reflect.get(value, 'issuedAt') : undefined; + } catch { + issuedAt = undefined; + } finally{ + await (0, _promises.rm)(claimed, { + force: true + }); + } + const now = Date.now(); + if (typeof issuedAt === 'number' && issuedAt <= now && now - issuedAt < RETRY_TTL) { + if (command === 'dev' && process.env.NEXT_PRIVATE_WORKER === '1') { + await new Promise((complete, reject)=>{ + const message = { + nextUpgradeRetryAllowed: identity + }; + process.send(message, (error)=>{ + if (error) { + reject(error); + } else { + complete(); + } + }); + }); + } + allowedRetries.add(identity); + return true; + } + await writeRetry(receipt, Date.now()); + return false; +} +function getUpgradeContext(config) { + return { + distDir: config.distDir, + cacheComponents: config.cacheComponents, + configuredPolicy: config.experimental.agentUpgrade ?? null, + experimental: { + agentUpgrade: getRequestedUpgrade() ?? config.experimental.agentUpgrade ?? false + } + }; +} +async function assessUpgrade(directory, config, installedVersion = "16.4.0" || 'unknown', stopBefore = null, forceVersionReminder = false) { + const policy = config.experimental.agentUpgrade; + if (policy !== 'security' && policy !== 'latest' && policy !== 'experimental-future') { + return null; + } + if (isTerminalForcedForTesting()) { + // Offer a fixed reminder without querying advisories or past dismissals. + return { + policy, + installedVersion, + kind: 'security', + reference: null, + targetVersion: installedVersion + }; + } + if (stopBefore === 'security') { + return null; + } + if (!_semver.default.valid(installedVersion)) { + return null; + } + const { getPrereleaseChannel, getUpgradeAssessment, getLatestUpgradeVersion } = require('./prepare-upgrade'); + if (_semver.default.prerelease(installedVersion) && !getPrereleaseChannel(installedVersion)) { + return null; + } + let assessment; + try { + assessment = await getUpgradeAssessment(installedVersion, policy, stopBefore === 'latest'); + } catch { + _log.warn('Could not check Next.js security advisories. Continuing without an upgrade assessment.'); + return null; + } + const { upgrade } = assessment; + if (upgrade.status !== 'ready') { + // TODO: Record affected and upgrade.status in telemetry so we can see when + // an advisory applies but no ready target was available to nudge. + return null; + } + if (assessment.affected) { + return { + kind: 'security', + policy, + installedVersion, + reference: assessment.reference, + targetVersion: upgrade.targetVersion + }; + } + if (policy === 'security' || stopBefore === 'latest') { + return null; + } + const latestVersion = getLatestUpgradeVersion(installedVersion, upgrade.targetVersion); + if (latestVersion || forceVersionReminder && upgrade.targetVersion !== installedVersion) { + return { + kind: 'latest', + policy, + installedVersion, + latestVersion: upgrade.targetVersion, + names: policy === 'experimental-future' ? (0, _futuredefaults.getPendingFutureDefaults)(directory, config, upgrade.targetVersion).map((entry)=>entry.name) : [] + }; + } + if (policy !== 'experimental-future' || stopBefore === 'experimental-future') { + return null; + } + const pending = (0, _futuredefaults.getPendingFutureDefaults)(directory, config, installedVersion); + if (pending.length === 0) { + return null; + } + return { + kind: 'experimental-future', + policy, + installedVersion, + targetVersion: upgrade.targetVersion, + names: pending.map((entry)=>entry.name) + }; +} +async function nudgeUpgradeForAgent(options, reminder, nudgeId, agentProduct, telemetry, policyEvent) { + let summary; + let recommendation; + let reference = null; + switch(reminder.kind){ + case 'security': + summary = 'Your version of Next.js is affected by a known security vulnerability.'; + recommendation = 'We strongly recommend you upgrade Next.js.'; + reference = reminder.reference; + break; + case 'latest': + var _semver_prerelease; + summary = `Next.js ${reminder.latestVersion ?? '[latest version]'} is available. You're using ${reminder.installedVersion}.`; + recommendation = 'We recommend you upgrade Next.js.'; + reference = `https://registry.npmjs.org/next/${((_semver_prerelease = _semver.default.prerelease(reminder.installedVersion)) == null ? void 0 : _semver_prerelease[0]) === 'canary' ? 'canary' : 'latest'}`; + break; + case 'experimental-future': + summary = `Installed Next.js ${reminder.installedVersion} includes Future Defaults available for this app:\n\n${reminder.names.map((name)=>`- ${name}`).join('\n')}`; + recommendation = 'We recommend you adopt these Future Defaults.'; + break; + } + // Pass attribution on the invocation using the same command syntax on every platform. + const command = `next upgrade --agent=${reminder.policy} --internal-nudge-id=${nudgeId}`; + const message = `${summary} + +**${recommendation}** + +This command stopped to show the upgrade recommendation. Retry the same command to continue the original task. + +When you report back to the user, include this upgrade recommendation even if the retry succeeds. + +At the end of the task, ask the user once: "Would you like me to run the '${reminder.policy}' upgrade in the background in a separate Git worktree? I can use the current checkout if you prefer." If the app is not in Git, say it will run in place. Use their worktree choice and continue in this agent session. Run this command from this app's directory: + +\`\`\` +${command} +\`\`\` + +${reference ? `Reference: ${reference}` : ''}`; + let retryAllowed = false; + try { + retryAllowed = await allowNudgeRetry(options, reminder.installedVersion, reminder.kind); + } catch { + _log.warn('Could not prepare an upgrade retry. This command will remain blocked.'); + } + if (retryAllowed) { + telemetry == null ? void 0 : telemetry.record(policyEvent); + _log.warn(`${summary} This command is continuing after the upgrade reminder.${reference ? `\nReference: ${reference}` : ''}`); + return; + } + // Queue the full nudge once, then send it outside the command that is about to stop. + if (telemetry) { + try { + if (telemetry.isEnabled || process.env.NEXT_TELEMETRY_DEBUG) { + telemetry.flushDetached({ + mode: 'dev', + dir: options.directory, + distDir: (0, _path.resolve)(options.directory, options.distDir), + events: [ + policyEvent, + (0, _agentupgrade.eventAgentUpgradeNudgeShown)({ + nudgeId, + recipient: 'agent', + agentProduct, + sourceCommand: options.command, + policy: reminder.policy, + nudgeKind: reminder.kind + }) + ] + }); + } + } catch (error) { + _log.warn(`Could not queue upgrade telemetry: ${String(error)}`); + } + } + const error = new Error(message); + error.name = reminder.kind === 'security' ? 'SecurityFatalError' : 'UpgradeNudgeError'; + Object.assign(error, { + exitCode: 1 + }); + throw error; +} +async function getUpgradePreferences(directory) { + const Conf = require('next/dist/compiled/conf'); + const project = await (0, _promises.realpath)(directory); + let identity = project; + let projectName = (0, _path.basename)(project); + try { + const { stdout } = await (0, _util.promisify)(_child_process.execFile)('git', [ + 'rev-parse', + '--show-toplevel', + '--git-common-dir' + ], { + cwd: project, + timeout: 1000 + }); + const [root, common] = stdout.trimEnd().split('\n'); + const commonDirectory = await (0, _promises.realpath)((0, _path.resolve)(project, common)); + const appPath = (0, _path.relative)(await (0, _promises.realpath)(root), project); + // Worktrees share a Git directory, but monorepo apps need separate keys. + identity = `${commonDirectory}\0${appPath}`; + projectName = (0, _path.basename)(appPath || ((0, _path.basename)(commonDirectory) === '.git' ? (0, _path.dirname)(commonDirectory) : commonDirectory)); + } catch { + // Apps outside Git (or without Git installed) keep their directory identity. + } + const hash = (0, _crypto.createHash)('sha256').update(identity).digest('hex'); + // Conf treats dots as separators, including dots in directory names. + const name = encodeURIComponent(projectName).replace(/\./g, '%2E'); + const key = `agent-upgrade.${name}.${hash}`; + // Upgrade preferences share Next.js' global config location, not telemetry consent. + return { + key, + preferences: new Conf({ + projectName: 'nextjs' + }) + }; +} +// The terminal test needs a menu in CI and under agents, without the network. +function isTerminalForcedForTesting() { + return process.env.__NEXT_AGENT_UPGRADE_FORCE_TERMINAL_FOR_TESTING === '1'; +} +function canPromptForUpgrade() { + return (!_ciinfo.isCI || isTerminalForcedForTesting()) && Boolean(process.stdin.isTTY && process.stdout.isTTY) && process.env.TERM !== 'dumb'; +} +async function getUpgradeDismissal(directory, version, policy) { + try { + const { key, preferences } = await getUpgradePreferences(directory); + for (const kind of [ + 'security', + 'latest', + 'experimental-future' + ]){ + if (preferences.get(`${key}.${kind}`) === `${version}:${policy}`) { + return kind; + } + } + } catch { + // A preferences failure must not prevent assessing or skipping a reminder. + } + return null; +} +async function nudgeUpgradeForHuman(directory, reminder, signal, onShown) { + if (signal.aborted) { + return 'skip'; + } + let message; + if (reminder.kind === 'security') { + message = `⚠ Installed Next.js version ${reminder.installedVersion} is affected by a known security vulnerability.`; + message += `\n\nNext.js security version upgrade available: ${reminder.installedVersion} -> ${reminder.targetVersion}`; + } else if (reminder.policy === 'experimental-future') { + const targetVersion = reminder.kind === 'latest' ? reminder.latestVersion : reminder.targetVersion; + const versions = targetVersion !== reminder.installedVersion ? ` ${reminder.installedVersion} -> ${targetVersion ?? '[target version]'}` : ''; + message = `Next.js Future Default upgrade available:${versions}`; + if (reminder.names.length > 0) { + message += `\n\n${reminder.names.map((name)=>`- ${name}`).join('\n')}`; + } + } else if (reminder.kind === 'latest') { + message = `Next.js latest version upgrade available: ${reminder.installedVersion} -> ${reminder.latestVersion ?? '[target version]'}`; + } else { + return 'skip'; + } + const { promptUpgrade } = require('./prompt'); + const action = await promptUpgrade({ + message, + signal, + canUpdate: true, + onShown + }); + if (signal.aborted) { + return 'skip'; + } + if (action === 'dismiss') { + try { + const { key, preferences } = await getUpgradePreferences(directory); + preferences.set(`${key}.${reminder.kind}`, `${reminder.installedVersion}:${reminder.policy}`); + } catch { + _log.warn('Could not save your upgrade reminder preference. Skipping for this session.'); + } + } + return action; +} +async function runUpgrade(directory, policy, nudgeId) { + // The agent's dev/build commands must not trigger this explicit request again. + delete process.env.__NEXT_AGENT_UPGRADE; + (0, _env.updateInitialEnv)({ + __NEXT_AGENT_UPGRADE: undefined + }); + const { spawnNextUpgrade } = await import('../../cli/next-upgrade.js'); + // Human Update actions invoke the CLI directly, so their ID does not need an env var. + await spawnNextUpgrade(directory, { + revision: 'latest', + verbose: false, + agent: policy + }, nudgeId ? { + id: nudgeId, + recipient: 'human' + } : null); + return process.exitCode ?? 0; +} +async function shouldPromptForUpgrade() { + return canPromptForUpgrade() && (isTerminalForcedForTesting() || !await (0, _agentname.getAgentName)()); +} +async function nudgeUpgrade(directory, config, command, signal, initialAssessment, telemetryOptions) { + const requested = getRequestedUpgrade(); + const policy = requested ?? config.experimental.agentUpgrade; + if (policy !== 'security' && policy !== 'latest' && policy !== 'experimental-future') { + return; + } + // Observe the effective policy even when assessment finds no upgrade to offer. + const telemetry = (telemetryOptions == null ? void 0 : telemetryOptions.telemetry) ?? null; + const policyEvent = (0, _agentupgrade.eventAgentUpgradePolicyDetected)({ + configuredPolicy: config.configuredPolicy ?? null, + effectivePolicy: policy, + policySource: requested ? 'environment' : 'config', + sourceCommand: command + }); + if (requested && _ciinfo.isCI) { + telemetry == null ? void 0 : telemetry.record(policyEvent); + return; + } + // An agent's stopped command sends policy and nudge together before synchronous exit. + const agent = isTerminalForcedForTesting() ? null : await (0, _agentname.getAgentName)(); + if (!agent) { + telemetry == null ? void 0 : telemetry.record(policyEvent); + } + const installedVersion = "16.4.0" || 'unknown'; + let stopBefore = null; + if (!agent) { + if (!signal || signal.aborted) { + return; + } + if (!canPromptForUpgrade()) { + return; + } + if (!requested) { + stopBefore = await getUpgradeDismissal(directory, installedVersion, policy); + } + if (signal.aborted) { + return; + } + } + const reminder = await (stopBefore === null && initialAssessment && !isTerminalForcedForTesting() ? initialAssessment : assessUpgrade(directory, { + ...config, + experimental: { + agentUpgrade: policy + } + }, installedVersion, stopBefore, requested !== null)).catch((error)=>{ + if (agent) { + telemetry == null ? void 0 : telemetry.record(policyEvent); + } + throw error; + }); + if (!reminder || (signal == null ? void 0 : signal.aborted)) { + if (agent) { + telemetry == null ? void 0 : telemetry.record(policyEvent); + } + return; + } + // The nudge and any resulting upgrade run share this ID across processes. + const nudgeId = (0, _crypto.randomUUID)(); + if (agent) { + await nudgeUpgradeForAgent({ + directory, + distDir: config.distDir, + command + }, reminder, nudgeId, agent, telemetry, policyEvent); + } else if (signal) { + // Count a human nudge only after the menu renders, including its selected action. + let shown = false; + const onShown = telemetryOptions ? ()=>{ + shown = true; + telemetryOptions.onNudgeId == null ? void 0 : telemetryOptions.onNudgeId.call(telemetryOptions, nudgeId); + telemetryOptions.telemetry.record((0, _agentupgrade.eventAgentUpgradeNudgeShown)({ + nudgeId, + recipient: 'human', + agentProduct: null, + sourceCommand: command, + policy: reminder.policy, + nudgeKind: reminder.kind + })); + } : null; + const action = await nudgeUpgradeForHuman(directory, reminder, signal, onShown); + // The caller flushes after it gives the terminal back. + if (shown && telemetry && !signal.aborted) { + telemetry.record((0, _agentupgrade.eventAgentUpgradeNudgeDecision)({ + nudgeId, + action + })); + } + return action; + } +} + +//# sourceMappingURL=nudge.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/nudge.js.map b/e-commerce/node_modules/next/dist/lib/upgrade/nudge.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ecfca63db4253b49d2b6ed493f39f9fdc448fa23 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/nudge.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/upgrade/nudge.ts"],"sourcesContent":["import { execFile } from 'child_process'\nimport { createHash, randomUUID } from 'crypto'\nimport { mkdir, readFile, realpath, rename, rm, writeFile } from 'fs/promises'\nimport { basename, dirname, join, relative, resolve } from 'path'\nimport { promisify } from 'util'\nimport { updateInitialEnv } from '@next/env'\n\nimport * as Log from '../../build/output/log'\nimport type { NextConfigComplete } from '../../server/config-shared'\nimport type { Telemetry } from '../../telemetry/storage'\nimport {\n eventAgentUpgradeNudgeDecision,\n eventAgentUpgradeNudgeShown,\n eventAgentUpgradePolicyDetected,\n} from '../../telemetry/events/agent-upgrade'\nimport semver from 'next/dist/compiled/semver'\nimport type { UpgradeAction } from './prompt'\nimport { getAgentName } from '../../telemetry/agent-name'\nimport { getPendingFutureDefaults } from './future-defaults'\nimport { isCI } from '../../server/ci-info'\n\ntype NudgeOptions = {\n directory: string\n distDir: string\n command: 'dev' | 'build'\n}\n\nexport type NudgeKind = 'security' | 'latest' | 'experimental-future'\n\nfunction getRequestedUpgrade() {\n const policy = process.env.__NEXT_AGENT_UPGRADE\n return policy === 'security' ||\n policy === 'latest' ||\n policy === 'experimental-future'\n ? policy\n : null\n}\n\nconst RETRY_TTL = 5 * 60 * 1000\nconst allowedRetries = new Set(\n process.env.NEXT_PRIVATE_WORKER === '1'\n ? (process.env.NEXT_PRIVATE_ALLOWED_UPGRADE_RETRIES ?? '')\n .split(',')\n .filter((identity) => /^[a-f0-9]{64}$/.test(identity))\n : []\n)\n\nfunction hasCode(error: unknown, code: string): boolean {\n return (\n typeof error === 'object' &&\n error !== null &&\n 'code' in error &&\n error.code === code\n )\n}\n\nasync function writeRetry(path: string, issuedAt: number): Promise {\n const temporary = `${path}.${randomUUID()}.tmp`\n try {\n await writeFile(temporary, JSON.stringify({ issuedAt }), { mode: 0o600 })\n await rename(temporary, path)\n } finally {\n await rm(temporary, { force: true })\n }\n}\n\nasync function allowNudgeRetry(\n { directory, distDir, command }: NudgeOptions,\n version: string,\n kind: NudgeKind\n): Promise {\n const project = await realpath(directory)\n const identity = createHash('sha256')\n .update(`${project}\\0${version}\\0${command}\\0${kind}`)\n .digest('hex')\n\n if (allowedRetries.has(identity)) {\n return true\n }\n\n const cache = resolve(\n project,\n distDir,\n 'cache',\n 'next-agentic-upgrade-retries'\n )\n const receipt = join(cache, `${identity}.json`)\n const claimed = `${receipt}.${randomUUID()}.claim`\n await mkdir(cache, { recursive: true })\n\n try {\n await rename(receipt, claimed)\n } catch (error) {\n if (!hasCode(error, 'ENOENT')) {\n throw error\n }\n await writeRetry(receipt, Date.now())\n return false\n }\n\n let issuedAt: unknown\n try {\n const value: unknown = JSON.parse(await readFile(claimed, 'utf8'))\n issuedAt =\n typeof value === 'object' && value !== null\n ? Reflect.get(value, 'issuedAt')\n : undefined\n } catch {\n issuedAt = undefined\n } finally {\n await rm(claimed, { force: true })\n }\n\n const now = Date.now()\n if (\n typeof issuedAt === 'number' &&\n issuedAt <= now &&\n now - issuedAt < RETRY_TTL\n ) {\n if (command === 'dev' && process.env.NEXT_PRIVATE_WORKER === '1') {\n await new Promise((complete, reject) => {\n const message = { nextUpgradeRetryAllowed: identity }\n process.send!(message, (error: Error | null) => {\n if (error) {\n reject(error)\n } else {\n complete()\n }\n })\n })\n }\n allowedRetries.add(identity)\n return true\n }\n\n await writeRetry(receipt, Date.now())\n return false\n}\n\nexport type UpgradeContext = Pick<\n NextConfigComplete,\n 'distDir' | 'cacheComponents'\n> & {\n configuredPolicy: NudgeKind | false | null\n experimental: { agentUpgrade: NudgeKind | false }\n}\n\nexport type UpgradeReminder = {\n policy: NudgeKind\n installedVersion: string\n} & (\n | {\n kind: 'security'\n reference: string | null\n targetVersion: string\n }\n | { kind: 'latest'; latestVersion: string | null; names: string[] }\n | { kind: 'experimental-future'; targetVersion: string; names: string[] }\n)\n\nexport function getUpgradeContext(config: NextConfigComplete): UpgradeContext {\n return {\n distDir: config.distDir,\n cacheComponents: config.cacheComponents,\n configuredPolicy: config.experimental.agentUpgrade ?? null,\n experimental: {\n agentUpgrade:\n getRequestedUpgrade() ?? config.experimental.agentUpgrade ?? false,\n },\n }\n}\n\nexport async function assessUpgrade(\n directory: string,\n config: UpgradeContext,\n installedVersion: string = process.env.__NEXT_VERSION || 'unknown',\n stopBefore: NudgeKind | null = null,\n forceVersionReminder: boolean = false\n): Promise {\n const policy = config.experimental.agentUpgrade\n if (\n policy !== 'security' &&\n policy !== 'latest' &&\n policy !== 'experimental-future'\n ) {\n return null\n }\n if (isTerminalForcedForTesting()) {\n // Offer a fixed reminder without querying advisories or past dismissals.\n return {\n policy,\n installedVersion,\n kind: 'security',\n reference: null,\n targetVersion: installedVersion,\n }\n }\n if (stopBefore === 'security') {\n return null\n }\n\n if (!semver.valid(installedVersion)) {\n return null\n }\n const {\n getPrereleaseChannel,\n getUpgradeAssessment,\n getLatestUpgradeVersion,\n } = require('./prepare-upgrade') as typeof import('./prepare-upgrade')\n if (\n semver.prerelease(installedVersion) &&\n !getPrereleaseChannel(installedVersion)\n ) {\n return null\n }\n let assessment\n try {\n assessment = await getUpgradeAssessment(\n installedVersion,\n policy,\n stopBefore === 'latest'\n )\n } catch {\n Log.warn(\n 'Could not check Next.js security advisories. Continuing without an upgrade assessment.'\n )\n return null\n }\n const { upgrade } = assessment\n if (upgrade.status !== 'ready') {\n // TODO: Record affected and upgrade.status in telemetry so we can see when\n // an advisory applies but no ready target was available to nudge.\n return null\n }\n if (assessment.affected) {\n return {\n kind: 'security',\n policy,\n installedVersion,\n reference: assessment.reference,\n targetVersion: upgrade.targetVersion,\n }\n }\n if (policy === 'security' || stopBefore === 'latest') {\n return null\n }\n const latestVersion = getLatestUpgradeVersion(\n installedVersion,\n upgrade.targetVersion\n )\n if (\n latestVersion ||\n (forceVersionReminder && upgrade.targetVersion !== installedVersion)\n ) {\n return {\n kind: 'latest',\n policy,\n installedVersion,\n latestVersion: upgrade.targetVersion,\n names:\n policy === 'experimental-future'\n ? getPendingFutureDefaults(\n directory,\n config,\n upgrade.targetVersion\n ).map((entry) => entry.name)\n : [],\n }\n }\n\n if (\n policy !== 'experimental-future' ||\n stopBefore === 'experimental-future'\n ) {\n return null\n }\n const pending = getPendingFutureDefaults(directory, config, installedVersion)\n if (pending.length === 0) {\n return null\n }\n return {\n kind: 'experimental-future',\n policy,\n installedVersion,\n targetVersion: upgrade.targetVersion,\n names: pending.map((entry) => entry.name),\n }\n}\n\nasync function nudgeUpgradeForAgent(\n options: NudgeOptions,\n reminder: UpgradeReminder,\n nudgeId: string,\n agentProduct: string,\n telemetry: Telemetry | null,\n policyEvent: ReturnType\n): Promise {\n let summary: string\n let recommendation: string\n let reference: string | null = null\n switch (reminder.kind) {\n case 'security':\n summary =\n 'Your version of Next.js is affected by a known security vulnerability.'\n recommendation = 'We strongly recommend you upgrade Next.js.'\n reference = reminder.reference\n break\n case 'latest':\n summary = `Next.js ${reminder.latestVersion ?? '[latest version]'} is available. You're using ${reminder.installedVersion}.`\n recommendation = 'We recommend you upgrade Next.js.'\n reference = `https://registry.npmjs.org/next/${semver.prerelease(reminder.installedVersion)?.[0] === 'canary' ? 'canary' : 'latest'}`\n break\n case 'experimental-future':\n summary = `Installed Next.js ${reminder.installedVersion} includes Future Defaults available for this app:\\n\\n${reminder.names.map((name) => `- ${name}`).join('\\n')}`\n recommendation = 'We recommend you adopt these Future Defaults.'\n break\n }\n // Pass attribution on the invocation using the same command syntax on every platform.\n const command = `next upgrade --agent=${reminder.policy} --internal-nudge-id=${nudgeId}`\n const message = `${summary}\n\n**${recommendation}**\n\nThis command stopped to show the upgrade recommendation. Retry the same command to continue the original task.\n\nWhen you report back to the user, include this upgrade recommendation even if the retry succeeds.\n\nAt the end of the task, ask the user once: \"Would you like me to run the '${reminder.policy}' upgrade in the background in a separate Git worktree? I can use the current checkout if you prefer.\" If the app is not in Git, say it will run in place. Use their worktree choice and continue in this agent session. Run this command from this app's directory:\n\n\\`\\`\\`\n${command}\n\\`\\`\\`\n\n${reference ? `Reference: ${reference}` : ''}`\n let retryAllowed = false\n try {\n retryAllowed = await allowNudgeRetry(\n options,\n reminder.installedVersion,\n reminder.kind\n )\n } catch {\n Log.warn(\n 'Could not prepare an upgrade retry. This command will remain blocked.'\n )\n }\n if (retryAllowed) {\n telemetry?.record(policyEvent)\n Log.warn(\n `${summary} This command is continuing after the upgrade reminder.${reference ? `\\nReference: ${reference}` : ''}`\n )\n return\n }\n // Queue the full nudge once, then send it outside the command that is about to stop.\n if (telemetry) {\n try {\n if (telemetry.isEnabled || process.env.NEXT_TELEMETRY_DEBUG) {\n telemetry.flushDetached({\n mode: 'dev',\n dir: options.directory,\n distDir: resolve(options.directory, options.distDir),\n events: [\n policyEvent,\n eventAgentUpgradeNudgeShown({\n nudgeId,\n recipient: 'agent',\n agentProduct,\n sourceCommand: options.command,\n policy: reminder.policy,\n nudgeKind: reminder.kind,\n }),\n ],\n })\n }\n } catch (error) {\n Log.warn(`Could not queue upgrade telemetry: ${String(error)}`)\n }\n }\n const error = new Error(message)\n error.name =\n reminder.kind === 'security' ? 'SecurityFatalError' : 'UpgradeNudgeError'\n Object.assign(error, { exitCode: 1 })\n throw error\n}\n\nasync function getUpgradePreferences(directory: string) {\n const Conf =\n require('next/dist/compiled/conf') as typeof import('next/dist/compiled/conf')\n const project = await realpath(directory)\n let identity = project\n let projectName = basename(project)\n try {\n const { stdout } = await promisify(execFile)(\n 'git',\n ['rev-parse', '--show-toplevel', '--git-common-dir'],\n { cwd: project, timeout: 1000 }\n )\n const [root, common] = stdout.trimEnd().split('\\n')\n const commonDirectory = await realpath(resolve(project, common))\n const appPath = relative(await realpath(root), project)\n // Worktrees share a Git directory, but monorepo apps need separate keys.\n identity = `${commonDirectory}\\0${appPath}`\n projectName = basename(\n appPath ||\n (basename(commonDirectory) === '.git'\n ? dirname(commonDirectory)\n : commonDirectory)\n )\n } catch {\n // Apps outside Git (or without Git installed) keep their directory identity.\n }\n const hash = createHash('sha256').update(identity).digest('hex')\n // Conf treats dots as separators, including dots in directory names.\n const name = encodeURIComponent(projectName).replace(/\\./g, '%2E')\n const key = `agent-upgrade.${name}.${hash}`\n // Upgrade preferences share Next.js' global config location, not telemetry consent.\n return { key, preferences: new Conf({ projectName: 'nextjs' }) }\n}\n\n// The terminal test needs a menu in CI and under agents, without the network.\nfunction isTerminalForcedForTesting(): boolean {\n return process.env.__NEXT_AGENT_UPGRADE_FORCE_TERMINAL_FOR_TESTING === '1'\n}\n\nfunction canPromptForUpgrade(): boolean {\n return (\n (!isCI || isTerminalForcedForTesting()) &&\n Boolean(process.stdin.isTTY && process.stdout.isTTY) &&\n process.env.TERM !== 'dumb'\n )\n}\n\nasync function getUpgradeDismissal(\n directory: string,\n version: string,\n policy: NudgeKind\n): Promise {\n try {\n const { key, preferences } = await getUpgradePreferences(directory)\n for (const kind of ['security', 'latest', 'experimental-future'] as const) {\n if (preferences.get(`${key}.${kind}`) === `${version}:${policy}`) {\n return kind\n }\n }\n } catch {\n // A preferences failure must not prevent assessing or skipping a reminder.\n }\n return null\n}\n\nasync function nudgeUpgradeForHuman(\n directory: string,\n reminder: UpgradeReminder,\n signal: AbortSignal,\n onShown: (() => void) | null\n): Promise {\n if (signal.aborted) {\n return 'skip'\n }\n let message: string\n if (reminder.kind === 'security') {\n message = `⚠ Installed Next.js version ${reminder.installedVersion} is affected by a known security vulnerability.`\n message += `\\n\\nNext.js security version upgrade available: ${reminder.installedVersion} -> ${reminder.targetVersion}`\n } else if (reminder.policy === 'experimental-future') {\n const targetVersion =\n reminder.kind === 'latest'\n ? reminder.latestVersion\n : reminder.targetVersion\n const versions =\n targetVersion !== reminder.installedVersion\n ? ` ${reminder.installedVersion} -> ${targetVersion ?? '[target version]'}`\n : ''\n message = `Next.js Future Default upgrade available:${versions}`\n if (reminder.names.length > 0) {\n message += `\\n\\n${reminder.names.map((name) => `- ${name}`).join('\\n')}`\n }\n } else if (reminder.kind === 'latest') {\n message = `Next.js latest version upgrade available: ${reminder.installedVersion} -> ${reminder.latestVersion ?? '[target version]'}`\n } else {\n return 'skip'\n }\n const { promptUpgrade } = require('./prompt') as typeof import('./prompt')\n const action = await promptUpgrade({\n message,\n signal,\n canUpdate: true,\n onShown,\n })\n if (signal.aborted) {\n return 'skip'\n }\n if (action === 'dismiss') {\n try {\n const { key, preferences } = await getUpgradePreferences(directory)\n preferences.set(\n `${key}.${reminder.kind}`,\n `${reminder.installedVersion}:${reminder.policy}`\n )\n } catch {\n Log.warn(\n 'Could not save your upgrade reminder preference. Skipping for this session.'\n )\n }\n }\n return action\n}\n\nexport async function runUpgrade(\n directory: string,\n policy: NudgeKind,\n nudgeId: string | null\n) {\n // The agent's dev/build commands must not trigger this explicit request again.\n delete process.env.__NEXT_AGENT_UPGRADE\n updateInitialEnv({ __NEXT_AGENT_UPGRADE: undefined })\n const { spawnNextUpgrade } = await import('../../cli/next-upgrade.js')\n\n // Human Update actions invoke the CLI directly, so their ID does not need an env var.\n await spawnNextUpgrade(\n directory,\n { revision: 'latest', verbose: false, agent: policy },\n nudgeId ? { id: nudgeId, recipient: 'human' } : null\n )\n return process.exitCode ?? 0\n}\n\nexport async function shouldPromptForUpgrade(): Promise {\n return (\n canPromptForUpgrade() &&\n (isTerminalForcedForTesting() || !(await getAgentName()))\n )\n}\n\nexport async function nudgeUpgrade(\n directory: string,\n config: UpgradeContext,\n command: 'dev' | 'build',\n signal: AbortSignal | null,\n initialAssessment: Promise | null,\n telemetryOptions: {\n telemetry: Telemetry\n onNudgeId: ((nudgeId: string) => void) | null\n } | null\n): Promise {\n const requested = getRequestedUpgrade()\n const policy = requested ?? config.experimental.agentUpgrade\n if (\n policy !== 'security' &&\n policy !== 'latest' &&\n policy !== 'experimental-future'\n ) {\n return\n }\n // Observe the effective policy even when assessment finds no upgrade to offer.\n const telemetry = telemetryOptions?.telemetry ?? null\n const policyEvent = eventAgentUpgradePolicyDetected({\n configuredPolicy: config.configuredPolicy ?? null,\n effectivePolicy: policy,\n policySource: requested ? 'environment' : 'config',\n sourceCommand: command,\n })\n if (requested && isCI) {\n telemetry?.record(policyEvent)\n return\n }\n\n // An agent's stopped command sends policy and nudge together before synchronous exit.\n const agent = isTerminalForcedForTesting() ? null : await getAgentName()\n if (!agent) {\n telemetry?.record(policyEvent)\n }\n const installedVersion = process.env.__NEXT_VERSION || 'unknown'\n let stopBefore: NudgeKind | null = null\n if (!agent) {\n if (!signal || signal.aborted) {\n return\n }\n if (!canPromptForUpgrade()) {\n return\n }\n if (!requested) {\n stopBefore = await getUpgradeDismissal(\n directory,\n installedVersion,\n policy\n )\n }\n if (signal.aborted) {\n return\n }\n }\n const reminder = await (\n stopBefore === null && initialAssessment && !isTerminalForcedForTesting()\n ? initialAssessment\n : assessUpgrade(\n directory,\n { ...config, experimental: { agentUpgrade: policy } },\n installedVersion,\n stopBefore,\n requested !== null\n )\n ).catch((error) => {\n if (agent) {\n telemetry?.record(policyEvent)\n }\n throw error\n })\n if (!reminder || signal?.aborted) {\n if (agent) {\n telemetry?.record(policyEvent)\n }\n return\n }\n\n // The nudge and any resulting upgrade run share this ID across processes.\n const nudgeId = randomUUID()\n if (agent) {\n await nudgeUpgradeForAgent(\n { directory, distDir: config.distDir, command },\n reminder,\n nudgeId,\n agent,\n telemetry,\n policyEvent\n )\n } else if (signal) {\n // Count a human nudge only after the menu renders, including its selected action.\n let shown = false\n const onShown = telemetryOptions\n ? () => {\n shown = true\n telemetryOptions.onNudgeId?.(nudgeId)\n telemetryOptions.telemetry.record(\n eventAgentUpgradeNudgeShown({\n nudgeId,\n recipient: 'human',\n agentProduct: null,\n sourceCommand: command,\n policy: reminder.policy,\n nudgeKind: reminder.kind,\n })\n )\n }\n : null\n\n const action = await nudgeUpgradeForHuman(\n directory,\n reminder,\n signal,\n onShown\n )\n\n // The caller flushes after it gives the terminal back.\n if (shown && telemetry && !signal.aborted) {\n telemetry.record(eventAgentUpgradeNudgeDecision({ nudgeId, action }))\n }\n return action\n }\n}\n"],"names":["assessUpgrade","getUpgradeContext","nudgeUpgrade","runUpgrade","shouldPromptForUpgrade","getRequestedUpgrade","policy","process","env","__NEXT_AGENT_UPGRADE","RETRY_TTL","allowedRetries","Set","NEXT_PRIVATE_WORKER","NEXT_PRIVATE_ALLOWED_UPGRADE_RETRIES","split","filter","identity","test","hasCode","error","code","writeRetry","path","issuedAt","temporary","randomUUID","writeFile","JSON","stringify","mode","rename","rm","force","allowNudgeRetry","directory","distDir","command","version","kind","project","realpath","createHash","update","digest","has","cache","resolve","receipt","join","claimed","mkdir","recursive","Date","now","value","parse","readFile","Reflect","get","undefined","Promise","complete","reject","message","nextUpgradeRetryAllowed","send","add","config","cacheComponents","configuredPolicy","experimental","agentUpgrade","installedVersion","__NEXT_VERSION","stopBefore","forceVersionReminder","isTerminalForcedForTesting","reference","targetVersion","semver","valid","getPrereleaseChannel","getUpgradeAssessment","getLatestUpgradeVersion","require","prerelease","assessment","Log","warn","upgrade","status","affected","latestVersion","names","getPendingFutureDefaults","map","entry","name","pending","length","nudgeUpgradeForAgent","options","reminder","nudgeId","agentProduct","telemetry","policyEvent","summary","recommendation","retryAllowed","record","isEnabled","NEXT_TELEMETRY_DEBUG","flushDetached","dir","events","eventAgentUpgradeNudgeShown","recipient","sourceCommand","nudgeKind","String","Error","Object","assign","exitCode","getUpgradePreferences","Conf","projectName","basename","stdout","promisify","execFile","cwd","timeout","root","common","trimEnd","commonDirectory","appPath","relative","dirname","hash","encodeURIComponent","replace","key","preferences","__NEXT_AGENT_UPGRADE_FORCE_TERMINAL_FOR_TESTING","canPromptForUpgrade","isCI","Boolean","stdin","isTTY","TERM","getUpgradeDismissal","nudgeUpgradeForHuman","signal","onShown","aborted","versions","promptUpgrade","action","canUpdate","set","updateInitialEnv","spawnNextUpgrade","revision","verbose","agent","id","getAgentName","initialAssessment","telemetryOptions","requested","eventAgentUpgradePolicyDetected","effectivePolicy","policySource","catch","shown","onNudgeId","eventAgentUpgradeNudgeDecision"],"mappings":";;;;;;;;;;;;;;;;;;IA4KsBA,aAAa;eAAbA;;IAZNC,iBAAiB;eAAjBA;;IAqXMC,YAAY;eAAZA;;IA1BAC,UAAU;eAAVA;;IAmBAC,sBAAsB;eAAtBA;;;+BA9gBG;wBACc;0BAC0B;sBACN;sBACjC;qBACO;6DAEZ;8BAOd;+DACY;2BAEU;gCACY;wBACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUrB,SAASC;IACP,MAAMC,SAASC,QAAQC,GAAG,CAACC,oBAAoB;IAC/C,OAAOH,WAAW,cAChBA,WAAW,YACXA,WAAW,wBACTA,SACA;AACN;AAEA,MAAMI,YAAY,IAAI,KAAK;AAC3B,MAAMC,iBAAiB,IAAIC,IACzBL,QAAQC,GAAG,CAACK,mBAAmB,KAAK,MAChC,AAACN,CAAAA,QAAQC,GAAG,CAACM,oCAAoC,IAAI,EAAC,EACnDC,KAAK,CAAC,KACNC,MAAM,CAAC,CAACC,WAAa,iBAAiBC,IAAI,CAACD,aAC9C,EAAE;AAGR,SAASE,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WACA;QAAE,GAAGiC,MAAM;QAAEG,cAAc;YAAEC,cAAclE;QAAO;IAAE,GACpDmE,kBACAE,YACAkG,cAAc,KAChB,EACJI,KAAK,CAAC,CAAC7J;QACP,IAAIoJ,OAAO;YACT9D,6BAAAA,UAAWK,MAAM,CAACJ;QACpB;QACA,MAAMvF;IACR;IACA,IAAI,CAACmF,aAAYqD,0BAAAA,OAAQE,OAAO,GAAE;QAChC,IAAIU,OAAO;YACT9D,6BAAAA,UAAWK,MAAM,CAACJ;QACpB;QACA;IACF;IAEA,0EAA0E;IAC1E,MAAMH,UAAU9E,IAAAA,kBAAU;IAC1B,IAAI8I,OAAO;QACT,MAAMnE,qBACJ;YAAElE;YAAWC,SAASgC,OAAOhC,OAAO;YAAEC;QAAQ,GAC9CkE,UACAC,SACAgE,OACA9D,WACAC;IAEJ,OAAO,IAAIiD,QAAQ;QACjB,kFAAkF;QAClF,IAAIsB,QAAQ;QACZ,MAAMrB,UAAUe,mBACZ;YACEM,QAAQ;YACRN,iBAAiBO,SAAS,oBAA1BP,iBAAiBO,SAAS,MAA1BP,kBAA6BpE;YAC7BoE,iBAAiBlE,SAAS,CAACK,MAAM,CAC/BM,IAAAA,yCAA2B,EAAC;gBAC1Bb;gBACAc,WAAW;gBACXb,cAAc;gBACdc,eAAelF;gBACf/B,QAAQiG,SAASjG,MAAM;gBACvBkH,WAAWjB,SAAShE,IAAI;YAC1B;QAEJ,IACA;QAEJ,MAAM0H,SAAS,MAAMN,qBACnBxH,WACAoE,UACAqD,QACAC;QAGF,uDAAuD;QACvD,IAAIqB,SAASxE,aAAa,CAACkD,OAAOE,OAAO,EAAE;YACzCpD,UAAUK,MAAM,CAACqE,IAAAA,4CAA8B,EAAC;gBAAE5E;gBAASyD;YAAO;QACpE;QACA,OAAOA;IACT;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/prepare-upgrade.d.ts b/e-commerce/node_modules/next/dist/lib/upgrade/prepare-upgrade.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c95538f7317d6df9918ca7c3b07430ff687f82ab --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/prepare-upgrade.d.ts @@ -0,0 +1,21 @@ +import { type FutureDefaultEntry } from './future-defaults'; +type UpgradePreparation = { + status: 'unaffected' | 'blocked' | 'unknown'; + reason: string; +} | { + status: 'ready'; + installedVersion: string; + targetVersion: string; + references: string[]; + futureDefaults: FutureDefaultEntry[]; +}; +export declare function prepareUpgrade(directory: string, targetRequest?: string): Promise; +export type UpgradeAssessment = { + affected: boolean | null; + reference: string | null; + upgrade: UpgradePreparation; +}; +export declare function getUpgradeAssessment(installedVersion: string, policy: 'security' | 'latest' | 'experimental-future', onlyIfAffected?: boolean): Promise; +export declare function getPrereleaseChannel(version: string): string | null; +export declare function getLatestUpgradeVersion(version: string, targetVersion: string): string | null; +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/prepare-upgrade.js b/e-commerce/node_modules/next/dist/lib/upgrade/prepare-upgrade.js new file mode 100644 index 0000000000000000000000000000000000000000..a25da1aa7b93080f6e2b7ea1b8cb27dabafa149d --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/prepare-upgrade.js @@ -0,0 +1,374 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + getLatestUpgradeVersion: null, + getPrereleaseChannel: null, + getUpgradeAssessment: null, + prepareUpgrade: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + getLatestUpgradeVersion: function() { + return getLatestUpgradeVersion; + }, + getPrereleaseChannel: function() { + return getPrereleaseChannel; + }, + getUpgradeAssessment: function() { + return getUpgradeAssessment; + }, + prepareUpgrade: function() { + return prepareUpgrade; + } +}); +const _promises = require("fs/promises"); +const _module = require("module"); +const _path = require("path"); +const _env = require("@next/env"); +const _semver = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/semver")); +const _config = /*#__PURE__*/ _interop_require_default(require("../../server/config")); +const _constants = require("../../shared/lib/constants"); +const _futuredefaults = require("./future-defaults"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +async function prepareUpgrade(directory, targetRequest = 'security') { + if (targetRequest !== 'security' && targetRequest !== 'latest' && targetRequest !== 'experimental-future') { + throw new Error(`Unsupported agent upgrade type ${JSON.stringify(targetRequest)}. Expected "security", "latest", or "experimental-future".`); + } + // Resolve from the app: the invoking canary is only the upgrade tooling. + const requireFromApp = (0, _module.createRequire)((0, _path.join)(directory, 'package.json')); + const installedNext = JSON.parse(await (0, _promises.readFile)(requireFromApp.resolve('next/package.json'), 'utf8')); + const installedVersion = installedNext.version; + if (!_semver.default.valid(installedVersion)) { + throw new Error('Could not determine the installed Next.js version.'); + } + const { upgrade } = await getUpgradeAssessment(installedVersion, targetRequest); + if (upgrade.status !== 'ready' || targetRequest !== 'experimental-future') { + return upgrade; + } + const config = await (0, _config.default)(_constants.PHASE_INFO, directory, { + silent: true + }).finally(_env.resetEnv); + const pendingFutureDefaults = (0, _futuredefaults.getPendingFutureDefaults)(directory, config, upgrade.targetVersion); + if (upgrade.targetVersion === installedVersion && pendingFutureDefaults.length === 0) { + return { + status: 'unaffected', + reason: `Next.js ${installedVersion} is current and no applicable Future Defaults are pending.` + }; + } + return { + ...upgrade, + futureDefaults: pendingFutureDefaults + }; +} +async function getUpgradeAssessment(installedVersion, policy, onlyIfAffected = false) { + if (!_semver.default.valid(installedVersion)) { + throw new Error('The running Next.js version is not valid semver.'); + } + const channel = getPrereleaseChannel(installedVersion); + if (_semver.default.prerelease(installedVersion) && !channel) { + throw new Error('Agent upgrades are not available for this prerelease version of Next.js.'); + } + if (channel && (policy === 'security' || onlyIfAffected)) { + return { + affected: null, + reference: null, + upgrade: { + status: 'blocked', + reason: `The installed Next.js version (${installedVersion}) is a ${channel} prerelease. Security advisories target stable versions, and prereleases do not reliably follow stable version ordering, so an advisory could be a false positive. To upgrade to the latest ${channel === 'canary' ? 'canary' : 'stable'} release, run this command from the app's directory:\n\nnpx next@canary upgrade --agent=latest` + } + }; + } + if (channel && channel !== 'canary' && policy === 'experimental-future') { + return { + affected: null, + reference: null, + upgrade: { + status: 'blocked', + reason: `Future Defaults upgrades are not supported for Next.js ${installedVersion}. To upgrade to the latest stable release, run this command from the app's directory:\n\nnpx next@canary upgrade --agent=latest` + } + }; + } + // Prerelease version ordering does not establish which security fixes it + // contains, but stable promotion targets still need advisory validation. + let snapshot = null; + if (channel !== 'canary') { + try { + snapshot = { + ranges: await readNpmAdvisories([ + installedVersion + ]), + reference: NPM_ADVISORIES + }; + } catch { + return { + affected: null, + reference: null, + upgrade: { + status: 'unknown', + reason: 'Could not check for security updates. Please try again.' + } + }; + } + } + const affected = snapshot && !channel ? snapshot.ranges.some((range)=>_semver.default.satisfies(installedVersion, range)) : null; + const assessment = { + affected, + reference: (snapshot == null ? void 0 : snapshot.reference) ?? null + }; + // A dismissed release reminder still checks advisories, but does not need + // target metadata unless an advisory applies. + if ((policy === 'security' || onlyIfAffected) && !affected) { + return { + ...assessment, + upgrade: { + status: 'unaffected', + reason: `No security update is needed for Next.js ${installedVersion}.` + } + }; + } + // Keep a confirmed advisory even when target metadata cannot be read. + try { + let targetVersion; + let references; + if (policy === 'security' && snapshot) { + const registryURL = `${NPM_REGISTRY}next`; + const registry = (await fetchJSON(registryURL)).value; + const releases = parseReleases(registry); + references = [ + snapshot.reference, + registryURL + ]; + const candidates = securityCandidates(installedVersion, releases); + const ranges = [ + ...snapshot.ranges, + ...candidates.length ? await readNpmAdvisories(candidates.map(({ version })=>version)) : [] + ]; + try { + targetVersion = selectSecurityTarget(installedVersion, releases, ranges).version; + } catch (error) { + return { + ...assessment, + upgrade: { + status: 'blocked', + reason: error.message + } + }; + } + } else { + const release = await fetchLatestRelease(installedVersion); + if (!release) { + throw new Error(channel === 'canary' ? 'Could not determine the latest Next.js version on the canary dist-tag.' : 'Could not determine the latest stable Next.js version.'); + } + targetVersion = policy === 'experimental-future' && _semver.default.gt(installedVersion, release.version) ? installedVersion : release.version; + references = [ + release.reference + ]; + const releaseKind = channel === 'canary' ? 'canary release' : 'stable release'; + if (policy === 'latest' && _semver.default.lt(targetVersion, installedVersion)) { + return { + ...assessment, + upgrade: { + status: 'unaffected', + reason: `Next.js ${installedVersion} is newer than the latest ${releaseKind} ${targetVersion}.` + } + }; + } + const targetRanges = snapshot && targetVersion !== installedVersion ? await readNpmAdvisories([ + targetVersion + ]) : snapshot == null ? void 0 : snapshot.ranges; + if (targetRanges == null ? void 0 : targetRanges.some((range)=>_semver.default.satisfies(targetVersion, range))) { + return { + ...assessment, + upgrade: { + status: 'blocked', + reason: `Next.js ${targetVersion} is affected by an active advisory.` + } + }; + } + if (policy === 'latest' && _semver.default.eq(targetVersion, installedVersion)) { + return { + ...assessment, + upgrade: { + status: 'unaffected', + reason: `Next.js ${installedVersion} is already the latest ${releaseKind}.` + } + }; + } + } + return { + ...assessment, + upgrade: { + status: 'ready', + installedVersion, + targetVersion, + references, + futureDefaults: [] + } + }; + } catch (error) { + return { + ...assessment, + upgrade: { + status: 'unknown', + reason: error.message + } + }; + } +} +const NPM_REGISTRY = 'https://registry.npmjs.org/'; +const NPM_ADVISORIES = `${NPM_REGISTRY}-/npm/v1/security/advisories/bulk`; +async function fetchJSON(url, init = undefined) { + try { + const response = await fetch(url, { + ...init, + headers: { + Accept: 'application/json', + ...init == null ? void 0 : init.headers + }, + signal: AbortSignal.timeout(10000), + redirect: 'error' + }); + if (!response.ok) { + throw new Error(`HTTP ${response.status}`); + } + return { + value: await response.json() + }; + } catch (error) { + throw new Error('Could not fetch upgrade metadata. Please try again.', { + cause: error + }); + } +} +function getPrereleaseChannel(version) { + var _semver_prerelease; + const channel = (_semver_prerelease = _semver.default.prerelease(version)) == null ? void 0 : _semver_prerelease[0]; + return channel === 'canary' || channel === 'rc' || channel === 'beta' || channel === 'preview' ? channel : null; +} +function parseReleases(value) { + const data = value; + if (!(data == null ? void 0 : data.versions)) { + throw new Error('Could not determine a safe Next.js version.'); + } + return Object.entries(data.versions).flatMap(([version, metadata])=>{ + if (!_semver.default.valid(version) || _semver.default.prerelease(version)) { + return []; + } + if (metadata.version !== version) { + throw new Error('Could not determine a safe Next.js version.'); + } + return [ + { + version + } + ]; + }); +} +function getLatestUpgradeVersion(version, targetVersion) { + const channel = getPrereleaseChannel(version); + const targetChannel = getPrereleaseChannel(targetVersion); + if (!_semver.default.valid(version) || !_semver.default.valid(targetVersion) || _semver.default.prerelease(version) && !channel || _semver.default.prerelease(targetVersion) && !targetChannel || (channel === 'canary' ? targetChannel !== 'canary' : targetChannel !== null) || !_semver.default.gt(targetVersion, version)) { + return null; + } + // Stable releases replacing prereleases still warrant a reminder, even + // within the same minor. Patches and consecutive canaries remain explicit. + if (!(channel && channel !== 'canary') && _semver.default.major(targetVersion) === _semver.default.major(version) && _semver.default.minor(targetVersion) === _semver.default.minor(version)) { + return null; + } + return targetVersion; +} +async function fetchLatestRelease(installedVersion) { + const channel = getPrereleaseChannel(installedVersion); + const releaseChannel = channel === 'canary' ? 'canary' : 'latest'; + const reference = `${NPM_REGISTRY}next/${releaseChannel}`; + const { value } = await fetchJSON(reference); + const release = value; + if (!release || !_semver.default.valid(release.version) || channel !== 'canary' && _semver.default.prerelease(release.version) || getPrereleaseChannel(release.version) !== (channel === 'canary' ? 'canary' : null)) { + return null; + } + return { + version: release.version, + reference + }; +} +// TODO: Record whether each advisory lookup succeeded or failed in upgrade telemetry. +async function readNpmAdvisories(versions) { + let value; + try { + value = (await fetchJSON(NPM_ADVISORIES, { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + next: versions + }) + })).value; + } catch (error) { + throw new Error('Could not check for security updates. Please try again.', { + cause: error + }); + } + if (!value || typeof value !== 'object' || Array.isArray(value)) { + throw new Error('Could not check for security updates.'); + } + const data = value; + if (Object.keys(data).some((name)=>name !== 'next')) { + throw new Error('Could not check for security updates.'); + } + // The bulk endpoint omits packages with no known vulnerabilities. + if (!('next' in data)) { + return []; + } + if (!Array.isArray(data.next)) { + throw new Error('Could not check for security updates.'); + } + return data.next.map((finding)=>{ + if (!finding || typeof finding.vulnerable_versions !== 'string' || !finding.vulnerable_versions.trim()) { + throw new Error('Could not check for security updates.'); + } + const range = finding.vulnerable_versions.replace(/,\s*/g, ' '); + if (!_semver.default.validRange(range)) { + throw new Error('Could not check for security updates.'); + } + return range; + }); +} +function securityCandidates(source, releases) { + // Only the newest stable release of each eligible major is considered. + const latest = new Map(); + for (const release of releases){ + const major = _semver.default.major(release.version); + const previous = latest.get(major); + if (!previous || _semver.default.gt(release.version, previous.version)) { + latest.set(major, release); + } + } + return [ + ...latest.entries() + ].sort(([a], [b])=>a - b).filter(([major, release])=>major >= _semver.default.major(source) && _semver.default.gt(release.version, source)).map(([, release])=>release); +} +function selectSecurityTarget(source, releases, ranges) { + if (!ranges.some((range)=>_semver.default.satisfies(source, range))) { + return; + } + for (const candidate of securityCandidates(source, releases)){ + if (!ranges.some((range)=>_semver.default.satisfies(candidate.version, range))) { + return candidate; + } + } + throw new Error('No safe Next.js update is currently available.'); +} + +//# sourceMappingURL=prepare-upgrade.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/prepare-upgrade.js.map b/e-commerce/node_modules/next/dist/lib/upgrade/prepare-upgrade.js.map new file mode 100644 index 0000000000000000000000000000000000000000..896eae1b693e4cc3a1446f234144d8e2cbfc1b0a --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/prepare-upgrade.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/upgrade/prepare-upgrade.ts"],"sourcesContent":["import { readFile } from 'fs/promises'\nimport { createRequire } from 'module'\nimport { join } from 'path'\nimport { resetEnv } from '@next/env'\nimport semver from 'next/dist/compiled/semver'\nimport loadConfig from '../../server/config'\nimport { PHASE_INFO } from '../../shared/lib/constants'\nimport {\n getPendingFutureDefaults,\n type FutureDefaultEntry,\n} from './future-defaults'\n\ntype UpgradePreparation =\n | { status: 'unaffected' | 'blocked' | 'unknown'; reason: string }\n | {\n status: 'ready'\n installedVersion: string\n targetVersion: string\n references: string[]\n futureDefaults: FutureDefaultEntry[]\n }\n\nexport async function prepareUpgrade(\n directory: string,\n targetRequest: string = 'security'\n): Promise {\n if (\n targetRequest !== 'security' &&\n targetRequest !== 'latest' &&\n targetRequest !== 'experimental-future'\n ) {\n throw new Error(\n `Unsupported agent upgrade type ${JSON.stringify(targetRequest)}. Expected \"security\", \"latest\", or \"experimental-future\".`\n )\n }\n\n // Resolve from the app: the invoking canary is only the upgrade tooling.\n const requireFromApp = createRequire(join(directory, 'package.json'))\n const installedNext = JSON.parse(\n await readFile(requireFromApp.resolve('next/package.json'), 'utf8')\n ) as {\n version: string\n }\n const installedVersion = installedNext.version\n\n if (!semver.valid(installedVersion)) {\n throw new Error('Could not determine the installed Next.js version.')\n }\n\n const { upgrade } = await getUpgradeAssessment(\n installedVersion,\n targetRequest\n )\n if (upgrade.status !== 'ready' || targetRequest !== 'experimental-future') {\n return upgrade\n }\n\n const config = await loadConfig(PHASE_INFO, directory, {\n silent: true,\n }).finally(resetEnv)\n const pendingFutureDefaults = getPendingFutureDefaults(\n directory,\n config,\n upgrade.targetVersion\n )\n\n if (\n upgrade.targetVersion === installedVersion &&\n pendingFutureDefaults.length === 0\n ) {\n return {\n status: 'unaffected',\n reason: `Next.js ${installedVersion} is current and no applicable Future Defaults are pending.`,\n }\n }\n\n return { ...upgrade, futureDefaults: pendingFutureDefaults }\n}\n\nexport type UpgradeAssessment = {\n // null means advisory assessment is unsupported for this release channel.\n affected: boolean | null\n reference: string | null\n upgrade: UpgradePreparation\n}\n\n// TODO: Cache assessments briefly by installed version, policy, and resolved\n// target to avoid repeating nudge lookups. New advisories can affect the same\n// target, so expire cached results and refresh metadata before execution.\nexport async function getUpgradeAssessment(\n installedVersion: string,\n policy: 'security' | 'latest' | 'experimental-future',\n onlyIfAffected: boolean = false\n): Promise {\n if (!semver.valid(installedVersion)) {\n throw new Error('The running Next.js version is not valid semver.')\n }\n const channel = getPrereleaseChannel(installedVersion)\n if (semver.prerelease(installedVersion) && !channel) {\n throw new Error(\n 'Agent upgrades are not available for this prerelease version of Next.js.'\n )\n }\n if (channel && (policy === 'security' || onlyIfAffected)) {\n return {\n affected: null,\n reference: null,\n upgrade: {\n status: 'blocked',\n reason: `The installed Next.js version (${installedVersion}) is a ${channel} prerelease. Security advisories target stable versions, and prereleases do not reliably follow stable version ordering, so an advisory could be a false positive. To upgrade to the latest ${channel === 'canary' ? 'canary' : 'stable'} release, run this command from the app's directory:\\n\\nnpx next@canary upgrade --agent=latest`,\n },\n }\n }\n if (channel && channel !== 'canary' && policy === 'experimental-future') {\n return {\n affected: null,\n reference: null,\n upgrade: {\n status: 'blocked',\n reason: `Future Defaults upgrades are not supported for Next.js ${installedVersion}. To upgrade to the latest stable release, run this command from the app's directory:\\n\\nnpx next@canary upgrade --agent=latest`,\n },\n }\n }\n // Prerelease version ordering does not establish which security fixes it\n // contains, but stable promotion targets still need advisory validation.\n let snapshot: { ranges: string[]; reference: string } | null = null\n if (channel !== 'canary') {\n try {\n snapshot = {\n ranges: await readNpmAdvisories([installedVersion]),\n reference: NPM_ADVISORIES,\n }\n } catch {\n return {\n affected: null,\n reference: null,\n upgrade: {\n status: 'unknown',\n reason: 'Could not check for security updates. Please try again.',\n },\n }\n }\n }\n const affected =\n snapshot && !channel\n ? snapshot.ranges.some((range) =>\n semver.satisfies(installedVersion, range)\n )\n : null\n const assessment = { affected, reference: snapshot?.reference ?? null }\n\n // A dismissed release reminder still checks advisories, but does not need\n // target metadata unless an advisory applies.\n if ((policy === 'security' || onlyIfAffected) && !affected) {\n return {\n ...assessment,\n upgrade: {\n status: 'unaffected',\n reason: `No security update is needed for Next.js ${installedVersion}.`,\n },\n }\n }\n\n // Keep a confirmed advisory even when target metadata cannot be read.\n try {\n let targetVersion: string\n let references: string[]\n if (policy === 'security' && snapshot) {\n const registryURL = `${NPM_REGISTRY}next`\n const registry = (await fetchJSON(registryURL)).value\n const releases = parseReleases(registry)\n references = [snapshot.reference, registryURL]\n const candidates = securityCandidates(installedVersion, releases)\n const ranges = [\n ...snapshot.ranges,\n ...(candidates.length\n ? await readNpmAdvisories(candidates.map(({ version }) => version))\n : []),\n ]\n try {\n targetVersion = selectSecurityTarget(\n installedVersion,\n releases,\n ranges\n )!.version\n } catch (error) {\n return {\n ...assessment,\n upgrade: { status: 'blocked', reason: (error as Error).message },\n }\n }\n } else {\n const release = await fetchLatestRelease(installedVersion)\n if (!release) {\n throw new Error(\n channel === 'canary'\n ? 'Could not determine the latest Next.js version on the canary dist-tag.'\n : 'Could not determine the latest stable Next.js version.'\n )\n }\n targetVersion =\n policy === 'experimental-future' &&\n semver.gt(installedVersion, release.version)\n ? installedVersion\n : release.version\n references = [release.reference]\n const releaseKind =\n channel === 'canary' ? 'canary release' : 'stable release'\n\n if (policy === 'latest' && semver.lt(targetVersion, installedVersion)) {\n return {\n ...assessment,\n upgrade: {\n status: 'unaffected',\n reason: `Next.js ${installedVersion} is newer than the latest ${releaseKind} ${targetVersion}.`,\n },\n }\n }\n\n const targetRanges =\n snapshot && targetVersion !== installedVersion\n ? await readNpmAdvisories([targetVersion])\n : snapshot?.ranges\n if (\n targetRanges?.some((range) => semver.satisfies(targetVersion, range))\n ) {\n return {\n ...assessment,\n upgrade: {\n status: 'blocked',\n reason: `Next.js ${targetVersion} is affected by an active advisory.`,\n },\n }\n }\n\n if (policy === 'latest' && semver.eq(targetVersion, installedVersion)) {\n return {\n ...assessment,\n upgrade: {\n status: 'unaffected',\n reason: `Next.js ${installedVersion} is already the latest ${releaseKind}.`,\n },\n }\n }\n }\n\n return {\n ...assessment,\n upgrade: {\n status: 'ready',\n installedVersion,\n targetVersion,\n references,\n futureDefaults: [],\n },\n }\n } catch (error) {\n return {\n ...assessment,\n upgrade: { status: 'unknown', reason: (error as Error).message },\n }\n }\n}\n\ntype PackageRelease = {\n version: string\n}\n\nconst NPM_REGISTRY = 'https://registry.npmjs.org/'\nconst NPM_ADVISORIES = `${NPM_REGISTRY}-/npm/v1/security/advisories/bulk`\n\nasync function fetchJSON(\n url: string,\n init: RequestInit | undefined = undefined\n): Promise<{ value: unknown }> {\n try {\n const response = await fetch(url, {\n ...init,\n headers: { Accept: 'application/json', ...init?.headers },\n signal: AbortSignal.timeout(10_000),\n redirect: 'error',\n })\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}`)\n }\n\n return { value: await response.json() }\n } catch (error) {\n throw new Error('Could not fetch upgrade metadata. Please try again.', {\n cause: error,\n })\n }\n}\n\nexport function getPrereleaseChannel(version: string): string | null {\n const channel = semver.prerelease(version)?.[0]\n return channel === 'canary' ||\n channel === 'rc' ||\n channel === 'beta' ||\n channel === 'preview'\n ? channel\n : null\n}\n\nfunction parseReleases(value: unknown): PackageRelease[] {\n const data = value as {\n versions:\n | Record<\n string,\n {\n version: string\n }\n >\n | undefined\n }\n\n if (!data?.versions) {\n throw new Error('Could not determine a safe Next.js version.')\n }\n\n return Object.entries(data.versions).flatMap(([version, metadata]) => {\n if (!semver.valid(version) || semver.prerelease(version)) {\n return []\n }\n\n if (metadata.version !== version) {\n throw new Error('Could not determine a safe Next.js version.')\n }\n\n return [{ version }]\n })\n}\n\nexport function getLatestUpgradeVersion(\n version: string,\n targetVersion: string\n) {\n const channel = getPrereleaseChannel(version)\n const targetChannel = getPrereleaseChannel(targetVersion)\n if (\n !semver.valid(version) ||\n !semver.valid(targetVersion) ||\n (semver.prerelease(version) && !channel) ||\n (semver.prerelease(targetVersion) && !targetChannel) ||\n (channel === 'canary'\n ? targetChannel !== 'canary'\n : targetChannel !== null) ||\n !semver.gt(targetVersion, version)\n ) {\n return null\n }\n // Stable releases replacing prereleases still warrant a reminder, even\n // within the same minor. Patches and consecutive canaries remain explicit.\n if (\n !(channel && channel !== 'canary') &&\n semver.major(targetVersion) === semver.major(version) &&\n semver.minor(targetVersion) === semver.minor(version)\n ) {\n return null\n }\n return targetVersion\n}\n\nasync function fetchLatestRelease(installedVersion: string): Promise<{\n version: string\n reference: string\n} | null> {\n const channel = getPrereleaseChannel(installedVersion)\n const releaseChannel = channel === 'canary' ? 'canary' : 'latest'\n const reference = `${NPM_REGISTRY}next/${releaseChannel}`\n const { value } = await fetchJSON(reference)\n const release = value as { version: string } | null\n\n if (\n !release ||\n !semver.valid(release.version) ||\n (channel !== 'canary' && semver.prerelease(release.version)) ||\n getPrereleaseChannel(release.version) !==\n (channel === 'canary' ? 'canary' : null)\n ) {\n return null\n }\n\n return { version: release.version, reference }\n}\n\n// TODO: Record whether each advisory lookup succeeded or failed in upgrade telemetry.\nasync function readNpmAdvisories(versions: string[]): Promise {\n let value: unknown\n try {\n value = (\n await fetchJSON(NPM_ADVISORIES, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ next: versions }),\n })\n ).value\n } catch (error) {\n throw new Error('Could not check for security updates. Please try again.', {\n cause: error,\n })\n }\n\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n throw new Error('Could not check for security updates.')\n }\n\n const data = value as Record\n\n if (Object.keys(data).some((name) => name !== 'next')) {\n throw new Error('Could not check for security updates.')\n }\n\n // The bulk endpoint omits packages with no known vulnerabilities.\n if (!('next' in data)) {\n return []\n }\n\n if (!Array.isArray(data.next)) {\n throw new Error('Could not check for security updates.')\n }\n\n return data.next.map((finding) => {\n if (\n !finding ||\n typeof finding.vulnerable_versions !== 'string' ||\n !finding.vulnerable_versions.trim()\n ) {\n throw new Error('Could not check for security updates.')\n }\n const range = finding.vulnerable_versions.replace(/,\\s*/g, ' ')\n if (!semver.validRange(range)) {\n throw new Error('Could not check for security updates.')\n }\n return range\n })\n}\n\nfunction securityCandidates(\n source: string,\n releases: PackageRelease[]\n): PackageRelease[] {\n // Only the newest stable release of each eligible major is considered.\n const latest = new Map()\n for (const release of releases) {\n const major = semver.major(release.version)\n const previous = latest.get(major)\n if (!previous || semver.gt(release.version, previous.version)) {\n latest.set(major, release)\n }\n }\n return [...latest.entries()]\n .sort(([a], [b]) => a - b)\n .filter(\n ([major, release]) =>\n major >= semver.major(source) && semver.gt(release.version, source)\n )\n .map(([, release]) => release)\n}\n\nfunction selectSecurityTarget(\n source: string,\n releases: PackageRelease[],\n ranges: string[]\n): PackageRelease | undefined {\n if (!ranges.some((range) => semver.satisfies(source, range))) {\n return\n }\n\n for (const candidate of securityCandidates(source, releases)) {\n if (!ranges.some((range) => semver.satisfies(candidate.version, range))) {\n return candidate\n }\n }\n\n throw new Error('No safe Next.js update is currently available.')\n}\n"],"names":["getLatestUpgradeVersion","getPrereleaseChannel","getUpgradeAssessment","prepareUpgrade","directory","targetRequest","Error","JSON","stringify","requireFromApp","createRequire","join","installedNext","parse","readFile","resolve","installedVersion","version","semver","valid","upgrade","status","config","loadConfig","PHASE_INFO","silent","finally","resetEnv","pendingFutureDefaults","getPendingFutureDefaults","targetVersion","length","reason","futureDefaults","policy","onlyIfAffected","channel","prerelease","affected","reference","snapshot","ranges","readNpmAdvisories","NPM_ADVISORIES","some","range","satisfies","assessment","references","registryURL","NPM_REGISTRY","registry","fetchJSON","value","releases","parseReleases","candidates","securityCandidates","map","selectSecurityTarget","error","message","release","fetchLatestRelease","gt","releaseKind","lt","targetRanges","eq","url","init","undefined","response","fetch","headers","Accept","signal","AbortSignal","timeout","redirect","ok","json","cause","data","versions","Object","entries","flatMap","metadata","targetChannel","major","minor","releaseChannel","method","body","next","Array","isArray","keys","name","finding","vulnerable_versions","trim","replace","validRange","source","latest","Map","previous","get","set","sort","a","b","filter","candidate"],"mappings":";;;;;;;;;;;;;;;;;IA8UgBA,uBAAuB;eAAvBA;;IAvCAC,oBAAoB;eAApBA;;IA9MMC,oBAAoB;eAApBA;;IAnEAC,cAAc;eAAdA;;;0BAtBG;wBACK;sBACT;qBACI;+DACN;+DACI;2BACI;gCAIpB;;;;;;AAYA,eAAeA,eACpBC,SAAiB,EACjBC,gBAAwB,UAAU;IAElC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,SAASxE,eAAM,CAACwE,KAAK,CAACe,WAAWvF,eAAM,CAAC8C,EAAE,CAACF,QAAQ7C,OAAO,EAAEwF,SAE/D/C,GAAG,CAAC,CAAC,GAAGI,QAAQ,GAAKA;AAC1B;AAEA,SAASH,qBACP8C,MAAc,EACdnD,QAA0B,EAC1Bb,MAAgB;IAEhB,IAAI,CAACA,OAAOG,IAAI,CAAC,CAACC,QAAU3B,eAAM,CAAC4B,SAAS,CAAC2D,QAAQ5D,SAAS;QAC5D;IACF;IAEA,KAAK,MAAMsE,aAAa1D,mBAAmBgD,QAAQnD,UAAW;QAC5D,IAAI,CAACb,OAAOG,IAAI,CAAC,CAACC,QAAU3B,eAAM,CAAC4B,SAAS,CAACqE,UAAUlG,OAAO,EAAE4B,SAAS;YACvE,OAAOsE;QACT;IACF;IAEA,MAAM,IAAI7G,MAAM;AAClB","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/prompt-output.d.ts b/e-commerce/node_modules/next/dist/lib/upgrade/prompt-output.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4d54cd4c274f4a7ddc00dfeee071bd23b16ed007 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/prompt-output.d.ts @@ -0,0 +1,31 @@ +import type { ChildProcess } from 'child_process'; +import type { NudgeKind, UpgradeContext, UpgradeReminder } from './nudge'; +type PromptOutput = ReturnType; +export type UpgradeMenuResult = { + policy: NudgeKind; + nudgeId: string | null; +} | 'interrupt' | null; +export declare function createPromptOutput(): { + attach(child: ChildProcess): void; + hold(): void; + release(): void; + discard(): void; +}; +export declare function drainPromptOutput(child: ChildProcess): Promise; +export declare function getPromptOutputEnv(): { + FORCE_COLOR: string | undefined; + NEXT_PRIVATE_PROMPT_OUTPUT: string; + NEXT_PRIVATE_TERMINAL_COLUMNS: string | undefined; +}; +export declare function reassertRawMode(): void; +export declare function showUpgradeMenu(output: PromptOutput, options: { + dir: string; + context: UpgradeContext; + command: 'dev' | 'build'; + signal: AbortSignal; + initialAssessment: Promise | null; + telemetryDisabled: string | undefined; +}): Promise; +export declare function closedUpgradeMenu(menu: Promise | undefined): Promise; +export declare function flushUpgradeTelemetry(): Promise; +export {}; diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/prompt-output.js b/e-commerce/node_modules/next/dist/lib/upgrade/prompt-output.js new file mode 100644 index 0000000000000000000000000000000000000000..da74c3ab3a0d52c0f43036e19692ef2c2ae253fc --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/prompt-output.js @@ -0,0 +1,235 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + closedUpgradeMenu: null, + createPromptOutput: null, + drainPromptOutput: null, + flushUpgradeTelemetry: null, + getPromptOutputEnv: null, + reassertRawMode: null, + showUpgradeMenu: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + closedUpgradeMenu: function() { + return closedUpgradeMenu; + }, + createPromptOutput: function() { + return createPromptOutput; + }, + drainPromptOutput: function() { + return drainPromptOutput; + }, + flushUpgradeTelemetry: function() { + return flushUpgradeTelemetry; + }, + getPromptOutputEnv: function() { + return getPromptOutputEnv; + }, + reassertRawMode: function() { + return reassertRawMode; + }, + showUpgradeMenu: function() { + return showUpgradeMenu; + } +}); +const _path = /*#__PURE__*/ _interop_require_default(require("path")); +const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../build/output/log")); +const _storage = require("../../telemetry/storage"); +const _events = require("events"); +const _promises = require("timers/promises"); +const _picocolors = require("../picocolors"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || typeof obj !== "object" && typeof obj !== "function") { + return { + default: obj + }; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = { + __proto__: null + }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj){ + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} +// Keep at most this much while the menu is open, so a menu left open doesn't +// grow memory without bound. +const MAX_HELD_BYTES = 10 * 1024 * 1024; +function createPromptOutput() { + // print: show now. hold: keep for later. drop: throw away. + let mode = 'print'; + // One list for stdout and stderr keeps their order. + let held = []; + let heldBytes = 0; + let droppedBytes = 0; + function forward(destination) { + return (chunk)=>{ + if (mode === 'print') { + destination.write(chunk); + } else if (mode === 'hold') { + held.push([ + destination, + chunk + ]); + heldBytes += chunk.length; + // Over the limit: drop the oldest output. + while(heldBytes > MAX_HELD_BYTES && held.length > 1){ + const [, oldest] = held.shift(); + heldBytes -= oldest.length; + droppedBytes += oldest.length; + } + } + }; + } + return { + attach (child) { + child.stdout.on('data', forward(process.stdout)); + child.stderr.on('data', forward(process.stderr)); + }, + // The menu opened. + hold () { + mode = 'hold'; + }, + // The menu closed: show what was held. + release () { + mode = 'print'; + if (droppedBytes > 0) { + _log.warn(`${droppedBytes} bytes of earlier output were dropped while the upgrade menu was open.`); + } + for (const [destination, chunk] of held){ + destination.write(chunk); + } + held = []; + }, + // Upgrade was chosen and the child is stopping, so its output doesn't + // matter. + discard () { + mode = 'drop'; + held = []; + } + }; +} +async function drainPromptOutput(child) { + var _child_stderr; + // The pipes are often closed by the time 'exit' fires, and then 'close' has + // already been sent. + if (!child.stdout || child.stdout.destroyed && ((_child_stderr = child.stderr) == null ? void 0 : _child_stderr.destroyed)) { + return; + } + await Promise.race([ + (0, _events.once)(child, 'close'), + (0, _promises.setTimeout)(500) + ]); +} +function getPromptOutputEnv() { + const { FORCE_COLOR, NODE_DISABLE_COLORS } = process.env; + return { + FORCE_COLOR: // An empty FORCE_COLOR means "on" to Node but "unset" to picocolors. + FORCE_COLOR || (_picocolors.isColorSupported && !NODE_DISABLE_COLORS ? '1' : FORCE_COLOR), + NEXT_PRIVATE_PROMPT_OUTPUT: '1', + NEXT_PRIVATE_TERMINAL_COLUMNS: process.stdout.columns ? String(process.stdout.columns) : undefined + }; +} +function reassertRawMode() { + const stdin = process.stdin; + if (stdin.isTTY && stdin.isRaw) { + // Node skips setting a mode it thinks is already set, so toggle. + stdin.setRawMode(false); + stdin.setRawMode(true); + } +} +let pendingTelemetry; +async function showUpgradeMenu(output, options) { + const { dir, context, command, signal, initialAssessment } = options; + const { nudgeUpgrade } = require('./nudge'); + if (options.telemetryDisabled) { + process.env.NEXT_TELEMETRY_DISABLED = options.telemetryDisabled; + } + const telemetry = new _storage.Telemetry({ + distDir: _path.default.join(dir, context.distDir), + skipNotify: true + }); + let nudgeId = null; + // onNudgeId runs as the menu draws, so holding starts at exactly that point. + const action = await nudgeUpgrade(dir, context, command, signal, initialAssessment, { + telemetry, + onNudgeId (id) { + nudgeId = id; + output.hold(); + } + }).catch((error)=>{ + _log.warn(`Could not offer the upgrade: ${String(error)}`); + }); + // The answer is already being sent. Don't wait for it here, or Ctrl+C would + // be ignored until it is done. + pendingTelemetry = telemetry.flush(); + // Upgrade. The caller drops or shows what was held. + const policy = context.experimental.agentUpgrade; + if (action === 'update' && policy && !signal.aborted) { + return { + policy, + nudgeId + }; + } + // Skip, Ctrl+C, or closed: show what was held. + output.release(); + return action === 'interrupt' && !signal.aborted ? 'interrupt' : null; +} +async function closedUpgradeMenu(menu) { + await Promise.race([ + menu, + (0, _promises.setTimeout)(1000, undefined, { + ref: false + }) + ]); +} +async function flushUpgradeTelemetry() { + await Promise.race([ + pendingTelemetry, + (0, _promises.setTimeout)(1000, undefined, { + ref: false + }) + ]); +} + +//# sourceMappingURL=prompt-output.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/prompt-output.js.map b/e-commerce/node_modules/next/dist/lib/upgrade/prompt-output.js.map new file mode 100644 index 0000000000000000000000000000000000000000..31ffb93ad5136b3f96ff1f6ae29a8a4f54368243 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/prompt-output.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/upgrade/prompt-output.ts"],"sourcesContent":["import path from 'path'\nimport * as Log from '../../build/output/log'\nimport { Telemetry } from '../../telemetry/storage'\n\nimport { once } from 'events'\nimport { setTimeout as sleep } from 'timers/promises'\nimport { isColorSupported } from '../picocolors'\n\nimport type { ChildProcess } from 'child_process'\nimport type { NudgeKind, UpgradeContext, UpgradeReminder } from './nudge'\n\ntype PromptOutput = ReturnType\n\nexport type UpgradeMenuResult =\n | { policy: NudgeKind; nudgeId: string | null }\n | 'interrupt'\n | null\n\n// Keep at most this much while the menu is open, so a menu left open doesn't\n// grow memory without bound.\nconst MAX_HELD_BYTES = 10 * 1024 * 1024\n\n// All output of the child (and anything it starts) comes through here, so it\n// can be held while the upgrade menu is on screen.\nexport function createPromptOutput() {\n // print: show now. hold: keep for later. drop: throw away.\n let mode: 'print' | 'hold' | 'drop' = 'print'\n // One list for stdout and stderr keeps their order.\n let held: Array<[NodeJS.WriteStream, Buffer]> = []\n let heldBytes = 0\n let droppedBytes = 0\n\n function forward(destination: NodeJS.WriteStream) {\n return (chunk: Buffer) => {\n if (mode === 'print') {\n destination.write(chunk)\n } else if (mode === 'hold') {\n held.push([destination, chunk])\n heldBytes += chunk.length\n // Over the limit: drop the oldest output.\n while (heldBytes > MAX_HELD_BYTES && held.length > 1) {\n const [, oldest] = held.shift()!\n heldBytes -= oldest.length\n droppedBytes += oldest.length\n }\n }\n }\n }\n\n return {\n attach(child: ChildProcess) {\n child.stdout!.on('data', forward(process.stdout))\n child.stderr!.on('data', forward(process.stderr))\n },\n // The menu opened.\n hold() {\n mode = 'hold'\n },\n // The menu closed: show what was held.\n release() {\n mode = 'print'\n if (droppedBytes > 0) {\n Log.warn(\n `${droppedBytes} bytes of earlier output were dropped while the upgrade menu was open.`\n )\n }\n for (const [destination, chunk] of held) {\n destination.write(chunk)\n }\n held = []\n },\n // Upgrade was chosen and the child is stopping, so its output doesn't\n // matter.\n discard() {\n mode = 'drop'\n held = []\n },\n }\n}\n\n// Read what is left in the pipes after the child exits. Don't wait long, in\n// case something the child started keeps them open.\nexport async function drainPromptOutput(child: ChildProcess) {\n // The pipes are often closed by the time 'exit' fires, and then 'close' has\n // already been sent.\n if (!child.stdout || (child.stdout.destroyed && child.stderr?.destroyed)) {\n return\n }\n await Promise.race([once(child, 'close'), sleep(500)])\n}\n\n// A pipe is not a terminal. Like other tools that pipe a child's output, pass\n// FORCE_COLOR on. Tell Next's own output code that the output still ends up on\n// a terminal, and how wide it is.\nexport function getPromptOutputEnv() {\n const { FORCE_COLOR, NODE_DISABLE_COLORS } = process.env\n return {\n FORCE_COLOR:\n // An empty FORCE_COLOR means \"on\" to Node but \"unset\" to picocolors.\n FORCE_COLOR ||\n (isColorSupported && !NODE_DISABLE_COLORS ? '1' : FORCE_COLOR),\n NEXT_PRIVATE_PROMPT_OUTPUT: '1',\n NEXT_PRIVATE_TERMINAL_COLUMNS: process.stdout.columns\n ? String(process.stdout.columns)\n : undefined,\n }\n}\n\n// A child on the terminal puts it back in normal mode when it exits, which\n// stops the menu from reading keys. Put raw mode back.\nexport function reassertRawMode() {\n const stdin = process.stdin\n if (stdin.isTTY && stdin.isRaw) {\n // Node skips setting a mode it thinks is already set, so toggle.\n stdin.setRawMode(false)\n stdin.setRawMode(true)\n }\n}\n\nlet pendingTelemetry: Promise | undefined\n\n// Shows the menu while the child keeps working. Returns what to do next:\n// upgrade, interrupt, or carry on (null).\nexport async function showUpgradeMenu(\n output: PromptOutput,\n options: {\n dir: string\n context: UpgradeContext\n command: 'dev' | 'build'\n signal: AbortSignal\n initialAssessment: Promise | null\n // The child's NEXT_TELEMETRY_DISABLED. It loaded .env; this process did\n // not.\n telemetryDisabled: string | undefined\n }\n): Promise {\n const { dir, context, command, signal, initialAssessment } = options\n const { nudgeUpgrade } = require('./nudge') as typeof import('./nudge')\n\n if (options.telemetryDisabled) {\n process.env.NEXT_TELEMETRY_DISABLED = options.telemetryDisabled\n }\n const telemetry = new Telemetry({\n distDir: path.join(dir, context.distDir),\n skipNotify: true,\n })\n let nudgeId: string | null = null\n\n // onNudgeId runs as the menu draws, so holding starts at exactly that point.\n const action = await nudgeUpgrade(\n dir,\n context,\n command,\n signal,\n initialAssessment,\n {\n telemetry,\n onNudgeId(id) {\n nudgeId = id\n output.hold()\n },\n }\n ).catch((error) => {\n Log.warn(`Could not offer the upgrade: ${String(error)}`)\n })\n\n // The answer is already being sent. Don't wait for it here, or Ctrl+C would\n // be ignored until it is done.\n pendingTelemetry = telemetry.flush()\n\n // Upgrade. The caller drops or shows what was held.\n const policy = context.experimental.agentUpgrade\n if (action === 'update' && policy && !signal.aborted) {\n return { policy, nudgeId }\n }\n\n // Skip, Ctrl+C, or closed: show what was held.\n output.release()\n return action === 'interrupt' && !signal.aborted ? 'interrupt' : null\n}\n\n// The menu closes right away when cancelled, but it may still be waiting on a\n// network check before showing. Don't wait on that.\nexport async function closedUpgradeMenu(menu: Promise | undefined) {\n await Promise.race([menu, sleep(1000, undefined, { ref: false })])\n}\n\n// Before exiting, give the menu's telemetry a moment to finish sending.\nexport async function flushUpgradeTelemetry() {\n await Promise.race([pendingTelemetry, sleep(1000, undefined, { ref: false })])\n}\n"],"names":["closedUpgradeMenu","createPromptOutput","drainPromptOutput","flushUpgradeTelemetry","getPromptOutputEnv","reassertRawMode","showUpgradeMenu","MAX_HELD_BYTES","mode","held","heldBytes","droppedBytes","forward","destination","chunk","write","push","length","oldest","shift","attach","child","stdout","on","process","stderr","hold","release","Log","warn","discard","destroyed","Promise","race","once","sleep","FORCE_COLOR","NODE_DISABLE_COLORS","env","isColorSupported","NEXT_PRIVATE_PROMPT_OUTPUT","NEXT_PRIVATE_TERMINAL_COLUMNS","columns","String","undefined","stdin","isTTY","isRaw","setRawMode","pendingTelemetry","output","options","dir","context","command","signal","initialAssessment","nudgeUpgrade","require","telemetryDisabled","NEXT_TELEMETRY_DISABLED","telemetry","Telemetry","distDir","path","join","skipNotify","nudgeId","action","onNudgeId","id","catch","error","flush","policy","experimental","agentUpgrade","aborted","menu","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;IAuLsBA,iBAAiB;eAAjBA;;IA/JNC,kBAAkB;eAAlBA;;IA0DMC,iBAAiB;eAAjBA;;IA0GAC,qBAAqB;eAArBA;;IA9FNC,kBAAkB;eAAlBA;;IAgBAC,eAAe;eAAfA;;IAaMC,eAAe;eAAfA;;;6DA3HL;6DACI;yBACK;wBAEL;0BACe;4BACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYjC,6EAA6E;AAC7E,6BAA6B;AAC7B,MAAMC,iBAAiB,KAAK,OAAO;AAI5B,SAASN;IACd,2DAA2D;IAC3D,IAAIO,OAAkC;IACtC,oDAAoD;IACpD,IAAIC,OAA4C,EAAE;IAClD,IAAIC,YAAY;IAChB,IAAIC,eAAe;IAEnB,SAASC,QAAQC,WAA+B;QAC9C,OAAO,CAACC;YACN,IAAIN,SAAS,SAAS;gBACpBK,YAAYE,KAAK,CAACD;YACpB,OAAO,IAAIN,SAAS,QAAQ;gBAC1BC,KAAKO,IAAI,CAAC;oBAACH;oBAAaC;iBAAM;gBAC9BJ,aAAaI,MAAMG,MAAM;gBACzB,0CAA0C;gBAC1C,MAAOP,YAAYH,kBAAkBE,KAAKQ,MAAM,GAAG,EAAG;oBACpD,MAAM,GAAGC,OAAO,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C,QAAQC,IAAI,CAAC;QAAC6C;QAAM3C,IAAAA,oBAAK,EAAC,MAAMS,WAAW;YAAEmC,KAAK;QAAM;KAAG;AACnE;AAGO,eAAe5E;IACpB,MAAM6B,QAAQC,IAAI,CAAC;QAACgB;QAAkBd,IAAAA,oBAAK,EAAC,MAAMS,WAAW;YAAEmC,KAAK;QAAM;KAAG;AAC/E","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/prompt.d.ts b/e-commerce/node_modules/next/dist/lib/upgrade/prompt.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..eb6b9c34e4d92307e3cf1c271499820a70a93ddf --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/prompt.d.ts @@ -0,0 +1,7 @@ +export type UpgradeAction = 'update' | 'skip' | 'dismiss' | 'interrupt'; +export declare function promptUpgrade({ message, signal, canUpdate, onShown, }: { + message: string; + signal: AbortSignal; + canUpdate: boolean; + onShown: (() => void) | null; +}): Promise; diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/prompt.js b/e-commerce/node_modules/next/dist/lib/upgrade/prompt.js new file mode 100644 index 0000000000000000000000000000000000000000..a7c40d2d73f50683c7a9b17b0949f3f66c5eaaab --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/prompt.js @@ -0,0 +1,159 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "promptUpgrade", { + enumerable: true, + get: function() { + return promptUpgrade; + } +}); +const _readline = require("readline"); +const _stream = require("stream"); +const _cliselect = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/cli-select")); +const _picocolors = require("../picocolors"); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +async function promptUpgrade({ message, signal, canUpdate, onShown }) { + if (signal.aborted) { + return 'skip'; + } + const input = process.stdin; + const terminal = process.stdout; + const values = { + ...canUpdate ? { + update: 'Upgrade now' + } : {}, + skip: 'Skip', + dismiss: 'Skip until next version' + }; + const labels = Object.values(values); + const heading = `${message}\n\n`; + const wasRaw = input.isRaw ?? false; + const wasFlowing = input.readableFlowing; + // Isolate cancellation from other consumers of stdin. cli-select can close + // this stream without changing the real terminal's original raw/flow state. + const keys = Object.assign(new _stream.PassThrough(), { + setRawMode () {} + }); + let interrupted = false; + let cancelled = false; + let resized = false; + let selectedIndex = 0; + let shown = false; + const renderValue = (value, selected)=>{ + if (value === labels[0]) { + // We own this screen. Redraw from the top instead of relying on + // cli-select's one-row-per-choice cursor movement when choices wrap. + terminal.write(`\x1b[H\x1b[2J${heading}`); + // Redraws must not count the same rendered menu as another nudge. + if (!shown) { + shown = true; + onShown == null ? void 0 : onShown(); + } + } + if (selected) { + selectedIndex = labels.indexOf(value); + } + return selected ? (0, _picocolors.cyan)((0, _picocolors.bold)(value)) : value; + }; + const cancel = ()=>{ + cancelled = true; + keys.emit('keypress', '', { + name: 'escape' + }); + }; + const onKey = (text, key)=>{ + if ((key == null ? void 0 : key.ctrl) && key.name === 'c') { + interrupted = true; + } + if ((key == null ? void 0 : key.name) === 'escape') { + cancelled = true; + } + keys.emit('keypress', text, key); + }; + const onResize = ()=>{ + resized = true; + // A terminal write can emit resize while cli-select is still opening. + // Wait until its selection callback is installed before cancelling it. + queueMicrotask(()=>{ + if (resized && !restored) { + keys.emit('keypress', '', { + name: 'escape' + }); + } + }); + }; + let restored = false; + const restore = ()=>{ + if (restored) { + return; + } + restored = true; + input.removeListener('keypress', onKey); + terminal.removeListener('resize', onResize); + signal.removeEventListener('abort', cancel); + process.removeListener('exit', restore); + keys.destroy(); + try { + input.setRawMode(wasRaw); + } finally{ + if (wasFlowing !== true) { + input.pause(); + } + terminal.write('\x1b[?1049l\x1b[?25h'); + } + }; + // CLI signal handlers may exit synchronously, before the promise settles. + process.once('exit', restore); + try { + // Keep startup output on the normal screen while the menu owns the terminal. + terminal.write('\x1b[?1049h'); + (0, _readline.emitKeypressEvents)(input); + input.on('keypress', onKey); + terminal.on('resize', onResize); + signal.addEventListener('abort', cancel, { + once: true + }); + input.setRawMode(true); + input.resume(); + while(true){ + resized = false; + const selection = (0, _cliselect.default)({ + values, + defaultValue: selectedIndex, + selected: (0, _picocolors.cyan)('❯'), + unselected: ' ', + indentation: 2, + cleanup: true, + // cli-select types inputStream as a WriteStream, but only consumes + // keypress events and the raw-mode methods supplied by this proxy. + inputStream: keys, + outputStream: terminal, + valueRenderer: renderValue + }); + if (signal.aborted || cancelled) { + cancel(); + } + try { + const { id } = await selection; + return signal.aborted || cancelled ? 'skip' : id; + } catch (error) { + // cli-select rejects without a reason for Escape / Ctrl+C. + if (error) { + throw error; + } + if (!resized || signal.aborted || cancelled || interrupted) { + return interrupted ? 'interrupt' : 'skip'; + } + } + } + } finally{ + restore(); + } +} + +//# sourceMappingURL=prompt.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/prompt.js.map b/e-commerce/node_modules/next/dist/lib/upgrade/prompt.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c468e67e31a06cbd96cb6ae31cb2a34f36216b22 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/prompt.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/upgrade/prompt.ts"],"sourcesContent":["import { emitKeypressEvents, type Key } from 'readline'\nimport { PassThrough } from 'stream'\nimport cliSelect from 'next/dist/compiled/cli-select'\nimport { bold, cyan } from '../picocolors'\n\nexport type UpgradeAction = 'update' | 'skip' | 'dismiss' | 'interrupt'\n\nexport async function promptUpgrade({\n message,\n signal,\n canUpdate,\n onShown,\n}: {\n message: string\n signal: AbortSignal\n canUpdate: boolean\n onShown: (() => void) | null\n}): Promise {\n if (signal.aborted) {\n return 'skip'\n }\n const input = process.stdin\n const terminal = process.stdout\n const values = {\n ...(canUpdate ? { update: 'Upgrade now' } : {}),\n skip: 'Skip',\n dismiss: 'Skip until next version',\n }\n const labels = Object.values(values)\n const heading = `${message}\\n\\n`\n const wasRaw = input.isRaw ?? false\n const wasFlowing = input.readableFlowing\n // Isolate cancellation from other consumers of stdin. cli-select can close\n // this stream without changing the real terminal's original raw/flow state.\n const keys = Object.assign(new PassThrough(), { setRawMode() {} })\n let interrupted = false\n let cancelled = false\n let resized = false\n let selectedIndex = 0\n let shown = false\n const renderValue = (value: string, selected: boolean) => {\n if (value === labels[0]) {\n // We own this screen. Redraw from the top instead of relying on\n // cli-select's one-row-per-choice cursor movement when choices wrap.\n terminal.write(`\\x1b[H\\x1b[2J${heading}`)\n\n // Redraws must not count the same rendered menu as another nudge.\n if (!shown) {\n shown = true\n onShown?.()\n }\n }\n if (selected) {\n selectedIndex = labels.indexOf(value)\n }\n return selected ? cyan(bold(value)) : value\n }\n const cancel = () => {\n cancelled = true\n keys.emit('keypress', '', { name: 'escape' })\n }\n const onKey = (text: string, key: Key) => {\n if (key?.ctrl && key.name === 'c') {\n interrupted = true\n }\n if (key?.name === 'escape') {\n cancelled = true\n }\n keys.emit('keypress', text, key)\n }\n const onResize = () => {\n resized = true\n // A terminal write can emit resize while cli-select is still opening.\n // Wait until its selection callback is installed before cancelling it.\n queueMicrotask(() => {\n if (resized && !restored) {\n keys.emit('keypress', '', { name: 'escape' })\n }\n })\n }\n let restored = false\n const restore = () => {\n if (restored) {\n return\n }\n restored = true\n input.removeListener('keypress', onKey)\n terminal.removeListener('resize', onResize)\n signal.removeEventListener('abort', cancel)\n process.removeListener('exit', restore)\n keys.destroy()\n try {\n input.setRawMode(wasRaw)\n } finally {\n if (wasFlowing !== true) {\n input.pause()\n }\n terminal.write('\\x1b[?1049l\\x1b[?25h')\n }\n }\n // CLI signal handlers may exit synchronously, before the promise settles.\n process.once('exit', restore)\n try {\n // Keep startup output on the normal screen while the menu owns the terminal.\n terminal.write('\\x1b[?1049h')\n emitKeypressEvents(input)\n input.on('keypress', onKey)\n terminal.on('resize', onResize)\n signal.addEventListener('abort', cancel, { once: true })\n input.setRawMode(true)\n input.resume()\n while (true) {\n resized = false\n const selection = cliSelect({\n values,\n defaultValue: selectedIndex,\n selected: cyan('❯'),\n unselected: ' ',\n indentation: 2,\n cleanup: true,\n // cli-select types inputStream as a WriteStream, but only consumes\n // keypress events and the raw-mode methods supplied by this proxy.\n inputStream: keys as unknown as NodeJS.WriteStream,\n outputStream: terminal,\n valueRenderer: renderValue,\n })\n if (signal.aborted || cancelled) {\n cancel()\n }\n try {\n const { id } = await selection\n return signal.aborted || cancelled ? 'skip' : (id as UpgradeAction)\n } catch (error) {\n // cli-select rejects without a reason for Escape / Ctrl+C.\n if (error) {\n throw error\n }\n if (!resized || signal.aborted || cancelled || interrupted) {\n return interrupted ? 'interrupt' : 'skip'\n }\n }\n }\n } finally {\n restore()\n }\n}\n"],"names":["promptUpgrade","message","signal","canUpdate","onShown","aborted","input","process","stdin","terminal","stdout","values","update","skip","dismiss","labels","Object","heading","wasRaw","isRaw","wasFlowing","readableFlowing","keys","assign","PassThrough","setRawMode","interrupted","cancelled","resized","selectedIndex","shown","renderValue","value","selected","write","indexOf","cyan","bold","cancel","emit","name","onKey","text","key","ctrl","onResize","queueMicrotask","restored","restore","removeListener","removeEventListener","destroy","pause","once","emitKeypressEvents","on","addEventListener","resume","selection","cliSelect","defaultValue","unselected","indentation","cleanup","inputStream","outputStream","valueRenderer","id","error"],"mappings":";;;;+BAOsBA;;;eAAAA;;;0BAPuB;wBACjB;kEACN;4BACK;;;;;;AAIpB,eAAeA,cAAc,EAClCC,OAAO,EACPC,MAAM,EACNC,SAAS,EACTC,OAAO,EAMR;IACC,IAAIF,OAAOG,OAAO,EAAE;QAClB,OAAO;IACT;IACA,MAAMC,QAAQC,QAAQC,KAAK;IAC3B,MAAMC,WAAWF,QAAQG,MAAM;IAC/B,MAAMC,SAAS;QACb,GAAIR,YAAY;YAAES,QAAQ;QAAc,IAAI,CAAC,CAAC;QAC9CC,MAAM;QACNC,SAAS;IACX;IACA,MAAMC,SAASC,OAAOL,MAAM,CAACA;IAC7B,MAAMM,UAAU,GAAGhB,QAAQ,IA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aD,aAAa;oBAC1D,OAAOA,cAAc,cAAc;gBACrC;YACF;QACF;IACF,SAAU;QACRsB;IACF;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/run-child-process.d.ts b/e-commerce/node_modules/next/dist/lib/upgrade/run-child-process.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f1d6a121862e5393f8d167dc7de1dc2fecc19796 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/run-child-process.d.ts @@ -0,0 +1,2 @@ +import type { SpawnOptions } from 'child_process'; +export declare function runChildProcess(command: string, args: string[], options: SpawnOptions, onSpawn: (() => void) | null): Promise; diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/run-child-process.js b/e-commerce/node_modules/next/dist/lib/upgrade/run-child-process.js new file mode 100644 index 0000000000000000000000000000000000000000..903f41628332ec450b5a61d83b92167981663c9c --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/run-child-process.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "runChildProcess", { + enumerable: true, + get: function() { + return runChildProcess; + } +}); +const _os = require("os"); +const _crossspawn = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/cross-spawn")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function runChildProcess(command, args, options, onSpawn) { + const child = (0, _crossspawn.default)(command, args, options); + return new Promise((resolve, reject)=>{ + const onInterrupt = ()=>child.kill('SIGINT'); + const onTerminate = ()=>child.kill('SIGTERM'); + const onHangup = ()=>child.kill('SIGHUP'); + process.on('SIGINT', onInterrupt); + process.on('SIGTERM', onTerminate); + process.on('SIGHUP', onHangup); + const cleanup = ()=>{ + process.removeListener('SIGINT', onInterrupt); + process.removeListener('SIGTERM', onTerminate); + process.removeListener('SIGHUP', onHangup); + }; + // Report delivery when the child starts, without waiting for the agent's work to finish. + if (onSpawn) { + child.once('spawn', ()=>{ + try { + onSpawn(); + } catch (error) { + cleanup(); + reject(error); + } + }); + } + child.once('error', (error)=>{ + cleanup(); + reject(error); + }); + child.once('close', (code, signal)=>{ + cleanup(); + resolve(code ?? (signal ? 128 + (_os.constants.signals[signal] ?? 1) : 1)); + }); + }); +} + +//# sourceMappingURL=run-child-process.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/run-child-process.js.map b/e-commerce/node_modules/next/dist/lib/upgrade/run-child-process.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f934a710079c19d877f842300f2876c558002901 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/run-child-process.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/lib/upgrade/run-child-process.ts"],"sourcesContent":["import type { SpawnOptions } from 'child_process'\nimport { constants as osConstants } from 'os'\n\nimport spawn from 'next/dist/compiled/cross-spawn'\n\nexport function runChildProcess(\n command: string,\n args: string[],\n options: SpawnOptions,\n onSpawn: (() => void) | null\n): Promise {\n const child = spawn(command, args, options)\n\n return new Promise((resolve, reject) => {\n const onInterrupt = () => child.kill('SIGINT')\n const onTerminate = () => child.kill('SIGTERM')\n const onHangup = () => child.kill('SIGHUP')\n process.on('SIGINT', onInterrupt)\n process.on('SIGTERM', onTerminate)\n process.on('SIGHUP', onHangup)\n\n const cleanup = () => {\n process.removeListener('SIGINT', onInterrupt)\n process.removeListener('SIGTERM', onTerminate)\n process.removeListener('SIGHUP', onHangup)\n }\n\n // Report delivery when the child starts, without waiting for the agent's work to finish.\n if (onSpawn) {\n child.once('spawn', () => {\n try {\n onSpawn()\n } catch (error) {\n cleanup()\n reject(error)\n }\n })\n }\n\n child.once('error', (error: Error) => {\n cleanup()\n reject(error)\n })\n child.once(\n 'close',\n (code: number | null, signal: NodeJS.Signals | null) => {\n cleanup()\n resolve(code ?? (signal ? 128 + (osConstants.signals[signal] ?? 1) : 1))\n }\n )\n })\n}\n"],"names":["runChildProcess","command","args","options","onSpawn","child","spawn","Promise","resolve","reject","onInterrupt","kill","onTerminate","onHangup","process","on","cleanup","removeListener","once","error","code","signal","osConstants","signals"],"mappings":";;;;+BAKgBA;;;eAAAA;;;oBAJyB;mEAEvB;;;;;;AAEX,SAASA,gBACdC,OAAe,EACfC,IAAc,EACdC,OAAqB,EACrBC,OAA4B;IAE5B,MAAMC,QAAQC,IAAAA,mBAAK,EAACL,SAASC,MAAMC;IAEnC,OAAO,IAAII,QAAQ,CAACC,SAASC;QAC3B,MAAMC,cAAc,IAAML,MAAMM,IAAI,CAAC;QACrC,MAAMC,cAAc,IAAMP,MAAMM,IAAI,CAAC;QACrC,MAAME,WAAW,IAAMR,MAAMM,IAAI,CAAC;QAClCG,QAAQC,EAAE,CAAC,UAAUL;QACrBI,QAAQC,EAAE,CAAC,WAAWH;QACtBE,QAAQC,EAAE,CAAC,UAAUF;QAErB,MAAMG,UAAU;YACdF,QAAQG,cAAc,CAAC,UAAUP;YACjCI,QAAQG,cAAc,CAAC,WAAWL;YAClCE,QAAQG,cAAc,CAAC,UAAUJ;QACnC;QAEA,yFAAyF;QACzF,IAAIT,SAAS;YACXC,MAAMa,IAAI,CAAC,SAAS;gBAClB,IAAI;oBACFd;gBACF,EAAE,OAAOe,OAAO;oBACdH;oBACAP,OAAOU;gBACT;YACF;QACF;QAEAd,MAAMa,IAAI,CAAC,SAAS,CAACC;YACnBH;YACAP,OAAOU;QACT;QACAd,MAAMa,IAAI,CACR,SACA,CAACE,MAAqBC;YACpBL;YACAR,QAAQY,QAASC,CAAAA,SAAS,MAAOC,CAAAA,aAAW,CAACC,OAAO,CAACF,OAAO,IAAI,CAAA,IAAK,CAAA;QACvE;IAEJ;AACF","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/same-major.md b/e-commerce/node_modules/next/dist/lib/upgrade/same-major.md new file mode 100644 index 0000000000000000000000000000000000000000..cb7ada0dad7e3f65a2c15c04605a7f0a20a11a92 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/same-major.md @@ -0,0 +1,19 @@ +Use the exact target version in the handoff prompt. Do not run a codemod or +follow a major-version migration guide for this same-major update. + +## Install + +- [ ] Install the exact target Next.js version. Update other dependencies if + needed for compatibility. + +## Verify + +- [ ] Confirm the installed version with `next --version`. +- [ ] Verify the app works with the updated dependencies and resolve any issues + caused by the update. +- [ ] Complete the verification checklist in `shared.md`. + +## Deliver + +- [ ] After verifying the version update and any requested Future Defaults + adoption, return to `shared.md` and complete its delivery checklist. diff --git a/e-commerce/node_modules/next/dist/lib/upgrade/shared.md b/e-commerce/node_modules/next/dist/lib/upgrade/shared.md new file mode 100644 index 0000000000000000000000000000000000000000..e3709ab8713a75174fe706d9f24f4af93dce8957 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/upgrade/shared.md @@ -0,0 +1,72 @@ +## Before changing files: check for duplicates + +- [ ] Check the app for an equivalent upgrade or Future Defaults adoption already + in progress. +- [ ] If the app is in a Git repository, check local branches and commits. If it + has a remote, also check remote branches and commits. +- [ ] If the repository has a provider remote, use its CLI or API to look for + open pull requests with equivalent work. For GitHub, run + `gh pr list --state open --limit 100 --json number,title,body,url,headRefName`. + Inspect the body and diff of likely matches with `gh pr diff `. + +Look for unmarked work and these markers: + +```md + + +``` + +Do not require Git to upgrade an app. Attempt each check that applies to the +app's repository and remote. Do not substitute Git history for an available +provider lookup. If a check is unavailable or fails, report which work could +not be checked and continue the upgrade. Stop before changing files only if +you find equivalent work. + +## During the upgrade: troubleshoot failures + +- [ ] Check the relevant version upgrade guides for troubleshooting sections + and follow any applicable checklists before verification or delivery. + +## Verify + +Complete this checklist after updating dependencies and for each Future Defaults +adoption, before moving on to delivery or the next adoption. + +- [ ] Confirm dependencies install successfully with the app's package manager + from its install root (the workspace root for a monorepo). Detect the + manager from `package.json` and workspace configuration, using lockfiles + as supporting evidence. Preserve its configured version and dependency + policies. +- [ ] If an upgrade or adoption command failed, inspect its partial changes, + resolve the failure, and complete any remaining steps before running + checks. Do not repeat completed codemods. +- [ ] Confirm the installed Next.js version with `next --version` using the + app's package manager. It must match the exact target in the prompt. +- [ ] Resolve issues caused by the update or adoption before continuing. + +## After all upgrade and adoption steps: commit and deliver + +- [ ] If the app is in a Git repository, commit the verified version update + before Future Defaults adoption. For a different-major update, use one + commit for each crossed major, containing + that major's surviving final-target changes. Do not add transitional + changes solely to make an intermediate version work. Include source and + target versions in each commit message and explain why and how. +- [ ] Group Future Defaults changes by the default adopted. If the app is in a + Git repository, explain why and how in each commit message. +- [ ] If the repository has a provider remote, with permission, recheck open + pull requests for duplicates. If you find equivalent work, report it and + do not publish another PR. If the recheck is unavailable, report that and + deliver the verified local changes. Otherwise, publish one draft PR with + the app marker: + +```md + + +``` + +- [ ] If the app has no Git repository or provider remote, deliver the verified + local changes and report that a PR requires a repository and remote. +- [ ] If a PR is possible but permission has not been granted, ask the user + whether to open one when reporting the completed work. +- [ ] If work is incomplete, report completed work, the blocker, and how to resume. diff --git a/e-commerce/node_modules/next/dist/lib/url.d.ts b/e-commerce/node_modules/next/dist/lib/url.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6ebcb82f2bd37d644895d8ed6c5c0765ee4e2a6 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/url.d.ts @@ -0,0 +1,5 @@ +import type { UrlWithParsedQuery } from 'url'; +export declare function isFullStringUrl(url: string): boolean; +export declare function parseUrl(url: string): URL | undefined; +export declare function parseReqUrl(url: string): UrlWithParsedQuery | undefined; +export declare function stripNextRscUnionQuery(relativeUrl: string): string; diff --git a/e-commerce/node_modules/next/dist/lib/url.js b/e-commerce/node_modules/next/dist/lib/url.js new file mode 100644 index 0000000000000000000000000000000000000000..73d5f3dc34e662a06450103f05a218a23fb5a135 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/url.js @@ -0,0 +1,75 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +0 && (module.exports = { + isFullStringUrl: null, + parseReqUrl: null, + parseUrl: null, + stripNextRscUnionQuery: null +}); +function _export(target, all) { + for(var name in all)Object.defineProperty(target, name, { + enumerable: true, + get: all[name] + }); +} +_export(exports, { + isFullStringUrl: function() { + return isFullStringUrl; + }, + parseReqUrl: function() { + return parseReqUrl; + }, + parseUrl: function() { + return parseUrl; + }, + stripNextRscUnionQuery: function() { + return stripNextRscUnionQuery; + } +}); +const _approuterheaders = require("../client/components/app-router-headers"); +const DUMMY_ORIGIN = 'http://n'; +function isFullStringUrl(url) { + return /https?:\/\//.test(url); +} +function parseUrl(url) { + let parsed = undefined; + try { + parsed = new URL(url, DUMMY_ORIGIN); + } catch {} + return parsed; +} +function parseReqUrl(url) { + const parsedUrl = parseUrl(url); + if (!parsedUrl) { + return; + } + const query = {}; + for (const key of parsedUrl.searchParams.keys()){ + const values = parsedUrl.searchParams.getAll(key); + query[key] = values.length > 1 ? values : values[0]; + } + const legacyUrl = { + query, + hash: parsedUrl.hash, + search: parsedUrl.search, + path: parsedUrl.pathname, + pathname: parsedUrl.pathname, + href: `${parsedUrl.pathname}${parsedUrl.search}${parsedUrl.hash}`, + host: '', + hostname: '', + auth: '', + protocol: '', + slashes: null, + port: '' + }; + return legacyUrl; +} +function stripNextRscUnionQuery(relativeUrl) { + const urlInstance = new URL(relativeUrl, DUMMY_ORIGIN); + urlInstance.searchParams.delete(_approuterheaders.NEXT_RSC_UNION_QUERY); + return urlInstance.pathname + urlInstance.search; +} + +//# sourceMappingURL=url.js.map \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/url.js.map b/e-commerce/node_modules/next/dist/lib/url.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a89b5c5f7d8d3a9839863debb870fd6715346e0e --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/url.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/lib/url.ts"],"sourcesContent":["import type { UrlWithParsedQuery } from 'url'\nimport { NEXT_RSC_UNION_QUERY } from '../client/components/app-router-headers'\n\nconst DUMMY_ORIGIN = 'http://n'\n\nexport function isFullStringUrl(url: string) {\n return /https?:\\/\\//.test(url)\n}\n\nexport function parseUrl(url: string): URL | undefined {\n let parsed: URL | undefined = undefined\n try {\n parsed = new URL(url, DUMMY_ORIGIN)\n } catch {}\n return parsed\n}\n\nexport function parseReqUrl(url: string): UrlWithParsedQuery | undefined {\n const parsedUrl: URL | undefined = parseUrl(url)\n\n if (!parsedUrl) {\n return\n }\n\n const query: Record = {}\n\n for (const key of parsedUrl.searchParams.keys()) {\n const values = parsedUrl.searchParams.getAll(key)\n query[key] = values.length > 1 ? values : values[0]\n }\n\n const legacyUrl: UrlWithParsedQuery = {\n query,\n hash: parsedUrl.hash,\n search: parsedUrl.search,\n path: parsedUrl.pathname,\n pathname: parsedUrl.pathname,\n href: `${parsedUrl.pathname}${parsedUrl.search}${parsedUrl.hash}`,\n host: '',\n hostname: '',\n auth: '',\n protocol: '',\n slashes: null,\n port: '',\n }\n return legacyUrl\n}\n\nexport function stripNextRscUnionQuery(relativeUrl: string): string {\n const urlInstance = new URL(relativeUrl, DUMMY_ORIGIN)\n urlInstance.searchParams.delete(NEXT_RSC_UNION_QUERY)\n\n return urlInstance.pathname + urlInstance.search\n}\n"],"names":["isFullStringUrl","parseReqUrl","parseUrl","stripNextRscUnionQuery","DUMMY_ORIGIN","url","test","parsed","undefined","URL","parsedUrl","query","key","searchParams","keys","values","getAll","length","legacyUrl","hash","search","path","pathname","href","host","hostname","auth","protocol","slashes","port","relativeUrl","urlInstance","delete","NEXT_RSC_UNION_QUERY"],"mappings":";;;;;;;;;;;;;;;;;IAKgBA,eAAe;eAAfA;;IAYAC,WAAW;eAAXA;;IARAC,QAAQ;eAARA;;IAuCAC,sBAAsB;eAAtBA;;;kCA/CqB;AAErC,MAAMC,eAAe;AAEd,SAASJ,gBAAgBK,GAAW;IACzC,OAAO,cAAcC,IAAI,CAACD;AAC5B;AAEO,SAASH,SAASG,GAAW;IAClC,IAAIE,SAA0BC;IAC9B,IAAI;QACFD,SAAS,IAAIE,IAAIJ,KAAKD;IACxB,EAAE,OAAM,CAAC;IACT,OAAOG;AACT;AAEO,SAASN,YAAYI,GAAW;IACrC,MAAMK,YAA6BR,SAASG;IAE5C,IAAI,CAACK,WAAW;QACd;IACF;IAEA,MAAMC,QAA2C,CAAC;IAElD,KAAK,MAAMC,OAAOF,UAAUG,YAAY,CAACC,IAAI,GAAI;QAC/C,MAAMC,SAASL,UAAUG,YAAY,CAACG,MAAM,CAACJ;QAC7CD,KAAK,CAACC,IAAI,GAAGG,OAAOE,MAAM,GAAG,IAAIF,SAASA,MAAM,CAAC,EAAE;IACrD;IAEA,MAAMG,YAAgC;QACpCP;QACAQ,MAAMT,UAAUS,IAAI;QACpBC,QAAQV,UAAUU,MAAM;QACxBC,MAAMX,UAAUY,QAAQ;QACxBA,UAAUZ,UAAUY,QAAQ;QAC5BC,MAAM,GAAGb,UAAUY,QAAQ,GAAGZ,UAAUU,MAAM,GAAGV,UAAUS,IAAI,EAAE;QACjEK,MAAM;QACNC,UAAU;QACVC,MAAM;QACNC,UAAU;QACVC,SAAS;QACTC,MAAM;IACR;IACA,OAAOX;AACT;AAEO,SAASf,uBAAuB2B,WAAmB;IACxD,MAAMC,cAAc,IAAItB,IAAIqB,aAAa1B;IACzC2B,YAAYlB,YAAY,CAACmB,MAAM,CAACC,sCAAoB;IAEpD,OAAOF,YAAYT,QAAQ,GAAGS,YAAYX,MAAM;AAClD","ignoreList":[0]} \ No newline at end of file diff --git a/e-commerce/node_modules/next/dist/lib/verify-partytown-setup.d.ts b/e-commerce/node_modules/next/dist/lib/verify-partytown-setup.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..95ee39b65816127eade5eede64e60b58cdb22745 --- /dev/null +++ b/e-commerce/node_modules/next/dist/lib/verify-partytown-setup.d.ts @@ -0,0 +1 @@ +export declare function verifyPartytownSetup(dir: string, targetDir: string): Promise;