2025-04-15 16:39:47 +02:00

1 line
81 KiB
Plaintext

{"version":3,"sources":["../src/index.ts","../src/constants.ts","../src/context.ts","../node_modules/.pnpm/@antfu+utils@9.1.0/node_modules/@antfu/utils/dist/index.mjs","../src/files.ts","../src/utils.ts","../src/options.ts","../src/stringify.ts","../src/resolvers/react.ts","../src/resolvers/solid.ts","../src/resolvers/vue.ts","../src/customBlock.ts"],"sourcesContent":["import type { Plugin } from 'vite'\nimport type { UserOptions } from './types'\nimport { MODULE_ID_VIRTUAL, ROUTE_BLOCK_ID_VIRTUAL, routeBlockQueryRE } from './constants'\n\nimport { PageContext } from './context'\nimport { parsePageRequest } from './utils'\n\nfunction pagesPlugin(userOptions: UserOptions = {}): Plugin {\n let ctx: PageContext\n\n return {\n name: 'vite-plugin-pages',\n enforce: 'pre',\n async configResolved(config) {\n // auto set resolver for react project\n if (\n !userOptions.resolver\n && config.plugins.find(i => i.name.includes('vite:react'))\n ) {\n userOptions.resolver = 'react'\n }\n\n // auto set resolver for solid project\n if (\n !userOptions.resolver\n && config.plugins.find(i => i.name.includes('solid'))\n ) {\n userOptions.resolver = 'solid'\n }\n\n ctx = new PageContext(userOptions, config.root)\n ctx.setLogger(config.logger)\n await ctx.searchGlob()\n },\n api: {\n getResolvedRoutes() {\n return ctx.options.resolver.getComputedRoutes(ctx)\n },\n },\n configureServer(server) {\n ctx.setupViteServer(server)\n },\n resolveId(id) {\n if (ctx.options.moduleIds.includes(id))\n return `${MODULE_ID_VIRTUAL}?id=${id}`\n\n if (routeBlockQueryRE.test(id))\n return ROUTE_BLOCK_ID_VIRTUAL\n\n return null\n },\n async load(id) {\n const {\n moduleId,\n pageId,\n } = parsePageRequest(id)\n\n if (moduleId === MODULE_ID_VIRTUAL && pageId && ctx.options.moduleIds.includes(pageId))\n return ctx.resolveRoutes()\n\n if (id === ROUTE_BLOCK_ID_VIRTUAL) {\n return {\n code: 'export default {};',\n map: null,\n }\n }\n\n return null\n },\n }\n}\n\nexport { syncIndexResolver } from './options'\nexport type {\n ReactRoute,\n SolidRoute,\n VueRoute,\n} from './resolvers'\n\nexport {\n reactResolver,\n solidResolver,\n vueResolver,\n} from './resolvers'\nexport * from './types'\nexport { PageContext }\nexport default pagesPlugin\n","export const MODULE_IDS = [\n '~pages',\n '~react-pages',\n '~solid-pages',\n 'pages-generated',\n 'virtual:generated-pages',\n 'virtual:generated-pages-react',\n]\n\nexport const MODULE_ID_VIRTUAL = 'virtual:vite-plugin-pages/generated-pages'\nexport const ROUTE_BLOCK_ID_VIRTUAL = 'virtual:vite-plugin-pages/route-block'\nexport const ROUTE_IMPORT_NAME = '__pages_import_$1__'\n\nexport const routeBlockQueryRE = /\\?vue&type=route/\n\nexport const dynamicRouteRE = /^\\[(.+)\\]$/\nexport const cacheAllRouteRE = /^\\[\\.{3}(.*)\\]$/\nexport const replaceDynamicRouteRE = /^\\[(?:\\.{3})?(.*)\\]$/\n\nexport const nuxtDynamicRouteRE = /^_(.*)$/\nexport const nuxtCacheAllRouteRE = /^_$/\n\nexport const countSlashRE = /\\//g\n\nexport const replaceIndexRE = /\\/?index$/\n","import type { Logger, ViteDevServer } from 'vite'\nimport type { PageOptions, ResolvedOptions, UserOptions } from './types'\nimport { join, resolve } from 'node:path'\nimport process from 'node:process'\nimport { slash, toArray } from '@antfu/utils'\nimport { getPageFiles } from './files'\nimport { resolveOptions } from './options'\n\nimport { debug, invalidatePagesModule, isTarget } from './utils'\n\nexport interface PageRoute {\n path: string\n route: string\n}\n\nexport class PageContext {\n private _server: ViteDevServer | undefined\n private _pageRouteMap = new Map<string, PageRoute>()\n\n rawOptions: UserOptions\n root: string\n options: ResolvedOptions\n logger?: Logger\n\n constructor(userOptions: UserOptions, viteRoot: string = process.cwd()) {\n this.rawOptions = userOptions\n this.root = slash(viteRoot)\n debug.env('root', this.root)\n this.options = resolveOptions(userOptions, this.root)\n debug.options(this.options)\n }\n\n setLogger(logger: Logger) {\n this.logger = logger\n }\n\n setupViteServer(server: ViteDevServer) {\n if (this._server === server)\n return\n\n this._server = server\n this.setupWatcher(server.watcher)\n }\n\n setupWatcher(watcher: ViteDevServer['watcher']) {\n watcher\n .on('unlink', async (path) => {\n path = slash(path)\n if (!isTarget(path, this.options))\n return\n await this.removePage(path)\n this.onUpdate()\n })\n watcher\n .on('add', async (path) => {\n path = slash(path)\n if (!isTarget(path, this.options))\n return\n const page = this.options.dirs.find(i => path.startsWith(slash(resolve(this.root, i.dir))))!\n await this.addPage(path, page)\n this.onUpdate()\n })\n\n watcher\n .on('change', async (path) => {\n path = slash(path)\n if (!isTarget(path, this.options))\n return\n const page = this._pageRouteMap.get(path)\n if (page)\n await this.options.resolver.hmr?.changed?.(this, path)\n })\n }\n\n async addPage(path: string | string[], pageDir: PageOptions) {\n debug.pages('add', path)\n for (const p of toArray(path)) {\n const pageDirPath = slash(resolve(this.root, pageDir.dir))\n const extension = this.options.extensions.find(ext => p.endsWith(`.${ext}`))\n if (!extension)\n continue\n\n const route = slash(join(pageDir.baseRoute, p.replace(`${pageDirPath}/`, '').replace(`.${extension}`, '')))\n this._pageRouteMap.set(p, {\n path: p,\n route,\n })\n await this.options.resolver.hmr?.added?.(this, p)\n }\n }\n\n async removePage(path: string) {\n debug.pages('remove', path)\n this._pageRouteMap.delete(path)\n await this.options.resolver.hmr?.removed?.(this, path)\n }\n\n onUpdate() {\n if (!this._server)\n return\n\n invalidatePagesModule(this._server)\n debug.hmr('Reload generated pages.')\n this._server.ws.send({\n type: 'full-reload',\n })\n }\n\n async resolveRoutes() {\n return this.options.resolver.resolveRoutes(this)\n }\n\n async searchGlob() {\n const pageDirFiles = this.options.dirs.map((page) => {\n const pagesDirPath = slash(resolve(this.options.root, page.dir))\n const files = getPageFiles(pagesDirPath, this.options, page)\n debug.search(page.dir, files)\n return {\n ...page,\n files: files.map(file => slash(file)),\n }\n })\n\n for (const page of pageDirFiles)\n await this.addPage(page.files, page)\n\n debug.cache(this.pageRouteMap)\n }\n\n get debug() {\n return debug\n }\n\n get pageRouteMap() {\n return this._pageRouteMap\n }\n}\n","function clamp(n, min, max) {\n return Math.min(max, Math.max(min, n));\n}\nfunction sum(...args) {\n return flattenArrayable(args).reduce((a, b) => a + b, 0);\n}\nfunction lerp(min, max, t) {\n const interpolation = clamp(t, 0, 1);\n return min + (max - min) * interpolation;\n}\nfunction remap(n, inMin, inMax, outMin, outMax) {\n const interpolation = (n - inMin) / (inMax - inMin);\n return lerp(outMin, outMax, interpolation);\n}\n\nfunction toArray(array) {\n array = array ?? [];\n return Array.isArray(array) ? array : [array];\n}\nfunction flattenArrayable(array) {\n return toArray(array).flat(1);\n}\nfunction mergeArrayable(...args) {\n return args.flatMap((i) => toArray(i));\n}\nfunction partition(array, ...filters) {\n const result = Array.from({ length: filters.length + 1 }).fill(null).map(() => []);\n array.forEach((e, idx, arr) => {\n let i = 0;\n for (const filter of filters) {\n if (filter(e, idx, arr)) {\n result[i].push(e);\n return;\n }\n i += 1;\n }\n result[i].push(e);\n });\n return result;\n}\nfunction uniq(array) {\n return Array.from(new Set(array));\n}\nfunction uniqueBy(array, equalFn) {\n return array.reduce((acc, cur) => {\n const index = acc.findIndex((item) => equalFn(cur, item));\n if (index === -1)\n acc.push(cur);\n return acc;\n }, []);\n}\nfunction last(array) {\n return at(array, -1);\n}\nfunction remove(array, value) {\n if (!array)\n return false;\n const index = array.indexOf(value);\n if (index >= 0) {\n array.splice(index, 1);\n return true;\n }\n return false;\n}\nfunction at(array, index) {\n const len = array.length;\n if (!len)\n return void 0;\n if (index < 0)\n index += len;\n return array[index];\n}\nfunction range(...args) {\n let start, stop, step;\n if (args.length === 1) {\n start = 0;\n step = 1;\n [stop] = args;\n } else {\n [start, stop, step = 1] = args;\n }\n const arr = [];\n let current = start;\n while (current < stop) {\n arr.push(current);\n current += step || 1;\n }\n return arr;\n}\nfunction move(arr, from, to) {\n arr.splice(to, 0, arr.splice(from, 1)[0]);\n return arr;\n}\nfunction clampArrayRange(n, arr) {\n return clamp(n, 0, arr.length - 1);\n}\nfunction sample(arr, quantity) {\n return Array.from({ length: quantity }, (_) => arr[Math.round(Math.random() * (arr.length - 1))]);\n}\nfunction shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [array[i], array[j]] = [array[j], array[i]];\n }\n return array;\n}\nfunction filterInPlace(array, predicate) {\n for (let i = array.length; i--; i >= 0) {\n if (!predicate(array[i], i, array))\n array.splice(i, 1);\n }\n return array;\n}\n\nfunction assert(condition, message) {\n if (!condition)\n throw new Error(message);\n}\nconst toString = (v) => Object.prototype.toString.call(v);\nfunction getTypeName(v) {\n if (v === null)\n return \"null\";\n const type = toString(v).slice(8, -1).toLowerCase();\n return typeof v === \"object\" || typeof v === \"function\" ? type : typeof v;\n}\nfunction noop() {\n}\n\nfunction isDeepEqual(value1, value2) {\n const type1 = getTypeName(value1);\n const type2 = getTypeName(value2);\n if (type1 !== type2)\n return false;\n if (type1 === \"array\") {\n if (value1.length !== value2.length)\n return false;\n return value1.every((item, i) => {\n return isDeepEqual(item, value2[i]);\n });\n }\n if (type1 === \"object\") {\n const keyArr = Object.keys(value1);\n if (keyArr.length !== Object.keys(value2).length)\n return false;\n return keyArr.every((key) => {\n return isDeepEqual(value1[key], value2[key]);\n });\n }\n return Object.is(value1, value2);\n}\n\nfunction batchInvoke(functions) {\n functions.forEach((fn) => fn && fn());\n}\nfunction invoke(fn) {\n return fn();\n}\nfunction tap(value, callback) {\n callback(value);\n return value;\n}\n\nfunction notNullish(v) {\n return v != null;\n}\nfunction noNull(v) {\n return v !== null;\n}\nfunction notUndefined(v) {\n return v !== void 0;\n}\nfunction isTruthy(v) {\n return Boolean(v);\n}\n\nconst isDef = (val) => typeof val !== \"undefined\";\nconst isBoolean = (val) => typeof val === \"boolean\";\nconst isFunction = (val) => typeof val === \"function\";\nconst isNumber = (val) => typeof val === \"number\";\nconst isString = (val) => typeof val === \"string\";\nconst isObject = (val) => toString(val) === \"[object Object]\";\nconst isUndefined = (val) => toString(val) === \"[object Undefined]\";\nconst isNull = (val) => toString(val) === \"[object Null]\";\nconst isRegExp = (val) => toString(val) === \"[object RegExp]\";\nconst isDate = (val) => toString(val) === \"[object Date]\";\nfunction isPrimitive(val) {\n return !val || Object(val) !== val;\n}\nconst isWindow = (val) => typeof window !== \"undefined\" && toString(val) === \"[object Window]\";\nconst isBrowser = typeof window !== \"undefined\";\n\nfunction slash(str) {\n return str.replace(/\\\\/g, \"/\");\n}\nfunction ensurePrefix(prefix, str) {\n if (!str.startsWith(prefix))\n return prefix + str;\n return str;\n}\nfunction ensureSuffix(suffix, str) {\n if (!str.endsWith(suffix))\n return str + suffix;\n return str;\n}\nfunction template(str, ...args) {\n const [firstArg, fallback] = args;\n if (isObject(firstArg)) {\n const vars = firstArg;\n return str.replace(/\\{(\\w+)\\}/g, (_, key) => vars[key] || ((typeof fallback === \"function\" ? fallback(key) : fallback) ?? key));\n } else {\n return str.replace(/\\{(\\d+)\\}/g, (_, key) => {\n const index = Number(key);\n if (Number.isNaN(index))\n return key;\n return args[index];\n });\n }\n}\nconst urlAlphabet = \"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict\";\nfunction randomStr(size = 16, dict = urlAlphabet) {\n let id = \"\";\n let i = size;\n const len = dict.length;\n while (i--)\n id += dict[Math.random() * len | 0];\n return id;\n}\nfunction capitalize(str) {\n return str[0].toUpperCase() + str.slice(1).toLowerCase();\n}\nconst _reFullWs = /^\\s*$/;\nfunction unindent(str) {\n const lines = (typeof str === \"string\" ? str : str[0]).split(\"\\n\");\n const whitespaceLines = lines.map((line) => _reFullWs.test(line));\n const commonIndent = lines.reduce((min, line, idx) => {\n if (whitespaceLines[idx])\n return min;\n const indent = line.match(/^\\s*/)?.[0].length;\n return indent === void 0 ? min : Math.min(min, indent);\n }, Number.POSITIVE_INFINITY);\n let emptyLinesHead = 0;\n while (emptyLinesHead < lines.length && whitespaceLines[emptyLinesHead])\n emptyLinesHead++;\n let emptyLinesTail = 0;\n while (emptyLinesTail < lines.length && whitespaceLines[lines.length - emptyLinesTail - 1])\n emptyLinesTail++;\n return lines.slice(emptyLinesHead, lines.length - emptyLinesTail).map((line) => line.slice(commonIndent)).join(\"\\n\");\n}\n\nfunction objectMap(obj, fn) {\n return Object.fromEntries(\n Object.entries(obj).map(([k, v]) => fn(k, v)).filter(notNullish)\n );\n}\nfunction isKeyOf(obj, k) {\n return k in obj;\n}\nfunction objectKeys(obj) {\n return Object.keys(obj);\n}\nfunction objectEntries(obj) {\n return Object.entries(obj);\n}\nfunction deepMerge(target, ...sources) {\n if (!sources.length)\n return target;\n const source = sources.shift();\n if (source === void 0)\n return target;\n if (isMergableObject(target) && isMergableObject(source)) {\n objectKeys(source).forEach((key) => {\n if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\")\n return;\n if (isMergableObject(source[key])) {\n if (!target[key])\n target[key] = {};\n if (isMergableObject(target[key])) {\n deepMerge(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n } else {\n target[key] = source[key];\n }\n });\n }\n return deepMerge(target, ...sources);\n}\nfunction deepMergeWithArray(target, ...sources) {\n if (!sources.length)\n return target;\n const source = sources.shift();\n if (source === void 0)\n return target;\n if (Array.isArray(target) && Array.isArray(source))\n target.push(...source);\n if (isMergableObject(target) && isMergableObject(source)) {\n objectKeys(source).forEach((key) => {\n if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\")\n return;\n if (Array.isArray(source[key])) {\n if (!target[key])\n target[key] = [];\n deepMergeWithArray(target[key], source[key]);\n } else if (isMergableObject(source[key])) {\n if (!target[key])\n target[key] = {};\n deepMergeWithArray(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n });\n }\n return deepMergeWithArray(target, ...sources);\n}\nfunction isMergableObject(item) {\n return isObject(item) && !Array.isArray(item);\n}\nfunction objectPick(obj, keys, omitUndefined = false) {\n return keys.reduce((n, k) => {\n if (k in obj) {\n if (!omitUndefined || obj[k] !== void 0)\n n[k] = obj[k];\n }\n return n;\n }, {});\n}\nfunction clearUndefined(obj) {\n Object.keys(obj).forEach((key) => obj[key] === void 0 ? delete obj[key] : {});\n return obj;\n}\nfunction hasOwnProperty(obj, v) {\n if (obj == null)\n return false;\n return Object.prototype.hasOwnProperty.call(obj, v);\n}\nconst _objectIdMap = /* @__PURE__ */ new WeakMap();\nfunction objectId(obj) {\n if (isPrimitive(obj))\n return obj;\n if (!_objectIdMap.has(obj)) {\n _objectIdMap.set(obj, randomStr());\n }\n return _objectIdMap.get(obj);\n}\n\n/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nclass Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tpeek() {\n\t\tif (!this.#head) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.#head.value;\n\n\t\t// TODO: Node.js 18.\n\t\t// return this.#head?.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n}\n\nfunction pLimit(concurrency) {\n\tvalidateConcurrency(concurrency);\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst resumeNext = () => {\n\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\tqueue.dequeue()();\n\t\t\t// Since `pendingCount` has been decreased by one, increase `activeCount` by one.\n\t\t\tactiveCount++;\n\t\t}\n\t};\n\n\tconst next = () => {\n\t\tactiveCount--;\n\n\t\tresumeNext();\n\t};\n\n\tconst run = async (function_, resolve, arguments_) => {\n\t\tconst result = (async () => function_(...arguments_))();\n\n\t\tresolve(result);\n\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\tnext();\n\t};\n\n\tconst enqueue = (function_, resolve, arguments_) => {\n\t\t// Queue `internalResolve` instead of the `run` function\n\t\t// to preserve asynchronous context.\n\t\tnew Promise(internalResolve => {\n\t\t\tqueue.enqueue(internalResolve);\n\t\t}).then(\n\t\t\trun.bind(undefined, function_, resolve, arguments_),\n\t\t);\n\n\t\t(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// after the `internalResolve` function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve();\n\n\t\t\tif (activeCount < concurrency) {\n\t\t\t\tresumeNext();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst generator = (function_, ...arguments_) => new Promise(resolve => {\n\t\tenqueue(function_, resolve, arguments_);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue() {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t\tconcurrency: {\n\t\t\tget: () => concurrency,\n\n\t\t\tset(newConcurrency) {\n\t\t\t\tvalidateConcurrency(newConcurrency);\n\t\t\t\tconcurrency = newConcurrency;\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t// eslint-disable-next-line no-unmodified-loop-condition\n\t\t\t\t\twhile (activeCount < concurrency && queue.size > 0) {\n\t\t\t\t\t\tresumeNext();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n\nfunction validateConcurrency(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n}\n\nconst VOID = Symbol(\"p-void\");\nclass PInstance extends Promise {\n constructor(items = [], options) {\n super(() => {\n });\n this.items = items;\n this.options = options;\n }\n promises = /* @__PURE__ */ new Set();\n get promise() {\n let batch;\n const items = [...Array.from(this.items), ...Array.from(this.promises)];\n if (this.options?.concurrency) {\n const limit = pLimit(this.options.concurrency);\n batch = Promise.all(items.map((p2) => limit(() => p2)));\n } else {\n batch = Promise.all(items);\n }\n return batch.then((l) => l.filter((i) => i !== VOID));\n }\n add(...args) {\n args.forEach((i) => {\n this.promises.add(i);\n });\n }\n map(fn) {\n return new PInstance(\n Array.from(this.items).map(async (i, idx) => {\n const v = await i;\n if (v === VOID)\n return VOID;\n return fn(v, idx);\n }),\n this.options\n );\n }\n filter(fn) {\n return new PInstance(\n Array.from(this.items).map(async (i, idx) => {\n const v = await i;\n const r = await fn(v, idx);\n if (!r)\n return VOID;\n return v;\n }),\n this.options\n );\n }\n forEach(fn) {\n return this.map(fn).then();\n }\n reduce(fn, initialValue) {\n return this.promise.then((array) => array.reduce(fn, initialValue));\n }\n clear() {\n this.promises.clear();\n }\n then(fn) {\n const p2 = this.promise;\n if (fn)\n return p2.then(fn);\n else\n return p2;\n }\n catch(fn) {\n return this.promise.catch(fn);\n }\n finally(fn) {\n return this.promise.finally(fn);\n }\n}\nfunction p(items, options) {\n return new PInstance(items, options);\n}\n\nfunction createSingletonPromise(fn) {\n let _promise;\n function wrapper() {\n if (!_promise)\n _promise = fn();\n return _promise;\n }\n wrapper.reset = async () => {\n const _prev = _promise;\n _promise = void 0;\n if (_prev)\n await _prev;\n };\n return wrapper;\n}\nfunction sleep(ms, callback) {\n return new Promise(\n (resolve) => setTimeout(async () => {\n await callback?.();\n resolve();\n }, ms)\n );\n}\nfunction createPromiseLock() {\n const locks = [];\n return {\n async run(fn) {\n const p = fn();\n locks.push(p);\n try {\n return await p;\n } finally {\n remove(locks, p);\n }\n },\n async wait() {\n await Promise.allSettled(locks);\n },\n isWaiting() {\n return Boolean(locks.length);\n },\n clear() {\n locks.length = 0;\n }\n };\n}\nfunction createControlledPromise() {\n let resolve, reject;\n const promise = new Promise((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n promise.resolve = resolve;\n promise.reject = reject;\n return promise;\n}\n\nconst timestamp = () => +Date.now();\n\n/* eslint-disable no-undefined,no-param-reassign,no-shadow */\n\n/**\n * Throttle execution of a function. Especially useful for rate limiting\n * execution of handlers on events like resize and scroll.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)\n * are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,\n * as-is, to `callback` when the throttled-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds\n * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed\n * one final time after the last throttled-function call. (After the throttled-function has not been called for\n * `delay` milliseconds, the internal counter is reset).\n * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback\n * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that\n * callback will never executed if both noLeading = true and noTrailing = true.\n * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is\n * false (at end), schedule `callback` to execute after `delay` ms.\n *\n * @returns {Function} A new, throttled, function.\n */\nfunction throttle$1 (delay, callback, options) {\n var _ref = options || {},\n _ref$noTrailing = _ref.noTrailing,\n noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,\n _ref$noLeading = _ref.noLeading,\n noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,\n _ref$debounceMode = _ref.debounceMode,\n debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;\n /*\n * After wrapper has stopped being called, this timeout ensures that\n * `callback` is executed at the proper times in `throttle` and `end`\n * debounce modes.\n */\n\n\n var timeoutID;\n var cancelled = false; // Keep track of the last time `callback` was executed.\n\n var lastExec = 0; // Function to clear existing timeout\n\n function clearExistingTimeout() {\n if (timeoutID) {\n clearTimeout(timeoutID);\n }\n } // Function to cancel next exec\n\n\n function cancel(options) {\n var _ref2 = options || {},\n _ref2$upcomingOnly = _ref2.upcomingOnly,\n upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;\n\n clearExistingTimeout();\n cancelled = !upcomingOnly;\n }\n /*\n * The `wrapper` function encapsulates all of the throttling / debouncing\n * functionality and when executed will limit the rate at which `callback`\n * is executed.\n */\n\n\n function wrapper() {\n for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {\n arguments_[_key] = arguments[_key];\n }\n\n var self = this;\n var elapsed = Date.now() - lastExec;\n\n if (cancelled) {\n return;\n } // Execute `callback` and update the `lastExec` timestamp.\n\n\n function exec() {\n lastExec = Date.now();\n callback.apply(self, arguments_);\n }\n /*\n * If `debounceMode` is true (at begin) this is used to clear the flag\n * to allow future `callback` executions.\n */\n\n\n function clear() {\n timeoutID = undefined;\n }\n\n if (!noLeading && debounceMode && !timeoutID) {\n /*\n * Since `wrapper` is being called for the first time and\n * `debounceMode` is true (at begin), execute `callback`\n * and noLeading != true.\n */\n exec();\n }\n\n clearExistingTimeout();\n\n if (debounceMode === undefined && elapsed > delay) {\n if (noLeading) {\n /*\n * In throttle mode with noLeading, if `delay` time has\n * been exceeded, update `lastExec` and schedule `callback`\n * to execute after `delay` ms.\n */\n lastExec = Date.now();\n\n if (!noTrailing) {\n timeoutID = setTimeout(debounceMode ? clear : exec, delay);\n }\n } else {\n /*\n * In throttle mode without noLeading, if `delay` time has been exceeded, execute\n * `callback`.\n */\n exec();\n }\n } else if (noTrailing !== true) {\n /*\n * In trailing throttle mode, since `delay` time has not been\n * exceeded, schedule `callback` to execute `delay` ms after most\n * recent execution.\n *\n * If `debounceMode` is true (at begin), schedule `clear` to execute\n * after `delay` ms.\n *\n * If `debounceMode` is false (at end), schedule `callback` to\n * execute after `delay` ms.\n */\n timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);\n }\n }\n\n wrapper.cancel = cancel; // Return the wrapper function.\n\n return wrapper;\n}\n\n/* eslint-disable no-undefined */\n/**\n * Debounce execution of a function. Debouncing, unlike throttling,\n * guarantees that a function is only executed a single time, either at the\n * very beginning of a series of calls, or at the very end.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n * to `callback` when the debounced-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds\n * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.\n * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).\n *\n * @returns {Function} A new, debounced function.\n */\n\nfunction debounce$1 (delay, callback, options) {\n var _ref = options || {},\n _ref$atBegin = _ref.atBegin,\n atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin;\n\n return throttle$1(delay, callback, {\n debounceMode: atBegin !== false\n });\n}\n\nfunction throttle(...args) {\n return throttle$1(...args);\n}\nfunction debounce(...args) {\n return debounce$1(...args);\n}\n\nexport { assert, at, batchInvoke, capitalize, clamp, clampArrayRange, clearUndefined, createControlledPromise, createPromiseLock, createSingletonPromise, debounce, deepMerge, deepMergeWithArray, ensurePrefix, ensureSuffix, filterInPlace, flattenArrayable, getTypeName, hasOwnProperty, invoke, isBoolean, isBrowser, isDate, isDeepEqual, isDef, isFunction, isKeyOf, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isTruthy, isUndefined, isWindow, last, lerp, mergeArrayable, move, noNull, noop, notNullish, notUndefined, objectEntries, objectId, objectKeys, objectMap, objectPick, p, partition, randomStr, range, remap, remove, sample, shuffle, slash, sleep, sum, tap, template, throttle, timestamp, toArray, toString, unindent, uniq, uniqueBy };\n","import type { PageOptions, ResolvedOptions } from './types'\nimport { join } from 'node:path'\nimport { slash } from '@antfu/utils'\nimport { globSync } from 'tinyglobby'\n\nimport { extsToGlob } from './utils'\n\n/**\n * Resolves the page dirs for its for its given globs\n */\nexport function getPageDirs(PageOptions: PageOptions, root: string, exclude: string[]): PageOptions[] {\n const dirs = globSync(slash(PageOptions.dir), {\n ignore: exclude,\n onlyDirectories: true,\n dot: true,\n expandDirectories: false,\n cwd: root,\n })\n\n const pageDirs = dirs.map(dir => ({\n ...PageOptions,\n dir: dir.replace(/\\/$/, ''),\n }))\n\n return pageDirs\n}\n\n/**\n * Resolves the files that are valid pages for the given context.\n */\nexport function getPageFiles(path: string, options: ResolvedOptions, pageOptions?: PageOptions): string[] {\n const {\n exclude,\n extensions,\n } = options\n\n const ext = extsToGlob(extensions)\n const pattern = pageOptions?.filePattern ?? `**/*.${ext}`\n\n const files = globSync(pattern, {\n ignore: exclude,\n onlyFiles: true,\n cwd: path,\n }).map(p => slash(join(path, p)))\n\n return files\n}\n","import type { ModuleNode, ViteDevServer } from 'vite'\nimport type { ResolvedOptions } from './types'\nimport { resolve, win32 } from 'node:path'\nimport { URLSearchParams } from 'node:url'\nimport { slash } from '@antfu/utils'\nimport Debug from 'debug'\nimport micromatch from 'micromatch'\n\nimport { cacheAllRouteRE, countSlashRE, dynamicRouteRE, MODULE_ID_VIRTUAL, nuxtCacheAllRouteRE, nuxtDynamicRouteRE, replaceDynamicRouteRE, replaceIndexRE } from './constants'\n\nexport const debug = {\n hmr: Debug('vite-plugin-pages:hmr'),\n routeBlock: Debug('vite-plugin-pages:routeBlock'),\n options: Debug('vite-plugin-pages:options'),\n pages: Debug('vite-plugin-pages:pages'),\n search: Debug('vite-plugin-pages:search'),\n env: Debug('vite-plugin-pages:env'),\n cache: Debug('vite-plugin-pages:cache'),\n resolver: Debug('vite-plugin-pages:resolver'),\n}\n\nexport function extsToGlob(extensions: string[]) {\n return extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0] || ''\n}\n\nexport function countSlash(value: string) {\n return (value.match(countSlashRE) || []).length\n}\n\nfunction isPagesDir(path: string, options: ResolvedOptions) {\n for (const page of options.dirs) {\n const dirPath = slash(resolve(options.root, page.dir))\n if (path.startsWith(dirPath))\n return true\n }\n return false\n}\n\nexport function isTarget(path: string, options: ResolvedOptions) {\n return isPagesDir(path, options) && !micromatch.isMatch(path, options.exclude) && options.extensionsRE.test(path)\n}\n\nexport function isDynamicRoute(routePath: string, nuxtStyle = false) {\n return nuxtStyle\n ? nuxtDynamicRouteRE.test(routePath)\n : dynamicRouteRE.test(routePath)\n}\n\nexport function isCatchAllRoute(routePath: string, nuxtStyle = false) {\n return nuxtStyle\n ? nuxtCacheAllRouteRE.test(routePath)\n : cacheAllRouteRE.test(routePath)\n}\n\nexport function resolveImportMode(\n filepath: string,\n options: ResolvedOptions,\n) {\n const mode = options.importMode\n if (typeof mode === 'function')\n return mode(filepath, options)\n return mode\n}\n\nexport function invalidatePagesModule(server: ViteDevServer) {\n const { moduleGraph } = server\n const mods = moduleGraph.getModulesByFile(MODULE_ID_VIRTUAL)\n if (mods) {\n const seen = new Set<ModuleNode>()\n mods.forEach((mod) => {\n moduleGraph.invalidateModule(mod, seen)\n })\n }\n}\n\nexport function normalizeCase(str: string, caseSensitive: boolean) {\n if (!caseSensitive)\n return str.toLocaleLowerCase()\n return str\n}\n\nexport function normalizeName(name: string, isDynamic: boolean, nuxtStyle = false) {\n if (!isDynamic)\n return name\n\n return nuxtStyle\n ? name.replace(nuxtDynamicRouteRE, '$1') || 'all'\n : name.replace(replaceDynamicRouteRE, '$1')\n}\n\nexport function buildReactRoutePath(node: string, nuxtStyle = false): string | undefined {\n const isDynamic = isDynamicRoute(node, nuxtStyle)\n const isCatchAll = isCatchAllRoute(node, nuxtStyle)\n const normalizedName = normalizeName(node, isDynamic, nuxtStyle)\n\n if (isDynamic) {\n if (isCatchAll)\n return '*'\n\n return `:${normalizedName}`\n }\n\n return `${normalizedName}`\n}\n\n// https://github.dev/remix-run/remix/blob/264e3f8884c5cafd8d06acc3e01153b376745b7c/packages/remix-dev/config/routesConvention.ts#L105\nexport function buildReactRemixRoutePath(node: string): string | undefined {\n const escapeStart = '['\n const escapeEnd = ']'\n let result = ''\n let rawSegmentBuffer = ''\n\n let inEscapeSequence = 0\n let skipSegment = false\n for (let i = 0; i < node.length; i++) {\n const char = node.charAt(i)\n const lastChar = i > 0 ? node.charAt(i - 1) : undefined\n const nextChar = i < node.length - 1 ? node.charAt(i + 1) : undefined\n\n function isNewEscapeSequence() {\n return (\n !inEscapeSequence && char === escapeStart && lastChar !== escapeStart\n )\n }\n\n function isCloseEscapeSequence() {\n return inEscapeSequence && char === escapeEnd && nextChar !== escapeEnd\n }\n\n function isStartOfLayoutSegment() {\n return char === '_' && nextChar === '_' && !rawSegmentBuffer\n }\n\n if (skipSegment) {\n if (char === '/' || char === '.' || char === win32.sep)\n skipSegment = false\n\n continue\n }\n\n if (isNewEscapeSequence()) {\n inEscapeSequence++\n continue\n }\n\n if (isCloseEscapeSequence()) {\n inEscapeSequence--\n continue\n }\n\n if (inEscapeSequence) {\n result += char\n continue\n }\n\n if (char === '/' || char === win32.sep || char === '.') {\n if (rawSegmentBuffer === 'index' && result.endsWith('index'))\n result = result.replace(replaceIndexRE, '')\n else result += '/'\n\n rawSegmentBuffer = ''\n continue\n }\n\n if (isStartOfLayoutSegment()) {\n skipSegment = true\n continue\n }\n\n rawSegmentBuffer += char\n\n if (char === '$') {\n result += typeof nextChar === 'undefined' ? '*' : ':'\n continue\n }\n\n result += char\n }\n\n if (rawSegmentBuffer === 'index' && result.endsWith('index'))\n result = result.replace(replaceIndexRE, '')\n\n return result || undefined\n}\n\nexport function parsePageRequest(id: string) {\n const [moduleId, rawQuery] = id.split('?', 2)\n const query = new URLSearchParams(rawQuery)\n const pageId = query.get('id')\n return {\n moduleId,\n query,\n pageId,\n }\n}\n","import type { ImportModeResolver, ResolvedOptions, UserOptions } from './types'\nimport { resolve } from 'node:path'\nimport process from 'node:process'\nimport { slash, toArray } from '@antfu/utils'\n\nimport { MODULE_IDS } from './constants'\nimport { getPageDirs } from './files'\nimport { reactResolver, solidResolver, vueResolver } from './resolvers'\n\nfunction resolvePageDirs(dirs: UserOptions['dirs'], root: string, exclude: string[]) {\n dirs = toArray(dirs)\n return dirs.flatMap((dir) => {\n const option = typeof dir === 'string'\n ? { dir, baseRoute: '' }\n : dir\n\n option.dir = slash(resolve(root, option.dir)).replace(`${root}/`, '')\n option.baseRoute = option.baseRoute.replace(/^\\//, '').replace(/\\/$/, '')\n\n return getPageDirs(option, root, exclude)\n })\n}\n\nexport const syncIndexResolver: ImportModeResolver = (filepath, options) => {\n for (const page of options.dirs) {\n if (page.baseRoute === '' && filepath.startsWith(`/${page.dir}/index`))\n return 'sync'\n }\n return 'async'\n}\n\nfunction getResolver(originalResolver: UserOptions['resolver']) {\n let resolver = originalResolver || 'vue'\n\n if (typeof resolver !== 'string')\n return resolver\n\n switch (resolver) {\n case 'vue':\n resolver = vueResolver()\n break\n case 'react':\n resolver = reactResolver()\n break\n case 'solid':\n resolver = solidResolver()\n break\n default:\n throw new Error(`Unsupported resolver: ${resolver}`)\n }\n return resolver\n}\n\nexport function resolveOptions(userOptions: UserOptions, viteRoot?: string): ResolvedOptions {\n const {\n dirs = ['src/pages'],\n routeBlockLang = 'json5',\n exclude = ['node_modules', '.git', '**/__*__/**'],\n caseSensitive = false,\n routeNameSeparator = '-',\n extendRoute,\n onRoutesGenerated,\n onClientGenerated,\n } = userOptions\n\n const root = viteRoot || slash(process.cwd())\n\n const importMode = userOptions.importMode || syncIndexResolver\n\n const importPath = userOptions.importPath || 'relative'\n\n const resolver = getResolver(userOptions.resolver)\n\n const extensions = userOptions.extensions || resolver.resolveExtensions()\n\n const extensionsRE = new RegExp(`\\\\.(${extensions.join('|')})$`)\n\n const resolvedDirs = resolvePageDirs(dirs, root, exclude)\n\n const routeStyle = userOptions.routeStyle || 'next'\n\n const moduleIds = userOptions.moduleId\n ? [userOptions.moduleId]\n : resolver.resolveModuleIds?.() || MODULE_IDS\n\n const resolvedOptions: ResolvedOptions = {\n dirs: resolvedDirs,\n routeStyle,\n routeBlockLang,\n moduleIds,\n root,\n extensions,\n importMode,\n importPath,\n exclude,\n caseSensitive,\n resolver,\n extensionsRE,\n extendRoute,\n onRoutesGenerated,\n onClientGenerated,\n routeNameSeparator,\n }\n\n return resolvedOptions\n}\n","import type { ResolvedOptions } from './types'\nimport { ROUTE_IMPORT_NAME } from './constants'\n\nimport { resolveImportMode } from './utils'\n\nconst componentRE = /\"(?:component|element)\":(\"(.*?)\")/g\nconst hasFunctionRE = /\"(?:props|beforeEnter)\":(\"(.*?)\")/g\n\nconst multilineCommentsRE = /\\/\\*(.|[\\r\\n])*?\\*\\//g\nconst singlelineCommentsRE = /\\/\\/.*/g\n\nfunction replaceFunction(_: any, value: any) {\n if (typeof value === 'function' || typeof value === 'function') {\n const fnBody = value.toString()\n .replace(multilineCommentsRE, '')\n .replace(singlelineCommentsRE, '')\n .replace(/(\\s)/g, '')\n\n // ES6 Arrow Function\n if (fnBody.length < 8 || fnBody.substring(0, 8) !== 'function')\n return `_NuFrRa_${fnBody}`\n\n return fnBody\n }\n\n return value\n}\n\n/**\n * Creates a stringified Vue Router route definition.\n */\nexport function stringifyRoutes(\n preparedRoutes: any[],\n options: ResolvedOptions,\n) {\n const importsMap: Map<string, string> = new Map()\n\n function getImportString(path: string, importName: string) {\n const mode = resolveImportMode(path, options)\n return mode === 'sync'\n ? `import ${importName} from \"${path}\"`\n : `const ${importName} = ${\n options.resolver.stringify?.dynamicImport?.(path) || `() => import(\"${path}\")`\n }`\n }\n\n function componentReplacer(str: string, replaceStr: string, path: string) {\n let importName = importsMap.get(path)\n\n if (!importName)\n importName = ROUTE_IMPORT_NAME.replace('$1', `${importsMap.size}`)\n\n importsMap.set(path, importName)\n\n importName = options.resolver.stringify?.component?.(importName) || importName\n\n return str.replace(replaceStr, importName)\n }\n\n function functionReplacer(str: string, replaceStr: string, content: string) {\n if (content.startsWith('function'))\n return str.replace(replaceStr, content)\n\n if (content.startsWith('_NuFrRa_'))\n return str.replace(replaceStr, content.slice(8))\n\n return str\n }\n\n const stringRoutes = JSON\n .stringify(preparedRoutes, replaceFunction)\n .replace(componentRE, componentReplacer)\n .replace(hasFunctionRE, functionReplacer)\n\n const imports = Array.from(importsMap).map(args => getImportString(...args))\n\n return {\n imports,\n stringRoutes,\n }\n}\n\nexport function generateClientCode(routes: any[], options: ResolvedOptions) {\n const { imports, stringRoutes } = stringifyRoutes(routes, options)\n const code = `${imports.join(';\\n')};\\n\\nconst routes = ${stringRoutes};\\n\\nexport default routes;`\n return options.resolver.stringify?.final?.(code) || code\n}\n","import type { PageContext } from '../context'\nimport type { Optional, PageResolver, ResolvedOptions } from '../types'\n\nimport { generateClientCode } from '../stringify'\nimport {\n buildReactRemixRoutePath,\n buildReactRoutePath,\n countSlash,\n normalizeCase,\n} from '../utils'\n\nexport interface ReactRouteBase {\n caseSensitive?: boolean\n children?: ReactRouteBase[]\n element?: string\n index?: boolean\n path?: string\n rawRoute: string\n}\n\nexport interface ReactRoute extends Omit<Optional<ReactRouteBase, 'rawRoute' | 'path'>, 'children'> {\n children?: ReactRoute[]\n}\n\nfunction prepareRoutes(\n routes: ReactRoute[],\n options: ResolvedOptions,\n parent?: ReactRoute,\n) {\n for (const route of routes) {\n if (parent)\n route.path = route.path?.replace(/^\\//, '')\n\n if (route.children)\n route.children = prepareRoutes(route.children, options, route)\n\n delete route.rawRoute\n\n Object.assign(route, options.extendRoute?.(route, parent) || {})\n }\n\n return routes\n}\n\nasync function computeReactRoutes(ctx: PageContext): Promise<ReactRoute[]> {\n const { routeStyle, caseSensitive, importPath } = ctx.options\n const nuxtStyle = routeStyle === 'nuxt'\n\n const pageRoutes = [...ctx.pageRouteMap.values()]\n // sort routes for HMR\n .sort((a, b) => countSlash(a.route) - countSlash(b.route))\n\n const routes: ReactRouteBase[] = []\n\n pageRoutes.forEach((page) => {\n const pathNodes = page.route.split('/')\n const element = importPath === 'relative' ? page.path.replace(ctx.root, '') : page.path\n let parentRoutes = routes\n\n for (let i = 0; i < pathNodes.length; i++) {\n const node = pathNodes[i]\n\n const route: ReactRouteBase = {\n caseSensitive,\n path: '',\n rawRoute: pathNodes.slice(0, i + 1).join('/'),\n }\n\n if (i === pathNodes.length - 1)\n route.element = element\n\n const isIndexRoute = normalizeCase(node, caseSensitive).endsWith('index')\n\n if (!route.path && isIndexRoute) {\n route.path = '/'\n }\n else if (!isIndexRoute) {\n if (routeStyle === 'remix')\n route.path = buildReactRemixRoutePath(node)\n else\n route.path = buildReactRoutePath(node, nuxtStyle)\n }\n\n // Check parent exits\n const parent = parentRoutes.find((parent) => {\n return pathNodes.slice(0, i).join('/') === parent.rawRoute\n })\n\n if (parent) {\n // Make sure children exits in parent\n parent.children = parent.children || []\n // Append to parent's children\n parentRoutes = parent.children\n }\n\n const exits = parentRoutes.some((parent) => {\n return pathNodes.slice(0, i + 1).join('/') === parent.rawRoute\n })\n if (!exits)\n parentRoutes.push(route)\n }\n })\n\n // sort by dynamic routes\n let finalRoutes = prepareRoutes(routes, ctx.options)\n\n finalRoutes = (await ctx.options.onRoutesGenerated?.(finalRoutes)) || finalRoutes\n\n return finalRoutes\n}\n\nasync function resolveReactRoutes(ctx: PageContext) {\n const finalRoutes = await computeReactRoutes(ctx)\n let client = generateClientCode(finalRoutes, ctx.options)\n client = (await ctx.options.onClientGenerated?.(client)) || client\n return client\n}\n\nexport function reactResolver(): PageResolver {\n return {\n resolveModuleIds() {\n return ['~react-pages', 'virtual:generated-pages-react']\n },\n resolveExtensions() {\n return ['tsx', 'jsx', 'ts', 'js']\n },\n async resolveRoutes(ctx) {\n return resolveReactRoutes(ctx)\n },\n async getComputedRoutes(ctx) {\n return computeReactRoutes(ctx)\n },\n stringify: {\n component: path => `React.createElement(${path})`,\n dynamicImport: path => `React.lazy(() => import(\"${path}\"))`,\n final: code => `import React from \"react\";\\n${code}`,\n },\n }\n}\n","import type { PageContext } from '../context'\nimport type { Optional, PageResolver, ResolvedOptions } from '../types'\n\nimport { generateClientCode } from '../stringify'\nimport {\n buildReactRemixRoutePath,\n buildReactRoutePath,\n countSlash,\n normalizeCase,\n} from '../utils'\n\nexport interface SolidRouteBase {\n rawRoute: string\n path: string\n children?: SolidRouteBase[]\n component?: string\n element?: string\n}\n\nexport interface SolidRoute extends Omit<Optional<SolidRouteBase, 'rawRoute' | 'path'>, 'children'> {\n children?: SolidRoute[]\n}\n\nfunction prepareRoutes(\n options: ResolvedOptions,\n routes: SolidRoute[],\n parent?: SolidRoute,\n) {\n for (const route of routes) {\n if (parent)\n route.path = route.path?.replace(/^\\//, '')\n\n if (route.children)\n route.children = prepareRoutes(options, route.children, route)\n\n delete route.rawRoute\n\n Object.assign(route, options.extendRoute?.(route, parent) || {})\n }\n\n return routes\n}\n\nasync function computeSolidRoutes(ctx: PageContext): Promise<SolidRoute[]> {\n const { routeStyle, caseSensitive, importPath } = ctx.options\n const nuxtStyle = routeStyle === 'nuxt'\n\n const pageRoutes = [...ctx.pageRouteMap.values()]\n // sort routes for HMR\n .sort((a, b) => countSlash(a.route) - countSlash(b.route))\n\n const routes: SolidRouteBase[] = []\n\n pageRoutes.forEach((page) => {\n const pathNodes = page.route.split('/')\n\n const component = importPath === 'relative' ? page.path.replace(ctx.root, '') : page.path\n const element = importPath === 'relative' ? page.path.replace(ctx.root, '') : page.path\n\n let parentRoutes = routes\n\n for (let i = 0; i < pathNodes.length; i++) {\n const node = pathNodes[i]\n const normalizedPath = normalizeCase(node, caseSensitive)\n\n const route: SolidRouteBase = {\n path: '',\n rawRoute: pathNodes.slice(0, i + 1).join('/'),\n }\n\n // Check parent exists\n const parent = parentRoutes.find(parent =>\n pathNodes.slice(0, i).join('/') === parent.rawRoute,\n )\n\n if (parent) {\n // Make sure children exist in parent\n parent.children = parent.children || []\n // Append to parent's children\n parentRoutes = parent.children\n }\n\n if (i === pathNodes.length - 1) {\n route.element = element\n route.component = component\n }\n\n if (normalizedPath === 'index') {\n if (!route.path)\n route.path = '/'\n }\n else if (normalizedPath !== 'index') {\n if (routeStyle === 'remix')\n route.path = buildReactRemixRoutePath(node) || ''\n else\n route.path = buildReactRoutePath(node, nuxtStyle) || ''\n }\n\n const exist = parentRoutes.some((parent) => {\n return pathNodes.slice(0, i + 1).join('/') === parent.rawRoute\n })\n if (!exist)\n parentRoutes.push(route)\n }\n })\n\n // sort by dynamic routes\n let finalRoutes = prepareRoutes(ctx.options, routes)\n\n finalRoutes = (await ctx.options.onRoutesGenerated?.(finalRoutes)) || finalRoutes\n\n return finalRoutes\n}\n\nasync function resolveSolidRoutes(ctx: PageContext) {\n const finalRoutes = await computeSolidRoutes(ctx)\n let client = generateClientCode(finalRoutes, ctx.options)\n client = (await ctx.options.onClientGenerated?.(client)) || client\n return client\n}\n\nexport function solidResolver(): PageResolver {\n return {\n resolveModuleIds() {\n return ['~solid-pages']\n },\n resolveExtensions() {\n return ['tsx', 'jsx', 'ts', 'js']\n },\n async resolveRoutes(ctx) {\n return resolveSolidRoutes(ctx)\n },\n async getComputedRoutes(ctx) {\n return computeSolidRoutes(ctx)\n },\n stringify: {\n dynamicImport: path => `Solid.lazy(() => import(\"${path}\"))`,\n final: code => `import * as Solid from \"solid-js\";\\n${code}`,\n },\n }\n}\n","import type { PageContext } from '../context'\nimport type { CustomBlock, Optional, PageResolver } from '../types'\nimport { dequal } from 'dequal'\nimport colors from 'picocolors'\n\nimport { getRouteBlock } from '../customBlock'\nimport { generateClientCode } from '../stringify'\nimport {\n countSlash,\n isCatchAllRoute,\n isDynamicRoute,\n normalizeCase,\n normalizeName,\n} from '../utils'\n\nexport interface VueRouteBase {\n name: string\n path: string\n props?: boolean\n component: string\n children?: VueRouteBase[]\n customBlock?: CustomBlock\n rawRoute: string\n}\n\nexport interface VueRoute extends Omit<Optional<VueRouteBase, 'rawRoute' | 'name'>, 'children'> {\n children?: VueRoute[]\n}\n\nfunction prepareRoutes(\n ctx: PageContext,\n routes: VueRoute[],\n parent?: VueRoute,\n) {\n for (const route of routes) {\n if (route.name)\n route.name = route.name.replace(new RegExp(`${ctx.options.routeNameSeparator}index$`), '')\n\n if (parent)\n route.path = route.path?.replace(/^\\//, '')\n\n if (route.children)\n route.children = prepareRoutes(ctx, route.children, route)\n\n if (route.children?.find(c => c.name === route.name))\n delete route.name\n\n route.props = true\n\n delete route.rawRoute\n\n if (route.customBlock) {\n Object.assign(route, route.customBlock || {})\n delete route.customBlock\n }\n\n Object.assign(route, ctx.options.extendRoute?.(route, parent) || {})\n }\n\n return routes\n}\n\nasync function computeVueRoutes(ctx: PageContext, customBlockMap: Map<string, CustomBlock>): Promise<VueRoute[]> {\n const { routeStyle, caseSensitive, importPath, routeNameSeparator } = ctx.options\n\n const pageRoutes = [...ctx.pageRouteMap.values()]\n // sort routes for HMR\n .sort((a, b) => countSlash(a.route) - countSlash(b.route))\n\n const routes: VueRouteBase[] = []\n\n pageRoutes.forEach((page) => {\n const pathNodes = page.route.split('/')\n\n // add leading slash to component path if not already there\n const component = importPath === 'relative' ? page.path.replace(ctx.root, '') : page.path\n const customBlock = customBlockMap.get(page.path)\n\n const route: VueRouteBase = {\n name: '',\n path: '',\n component,\n customBlock,\n rawRoute: page.route,\n }\n\n let parentRoutes = routes\n let dynamicRoute = false\n\n for (let i = 0; i < pathNodes.length; i++) {\n const node = pathNodes[i]\n const nuxtStyle = routeStyle === 'nuxt'\n const isDynamic = isDynamicRoute(node, nuxtStyle)\n const isCatchAll = isCatchAllRoute(node, nuxtStyle)\n const normalizedName = normalizeName(node, isDynamic, nuxtStyle)\n const normalizedPath = normalizeCase(normalizedName, caseSensitive)\n\n if (isDynamic)\n dynamicRoute = true\n\n route.name += route.name ? `${routeNameSeparator}${normalizedName}` : normalizedName\n\n // Check parent exits\n const parent = parentRoutes.find((parent) => {\n return pathNodes.slice(0, i + 1).join('/') === parent.rawRoute\n })\n\n if (parent) {\n // Make sure children exist in parent\n parent.children = parent.children || []\n // Append to parent's children\n parentRoutes = parent.children\n // Reset path\n route.path = ''\n }\n else if (normalizedPath === 'index') {\n if (!route.path)\n route.path = '/'\n }\n else if (normalizedPath !== 'index') {\n if (isDynamic) {\n route.path += `/:${normalizedName}`\n // Catch-all route\n if (isCatchAll) {\n if (i === 0)\n // root cache all route include children\n route.path += '(.*)*'\n else\n // nested cache all route not include children\n route.path += '(.*)'\n }\n else if (nuxtStyle && i === pathNodes.length - 1) {\n // we need to search if the folder provide `index.vue`\n const isIndexFound = pageRoutes.find(({ route }) => {\n return route === page.route.replace(pathNodes[i], 'index')\n })\n if (!isIndexFound)\n route.path += '?'\n }\n }\n else {\n route.path += `/${normalizedPath}`\n }\n }\n }\n\n // put dynamic routes at the end\n if (dynamicRoute)\n parentRoutes.push(route)\n else\n parentRoutes.unshift(route)\n })\n\n let finalRoutes = prepareRoutes(ctx, routes)\n\n finalRoutes = (await ctx.options.onRoutesGenerated?.(finalRoutes)) || finalRoutes\n\n return finalRoutes\n}\n\nasync function resolveVueRoutes(ctx: PageContext, customBlockMap: Map<string, CustomBlock>) {\n const finalRoutes = await computeVueRoutes(ctx, customBlockMap)\n\n let client = generateClientCode(finalRoutes, ctx.options)\n client = (await ctx.options.onClientGenerated?.(client)) || client\n return client\n}\n\nexport function vueResolver(): PageResolver {\n const customBlockMap = new Map<string, CustomBlock>()\n\n async function checkCustomBlockChange(ctx: PageContext, path: string) {\n const exitsCustomBlock = customBlockMap.get(path)\n let customBlock: CustomBlock | undefined\n try {\n customBlock = await getRouteBlock(path, ctx.options)\n }\n catch (error: any) {\n ctx.logger?.error(colors.red(`[vite-plugin-pages] ${error.message}`))\n return\n }\n if (!exitsCustomBlock && !customBlock)\n return\n\n if (!customBlock) {\n customBlockMap.delete(path)\n ctx.debug.routeBlock('%s deleted', path)\n return\n }\n if (!exitsCustomBlock || !dequal(exitsCustomBlock, customBlock)) {\n ctx.debug.routeBlock('%s old: %O', path, exitsCustomBlock)\n ctx.debug.routeBlock('%s new: %O', path, customBlock)\n customBlockMap.set(path, customBlock)\n ctx.onUpdate()\n }\n }\n\n return {\n resolveExtensions() {\n return ['vue', 'ts', 'js']\n },\n resolveModuleIds() {\n return ['~pages', 'pages-generated', 'virtual:generated-pages']\n },\n async resolveRoutes(ctx) {\n return resolveVueRoutes(ctx, customBlockMap)\n },\n async getComputedRoutes(ctx) {\n return computeVueRoutes(ctx, customBlockMap)\n },\n hmr: {\n added: async (ctx, path) => checkCustomBlockChange(ctx, path),\n changed: async (ctx, path) => checkCustomBlockChange(ctx, path),\n removed: async (_ctx, path) => {\n customBlockMap.delete(path)\n },\n },\n }\n}\n","import type { SFCBlock, SFCDescriptor } from '@vue/compiler-sfc'\nimport type { CustomBlock, ParsedJSX, ResolvedOptions } from './types'\nimport fs from 'node:fs'\n\n// @ts-expect-error no type\nimport extractComments from 'extract-comments'\n\nimport JSON5 from 'json5'\nimport { importModule } from 'local-pkg'\nimport { parse as YAMLParser } from 'yaml'\nimport { debug } from './utils'\n\nconst routeJSXReg = /^\\s+(route)\\s+/gm\n\nexport function parseJSX(code: string): ParsedJSX[] {\n return extractComments(code).slice(0, 1).filter((comment: ParsedJSX) => routeJSXReg.test(comment.value) && comment.value.includes(':') && comment.loc.start.line === 1)\n}\n\nexport function parseYamlComment(code: ParsedJSX[], path: string): CustomBlock {\n return code.reduce((memo, item) => {\n const { value } = item\n const v = value.replace(routeJSXReg, '')\n debug.routeBlock(`use ${v} parser`)\n try {\n const yamlResult = YAMLParser(v)\n\n return {\n ...memo,\n ...yamlResult,\n }\n }\n catch (err: any) {\n throw new Error(`Invalid YAML format of comment in ${path}\\n${err.message}`)\n }\n }, {})\n}\n\nexport async function parseSFC(code: string): Promise<SFCDescriptor> {\n try {\n const { parse } = await importModule('@vue/compiler-sfc') as typeof import('@vue/compiler-sfc')\n return parse(code, {\n pad: 'space',\n }).descriptor\n // for @vue/compiler-sfc ^2.7\n || (parse as any)({\n source: code,\n })\n }\n catch {\n throw new Error('[vite-plugin-pages] Vue3\\'s \"@vue/compiler-sfc\" is required.')\n }\n}\n\nexport function parseCustomBlock(block: SFCBlock, filePath: string, options: ResolvedOptions): any {\n const lang = block.lang ?? options.routeBlockLang\n\n debug.routeBlock(`use ${lang} parser`)\n\n if (lang === 'json5') {\n try {\n return JSON5.parse(block.content)\n }\n catch (err: any) {\n throw new Error(`Invalid JSON5 format of <${block.type}> content in ${filePath}\\n${err.message}`)\n }\n }\n else if (lang === 'json') {\n try {\n return JSON.parse(block.content)\n }\n catch (err: any) {\n throw new Error(`Invalid JSON format of <${block.type}> content in ${filePath}\\n${err.message}`)\n }\n }\n else if (lang === 'yaml' || lang === 'yml') {\n try {\n return YAMLParser(block.content)\n }\n catch (err: any) {\n throw new Error(`Invalid YAML format of <${block.type}> content in ${filePath}\\n${err.message}`)\n }\n }\n}\n\nexport async function getRouteBlock(path: string, options: ResolvedOptions) {\n const content = fs.readFileSync(path, 'utf8')\n\n const parsedSFC = await parseSFC(content)\n const blockStr = parsedSFC?.customBlocks.find(b => b.type === 'route')\n\n const parsedJSX = parseJSX(content)\n\n if (!blockStr && parsedJSX.length === 0)\n return\n\n let result\n\n if (blockStr)\n result = parseCustomBlock(blockStr, path, options) as CustomBlock\n\n if (parsedJSX.length > 0)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B,QAAQ;AACtB,UAAI,gBAAgB,MAAM;AAAA,IAC5B;AAAA,IACA,UAAU,IAAI;AACZ,UAAI,IAAI,QAAQ,UAAU,SAAS,EAAE;AACnC,eAAO,GAAG,iBAAiB,OAAO,EAAE;AAEtC,UAAI,kBAAkB,KAAK,EAAE;AAC3B,eAAO;AAET,aAAO;AAAA,IACT;AAAA,IACA,MAAM,KAAK,IAAI;AACb,YAAM;AAAA,QACJ;AAAA,QACA;AAAA,MACF,IAAI,iBAAiB,EAAE;AAEvB,UAAI,aAAa,qBAAqB,UAAU,IAAI,QAAQ,UAAU,SAAS,MAAM;AACnF,eAAO,IAAI,cAAc;AAE3B,UAAI,OAAO,wBAAwB;AACjC,eAAO;AAAA,UACL,MAAM;AAAA,UACN,KAAK;AAAA,QACP;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAgBA,IAAO,gBAAQ;","names":["import_node_path","import_node_process","import_node_path","Debug","micromatch","isNewEscapeSequence","isCloseEscapeSequence","isStartOfLayoutSegment","import_node_path","parent","prepareRoutes","parent","extractComments","YAMLParser","JSON5","fs","prepareRoutes","parent","route","colors","process","process"]}