Next.js website for Rocky Mountain Vending company featuring: - Product catalog with Stripe integration - Service areas and parts pages - Admin dashboard with Clerk authentication - SEO optimized pages with JSON-LD structured data Co-authored-by: Cursor <cursoragent@cursor.com>
1 line
No EOL
6.5 KiB
Text
1 line
No EOL
6.5 KiB
Text
{"version":3,"sources":["../../../src/server/route-matcher-managers/dev-route-matcher-manager.ts"],"sourcesContent":["import { RouteKind } from '../route-kind'\nimport type { RouteMatch } from '../route-matches/route-match'\nimport type { RouteDefinition } from '../route-definitions/route-definition'\nimport { DefaultRouteMatcherManager } from './default-route-matcher-manager'\nimport type { MatchOptions, RouteMatcherManager } from './route-matcher-manager'\nimport path from '../../shared/lib/isomorphic/path'\nimport * as Log from '../../build/output/log'\nimport { cyan } from '../../lib/picocolors'\nimport type { RouteMatcher } from '../route-matchers/route-matcher'\n\nexport interface RouteEnsurer {\n ensure(match: RouteMatch, pathname: string): Promise<void>\n}\n\nexport class DevRouteMatcherManager extends DefaultRouteMatcherManager {\n constructor(\n private readonly production: RouteMatcherManager,\n private readonly ensurer: RouteEnsurer,\n private readonly dir: string\n ) {\n super()\n }\n\n public async test(pathname: string, options: MatchOptions): Promise<boolean> {\n // Try to find a match within the developer routes.\n const match = await super.match(pathname, options)\n\n // Return if the match wasn't null. Unlike the implementation of `match`\n // which uses `matchAll` here, this does not call `ensure` on the match\n // found via the development matches.\n return match !== null\n }\n\n protected validate(\n pathname: string,\n matcher: RouteMatcher,\n options: MatchOptions\n ): RouteMatch | null {\n const match = super.validate(pathname, matcher, options)\n\n // If a match was found, check to see if there were any conflicting app or\n // pages files.\n // TODO: maybe expand this to _any_ duplicated routes instead?\n if (\n match &&\n matcher.duplicated &&\n matcher.duplicated.some(\n (duplicate) =>\n duplicate.definition.kind === RouteKind.APP_PAGE ||\n duplicate.definition.kind === RouteKind.APP_ROUTE\n ) &&\n matcher.duplicated.some(\n (duplicate) =>\n duplicate.definition.kind === RouteKind.PAGES ||\n duplicate.definition.kind === RouteKind.PAGES_API\n )\n ) {\n return null\n }\n\n return match\n }\n\n public async *matchAll(\n pathname: string,\n options: MatchOptions\n ): AsyncGenerator<RouteMatch<RouteDefinition<RouteKind>>, null, undefined> {\n // Iterate over the development matches to see if one of them match the\n // request path.\n for await (const developmentMatch of super.matchAll(pathname, options)) {\n // We're here, which means that we haven't seen this match yet, so we\n // should try to ensure it and recompile the production matcher.\n await this.ensurer.ensure(developmentMatch, pathname)\n await this.production.reload()\n\n // Iterate over the production matches again, this time we should be able\n // to match it against the production matcher unless there's an error.\n for await (const productionMatch of this.production.matchAll(\n pathname,\n options\n )) {\n yield productionMatch\n }\n }\n\n // We tried direct matching against the pathname and against all the dynamic\n // paths, so there was no match.\n return null\n }\n\n public async reload(): Promise<void> {\n // Compile the production routes again.\n await this.production.reload()\n\n // Compile the development routes.\n await super.reload()\n\n // Check for and warn of any duplicates.\n for (const [pathname, matchers] of Object.entries(\n this.matchers.duplicates\n )) {\n // We only want to warn about matchers resolving to the same path if their\n // identities are different.\n const identity = matchers[0].identity\n if (matchers.slice(1).some((matcher) => matcher.identity !== identity)) {\n continue\n }\n\n Log.warn(\n `Duplicate page detected. ${matchers\n .map((matcher) =>\n cyan(path.relative(this.dir, matcher.definition.filename))\n )\n .join(' and ')} resolve to ${cyan(pathname)}`\n )\n }\n }\n}\n"],"names":["RouteKind","DefaultRouteMatcherManager","path","Log","cyan","DevRouteMatcherManager","constructor","production","ensurer","dir","test","pathname","options","match","validate","matcher","duplicated","some","duplicate","definition","kind","APP_PAGE","APP_ROUTE","PAGES","PAGES_API","matchAll","developmentMatch","ensure","reload","productionMatch","matchers","Object","entries","duplicates","identity","slice","warn","map","relative","filename","join"],"mappings":"AAAA,SAASA,SAAS,QAAQ,gBAAe;AAGzC,SAASC,0BAA0B,QAAQ,kCAAiC;AAE5E,OAAOC,UAAU,mCAAkC;AACnD,YAAYC,SAAS,yBAAwB;AAC7C,SAASC,IAAI,QAAQ,uBAAsB;AAO3C,OAAO,MAAMC,+BAA+BJ;IAC1CK,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