diff --git a/.changeset/tall-hoops-invent.md b/.changeset/tall-hoops-invent.md new file mode 100644 index 00000000..b989e10e --- /dev/null +++ b/.changeset/tall-hoops-invent.md @@ -0,0 +1,6 @@ +--- +"@solidjs/file-routes": minor +"@solidjs/router": minor +--- + +Move file-system routing from SolidStart into router-neutral packages: `@solidjs/file-routes` scans a route directory into a neutral route manifest with pluggable conventions, `@solidjs/file-routes/vite` delivers it as the `solid:file-routes` virtual module with HMR and per-export code splitting, and `@solidjs/router/fs` ships Solid Router's emission adapter — `createFileRoutes` and ``. diff --git a/.github/workflows/dist-typecheck.yml b/.github/workflows/dist-typecheck.yml index 192446ff..606dbc94 100644 --- a/.github/workflows/dist-typecheck.yml +++ b/.github/workflows/dist-typecheck.yml @@ -28,8 +28,8 @@ jobs: - name: Install dependencies run: pnpm install - - name: Build package and dependencies + - name: Build packages run: pnpm build - - name: Check types - run: pnpx @arethetypeswrong/cli --pack . --profile esm-only + - name: Check package types + run: pnpm typecheck:dist diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b294f84c..aba818ea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,4 +30,4 @@ jobs: run: pnpm i --frozen-lockfile - name: Run tests - run: pnpm run test + run: pnpm test diff --git a/examples/file-routes/README.md b/examples/file-routes/README.md new file mode 100644 index 00000000..70d498ee --- /dev/null +++ b/examples/file-routes/README.md @@ -0,0 +1,34 @@ +# File routes example + +A plain Vite + Solid Router SPA using file-system routing — no SolidStart. + +- `@solidjs/file-routes/vite` scans `src/routes` and serves the route manifest + from the `solid:file-routes` virtual module (see [vite.config.ts](vite.config.ts)) +- `` from `@solidjs/router/fs` renders it as lazy, code-split + route definitions (see [src/entry.tsx](src/entry.tsx)) + +``` +src/routes/ +├── index.tsx → / +├── about.tsx → /about +├── blog.tsx → layout for /blog/* +├── blog/ +│ ├── index.tsx → /blog +│ └── [id].tsx → /blog/:id (route config with preload) +└── [...404].tsx → catch-all +``` + +`blog/[id].tsx` also shows the code-splitting seam: its `route` export +(`preload`) is picked into the main bundle so data loading starts during +navigation, while the component stays in its own lazy chunk. + +## Run it + +From the repository root: + +```sh +pnpm install +pnpm build # builds @solidjs/router and @solidjs/file-routes first +cd examples/file-routes +pnpm dev +``` diff --git a/examples/file-routes/index.html b/examples/file-routes/index.html new file mode 100644 index 00000000..2d52ba07 --- /dev/null +++ b/examples/file-routes/index.html @@ -0,0 +1,12 @@ + + + + + + Solid Router · File Routes + + +
+ + + diff --git a/examples/file-routes/package.json b/examples/file-routes/package.json new file mode 100644 index 00000000..1eb59453 --- /dev/null +++ b/examples/file-routes/package.json @@ -0,0 +1,21 @@ +{ + "name": "example-file-routes", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "dependencies": { + "@solidjs/file-routes": "workspace:*", + "@solidjs/router": "workspace:*", + "solid-js": "^1.9.3" + }, + "devDependencies": { + "typescript": "^5.7.2", + "vite": "^6.0.0", + "vite-plugin-solid": "^2.11.0" + } +} diff --git a/examples/file-routes/src/entry.tsx b/examples/file-routes/src/entry.tsx new file mode 100644 index 00000000..22a11f79 --- /dev/null +++ b/examples/file-routes/src/entry.tsx @@ -0,0 +1,25 @@ +/* @refresh reload */ +import { A, Router } from "@solidjs/router"; +import { FileRoutes } from "@solidjs/router/fs"; +import { Suspense, type ParentProps } from "solid-js"; +import { render } from "solid-js/web"; + +function Layout(props: ParentProps) { + return ( + <> + + {props.children} + + ); +} + +render( + () => ( + + + + ), + document.getElementById("app")! +); diff --git a/examples/file-routes/src/routes/[...404].tsx b/examples/file-routes/src/routes/[...404].tsx new file mode 100644 index 00000000..c1dbe755 --- /dev/null +++ b/examples/file-routes/src/routes/[...404].tsx @@ -0,0 +1,3 @@ +export default function NotFound() { + return

Page not found

; +} diff --git a/examples/file-routes/src/routes/about.tsx b/examples/file-routes/src/routes/about.tsx new file mode 100644 index 00000000..9f07bfaa --- /dev/null +++ b/examples/file-routes/src/routes/about.tsx @@ -0,0 +1,3 @@ +export default function About() { + return

About

; +} diff --git a/examples/file-routes/src/routes/blog.tsx b/examples/file-routes/src/routes/blog.tsx new file mode 100644 index 00000000..1fd24adb --- /dev/null +++ b/examples/file-routes/src/routes/blog.tsx @@ -0,0 +1,11 @@ +import type { ParentProps } from "solid-js"; + +// `blog.tsx` is the layout for everything under `blog/`. +export default function BlogLayout(props: ParentProps) { + return ( +
+

Blog

+ {props.children} +
+ ); +} diff --git a/examples/file-routes/src/routes/blog/[id].tsx b/examples/file-routes/src/routes/blog/[id].tsx new file mode 100644 index 00000000..522634a7 --- /dev/null +++ b/examples/file-routes/src/routes/blog/[id].tsx @@ -0,0 +1,29 @@ +import { + createAsync, + query, + useParams, + type RouteDefinition +} from "@solidjs/router"; + +const getPost = query(async (id: string) => { + // stands in for a real fetch + await new Promise(resolve => setTimeout(resolve, 100)); + return { title: `Post #${id}`, body: `This is post number ${id}.` }; +}, "post"); + +// The `route` export is picked into the main bundle and starts the fetch +// during navigation, before this component's code-split chunk loads. +export const route = { + preload: ({ params }) => getPost(params.id!) +} satisfies RouteDefinition<"/blog/:id">; + +export default function Post() { + const params = useParams<{ id: string }>(); + const post = createAsync(() => getPost(params.id)); + return ( +
+

{post()?.title}

+

{post()?.body}

+
+ ); +} diff --git a/examples/file-routes/src/routes/blog/index.tsx b/examples/file-routes/src/routes/blog/index.tsx new file mode 100644 index 00000000..28305d92 --- /dev/null +++ b/examples/file-routes/src/routes/blog/index.tsx @@ -0,0 +1,16 @@ +import { A } from "@solidjs/router"; +import { For } from "solid-js"; + +export default function BlogIndex() { + return ( + + ); +} diff --git a/examples/file-routes/src/routes/index.tsx b/examples/file-routes/src/routes/index.tsx new file mode 100644 index 00000000..79f5c47f --- /dev/null +++ b/examples/file-routes/src/routes/index.tsx @@ -0,0 +1,11 @@ +export default function Home() { + return ( + <> +

Home

+

+ Routes in src/routes are scanned by @solidjs/file-routes/vite and + rendered by <FileRoutes /> from @solidjs/router/fs. +

+ + ); +} diff --git a/examples/file-routes/tsconfig.json b/examples/file-routes/tsconfig.json new file mode 100644 index 00000000..5fe63a7f --- /dev/null +++ b/examples/file-routes/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "ESNext", + "moduleResolution": "bundler", + "strict": true, + "jsx": "preserve", + "jsxImportSource": "solid-js", + "types": ["vite/client"], + "noEmit": true + }, + "include": ["src", "vite.config.ts"] +} diff --git a/examples/file-routes/vite.config.ts b/examples/file-routes/vite.config.ts new file mode 100644 index 00000000..bf415f75 --- /dev/null +++ b/examples/file-routes/vite.config.ts @@ -0,0 +1,14 @@ +import { fileRoutes } from "@solidjs/file-routes/vite"; +import { defineConfig } from "vite"; +import solid from "vite-plugin-solid"; + +export default defineConfig({ + // `extensions` makes vite-plugin-solid also compile the `?pick=` route + // modules the file-routes plugin emits (their ids end in a query string) + plugins: [solid({ extensions: [".jsx", ".tsx"] }), fileRoutes()], + optimizeDeps: { + // pre-bundle everything the workspace-linked router pulls in, so the + // dep optimizer doesn't re-run mid-page-load with a second solid-js copy + include: ["solid-js", "solid-js/web", "solid-js/store"] + } +}); diff --git a/package.json b/package.json index 8d3e8eac..6c332127 100644 --- a/package.json +++ b/package.json @@ -1,63 +1,15 @@ { - "name": "@solidjs/router", - "description": "Universal router for SolidJS", - "author": "Ryan Carniato", - "contributors": [ - "Ryan Turnquist" - ], - "license": "MIT", - "version": "0.16.2", - "homepage": "https://github.com/solidjs/solid-router#readme", - "repository": { - "type": "git", - "url": "https://github.com/solidjs/solid-router" - }, - "publishConfig": { - "access": "public" - }, - "type": "module", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "exports": { - ".": { - "solid": "./dist/index.jsx", - "default": "./dist/index.js" - } - }, - "files": [ - "dist" - ], - "sideEffects": false, + "name": "solid-router-monorepo", + "private": true, "scripts": { - "build": "rm -rf dist && tsc && rollup -c", - "prepublishOnly": "npm run build", - "test": "vitest run && npm run test:types", - "test:watch": "vitest", - "test:types": "tsc --project tsconfig.test.json", - "pretty": "prettier --write \"{src,test}/**/*.{ts,tsx}\"", + "build": "pnpm --recursive --if-present run build", + "test": "pnpm --recursive --if-present run test", + "pretty": "pnpm --recursive --if-present run pretty", + "typecheck:dist": "pnpm --recursive --if-present run typecheck:dist", "release": "pnpm build && changeset publish" }, "devDependencies": { - "@babel/core": "^7.26.0", - "@babel/preset-typescript": "^7.26.0", - "@changesets/cli": "^2.27.10", - "@rollup/plugin-babel": "6.0.4", - "@rollup/plugin-node-resolve": "15.3.0", - "@rollup/plugin-terser": "0.4.4", - "@types/jest": "^29.5.14", - "@types/node": "^22.10.0", - "babel-preset-solid": "^1.9.3", - "jsdom": "^25.0.1", - "prettier": "^3.4.1", - "rollup": "^4.27.4", - "solid-js": "^1.9.3", - "typescript": "^5.7.2", - "vite": "^6.0.0", - "vite-plugin-solid": "^2.11.0", - "vitest": "^2.1.6" - }, - "peerDependencies": { - "solid-js": "^1.8.6" + "@changesets/cli": "^2.27.10" }, "packageManager": "pnpm@10.19.0+sha512.c9fc7236e92adf5c8af42fd5bf1612df99c2ceb62f27047032f4720b33f8eacdde311865e91c411f2774f618d82f320808ecb51718bfa82c060c4ba7c76a32b8" } diff --git a/packages/file-routes/README.md b/packages/file-routes/README.md new file mode 100644 index 00000000..c15d9433 --- /dev/null +++ b/packages/file-routes/README.md @@ -0,0 +1,125 @@ +# @solidjs/file-routes + +Router-neutral file-system routing for Solid projects. + +This package owns the *machinery* of file routing — scanning a directory, +applying a filename convention and producing a neutral **route manifest** — +while routers own the *shapes*: each router ships a small emission adapter +that turns the manifest into its own route definitions, and each bundler ships +a delivery adapter that materializes the manifest into code. + +| Piece | Owner | +| --- | --- | +| Scanning, filename convention, neutral route manifest | `@solidjs/file-routes` | +| Vite delivery (virtual module, HMR, code splitting) | `@solidjs/file-routes/vite` | +| `RouteDefinition` emission + `` | `@solidjs/router/fs` | +| Server conventions (`GET`/`POST` exports, API routes, middleware) | `@solidjs/start` | + +The core is bundler-agnostic — it never imports Vite — and the conventions are +the ones proven by SolidStart. + +## Usage with Solid Router and Vite + +```ts +// vite.config.ts +import { fileRoutes } from "@solidjs/file-routes/vite"; +import { defineConfig } from "vite"; +import solid from "vite-plugin-solid"; + +export default defineConfig({ + // `extensions` makes vite-plugin-solid also compile the `?pick=` route + // modules this plugin emits (their ids end in a query string) + plugins: [solid({ extensions: [".jsx", ".tsx"] }), fileRoutes()] +}); +``` + +```tsx +// src/app.tsx +import { Router } from "@solidjs/router"; +import { FileRoutes } from "@solidjs/router/fs"; + +export const App = () => ( + <>{props.children}}> + + +); +``` + +Route modules live in `src/routes` (configurable via `fileRoutes({ dir })`). +A module is a page when it has a default export, and may export a `route` +config object: + +```tsx +// src/routes/blog/[id].tsx +import type { RouteDefinition } from "@solidjs/router"; + +export const route = { + preload: ({ params }) => loadPost(params.id) +} satisfies RouteDefinition; + +export default function Post() { + return

Post

; +} +``` + +## Filename convention + +| File | Path | +| --- | --- | +| `index.tsx` | `/` | +| `about.tsx` | `/about` | +| `blog/[id].tsx` | `/blog/:id` | +| `blog/[[page]].tsx` | `/blog/:page?` | +| `docs/[...path].tsx` | `/docs/*path` | +| `(marketing)/about.tsx` | `/about`, nested in the `(marketing)` group | + +Nested layouts come from pairing a file with a directory: `blog.tsx` is the +layout for everything in `blog/`. + +The convention is pluggable — pass `toPath`/`toRoute` to a router, or a whole +custom router to the Vite plugin: + +```ts +import { PageFileSystemRouter } from "@solidjs/file-routes"; +import { fileRoutes } from "@solidjs/file-routes/vite"; + +fileRoutes({ + router: new PageFileSystemRouter({ + dir: "/absolute/path/to/routes", + extensions: ["tsx"], + toPath: routeFile => (routeFile.endsWith(".page") ? routeFile.slice(0, -5) : undefined) + }) +}); +``` + +## The manifest seam + +The scanner produces flat `RouteManifestEntry` objects: + +```ts +{ + path: "/blog/:id", // neutral pattern language + page: true, + $component: { src, pick }, // lazy module ref → code-split dynamic import + $$route: { src, pick } // eager module ref → static import +} +``` + +The Vite adapter serializes the manifest into the `solid:file-routes` virtual +module, turning `$`-prefixed refs into dynamic imports and `$$`-prefixed refs +into static imports, each tree-shaken down to the picked exports. Emission +adapters import that module and emit their router's shape — see +`@solidjs/router/fs` for Solid Router's, which is a ~100 line adapter other +routers can mirror. + +Frameworks with several Vite environments can serve a different router (and +convention) per environment: + +```ts +fileRoutes({ + routers: { + client: new PageFileSystemRouter({ dir, extensions }), + ssr: new MyServerFileRouter({ dir, extensions }) + } +}); +``` diff --git a/packages/file-routes/package.json b/packages/file-routes/package.json new file mode 100644 index 00000000..7fac4001 --- /dev/null +++ b/packages/file-routes/package.json @@ -0,0 +1,63 @@ +{ + "name": "@solidjs/file-routes", + "description": "Router-neutral file-system routing: scans a route directory into a neutral route manifest with pluggable conventions and delivery adapters", + "license": "MIT", + "version": "0.1.0", + "homepage": "https://github.com/solidjs/solid-router#readme", + "repository": { + "type": "git", + "url": "https://github.com/solidjs/solid-router", + "directory": "packages/file-routes" + }, + "publishConfig": { + "access": "public" + }, + "type": "module", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./vite": { + "types": "./dist/vite/index.d.ts", + "default": "./dist/vite/index.js" + } + }, + "files": [ + "dist" + ], + "scripts": { + "build": "rm -rf dist && tsc", + "prepublishOnly": "npm run build", + "test": "vitest run", + "test:watch": "vitest", + "pretty": "prettier --write \"{src,test}/**/*.ts\"", + "typecheck:dist": "pnpx @arethetypeswrong/cli --pack . --profile esm-only" + }, + "dependencies": { + "@babel/core": "^7.29.0", + "@types/babel__core": "^7.20.5", + "@types/babel__traverse": "^7.28.0", + "@types/micromatch": "^4.0.10", + "fast-glob": "^3.3.3", + "micromatch": "^4.0.8", + "oxc-parser": "^0.139.0" + }, + "peerDependencies": { + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "vite": { + "optional": true + } + }, + "devDependencies": { + "@types/node": "^22.10.0", + "prettier": "^3.4.1", + "typescript": "^5.7.2", + "vite": "^6.0.0", + "vitest": "^2.1.6" + } +} diff --git a/packages/file-routes/src/analyze.ts b/packages/file-routes/src/analyze.ts new file mode 100644 index 00000000..f54b79db --- /dev/null +++ b/packages/file-routes/src/analyze.ts @@ -0,0 +1,35 @@ +import fs from "node:fs"; +import { parseSync, type StaticExportEntry } from "oxc-parser"; + +export type { StaticExportEntry }; + +/** + * Analyze a route module's static exports. + * + * This is the compiler-shaped slice of file routing: it reports what a module + * exports without knowing what a route is. It is kept behind its own seam so + * a compiler that already performs export analysis can provide it instead. + */ +export function analyzeModule(src: string): StaticExportEntry[] { + const result = parseSync(src, fs.readFileSync(src, "utf-8"), { lang: "tsx" }); + const error = result.errors[0]; + if (error) throw new SyntaxError(`Failed to parse ${src}:\n${error.codeframe || error.message}`); + + return result.module.staticExports.flatMap(({ entries }) => + entries.filter(entry => !entry.isType && entry.exportName.kind !== "None") + ); +} + +export function getExportName(entry: StaticExportEntry) { + return entry.exportName.name ?? "default"; +} + +/** + * Returns the export name only when it is backed by a same-named local + * binding, i.e. it can be re-picked from the module without renaming. + */ +export function getLocalExportName(entry: StaticExportEntry) { + const name = getExportName(entry); + if (name === "default") return; + return name === (entry.localName.name ?? entry.importName.name ?? name) ? name : undefined; +} diff --git a/packages/file-routes/src/convention.ts b/packages/file-routes/src/convention.ts new file mode 100644 index 00000000..ae84f8b3 --- /dev/null +++ b/packages/file-routes/src/convention.ts @@ -0,0 +1,85 @@ +import { analyzeModule, getExportName, getLocalExportName } from "./analyze.ts"; +import type { RouteManifestEntry } from "./manifest.ts"; +import { BaseFileSystemRouter, cleanPath } from "./router.ts"; + +/** + * The filename convention proven by SolidStart: + * - `index` files map to their directory's path + * - `[param]` maps to `:param` + * - `[[param]]` maps to an optional `:param?` + * - `[...rest]` maps to a catch-all `*rest` + * - `(group)` segments are retained for emission adapters to nest and strip + */ +export function routePathFromFile(routeFile: string): string { + const routePath = routeFile + // remove the initial slash + .slice(1) + .replace(/index$/, "") + .replace(/\[([^/]+)\]/g, (_, m) => { + if (m.length > 3 && m.startsWith("...")) { + return `*${m.slice(3)}`; + } + if (m.length > 2 && m.startsWith("[") && m.endsWith("]")) { + return `:${m.slice(1, -1)}?`; + } + return `:${m}`; + }); + + return routePath?.length > 0 ? `/${routePath}` : "/"; +} + +/** + * The page-module convention proven by SolidStart: a route module is a page + * when it has a default export, and may export a `route` config object. + * `.md`/`.mdx` files are always pages. + * + * Server conventions (`GET`, `POST`, … exports) intentionally do not live + * here — they belong to the server framework, which can extend this class. + */ +export class PageFileSystemRouter extends BaseFileSystemRouter { + toPath(src: string): string | undefined { + if (this.config.toPath) return super.toPath(src); + return routePathFromFile(cleanPath(src, this.config)); + } + + toRoute(src: string): RouteManifestEntry | undefined { + if (this.config.toRoute) return super.toRoute(src); + + const path = this.toPath(src); + if (path === undefined) return; + + if (src.endsWith(".md") || src.endsWith(".mdx")) { + return { + page: true, + $component: { + src: src, + pick: ["$css"] + }, + $$route: undefined, + path + }; + } + + const exports = analyzeModule(src); + const exportNames = exports.map(getExportName); + const localExportNames = exports.map(getLocalExportName).filter(name => name !== undefined); + const hasDefault = exportNames.includes("default"); + const hasRouteConfig = exportNames.includes("route"); + if (hasDefault) { + return { + page: true, + $component: { + src: src, + pick: [...localExportNames.filter(name => name !== "route"), "default", "$css"] + }, + $$route: hasRouteConfig + ? { + src: src, + pick: ["route"] + } + : undefined, + path + }; + } + } +} diff --git a/packages/file-routes/src/index.ts b/packages/file-routes/src/index.ts new file mode 100644 index 00000000..fffda224 --- /dev/null +++ b/packages/file-routes/src/index.ts @@ -0,0 +1,11 @@ +export { analyzeModule, getExportName, getLocalExportName } from "./analyze.ts"; +export type { StaticExportEntry } from "./analyze.ts"; +export type { ModuleRef, RouteManifestEntry } from "./manifest.ts"; +export { + BaseFileSystemRouter, + cleanPath, + glob, + normalizePath, + type FileSystemRouterConfig +} from "./router.ts"; +export { PageFileSystemRouter, routePathFromFile } from "./convention.ts"; diff --git a/packages/file-routes/src/manifest.ts b/packages/file-routes/src/manifest.ts new file mode 100644 index 00000000..e43e058d --- /dev/null +++ b/packages/file-routes/src/manifest.ts @@ -0,0 +1,48 @@ +/** + * The neutral route manifest. + * + * A file-system router produces a flat list of `RouteManifestEntry` objects. + * The manifest is deliberately router-agnostic: it records paths, params, + * module refs and export info, but says nothing about how a router turns + * those into its own route definitions. Each router ships a small emission + * adapter for that (e.g. `@solidjs/router/fs` emits `RouteDefinition`s), + * and each bundler ships a delivery adapter (e.g. `@solidjs/file-routes/vite` + * serializes the manifest into a virtual module). + */ + +/** + * A reference to a subset of a route module's exports. + * + * Delivery adapters materialize refs into code. The key the ref is stored + * under decides how: + * - keys prefixed `$` become lazy refs: `{ src, import: () => import(...) }` + * - keys prefixed `$$` become eager refs: `{ require: () => ({ ...exports }) }` + */ +export interface ModuleRef { + /** Absolute path of the source module. */ + src: string; + /** The named exports (or `"default"`) this ref selects from the module. */ + pick: string[]; +} + +export interface RouteManifestEntry { + /** + * The route path in the neutral pattern language proven by SolidStart: + * `:param`, `:param?` (optional) and `*rest` (catch-all) segments. + * Group segments (`(name)`) are retained; emission adapters decide how + * to nest and strip them. + */ + path: string; + /** `true` when the module renders a page (has a default export). */ + page?: boolean; + /** Lazy ref to the page component module. */ + $component?: ModuleRef; + /** Eager ref to the route config (`route` export), when present. */ + $$route?: ModuleRef; + /** + * Additional refs and metadata added by convention extensions, e.g. a + * server convention may add `$GET`/`$POST` handler refs. Keys prefixed + * `$`/`$$` are treated as lazy/eager module refs by delivery adapters. + */ + [key: string]: unknown; +} diff --git a/packages/file-routes/src/router.ts b/packages/file-routes/src/router.ts new file mode 100644 index 00000000..0cfe5eb6 --- /dev/null +++ b/packages/file-routes/src/router.ts @@ -0,0 +1,170 @@ +import fg from "fast-glob"; +import micromatch from "micromatch"; +import { posix, sep } from "node:path"; + +import type { RouteManifestEntry } from "./manifest.ts"; + +export const glob = (path: string) => fg.sync(path, { absolute: true }); + +/** Normalize a file path to posix separators (bundler-agnostic). */ +export function normalizePath(path: string) { + return sep === "\\" ? path.replace(/\\/g, "/") : path; +} + +export interface FileSystemRouterConfig { + /** Absolute path of the route directory to scan. */ + dir: string; + /** File extensions (without the dot) that participate in routing. */ + extensions: string[]; + /** + * Pluggable filename convention: maps a route file (relative to `dir`, + * extension stripped, e.g. `/blog/[id]`) to a route path in the neutral + * pattern language, or `undefined` to skip the file. When omitted, the + * router's own `toPath` implementation is used. + */ + toPath?: (routeFile: string, config: FileSystemRouterConfig) => string | undefined; + /** + * Pluggable module convention: maps a source file to a manifest entry, + * or `undefined` to skip the file. When omitted, the router's own + * `toRoute` implementation is used. + */ + toRoute?: (src: string, router: BaseFileSystemRouter) => RouteManifestEntry | undefined; +} + +type RouterEvent = CustomEvent<{ route: string; type: "update" | "remove" | "add" }>; + +/** Strips the route dir prefix and the file extension from a source path. */ +export function cleanPath(src: string, config: FileSystemRouterConfig) { + return src + .slice(config.dir.length) + .replace(new RegExp(`\.(${(config.extensions ?? []).join("|")})$`), ""); +} + +/** + * Bundler-agnostic file-system router: scans a directory into a flat, neutral + * route manifest and keeps it up to date as files are added, changed and + * removed. Delivery adapters (e.g. the Vite plugin) subscribe to `reload` + * events; emission adapters consume the manifest. + */ +export class BaseFileSystemRouter extends EventTarget { + routes: RouteManifestEntry[]; + + config: FileSystemRouterConfig; + + constructor(config: FileSystemRouterConfig) { + super(); + this.routes = []; + this.config = config; + } + + glob() { + const extensions = this.config.extensions; + // a single-entry brace pattern like `.{tsx}` is treated as a literal + const suffix = extensions.length === 1 ? `.${extensions[0]}` : `.{${extensions.join(",")}}`; + return posix.join(fg.convertPathToPattern(this.config.dir), "**/*") + suffix; + } + + async buildRoutes(): Promise { + for (const src of glob(this.glob())) { + await this.addRoute(src); + } + + return this.routes; + } + + isRoute(src: string) { + return Boolean(micromatch(src as any, this.glob())?.length); + } + + toPath(src: string): string | undefined { + if (this.config.toPath) return this.config.toPath(cleanPath(src, this.config), this.config); + throw new Error("Not implemented"); + } + + toRoute(src: string): RouteManifestEntry | undefined { + if (this.config.toRoute) return this.config.toRoute(src, this); + throw new Error("Not implemented"); + } + + _addRoute(route: RouteManifestEntry) { + const idx = this.routes.findIndex(r => r.path === route.path); + if (idx >= 0) this.routes.splice(idx, 1); + this.routes.push(route); + + return idx >= 0; + } + + async addRoute(src: string) { + src = normalizePath(src); + if (this.isRoute(src)) { + try { + const route = this.toRoute(src); + if (route) { + this._addRoute(route); + this.reload(route.path, "add"); + } + } catch (e) { + console.error(e); + } + } + } + + reload(route: string, type: "update" | "remove" | "add") { + this.dispatchEvent( + new CustomEvent("reload", { + detail: { + route, + type + } + }) + ); + } + + async updateRoute(src_: string) { + const src = normalizePath(src_); + if (this.isRoute(src)) { + try { + const route = this.toRoute(src); + if (route) { + const updated = this._addRoute(route); + this.reload(route.path, updated ? "update" : "add"); + } else { + this.removeRoute(src_); + } + } catch (e) { + console.error(e); + } + } + } + + removeRoute(src: string) { + src = normalizePath(src); + if (this.isRoute(src)) { + const path = this.toPath(src); + if (path === undefined) { + return; + } + + const idx = this.routes.findIndex(r => r.path === path); + if (idx === -1) return; + + this.routes.splice(idx, 1); + this.reload(path, "remove"); + } + } + + on(type: string, cb: (evt: RouterEvent) => void) { + this.addEventListener(type, cb as any); + return () => this.removeEventListener(type, cb as any); + } + + buildRoutesPromise?: Promise; + + async getRoutes() { + if (!this.buildRoutesPromise) { + this.buildRoutesPromise = this.buildRoutes(); + } + await this.buildRoutesPromise; + return this.routes; + } +} diff --git a/packages/file-routes/src/vite/constants.ts b/packages/file-routes/src/vite/constants.ts new file mode 100644 index 00000000..948b21c6 --- /dev/null +++ b/packages/file-routes/src/vite/constants.ts @@ -0,0 +1,4 @@ +/** The virtual module that serves the serialized route manifest. */ +export const moduleId = "solid:file-routes"; + +export const DEFAULT_EXTENSIONS = ["js", "jsx", "ts", "tsx"]; diff --git a/packages/file-routes/src/vite/debounce.ts b/packages/file-routes/src/vite/debounce.ts new file mode 100644 index 00000000..fc165693 --- /dev/null +++ b/packages/file-routes/src/vite/debounce.ts @@ -0,0 +1,10 @@ +/** + * Creates a debounced function that delays the invocation of a function + */ +export const debounce = void>(cb: T, debounceMs: number) => { + let timeout: NodeJS.Timeout | undefined; + return (...args: Parameters) => { + clearTimeout(timeout); + timeout = setTimeout(() => cb(...args), debounceMs); + }; +}; diff --git a/packages/file-routes/src/vite/fs-watcher.ts b/packages/file-routes/src/vite/fs-watcher.ts new file mode 100644 index 00000000..917b61e7 --- /dev/null +++ b/packages/file-routes/src/vite/fs-watcher.ts @@ -0,0 +1,73 @@ +import type { EnvironmentModuleNode, FSWatcher, PluginOption, ViteDevServer } from "vite"; + +import type { BaseFileSystemRouter } from "../router.ts"; +import { moduleId } from "./constants.ts"; +import { debounce } from "./debounce.ts"; + +function setupWatcher(watcher: FSWatcher, routes: BaseFileSystemRouter): void { + watcher.on("unlink", path => routes.removeRoute(path)); + watcher.on("add", path => routes.addRoute(path)); + watcher.on("change", path => routes.updateRoute(path)); +} + +function createRoutesReloader( + server: ViteDevServer, + routes: BaseFileSystemRouter, + environment: string +) { + const devEnv = server.environments[environment]; + if (!devEnv?.moduleGraph) return; + + /** + * Debounce catches multiple route changes in a row + * Short timeout for inexpensive invalidations + */ + const invalidateModule = debounce((mod: EnvironmentModuleNode) => { + devEnv.moduleGraph.invalidateModule(mod); + }, 0); + + /** + * Long debounce timeout for expensive reloads + */ + const reloadModule = debounce((mod: EnvironmentModuleNode) => { + devEnv.reloadModule(mod); + }, 200); + + return routes.on("reload", function handleRoutesReload(evt): void { + const mod = devEnv.moduleGraph.getModuleById(moduleId)!; + if (!mod) { + devEnv.hot.send({ type: "full-reload" }); + return; + } + + if (environment === "client" && evt.detail.type !== "update") { + // Client has to be reloaded when routes are added or removed + reloadModule(mod); + } else { + invalidateModule(mod); + } + }); +} + +export const fileSystemWatcher = ( + getRouter: (environment: string) => BaseFileSystemRouter | undefined +): PluginOption => { + const plugin: PluginOption = { + name: "solid-file-routes:watcher", + async configureServer(server: ViteDevServer) { + const watched = new Set(); + for (const environment of Object.keys(server.environments)) { + const router = getRouter(environment); + if (!router) continue; + if (!watched.has(router)) { + watched.add(router); + setupWatcher(server.watcher, router); + } + // Build the manifest before listening for reloads, so the initial + // scan's `add` events don't invalidate the module mid-page-load. + router.getRoutes().then(() => createRoutesReloader(server, router, environment)); + } + } + }; + return plugin; +}; diff --git a/packages/file-routes/src/vite/index.ts b/packages/file-routes/src/vite/index.ts new file mode 100644 index 00000000..5e66c8e0 --- /dev/null +++ b/packages/file-routes/src/vite/index.ts @@ -0,0 +1,149 @@ +import { relative, resolve } from "node:path"; +import type { PluginOption } from "vite"; + +import { PageFileSystemRouter } from "../convention.ts"; +import { BaseFileSystemRouter, normalizePath } from "../router.ts"; +import { DEFAULT_EXTENSIONS, moduleId } from "./constants.ts"; +import { fileSystemWatcher } from "./fs-watcher.ts"; +import { treeShake } from "./tree-shake.ts"; + +export { DEFAULT_EXTENSIONS, moduleId }; +export { treeShake } from "./tree-shake.ts"; +export { fileSystemWatcher } from "./fs-watcher.ts"; + +export interface FileRoutesOptions { + /** Route directory, relative to the Vite root. Defaults to `src/routes`. */ + dir?: string; + /** File extensions that participate in routing. Defaults to js/jsx/ts/tsx. */ + extensions?: string[]; + /** + * A custom file-system router (scanning + convention) used for every Vite + * environment. Defaults to a `PageFileSystemRouter` over `dir`. + */ + router?: BaseFileSystemRouter; + /** + * Per-environment file-system routers, keyed by Vite environment name. + * Frameworks (e.g. SolidStart) use this to serve different conventions to + * client and server environments. Falls back to `router` for environments + * not listed. + */ + routers?: Record; +} + +/** + * The Vite delivery adapter for `@solidjs/file-routes`. + * + * Serializes the neutral route manifest into the `solid:file-routes` virtual + * module — module refs become code-split dynamic imports (`$`-prefixed keys) + * or eagerly required static imports (`$$`-prefixed keys) — and keeps it hot + * as route files are added, changed and removed. + */ +export function fileRoutes(options: FileRoutesOptions = {}): PluginOption[] { + let defaultRouter = options.router; + + const getRouter = (environment: string) => options.routers?.[environment] ?? defaultRouter; + + return [ + { + name: "solid-file-routes", + enforce: "pre", + config() { + return { + optimizeDeps: { + // The emission adapter imports the virtual module, which only + // this plugin can resolve; keep it out of esbuild prebundling. + exclude: ["@solidjs/router/fs"] + } + }; + }, + configResolved(config) { + if (!defaultRouter) { + defaultRouter = new PageFileSystemRouter({ + dir: normalizePath(resolve(config.root, options.dir ?? "src/routes")), + extensions: options.extensions ?? DEFAULT_EXTENSIONS + }); + } + }, + resolveId(id) { + if (id === moduleId) return id; + }, + async load(id) { + if (id !== moduleId) return; + + const root = this.environment.config.root; + const isBuild = this.environment.mode === "build"; + const js = jsCode(); + + const router = getRouter(this.environment.name); + const routes = router ? await router.getRoutes() : []; + + let routesCode = JSON.stringify(routes ?? [], (k, v) => { + if (v === undefined) return undefined; + + if (k.startsWith("$$")) { + const buildId = `${v.src}?${v.pick.map((p: any) => `pick=${p}`).join("&")}`; + + const refs: Record = {}; + for (const pick of v.pick) { + refs[pick] = js.addNamedImport(pick, buildId); + } + return { + require: `_$() => ({ ${Object.entries(refs) + .map(([pick, namedImport]) => `'${pick}': ${namedImport}`) + .join(", ")} })$_` + }; + } else if (k.startsWith("$")) { + const buildId = `${v.src}?${v.pick.map((p: any) => `pick=${p}`).join("&")}`; + return { + src: relative(root, buildId), + build: isBuild ? `_$() => import('${buildId}')$_` : undefined, + import: `_$() => import('${buildId}')$_` + }; + } + return v; + }); + + routesCode = routesCode.replaceAll('"_$(', "(").replaceAll(')$_"', ")"); + + return ` +${js.getImportStatements()} +export default ${routesCode}`; + } + }, + treeShake(), + fileSystemWatcher(getRouter) + ]; +} + +function jsCode() { + const imports = new Map>(); + let vars = 0; + + function addNamedImport(name: string, source: string) { + let names = imports.get(source); + if (!names) { + names = {}; + imports.set(source, names); + } + + const alias = "routeData" + vars++; + names[name] = alias; + return alias; + } + + const getImportStatements = () => { + return [...imports.entries()] + .map( + ([source, names]) => + `import { ${Object.entries(names) + .map(([name, alias]) => `${name} as ${alias}`) + .join(", ")} } from '${source}';` + ) + .join("\n"); + }; + + return { + addNamedImport, + getImportStatements + }; +} diff --git a/packages/file-routes/src/vite/tree-shake.ts b/packages/file-routes/src/vite/tree-shake.ts new file mode 100644 index 00000000..57e048ff --- /dev/null +++ b/packages/file-routes/src/vite/tree-shake.ts @@ -0,0 +1,475 @@ +// All credit for this work goes to the amazing Next.js team. +// https://github.com/vercel/next.js/blob/canary/packages/next/build/babel/plugins/next-ssg-transform.ts +// This is adapted to work with routeData functions. It can be run in two modes, one which preserves the routeData and the Component in the same file, and one which creates a + +import type * as Babel from "@babel/core"; +import type { NodePath, PluginObj, PluginPass } from "@babel/core"; +import type { Binding } from "@babel/traverse"; +import { basename } from "node:path"; + +type Identifier = Babel.types.Identifier; +import type { Plugin } from "vite"; + +type State = Omit & { + opts: { pick: string[] }; + refs: Set; + candidates: Set>; + done: boolean; +}; + +function treeShakeTransform({ types: t }: typeof Babel): PluginObj { + function getIdentifier(path: any) { + const parentPath = path.parentPath; + if (parentPath.type === "VariableDeclarator") { + const pp = parentPath; + const name = pp.get("id"); + return name.node.type === "Identifier" ? name : null; + } + if (parentPath.type === "AssignmentExpression") { + const pp = parentPath; + const name = pp.get("left"); + return name.node.type === "Identifier" ? name : null; + } + if (path.node.type === "ArrowFunctionExpression") { + return null; + } + return path.node.id && path.node.id.type === "Identifier" ? path.get("id") : null; + } + + function isTypeOnlyReference(path: NodePath) { + return path.getAncestry().some(parent => { + if (parent.isTSType()) return true; + if (parent.isExportNamedDeclaration()) return parent.node.exportKind === "type"; + if (parent.isExportSpecifier()) return parent.node.exportKind === "type"; + return false; + }); + } + + function runtimeReferences(binding: Binding) { + return binding.referencePaths.filter(ref => !isTypeOnlyReference(ref)); + } + + function isIdentifierReferenced(ident: any, includeTypes = false) { + const b: Binding | undefined = ident.scope.getBinding(ident.node.name); + if (b) { + const references = b.constantViolations.concat( + includeTypes ? b.referencePaths : runtimeReferences(b) + ); + if (!references.length) return false; + if (b.path.type === "FunctionDeclaration") { + return !references.every(ref => ref.findParent(p => p === b.path)); + } + return true; + } + return false; + } + function markFunction(path: any, state: any) { + const ident = getIdentifier(path); + if (ident && ident.node && isIdentifierReferenced(ident, true)) { + state.refs.add(ident); + } + } + function markImport(path: any, state: any) { + const local = path.get("local"); + if (isIdentifierReferenced(local, true)) { + state.refs.add(local); + } + } + + return { + visitor: { + Program: { + enter(path, state) { + state.refs = new Set(); + state.candidates = new Set(); + state.done = false; + path.traverse( + { + VariableDeclarator(variablePath, variableState: any) { + if (variablePath.node.id.type === "Identifier") { + const local = variablePath.get("id"); + if (isIdentifierReferenced(local, true)) { + variableState.refs.add(local); + } + } else if (variablePath.node.id.type === "ObjectPattern") { + const pattern = variablePath.get("id"); + const properties = pattern.get("properties") as Array; + properties.forEach(p => { + const local = p.get( + p.node.type === "ObjectProperty" + ? "value" + : p.node.type === "RestElement" + ? "argument" + : (() => { + throw new Error("invariant"); + })() + ); + if (isIdentifierReferenced(local, true)) { + variableState.refs.add(local); + } + }); + } else if (variablePath.node.id.type === "ArrayPattern") { + const pattern = variablePath.get("id"); + const elements = pattern.get("elements") as Array; + elements.forEach(e => { + let local: NodePath; + if (e.node && e.node.type === "Identifier") { + local = e; + } else if (e.node && e.node.type === "RestElement") { + local = e.get("argument"); + } else { + return; + } + if (isIdentifierReferenced(local, true)) { + variableState.refs.add(local); + } + }); + } + }, + ExportDefaultDeclaration(exportNamedPath) { + if (state.opts.pick && !state.opts.pick.includes("default")) { + const decl = exportNamedPath.node.declaration; + // A named function/class declaration creates a module-scope + // binding that picked exports may reference, so only strip + // the `export default`; the sweep below removes the + // declaration again if nothing references it. + if ((t.isFunctionDeclaration(decl) || t.isClassDeclaration(decl)) && decl.id) { + const [newPath] = exportNamedPath.replaceWith(decl); + const id = (newPath as NodePath).get("id") as NodePath; + state.refs.add(id); + state.candidates.add(id); + } else { + exportNamedPath.remove(); + } + } + }, + ExportNamedDeclaration(exportNamedPath) { + // No pick list means nothing gets pruned. + if (!state.opts.pick) { + return; + } + const specifiers = exportNamedPath.get("specifiers"); + if (specifiers.length) { + specifiers.forEach(s => { + const exported = s.node.exported; + const exportedName = t.isIdentifier(exported) ? exported.name : exported.value; + if (!state.opts.pick.includes(exportedName)) { + s.remove(); + } + }); + if (exportNamedPath.node.specifiers.length < 1) { + exportNamedPath.remove(); + } + return; + } + const decl = exportNamedPath.get("declaration"); + if (decl == null || decl.node == null) { + return; + } + switch (decl.node.type) { + case "FunctionDeclaration": + case "ClassDeclaration": { + const name = decl.node.id?.name; + if (name && state.opts.pick && !state.opts.pick.includes(name)) { + // Keep the declaration in module scope since picked + // exports may reference it; the sweep below removes it + // again if unreferenced. + const [newPath] = exportNamedPath.replaceWith(decl.node); + const id = (newPath as NodePath).get("id") as NodePath; + state.refs.add(id); + state.candidates.add(id); + } + break; + } + case "VariableDeclaration": { + const declNode = decl.node; + // Destructuring declarators are conservatively treated as + // picked (matching the previous behavior of leaving them + // untouched). + const isPicked = (d: (typeof declNode.declarations)[number]) => + d.id.type !== "Identifier" || state.opts.pick.includes(d.id.name); + if (declNode.declarations.every(isPicked)) { + break; + } + // Split into one declaration per declarator (preserving + // evaluation order) and export only the picked ones. + // Unpicked bindings are kept since picked exports may + // reference them; the sweep below removes them again if + // unreferenced. + const statements = declNode.declarations.map(d => { + const single = t.variableDeclaration(declNode.kind, [d]); + single.declare = declNode.declare; + return isPicked(d) ? t.exportNamedDeclaration(single, []) : single; + }); + const newPaths = exportNamedPath.replaceWithMultiple(statements); + for (const p of newPaths) { + if (!p.isVariableDeclaration()) continue; + for (const d of p.get("declarations")) { + if (d.node.id.type === "Identifier") { + const id = d.get("id") as NodePath; + state.refs.add(id); + state.candidates.add(id); + } + } + } + break; + } + default: { + break; + } + } + }, + FunctionDeclaration: markFunction, + FunctionExpression: markFunction, + ArrowFunctionExpression: markFunction, + ClassDeclaration: markFunction, + ClassExpression: markFunction, + ImportSpecifier: markImport, + ImportDefaultSpecifier: markImport, + ImportNamespaceSpecifier: markImport, + ImportDeclaration: (path, state) => { + if ( + path.node.source.value.endsWith(".css") && + state.opts.pick && + !state.opts.pick.includes("$css") + ) { + path.remove(); + } + } + }, + state + ); + + // References alone cannot distinguish live bindings from dead cycles. + // Build a graph of localized exports and retain only those reachable + // from runtime code outside that graph. + path.scope.crawl(); + const tracked = new Map>(); + const candidateOwners = new Map>(); + const addOwner = ( + owners: Map>, + binding: Binding, + owner: NodePath + ) => { + const paths = owners.get(binding) ?? new Set(); + paths.add(owner); + owners.set(binding, paths); + }; + + for (const identifier of state.refs) { + if (identifier.node?.type !== "Identifier" || !identifier.parentPath) continue; + const binding = identifier.scope.getBinding(identifier.node.name); + if (binding) addOwner(tracked, binding, identifier.parentPath); + } + for (const identifier of state.candidates) { + if (!identifier.parentPath) continue; + const binding = identifier.scope.getBinding(identifier.node.name); + if (!binding) continue; + addOwner(tracked, binding, identifier.parentPath); + addOwner(candidateOwners, binding, identifier.parentPath); + } + + const dependencies = new Map>(); + const live = new Set(); + for (const [binding, owners] of tracked) { + dependencies.set(binding, new Set()); + if ( + [...owners].some(owner => + owner.findParent( + parent => parent.isExportNamedDeclaration() || parent.isExportDefaultDeclaration() + ) + ) + ) { + live.add(binding); + } + } + + const ownerBindings = new Map(); + for (const [binding, owners] of tracked) { + for (const owner of owners) { + ownerBindings.set(owner, binding); + } + } + const owningBinding = (reference: NodePath) => { + const owner = reference.find(parent => ownerBindings.has(parent)); + return owner && ownerBindings.get(owner); + }; + + for (const target of tracked.keys()) { + const references = target.constantViolations.concat(runtimeReferences(target)); + for (const reference of references) { + const source = owningBinding(reference); + if (source) dependencies.get(source)?.add(target); + else live.add(target); + } + } + + const pending = [...live]; + while (pending.length) { + const source = pending.pop()!; + for (const dependency of dependencies.get(source) ?? []) { + if (live.has(dependency)) continue; + live.add(dependency); + pending.push(dependency); + } + } + + const deadCandidates = new Set( + [...candidateOwners.keys()].filter(candidate => !live.has(candidate)) + ); + path.traverse({ + VariableDeclarator(variablePath) { + if (variablePath.node.id.type !== "Identifier") return; + const binding = variablePath.scope.getBinding(variablePath.node.id.name); + if (binding && deadCandidates.has(binding)) variablePath.remove(); + } + }); + for (const [candidate, owners] of candidateOwners) { + if (!deadCandidates.has(candidate)) continue; + for (const owner of owners) { + if (!owner.removed && !owner.isVariableDeclarator()) owner.remove(); + } + } + + const refs = state.refs; + const refNodes = new Set([...refs].map(ref => ref.node)); + let count = 0; + const sweepFunction = (sweepPath: any) => { + const ident = getIdentifier(sweepPath); + if (ident && ident.node && refNodes.has(ident.node) && !isIdentifierReferenced(ident)) { + ++count; + if ( + t.isAssignmentExpression(sweepPath.parentPath) || + t.isVariableDeclarator(sweepPath.parentPath) + ) { + sweepPath.parentPath.remove(); + } else { + sweepPath.remove(); + } + } + }; + function sweepImport(sweepPath: any) { + const local = sweepPath.get("local"); + if (refNodes.has(local.node) && !isIdentifierReferenced(local)) { + ++count; + sweepPath.remove(); + if (sweepPath.parent.specifiers.length === 0) { + sweepPath.parentPath.remove(); + } + } + } + do { + path.scope.crawl(); + count = 0; + path.traverse({ + VariableDeclarator(variablePath) { + if (variablePath.node.id.type === "Identifier") { + const local = variablePath.get("id"); + if (refNodes.has(local.node) && !isIdentifierReferenced(local)) { + ++count; + variablePath.remove(); + } + } else if (variablePath.node.id.type === "ObjectPattern") { + const pattern = variablePath.get("id"); + const beforeCount = count; + const properties = pattern.get("properties"); + properties.forEach(p => { + const local = p.get( + p.node.type === "ObjectProperty" + ? "value" + : p.node.type === "RestElement" + ? "argument" + : (() => { + throw new Error("invariant"); + })() + ); + if (refNodes.has(local.node) && !isIdentifierReferenced(local)) { + ++count; + p.remove(); + } + }); + if (beforeCount !== count && pattern.get("properties").length < 1) { + variablePath.remove(); + } + } else if (variablePath.node.id.type === "ArrayPattern") { + const pattern = variablePath.get("id"); + const beforeCount = count; + const elements = pattern.get("elements"); + elements.forEach(e => { + let local: NodePath | undefined; + if (e.node && e.node.type === "Identifier") { + local = e; + } else if (e.node && e.node.type === "RestElement") { + local = e.get("argument"); + } else { + return; + } + if (refNodes.has(local.node) && !isIdentifierReferenced(local)) { + ++count; + e.remove(); + } + }); + if (beforeCount !== count && pattern.get("elements").length < 1) { + variablePath.remove(); + } + } + }, + FunctionDeclaration: sweepFunction, + FunctionExpression: sweepFunction, + ArrowFunctionExpression: sweepFunction, + ClassDeclaration: sweepFunction, + ClassExpression: sweepFunction, + ImportSpecifier: sweepImport, + ImportDefaultSpecifier: sweepImport, + ImportNamespaceSpecifier: sweepImport + }); + } while (count); + } + } + } + }; +} + +export function treeShake(): Plugin { + async function transform(id: string, code: string) { + const [path, queryString] = id.split("?"); + const query = new URLSearchParams(queryString); + if (query.has("pick")) { + const babel = await import("@babel/core"); + const transformed = await babel.transformAsync(code, { + plugins: [[treeShakeTransform, { pick: query.getAll("pick") }]], + parserOpts: { + plugins: ["jsx", "typescript"] + }, + filename: basename(id), + ast: false, + sourceMaps: true, + configFile: false, + babelrc: false, + sourceFileName: id + }); + + return transformed; + } + } + return { + name: "solid-file-routes:tree-shake", + enforce: "pre", + async transform(code, id) { + const [path, queryString] = id.split("?"); + if (!path) return; + const query = new URLSearchParams(queryString); + const ext = path.split(".").pop(); + if (!ext) return; + if (query.has("pick") && ["js", "jsx", "ts", "tsx"].includes(ext)) { + const transformed = await transform(id, code); + if (!transformed?.code) return; + + return { + code: transformed.code, + map: transformed.map + }; + } + } + }; +} diff --git a/packages/file-routes/test/analyze.spec.ts b/packages/file-routes/test/analyze.spec.ts new file mode 100644 index 00000000..af83331c --- /dev/null +++ b/packages/file-routes/test/analyze.spec.ts @@ -0,0 +1,85 @@ +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { afterEach, describe, expect, it } from "vitest"; + +import { analyzeModule } from "../src/analyze.ts"; +import { PageFileSystemRouter } from "../src/convention.ts"; + +const temporaryDirectories: string[] = []; + +function writeRoute(source: string) { + const directory = fs.mkdtempSync(path.join(os.tmpdir(), "solid-file-routes-")); + const filename = path.join(directory, "route.tsx"); + temporaryDirectories.push(directory); + fs.writeFileSync(filename, source); + return filename; +} + +afterEach(() => { + for (const directory of temporaryDirectories.splice(0)) { + fs.rmSync(directory, { recursive: true }); + } +}); + +describe("analyzeModule", () => { + it("returns runtime exports from TSX modules", () => { + const route = writeRoute(` + export type TypeOnly = string; + const local = 1; + export { local, local as renamed }; + export const route = {}; + export function GET() {} + export default function Route() { + return
; + } + `); + + const exports = analyzeModule(route); + + expect( + exports.map(entry => entry.exportName.name ?? entry.exportName.kind.toLowerCase()) + ).toEqual(["local", "renamed", "route", "GET", "default"]); + expect(exports.every(entry => !entry.isType)).toBe(true); + }); + + it("preserves local-name semantics for re-exports", () => { + const route = writeRoute(` + export { external, external as renamedExternal } from "./external.ts"; + export { default as DefaultExport } from "./external.ts"; + export * as namespace from "./external.ts"; + export * from "./external.ts"; + `); + + const exports = analyzeModule(route); + + expect(exports.map(entry => entry.exportName.name)).toEqual([ + "external", + "renamedExternal", + "DefaultExport", + "namespace" + ]); + expect(exports.map(entry => entry.importName.name)).toEqual([ + "external", + "external", + "default", + null + ]); + }); + + it("throws on invalid route syntax", () => { + const route = writeRoute("export default function Route( {"); + + expect(() => analyzeModule(route)).toThrow(`Failed to parse ${route}`); + }); + + it("does not include an anonymous default export twice", () => { + const route = writeRoute("export default () =>
;"); + const router = new PageFileSystemRouter({ + dir: path.dirname(route), + extensions: ["tsx"] + }); + + expect(router.toRoute(route)?.$component?.pick).toEqual(["default", "$css"]); + }); +}); diff --git a/packages/file-routes/test/convention.spec.ts b/packages/file-routes/test/convention.spec.ts new file mode 100644 index 00000000..bb87adf8 --- /dev/null +++ b/packages/file-routes/test/convention.spec.ts @@ -0,0 +1,116 @@ +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { afterEach, describe, expect, it } from "vitest"; + +import { PageFileSystemRouter, routePathFromFile } from "../src/index.ts"; + +describe("routePathFromFile", () => { + it("maps index files to their directory path", () => { + expect(routePathFromFile("/index")).toBe("/"); + expect(routePathFromFile("/blog/index")).toBe("/blog/"); + expect(routePathFromFile("/about")).toBe("/about"); + }); + + it("maps [param] segments to :param", () => { + expect(routePathFromFile("/blog/[id]")).toBe("/blog/:id"); + expect(routePathFromFile("/[lang]/about")).toBe("/:lang/about"); + }); + + it("maps [[param]] segments to optional :param?", () => { + expect(routePathFromFile("/blog/[[page]]")).toBe("/blog/:page?"); + }); + + it("maps [...rest] segments to catch-all *rest", () => { + expect(routePathFromFile("/docs/[...path]")).toBe("/docs/*path"); + }); + + it("retains group segments for emission adapters", () => { + expect(routePathFromFile("/(marketing)/about")).toBe("/(marketing)/about"); + }); +}); + +const temporaryDirectories: string[] = []; + +function createRouteTree(files: Record) { + const directory = fs.realpathSync( + fs.mkdtempSync(path.join(os.tmpdir(), "solid-file-routes-tree-")) + ); + temporaryDirectories.push(directory); + for (const [file, source] of Object.entries(files)) { + const filename = path.join(directory, file); + fs.mkdirSync(path.dirname(filename), { recursive: true }); + fs.writeFileSync(filename, source); + } + return directory; +} + +afterEach(() => { + for (const directory of temporaryDirectories.splice(0)) { + fs.rmSync(directory, { recursive: true }); + } +}); + +describe("PageFileSystemRouter", () => { + it("scans a route directory into a flat manifest", async () => { + const dir = createRouteTree({ + "index.tsx": "export default () =>

Home

;", + "about.tsx": "export default () =>

About

;", + "blog/index.tsx": "export default () =>

Blog

;", + "blog/[id].tsx": ` + export const route = { preload: () => {} }; + export default () =>

Post

; + `, + "docs/[...path].tsx": "export default () =>

Docs

;", + "not-a-page.ts": "export const helper = () => {};" + }); + const router = new PageFileSystemRouter({ dir, extensions: ["ts", "tsx"] }); + + const routes = await router.getRoutes(); + const paths = routes.map(route => route.path).sort(); + + expect(paths).toEqual(["/", "/about", "/blog/", "/blog/:id", "/docs/*path"]); + + const post = routes.find(route => route.path === "/blog/:id")!; + expect(post.page).toBe(true); + expect(post.$component?.pick).toEqual(["default", "$css"]); + expect(post.$$route?.pick).toEqual(["route"]); + }); + + it("updates the manifest when files change or are removed", async () => { + const dir = createRouteTree({ + "index.tsx": "export default () =>

Home

;" + }); + const router = new PageFileSystemRouter({ dir, extensions: ["tsx"] }); + await router.getRoutes(); + + const events: string[] = []; + router.on("reload", evt => events.push(`${evt.detail.type}:${evt.detail.route}`)); + + const contact = path.join(dir, "contact.tsx"); + fs.writeFileSync(contact, "export default () =>

Contact

;"); + await router.addRoute(contact); + expect(router.routes.map(route => route.path).sort()).toEqual(["/", "/contact"]); + + router.removeRoute(contact); + expect(router.routes.map(route => route.path)).toEqual(["/"]); + expect(events).toEqual(["add:/contact", "remove:/contact"]); + }); + + it("supports a pluggable filename convention", async () => { + const dir = createRouteTree({ + "home.page.tsx": "export default () =>

Home

;", + "helper.ts": "export default () => null;" + }); + const router = new PageFileSystemRouter({ + dir, + extensions: ["ts", "tsx"], + toPath: routeFile => + routeFile.endsWith(".page") ? routeFile.slice(0, -".page".length) : undefined + }); + + const routes = await router.getRoutes(); + + expect(routes.map(route => route.path)).toEqual(["/home"]); + }); +}); diff --git a/packages/file-routes/test/tree-shake.spec.ts b/packages/file-routes/test/tree-shake.spec.ts new file mode 100644 index 00000000..8d4efcc9 --- /dev/null +++ b/packages/file-routes/test/tree-shake.spec.ts @@ -0,0 +1,289 @@ +import { describe, expect, it } from "vitest"; + +import { treeShake } from "../src/vite/tree-shake.ts"; + +async function shake(code: string, pick: string[]) { + const plugin = treeShake() as any; + const id = `/routes/route.ts?${pick.map(p => `pick=${p}`).join("&")}`; + const result = await plugin.transform(code, id); + return result?.code as string | undefined; +} + +describe("treeShake", () => { + it("keeps only the picked export", async () => { + const code = ` + export const GET = () => "get"; + export const POST = () => "post"; + `; + + const output = await shake(code, ["GET"]); + + expect(output).toContain("export const GET"); + expect(output).not.toContain("POST"); + }); + + // https://github.com/solidjs/solid-start/issues/2100 + it("keeps a non-picked export that a picked export references", async () => { + const code = ` + export const hello = () => "hello"; + export const GET = async () => { + return hello(); + }; + `; + + const output = await shake(code, ["GET"]); + + expect(output).toContain(`const hello = () => "hello"`); + expect(output).not.toContain("export const hello"); + expect(output).toContain("export const GET"); + }); + + it("keeps a non-picked exported function that a picked export references", async () => { + const code = ` + export function helper() { + return "helper"; + } + export const GET = () => helper(); + `; + + const output = await shake(code, ["GET"]); + + expect(output).toContain("function helper()"); + expect(output).not.toContain("export function helper"); + expect(output).toContain("export const GET"); + }); + + it("removes a non-picked export that nothing references", async () => { + const code = ` + export const secret = globalThis.createSecret(); + export const GET = () => "ok"; + `; + + const output = await shake(code, ["GET"]); + + expect(output).not.toContain("secret"); + expect(output).toContain("export const GET"); + }); + + // https://github.com/solidjs/solid-start/issues/1659 + it("keeps picked exports declared via specifiers, including aliases", async () => { + const code = ` + const handler = () => "ok"; + export { handler as GET, handler as POST }; + `; + + const output = await shake(code, ["GET"]); + + expect(output).toContain("handler as GET"); + expect(output).not.toContain("POST"); + }); + + it("splits mixed variable declarations while preserving evaluation order", async () => { + const code = ` + export const first = 1, GET = () => first; + `; + + const output = await shake(code, ["GET"]); + + expect(output).toMatch(/const first = 1;\s*export const GET/); + expect(output).not.toContain("export const first"); + }); + + it("keeps a named default export that a picked export references", async () => { + const code = ` + export default function Page() { + return "page"; + } + export const GET = () => Page(); + `; + + const output = await shake(code, ["GET"]); + + expect(output).toContain("function Page()"); + expect(output).not.toContain("export default"); + expect(output).toContain("export const GET"); + }); + + it("removes an unreferenced default export, including anonymous ones", async () => { + const named = await shake( + ` + export default function Page() { return "page"; } + export const GET = () => "ok"; + `, + ["GET"] + ); + expect(named).not.toContain("Page"); + + const anonymous = await shake( + ` + export default function () { return "page"; } + export const GET = () => "ok"; + `, + ["GET"] + ); + expect(anonymous).not.toContain("export default"); + expect(anonymous).toContain("export const GET"); + }); + + it("removes imports only used by removed exports", async () => { + const code = ` + import { db } from "./db.ts"; + export const POST = () => db.write(); + export const GET = () => "ok"; + `; + + const output = await shake(code, ["GET"]); + + expect(output).not.toContain("db"); + expect(output).toContain("export const GET"); + }); + + it("removes unreachable export cycles and their imports", async () => { + const code = ` + import { register } from "./registry.ts"; + export const first = register(() => second); + export const second = register(() => first); + export const GET = () => "ok"; + `; + + const output = await shake(code, ["GET"]); + + expect(output).not.toContain("register"); + expect(output).not.toContain("first"); + expect(output).not.toContain("second"); + expect(output).toContain("export const GET"); + }); + + it("keeps an export cycle reachable from a picked export", async () => { + const code = ` + export const first = () => second(); + export const second = () => first(); + export const GET = () => first(); + `; + + const output = await shake(code, ["GET"]); + + expect(output).toContain("const first"); + expect(output).toContain("const second"); + expect(output).not.toContain("export const first"); + expect(output).not.toContain("export const second"); + }); + + it("removes an unreachable cycle through a non-exported binding", async () => { + const code = ` + import { register } from "./registry.ts"; + export const first = register(() => helper()); + const helper = () => first; + export const GET = () => "ok"; + `; + + const output = await shake(code, ["GET"]); + + expect(output).not.toContain("register"); + expect(output).not.toContain("first"); + expect(output).not.toContain("helper"); + expect(output).toContain("export const GET"); + }); + + it("ignores type-only references when determining reachability", async () => { + const code = ` + import { initializeSecret } from "./secret.ts"; + export const secret = initializeSecret(); + type Secret = typeof secret; + export const GET = (_value: Secret) => "ok"; + `; + + const output = await shake(code, ["GET"]); + + expect(output).not.toContain("initializeSecret"); + expect(output).not.toContain("const secret"); + expect(output).toContain("export const GET"); + }); + + it("keeps runtime references wrapped in TypeScript syntax", async () => { + const code = ` + type Handler = () => string; + export const helper = () => "ok"; + export const GET = () => helper satisfies Handler; + `; + + const output = await shake(code, ["GET"]); + + expect(output).toContain("const helper"); + expect(output).not.toContain("export const helper"); + }); + + it("removes an unreferenced named default class", async () => { + const code = ` + export default class Page { + static { globalThis.initializePage(); } + } + export const GET = () => "ok"; + `; + + const output = await shake(code, ["GET"]); + + expect(output).not.toContain("Page"); + expect(output).not.toContain("initializePage"); + expect(output).toContain("export const GET"); + }); + + it("keeps a class reachable from a picked export", async () => { + const code = ` + export class Helper { + static value = "ok"; + } + export const GET = () => Helper.value; + `; + + const output = await shake(code, ["GET"]); + + expect(output).toContain("class Helper"); + expect(output).not.toContain("export class Helper"); + expect(output).toContain("export const GET"); + }); + + it("removes an unreachable cycle through a non-exported class", async () => { + const code = ` + import { register } from "./registry.ts"; + export const first = register(() => Helper); + class Helper { + value() { return first; } + } + export const GET = () => "ok"; + `; + + const output = await shake(code, ["GET"]); + + expect(output).not.toContain("register"); + expect(output).not.toContain("first"); + expect(output).not.toContain("Helper"); + expect(output).toContain("export const GET"); + }); + + it("preserves declare when splitting mixed variable declarations", async () => { + const code = ` + export declare const helper: string, GET: () => string; + `; + + const output = await shake(code, ["GET"]); + + expect(output).not.toContain("helper"); + expect(output).toContain("export declare const GET"); + }); + + it("removes an unpicked var initializer when the binding is redeclared", async () => { + const code = ` + import { initializeSecret } from "./secret.ts"; + var secret = initializeSecret(); + export var secret; + var secret; + export const GET = () => "ok"; + `; + + const output = await shake(code, ["GET"]); + + expect(output).not.toContain("initializeSecret"); + expect(output).toContain("export const GET"); + }); +}); diff --git a/packages/file-routes/test/vite.spec.ts b/packages/file-routes/test/vite.spec.ts new file mode 100644 index 00000000..c7c5bce2 --- /dev/null +++ b/packages/file-routes/test/vite.spec.ts @@ -0,0 +1,62 @@ +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { afterEach, describe, expect, it } from "vitest"; + +import { fileRoutes, moduleId } from "../src/vite/index.ts"; + +const temporaryDirectories: string[] = []; + +function createRouteTree(files: Record) { + const directory = fs.realpathSync( + fs.mkdtempSync(path.join(os.tmpdir(), "solid-file-routes-vite-")) + ); + temporaryDirectories.push(directory); + for (const [file, source] of Object.entries(files)) { + const filename = path.join(directory, "src", "routes", file); + fs.mkdirSync(path.dirname(filename), { recursive: true }); + fs.writeFileSync(filename, source); + } + return directory; +} + +afterEach(() => { + for (const directory of temporaryDirectories.splice(0)) { + fs.rmSync(directory, { recursive: true }); + } +}); + +function loadVirtualModule(root: string, environment = "client") { + const [plugin] = fileRoutes() as any[]; + plugin.configResolved({ root }); + const context = { environment: { config: { root }, mode: "dev", name: environment } }; + return plugin.load.call(context, moduleId); +} + +describe("fileRoutes vite plugin", () => { + it("serializes the manifest into a virtual module", async () => { + const root = createRouteTree({ + "index.tsx": "export default () =>

Home

;", + "blog/[id].tsx": ` + export const route = { preload: () => {} }; + export default () =>

Post

; + ` + }); + + const code = await loadVirtualModule(root); + + expect(code).toContain("export default ["); + // lazy refs become code-split dynamic imports picking component exports + expect(code).toMatch(/import\('[^']*index\.tsx\?pick=default&pick=\$css'\)/); + // eager refs become static imports of the route config + expect(code).toMatch(/import { route as routeData0 } from '[^']*\[id\]\.tsx\?pick=route';/); + expect(code).toContain(`"path":"/blog/:id"`); + expect(code).toContain(`'route': routeData0`); + }); + + it("resolves only the virtual module id", async () => { + const [plugin] = fileRoutes() as any[]; + expect(plugin.resolveId(moduleId)).toBe(moduleId); + expect(plugin.resolveId("./other")).toBeUndefined(); + }); +}); diff --git a/packages/file-routes/tsconfig.json b/packages/file-routes/tsconfig.json new file mode 100644 index 00000000..3d653568 --- /dev/null +++ b/packages/file-routes/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "strict": true, + "newLine": "LF", + "declaration": true, + "isolatedModules": true, + "allowImportingTsExtensions": true, + "rewriteRelativeImportExtensions": true, + "rootDir": "./src", + "outDir": "./dist", + "skipLibCheck": true + }, + "include": ["./src"], + "exclude": ["node_modules"] +} diff --git a/packages/file-routes/vitest.config.ts b/packages/file-routes/vitest.config.ts new file mode 100644 index 00000000..c985ba12 --- /dev/null +++ b/packages/file-routes/vitest.config.ts @@ -0,0 +1,8 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + environment: "node", + include: ["test/**/*.spec.ts"] + } +}); diff --git a/CHANGELOG.md b/packages/router/CHANGELOG.md similarity index 100% rename from CHANGELOG.md rename to packages/router/CHANGELOG.md diff --git a/packages/router/LICENSE b/packages/router/LICENSE new file mode 100644 index 00000000..30c02e59 --- /dev/null +++ b/packages/router/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020-2022 Ryan Carniato + +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. diff --git a/packages/router/README.md b/packages/router/README.md new file mode 100644 index 00000000..4b972ff4 --- /dev/null +++ b/packages/router/README.md @@ -0,0 +1,1066 @@ +[![Banner](https://assets.solidjs.com/banner?project=Router&type=core)](https://github.com/solidjs) + +
+ +[![Version](https://img.shields.io/npm/v/@solidjs/router.svg?style=for-the-badge&color=blue&logo=npm)](https://npmjs.com/package/@solidjs/router) +[![Downloads](https://img.shields.io/npm/dm/@solidjs/router.svg?style=for-the-badge&color=green&logo=npm)](https://npmjs.com/package/@solidjs/router) +[![Stars](https://img.shields.io/github/stars/solidjs/solid-router?style=for-the-badge&color=yellow&logo=github)](https://github.com/solidjs/solid-router) +[![Discord](https://img.shields.io/discord/722131463138705510?label=join&style=for-the-badge&color=5865F2&logo=discord&logoColor=white)](https://discord.com/invite/solidjs) +[![Reddit](https://img.shields.io/reddit/subreddit-subscribers/solidjs?label=join&style=for-the-badge&color=FF4500&logo=reddit&logoColor=white)](https://reddit.com/r/solidjs) + +
+ +**Solid Router** brings fine-grained reactivity to route navigation, enabling your single-page application to become multi-paged without full page reloads. Fully integrated into the SolidJS ecosystem, Solid Router provides declarative syntax with features like universal rendering and parallel data fetching for best performance. + +Explore the official [documentation](https://docs.solidjs.com/solid-router) for detailed guides and examples. + +## Core Features + +- **All Routing Modes**: + - [History-Based](https://docs.solidjs.com/solid-router/reference/components/router#router) for standard browser navigation + - [Hash-Based](https://docs.solidjs.com/solid-router/reference/components/hash-router#hashrouter) for navigation based on URL hash + - [Static Routing](https://docs.solidjs.com/solid-router/rendering-modes/ssr#server-side-rendering) for server-side rendering (_SSR_) + - [Memory-Based](https://docs.solidjs.com/solid-router/reference/components/memory-router#memoryrouter) for testing in non-browser environments +- **TypeScript**: Full integration for robust, type-safe development +- **Universal Rendering**: Seamless rendering on both client and server environments +- **Declarative**: Define routes as components or as an object +- **Preload Functions**: Parallel data fetching, following the render-as-you-fetch pattern +- **Dynamic Route Parameters**: Flexible URL patterns with parameters, optional segments, and wildcards +- **Data APIs with Caching**: Reactive data fetching with deduplication and revalidation + +## Table of contents + +- [Getting Started](#getting-started) + - [Set Up the Router](#set-up-the-router) + - [Configure Your Routes](#configure-your-routes) + - [Create Links to Your Routes](#create-links-to-your-routes) +- [Dynamic Routes](#dynamic-routes) +- [Nested Routes](#nested-routes) +- [Hash Mode Router](#hash-mode-router) +- [Memory Mode Router](#memory-mode-router) +- [Data APIs](#data-apis) +- [Config Based Routing](#config-based-routing) +- [Components](#components) +- [Router Primitives](#router-primitives) + - [useParams](#useparams) + - [useNavigate](#usenavigate) + - [useLocation](#uselocation) + - [useSearchParams](#usesearchparams) + - [useIsRouting](#useisrouting) + - [useMatch](#usematch) + - [useCurrentMatches](#useCurrentMatches) + - [useBeforeLeave](#usebeforeleave) +- [SPAs in Deployed Environments](#spas-in-deployed-environments) + +## Getting Started + +### Set Up the Router + +```bash +# use preferred package manager +npm add @solidjs/router +``` + +Install `@solidjs/router`, then start your application by rendering the router component + +```jsx +import { render } from "solid-js/web"; +import { Router } from "@solidjs/router"; + +render(() => , document.getElementById("app")); +``` + +This sets up a Router that will match on the url to display the desired page + +### Configure Your Routes + +Solid Router allows you to configure your routes using JSX: + +1. Add each route to a `` using the `Route` component, specifying a path and a component to render when the user navigates to that path. + +```jsx +import { render } from "solid-js/web"; +import { Router, Route } from "@solidjs/router"; + +import Home from "./pages/Home"; +import Users from "./pages/Users"; + +render( + () => ( + + + + + ), + document.getElementById("app") +); +``` + +2. Provide a root level layout + +This will always be there and won't update on page change. It is the ideal place to put top level navigation and Context Providers + +```jsx +import { render } from "solid-js/web"; +import { Router, Route } from "@solidjs/router"; + +import Home from "./pages/Home"; +import Users from "./pages/Users"; + +const App = (props) => ( + <> +

My Site with lots of pages

+ {props.children} + +); + +render( + () => ( + + + + + ), + document.getElementById("app") +); +``` + +3. Create a catch-all route (404 page) + +We can create catch-all routes for pages not found at any nested level of the router. We use `*` and optionally the name of a parameter to retrieve the rest of the path. + +```jsx +import { render } from "solid-js/web"; +import { Router, Route } from "@solidjs/router"; + +import Home from "./pages/Home"; +import Users from "./pages/Users"; +import NotFound from "./pages/404"; + +const App = (props) => ( + <> +

My Site with lots of pages

+ {props.children} + +); + +render( + () => ( + + + + + + ), + document.getElementById("app") +); +``` + +4. Lazy-load route components + +This way, the `Users` and `Home` components will only be loaded if you're navigating to `/users` or `/`, respectively. + +```jsx +import { lazy } from "solid-js"; +import { render } from "solid-js/web"; +import { Router, Route } from "@solidjs/router"; + +const Users = lazy(() => import("./pages/Users")); +const Home = lazy(() => import("./pages/Home")); + +const App = (props) => ( + <> +

My Site with lots of pages

+ {props.children} + +); + +render( + () => ( + + + + + ), + document.getElementById("app") +); +``` + +### Create Links to Your Routes + +Use an anchor tag that takes you to a route: + +```jsx +import { lazy } from "solid-js"; +import { render } from "solid-js/web"; +import { Router, Route } from "@solidjs/router"; + +const Users = lazy(() => import("./pages/Users")); +const Home = lazy(() => import("./pages/Home")); + +const App = (props) => ( + <> + +

My Site with lots of pages

+ {props.children} + +); + +render( + () => ( + + + + + ), + document.getElementById("app") +); +``` + +## Dynamic Routes + +If you don't know the path ahead of time, you might want to treat part of the path as a flexible parameter that is passed on to the component. + +```jsx +import { lazy } from "solid-js"; +import { render } from "solid-js/web"; +import { Router, Route } from "@solidjs/router"; + +const Users = lazy(() => import("./pages/Users")); +const User = lazy(() => import("./pages/User")); +const Home = lazy(() => import("./pages/Home")); + +render( + () => ( + + + + + + ), + document.getElementById("app") +); +``` + +The colon indicates that `id` can be any string, and as long as the URL fits that pattern, the `User` component will show. + +You can then access that `id` from within a route component with `useParams`. + +**Note on Animation/Transitions**: +Routes that share the same path match will be treated as the same route. If you want to force re-render you can wrap your component in a keyed `` like: + +```jsx + + + +``` + +--- + +Each path parameter can be validated using a `MatchFilter`. +This allows for more complex routing descriptions than just checking the presence of a parameter. + +```jsx +import { lazy } from "solid-js"; +import { render } from "solid-js/web"; +import { Router, Route } from "@solidjs/router"; +import type { MatchFilters } from "@solidjs/router"; + +const User = lazy(() => import("./pages/User")); + +const filters: MatchFilters = { + parent: ["mom", "dad"], // allow enum values + id: /^\d+$/, // only allow numbers + withHtmlExtension: (v: string) => v.length > 5 && v.endsWith(".html"), // we want an `*.html` extension +}; + +render( + () => ( + + + + ), + document.getElementById("app") +); +``` + +Here, we have added the `matchFilters` prop. This allows us to validate the `parent`, `id` and `withHtmlExtension` parameters against the filters defined in `filters`. +If the validation fails, the route will not match. + +So in this example: + +- `/users/mom/123/contact.html` would match, +- `/users/dad/123/about.html` would match, +- `/users/aunt/123/contact.html` would not match as `:parent` is not 'mom' or 'dad', +- `/users/mom/me/contact.html` would not match as `:id` is not a number, +- `/users/dad/123/contact` would not match as `:withHtmlExtension` is missing `.html`. + +--- + +### Optional Parameters + +Parameters can be specified as optional by adding a question mark to the end of the parameter name: + +```jsx +// Matches stories and stories/123 but not stories/123/comments + +``` + +### Wildcard Routes + +`:param` lets you match an arbitrary name at that point in the path. You can use `*` to match any end of the path: + +```jsx +// Matches any path that begins with foo, including foo/, foo/a/, foo/a/b/c + +``` + +If you want to expose the wild part of the path to the component as a parameter, you can name it: + +```jsx + +``` + +Note that the wildcard token must be the last part of the path; `foo/*any/bar` won't create any routes. + +### Multiple Paths + +Routes also support defining multiple paths using an array. This allows a route to remain mounted and not rerender when switching between two or more locations that it matches: + +```jsx +// Navigating from login to register does not cause the Login component to re-render + +``` + +## Nested Routes + +The following two route definitions have the same result: + +```jsx + +``` + +```jsx + + + +``` + +`/users/:id` renders the `` component, and `/users/` is an empty route. + +Only leaf Route nodes (innermost `Route` components) are given a route. If you want to make the parent its own route, you have to specify it separately: + +```jsx +//This won't work the way you'd expect + + + + +// This works + + + +// This also works + + + + +``` + +You can also take advantage of nesting by using `props.children` passed to the route component. + +```jsx +function PageWrapper(props) { + return ( +
+

We love our users!

+ {props.children} + Back Home +
+ ); +} + + + + +; +``` + +The routes are still configured the same, but now the route elements will appear inside the parent element where the `props.children` was declared. + +You can nest indefinitely - just remember that only leaf nodes will become their own routes. In this example, the only route created is `/layer1/layer2`, and it appears as three nested divs. + +```jsx +
Onion starts here {props.children}
} +> +
Another layer {props.children}
} + > +
Innermost layer
} /> +
+
+``` + +## Preload Functions + +Even with smart caches it is possible that we have waterfalls both with view logic and with lazy loaded code. With preload functions, we can instead start fetching the data parallel to loading the route, so we can use the data as soon as possible. The preload function is called when the Route is loaded or eagerly when links are hovered. + +As its only argument, the preload function is passed an object that you can use to access route information: + +```js +import { lazy } from "solid-js"; +import { Route } from "@solidjs/router"; + +const User = lazy(() => import("./pages/users/[id].js")); + +// preload function +function preloadUser({ params, location }) { + // do preloading +} + +// Pass it in the route definition +; +``` + +| key | type | description | +| -------- | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| params | object | The route parameters (same value as calling `useParams()` inside the route component) | +| location | `{ pathname, search, hash, query, state, key}` | An object that you can use to get more information about the path (corresponds to [`useLocation()`](#uselocation)) | +| intent | `"initial", "navigate", "native", "preload"` | Indicates why this function is being called.
  • "initial" - the route is being initially shown (ie page load)
  • "native" - navigate originated from the browser (eg back/forward)
  • "navigate" - navigate originated from the router (eg call to navigate or anchor clicked)
  • "preload" - not navigating, just preloading (eg link hover)
| + +A common pattern is to export the preload function and data wrappers that corresponds to a route in a dedicated `route.data.js` file. This way, the data function can be imported without loading anything else. + +```js +import { lazy } from "solid-js"; +import { Route } from "@solidjs/router"; +import preloadUser from "./pages/users/[id].data.js"; +const User = lazy(() => import("/pages/users/[id].js")); + +// In the Route definition +; +``` + +The `preload` function's return value is passed to the page component for any intent other than `"preload"`, allowing you to initialize data or alternatively use our new Data APIs: + +## Data APIs + +Keep in mind that these are entirely optional, but they demonstrate the power of our preload mechanism. + +### `query` + +To prevent duplicate fetching and to handle refetching triggers, we provide a query API that accepts a function and returns the same function. + +```jsx +const getUser = query(async (id) => { + return (await fetch(`/api/users/${id}`)).json(); +}, "users"); // used as the query key + serialized arguments +``` + +It is expected that the arguments to the query function are serializable. + +This query accomplishes the following: + +1. It does deduping on the server for the lifetime of the request. +2. It fills a preload cache in the browser which lasts 5 seconds. When a route is preloaded on hover or when preload is called when entering a route it will make sure to dedupe calls. +3. We have a reactive refetch mechanism based on key. So we can tell routes that aren't new to retrigger on action revalidation. +4. It will serve as a back/forward cache for browser navigation up to 5 mins. Any user based navigation or link click bypasses this cache. Revalidation or new fetch updates the cache. + +Using it with preload function might look like: + +```js +import { lazy } from "solid-js"; +import { Route } from "@solidjs/router"; +import { getUser } from ... // the query function + +const User = lazy(() => import("./pages/users/[id].js")); + +// preload function +function preloadUser({params, location}) { + void getUser(params.id) +} + +// Pass it in the route definition +; +``` + +Inside your page component you: + +```jsx +// pages/users/[id].js +import { getUser } from ... // the query function + +export default function User(props) { + const user = createAsync(() => getUser(props.params.id)); + return

{user().name}

; +} +``` + +Cached function has a few useful methods for getting the key that are useful for invalidation. + +```ts +let id = 5; + +getUser.key; // returns "users" +getUser.keyFor(id); // returns "users[5]" +``` + +You can revalidate the query using the `revalidate` method or you can set `revalidate` keys on your response from your actions. If you pass the whole key it will invalidate all the entries for the query (ie "users" in the example above). You can also invalidate a single entry by using `keyFor`. + +`query` can be defined anywhere and then used inside your components with: + +### `createAsync` + +This is light wrapper over `createResource` that aims to serve as stand-in for a future primitive we intend to bring to Solid core in 2.0. It is a simpler async primitive where the function tracks like `createMemo` and it expects a promise back that it turns into a Signal. Reading it before it is ready causes Suspense/Transitions to trigger. + +```jsx +const user = createAsync((currentValue) => getUser(params.id)); +``` + +It also preserves `latest` field from `createResource`. Note that it will be removed in the future. + +```jsx +const user = createAsync((currentValue) => getUser(params.id)); +return

{user.latest.name}

; +``` + +Using `query` in `createResource` directly won't work properly as the fetcher is not reactive and it won't invalidate properly. + +### `createAsyncStore` + +Similar to `createAsync` except it uses a deeply reactive store. Perfect for applying fine-grained changes to large model data that updates. +It also supports `latest` field which will be removed in the future. + +```jsx +const todos = createAsyncStore(() => getTodos()); +``` + +### `action` + +Actions are data mutations that can trigger invalidations and further routing. A list of prebuilt response helpers can be found below. + +```jsx +import { action, revalidate, redirect } from "@solidjs/router" + +// anywhere +const myAction = action(async (data) => { + await doMutation(data); + throw redirect("/", { revalidate: getUser.keyFor(data.id) }); // throw a response to do a redirect +}); + +// in component +
+ +//or + +``` + +Actions only work with post requests, so make sure to put `method="post"` on your form. + +Sometimes it might be easier to deal with typed data instead of `FormData` and adding additional hidden fields. For that reason Actions have a with method. That works similar to `bind` which applies the arguments in order. + +Picture an action that deletes Todo Item: + +```js +const deleteTodo = action(async (formData: FormData) => { + const id = Number(formData.get("id")) + await api.deleteTodo(id) +}) + + + + +
+``` + +Instead with `with` you can write this: + +```js +const deleteTodo = action(api.deleteTodo) + +
+ +
+``` + +Actions also take a second argument which can be the name or an option object with `name` and `onComplete`. `name` is used to identify SSR actions that aren't server functions (see note below). `onComplete` allows you to configure behavior when `action`s complete. Keep in mind `onComplete` does not work when JavaScript is disabled. + +#### Notes on `
` implementation and SSR + +This requires stable references as you can only serialize a string as an attribute, and across SSR they'd need to match. The solution is providing a unique name. + +```jsx +const myAction = action(async (args) => {}, "my-action"); +``` + +### `useAction` + +Instead of forms you can use actions directly by wrapping them in a `useAction` primitive. This is how we get the router context. + +```jsx +// in component +const submit = useAction(myAction); +submit(...args); +``` + +The outside of a form context you can use custom data instead of formData, and these helpers preserve types. However, even when used with server functions (in projects like SolidStart) this requires client side javascript and is not Progressive Enhanceable like forms are. + +### `useSubmission`/`useSubmissions` + +Are used to injecting the optimistic updates while actions are in flight. They either return a single Submission(latest) or all that match with an optional filter function. + +```jsx +type Submission = { + readonly input: T; + readonly result?: U; + readonly pending: boolean; + readonly url: string; + clear: () => void; + retry: () => void; +}; + +const submissions = useSubmissions(action, (input) => filter(input)); +const submission = useSubmission(action, (input) => filter(input)); +``` + +### Response Helpers + +These are used to communicate router navigations from query/actions, and can include invalidation hints. Generally these are thrown to not interfere the with the types and make it clear that function ends execution at that point. + +#### `redirect(path, options)` + +Redirects to the next route + +```js +const getUser = query(() => { + const user = await api.getCurrentUser() + if (!user) throw redirect("/login"); + return user; +}) +``` + +#### `reload(options)` + +Reloads the data on the current page + +```js +const getTodo = query(async (id: number) => { + const todo = await fetchTodo(id); + return todo; +}, "todo"); + +const updateTodo = action(async (todo: Todo) => { + await updateTodo(todo.id, todo); + reload({ revalidate: getTodo.keyFor(todo.id) }); +}); +``` + +## Config Based Routing + +You don't have to use JSX to set up your routes; you can pass an array of route definitions: + +```jsx +import { lazy } from "solid-js"; +import { render } from "solid-js/web"; +import { Router } from "@solidjs/router"; + +const routes = [ + { + path: "/users", + component: lazy(() => import("/pages/users.js")), + }, + { + path: "/users/:id", + component: lazy(() => import("/pages/users/[id].js")), + children: [ + { + path: "/", + component: lazy(() => import("/pages/users/[id]/index.js")), + }, + { + path: "/settings", + component: lazy(() => import("/pages/users/[id]/settings.js")), + }, + { + path: "/*all", + component: lazy(() => import("/pages/users/[id]/[...all].js")), + }, + ], + }, + { + path: "/", + component: lazy(() => import("/pages/index.js")), + }, + { + path: "/*all", + component: lazy(() => import("/pages/[...all].js")), + }, +]; + +render(() => {routes}, document.getElementById("app")); +``` + +Also you can pass a single route definition object for a single route: + +```jsx +import { lazy } from "solid-js"; +import { render } from "solid-js/web"; +import { Router } from "@solidjs/router"; + +const route = { + path: "/", + component: lazy(() => import("/pages/index.js")), +}; + +render(() => {route}, document.getElementById("app")); +``` + +## File-System Routing + +Solid Router ships an emission adapter for [`@solidjs/file-routes`](../file-routes) under `@solidjs/router/fs`. With the `@solidjs/file-routes/vite` plugin serving a route manifest from your `src/routes` directory, `` renders it as lazy, code-split route definitions: + +```js +// vite.config.ts +import { fileRoutes } from "@solidjs/file-routes/vite"; +import { defineConfig } from "vite"; +import solid from "vite-plugin-solid"; + +export default defineConfig({ + plugins: [solid({ extensions: [".jsx", ".tsx"] }), fileRoutes()] +}); +``` + +```jsx +import { Router } from "@solidjs/router"; +import { FileRoutes } from "@solidjs/router/fs"; + +const App = () => ( + {props.children}}> + + +); +``` + +See the [`@solidjs/file-routes` README](../file-routes/README.md) for the filename conventions and how to plug in your own. + +## Alternative Routers + +### Hash Mode Router + +By default, Solid Router uses `location.pathname` as route path. You can simply switch to hash mode through using ``. + +```jsx +import { HashRouter } from "@solidjs/router"; + +; +``` + +### Memory Mode Router + +You can also use memory mode router for testing purpose. + +```jsx +import { MemoryRouter } from "@solidjs/router"; + +; +``` + +### SSR Routing + +For SSR you can use the static router directly or the browser Router defaults to it on the server, just pass in the url. + +```jsx +import { isServer } from "solid-js/web"; +import { Router } from "@solidjs/router"; + +; +``` + +## Components + +### `` + +This is the main Router component for the browser. + +| prop | type | description | +| ------------- | -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| children | `JSX.Element`, `RouteDefinition`, or `RouteDefinition[]` | The route definitions | +| root | Component | Top level layout component | +| base | string | Base url to use for matching routes | +| actionBase | string | Root url for server actions, default: `/_server` | +| preload | boolean | Enables/disables preloads globally, default: `true` | +| explicitLinks | boolean | Disables all anchors being intercepted and instead requires ``. Default: `false`. (To disable interception for a specific link, set `target` to any value, e.g. ``.) | + +### `` + +Like the `` tag but supports automatic apply of base path + relative paths and active class styling (requires client side JavaScript). + +The `` tag has an `active` class if its href matches the current location, and `inactive` otherwise. **Note:** By default matching includes locations that are descendants (eg. href `/users` matches locations `/users` and `/users/123`), use the boolean `end` prop to prevent matching these. This is particularly useful for links to the root route `/` which would match everything. + +| prop | type | description | +| ------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| href | string | The path of the route to navigate to. This will be resolved relative to the route that the link is in, but you can preface it with `/` to refer back to the root. | +| noScroll | boolean | If true, turn off the default behavior of scrolling to the top of the new page | +| replace | boolean | If true, don't add a new entry to the browser history. (By default, the new page will be added to the browser history, so pressing the back button will take you to the previous route.) | +| state | unknown | [Push this value](https://developer.mozilla.org/en-US/docs/Web/API/History/pushState) to the history stack when navigating | +| inactiveClass | string | The class to show when the link is inactive (when the current location doesn't match the link) | +| activeClass | string | The class to show when the link is active | +| end | boolean | If `true`, only considers the link to be active when the current location matches the `href` exactly; if `false`, check if the current location _starts with_ `href` | + +### `` + +Solid Router provides a `Navigate` component that works similarly to `A`, but it will _immediately_ navigate to the provided path as soon as the component is rendered. It also uses the `href` prop, but you have the additional option of passing a function to `href` that returns a path to navigate to: + +```jsx +function getPath({ navigate, location }) { + // navigate is the result of calling useNavigate(); location is the result of calling useLocation(). + // You can use those to dynamically determine a path to navigate to + return "/some-path"; +} + +// Navigating to /redirect will redirect you to the result of getPath + } />; +``` + +### `` + +The Component for defining Routes: + +| prop | type | description | +| ------------ | ------------------ | ----------------------------------------------------------------- | +| path | string | Path partial for defining the route segment | +| component | `Component` | Component that will be rendered for the matched segment | +| matchFilters | `MatchFilters` | Additional constraints for matching against the route | +| children | `JSX.Element` | Nested `` definitions | +| preload | `RoutePreloadFunc` | Function called during preload or when the route is navigated to. | + +## Router Primitives + +Solid Router provides a number of primitives that read off the Router and Route context. + +### useParams + +Retrieves a reactive, store-like object containing the current route path parameters as defined in the Route. + +```js +const params = useParams(); + +// fetch user based on the id path parameter +const [user] = createResource(() => params.id, fetchUser); +``` + +### useNavigate + +Retrieves method to do navigation. The method accepts a path to navigate to and an optional object with the following options: + +- resolve (_boolean_, default `true`): resolve the path against the current route +- replace (_boolean_, default `false`): replace the history entry +- scroll (_boolean_, default `true`): scroll to top after navigation +- state (_any_, default `undefined`): pass custom state to `location.state` + +**Note:** The state is serialized using the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm) which does not support all object types. + +```js +const navigate = useNavigate(); + +if (unauthorized) { + navigate("/login", { replace: true }); +} +``` + +### useLocation + +Retrieves reactive `location` object useful for getting things like `pathname`. + +```js +const location = useLocation(); + +const pathname = createMemo(() => parsePath(location.pathname)); +``` + +### useSearchParams + +Retrieves a tuple containing a reactive object to read the current location's query parameters and a method to update them. The object is a proxy so you must access properties to subscribe to reactive updates. Note values will be strings and property names will retain their casing. + +The setter method accepts an object whose entries will be merged into the current query string. Values `''`, `undefined` and `null` will remove the key from the resulting query string. Updates will behave just like a navigation and the setter accepts the same optional second parameter as `navigate` and auto-scrolling is disabled by default. + +```js +const [searchParams, setSearchParams] = useSearchParams(); + +return ( +
+ Page: {searchParams.page} + +
+); +``` + +### useIsRouting + +Retrieves signal that indicates whether the route is currently in a Transition. Useful for showing stale/pending state when the route resolution is Suspended during concurrent rendering. + +```js +const isRouting = useIsRouting(); + +return ( +
+ +
+); +``` + +### useMatch + +`useMatch` takes an accessor that returns the path and creates a Memo that returns match information if the current path matches the provided path. Useful for determining if a given path matches the current route. + +```js +const match = useMatch(() => props.href); + +return
; +``` + +### useCurrentMatches + +`useCurrentMatches` returns all the matches for the current matched route. Useful for getting all the route information. + +For example if you stored breadcrumbs on your route definition you could retrieve them like so: + +```js +const matches = useCurrentMatches(); + +const breadcrumbs = createMemo(() => + matches().map((m) => m.route.info.breadcrumb) +); +``` + +### usePreloadRoute + +`usePreloadRoute` returns a function that can be used to preload a route manual. This is what happens automatically with link hovering and similar focus based behavior, but it is available here as an API. + +```js +const preload = usePreloadRoute(); + +preload(`/users/settings`, { preloadData: true }); +``` + +### useBeforeLeave + +`useBeforeLeave` takes a function that will be called prior to leaving a route. The function will be called with: + +- from (_Location_): current location (before change). +- to (_string | number_): path passed to `navigate`. +- options (_NavigateOptions_): options passed to `navigate`. +- preventDefault (_function_): call to block the route change. +- defaultPrevented (_readonly boolean_): `true` if any previously called leave handlers called `preventDefault`. +- retry (_function_, _force?: boolean_ ): call to retry the same navigation, perhaps after confirming with the user. Pass `true` to skip running the leave handlers again (i.e. force navigate without confirming). + +Example usage: + +```js +useBeforeLeave((e: BeforeLeaveEventArgs) => { + if (form.isDirty && !e.defaultPrevented) { + // preventDefault to block immediately and prompt user async + e.preventDefault(); + setTimeout(() => { + if (window.confirm("Discard unsaved changes - are you sure?")) { + // user wants to proceed anyway so retry with force=true + e.retry(true); + } + }, 100); + } +}); +``` + +## Migrations from 0.9.x + +v0.10.0 brings some big changes to support the future of routing including Islands/Partial Hydration hybrid solutions. Most notably there is no Context API available in non-hydrating parts of the application. + +The biggest changes are around removed APIs that need to be replaced. + +### ``, ``, `useRoutes` + +This is no longer used and instead will use `props.children` passed from into the page components for outlets. This keeps the outlet directly passed from its page and avoids oddness of trying to use context across Islands boundaries. Nested `` components inherently cause waterfalls and are `` themselves so they have the same concerns. + +Keep in mind no `` means the `` API is different. The `` acts as the `` component and its children can only be `` components. Your top-level layout should go in the root prop of the router [as shown above](#configure-your-routes) + +## `element` prop removed from `Route` + +Related without Outlet component it has to be passed in manually. At which point the `element` prop has less value. Removing the second way to define route components to reduce confusion and edge cases. + +### `data` functions & `useRouteData` + +These have been replaced by a preload mechanism. This allows link hover preloads (as the preload function can be run as much as wanted without worry about reactivity). It support deduping/query APIs which give more control over how things are cached. It also addresses TS issues with getting the right types in the Component without `typeof` checks. + +That being said you can reproduce the old pattern largely by turning off preloads at the router level and then injecting your own Context: + +```js +import { lazy } from "solid-js"; +import { Route } from "@solidjs/router"; + +const User = lazy(() => import("./pages/users/[id].js")); + +// preload function +function preloadUser({ params, location }) { + const [user] = createResource(() => params.id, fetchUser); + return user; +} + +// Pass it in the route definition + + +; +``` + +And then in your component taking the page props and putting them in a Context. + +```js +function User(props) { + + {/* my component content */} + ; +} + +// Somewhere else +function UserDetails() { + const user = useContext(UserContext); + // render stuff +} +``` + +## SPAs in Deployed Environments + +When deploying applications that use a client side router that does not rely on Server Side Rendering you need to handle redirects to your index page so that loading from other URLs does not cause your CDN or Hosting to return not found for pages that aren't actually there. + +Each provider has a different way of doing this. For example on Netlify you create a `_redirects` file that contains: + +```sh +/* /index.html 200 +``` + +On Vercel you add a rewrites section to your `vercel.json`: + +```json +{ + "rewrites": [ + { + "source": "/(.*)", + "destination": "/index.html" + } + ] +} +``` diff --git a/babel.config.cjs b/packages/router/babel.config.cjs similarity index 100% rename from babel.config.cjs rename to packages/router/babel.config.cjs diff --git a/packages/router/package.json b/packages/router/package.json new file mode 100644 index 00000000..55bb5e07 --- /dev/null +++ b/packages/router/package.json @@ -0,0 +1,66 @@ +{ + "name": "@solidjs/router", + "description": "Universal router for SolidJS", + "author": "Ryan Carniato", + "contributors": [ + "Ryan Turnquist" + ], + "license": "MIT", + "version": "0.16.2", + "homepage": "https://github.com/solidjs/solid-router#readme", + "repository": { + "type": "git", + "url": "https://github.com/solidjs/solid-router", + "directory": "packages/router" + }, + "publishConfig": { + "access": "public" + }, + "type": "module", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "exports": { + ".": { + "solid": "./dist/index.jsx", + "default": "./dist/index.js" + }, + "./fs": { + "types": "./dist/fs.d.ts", + "default": "./dist/fs.js" + } + }, + "files": [ + "dist" + ], + "sideEffects": false, + "scripts": { + "build": "rm -rf dist && tsc && rollup -c", + "prepublishOnly": "npm run build", + "test": "vitest run && npm run test:types", + "test:watch": "vitest", + "test:types": "tsc --project tsconfig.test.json", + "pretty": "prettier --write \"{src,test}/**/*.{ts,tsx}\"", + "typecheck:dist": "pnpx @arethetypeswrong/cli --pack . --profile esm-only" + }, + "devDependencies": { + "@babel/core": "^7.26.0", + "@babel/preset-typescript": "^7.26.0", + "@rollup/plugin-babel": "6.0.4", + "@rollup/plugin-node-resolve": "15.3.0", + "@rollup/plugin-terser": "0.4.4", + "@types/jest": "^29.5.14", + "@types/node": "^22.10.0", + "babel-preset-solid": "^1.9.3", + "jsdom": "^25.0.1", + "prettier": "^3.4.1", + "rollup": "^4.27.4", + "solid-js": "^1.9.3", + "typescript": "^5.7.2", + "vite": "^6.0.0", + "vite-plugin-solid": "^2.11.0", + "vitest": "^2.1.6" + }, + "peerDependencies": { + "solid-js": "^1.8.6" + } +} diff --git a/rollup.config.js b/packages/router/rollup.config.js similarity index 100% rename from rollup.config.js rename to packages/router/rollup.config.js diff --git a/src/components.tsx b/packages/router/src/components.tsx similarity index 100% rename from src/components.tsx rename to packages/router/src/components.tsx diff --git a/src/data/action.ts b/packages/router/src/data/action.ts similarity index 100% rename from src/data/action.ts rename to packages/router/src/data/action.ts diff --git a/src/data/createAsync.ts b/packages/router/src/data/createAsync.ts similarity index 100% rename from src/data/createAsync.ts rename to packages/router/src/data/createAsync.ts diff --git a/src/data/events.ts b/packages/router/src/data/events.ts similarity index 100% rename from src/data/events.ts rename to packages/router/src/data/events.ts diff --git a/src/data/index.ts b/packages/router/src/data/index.ts similarity index 100% rename from src/data/index.ts rename to packages/router/src/data/index.ts diff --git a/src/data/query.ts b/packages/router/src/data/query.ts similarity index 100% rename from src/data/query.ts rename to packages/router/src/data/query.ts diff --git a/src/data/response.ts b/packages/router/src/data/response.ts similarity index 100% rename from src/data/response.ts rename to packages/router/src/data/response.ts diff --git a/packages/router/src/file-routes.d.ts b/packages/router/src/file-routes.d.ts new file mode 100644 index 00000000..64b0db7c --- /dev/null +++ b/packages/router/src/file-routes.d.ts @@ -0,0 +1,8 @@ +/** + * The virtual route manifest module served by a `@solidjs/file-routes` + * delivery adapter (e.g. `@solidjs/file-routes/vite`). + */ +declare module "solid:file-routes" { + const routes: import("./fs.js").FileRouteEntry[]; + export default routes; +} diff --git a/packages/router/src/fs.ts b/packages/router/src/fs.ts new file mode 100644 index 00000000..2b881165 --- /dev/null +++ b/packages/router/src/fs.ts @@ -0,0 +1,136 @@ +/*@refresh skip*/ + +import { lazy, type Component, type JSX } from "solid-js"; +import fileRoutes from "solid:file-routes"; +import type { RouteDefinition } from "./types.js"; + +/** + * Solid Router's emission adapter for `@solidjs/file-routes`. + * + * A file-system routing delivery adapter (e.g. `@solidjs/file-routes/vite`) + * serves a flat, router-neutral route manifest from the `solid:file-routes` + * virtual module; this module turns it into Solid Router's own shape: + * nested `RouteDefinition`s with lazy components. + */ + +/** A code-split ref to a route module produced by a delivery adapter. */ +export interface FileRouteLazyRef { + src: string; + import(): Promise>; +} + +/** An eagerly required ref to a route module produced by a delivery adapter. */ +export interface FileRouteEagerRef { + require(): Record; +} + +/** A flat entry of the neutral route manifest. */ +export interface FileRouteEntry { + /** + * Route path in the neutral pattern language (`:param`, `:param?`, + * `*rest`), with `(group)` segments still present. + */ + path: string; + /** `true` when the module renders a page. */ + page?: boolean; + /** The page component module. */ + $component?: FileRouteLazyRef; + /** The route config (`route` export), when present. */ + $$route?: FileRouteEagerRef; + [key: string]: unknown; +} + +interface FileRouteTreeEntry extends FileRouteEntry { + id: string; + children?: FileRouteTreeEntry[]; +} + +/** + * Nests the flat manifest by path prefix and strips `(group)` segments, + * so `/(app)/dashboard` renders at `/dashboard` inside the `/(app)` layout. + */ +function buildRouteTree(entries: FileRouteEntry[]): FileRouteTreeEntry[] { + function processRoute(routes: FileRouteTreeEntry[], route: FileRouteEntry, id: string) { + const parentRoute = routes.find(o => id.startsWith(o.id + "/")); + + if (!parentRoute) { + routes.push({ + ...route, + id, + path: id.replace(/\([^)/]+\)/g, "").replace(/\/+/g, "/") + }); + return; + } + processRoute( + parentRoute.children || (parentRoute.children = []), + route, + id.slice(parentRoute.id.length) + ); + } + + return entries + .filter(entry => entry.page) + .sort((a, b) => a.path.length - b.path.length) + .reduce((routes: FileRouteTreeEntry[], route) => { + processRoute(routes, route, route.path); + return routes; + }, []); +} + +// Cached by source path so a module that appears in several routes only +// creates one lazy component and is only fetched once. +const components = new Map(); + +function createRoute(entry: FileRouteTreeEntry): RouteDefinition { + let component: Component | undefined; + if (entry.$component) { + component = components.get(entry.$component.src); + if (!component) { + component = lazy(entry.$component.import as () => Promise<{ default: Component }>); + components.set(entry.$component.src, component); + } + } + + const config = (entry.$$route ? entry.$$route.require().route : undefined) as + | (Omit, "path" | "component" | "children"> & { + info?: Record; + }) + | undefined; + + return { + ...config, + path: entry.path, + component, + info: { + ...config?.info, + filesystem: true + }, + children: entry.children ? entry.children.map(createRoute) : undefined + }; +} + +/** Turns a flat route manifest into nested Solid Router `RouteDefinition`s. */ +export function createFileRoutes(manifest: FileRouteEntry[]): RouteDefinition[] { + return buildRouteTree(manifest).map(createRoute); +} + +let routes: RouteDefinition[] | undefined; + +/** + * Renders the file-system routes served by a `@solidjs/file-routes` delivery + * adapter. Place it as `` children: + * + * ```tsx + * import { Router } from "@solidjs/router"; + * import { FileRoutes } from "@solidjs/router/fs"; + * + * const App = () => ( + * + * + * + * ); + * ``` + */ +export function FileRoutes(): JSX.Element { + return (routes ??= createFileRoutes(fileRoutes)) as unknown as JSX.Element; +} diff --git a/src/index.tsx b/packages/router/src/index.tsx similarity index 100% rename from src/index.tsx rename to packages/router/src/index.tsx diff --git a/src/lifecycle.ts b/packages/router/src/lifecycle.ts similarity index 100% rename from src/lifecycle.ts rename to packages/router/src/lifecycle.ts diff --git a/src/routers/HashRouter.ts b/packages/router/src/routers/HashRouter.ts similarity index 100% rename from src/routers/HashRouter.ts rename to packages/router/src/routers/HashRouter.ts diff --git a/src/routers/MemoryRouter.ts b/packages/router/src/routers/MemoryRouter.ts similarity index 100% rename from src/routers/MemoryRouter.ts rename to packages/router/src/routers/MemoryRouter.ts diff --git a/src/routers/Router.ts b/packages/router/src/routers/Router.ts similarity index 100% rename from src/routers/Router.ts rename to packages/router/src/routers/Router.ts diff --git a/src/routers/StaticRouter.ts b/packages/router/src/routers/StaticRouter.ts similarity index 100% rename from src/routers/StaticRouter.ts rename to packages/router/src/routers/StaticRouter.ts diff --git a/src/routers/components.tsx b/packages/router/src/routers/components.tsx similarity index 100% rename from src/routers/components.tsx rename to packages/router/src/routers/components.tsx diff --git a/src/routers/createRouter.ts b/packages/router/src/routers/createRouter.ts similarity index 100% rename from src/routers/createRouter.ts rename to packages/router/src/routers/createRouter.ts diff --git a/src/routers/index.ts b/packages/router/src/routers/index.ts similarity index 100% rename from src/routers/index.ts rename to packages/router/src/routers/index.ts diff --git a/src/routing.ts b/packages/router/src/routing.ts similarity index 100% rename from src/routing.ts rename to packages/router/src/routing.ts diff --git a/src/types.ts b/packages/router/src/types.ts similarity index 100% rename from src/types.ts rename to packages/router/src/types.ts diff --git a/src/utils.ts b/packages/router/src/utils.ts similarity index 100% rename from src/utils.ts rename to packages/router/src/utils.ts diff --git a/test/cached-error.spec.tsx b/packages/router/test/cached-error.spec.tsx similarity index 100% rename from test/cached-error.spec.tsx rename to packages/router/test/cached-error.spec.tsx diff --git a/test/data.spec.tsx b/packages/router/test/data.spec.tsx similarity index 100% rename from test/data.spec.tsx rename to packages/router/test/data.spec.tsx diff --git a/test/data/action.spec.ts b/packages/router/test/data/action.spec.ts similarity index 100% rename from test/data/action.spec.ts rename to packages/router/test/data/action.spec.ts diff --git a/test/data/createAsync.spec.ts b/packages/router/test/data/createAsync.spec.ts similarity index 100% rename from test/data/createAsync.spec.ts rename to packages/router/test/data/createAsync.spec.ts diff --git a/test/data/events.spec.ts b/packages/router/test/data/events.spec.ts similarity index 100% rename from test/data/events.spec.ts rename to packages/router/test/data/events.spec.ts diff --git a/test/data/query.spec.ts b/packages/router/test/data/query.spec.ts similarity index 100% rename from test/data/query.spec.ts rename to packages/router/test/data/query.spec.ts diff --git a/test/data/response.spec.ts b/packages/router/test/data/response.spec.ts similarity index 100% rename from test/data/response.spec.ts rename to packages/router/test/data/response.spec.ts diff --git a/packages/router/test/fixtures/file-routes-manifest.ts b/packages/router/test/fixtures/file-routes-manifest.ts new file mode 100644 index 00000000..cb0a51f5 --- /dev/null +++ b/packages/router/test/fixtures/file-routes-manifest.ts @@ -0,0 +1,24 @@ +// A stand-in for the `solid:file-routes` virtual module that a +// `@solidjs/file-routes` delivery adapter serves at build time. +import type { FileRouteEntry } from "../../src/fs.js"; + +const manifest: FileRouteEntry[] = [ + { + path: "/", + page: true, + $component: { + src: "src/routes/index.tsx", + import: async () => ({ default: () => "Home" }) + } + }, + { + path: "/about", + page: true, + $component: { + src: "src/routes/about.tsx", + import: async () => ({ default: () => "About" }) + } + } +]; + +export default manifest; diff --git a/packages/router/test/fs-render.spec.tsx b/packages/router/test/fs-render.spec.tsx new file mode 100644 index 00000000..c64915ba --- /dev/null +++ b/packages/router/test/fs-render.spec.tsx @@ -0,0 +1,40 @@ +// @vitest-environment jsdom +import { Suspense, type ParentProps } from "solid-js"; +import { render } from "solid-js/web"; +import { MemoryRouter, createMemoryHistory } from "../src/index.jsx"; +import { FileRoutes } from "../src/fs.js"; + +const wait = (ms: number) => new Promise(r => setTimeout(r, ms)); + +describe("FileRoutes rendering", () => { + test("renders manifest routes inside a Router", async () => { + const history = createMemoryHistory(); + history.set({ value: "/" }); + const Layout = (props: ParentProps) => ( +
+ + {props.children} +
+ ); + const root = document.createElement("div"); + document.body.appendChild(root); + const dispose = render( + () => ( + + + + ), + root + ); + + await wait(50); + expect(root.innerHTML).toContain("Home"); + + history.set({ value: "/about" }); + await wait(50); + expect(root.innerHTML).toContain("About"); + + dispose(); + document.body.removeChild(root); + }); +}); diff --git a/packages/router/test/fs.spec.tsx b/packages/router/test/fs.spec.tsx new file mode 100644 index 00000000..62f33379 --- /dev/null +++ b/packages/router/test/fs.spec.tsx @@ -0,0 +1,90 @@ +import { describe, expect, it } from "vitest"; + +import { createFileRoutes, FileRoutes, type FileRouteEntry } from "../src/fs.js"; +import type { RouteDefinition } from "../src/types.js"; + +const page = (src: string): FileRouteEntry["$component"] => ({ + src, + import: async () => ({ default: () => null }) +}); + +describe("createFileRoutes", () => { + it("emits lazy RouteDefinitions marked as filesystem routes", () => { + const routes = createFileRoutes([ + { path: "/", page: true, $component: page("routes/index.tsx") } + ]); + + expect(routes).toHaveLength(1); + expect(routes[0].path).toBe("/"); + expect(typeof routes[0].component).toBe("function"); + expect(routes[0].info).toEqual({ filesystem: true }); + }); + + it("skips non-page entries", () => { + const routes = createFileRoutes([ + { path: "/api/data", page: false }, + { path: "/", page: true, $component: page("routes/index.tsx") } + ]); + + expect(routes.map(r => r.path)).toEqual(["/"]); + }); + + it("nests child routes under their parent by path prefix", () => { + const routes = createFileRoutes([ + { path: "/blog", page: true, $component: page("routes/blog.tsx") }, + { path: "/blog/:id", page: true, $component: page("routes/blog/[id].tsx") } + ]); + + expect(routes).toHaveLength(1); + expect(routes[0].path).toBe("/blog"); + const children = routes[0].children as RouteDefinition[]; + expect(children).toHaveLength(1); + expect(children[0].path).toBe("/:id"); + }); + + it("strips (group) segments from paths while nesting inside them", () => { + const routes = createFileRoutes([ + { path: "/(marketing)", page: true, $component: page("routes/(marketing).tsx") }, + { path: "/(marketing)/about", page: true, $component: page("routes/(marketing)/about.tsx") } + ]); + + expect(routes).toHaveLength(1); + expect(routes[0].path).toBe("/"); + const children = routes[0].children as RouteDefinition[]; + expect(children[0].path).toBe("/about"); + }); + + it("merges the route config export into the definition", () => { + const preload = () => {}; + const routes = createFileRoutes([ + { + path: "/", + page: true, + $component: page("routes/index.tsx"), + $$route: { require: () => ({ route: { preload, info: { title: "Home" } } }) } + } + ]); + + expect(routes[0].preload).toBe(preload); + expect(routes[0].info).toEqual({ title: "Home", filesystem: true }); + }); + + it("reuses one lazy component per source module", () => { + const shared = page("routes/shared.tsx"); + const [a] = createFileRoutes([{ path: "/a", page: true, $component: shared }]); + const [b] = createFileRoutes([{ path: "/b", page: true, $component: shared }]); + + expect(a.component).toBe(b.component); + }); +}); + +describe("FileRoutes", () => { + it("renders the manifest served by the delivery adapter", () => { + const routes = FileRoutes() as unknown as RouteDefinition[]; + + expect(routes.map(r => r.path)).toEqual(["/", "/about"]); + expect(routes.every(r => (r.info as any).filesystem)).toBe(true); + // memoized across renders + expect(FileRoutes()).toBe(routes as unknown as ReturnType); + }); +}); diff --git a/test/helpers.ts b/packages/router/test/helpers.ts similarity index 100% rename from test/helpers.ts rename to packages/router/test/helpers.ts diff --git a/test/integration.spec.ts b/packages/router/test/integration.spec.ts similarity index 100% rename from test/integration.spec.ts rename to packages/router/test/integration.spec.ts diff --git a/test/lifecycle.spec.ts b/packages/router/test/lifecycle.spec.ts similarity index 100% rename from test/lifecycle.spec.ts rename to packages/router/test/lifecycle.spec.ts diff --git a/test/route.spec.ts b/packages/router/test/route.spec.ts similarity index 100% rename from test/route.spec.ts rename to packages/router/test/route.spec.ts diff --git a/test/router.spec.ts b/packages/router/test/router.spec.ts similarity index 100% rename from test/router.spec.ts rename to packages/router/test/router.spec.ts diff --git a/test/routes-disposal.spec.tsx b/packages/router/test/routes-disposal.spec.tsx similarity index 100% rename from test/routes-disposal.spec.tsx rename to packages/router/test/routes-disposal.spec.tsx diff --git a/test/search-params.spec.tsx b/packages/router/test/search-params.spec.tsx similarity index 100% rename from test/search-params.spec.tsx rename to packages/router/test/search-params.spec.tsx diff --git a/test/setup.ts b/packages/router/test/setup.ts similarity index 100% rename from test/setup.ts rename to packages/router/test/setup.ts diff --git a/test/tsconfig.json b/packages/router/test/tsconfig.json similarity index 100% rename from test/tsconfig.json rename to packages/router/test/tsconfig.json diff --git a/test/types.spec.ts b/packages/router/test/types.spec.ts similarity index 100% rename from test/types.spec.ts rename to packages/router/test/types.spec.ts diff --git a/test/utils.spec.ts b/packages/router/test/utils.spec.ts similarity index 100% rename from test/utils.spec.ts rename to packages/router/test/utils.spec.ts diff --git a/tsconfig.json b/packages/router/tsconfig.json similarity index 100% rename from tsconfig.json rename to packages/router/tsconfig.json diff --git a/tsconfig.test.json b/packages/router/tsconfig.test.json similarity index 77% rename from tsconfig.test.json rename to packages/router/tsconfig.test.json index 45b86723..20c3f209 100644 --- a/tsconfig.test.json +++ b/packages/router/tsconfig.test.json @@ -5,6 +5,6 @@ "skipLibCheck": true, "rootDir": "." }, - "include": ["test"], + "include": ["test", "src/file-routes.d.ts"], "exclude": ["node_modules"] } diff --git a/vitest.config.ts b/packages/router/vitest.config.ts similarity index 65% rename from vitest.config.ts rename to packages/router/vitest.config.ts index bf3d6e7d..62d3042b 100644 --- a/vitest.config.ts +++ b/packages/router/vitest.config.ts @@ -4,7 +4,12 @@ import solidPlugin from "vite-plugin-solid"; export default defineConfig({ plugins: [solidPlugin() as Plugin], resolve: { - conditions: ["module", "browser", "development|production"] + conditions: ["module", "browser", "development|production"], + alias: { + // the virtual manifest module a file-routes delivery adapter serves + "solid:file-routes": new URL("./test/fixtures/file-routes-manifest.ts", import.meta.url) + .pathname + } }, ssr: { resolve: { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bc2039de..e80108cd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,19 +7,84 @@ settings: importers: .: + devDependencies: + '@changesets/cli': + specifier: ^2.27.10 + version: 2.27.10 + + examples/file-routes: + dependencies: + '@solidjs/file-routes': + specifier: workspace:* + version: link:../../packages/file-routes + '@solidjs/router': + specifier: workspace:* + version: link:../../packages/router + solid-js: + specifier: ^1.9.3 + version: 1.9.3 + devDependencies: + typescript: + specifier: ^5.7.2 + version: 5.7.2 + vite: + specifier: ^6.0.0 + version: 6.0.0(@types/node@22.10.0)(terser@5.36.0) + vite-plugin-solid: + specifier: ^2.11.0 + version: 2.11.0(solid-js@1.9.3)(vite@6.0.0(@types/node@22.10.0)(terser@5.36.0)) + + packages/file-routes: + dependencies: + '@babel/core': + specifier: ^7.29.0 + version: 7.29.7 + '@types/babel__core': + specifier: ^7.20.5 + version: 7.20.5 + '@types/babel__traverse': + specifier: ^7.28.0 + version: 7.28.0 + '@types/micromatch': + specifier: ^4.0.10 + version: 4.0.10 + fast-glob: + specifier: ^3.3.3 + version: 3.3.3 + micromatch: + specifier: ^4.0.8 + version: 4.0.8 + oxc-parser: + specifier: ^0.139.0 + version: 0.139.0 + devDependencies: + '@types/node': + specifier: ^22.10.0 + version: 22.10.0 + prettier: + specifier: ^3.4.1 + version: 3.4.1 + typescript: + specifier: ^5.7.2 + version: 5.7.2 + vite: + specifier: ^6.0.0 + version: 6.0.0(@types/node@22.10.0)(terser@5.36.0) + vitest: + specifier: ^2.1.6 + version: 2.1.6(@types/node@22.10.0)(jsdom@25.0.1)(terser@5.36.0) + + packages/router: devDependencies: '@babel/core': specifier: ^7.26.0 - version: 7.26.0 + version: 7.29.7 '@babel/preset-typescript': specifier: ^7.26.0 - version: 7.26.0(@babel/core@7.26.0) - '@changesets/cli': - specifier: ^2.27.10 - version: 2.27.10 + version: 7.26.0(@babel/core@7.29.7) '@rollup/plugin-babel': specifier: 6.0.4 - version: 6.0.4(@babel/core@7.26.0)(@types/babel__core@7.20.5)(rollup@4.27.4) + version: 6.0.4(@babel/core@7.29.7)(@types/babel__core@7.20.5)(rollup@4.27.4) '@rollup/plugin-node-resolve': specifier: 15.3.0 version: 15.3.0(rollup@4.27.4) @@ -34,7 +99,7 @@ importers: version: 22.10.0 babel-preset-solid: specifier: ^1.9.3 - version: 1.9.3(@babel/core@7.26.0) + version: 1.9.3(@babel/core@7.29.7) jsdom: specifier: ^25.0.1 version: 25.0.1 @@ -62,32 +127,28 @@ importers: packages: - '@ampproject/remapping@2.3.0': - resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} - engines: {node: '>=6.0.0'} - - '@babel/code-frame@7.26.2': - resolution: {integrity: sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==} + '@babel/code-frame@7.29.7': + resolution: {integrity: sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==} engines: {node: '>=6.9.0'} - '@babel/compat-data@7.26.2': - resolution: {integrity: sha512-Z0WgzSEa+aUcdiJuCIqgujCshpMWgUpgOxXotrYPSA53hA3qopNaqcJpyr0hVb1FeWdnqFA35/fUtXgBK8srQg==} + '@babel/compat-data@7.29.7': + resolution: {integrity: sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==} engines: {node: '>=6.9.0'} - '@babel/core@7.26.0': - resolution: {integrity: sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==} + '@babel/core@7.29.7': + resolution: {integrity: sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==} engines: {node: '>=6.9.0'} - '@babel/generator@7.26.2': - resolution: {integrity: sha512-zevQbhbau95nkoxSq3f/DC/SC+EEOUZd3DYqfSkMhY2/wfSeaHV1Ew4vk8e+x8lja31IbyuUa2uQ3JONqKbysw==} + '@babel/generator@7.29.7': + resolution: {integrity: sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ==} engines: {node: '>=6.9.0'} '@babel/helper-annotate-as-pure@7.25.9': resolution: {integrity: sha512-gv7320KBUFJz1RnylIg5WWYPRXKZ884AGkYpgpWW02TH66Dl+HaC1t1CKd0z3R4b6hdYEcmrNZHUmfCP+1u3/g==} engines: {node: '>=6.9.0'} - '@babel/helper-compilation-targets@7.25.9': - resolution: {integrity: sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==} + '@babel/helper-compilation-targets@7.29.7': + resolution: {integrity: sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==} engines: {node: '>=6.9.0'} '@babel/helper-create-class-features-plugin@7.25.9': @@ -96,6 +157,10 @@ packages: peerDependencies: '@babel/core': ^7.0.0 + '@babel/helper-globals@7.29.7': + resolution: {integrity: sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==} + engines: {node: '>=6.9.0'} + '@babel/helper-member-expression-to-functions@7.25.9': resolution: {integrity: sha512-wbfdZ9w5vk0C0oyHqAJbc62+vet5prjj01jjJ8sKn3j9h3MQQlflEdXYvuqRWjHnM12coDEqiC1IRCi0U/EKwQ==} engines: {node: '>=6.9.0'} @@ -104,16 +169,12 @@ packages: resolution: {integrity: sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==} engines: {node: '>=6.9.0'} - '@babel/helper-module-imports@7.22.15': - resolution: {integrity: sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==} + '@babel/helper-module-imports@7.29.7': + resolution: {integrity: sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==} engines: {node: '>=6.9.0'} - '@babel/helper-module-imports@7.25.9': - resolution: {integrity: sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==} - engines: {node: '>=6.9.0'} - - '@babel/helper-module-transforms@7.26.0': - resolution: {integrity: sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==} + '@babel/helper-module-transforms@7.29.7': + resolution: {integrity: sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 @@ -140,32 +201,24 @@ packages: resolution: {integrity: sha512-K4Du3BFa3gvyhzgPcntrkDgZzQaq6uozzcpGbOO1OEJaI+EJdqWIMTLgFgQf6lrfiDFo5FU+BxKepI9RmZqahA==} engines: {node: '>=6.9.0'} - '@babel/helper-string-parser@7.22.5': - resolution: {integrity: sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==} - engines: {node: '>=6.9.0'} - - '@babel/helper-string-parser@7.25.9': - resolution: {integrity: sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==} + '@babel/helper-string-parser@7.29.7': + resolution: {integrity: sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==} engines: {node: '>=6.9.0'} - '@babel/helper-validator-identifier@7.22.20': - resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} + '@babel/helper-validator-identifier@7.29.7': + resolution: {integrity: sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==} engines: {node: '>=6.9.0'} - '@babel/helper-validator-identifier@7.25.9': - resolution: {integrity: sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==} + '@babel/helper-validator-option@7.29.7': + resolution: {integrity: sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==} engines: {node: '>=6.9.0'} - '@babel/helper-validator-option@7.25.9': - resolution: {integrity: sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==} + '@babel/helpers@7.29.7': + resolution: {integrity: sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==} engines: {node: '>=6.9.0'} - '@babel/helpers@7.26.0': - resolution: {integrity: sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==} - engines: {node: '>=6.9.0'} - - '@babel/parser@7.26.2': - resolution: {integrity: sha512-DWMCZH9WA4Maitz2q21SRKHo9QXZxkDsbNZoVD62gusNtNBBqDg9i7uOhASfTfIGNzW+O+r7+jAlM8dwphcJKQ==} + '@babel/parser@7.29.7': + resolution: {integrity: sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==} engines: {node: '>=6.0.0'} hasBin: true @@ -203,20 +256,16 @@ packages: resolution: {integrity: sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==} engines: {node: '>=6.9.0'} - '@babel/template@7.25.9': - resolution: {integrity: sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==} - engines: {node: '>=6.9.0'} - - '@babel/traverse@7.25.9': - resolution: {integrity: sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw==} + '@babel/template@7.29.7': + resolution: {integrity: sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==} engines: {node: '>=6.9.0'} - '@babel/types@7.23.3': - resolution: {integrity: sha512-OZnvoH2l8PK5eUvEcUyCt/sXgr/h+UWpVuBbOljwcrAgUl6lpchoQ++PHGyQy1AtYnVA6CEq3y5xeEI10brpXw==} + '@babel/traverse@7.29.7': + resolution: {integrity: sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw==} engines: {node: '>=6.9.0'} - '@babel/types@7.26.0': - resolution: {integrity: sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA==} + '@babel/types@7.29.7': + resolution: {integrity: sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==} engines: {node: '>=6.9.0'} '@changesets/apply-release-plan@7.0.6': @@ -274,11 +323,14 @@ packages: '@changesets/write@0.3.2': resolution: {integrity: sha512-kDxDrPNpUgsjDbWBvUo27PzKX4gqeKOlhibaOXDJA6kuBisGqNHv/HwGJrAu8U/dSf8ZEFIeHIPtvSlZI1kULw==} - '@esbuild/aix-ppc64@0.21.5': - resolution: {integrity: sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==} - engines: {node: '>=12'} - cpu: [ppc64] - os: [aix] + '@emnapi/core@1.11.1': + resolution: {integrity: sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==} + + '@emnapi/runtime@1.11.1': + resolution: {integrity: sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==} + + '@emnapi/wasi-threads@1.2.2': + resolution: {integrity: sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==} '@esbuild/aix-ppc64@0.24.0': resolution: {integrity: sha512-WtKdFM7ls47zkKHFVzMz8opM7LkcsIp9amDUBIAWirg70RM71WRSjdILPsY5Uv1D42ZpUfaPILDlfactHgsRkw==} @@ -286,204 +338,102 @@ packages: cpu: [ppc64] os: [aix] - '@esbuild/android-arm64@0.21.5': - resolution: {integrity: sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==} - engines: {node: '>=12'} - cpu: [arm64] - os: [android] - '@esbuild/android-arm64@0.24.0': resolution: {integrity: sha512-Vsm497xFM7tTIPYK9bNTYJyF/lsP590Qc1WxJdlB6ljCbdZKU9SY8i7+Iin4kyhV/KV5J2rOKsBQbB77Ab7L/w==} engines: {node: '>=18'} cpu: [arm64] os: [android] - '@esbuild/android-arm@0.21.5': - resolution: {integrity: sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==} - engines: {node: '>=12'} - cpu: [arm] - os: [android] - '@esbuild/android-arm@0.24.0': resolution: {integrity: sha512-arAtTPo76fJ/ICkXWetLCc9EwEHKaeya4vMrReVlEIUCAUncH7M4bhMQ+M9Vf+FFOZJdTNMXNBrWwW+OXWpSew==} engines: {node: '>=18'} cpu: [arm] os: [android] - '@esbuild/android-x64@0.21.5': - resolution: {integrity: sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==} - engines: {node: '>=12'} - cpu: [x64] - os: [android] - '@esbuild/android-x64@0.24.0': resolution: {integrity: sha512-t8GrvnFkiIY7pa7mMgJd7p8p8qqYIz1NYiAoKc75Zyv73L3DZW++oYMSHPRarcotTKuSs6m3hTOa5CKHaS02TQ==} engines: {node: '>=18'} cpu: [x64] os: [android] - '@esbuild/darwin-arm64@0.21.5': - resolution: {integrity: sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==} - engines: {node: '>=12'} - cpu: [arm64] - os: [darwin] - '@esbuild/darwin-arm64@0.24.0': resolution: {integrity: sha512-CKyDpRbK1hXwv79soeTJNHb5EiG6ct3efd/FTPdzOWdbZZfGhpbcqIpiD0+vwmpu0wTIL97ZRPZu8vUt46nBSw==} engines: {node: '>=18'} cpu: [arm64] os: [darwin] - '@esbuild/darwin-x64@0.21.5': - resolution: {integrity: sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==} - engines: {node: '>=12'} - cpu: [x64] - os: [darwin] - '@esbuild/darwin-x64@0.24.0': resolution: {integrity: sha512-rgtz6flkVkh58od4PwTRqxbKH9cOjaXCMZgWD905JOzjFKW+7EiUObfd/Kav+A6Gyud6WZk9w+xu6QLytdi2OA==} engines: {node: '>=18'} cpu: [x64] os: [darwin] - '@esbuild/freebsd-arm64@0.21.5': - resolution: {integrity: sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==} - engines: {node: '>=12'} - cpu: [arm64] - os: [freebsd] - '@esbuild/freebsd-arm64@0.24.0': resolution: {integrity: sha512-6Mtdq5nHggwfDNLAHkPlyLBpE5L6hwsuXZX8XNmHno9JuL2+bg2BX5tRkwjyfn6sKbxZTq68suOjgWqCicvPXA==} engines: {node: '>=18'} cpu: [arm64] os: [freebsd] - '@esbuild/freebsd-x64@0.21.5': - resolution: {integrity: sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [freebsd] - '@esbuild/freebsd-x64@0.24.0': resolution: {integrity: sha512-D3H+xh3/zphoX8ck4S2RxKR6gHlHDXXzOf6f/9dbFt/NRBDIE33+cVa49Kil4WUjxMGW0ZIYBYtaGCa2+OsQwQ==} engines: {node: '>=18'} cpu: [x64] os: [freebsd] - '@esbuild/linux-arm64@0.21.5': - resolution: {integrity: sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==} - engines: {node: '>=12'} - cpu: [arm64] - os: [linux] - '@esbuild/linux-arm64@0.24.0': resolution: {integrity: sha512-TDijPXTOeE3eaMkRYpcy3LarIg13dS9wWHRdwYRnzlwlA370rNdZqbcp0WTyyV/k2zSxfko52+C7jU5F9Tfj1g==} engines: {node: '>=18'} cpu: [arm64] os: [linux] - '@esbuild/linux-arm@0.21.5': - resolution: {integrity: sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==} - engines: {node: '>=12'} - cpu: [arm] - os: [linux] - '@esbuild/linux-arm@0.24.0': resolution: {integrity: sha512-gJKIi2IjRo5G6Glxb8d3DzYXlxdEj2NlkixPsqePSZMhLudqPhtZ4BUrpIuTjJYXxvF9njql+vRjB2oaC9XpBw==} engines: {node: '>=18'} cpu: [arm] os: [linux] - '@esbuild/linux-ia32@0.21.5': - resolution: {integrity: sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==} - engines: {node: '>=12'} - cpu: [ia32] - os: [linux] - '@esbuild/linux-ia32@0.24.0': resolution: {integrity: sha512-K40ip1LAcA0byL05TbCQ4yJ4swvnbzHscRmUilrmP9Am7//0UjPreh4lpYzvThT2Quw66MhjG//20mrufm40mA==} engines: {node: '>=18'} cpu: [ia32] os: [linux] - '@esbuild/linux-loong64@0.21.5': - resolution: {integrity: sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==} - engines: {node: '>=12'} - cpu: [loong64] - os: [linux] - '@esbuild/linux-loong64@0.24.0': resolution: {integrity: sha512-0mswrYP/9ai+CU0BzBfPMZ8RVm3RGAN/lmOMgW4aFUSOQBjA31UP8Mr6DDhWSuMwj7jaWOT0p0WoZ6jeHhrD7g==} engines: {node: '>=18'} cpu: [loong64] os: [linux] - '@esbuild/linux-mips64el@0.21.5': - resolution: {integrity: sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==} - engines: {node: '>=12'} - cpu: [mips64el] - os: [linux] - '@esbuild/linux-mips64el@0.24.0': resolution: {integrity: sha512-hIKvXm0/3w/5+RDtCJeXqMZGkI2s4oMUGj3/jM0QzhgIASWrGO5/RlzAzm5nNh/awHE0A19h/CvHQe6FaBNrRA==} engines: {node: '>=18'} cpu: [mips64el] os: [linux] - '@esbuild/linux-ppc64@0.21.5': - resolution: {integrity: sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==} - engines: {node: '>=12'} - cpu: [ppc64] - os: [linux] - '@esbuild/linux-ppc64@0.24.0': resolution: {integrity: sha512-HcZh5BNq0aC52UoocJxaKORfFODWXZxtBaaZNuN3PUX3MoDsChsZqopzi5UupRhPHSEHotoiptqikjN/B77mYQ==} engines: {node: '>=18'} cpu: [ppc64] os: [linux] - '@esbuild/linux-riscv64@0.21.5': - resolution: {integrity: sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==} - engines: {node: '>=12'} - cpu: [riscv64] - os: [linux] - '@esbuild/linux-riscv64@0.24.0': resolution: {integrity: sha512-bEh7dMn/h3QxeR2KTy1DUszQjUrIHPZKyO6aN1X4BCnhfYhuQqedHaa5MxSQA/06j3GpiIlFGSsy1c7Gf9padw==} engines: {node: '>=18'} cpu: [riscv64] os: [linux] - '@esbuild/linux-s390x@0.21.5': - resolution: {integrity: sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==} - engines: {node: '>=12'} - cpu: [s390x] - os: [linux] - '@esbuild/linux-s390x@0.24.0': resolution: {integrity: sha512-ZcQ6+qRkw1UcZGPyrCiHHkmBaj9SiCD8Oqd556HldP+QlpUIe2Wgn3ehQGVoPOvZvtHm8HPx+bH20c9pvbkX3g==} engines: {node: '>=18'} cpu: [s390x] os: [linux] - '@esbuild/linux-x64@0.21.5': - resolution: {integrity: sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [linux] - '@esbuild/linux-x64@0.24.0': resolution: {integrity: sha512-vbutsFqQ+foy3wSSbmjBXXIJ6PL3scghJoM8zCL142cGaZKAdCZHyf+Bpu/MmX9zT9Q0zFBVKb36Ma5Fzfa8xA==} engines: {node: '>=18'} cpu: [x64] os: [linux] - '@esbuild/netbsd-x64@0.21.5': - resolution: {integrity: sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==} - engines: {node: '>=12'} - cpu: [x64] - os: [netbsd] - '@esbuild/netbsd-x64@0.24.0': resolution: {integrity: sha512-hjQ0R/ulkO8fCYFsG0FZoH+pWgTTDreqpqY7UnQntnaKv95uP5iW3+dChxnx7C3trQQU40S+OgWhUVwCjVFLvg==} engines: {node: '>=18'} @@ -496,60 +446,30 @@ packages: cpu: [arm64] os: [openbsd] - '@esbuild/openbsd-x64@0.21.5': - resolution: {integrity: sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==} - engines: {node: '>=12'} - cpu: [x64] - os: [openbsd] - '@esbuild/openbsd-x64@0.24.0': resolution: {integrity: sha512-4ir0aY1NGUhIC1hdoCzr1+5b43mw99uNwVzhIq1OY3QcEwPDO3B7WNXBzaKY5Nsf1+N11i1eOfFcq+D/gOS15Q==} engines: {node: '>=18'} cpu: [x64] os: [openbsd] - '@esbuild/sunos-x64@0.21.5': - resolution: {integrity: sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==} - engines: {node: '>=12'} - cpu: [x64] - os: [sunos] - '@esbuild/sunos-x64@0.24.0': resolution: {integrity: sha512-jVzdzsbM5xrotH+W5f1s+JtUy1UWgjU0Cf4wMvffTB8m6wP5/kx0KiaLHlbJO+dMgtxKV8RQ/JvtlFcdZ1zCPA==} engines: {node: '>=18'} cpu: [x64] os: [sunos] - '@esbuild/win32-arm64@0.21.5': - resolution: {integrity: sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==} - engines: {node: '>=12'} - cpu: [arm64] - os: [win32] - '@esbuild/win32-arm64@0.24.0': resolution: {integrity: sha512-iKc8GAslzRpBytO2/aN3d2yb2z8XTVfNV0PjGlCxKo5SgWmNXx82I/Q3aG1tFfS+A2igVCY97TJ8tnYwpUWLCA==} engines: {node: '>=18'} cpu: [arm64] os: [win32] - '@esbuild/win32-ia32@0.21.5': - resolution: {integrity: sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==} - engines: {node: '>=12'} - cpu: [ia32] - os: [win32] - '@esbuild/win32-ia32@0.24.0': resolution: {integrity: sha512-vQW36KZolfIudCcTnaTpmLQ24Ha1RjygBo39/aLkM2kmjkWmZGEJ5Gn9l5/7tzXA42QGIoWbICfg6KLLkIw6yw==} engines: {node: '>=18'} cpu: [ia32] os: [win32] - '@esbuild/win32-x64@0.21.5': - resolution: {integrity: sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==} - engines: {node: '>=12'} - cpu: [x64] - os: [win32] - '@esbuild/win32-x64@0.24.0': resolution: {integrity: sha512-7IAFPrjSQIJrGsK6flwg7NFmwBoSTyF3rl7If0hNUFQU4ilTsEPL6GuMuU9BfIWVVGuRnuIidkSMC+c0Otu8IA==} engines: {node: '>=18'} @@ -568,47 +488,24 @@ packages: resolution: {integrity: sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - '@jridgewell/gen-mapping@0.3.3': - resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==} - engines: {node: '>=6.0.0'} + '@jridgewell/gen-mapping@0.3.13': + resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==} - '@jridgewell/gen-mapping@0.3.5': - resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} - engines: {node: '>=6.0.0'} - - '@jridgewell/resolve-uri@3.1.1': - resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==} - engines: {node: '>=6.0.0'} + '@jridgewell/remapping@2.3.5': + resolution: {integrity: sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==} '@jridgewell/resolve-uri@3.1.2': resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} engines: {node: '>=6.0.0'} - '@jridgewell/set-array@1.1.2': - resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==} - engines: {node: '>=6.0.0'} - - '@jridgewell/set-array@1.2.1': - resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==} - engines: {node: '>=6.0.0'} - - '@jridgewell/source-map@0.3.5': - resolution: {integrity: sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==} - '@jridgewell/source-map@0.3.6': resolution: {integrity: sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==} - '@jridgewell/sourcemap-codec@1.4.15': - resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} - '@jridgewell/sourcemap-codec@1.5.0': resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} - '@jridgewell/trace-mapping@0.3.20': - resolution: {integrity: sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==} - - '@jridgewell/trace-mapping@0.3.25': - resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} + '@jridgewell/trace-mapping@0.3.31': + resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} '@manypkg/find-root@1.1.0': resolution: {integrity: sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA==} @@ -616,6 +513,12 @@ packages: '@manypkg/get-packages@1.1.3': resolution: {integrity: sha512-fo+QhuU3qE/2TQMQmbVMqaQ6EWbMhi4ABWP+O4AM1NqPBuy0OrApV5LO6BrrgnhtAHS2NH6RrVk9OL181tTi8A==} + '@napi-rs/wasm-runtime@1.1.6': + resolution: {integrity: sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==} + peerDependencies: + '@emnapi/core': ^1.7.1 + '@emnapi/runtime': ^1.7.1 + '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -628,6 +531,128 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} + '@oxc-parser/binding-android-arm-eabi@0.139.0': + resolution: {integrity: sha512-22EsXTA3Vc7OvrF4bfT48PFln2UbxkVgrp/Tm32qLw76Dv7SmcInfClJe6yPYamnli6HiqasnESZ5ezN+X4ybg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [android] + + '@oxc-parser/binding-android-arm64@0.139.0': + resolution: {integrity: sha512-uASQkZV+CUQ6xXvoMzDQyfhd8OMusdv2FyCPfAi5ZDYptesapJlw7erhpGi1Lc+U8QjQV2JUrIh7d/3su2LzmQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@oxc-parser/binding-darwin-arm64@0.139.0': + resolution: {integrity: sha512-vuQOv2WF5pZCkdSPEExul98o853M3MCR24DpWsGrUoPJu5KcnGE34kLXY2yFwBwZwT+eN1x40Tt4q6ZzlEdNUA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@oxc-parser/binding-darwin-x64@0.139.0': + resolution: {integrity: sha512-zxZB8ChS+7XactZhcyxQ292P/DNiiBaPPKYiVUlb3RC0V/hme5bokNubjcmEmbW9uTfmqLTpveAdkbe66H3pGg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@oxc-parser/binding-freebsd-x64@0.139.0': + resolution: {integrity: sha512-iw2MsoCPBQwdJqywRAGsF1jEAcGoZ+DeG2LVzt5pdUvRHqajsMF46BH0rHiWoWtMwcMSia+oQYga7fHo7u7Bcw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@oxc-parser/binding-linux-arm-gnueabihf@0.139.0': + resolution: {integrity: sha512-SwjD/k3Y5bwGJWOH313VyaDrAuaYg1Pe+4AAXCgUKvSO5IHkj+mZ0oFcOWmB5nTuOM3uwdT+leL8h4OnFlI5hw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxc-parser/binding-linux-arm-musleabihf@0.139.0': + resolution: {integrity: sha512-qbeygDkcvailKFhphb2YGMMXsaZIynHlPtoOrcx4NZB/tRbUKraCCMbw8dPeFtEKasfS2qWh1VnReY+Lcys1zA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxc-parser/binding-linux-arm64-gnu@0.139.0': + resolution: {integrity: sha512-SrlL02KeImKlvx/9rCeopOLH7qKI3rqKKEguK6KBwVwEGLhV/A47dW4DNigf6/LFhrwoovaiayEQryjYAI86dQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + + '@oxc-parser/binding-linux-arm64-musl@0.139.0': + resolution: {integrity: sha512-u9e884ChAVRmIZ1jr/m46S96FoDQnruFjISLi4Y0i6Wu/JUUmIiw7+umLyXILJsPfUuqnN5BJLe23t07+Y6+IA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + + '@oxc-parser/binding-linux-ppc64-gnu@0.139.0': + resolution: {integrity: sha512-Z9tU2b3GJfAXOdirQmz4gZQkQkVjy53i77gf91l0733MQKa/qtk73KQQE2GzDtMqim+HyjpzvemmqzBtH2IJUA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + + '@oxc-parser/binding-linux-riscv64-gnu@0.139.0': + resolution: {integrity: sha512-RyUbr7hzPK84YDWKs77PRYk9VBwWbsbuYsQzQWiSmLnARXTg2zntLPGfCH/1wpfUYdmGkp/6SsqTXSsYdw9Jgw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + + '@oxc-parser/binding-linux-riscv64-musl@0.139.0': + resolution: {integrity: sha512-dcQhjtcDvtR8BgkUpt03Yz5SzxdzYvTigenIJOEsiSX6G2t6yybEMxGWjp0dOuYGror0BaqcZfTyXR58amCEig==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + + '@oxc-parser/binding-linux-s390x-gnu@0.139.0': + resolution: {integrity: sha512-iuGrxysV4rGUymdKpn7bgZQ6Vix8Bi/6D/rp71HYIzphq6NKrsBhsGOYsSZte+uBFL43tXh7Xr7TM72sGliJNA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + + '@oxc-parser/binding-linux-x64-gnu@0.139.0': + resolution: {integrity: sha512-NxJdZZyaa2JLLvNfH/iJQXfCNfKcPMylwY4ObMpBVmW4Nq+RyUpVVQXrMMelcQ6rwx3nuhF1Iga8n+eoAKGCIA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + + '@oxc-parser/binding-linux-x64-musl@0.139.0': + resolution: {integrity: sha512-ePxBvvtzISmSsJ0RIj8FNikSCn58i1jtccj7XR4U9Li4iSzhkFyYlnJ51cQTUwkairz8WMTD4SpKoot8RyTnQA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + + '@oxc-parser/binding-openharmony-arm64@0.139.0': + resolution: {integrity: sha512-b/c2+mPXMOxG5x16n8yf9cjor/ntQQScmYnSmLEWIWJ4rfXd5dokMxx0kliSLA+YAGq6DD3K9BWi+aFXHiiV1w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@oxc-parser/binding-wasm32-wasi@0.139.0': + resolution: {integrity: sha512-rNU0pO+/CVPC2qZ+xtX5R2cOje9Q75q3UkfgwUCPlplqxMv6Iffd5tMPGVMCLGnPINxPlmi0WPsW94HltbYvfQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [wasm32] + + '@oxc-parser/binding-win32-arm64-msvc@0.139.0': + resolution: {integrity: sha512-JPEmfncZfqAFiGsAN6UZSMIBqnG8wn8buywRacFOWjP+9dZwcs03SsBp4tmyjM/4l/VoH/IuThrW1Jof3OyQUw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@oxc-parser/binding-win32-ia32-msvc@0.139.0': + resolution: {integrity: sha512-c06dWBwEnFHof5JN7T9/ts23uATXS9czPEBO60d4xnjH2Am29Bo7OGKdVHRmcWQnw0OBxlTg9fIEXAvtcwOBfw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ia32] + os: [win32] + + '@oxc-parser/binding-win32-x64-msvc@0.139.0': + resolution: {integrity: sha512-bI3/44urQjW/D495JPXe+c9d+4Q+ONi3DvDNnzwRZYTWHZ3hAlFdmirYK4mzhTfCZiAly02EbMYir7QGU+9O2Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + + '@oxc-project/types@0.139.0': + resolution: {integrity: sha512-r9gHphtCs+1M7J0pw6Sn/hh/Wpa/iQrOOkrNAlVLF/gHq+/CJmHIWKKUUhdWjcD6CIa8idarspCsASiXCXvFUw==} + '@rollup/plugin-babel@6.0.4': resolution: {integrity: sha512-YF7Y52kFdFT/xVSuVdjkV5ZdX/3YtmX0QulG+x0taQOtJdHYzVU61aSSkAgVJ7NOv6qPkIYiJSgSWWN/DM5sGw==} engines: {node: '>=14.0.0'} @@ -659,15 +684,6 @@ packages: rollup: optional: true - '@rollup/pluginutils@5.0.5': - resolution: {integrity: sha512-6aEYR910NyP73oHiJglti74iRyOwgFU4x3meH/H8OJx6Ry0j6cOVZ5X/wTvub7G7Ao6qaHBEaNsV3GLJkSsF+Q==} - engines: {node: '>=14.0.0'} - peerDependencies: - rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 - peerDependenciesMeta: - rollup: - optional: true - '@rollup/pluginutils@5.1.3': resolution: {integrity: sha512-Pnsb6f32CD2W3uCaLZIzDmeFyQ2b8UWMFI7xtwUezpcGBDVDW6y9XgAWIlARiGAo6eNF5FK5aQTr0LFyNyqq5A==} engines: {node: '>=14.0.0'} @@ -770,6 +786,9 @@ packages: '@sinclair/typebox@0.27.8': resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} + '@tybys/wasm-util@0.10.3': + resolution: {integrity: sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==} + '@types/babel__core@7.20.5': resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} @@ -779,11 +798,11 @@ packages: '@types/babel__template@7.4.4': resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==} - '@types/babel__traverse@7.20.6': - resolution: {integrity: sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==} + '@types/babel__traverse@7.28.0': + resolution: {integrity: sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==} - '@types/estree@1.0.5': - resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} + '@types/braces@3.0.5': + resolution: {integrity: sha512-SQFof9H+LXeWNz8wDe7oN5zu7ket0qwMu5vZubW4GCJ8Kkeh6nBWUz87+KTz/G3Kqsrp0j/W253XJb3KMEeg3w==} '@types/estree@1.0.6': resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} @@ -800,6 +819,9 @@ packages: '@types/jest@29.5.14': resolution: {integrity: sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ==} + '@types/micromatch@4.0.10': + resolution: {integrity: sha512-5jOhFDElqr4DKTrTEbnW8DZ4Hz5LRUEmyrGpCMrD/NphYv3nUnaF08xmSLx1rGGnyEs/kFnhiw6dCgcDqMr5PQ==} + '@types/node@12.20.55': resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} @@ -847,11 +869,6 @@ packages: '@vitest/utils@2.1.6': resolution: {integrity: sha512-ixNkFy3k4vokOUTU2blIUvOgKq/N2PW8vKIjZZYsGJCMX69MRa9J2sKqX5hY/k5O5Gty3YJChepkqZ3KM9LyIQ==} - acorn@8.11.2: - resolution: {integrity: sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==} - engines: {node: '>=0.4.0'} - hasBin: true - acorn@8.14.0: resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==} engines: {node: '>=0.4.0'} @@ -1025,11 +1042,6 @@ packages: es-module-lexer@1.5.4: resolution: {integrity: sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==} - esbuild@0.21.5: - resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==} - engines: {node: '>=12'} - hasBin: true - esbuild@0.24.0: resolution: {integrity: sha512-FuLPevChGDshgSicjisSooU0cemp/sGXR841D5LHMB7mTVOmsEHcAxaH3irL53+8YDIeVNQEySh4DaYU/iuPqQ==} engines: {node: '>=18'} @@ -1069,8 +1081,8 @@ packages: resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==} engines: {node: '>=4'} - fast-glob@3.3.2: - resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} + fast-glob@3.3.3: + resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} engines: {node: '>=8.6.0'} fastq@1.17.1: @@ -1112,10 +1124,6 @@ packages: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} - globals@11.12.0: - resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} - engines: {node: '>=4'} - globby@11.1.0: resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} engines: {node: '>=10'} @@ -1308,6 +1316,10 @@ packages: outdent@0.5.0: resolution: {integrity: sha512-/jHxFIzoMXdqPzTaCpFzAAWhpkSjZPF4Vsn6jAfNpmbH/ymsmd7Qc6VE9BGn0L6YMj6uwpQLxCECpus4ukKS9Q==} + oxc-parser@0.139.0: + resolution: {integrity: sha512-cf1TKZN+zc0lwqigeyXKzKVk5+vNRe99Or2+wVJsXLdlhJgC+gsIniYDfj/ZEBzCJ8Xm21ZG6YtMbR262CcS2w==} + engines: {node: ^20.19.0 || >=22.12.0} + p-filter@2.1.0: resolution: {integrity: sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw==} engines: {node: '>=8'} @@ -1356,9 +1368,6 @@ packages: resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} engines: {node: '>= 14.16'} - picocolors@1.1.0: - resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} - picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} @@ -1374,10 +1383,6 @@ packages: resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} engines: {node: '>=6'} - postcss@8.4.47: - resolution: {integrity: sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==} - engines: {node: ^10 || ^12 || >=14} - postcss@8.4.49: resolution: {integrity: sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==} engines: {node: ^10 || ^12 || >=14} @@ -1551,11 +1556,6 @@ packages: resolution: {integrity: sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==} engines: {node: '>=8'} - terser@5.24.0: - resolution: {integrity: sha512-ZpGR4Hy3+wBEzVEnHvstMvqpD/nABNelQn/z2r0fjVWGQsN3bpOLzQlqDxmb4CDZnXq5lpjnQ+mHQLAOpfM5iw==} - engines: {node: '>=10'} - hasBin: true - terser@5.36.0: resolution: {integrity: sha512-IYV9eNMuFAV4THUspIRXkLakHnV6XO7FEdtKjf/mDyrnqUg9LnlOn6/RwRvM9SZjR4GUq8Nk8zj67FzVARr74w==} engines: {node: '>=10'} @@ -1590,10 +1590,6 @@ packages: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} engines: {node: '>=0.6.0'} - to-fast-properties@2.0.0: - resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} - engines: {node: '>=4'} - to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} @@ -1606,6 +1602,9 @@ packages: resolution: {integrity: sha512-tk2G5R2KRwBd+ZN0zaEXpmzdKyOYksXwywulIX95MBODjSzMIuQnQ3m8JxgbhnL1LeVo7lqQKsYa1O3Htl7K5g==} engines: {node: '>=18'} + tslib@2.8.1: + resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + typescript@5.7.2: resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} engines: {node: '>=14.17'} @@ -1642,37 +1641,6 @@ packages: '@testing-library/jest-dom': optional: true - vite@5.4.8: - resolution: {integrity: sha512-FqrItQ4DT1NC4zCUqMB4c4AZORMKIa0m8/URVCZ77OZ/QSNeJ54bU1vrFADbDsuwfIPcgknRkmqakQcgnL4GiQ==} - engines: {node: ^18.0.0 || >=20.0.0} - hasBin: true - peerDependencies: - '@types/node': ^18.0.0 || >=20.0.0 - less: '*' - lightningcss: ^1.21.0 - sass: '*' - sass-embedded: '*' - stylus: '*' - sugarss: '*' - terser: ^5.4.0 - peerDependenciesMeta: - '@types/node': - optional: true - less: - optional: true - lightningcss: - optional: true - sass: - optional: true - sass-embedded: - optional: true - stylus: - optional: true - sugarss: - optional: true - terser: - optional: true - vite@6.0.0: resolution: {integrity: sha512-Q2+5yQV79EdnpbNxjD3/QHVMCBaQ3Kpd4/uL51UGuh38bIIM+s4o3FqyCzRvTRwFb+cWIUeZvaWwS9y2LD2qeQ==} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} @@ -1757,6 +1725,7 @@ packages: whatwg-encoding@3.1.1: resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==} engines: {node: '>=18'} + deprecated: Use @exodus/bytes instead for a more spec-conformant and faster implementation whatwg-mimetype@4.0.0: resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==} @@ -1800,31 +1769,26 @@ packages: snapshots: - '@ampproject/remapping@2.3.0': + '@babel/code-frame@7.29.7': dependencies: - '@jridgewell/gen-mapping': 0.3.5 - '@jridgewell/trace-mapping': 0.3.25 - - '@babel/code-frame@7.26.2': - dependencies: - '@babel/helper-validator-identifier': 7.25.9 + '@babel/helper-validator-identifier': 7.29.7 js-tokens: 4.0.0 picocolors: 1.1.1 - '@babel/compat-data@7.26.2': {} + '@babel/compat-data@7.29.7': {} - '@babel/core@7.26.0': + '@babel/core@7.29.7': dependencies: - '@ampproject/remapping': 2.3.0 - '@babel/code-frame': 7.26.2 - '@babel/generator': 7.26.2 - '@babel/helper-compilation-targets': 7.25.9 - '@babel/helper-module-transforms': 7.26.0(@babel/core@7.26.0) - '@babel/helpers': 7.26.0 - '@babel/parser': 7.26.2 - '@babel/template': 7.25.9 - '@babel/traverse': 7.25.9 - '@babel/types': 7.26.0 + '@babel/code-frame': 7.29.7 + '@babel/generator': 7.29.7 + '@babel/helper-compilation-targets': 7.29.7 + '@babel/helper-module-transforms': 7.29.7(@babel/core@7.29.7) + '@babel/helpers': 7.29.7 + '@babel/parser': 7.29.7 + '@babel/template': 7.29.7 + '@babel/traverse': 7.29.7 + '@babel/types': 7.29.7 + '@jridgewell/remapping': 2.3.5 convert-source-map: 2.0.0 debug: 4.3.7 gensync: 1.0.0-beta.2 @@ -1833,156 +1797,150 @@ snapshots: transitivePeerDependencies: - supports-color - '@babel/generator@7.26.2': + '@babel/generator@7.29.7': dependencies: - '@babel/parser': 7.26.2 - '@babel/types': 7.26.0 - '@jridgewell/gen-mapping': 0.3.5 - '@jridgewell/trace-mapping': 0.3.25 + '@babel/parser': 7.29.7 + '@babel/types': 7.29.7 + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 jsesc: 3.0.2 '@babel/helper-annotate-as-pure@7.25.9': dependencies: - '@babel/types': 7.26.0 + '@babel/types': 7.29.7 - '@babel/helper-compilation-targets@7.25.9': + '@babel/helper-compilation-targets@7.29.7': dependencies: - '@babel/compat-data': 7.26.2 - '@babel/helper-validator-option': 7.25.9 + '@babel/compat-data': 7.29.7 + '@babel/helper-validator-option': 7.29.7 browserslist: 4.24.2 lru-cache: 5.1.1 semver: 6.3.1 - '@babel/helper-create-class-features-plugin@7.25.9(@babel/core@7.26.0)': + '@babel/helper-create-class-features-plugin@7.25.9(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.26.0 + '@babel/core': 7.29.7 '@babel/helper-annotate-as-pure': 7.25.9 '@babel/helper-member-expression-to-functions': 7.25.9 '@babel/helper-optimise-call-expression': 7.25.9 - '@babel/helper-replace-supers': 7.25.9(@babel/core@7.26.0) + '@babel/helper-replace-supers': 7.25.9(@babel/core@7.29.7) '@babel/helper-skip-transparent-expression-wrappers': 7.25.9 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.29.7 semver: 6.3.1 transitivePeerDependencies: - supports-color + '@babel/helper-globals@7.29.7': {} + '@babel/helper-member-expression-to-functions@7.25.9': dependencies: - '@babel/traverse': 7.25.9 - '@babel/types': 7.26.0 + '@babel/traverse': 7.29.7 + '@babel/types': 7.29.7 transitivePeerDependencies: - supports-color '@babel/helper-module-imports@7.18.6': dependencies: - '@babel/types': 7.26.0 - - '@babel/helper-module-imports@7.22.15': - dependencies: - '@babel/types': 7.23.3 + '@babel/types': 7.29.7 - '@babel/helper-module-imports@7.25.9': + '@babel/helper-module-imports@7.29.7': dependencies: - '@babel/traverse': 7.25.9 - '@babel/types': 7.26.0 + '@babel/traverse': 7.29.7 + '@babel/types': 7.29.7 transitivePeerDependencies: - supports-color - '@babel/helper-module-transforms@7.26.0(@babel/core@7.26.0)': + '@babel/helper-module-transforms@7.29.7(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.26.0 - '@babel/helper-module-imports': 7.25.9 - '@babel/helper-validator-identifier': 7.25.9 - '@babel/traverse': 7.25.9 + '@babel/core': 7.29.7 + '@babel/helper-module-imports': 7.29.7 + '@babel/helper-validator-identifier': 7.29.7 + '@babel/traverse': 7.29.7 transitivePeerDependencies: - supports-color '@babel/helper-optimise-call-expression@7.25.9': dependencies: - '@babel/types': 7.26.0 + '@babel/types': 7.29.7 '@babel/helper-plugin-utils@7.25.9': {} - '@babel/helper-replace-supers@7.25.9(@babel/core@7.26.0)': + '@babel/helper-replace-supers@7.25.9(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.26.0 + '@babel/core': 7.29.7 '@babel/helper-member-expression-to-functions': 7.25.9 '@babel/helper-optimise-call-expression': 7.25.9 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.29.7 transitivePeerDependencies: - supports-color '@babel/helper-simple-access@7.25.9': dependencies: - '@babel/traverse': 7.25.9 - '@babel/types': 7.26.0 + '@babel/traverse': 7.29.7 + '@babel/types': 7.29.7 transitivePeerDependencies: - supports-color '@babel/helper-skip-transparent-expression-wrappers@7.25.9': dependencies: - '@babel/traverse': 7.25.9 - '@babel/types': 7.26.0 + '@babel/traverse': 7.29.7 + '@babel/types': 7.29.7 transitivePeerDependencies: - supports-color - '@babel/helper-string-parser@7.22.5': {} - - '@babel/helper-string-parser@7.25.9': {} + '@babel/helper-string-parser@7.29.7': {} - '@babel/helper-validator-identifier@7.22.20': {} + '@babel/helper-validator-identifier@7.29.7': {} - '@babel/helper-validator-identifier@7.25.9': {} + '@babel/helper-validator-option@7.29.7': {} - '@babel/helper-validator-option@7.25.9': {} - - '@babel/helpers@7.26.0': + '@babel/helpers@7.29.7': dependencies: - '@babel/template': 7.25.9 - '@babel/types': 7.26.0 + '@babel/template': 7.29.7 + '@babel/types': 7.29.7 - '@babel/parser@7.26.2': + '@babel/parser@7.29.7': dependencies: - '@babel/types': 7.26.0 + '@babel/types': 7.29.7 - '@babel/plugin-syntax-jsx@7.25.9(@babel/core@7.26.0)': + '@babel/plugin-syntax-jsx@7.25.9(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.26.0 + '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-syntax-typescript@7.25.9(@babel/core@7.26.0)': + '@babel/plugin-syntax-typescript@7.25.9(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.26.0 + '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-transform-modules-commonjs@7.25.9(@babel/core@7.26.0)': + '@babel/plugin-transform-modules-commonjs@7.25.9(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.26.0 - '@babel/helper-module-transforms': 7.26.0(@babel/core@7.26.0) + '@babel/core': 7.29.7 + '@babel/helper-module-transforms': 7.29.7(@babel/core@7.29.7) '@babel/helper-plugin-utils': 7.25.9 '@babel/helper-simple-access': 7.25.9 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-typescript@7.25.9(@babel/core@7.26.0)': + '@babel/plugin-transform-typescript@7.25.9(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.26.0 + '@babel/core': 7.29.7 '@babel/helper-annotate-as-pure': 7.25.9 - '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.26.0) + '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.29.7) '@babel/helper-plugin-utils': 7.25.9 '@babel/helper-skip-transparent-expression-wrappers': 7.25.9 - '@babel/plugin-syntax-typescript': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-syntax-typescript': 7.25.9(@babel/core@7.29.7) transitivePeerDependencies: - supports-color - '@babel/preset-typescript@7.26.0(@babel/core@7.26.0)': + '@babel/preset-typescript@7.26.0(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.26.0 + '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.25.9 - '@babel/helper-validator-option': 7.25.9 - '@babel/plugin-syntax-jsx': 7.25.9(@babel/core@7.26.0) - '@babel/plugin-transform-modules-commonjs': 7.25.9(@babel/core@7.26.0) - '@babel/plugin-transform-typescript': 7.25.9(@babel/core@7.26.0) + '@babel/helper-validator-option': 7.29.7 + '@babel/plugin-syntax-jsx': 7.25.9(@babel/core@7.29.7) + '@babel/plugin-transform-modules-commonjs': 7.25.9(@babel/core@7.29.7) + '@babel/plugin-transform-typescript': 7.25.9(@babel/core@7.29.7) transitivePeerDependencies: - supports-color @@ -1990,34 +1948,28 @@ snapshots: dependencies: regenerator-runtime: 0.14.1 - '@babel/template@7.25.9': + '@babel/template@7.29.7': dependencies: - '@babel/code-frame': 7.26.2 - '@babel/parser': 7.26.2 - '@babel/types': 7.26.0 + '@babel/code-frame': 7.29.7 + '@babel/parser': 7.29.7 + '@babel/types': 7.29.7 - '@babel/traverse@7.25.9': + '@babel/traverse@7.29.7': dependencies: - '@babel/code-frame': 7.26.2 - '@babel/generator': 7.26.2 - '@babel/parser': 7.26.2 - '@babel/template': 7.25.9 - '@babel/types': 7.26.0 + '@babel/code-frame': 7.29.7 + '@babel/generator': 7.29.7 + '@babel/helper-globals': 7.29.7 + '@babel/parser': 7.29.7 + '@babel/template': 7.29.7 + '@babel/types': 7.29.7 debug: 4.3.7 - globals: 11.12.0 transitivePeerDependencies: - supports-color - '@babel/types@7.23.3': + '@babel/types@7.29.7': dependencies: - '@babel/helper-string-parser': 7.22.5 - '@babel/helper-validator-identifier': 7.22.20 - to-fast-properties: 2.0.0 - - '@babel/types@7.26.0': - dependencies: - '@babel/helper-string-parser': 7.25.9 - '@babel/helper-validator-identifier': 7.25.9 + '@babel/helper-string-parser': 7.29.7 + '@babel/helper-validator-identifier': 7.29.7 '@changesets/apply-release-plan@7.0.6': dependencies: @@ -2161,144 +2113,91 @@ snapshots: human-id: 1.0.2 prettier: 2.8.8 - '@esbuild/aix-ppc64@0.21.5': + '@emnapi/core@1.11.1': + dependencies: + '@emnapi/wasi-threads': 1.2.2 + tslib: 2.8.1 optional: true - '@esbuild/aix-ppc64@0.24.0': + '@emnapi/runtime@1.11.1': + dependencies: + tslib: 2.8.1 optional: true - '@esbuild/android-arm64@0.21.5': + '@emnapi/wasi-threads@1.2.2': + dependencies: + tslib: 2.8.1 optional: true - '@esbuild/android-arm64@0.24.0': + '@esbuild/aix-ppc64@0.24.0': optional: true - '@esbuild/android-arm@0.21.5': + '@esbuild/android-arm64@0.24.0': optional: true '@esbuild/android-arm@0.24.0': optional: true - '@esbuild/android-x64@0.21.5': - optional: true - '@esbuild/android-x64@0.24.0': optional: true - '@esbuild/darwin-arm64@0.21.5': - optional: true - '@esbuild/darwin-arm64@0.24.0': optional: true - '@esbuild/darwin-x64@0.21.5': - optional: true - '@esbuild/darwin-x64@0.24.0': optional: true - '@esbuild/freebsd-arm64@0.21.5': - optional: true - '@esbuild/freebsd-arm64@0.24.0': optional: true - '@esbuild/freebsd-x64@0.21.5': - optional: true - '@esbuild/freebsd-x64@0.24.0': optional: true - '@esbuild/linux-arm64@0.21.5': - optional: true - '@esbuild/linux-arm64@0.24.0': optional: true - '@esbuild/linux-arm@0.21.5': - optional: true - '@esbuild/linux-arm@0.24.0': optional: true - '@esbuild/linux-ia32@0.21.5': - optional: true - '@esbuild/linux-ia32@0.24.0': optional: true - '@esbuild/linux-loong64@0.21.5': - optional: true - '@esbuild/linux-loong64@0.24.0': optional: true - '@esbuild/linux-mips64el@0.21.5': - optional: true - '@esbuild/linux-mips64el@0.24.0': optional: true - '@esbuild/linux-ppc64@0.21.5': - optional: true - '@esbuild/linux-ppc64@0.24.0': optional: true - '@esbuild/linux-riscv64@0.21.5': - optional: true - '@esbuild/linux-riscv64@0.24.0': optional: true - '@esbuild/linux-s390x@0.21.5': - optional: true - '@esbuild/linux-s390x@0.24.0': optional: true - '@esbuild/linux-x64@0.21.5': - optional: true - '@esbuild/linux-x64@0.24.0': optional: true - '@esbuild/netbsd-x64@0.21.5': - optional: true - '@esbuild/netbsd-x64@0.24.0': optional: true '@esbuild/openbsd-arm64@0.24.0': optional: true - '@esbuild/openbsd-x64@0.21.5': - optional: true - '@esbuild/openbsd-x64@0.24.0': optional: true - '@esbuild/sunos-x64@0.21.5': - optional: true - '@esbuild/sunos-x64@0.24.0': optional: true - '@esbuild/win32-arm64@0.21.5': - optional: true - '@esbuild/win32-arm64@0.24.0': optional: true - '@esbuild/win32-ia32@0.21.5': - optional: true - '@esbuild/win32-ia32@0.24.0': optional: true - '@esbuild/win32-x64@0.21.5': - optional: true - '@esbuild/win32-x64@0.24.0': optional: true @@ -2319,47 +2218,26 @@ snapshots: '@types/yargs': 17.0.33 chalk: 4.1.2 - '@jridgewell/gen-mapping@0.3.3': - dependencies: - '@jridgewell/set-array': 1.1.2 - '@jridgewell/sourcemap-codec': 1.4.15 - '@jridgewell/trace-mapping': 0.3.20 - - '@jridgewell/gen-mapping@0.3.5': + '@jridgewell/gen-mapping@0.3.13': dependencies: - '@jridgewell/set-array': 1.2.1 '@jridgewell/sourcemap-codec': 1.5.0 - '@jridgewell/trace-mapping': 0.3.25 + '@jridgewell/trace-mapping': 0.3.31 - '@jridgewell/resolve-uri@3.1.1': {} + '@jridgewell/remapping@2.3.5': + dependencies: + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 '@jridgewell/resolve-uri@3.1.2': {} - '@jridgewell/set-array@1.1.2': {} - - '@jridgewell/set-array@1.2.1': {} - - '@jridgewell/source-map@0.3.5': - dependencies: - '@jridgewell/gen-mapping': 0.3.3 - '@jridgewell/trace-mapping': 0.3.20 - '@jridgewell/source-map@0.3.6': dependencies: - '@jridgewell/gen-mapping': 0.3.5 - '@jridgewell/trace-mapping': 0.3.25 - optional: true - - '@jridgewell/sourcemap-codec@1.4.15': {} + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 '@jridgewell/sourcemap-codec@1.5.0': {} - '@jridgewell/trace-mapping@0.3.20': - dependencies: - '@jridgewell/resolve-uri': 3.1.1 - '@jridgewell/sourcemap-codec': 1.4.15 - - '@jridgewell/trace-mapping@0.3.25': + '@jridgewell/trace-mapping@0.3.31': dependencies: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 @@ -2380,6 +2258,13 @@ snapshots: globby: 11.1.0 read-yaml-file: 1.1.0 + '@napi-rs/wasm-runtime@1.1.6(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1)': + dependencies: + '@emnapi/core': 1.11.1 + '@emnapi/runtime': 1.11.1 + '@tybys/wasm-util': 0.10.3 + optional: true + '@nodelib/fs.scandir@2.1.5': dependencies: '@nodelib/fs.stat': 2.0.5 @@ -2392,14 +2277,82 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.17.1 - '@rollup/plugin-babel@6.0.4(@babel/core@7.26.0)(@types/babel__core@7.20.5)(rollup@4.27.4)': + '@oxc-parser/binding-android-arm-eabi@0.139.0': + optional: true + + '@oxc-parser/binding-android-arm64@0.139.0': + optional: true + + '@oxc-parser/binding-darwin-arm64@0.139.0': + optional: true + + '@oxc-parser/binding-darwin-x64@0.139.0': + optional: true + + '@oxc-parser/binding-freebsd-x64@0.139.0': + optional: true + + '@oxc-parser/binding-linux-arm-gnueabihf@0.139.0': + optional: true + + '@oxc-parser/binding-linux-arm-musleabihf@0.139.0': + optional: true + + '@oxc-parser/binding-linux-arm64-gnu@0.139.0': + optional: true + + '@oxc-parser/binding-linux-arm64-musl@0.139.0': + optional: true + + '@oxc-parser/binding-linux-ppc64-gnu@0.139.0': + optional: true + + '@oxc-parser/binding-linux-riscv64-gnu@0.139.0': + optional: true + + '@oxc-parser/binding-linux-riscv64-musl@0.139.0': + optional: true + + '@oxc-parser/binding-linux-s390x-gnu@0.139.0': + optional: true + + '@oxc-parser/binding-linux-x64-gnu@0.139.0': + optional: true + + '@oxc-parser/binding-linux-x64-musl@0.139.0': + optional: true + + '@oxc-parser/binding-openharmony-arm64@0.139.0': + optional: true + + '@oxc-parser/binding-wasm32-wasi@0.139.0': + dependencies: + '@emnapi/core': 1.11.1 + '@emnapi/runtime': 1.11.1 + '@napi-rs/wasm-runtime': 1.1.6(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1) + optional: true + + '@oxc-parser/binding-win32-arm64-msvc@0.139.0': + optional: true + + '@oxc-parser/binding-win32-ia32-msvc@0.139.0': + optional: true + + '@oxc-parser/binding-win32-x64-msvc@0.139.0': + optional: true + + '@oxc-project/types@0.139.0': {} + + '@rollup/plugin-babel@6.0.4(@babel/core@7.29.7)(@types/babel__core@7.20.5)(rollup@4.27.4)': dependencies: - '@babel/core': 7.26.0 - '@babel/helper-module-imports': 7.22.15 - '@rollup/pluginutils': 5.0.5(rollup@4.27.4) + '@babel/core': 7.29.7 + '@babel/helper-module-imports': 7.29.7 + '@rollup/pluginutils': 5.1.3(rollup@4.27.4) optionalDependencies: '@types/babel__core': 7.20.5 rollup: 4.27.4 + transitivePeerDependencies: + - supports-color '@rollup/plugin-node-resolve@15.3.0(rollup@4.27.4)': dependencies: @@ -2415,15 +2368,7 @@ snapshots: dependencies: serialize-javascript: 6.0.1 smob: 1.4.1 - terser: 5.24.0 - optionalDependencies: - rollup: 4.27.4 - - '@rollup/pluginutils@5.0.5(rollup@4.27.4)': - dependencies: - '@types/estree': 1.0.5 - estree-walker: 2.0.2 - picomatch: 2.3.1 + terser: 5.36.0 optionalDependencies: rollup: 4.27.4 @@ -2491,28 +2436,33 @@ snapshots: '@sinclair/typebox@0.27.8': {} + '@tybys/wasm-util@0.10.3': + dependencies: + tslib: 2.8.1 + optional: true + '@types/babel__core@7.20.5': dependencies: - '@babel/parser': 7.26.2 - '@babel/types': 7.26.0 + '@babel/parser': 7.29.7 + '@babel/types': 7.29.7 '@types/babel__generator': 7.6.8 '@types/babel__template': 7.4.4 - '@types/babel__traverse': 7.20.6 + '@types/babel__traverse': 7.28.0 '@types/babel__generator@7.6.8': dependencies: - '@babel/types': 7.26.0 + '@babel/types': 7.29.7 '@types/babel__template@7.4.4': dependencies: - '@babel/parser': 7.26.2 - '@babel/types': 7.26.0 + '@babel/parser': 7.29.7 + '@babel/types': 7.29.7 - '@types/babel__traverse@7.20.6': + '@types/babel__traverse@7.28.0': dependencies: - '@babel/types': 7.26.0 + '@babel/types': 7.29.7 - '@types/estree@1.0.5': {} + '@types/braces@3.0.5': {} '@types/estree@1.0.6': {} @@ -2531,6 +2481,10 @@ snapshots: expect: 29.7.0 pretty-format: 29.7.0 + '@types/micromatch@4.0.10': + dependencies: + '@types/braces': 3.0.5 + '@types/node@12.20.55': {} '@types/node@22.10.0': @@ -2554,13 +2508,13 @@ snapshots: chai: 5.1.2 tinyrainbow: 1.2.0 - '@vitest/mocker@2.1.6(vite@5.4.8(@types/node@22.10.0)(terser@5.36.0))': + '@vitest/mocker@2.1.6(vite@6.0.0(@types/node@22.10.0)(terser@5.36.0))': dependencies: '@vitest/spy': 2.1.6 estree-walker: 3.0.3 magic-string: 0.30.14 optionalDependencies: - vite: 5.4.8(@types/node@22.10.0)(terser@5.36.0) + vite: 6.0.0(@types/node@22.10.0)(terser@5.36.0) '@vitest/pretty-format@2.1.6': dependencies: @@ -2587,10 +2541,7 @@ snapshots: loupe: 3.1.2 tinyrainbow: 1.2.0 - acorn@8.11.2: {} - - acorn@8.14.0: - optional: true + acorn@8.14.0: {} agent-base@7.1.1: dependencies: @@ -2618,20 +2569,20 @@ snapshots: asynckit@0.4.0: {} - babel-plugin-jsx-dom-expressions@0.39.3(@babel/core@7.26.0): + babel-plugin-jsx-dom-expressions@0.39.3(@babel/core@7.29.7): dependencies: - '@babel/core': 7.26.0 + '@babel/core': 7.29.7 '@babel/helper-module-imports': 7.18.6 - '@babel/plugin-syntax-jsx': 7.25.9(@babel/core@7.26.0) - '@babel/types': 7.26.0 + '@babel/plugin-syntax-jsx': 7.25.9(@babel/core@7.29.7) + '@babel/types': 7.29.7 html-entities: 2.3.3 parse5: 7.2.1 validate-html-nesting: 1.2.2 - babel-preset-solid@1.9.3(@babel/core@7.26.0): + babel-preset-solid@1.9.3(@babel/core@7.29.7): dependencies: - '@babel/core': 7.26.0 - babel-plugin-jsx-dom-expressions: 0.39.3(@babel/core@7.26.0) + '@babel/core': 7.29.7 + babel-plugin-jsx-dom-expressions: 0.39.3(@babel/core@7.29.7) better-path-resolve@1.0.0: dependencies: @@ -2735,32 +2686,6 @@ snapshots: es-module-lexer@1.5.4: {} - esbuild@0.21.5: - optionalDependencies: - '@esbuild/aix-ppc64': 0.21.5 - '@esbuild/android-arm': 0.21.5 - '@esbuild/android-arm64': 0.21.5 - '@esbuild/android-x64': 0.21.5 - '@esbuild/darwin-arm64': 0.21.5 - '@esbuild/darwin-x64': 0.21.5 - '@esbuild/freebsd-arm64': 0.21.5 - '@esbuild/freebsd-x64': 0.21.5 - '@esbuild/linux-arm': 0.21.5 - '@esbuild/linux-arm64': 0.21.5 - '@esbuild/linux-ia32': 0.21.5 - '@esbuild/linux-loong64': 0.21.5 - '@esbuild/linux-mips64el': 0.21.5 - '@esbuild/linux-ppc64': 0.21.5 - '@esbuild/linux-riscv64': 0.21.5 - '@esbuild/linux-s390x': 0.21.5 - '@esbuild/linux-x64': 0.21.5 - '@esbuild/netbsd-x64': 0.21.5 - '@esbuild/openbsd-x64': 0.21.5 - '@esbuild/sunos-x64': 0.21.5 - '@esbuild/win32-arm64': 0.21.5 - '@esbuild/win32-ia32': 0.21.5 - '@esbuild/win32-x64': 0.21.5 - esbuild@0.24.0: optionalDependencies: '@esbuild/aix-ppc64': 0.24.0 @@ -2818,7 +2743,7 @@ snapshots: iconv-lite: 0.4.24 tmp: 0.0.33 - fast-glob@3.3.2: + fast-glob@3.3.3: dependencies: '@nodelib/fs.stat': 2.0.5 '@nodelib/fs.walk': 1.2.8 @@ -2868,13 +2793,11 @@ snapshots: dependencies: is-glob: 4.0.3 - globals@11.12.0: {} - globby@11.1.0: dependencies: array-union: 2.1.0 dir-glob: 3.0.1 - fast-glob: 3.3.2 + fast-glob: 3.3.3 ignore: 5.3.2 merge2: 1.4.1 slash: 3.0.0 @@ -2963,7 +2886,7 @@ snapshots: jest-message-util@29.7.0: dependencies: - '@babel/code-frame': 7.26.2 + '@babel/code-frame': 7.29.7 '@jest/types': 29.6.3 '@types/stack-utils': 2.0.3 chalk: 4.1.2 @@ -3072,6 +2995,31 @@ snapshots: outdent@0.5.0: {} + oxc-parser@0.139.0: + dependencies: + '@oxc-project/types': 0.139.0 + optionalDependencies: + '@oxc-parser/binding-android-arm-eabi': 0.139.0 + '@oxc-parser/binding-android-arm64': 0.139.0 + '@oxc-parser/binding-darwin-arm64': 0.139.0 + '@oxc-parser/binding-darwin-x64': 0.139.0 + '@oxc-parser/binding-freebsd-x64': 0.139.0 + '@oxc-parser/binding-linux-arm-gnueabihf': 0.139.0 + '@oxc-parser/binding-linux-arm-musleabihf': 0.139.0 + '@oxc-parser/binding-linux-arm64-gnu': 0.139.0 + '@oxc-parser/binding-linux-arm64-musl': 0.139.0 + '@oxc-parser/binding-linux-ppc64-gnu': 0.139.0 + '@oxc-parser/binding-linux-riscv64-gnu': 0.139.0 + '@oxc-parser/binding-linux-riscv64-musl': 0.139.0 + '@oxc-parser/binding-linux-s390x-gnu': 0.139.0 + '@oxc-parser/binding-linux-x64-gnu': 0.139.0 + '@oxc-parser/binding-linux-x64-musl': 0.139.0 + '@oxc-parser/binding-openharmony-arm64': 0.139.0 + '@oxc-parser/binding-wasm32-wasi': 0.139.0 + '@oxc-parser/binding-win32-arm64-msvc': 0.139.0 + '@oxc-parser/binding-win32-ia32-msvc': 0.139.0 + '@oxc-parser/binding-win32-x64-msvc': 0.139.0 + p-filter@2.1.0: dependencies: p-map: 2.1.0 @@ -3106,8 +3054,6 @@ snapshots: pathval@2.0.0: {} - picocolors@1.1.0: {} - picocolors@1.1.1: {} picomatch@2.3.1: {} @@ -3116,12 +3062,6 @@ snapshots: pify@4.0.1: {} - postcss@8.4.47: - dependencies: - nanoid: 3.3.7 - picocolors: 1.1.0 - source-map-js: 1.2.1 - postcss@8.4.49: dependencies: nanoid: 3.3.7 @@ -3241,9 +3181,9 @@ snapshots: solid-refresh@0.6.3(solid-js@1.9.3): dependencies: - '@babel/generator': 7.26.2 - '@babel/helper-module-imports': 7.25.9 - '@babel/types': 7.26.0 + '@babel/generator': 7.29.7 + '@babel/helper-module-imports': 7.29.7 + '@babel/types': 7.29.7 solid-js: 1.9.3 transitivePeerDependencies: - supports-color @@ -3288,20 +3228,12 @@ snapshots: term-size@2.2.1: {} - terser@5.24.0: - dependencies: - '@jridgewell/source-map': 0.3.5 - acorn: 8.11.2 - commander: 2.20.3 - source-map-support: 0.5.21 - terser@5.36.0: dependencies: '@jridgewell/source-map': 0.3.6 acorn: 8.14.0 commander: 2.20.3 source-map-support: 0.5.21 - optional: true tinybench@2.9.0: {} @@ -3323,8 +3255,6 @@ snapshots: dependencies: os-tmpdir: 1.0.2 - to-fast-properties@2.0.0: {} - to-regex-range@5.0.1: dependencies: is-number: 7.0.0 @@ -3337,6 +3267,9 @@ snapshots: dependencies: punycode: 2.3.1 + tslib@2.8.1: + optional: true + typescript@5.7.2: {} undici-types@6.20.0: {} @@ -3357,9 +3290,10 @@ snapshots: debug: 4.3.7 es-module-lexer: 1.5.4 pathe: 1.1.2 - vite: 5.4.8(@types/node@22.10.0)(terser@5.36.0) + vite: 6.0.0(@types/node@22.10.0)(terser@5.36.0) transitivePeerDependencies: - '@types/node' + - jiti - less - lightningcss - sass @@ -3368,12 +3302,14 @@ snapshots: - sugarss - supports-color - terser + - tsx + - yaml vite-plugin-solid@2.11.0(solid-js@1.9.3)(vite@6.0.0(@types/node@22.10.0)(terser@5.36.0)): dependencies: - '@babel/core': 7.26.0 + '@babel/core': 7.29.7 '@types/babel__core': 7.20.5 - babel-preset-solid: 1.9.3(@babel/core@7.26.0) + babel-preset-solid: 1.9.3(@babel/core@7.29.7) merge-anything: 5.1.7 solid-js: 1.9.3 solid-refresh: 0.6.3(solid-js@1.9.3) @@ -3382,16 +3318,6 @@ snapshots: transitivePeerDependencies: - supports-color - vite@5.4.8(@types/node@22.10.0)(terser@5.36.0): - dependencies: - esbuild: 0.21.5 - postcss: 8.4.47 - rollup: 4.27.4 - optionalDependencies: - '@types/node': 22.10.0 - fsevents: 2.3.3 - terser: 5.36.0 - vite@6.0.0(@types/node@22.10.0)(terser@5.36.0): dependencies: esbuild: 0.24.0 @@ -3409,7 +3335,7 @@ snapshots: vitest@2.1.6(@types/node@22.10.0)(jsdom@25.0.1)(terser@5.36.0): dependencies: '@vitest/expect': 2.1.6 - '@vitest/mocker': 2.1.6(vite@5.4.8(@types/node@22.10.0)(terser@5.36.0)) + '@vitest/mocker': 2.1.6(vite@6.0.0(@types/node@22.10.0)(terser@5.36.0)) '@vitest/pretty-format': 2.1.6 '@vitest/runner': 2.1.6 '@vitest/snapshot': 2.1.6 @@ -3425,13 +3351,14 @@ snapshots: tinyexec: 0.3.1 tinypool: 1.0.2 tinyrainbow: 1.2.0 - vite: 5.4.8(@types/node@22.10.0)(terser@5.36.0) + vite: 6.0.0(@types/node@22.10.0)(terser@5.36.0) vite-node: 2.1.6(@types/node@22.10.0)(terser@5.36.0) why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 22.10.0 jsdom: 25.0.1 transitivePeerDependencies: + - jiti - less - lightningcss - msw @@ -3441,6 +3368,8 @@ snapshots: - sugarss - supports-color - terser + - tsx + - yaml w3c-xmlserializer@5.0.0: dependencies: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 00000000..89723f93 --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,3 @@ +packages: + - "packages/*" + - "examples/*"