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

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

1 line
No EOL
6 KiB
Text

{"version":3,"sources":["../../../../../../src/server/route-matcher-providers/dev/helpers/file-reader/batched-file-reader.ts"],"sourcesContent":["import type { FileReader } from './file-reader'\n\ninterface FileReaderBatch {\n completed: boolean\n directories: Array<string>\n callbacks: Array<{\n resolve: (value: ReadonlyArray<string>) => void\n reject: (err: any) => void\n }>\n}\n\n/**\n * CachedFileReader will deduplicate requests made to the same folder structure\n * to scan for files.\n */\nexport class BatchedFileReader implements FileReader {\n private batch?: FileReaderBatch\n\n constructor(private readonly reader: FileReader) {}\n\n // This allows us to schedule the batches after all the promises associated\n // with loading files.\n private schedulePromise?: Promise<void>\n private schedule(callback: Function) {\n if (!this.schedulePromise) {\n this.schedulePromise = Promise.resolve()\n }\n this.schedulePromise.then(() => {\n process.nextTick(callback)\n })\n }\n\n private getOrCreateBatch(): FileReaderBatch {\n // If there is an existing batch and it's not completed, then reuse it.\n if (this.batch && !this.batch.completed) {\n return this.batch\n }\n\n const batch: FileReaderBatch = {\n completed: false,\n directories: [],\n callbacks: [],\n }\n\n this.batch = batch\n\n this.schedule(async () => {\n batch.completed = true\n if (batch.directories.length === 0) return\n\n // Collect all the results for each of the directories. If any error\n // occurs, send the results back to the loaders.\n let values: ReadonlyArray<ReadonlyArray<string> | Error>\n try {\n values = await this.load(batch.directories)\n } catch (err) {\n // Reject all the callbacks.\n for (const { reject } of batch.callbacks) {\n reject(err)\n }\n return\n }\n\n // Loop over all the callbacks and send them their results.\n for (let i = 0; i < batch.callbacks.length; i++) {\n const value = values[i]\n if (value instanceof Error) {\n batch.callbacks[i].reject(value)\n } else {\n batch.callbacks[i].resolve(value)\n }\n }\n })\n\n return batch\n }\n\n private async load(\n directories: ReadonlyArray<string>\n ): Promise<ReadonlyArray<ReadonlyArray<string> | Error>> {\n // Make a unique array of directories. This is what lets us de-duplicate\n // loads for the same directory.\n const unique = [...new Set(directories)]\n\n const results = await Promise.all(\n unique.map(async (directory) => {\n let files: ReadonlyArray<string> | undefined\n let error: Error | undefined\n try {\n files = await this.reader.read(directory)\n } catch (err) {\n if (err instanceof Error) error = err\n }\n\n return { directory, files, error }\n })\n )\n\n return directories.map((directory) => {\n const found = results.find((result) => result.directory === directory)\n if (!found) return []\n\n if (found.files) return found.files\n if (found.error) return found.error\n\n return []\n })\n }\n\n public async read(dir: string): Promise<ReadonlyArray<string>> {\n // Get or create a new file reading batch.\n const batch = this.getOrCreateBatch()\n\n // Push this directory into the batch to resolve.\n batch.directories.push(dir)\n\n // Push the promise handles into the batch (under the same index) so it can\n // be resolved later when it's scheduled.\n const promise = new Promise<ReadonlyArray<string>>((resolve, reject) => {\n batch.callbacks.push({ resolve, reject })\n })\n\n return promise\n }\n}\n"],"names":["BatchedFileReader","constructor","reader","schedule","callback","schedulePromise","Promise","resolve","then","process","nextTick","getOrCreateBatch","batch","completed","directories","callbacks","length","values","load","err","reject","i","value","Error","unique","Set","results","all","map","directory","files","error","read","found","find","result","dir","push","promise"],"mappings":"AAWA;;;CAGC,GACD,OAAO,MAAMA;IAGXC,YAAY,AAAiBC,MAAkB,CAAE;aAApBA,SAAAA;IAAqB;IAK1CC,SAASC,QAAkB,EAAE;QACnC,IAAI,CAAC,IAAI,CAACC,eAAe,EAAE;YACzB,IAAI,CAACA,eAAe,GAAGC,QAAQC,OAAO;QACxC;QACA,IAAI,CAACF,eAAe,CAACG,IAAI,CAAC;YACxBC,QAAQC,QAAQ,CAACN;QACnB;IACF;IAEQO,mB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