Added router

This commit is contained in:
Marc Wieland 2025-07-25 14:34:29 +02:00
parent df7372999b
commit 4934b8043c
91 changed files with 105121 additions and 15 deletions

View File

@ -1,12 +1,18 @@
import { useEffect, useState } from "react";
import { Routes, Route, useNavigate, useLocation } from "react-router-dom";
import LoginPage from "./pages/LoginPage";
import ModeSelectPage from "./pages/ModeSelectPage";
import QuizPage from "./pages/QuizPage";
import SolutionsPage from "./pages/SolutionsPage";
function App() {
const [authenticated, setAuthenticated] = useState(false);
const [mode, setMode] = useState(null);
const location = useLocation();
const navigate = useNavigate();
useEffect(() => {
const isAuth = sessionStorage.getItem("authenticated") === "true";
const savedMode = sessionStorage.getItem("mode");
@ -19,6 +25,11 @@ function App() {
setMode(newMode);
};
if (location.pathname === "/solutions") {
return <SolutionsPage mode={mode || "d"} onBack={() => navigate("/")} />;
}
if (!authenticated) return <LoginPage onSuccess={() => setAuthenticated(true)} />;
if (!mode) return <ModeSelectPage onSelect={handleModeSelect} />;
return <QuizPage mode={mode} onBack={() => setMode(null)} />;

View File

@ -1,10 +1,13 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import {BrowserRouter} from "react-router-dom"
import App from './App.jsx'
import './index.css'
ReactDOM.createRoot(document.getElementById('root')).render(
ReactDOM.createRoot(document.getElementById("root")).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
<BrowserRouter>
<App />
</BrowserRouter>
</React.StrictMode>
);

View File

@ -1,6 +1,7 @@
import { useEffect, useState } from "react";
import QuestionCard from "../components/QuestionCard";
import ResultPage from "./ResultPage";
import {useNavigate} from "react-router-dom";
export default function QuizPage({ mode, onBack, customQuestions }) {
const [questions, setQuestions] = useState([]);
@ -10,6 +11,7 @@ export default function QuizPage({ mode, onBack, customQuestions }) {
const [showResult, setShowResult] = useState(false);
const [refreshKey, setRefreshKey] = useState(0);
const [answerStatus, setAnswerStatus] = useState([]); // "correct" | "wrong" | undefined
const navigate = useNavigate();
useEffect(() => {
@ -127,15 +129,22 @@ useEffect(() => {
<p className="text-sm text-gray-600 dark:text-gray-300">
Frage {currentIdx + 1} / {questions.length}
</p>
<div className="flex items-center gap-3">
<button onClick={() => navigate("/solutions")} className="...">Alle Lösungen anzeigen</button>
<button
className="text-sm text-blue-600 dark:text-blue-400 underline"
onClick={onBack}
>
Modus wechseln
</button>
</div>
<div className="flex items-center gap-3">
<button
onClick={() => navigate("/solutions")}
className="text-sm text-gray-700 dark:text-gray-300 hover:text-blue-600 hover:underline transition"
title="Lösungen durchsuchen"
>
Lösungen anzeigen
</button>
<span className="text-gray-300">|</span>
<button
onClick={onBack}
className="text-sm text-blue-600 dark:text-blue-400 underline hover:text-blue-800 transition"
>
Modus wechseln
</button>
</div>
</div>
{/* Segmentierter Balken */}

53
node_modules/.package-lock.json generated vendored
View File

@ -4,6 +4,15 @@
"lockfileVersion": 3,
"requires": true,
"packages": {
"node_modules/cookie": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-1.0.2.tgz",
"integrity": "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==",
"license": "MIT",
"engines": {
"node": ">=18"
}
},
"node_modules/react": {
"version": "19.1.0",
"resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz",
@ -25,11 +34,55 @@
"react": "^19.1.0"
}
},
"node_modules/react-router": {
"version": "7.7.1",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.7.1.tgz",
"integrity": "sha512-jVKHXoWRIsD/qS6lvGveckwb862EekvapdHJN/cGmzw40KnJH5gg53ujOJ4qX6EKIK9LSBfFed/xiQ5yeXNrUA==",
"license": "MIT",
"dependencies": {
"cookie": "^1.0.1",
"set-cookie-parser": "^2.6.0"
},
"engines": {
"node": ">=20.0.0"
},
"peerDependencies": {
"react": ">=18",
"react-dom": ">=18"
},
"peerDependenciesMeta": {
"react-dom": {
"optional": true
}
}
},
"node_modules/react-router-dom": {
"version": "7.7.1",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.7.1.tgz",
"integrity": "sha512-bavdk2BA5r3MYalGKZ01u8PGuDBloQmzpBZVhDLrOOv1N943Wq6dcM9GhB3x8b7AbqPMEezauv4PeGkAJfy7FQ==",
"license": "MIT",
"dependencies": {
"react-router": "7.7.1"
},
"engines": {
"node": ">=20.0.0"
},
"peerDependencies": {
"react": ">=18",
"react-dom": ">=18"
}
},
"node_modules/scheduler": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.26.0.tgz",
"integrity": "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA==",
"license": "MIT"
},
"node_modules/set-cookie-parser": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz",
"integrity": "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==",
"license": "MIT"
}
}
}

24
node_modules/cookie/LICENSE generated vendored Normal file
View File

@ -0,0 +1,24 @@
(The MIT License)
Copyright (c) 2012-2014 Roman Shtylman <shtylman@gmail.com>
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

248
node_modules/cookie/README.md generated vendored Normal file
View File

@ -0,0 +1,248 @@
# cookie
[![NPM Version][npm-version-image]][npm-url]
[![NPM Downloads][npm-downloads-image]][npm-url]
[![Build Status][ci-image]][ci-url]
[![Coverage Status][coverage-image]][coverage-url]
Basic HTTP cookie parser and serializer for HTTP servers.
## Installation
```sh
$ npm install cookie
```
## API
```js
const cookie = require("cookie");
// import * as cookie from 'cookie';
```
### cookie.parse(str, options)
Parse a HTTP `Cookie` header string and returning an object of all cookie name-value pairs.
The `str` argument is the string representing a `Cookie` header value and `options` is an
optional object containing additional parsing options.
```js
const cookies = cookie.parse("foo=bar; equation=E%3Dmc%5E2");
// { foo: 'bar', equation: 'E=mc^2' }
```
#### Options
`cookie.parse` accepts these properties in the options object.
##### decode
Specifies a function that will be used to decode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).
Since the value of a cookie has a limited character set (and must be a simple string), this function can be used to decode
a previously-encoded cookie value into a JavaScript string.
The default function is the global `decodeURIComponent`, wrapped in a `try..catch`. If an error
is thrown it will return the cookie's original value. If you provide your own encode/decode
scheme you must ensure errors are appropriately handled.
### cookie.serialize(name, value, options)
Serialize a cookie name-value pair into a `Set-Cookie` header string. The `name` argument is the
name for the cookie, the `value` argument is the value to set the cookie to, and the `options`
argument is an optional object containing additional serialization options.
```js
const setCookie = cookie.serialize("foo", "bar");
// foo=bar
```
#### Options
`cookie.serialize` accepts these properties in the options object.
##### encode
Specifies a function that will be used to encode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).
Since value of a cookie has a limited character set (and must be a simple string), this function can be used to encode
a value into a string suited for a cookie's value, and should mirror `decode` when parsing.
The default function is the global `encodeURIComponent`.
##### maxAge
Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.2).
The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and
`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
so if both are set, they should point to the same date and time.
##### expires
Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.1).
When no expiration is set clients consider this a "non-persistent cookie" and delete it the current session is over.
The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and
`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
so if both are set, they should point to the same date and time.
##### domain
Specifies the value for the [`Domain` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.3).
When no domain is set clients consider the cookie to apply to the current domain only.
##### path
Specifies the value for the [`Path` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.4).
When no path is set, the path is considered the ["default path"](https://tools.ietf.org/html/rfc6265#section-5.1.4).
##### httpOnly
Enables the [`HttpOnly` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.6).
When enabled, clients will not allow client-side JavaScript to see the cookie in `document.cookie`.
##### secure
Enables the [`Secure` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.5).
When enabled, clients will only send the cookie back if the browser has a HTTPS connection.
##### partitioned
Enables the [`Partitioned` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/).
When enabled, clients will only send the cookie back when the current domain _and_ top-level domain matches.
This is an attribute that has not yet been fully standardized, and may change in the future.
This also means clients may ignore this attribute until they understand it. More information
about can be found in [the proposal](https://github.com/privacycg/CHIPS).
##### priority
Specifies the value for the [`Priority` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).
- `'low'` will set the `Priority` attribute to `Low`.
- `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.
- `'high'` will set the `Priority` attribute to `High`.
More information about priority levels can be found in [the specification](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).
##### sameSite
Specifies the value for the [`SameSite` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).
- `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
- `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement.
- `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie.
- `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
More information about enforcement levels can be found in [the specification](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).
## Example
The following example uses this module in conjunction with the Node.js core HTTP server
to prompt a user for their name and display it back on future visits.
```js
var cookie = require("cookie");
var escapeHtml = require("escape-html");
var http = require("http");
var url = require("url");
function onRequest(req, res) {
// Parse the query string
var query = url.parse(req.url, true, true).query;
if (query && query.name) {
// Set a new cookie with the name
res.setHeader(
"Set-Cookie",
cookie.serialize("name", String(query.name), {
httpOnly: true,
maxAge: 60 * 60 * 24 * 7, // 1 week
}),
);
// Redirect back after setting cookie
res.statusCode = 302;
res.setHeader("Location", req.headers.referer || "/");
res.end();
return;
}
// Parse the cookies on the request
var cookies = cookie.parse(req.headers.cookie || "");
// Get the visitor name set in the cookie
var name = cookies.name;
res.setHeader("Content-Type", "text/html; charset=UTF-8");
if (name) {
res.write("<p>Welcome back, <b>" + escapeHtml(name) + "</b>!</p>");
} else {
res.write("<p>Hello, new visitor!</p>");
}
res.write('<form method="GET">');
res.write(
'<input placeholder="enter your name" name="name"> <input type="submit" value="Set Name">',
);
res.end("</form>");
}
http.createServer(onRequest).listen(3000);
```
## Testing
```sh
npm test
```
## Benchmark
```sh
npm run bench
```
```
name hz min max mean p75 p99 p995 p999 rme samples
· simple 8,566,313.09 0.0000 0.3694 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.64% 4283157 fastest
· decode 3,834,348.85 0.0001 0.2465 0.0003 0.0003 0.0003 0.0004 0.0006 ±0.38% 1917175
· unquote 8,315,355.96 0.0000 0.3824 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.72% 4157880
· duplicates 1,944,765.97 0.0004 0.2959 0.0005 0.0005 0.0006 0.0006 0.0008 ±0.24% 972384
· 10 cookies 675,345.67 0.0012 0.4328 0.0015 0.0015 0.0019 0.0020 0.0058 ±0.75% 337673
· 100 cookies 61,040.71 0.0152 0.4092 0.0164 0.0160 0.0196 0.0228 0.2260 ±0.71% 30521 slowest
✓ parse top-sites (15) 22945ms
name hz min max mean p75 p99 p995 p999 rme samples
· parse accounts.google.com 7,164,349.17 0.0000 0.0929 0.0001 0.0002 0.0002 0.0002 0.0003 ±0.09% 3582184
· parse apple.com 7,817,686.84 0.0000 0.6048 0.0001 0.0001 0.0002 0.0002 0.0003 ±1.05% 3908844
· parse cloudflare.com 7,189,841.70 0.0000 0.0390 0.0001 0.0002 0.0002 0.0002 0.0003 ±0.06% 3594921
· parse docs.google.com 7,051,765.61 0.0000 0.0296 0.0001 0.0002 0.0002 0.0002 0.0003 ±0.06% 3525883
· parse drive.google.com 7,349,104.77 0.0000 0.0368 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.05% 3674553
· parse en.wikipedia.org 1,929,909.49 0.0004 0.3598 0.0005 0.0005 0.0007 0.0007 0.0012 ±0.16% 964955
· parse linkedin.com 2,225,658.01 0.0003 0.0595 0.0004 0.0005 0.0005 0.0005 0.0006 ±0.06% 1112830
· parse maps.google.com 4,423,511.68 0.0001 0.0942 0.0002 0.0003 0.0003 0.0003 0.0005 ±0.08% 2211756
· parse microsoft.com 3,387,601.88 0.0002 0.0725 0.0003 0.0003 0.0004 0.0004 0.0005 ±0.09% 1693801
· parse play.google.com 7,375,980.86 0.0000 0.1994 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.12% 3687991
· parse support.google.com 4,912,267.94 0.0001 2.8958 0.0002 0.0002 0.0003 0.0003 0.0005 ±1.28% 2456134
· parse www.google.com 3,443,035.87 0.0002 0.2783 0.0003 0.0003 0.0004 0.0004 0.0007 ±0.51% 1721518
· parse youtu.be 1,910,492.87 0.0004 0.3490 0.0005 0.0005 0.0007 0.0007 0.0011 ±0.46% 955247
· parse youtube.com 1,895,082.62 0.0004 0.7454 0.0005 0.0005 0.0006 0.0007 0.0013 ±0.64% 947542 slowest
· parse example.com 21,582,835.27 0.0000 0.1095 0.0000 0.0000 0.0001 0.0001 0.0001 ±0.13% 10791418
```
## References
- [RFC 6265: HTTP State Management Mechanism](https://tools.ietf.org/html/rfc6265)
- [Same-site Cookies](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7)
## License
[MIT](LICENSE)
[ci-image]: https://img.shields.io/github/actions/workflow/status/jshttp/cookie/ci.yml
[ci-url]: https://github.com/jshttp/cookie/actions/workflows/ci.yml?query=branch%3Amaster
[coverage-image]: https://img.shields.io/codecov/c/github/jshttp/cookie/master
[coverage-url]: https://app.codecov.io/gh/jshttp/cookie
[npm-downloads-image]: https://img.shields.io/npm/dm/cookie
[npm-url]: https://npmjs.org/package/cookie
[npm-version-image]: https://img.shields.io/npm/v/cookie

114
node_modules/cookie/dist/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,114 @@
/**
* Parse options.
*/
export interface ParseOptions {
/**
* Specifies a function that will be used to decode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).
* Since the value of a cookie has a limited character set (and must be a simple string), this function can be used to decode
* a previously-encoded cookie value into a JavaScript string.
*
* The default function is the global `decodeURIComponent`, wrapped in a `try..catch`. If an error
* is thrown it will return the cookie's original value. If you provide your own encode/decode
* scheme you must ensure errors are appropriately handled.
*
* @default decode
*/
decode?: (str: string) => string | undefined;
}
/**
* Parse a cookie header.
*
* Parse the given cookie header string into an object
* The object has the various cookies as keys(names) => values
*/
export declare function parse(str: string, options?: ParseOptions): Record<string, string | undefined>;
/**
* Serialize options.
*/
export interface SerializeOptions {
/**
* Specifies a function that will be used to encode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).
* Since value of a cookie has a limited character set (and must be a simple string), this function can be used to encode
* a value into a string suited for a cookie's value, and should mirror `decode` when parsing.
*
* @default encodeURIComponent
*/
encode?: (str: string) => string;
/**
* Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.2).
*
* The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and
* `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
* so if both are set, they should point to the same date and time.
*/
maxAge?: number;
/**
* Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.1).
* When no expiration is set clients consider this a "non-persistent cookie" and delete it the current session is over.
*
* The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and
* `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
* so if both are set, they should point to the same date and time.
*/
expires?: Date;
/**
* Specifies the value for the [`Domain` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.3).
* When no domain is set clients consider the cookie to apply to the current domain only.
*/
domain?: string;
/**
* Specifies the value for the [`Path` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.4).
* When no path is set, the path is considered the ["default path"](https://tools.ietf.org/html/rfc6265#section-5.1.4).
*/
path?: string;
/**
* Enables the [`HttpOnly` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.6).
* When enabled, clients will not allow client-side JavaScript to see the cookie in `document.cookie`.
*/
httpOnly?: boolean;
/**
* Enables the [`Secure` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.5).
* When enabled, clients will only send the cookie back if the browser has a HTTPS connection.
*/
secure?: boolean;
/**
* Enables the [`Partitioned` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/).
* When enabled, clients will only send the cookie back when the current domain _and_ top-level domain matches.
*
* This is an attribute that has not yet been fully standardized, and may change in the future.
* This also means clients may ignore this attribute until they understand it. More information
* about can be found in [the proposal](https://github.com/privacycg/CHIPS).
*/
partitioned?: boolean;
/**
* Specifies the value for the [`Priority` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).
*
* - `'low'` will set the `Priority` attribute to `Low`.
* - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.
* - `'high'` will set the `Priority` attribute to `High`.
*
* More information about priority levels can be found in [the specification](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).
*/
priority?: "low" | "medium" | "high";
/**
* Specifies the value for the [`SameSite` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).
*
* - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
* - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement.
* - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie.
* - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
*
* More information about enforcement levels can be found in [the specification](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).
*/
sameSite?: boolean | "lax" | "strict" | "none";
}
/**
* Serialize data into a cookie header.
*
* Serialize a name value pair into a cookie string suitable for
* http headers. An optional options object specifies cookie parameters.
*
* serialize('foo', 'bar', { httpOnly: true })
* => "foo=bar; httpOnly"
*/
export declare function serialize(name: string, val: string, options?: SerializeOptions): string;

239
node_modules/cookie/dist/index.js generated vendored Normal file
View File

@ -0,0 +1,239 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parse = parse;
exports.serialize = serialize;
/**
* RegExp to match cookie-name in RFC 6265 sec 4.1.1
* This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
* which has been replaced by the token definition in RFC 7230 appendix B.
*
* cookie-name = token
* token = 1*tchar
* tchar = "!" / "#" / "$" / "%" / "&" / "'" /
* "*" / "+" / "-" / "." / "^" / "_" /
* "`" / "|" / "~" / DIGIT / ALPHA
*
* Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191
* Allow same range as cookie value, except `=`, which delimits end of name.
*/
const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
/**
* RegExp to match cookie-value in RFC 6265 sec 4.1.1
*
* cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
* cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
* ; US-ASCII characters excluding CTLs,
* ; whitespace DQUOTE, comma, semicolon,
* ; and backslash
*
* Allowing more characters: https://github.com/jshttp/cookie/issues/191
* Comma, backslash, and DQUOTE are not part of the parsing algorithm.
*/
const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
/**
* RegExp to match domain-value in RFC 6265 sec 4.1.1
*
* domain-value = <subdomain>
* ; defined in [RFC1034], Section 3.5, as
* ; enhanced by [RFC1123], Section 2.1
* <subdomain> = <label> | <subdomain> "." <label>
* <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]
* Labels must be 63 characters or less.
* 'let-dig' not 'letter' in the first char, per RFC1123
* <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>
* <let-dig-hyp> = <let-dig> | "-"
* <let-dig> = <letter> | <digit>
* <letter> = any one of the 52 alphabetic characters A through Z in
* upper case and a through z in lower case
* <digit> = any one of the ten digits 0 through 9
*
* Keep support for leading dot: https://github.com/jshttp/cookie/issues/173
*
* > (Note that a leading %x2E ("."), if present, is ignored even though that
* character is not permitted, but a trailing %x2E ("."), if present, will
* cause the user agent to ignore the attribute.)
*/
const domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
/**
* RegExp to match path-value in RFC 6265 sec 4.1.1
*
* path-value = <any CHAR except CTLs or ";">
* CHAR = %x01-7F
* ; defined in RFC 5234 appendix B.1
*/
const pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
const __toString = Object.prototype.toString;
const NullObject = /* @__PURE__ */ (() => {
const C = function () { };
C.prototype = Object.create(null);
return C;
})();
/**
* Parse a cookie header.
*
* Parse the given cookie header string into an object
* The object has the various cookies as keys(names) => values
*/
function parse(str, options) {
const obj = new NullObject();
const len = str.length;
// RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.
if (len < 2)
return obj;
const dec = options?.decode || decode;
let index = 0;
do {
const eqIdx = str.indexOf("=", index);
if (eqIdx === -1)
break; // No more cookie pairs.
const colonIdx = str.indexOf(";", index);
const endIdx = colonIdx === -1 ? len : colonIdx;
if (eqIdx > endIdx) {
// backtrack on prior semicolon
index = str.lastIndexOf(";", eqIdx - 1) + 1;
continue;
}
const keyStartIdx = startIndex(str, index, eqIdx);
const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
const key = str.slice(keyStartIdx, keyEndIdx);
// only assign once
if (obj[key] === undefined) {
let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
let valEndIdx = endIndex(str, endIdx, valStartIdx);
const value = dec(str.slice(valStartIdx, valEndIdx));
obj[key] = value;
}
index = endIdx + 1;
} while (index < len);
return obj;
}
function startIndex(str, index, max) {
do {
const code = str.charCodeAt(index);
if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
return index;
} while (++index < max);
return max;
}
function endIndex(str, index, min) {
while (index > min) {
const code = str.charCodeAt(--index);
if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
return index + 1;
}
return min;
}
/**
* Serialize data into a cookie header.
*
* Serialize a name value pair into a cookie string suitable for
* http headers. An optional options object specifies cookie parameters.
*
* serialize('foo', 'bar', { httpOnly: true })
* => "foo=bar; httpOnly"
*/
function serialize(name, val, options) {
const enc = options?.encode || encodeURIComponent;
if (!cookieNameRegExp.test(name)) {
throw new TypeError(`argument name is invalid: ${name}`);
}
const value = enc(val);
if (!cookieValueRegExp.test(value)) {
throw new TypeError(`argument val is invalid: ${val}`);
}
let str = name + "=" + value;
if (!options)
return str;
if (options.maxAge !== undefined) {
if (!Number.isInteger(options.maxAge)) {
throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
}
str += "; Max-Age=" + options.maxAge;
}
if (options.domain) {
if (!domainValueRegExp.test(options.domain)) {
throw new TypeError(`option domain is invalid: ${options.domain}`);
}
str += "; Domain=" + options.domain;
}
if (options.path) {
if (!pathValueRegExp.test(options.path)) {
throw new TypeError(`option path is invalid: ${options.path}`);
}
str += "; Path=" + options.path;
}
if (options.expires) {
if (!isDate(options.expires) ||
!Number.isFinite(options.expires.valueOf())) {
throw new TypeError(`option expires is invalid: ${options.expires}`);
}
str += "; Expires=" + options.expires.toUTCString();
}
if (options.httpOnly) {
str += "; HttpOnly";
}
if (options.secure) {
str += "; Secure";
}
if (options.partitioned) {
str += "; Partitioned";
}
if (options.priority) {
const priority = typeof options.priority === "string"
? options.priority.toLowerCase()
: undefined;
switch (priority) {
case "low":
str += "; Priority=Low";
break;
case "medium":
str += "; Priority=Medium";
break;
case "high":
str += "; Priority=High";
break;
default:
throw new TypeError(`option priority is invalid: ${options.priority}`);
}
}
if (options.sameSite) {
const sameSite = typeof options.sameSite === "string"
? options.sameSite.toLowerCase()
: options.sameSite;
switch (sameSite) {
case true:
case "strict":
str += "; SameSite=Strict";
break;
case "lax":
str += "; SameSite=Lax";
break;
case "none":
str += "; SameSite=None";
break;
default:
throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
}
}
return str;
}
/**
* URL-decode string value. Optimized to skip native call when no %.
*/
function decode(str) {
if (str.indexOf("%") === -1)
return str;
try {
return decodeURIComponent(str);
}
catch (e) {
return str;
}
}
/**
* Determine if value is a Date.
*/
function isDate(val) {
return __toString.call(val) === "[object Date]";
}
//# sourceMappingURL=index.js.map

1
node_modules/cookie/dist/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

42
node_modules/cookie/package.json generated vendored Normal file
View File

@ -0,0 +1,42 @@
{
"name": "cookie",
"version": "1.0.2",
"description": "HTTP server cookie parsing and serialization",
"keywords": [
"cookie",
"cookies"
],
"repository": "jshttp/cookie",
"license": "MIT",
"author": "Roman Shtylman <shtylman@gmail.com>",
"contributors": [
"Douglas Christopher Wilson <doug@somethingdoug.com>"
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist/"
],
"scripts": {
"bench": "vitest bench",
"build": "ts-scripts build",
"format": "ts-scripts format",
"prepare": "ts-scripts install",
"prepublishOnly": "npm run build",
"specs": "ts-scripts specs",
"test": "ts-scripts test"
},
"devDependencies": {
"@borderless/ts-scripts": "^0.15.0",
"@vitest/coverage-v8": "^2.1.2",
"top-sites": "1.1.194",
"typescript": "^5.6.2",
"vitest": "^2.1.2"
},
"engines": {
"node": ">=18"
},
"ts-scripts": {
"project": "tsconfig.build.json"
}
}

23
node_modules/react-router-dom/LICENSE.md generated vendored Normal file
View File

@ -0,0 +1,23 @@
MIT License
Copyright (c) React Training LLC 2015-2019
Copyright (c) Remix Software Inc. 2020-2021
Copyright (c) Shopify Inc. 2022-2023
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.

6
node_modules/react-router-dom/README.md generated vendored Normal file
View File

@ -0,0 +1,6 @@
This package simply re-exports everything from `react-router` to smooth the upgrade path for v6 applications. Once upgraded you can change all of your imports and remove it from your dependencies:
```diff
-import { Routes } from "react-router-dom"
+import { Routes } from "react-router"
```

2
node_modules/react-router-dom/dist/index.d.mts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export { HydratedRouter, RouterProvider, RouterProviderProps } from 'react-router/dom';
export * from 'react-router';

2
node_modules/react-router-dom/dist/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export { HydratedRouter, RouterProvider, RouterProviderProps } from 'react-router/dom';
export * from 'react-router';

45
node_modules/react-router-dom/dist/index.js generated vendored Normal file
View File

@ -0,0 +1,45 @@
/**
* react-router-dom v7.7.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// index.ts
var index_exports = {};
__export(index_exports, {
HydratedRouter: () => import_dom.HydratedRouter,
RouterProvider: () => import_dom.RouterProvider
});
module.exports = __toCommonJS(index_exports);
var import_dom = require("react-router/dom");
__reExport(index_exports, require("react-router"), module.exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
HydratedRouter,
RouterProvider,
...require("react-router")
});

18
node_modules/react-router-dom/dist/index.mjs generated vendored Normal file
View File

@ -0,0 +1,18 @@
/**
* react-router-dom v7.7.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
// index.ts
import { HydratedRouter, RouterProvider } from "react-router/dom";
export * from "react-router";
export {
HydratedRouter,
RouterProvider
};

82
node_modules/react-router-dom/package.json generated vendored Normal file
View File

@ -0,0 +1,82 @@
{
"name": "react-router-dom",
"version": "7.7.1",
"description": "Declarative routing for React web applications",
"keywords": [
"react",
"router",
"route",
"routing",
"history",
"link"
],
"repository": {
"type": "git",
"url": "https://github.com/remix-run/react-router",
"directory": "packages/react-router-dom"
},
"license": "MIT",
"author": "Remix Software <hello@remix.run>",
"sideEffects": false,
"main": "./dist/main.js",
"unpkg": "./dist/umd/react-router-dom.production.min.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"node": {
"types": "./dist/index.d.ts",
"module-sync": "./dist/index.mjs",
"default": "./dist/index.js"
},
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"default": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"./package.json": "./package.json"
},
"wireit": {
"build": {
"command": "tsup",
"files": [
"*.ts",
"tsconfig.json",
"package.json"
],
"output": [
"dist/**"
]
}
},
"dependencies": {
"react-router": "7.7.1"
},
"devDependencies": {
"react": "^19.1.0",
"react-dom": "^19.1.0",
"tsup": "^8.3.0",
"typescript": "^5.1.6",
"wireit": "0.14.9"
},
"peerDependencies": {
"react": ">=18",
"react-dom": ">=18"
},
"files": [
"dist/",
"LICENSE.md",
"README.md"
],
"engines": {
"node": ">=20.0.0"
},
"scripts": {
"build": "wireit",
"typecheck": "tsc"
}
}

1811
node_modules/react-router/CHANGELOG.md generated vendored Normal file

File diff suppressed because it is too large Load Diff

23
node_modules/react-router/LICENSE.md generated vendored Normal file
View File

@ -0,0 +1,23 @@
MIT License
Copyright (c) React Training LLC 2015-2019
Copyright (c) Remix Software Inc. 2020-2021
Copyright (c) Shopify Inc. 2022-2023
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.

7
node_modules/react-router/README.md generated vendored Normal file
View File

@ -0,0 +1,7 @@
`react-router` is the primary package in the React Router project.
## Installation
```sh
npm i react-router
```

View File

@ -0,0 +1,226 @@
import { AsyncLocalStorage } from 'node:async_hooks';
import * as React from 'react';
import { u as unstable_RouterContextProvider, i as ActionFunction, C as ClientActionFunction, j as ClientLoaderFunction, k as HeadersFunction, l as LinksFunction, m as LoaderFunction, M as MetaFunction, S as ShouldRevalidateFunction, c as Location, h as Params } from './route-data-CqEmXQub.mjs';
type ServerContext = {
redirect?: Response;
};
declare global {
var ___reactRouterServerStorage___: AsyncLocalStorage<ServerContext> | undefined;
}
type RSCRouteConfigEntryBase = {
action?: ActionFunction;
clientAction?: ClientActionFunction;
clientLoader?: ClientLoaderFunction;
ErrorBoundary?: React.ComponentType<any>;
handle?: any;
headers?: HeadersFunction;
HydrateFallback?: React.ComponentType<any>;
Layout?: React.ComponentType<any>;
links?: LinksFunction;
loader?: LoaderFunction;
meta?: MetaFunction;
shouldRevalidate?: ShouldRevalidateFunction;
};
type RSCRouteConfigEntry = RSCRouteConfigEntryBase & {
id: string;
path?: string;
Component?: React.ComponentType<any>;
lazy?: () => Promise<RSCRouteConfigEntryBase & ({
default?: React.ComponentType<any>;
Component?: never;
} | {
default?: never;
Component?: React.ComponentType<any>;
})>;
} & ({
index: true;
} | {
children?: RSCRouteConfigEntry[];
});
type RSCRouteConfig = Array<RSCRouteConfigEntry>;
type RSCRouteManifest = {
clientAction?: ClientActionFunction;
clientLoader?: ClientLoaderFunction;
element?: React.ReactElement | false;
errorElement?: React.ReactElement;
handle?: any;
hasAction: boolean;
hasComponent: boolean;
hasErrorBoundary: boolean;
hasLoader: boolean;
hydrateFallbackElement?: React.ReactElement;
id: string;
index?: boolean;
links?: LinksFunction;
meta?: MetaFunction;
parentId?: string;
path?: string;
shouldRevalidate?: ShouldRevalidateFunction;
};
type RSCRouteMatch = RSCRouteManifest & {
params: Params;
pathname: string;
pathnameBase: string;
};
type RSCRenderPayload = {
type: "render";
actionData: Record<string, any> | null;
basename: string | undefined;
errors: Record<string, any> | null;
loaderData: Record<string, any>;
location: Location;
matches: RSCRouteMatch[];
patches?: RSCRouteManifest[];
nonce?: string;
formState?: unknown;
};
type RSCManifestPayload = {
type: "manifest";
patches: RSCRouteManifest[];
};
type RSCActionPayload = {
type: "action";
actionResult: Promise<unknown>;
rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>;
};
type RSCRedirectPayload = {
type: "redirect";
status: number;
location: string;
replace: boolean;
reload: boolean;
actionResult?: Promise<unknown>;
};
type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload;
type RSCMatch = {
statusCode: number;
headers: Headers;
payload: RSCPayload;
};
type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
temporaryReferences: unknown;
}) => Promise<unknown[]>;
type LoadServerActionFunction = (id: string) => Promise<Function>;
/**
* Matches the given routes to a Request and returns a RSC Response encoding an
* `RSCPayload` for consumption by a RSC enabled client router.
*
* @example
* import {
* createTemporaryReferenceSet,
* decodeAction,
* decodeReply,
* loadServerAction,
* renderToReadableStream,
* } from "@vitejs/plugin-rsc/rsc";
* import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";
*
* matchRSCServerRequest({
* createTemporaryReferenceSet,
* decodeAction,
* decodeFormState,
* decodeReply,
* loadServerAction,
* request,
* routes: routes(),
* generateResponse(match) {
* return new Response(
* renderToReadableStream(match.payload),
* {
* status: match.statusCode,
* headers: match.headers,
* }
* );
* },
* });
*
* @name unstable_matchRSCServerRequest
* @public
* @category RSC
* @mode data
* @param opts Options
* @param opts.basename The basename to use when matching the request.
* @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction`
* function, responsible for loading a server action.
* @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply`
* function, used to decode the server function's arguments and bind them to the
* implementation for invocation by the router.
* @param opts.decodeFormState A function responsible for decoding form state for
* progressively enhanceable forms with `useActionState` using your
* `react-server-dom-xyz/server`'s `decodeFormState`.
* @param opts.generateResponse A function responsible for using your
* `renderToReadableStream` to generate a Response encoding the `RSCPayload`.
* @param opts.loadServerAction Your `react-server-dom-xyz/server`'s
* `loadServerAction` function, used to load a server action by ID.
* @param opts.request The request to match against.
* @param opts.requestContext An instance of `unstable_RouterContextProvider`
* that should be created per request, to be passed to loaders, actions and middleware.
* @param opts.routes Your route definitions.
* @param opts.createTemporaryReferenceSet A function that returns a temporary
* reference set for the request, used to track temporary references in the RSC stream.
* @param opts.onError An optional error handler that will be called with any
* errors that occur during the request processing.
* @returns A Response that contains the RSC data for hydration.
*/
declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
createTemporaryReferenceSet: () => unknown;
basename?: string;
decodeReply?: DecodeReplyFunction;
decodeAction?: DecodeActionFunction;
decodeFormState?: DecodeFormStateFunction;
requestContext?: unstable_RouterContextProvider;
loadServerAction?: LoadServerActionFunction;
onError?: (error: unknown) => void;
request: Request;
routes: RSCRouteConfigEntry[];
generateResponse: (match: RSCMatch, { temporaryReferences, }: {
temporaryReferences: unknown;
}) => Response;
}): Promise<Response>;
declare global {
interface Window {
__FLIGHT_DATA: any[];
}
}
/**
* Get the prerendered RSC stream for hydration. Usually passed directly to your
* `react-server-dom-xyz/client`'s `createFromReadableStream`.
*
* @example
* import { startTransition, StrictMode } from "react";
* import { hydrateRoot } from "react-dom/client";
* import {
* unstable_getRSCStream as getRSCStream,
* unstable_RSCHydratedRouter as RSCHydratedRouter,
* } from "react-router";
* import type { unstable_RSCPayload as RSCPayload } from "react-router";
*
* createFromReadableStream(getRSCStream()).then(
* (payload: RSCServerPayload) => {
* startTransition(async () => {
* hydrateRoot(
* document,
* <StrictMode>
* <RSCHydratedRouter ...props />
* </StrictMode>,
* {
* // Options
* }
* );
* });
* }
* );
*
* @name unstable_getRSCStream
* @public
* @category RSC
* @mode data
* @returns A `ReadableStream` that contains the RSC data for hydration.
*/
declare function getRSCStream(): ReadableStream<any>;
export { type DecodeActionFunction as D, type LoadServerActionFunction as L, type RSCPayload as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, type RSCManifestPayload as c, type RSCMatch as d, type RSCRenderPayload as e, type RSCRouteManifest as f, getRSCStream as g, type RSCRouteMatch as h, type RSCRouteConfigEntry as i, type RSCRouteConfig as j, matchRSCServerRequest as m };

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,802 @@
import { R as Router$1, I as InitialEntry, T as To, a as RelativeRoutingType, N as NonIndexRouteObject, L as LazyRouteFunction, b as IndexRouteObject, c as Location, A as Action, d as Navigator, e as RouterInit, F as FutureConfig, H as HydrationState, D as DataStrategyFunction, P as PatchRoutesOnNavigationFunction, f as RouteObject, g as RouteMatch, h as Params, U as UIMatch } from './route-data-CqEmXQub.mjs';
import * as React from 'react';
declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & {
hasErrorBoundary: boolean;
};
declare const hydrationRouteProperties: (keyof RouteObject)[];
/**
* @category Data Routers
*/
interface MemoryRouterOpts {
/**
* Basename path for the application.
*/
basename?: string;
/**
* Function to provide the initial context values for all client side
* navigations/fetches
*/
unstable_getContext?: RouterInit["unstable_getContext"];
/**
* Future flags to enable for the router.
*/
future?: Partial<FutureConfig>;
/**
* Hydration data to initialize the router with if you have already performed
* data loading on the server.
*/
hydrationData?: HydrationState;
/**
* Initial entries in the in-memory history stack
*/
initialEntries?: InitialEntry[];
/**
* Index of {@link initialEntries} the application should initialize to
*/
initialIndex?: number;
/**
* Override the default data strategy of loading in parallel.
* Only intended for advanced usage.
*/
dataStrategy?: DataStrategyFunction;
/**
* Lazily define portions of the route tree on navigations.
*/
patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction;
}
/**
* Create a new {@link DataRouter} that manages the application path using an
* in-memory [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
* stack. Useful for non-browser environments without a DOM API.
*
* @public
* @category Data Routers
* @mode data
* @param routes Application routes
* @param opts Options
* @param {MemoryRouterOpts.basename} opts.basename n/a
* @param {MemoryRouterOpts.dataStrategy} opts.dataStrategy n/a
* @param {MemoryRouterOpts.future} opts.future n/a
* @param {MemoryRouterOpts.unstable_getContext} opts.unstable_getContext n/a
* @param {MemoryRouterOpts.hydrationData} opts.hydrationData n/a
* @param {MemoryRouterOpts.initialEntries} opts.initialEntries n/a
* @param {MemoryRouterOpts.initialIndex} opts.initialIndex n/a
* @param {MemoryRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a
* @returns An initialized {@link DataRouter} to pass to {@link RouterProvider | `<RouterProvider>`}
*/
declare function createMemoryRouter(routes: RouteObject[], opts?: MemoryRouterOpts): Router$1;
/**
* @category Types
*/
interface RouterProviderProps {
/**
* The {@link DataRouter} instance to use for navigation and data fetching.
*/
router: Router$1;
/**
* The [`ReactDOM.flushSync`](https://react.dev/reference/react-dom/flushSync)
* implementation to use for flushing updates.
*
* You usually don't have to worry about this:
* - The `RouterProvider` exported from `react-router/dom` handles this internally for you
* - If you are rendering in a non-DOM environment, you can import
* `RouterProvider` from `react-router` and ignore this prop
*/
flushSync?: (fn: () => unknown) => undefined;
}
/**
* Render the UI for the given {@link DataRouter}. This component should
* typically be at the top of an app's element tree.
*
* @example
* import { createBrowserRouter } from "react-router";
* import { RouterProvider } from "react-router/dom";
* import { createRoot } from "react-dom/client";
*
* const router = createBrowserRouter(routes);
* createRoot(document.getElementById("root")).render(
* <RouterProvider router={router} />
* );
*
* @public
* @category Data Routers
* @mode data
* @param props Props
* @param {RouterProviderProps.flushSync} props.flushSync n/a
* @param {RouterProviderProps.router} props.router n/a
* @returns React element for the rendered router
*/
declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, }: RouterProviderProps): React.ReactElement;
/**
* @category Types
*/
interface MemoryRouterProps {
/**
* Application basename
*/
basename?: string;
/**
* Nested {@link Route} elements describing the route tree
*/
children?: React.ReactNode;
/**
* Initial entries in the in-memory history stack
*/
initialEntries?: InitialEntry[];
/**
* Index of {@link initialEntries} the application should initialize to
*/
initialIndex?: number;
}
/**
* A declarative {@link Router | `<Router>`} that stores all entries in memory.
*
* @public
* @category Declarative Routers
* @mode declarative
* @param props Props
* @param {MemoryRouterProps.basename} props.basename n/a
* @param {MemoryRouterProps.children} props.children n/a
* @param {MemoryRouterProps.initialEntries} props.initialEntries n/a
* @param {MemoryRouterProps.initialIndex} props.initialIndex n/a
* @returns A declarative in memory router for client side routing.
*/
declare function MemoryRouter({ basename, children, initialEntries, initialIndex, }: MemoryRouterProps): React.ReactElement;
/**
* @category Types
*/
interface NavigateProps {
/**
* The path to navigate to. This can be a string or a {@link Path} object
*/
to: To;
/**
* Whether to replace the current entry in the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
* stack
*/
replace?: boolean;
/**
* State to pass to the new {@link Location} to store in [`history.state`](https://developer.mozilla.org/en-US/docs/Web/API/History/state).
*/
state?: any;
/**
* How to interpret relative routing in the {@link to} prop.
* See {@link RelativeRoutingType}.
*/
relative?: RelativeRoutingType;
}
/**
* A component-based version of {@link useNavigate} to use in a
* [`React.Component` class](https://react.dev/reference/react/Component) where
* hooks cannot be used.
*
* It's recommended to avoid using this component in favor of {@link useNavigate}.
*
* @example
* <Navigate to="/tasks" />
*
* @public
* @category Components
* @param props Props
* @param {NavigateProps.relative} props.relative n/a
* @param {NavigateProps.replace} props.replace n/a
* @param {NavigateProps.state} props.state n/a
* @param {NavigateProps.to} props.to n/a
* @returns {void}
*
*/
declare function Navigate({ to, replace, state, relative, }: NavigateProps): null;
/**
* @category Types
*/
interface OutletProps {
/**
* Provides a context value to the element tree below the outlet. Use when
* the parent route needs to provide values to child routes.
*
* ```tsx
* <Outlet context={myContextValue} />
* ```
*
* Access the context with {@link useOutletContext}.
*/
context?: unknown;
}
/**
* Renders the matching child route of a parent route or nothing if no child
* route matches.
*
* @example
* import { Outlet } from "react-router";
*
* export default function SomeParent() {
* return (
* <div>
* <h1>Parent Content</h1>
* <Outlet />
* </div>
* );
* }
*
* @public
* @category Components
* @param props Props
* @param {OutletProps.context} props.context n/a
* @returns React element for the rendered outlet or `null` if no child route matches.
*/
declare function Outlet(props: OutletProps): React.ReactElement | null;
/**
* @category Types
*/
interface PathRouteProps {
/**
* Whether the path should be case-sensitive. Defaults to `false`.
*/
caseSensitive?: NonIndexRouteObject["caseSensitive"];
/**
* The path pattern to match. If unspecified or empty, then this becomes a
* layout route.
*/
path?: NonIndexRouteObject["path"];
/**
* The unique identifier for this route (for use with {@link DataRouter}s)
*/
id?: NonIndexRouteObject["id"];
/**
* A function that returns a promise that resolves to the route object.
* Used for code-splitting routes.
* See [`lazy`](../../start/data/route-object#lazy).
*/
lazy?: LazyRouteFunction<NonIndexRouteObject>;
/**
* The route loader.
* See [`loader`](../../start/data/route-object#loader).
*/
loader?: NonIndexRouteObject["loader"];
/**
* The route action.
* See [`action`](../../start/data/route-object#action).
*/
action?: NonIndexRouteObject["action"];
hasErrorBoundary?: NonIndexRouteObject["hasErrorBoundary"];
/**
* The route shouldRevalidate function.
* See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate).
*/
shouldRevalidate?: NonIndexRouteObject["shouldRevalidate"];
/**
* The route handle.
*/
handle?: NonIndexRouteObject["handle"];
/**
* Whether this is an index route.
*/
index?: false;
/**
* Child Route components
*/
children?: React.ReactNode;
/**
* The React element to render when this Route matches.
* Mutually exclusive with {@link Component}.
*/
element?: React.ReactNode | null;
/**
* The React element to render while this router is loading data.
* Mutually exclusive with {@link HydrateFallback}.
*/
hydrateFallbackElement?: React.ReactNode | null;
/**
* The React element to render at this route if an error occurs.
* Mutually exclusive with {@link ErrorBoundary}.
*/
errorElement?: React.ReactNode | null;
/**
* The React Component to render when this route matches.
* Mutually exclusive with {@link element}.
*/
Component?: React.ComponentType | null;
/**
* The React Component to render while this router is loading data.
* Mutually exclusive with {@link hydrateFallbackElement}.
*/
HydrateFallback?: React.ComponentType | null;
/**
* The React Component to render at this route if an error occurs.
* Mutually exclusive with {@link errorElement}.
*/
ErrorBoundary?: React.ComponentType | null;
}
/**
* @category Types
*/
interface LayoutRouteProps extends PathRouteProps {
}
/**
* @category Types
*/
interface IndexRouteProps {
/**
* Whether the path should be case-sensitive. Defaults to `false`.
*/
caseSensitive?: IndexRouteObject["caseSensitive"];
/**
* The path pattern to match. If unspecified or empty, then this becomes a
* layout route.
*/
path?: IndexRouteObject["path"];
/**
* The unique identifier for this route (for use with {@link DataRouter}s)
*/
id?: IndexRouteObject["id"];
/**
* A function that returns a promise that resolves to the route object.
* Used for code-splitting routes.
* See [`lazy`](../../start/data/route-object#lazy).
*/
lazy?: LazyRouteFunction<IndexRouteObject>;
/**
* The route loader.
* See [`loader`](../../start/data/route-object#loader).
*/
loader?: IndexRouteObject["loader"];
/**
* The route action.
* See [`action`](../../start/data/route-object#action).
*/
action?: IndexRouteObject["action"];
hasErrorBoundary?: IndexRouteObject["hasErrorBoundary"];
/**
* The route shouldRevalidate function.
* See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate).
*/
shouldRevalidate?: IndexRouteObject["shouldRevalidate"];
/**
* The route handle.
*/
handle?: IndexRouteObject["handle"];
/**
* Whether this is an index route.
*/
index: true;
/**
* Child Route components
*/
children?: undefined;
/**
* The React element to render when this Route matches.
* Mutually exclusive with {@link Component}.
*/
element?: React.ReactNode | null;
/**
* The React element to render while this router is loading data.
* Mutually exclusive with {@link HydrateFallback}.
*/
hydrateFallbackElement?: React.ReactNode | null;
/**
* The React element to render at this route if an error occurs.
* Mutually exclusive with {@link ErrorBoundary}.
*/
errorElement?: React.ReactNode | null;
/**
* The React Component to render when this route matches.
* Mutually exclusive with {@link element}.
*/
Component?: React.ComponentType | null;
/**
* The React Component to render while this router is loading data.
* Mutually exclusive with {@link hydrateFallbackElement}.
*/
HydrateFallback?: React.ComponentType | null;
/**
* The React Component to render at this route if an error occurs.
* Mutually exclusive with {@link errorElement}.
*/
ErrorBoundary?: React.ComponentType | null;
}
type RouteProps = PathRouteProps | LayoutRouteProps | IndexRouteProps;
/**
* Configures an element to render when a pattern matches the current location.
* It must be rendered within a {@link Routes} element. Note that these routes
* do not participate in data loading, actions, code splitting, or any other
* route module features.
*
* @example
* // Usually used in a declarative router
* function App() {
* return (
* <BrowserRouter>
* <Routes>
* <Route index element={<StepOne />} />
* <Route path="step-2" element={<StepTwo />} />
* <Route path="step-3" element={<StepThree />} />
* </Routes>
* </BrowserRouter>
* );
* }
*
* // But can be used with a data router as well if you prefer the JSX notation
* const routes = createRoutesFromElements(
* <>
* <Route index loader={step1Loader} Component={StepOne} />
* <Route path="step-2" loader={step2Loader} Component={StepTwo} />
* <Route path="step-3" loader={step3Loader} Component={StepThree} />
* </>
* );
*
* const router = createBrowserRouter(routes);
*
* function App() {
* return <RouterProvider router={router} />;
* }
*
* @public
* @category Components
* @param props Props
* @param {PathRouteProps.action} props.action n/a
* @param {PathRouteProps.caseSensitive} props.caseSensitive n/a
* @param {PathRouteProps.Component} props.Component n/a
* @param {PathRouteProps.children} props.children n/a
* @param {PathRouteProps.element} props.element n/a
* @param {PathRouteProps.ErrorBoundary} props.ErrorBoundary n/a
* @param {PathRouteProps.errorElement} props.errorElement n/a
* @param {PathRouteProps.handle} props.handle n/a
* @param {PathRouteProps.HydrateFallback} props.HydrateFallback n/a
* @param {PathRouteProps.hydrateFallbackElement} props.hydrateFallbackElement n/a
* @param {PathRouteProps.id} props.id n/a
* @param {PathRouteProps.index} props.index n/a
* @param {PathRouteProps.lazy} props.lazy n/a
* @param {PathRouteProps.loader} props.loader n/a
* @param {PathRouteProps.path} props.path n/a
* @param {PathRouteProps.shouldRevalidate} props.shouldRevalidate n/a
* @returns {void}
*/
declare function Route(props: RouteProps): React.ReactElement | null;
/**
* @category Types
*/
interface RouterProps {
/**
* The base path for the application. This is prepended to all locations
*/
basename?: string;
/**
* Nested {@link Route} elements describing the route tree
*/
children?: React.ReactNode;
/**
* The location to match against. Defaults to the current location.
* This can be a string or a {@link Location} object.
*/
location: Partial<Location> | string;
/**
* The type of navigation that triggered this location change.
* Defaults to {@link NavigationType.Pop}.
*/
navigationType?: Action;
/**
* The navigator to use for navigation. This is usually a history object
* or a custom navigator that implements the {@link Navigator} interface.
*/
navigator: Navigator;
/**
* Whether this router is static or not (used for SSR). If `true`, the router
* will not be reactive to location changes.
*/
static?: boolean;
}
/**
* Provides location context for the rest of the app.
*
* Note: You usually won't render a `<Router>` directly. Instead, you'll render a
* router that is more specific to your environment such as a {@link BrowserRouter}
* in web browsers or a {@link ServerRouter} for server rendering.
*
* @public
* @category Declarative Routers
* @mode declarative
* @param props Props
* @param {RouterProps.basename} props.basename n/a
* @param {RouterProps.children} props.children n/a
* @param {RouterProps.location} props.location n/a
* @param {RouterProps.navigationType} props.navigationType n/a
* @param {RouterProps.navigator} props.navigator n/a
* @param {RouterProps.static} props.static n/a
* @returns React element for the rendered router or `null` if the location does
* not match the {@link props.basename}
*/
declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, }: RouterProps): React.ReactElement | null;
/**
* @category Types
*/
interface RoutesProps {
/**
* Nested {@link Route} elements
*/
children?: React.ReactNode;
/**
* The {@link Location} to match against. Defaults to the current location.
*/
location?: Partial<Location> | string;
}
/**
* Renders a branch of {@link Route | `<Route>`s} that best matches the current
* location. Note that these routes do not participate in [data loading](../../start/framework/route-module#loader),
* [`action`](../../start/framework/route-module#action), code splitting, or
* any other [route module](../../start/framework/route-module) features.
*
* @example
* import { Route, Routes } from "react-router";
*
* <Routes>
* <Route index element={<StepOne />} />
* <Route path="step-2" element={<StepTwo />} />
* <Route path="step-3" element={<StepThree />}>
* </Routes>
*
* @public
* @category Components
* @param props Props
* @param {RoutesProps.children} props.children n/a
* @param {RoutesProps.location} props.location n/a
* @returns React element for the rendered routes or `null` if no route matches
*/
declare function Routes({ children, location, }: RoutesProps): React.ReactElement | null;
interface AwaitResolveRenderFunction<Resolve = any> {
(data: Awaited<Resolve>): React.ReactNode;
}
/**
* @category Types
*/
interface AwaitProps<Resolve> {
/**
* When using a function, the resolved value is provided as the parameter.
*
* ```tsx [2]
* <Await resolve={reviewsPromise}>
* {(resolvedReviews) => <Reviews items={resolvedReviews} />}
* </Await>
* ```
*
* When using React elements, {@link useAsyncValue} will provide the
* resolved value:
*
* ```tsx [2]
* <Await resolve={reviewsPromise}>
* <Reviews />
* </Await>
*
* function Reviews() {
* const resolvedReviews = useAsyncValue();
* return <div>...</div>;
* }
* ```
*/
children: React.ReactNode | AwaitResolveRenderFunction<Resolve>;
/**
* The error element renders instead of the `children` when the [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
* rejects.
*
* ```tsx
* <Await
* errorElement={<div>Oops</div>}
* resolve={reviewsPromise}
* >
* <Reviews />
* </Await>
* ```
*
* To provide a more contextual error, you can use the {@link useAsyncError} in a
* child component
*
* ```tsx
* <Await
* errorElement={<ReviewsError />}
* resolve={reviewsPromise}
* >
* <Reviews />
* </Await>
*
* function ReviewsError() {
* const error = useAsyncError();
* return <div>Error loading reviews: {error.message}</div>;
* }
* ```
*
* If you do not provide an `errorElement`, the rejected value will bubble up
* to the nearest route-level [`ErrorBoundary`](../../start/framework/route-module#errorboundary)
* and be accessible via the {@link useRouteError} hook.
*/
errorElement?: React.ReactNode;
/**
* Takes a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
* returned from a [`loader`](../../start/framework/route-module#loader) to be
* resolved and rendered.
*
* ```tsx
* import { Await, useLoaderData } from "react-router";
*
* export async function loader() {
* let reviews = getReviews(); // not awaited
* let book = await getBook();
* return {
* book,
* reviews, // this is a promise
* };
* }
*
* export default function Book() {
* const {
* book,
* reviews, // this is the same promise
* } = useLoaderData();
*
* return (
* <div>
* <h1>{book.title}</h1>
* <p>{book.description}</p>
* <React.Suspense fallback={<ReviewsSkeleton />}>
* <Await
* // and is the promise we pass to Await
* resolve={reviews}
* >
* <Reviews />
* </Await>
* </React.Suspense>
* </div>
* );
* }
* ```
*/
resolve: Resolve;
}
/**
* Used to render promise values with automatic error handling.
*
* **Note:** `<Await>` expects to be rendered inside a [`<React.Suspense>`](https://react.dev/reference/react/Suspense)
*
* @example
* import { Await, useLoaderData } from "react-router";
*
* export async function loader() {
* // not awaited
* const reviews = getReviews();
* // awaited (blocks the transition)
* const book = await fetch("/api/book").then((res) => res.json());
* return { book, reviews };
* }
*
* function Book() {
* const { book, reviews } = useLoaderData();
* return (
* <div>
* <h1>{book.title}</h1>
* <p>{book.description}</p>
* <React.Suspense fallback={<ReviewsSkeleton />}>
* <Await
* resolve={reviews}
* errorElement={
* <div>Could not load reviews 😬</div>
* }
* children={(resolvedReviews) => (
* <Reviews items={resolvedReviews} />
* )}
* />
* </React.Suspense>
* </div>
* );
* }
*
* @public
* @category Components
* @mode framework
* @mode data
* @param props Props
* @param {AwaitProps.children} props.children n/a
* @param {AwaitProps.errorElement} props.errorElement n/a
* @param {AwaitProps.resolve} props.resolve n/a
* @returns React element for the rendered awaited value
*/
declare function Await<Resolve>({ children, errorElement, resolve, }: AwaitProps<Resolve>): React.JSX.Element;
/**
* Creates a route config from a React "children" object, which is usually
* either a `<Route>` element or an array of them. Used internally by
* `<Routes>` to create a route config from its children.
*
* @category Utils
* @mode data
* @param children The React children to convert into a route config
* @param parentPath The path of the parent route, used to generate unique IDs.
* @returns An array of {@link RouteObject}s that can be used with a {@link DataRouter}
*/
declare function createRoutesFromChildren(children: React.ReactNode, parentPath?: number[]): RouteObject[];
/**
* Create route objects from JSX elements instead of arrays of objects.
*
* @example
* const routes = createRoutesFromElements(
* <>
* <Route index loader={step1Loader} Component={StepOne} />
* <Route path="step-2" loader={step2Loader} Component={StepTwo} />
* <Route path="step-3" loader={step3Loader} Component={StepThree} />
* </>
* );
*
* const router = createBrowserRouter(routes);
*
* function App() {
* return <RouterProvider router={router} />;
* }
*
* @name createRoutesFromElements
* @public
* @category Utils
* @mode data
* @param children The React children to convert into a route config
* @param parentPath The path of the parent route, used to generate unique IDs.
* This is used for internal recursion and is not intended to be used by the
* application developer.
* @returns An array of {@link RouteObject}s that can be used with a {@link DataRouter}
*/
declare const createRoutesFromElements: typeof createRoutesFromChildren;
/**
* Renders the result of {@link matchRoutes} into a React element.
*
* @public
* @category Utils
* @param matches The array of {@link RouteMatch | route matches} to render
* @returns A React element that renders the matched routes or `null` if no matches
*/
declare function renderMatches(matches: RouteMatch[] | null): React.ReactElement | null;
declare function useRouteComponentProps(): {
params: Readonly<Params<string>>;
loaderData: any;
actionData: any;
matches: UIMatch<unknown, unknown>[];
};
type RouteComponentProps = ReturnType<typeof useRouteComponentProps>;
type RouteComponentType = React.ComponentType<RouteComponentProps>;
declare function WithComponentProps({ children, }: {
children: React.ReactElement;
}): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
declare function withComponentProps(Component: RouteComponentType): () => React.ReactElement<{
params: Readonly<Params<string>>;
loaderData: any;
actionData: any;
matches: UIMatch<unknown, unknown>[];
}, string | React.JSXElementConstructor<any>>;
declare function useHydrateFallbackProps(): {
params: Readonly<Params<string>>;
loaderData: any;
actionData: any;
};
type HydrateFallbackProps = ReturnType<typeof useHydrateFallbackProps>;
type HydrateFallbackType = React.ComponentType<HydrateFallbackProps>;
declare function WithHydrateFallbackProps({ children, }: {
children: React.ReactElement;
}): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
declare function withHydrateFallbackProps(HydrateFallback: HydrateFallbackType): () => React.ReactElement<{
params: Readonly<Params<string>>;
loaderData: any;
actionData: any;
}, string | React.JSXElementConstructor<any>>;
declare function useErrorBoundaryProps(): {
params: Readonly<Params<string>>;
loaderData: any;
actionData: any;
error: unknown;
};
type ErrorBoundaryProps = ReturnType<typeof useErrorBoundaryProps>;
type ErrorBoundaryType = React.ComponentType<ErrorBoundaryProps>;
declare function WithErrorBoundaryProps({ children, }: {
children: React.ReactElement;
}): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
declare function withErrorBoundaryProps(ErrorBoundary: ErrorBoundaryType): () => React.ReactElement<{
params: Readonly<Params<string>>;
loaderData: any;
actionData: any;
error: unknown;
}, string | React.JSXElementConstructor<any>>;
export { type AwaitProps as A, type ErrorBoundaryType as E, type HydrateFallbackType as H, type IndexRouteProps as I, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateProps as N, type OutletProps as O, type PathRouteProps as P, type RouterProviderProps as R, WithComponentProps as W, type RouteComponentType as a, type MemoryRouterProps as b, type RouteProps as c, type RouterProps as d, type RoutesProps as e, Await as f, MemoryRouter as g, Navigate as h, Outlet as i, Route as j, Router as k, RouterProvider as l, Routes as m, createMemoryRouter as n, createRoutesFromChildren as o, createRoutesFromElements as p, hydrationRouteProperties as q, renderMatches as r, mapRouteProperties as s, WithHydrateFallbackProps as t, withHydrateFallbackProps as u, WithErrorBoundaryProps as v, withComponentProps as w, withErrorBoundaryProps as x };

View File

@ -0,0 +1,32 @@
import * as React from 'react';
import { R as RouterProviderProps$1 } from './components-CjQijYga.mjs';
import './browser-7LYX59NK.mjs';
import { e as RouterInit } from './route-data-CqEmXQub.mjs';
import 'node:async_hooks';
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
interface HydratedRouterProps {
/**
* Context object to passed through to `createBrowserRouter` and made available
* to `clientLoader`/`clientActon` functions
*/
unstable_getContext?: RouterInit["unstable_getContext"];
}
/**
* Framework-mode router component to be used to to hydrate a router from a
* `ServerRouter`. See [`entry.client.tsx`](../api/framework-conventions/entry.client.tsx).
*
* @public
* @category Framework Routers
* @mode framework
* @param props Props
* @param props.unstable_getContext Context object to passed through to
* {@link createBrowserRouter} and made available to `clientLoader`/`clientAction`
* functions
* @returns A React element that represents the hydrated application.
*/
declare function HydratedRouter(props: HydratedRouterProps): React.JSX.Element;
export { HydratedRouter, RouterProvider, type RouterProviderProps };

View File

@ -0,0 +1,29 @@
import * as React from 'react';
import { RouterProviderProps as RouterProviderProps$1, RouterInit } from 'react-router';
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
interface HydratedRouterProps {
/**
* Context object to passed through to `createBrowserRouter` and made available
* to `clientLoader`/`clientActon` functions
*/
unstable_getContext?: RouterInit["unstable_getContext"];
}
/**
* Framework-mode router component to be used to to hydrate a router from a
* `ServerRouter`. See [`entry.client.tsx`](../api/framework-conventions/entry.client.tsx).
*
* @public
* @category Framework Routers
* @mode framework
* @param props Props
* @param props.unstable_getContext Context object to passed through to
* {@link createBrowserRouter} and made available to `clientLoader`/`clientAction`
* functions
* @returns A React element that represents the hydrated application.
*/
declare function HydratedRouter(props: HydratedRouterProps): React.JSX.Element;
export { HydratedRouter, RouterProvider, type RouterProviderProps };

View File

@ -0,0 +1,234 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
* react-router v7.7.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
"use client";
var _chunkK7YFBME3js = require('./chunk-K7YFBME3.js');
// lib/dom-export/dom-router-provider.tsx
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react);
var _reactdom = require('react-dom'); var ReactDOM = _interopRequireWildcard(_reactdom);
var _reactrouter = require('react-router');
function RouterProvider(props) {
return /* @__PURE__ */ React.createElement(_reactrouter.RouterProvider, { flushSync: ReactDOM.flushSync, ...props });
}
// lib/dom-export/hydrated-router.tsx
var ssrInfo = null;
var router = null;
function initSsrInfo() {
if (!ssrInfo && window.__reactRouterContext && window.__reactRouterManifest && window.__reactRouterRouteModules) {
if (window.__reactRouterManifest.sri === true) {
const importMap = document.querySelector("script[rr-importmap]");
if (_optionalChain([importMap, 'optionalAccess', _ => _.textContent])) {
try {
window.__reactRouterManifest.sri = JSON.parse(
importMap.textContent
).integrity;
} catch (err) {
console.error("Failed to parse import map", err);
}
}
}
ssrInfo = {
context: window.__reactRouterContext,
manifest: window.__reactRouterManifest,
routeModules: window.__reactRouterRouteModules,
stateDecodingPromise: void 0,
router: void 0,
routerInitialized: false
};
}
}
function createHydratedRouter({
unstable_getContext
}) {
initSsrInfo();
if (!ssrInfo) {
throw new Error(
"You must be using the SSR features of React Router in order to skip passing a `router` prop to `<RouterProvider>`"
);
}
let localSsrInfo = ssrInfo;
if (!ssrInfo.stateDecodingPromise) {
let stream = ssrInfo.context.stream;
_reactrouter.UNSAFE_invariant.call(void 0, stream, "No stream found for single fetch decoding");
ssrInfo.context.stream = void 0;
ssrInfo.stateDecodingPromise = _reactrouter.UNSAFE_decodeViaTurboStream.call(void 0, stream, window).then((value) => {
ssrInfo.context.state = value.value;
localSsrInfo.stateDecodingPromise.value = true;
}).catch((e) => {
localSsrInfo.stateDecodingPromise.error = e;
});
}
if (ssrInfo.stateDecodingPromise.error) {
throw ssrInfo.stateDecodingPromise.error;
}
if (!ssrInfo.stateDecodingPromise.value) {
throw ssrInfo.stateDecodingPromise;
}
let routes = _reactrouter.UNSAFE_createClientRoutes.call(void 0,
ssrInfo.manifest.routes,
ssrInfo.routeModules,
ssrInfo.context.state,
ssrInfo.context.ssr,
ssrInfo.context.isSpaMode
);
let hydrationData = void 0;
if (ssrInfo.context.isSpaMode) {
let { loaderData } = ssrInfo.context.state;
if (_optionalChain([ssrInfo, 'access', _2 => _2.manifest, 'access', _3 => _3.routes, 'access', _4 => _4.root, 'optionalAccess', _5 => _5.hasLoader]) && loaderData && "root" in loaderData) {
hydrationData = {
loaderData: {
root: loaderData.root
}
};
}
} else {
hydrationData = _reactrouter.UNSAFE_getHydrationData.call(void 0,
ssrInfo.context.state,
routes,
(routeId) => ({
clientLoader: _optionalChain([ssrInfo, 'access', _6 => _6.routeModules, 'access', _7 => _7[routeId], 'optionalAccess', _8 => _8.clientLoader]),
hasLoader: _optionalChain([ssrInfo, 'access', _9 => _9.manifest, 'access', _10 => _10.routes, 'access', _11 => _11[routeId], 'optionalAccess', _12 => _12.hasLoader]) === true,
hasHydrateFallback: _optionalChain([ssrInfo, 'access', _13 => _13.routeModules, 'access', _14 => _14[routeId], 'optionalAccess', _15 => _15.HydrateFallback]) != null
}),
window.location,
_optionalChain([window, 'access', _16 => _16.__reactRouterContext, 'optionalAccess', _17 => _17.basename]),
ssrInfo.context.isSpaMode
);
if (hydrationData && hydrationData.errors) {
hydrationData.errors = _reactrouter.UNSAFE_deserializeErrors.call(void 0, hydrationData.errors);
}
}
let router2 = _reactrouter.UNSAFE_createRouter.call(void 0, {
routes,
history: _reactrouter.UNSAFE_createBrowserHistory.call(void 0, ),
basename: ssrInfo.context.basename,
unstable_getContext,
hydrationData,
hydrationRouteProperties: _reactrouter.UNSAFE_hydrationRouteProperties,
mapRouteProperties: _reactrouter.UNSAFE_mapRouteProperties,
future: {
unstable_middleware: ssrInfo.context.future.unstable_middleware
},
dataStrategy: _reactrouter.UNSAFE_getTurboStreamSingleFetchDataStrategy.call(void 0,
() => router2,
ssrInfo.manifest,
ssrInfo.routeModules,
ssrInfo.context.ssr,
ssrInfo.context.basename
),
patchRoutesOnNavigation: _reactrouter.UNSAFE_getPatchRoutesOnNavigationFunction.call(void 0,
ssrInfo.manifest,
ssrInfo.routeModules,
ssrInfo.context.ssr,
ssrInfo.context.routeDiscovery,
ssrInfo.context.isSpaMode,
ssrInfo.context.basename
)
});
ssrInfo.router = router2;
if (router2.state.initialized) {
ssrInfo.routerInitialized = true;
router2.initialize();
}
router2.createRoutesForHMR = /* spacer so ts-ignore does not affect the right hand of the assignment */
_reactrouter.UNSAFE_createClientRoutesWithHMRRevalidationOptOut;
window.__reactRouterDataRouter = router2;
return router2;
}
function HydratedRouter(props) {
if (!router) {
router = createHydratedRouter({
unstable_getContext: props.unstable_getContext
});
}
let [criticalCss, setCriticalCss] = React2.useState(
process.env.NODE_ENV === "development" ? _optionalChain([ssrInfo, 'optionalAccess', _18 => _18.context, 'access', _19 => _19.criticalCss]) : void 0
);
React2.useEffect(() => {
if (process.env.NODE_ENV === "development") {
setCriticalCss(void 0);
}
}, []);
React2.useEffect(() => {
if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
document.querySelectorAll(`[${_chunkK7YFBME3js.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
}
}, [criticalCss]);
let [location, setLocation] = React2.useState(router.state.location);
React2.useLayoutEffect(() => {
if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {
ssrInfo.routerInitialized = true;
ssrInfo.router.initialize();
}
}, []);
React2.useLayoutEffect(() => {
if (ssrInfo && ssrInfo.router) {
return ssrInfo.router.subscribe((newState) => {
if (newState.location !== location) {
setLocation(newState.location);
}
});
}
}, [location]);
_reactrouter.UNSAFE_invariant.call(void 0, ssrInfo, "ssrInfo unavailable for HydratedRouter");
_reactrouter.UNSAFE_useFogOFWarDiscovery.call(void 0,
router,
ssrInfo.manifest,
ssrInfo.routeModules,
ssrInfo.context.ssr,
ssrInfo.context.routeDiscovery,
ssrInfo.context.isSpaMode
);
return (
// This fragment is important to ensure we match the <ServerRouter> JSX
// structure so that useId values hydrate correctly
/* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
_reactrouter.UNSAFE_FrameworkContext.Provider,
{
value: {
manifest: ssrInfo.manifest,
routeModules: ssrInfo.routeModules,
future: ssrInfo.context.future,
criticalCss,
ssr: ssrInfo.context.ssr,
isSpaMode: ssrInfo.context.isSpaMode,
routeDiscovery: ssrInfo.context.routeDiscovery
}
},
/* @__PURE__ */ React2.createElement(_reactrouter.UNSAFE_RemixErrorBoundary, { location }, /* @__PURE__ */ React2.createElement(RouterProvider, { router }))
), /* @__PURE__ */ React2.createElement(React2.Fragment, null))
);
}
exports.HydratedRouter = HydratedRouter; exports.RouterProvider = RouterProvider;

View File

@ -0,0 +1,234 @@
/**
* react-router v7.7.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
"use client";
import {
deserializeErrors,
getHydrationData
} from "./chunk-KIUJAIYX.mjs";
import {
CRITICAL_CSS_DATA_ATTRIBUTE,
FrameworkContext,
RemixErrorBoundary,
RouterProvider,
createBrowserHistory,
createClientRoutes,
createClientRoutesWithHMRRevalidationOptOut,
createRouter,
decodeViaTurboStream,
getPatchRoutesOnNavigationFunction,
getTurboStreamSingleFetchDataStrategy,
hydrationRouteProperties,
invariant,
mapRouteProperties,
useFogOFWarDiscovery
} from "./chunk-C37GKA54.mjs";
// lib/dom-export/dom-router-provider.tsx
import * as React from "react";
import * as ReactDOM from "react-dom";
function RouterProvider2(props) {
return /* @__PURE__ */ React.createElement(RouterProvider, { flushSync: ReactDOM.flushSync, ...props });
}
// lib/dom-export/hydrated-router.tsx
import * as React2 from "react";
var ssrInfo = null;
var router = null;
function initSsrInfo() {
if (!ssrInfo && window.__reactRouterContext && window.__reactRouterManifest && window.__reactRouterRouteModules) {
if (window.__reactRouterManifest.sri === true) {
const importMap = document.querySelector("script[rr-importmap]");
if (importMap?.textContent) {
try {
window.__reactRouterManifest.sri = JSON.parse(
importMap.textContent
).integrity;
} catch (err) {
console.error("Failed to parse import map", err);
}
}
}
ssrInfo = {
context: window.__reactRouterContext,
manifest: window.__reactRouterManifest,
routeModules: window.__reactRouterRouteModules,
stateDecodingPromise: void 0,
router: void 0,
routerInitialized: false
};
}
}
function createHydratedRouter({
unstable_getContext
}) {
initSsrInfo();
if (!ssrInfo) {
throw new Error(
"You must be using the SSR features of React Router in order to skip passing a `router` prop to `<RouterProvider>`"
);
}
let localSsrInfo = ssrInfo;
if (!ssrInfo.stateDecodingPromise) {
let stream = ssrInfo.context.stream;
invariant(stream, "No stream found for single fetch decoding");
ssrInfo.context.stream = void 0;
ssrInfo.stateDecodingPromise = decodeViaTurboStream(stream, window).then((value) => {
ssrInfo.context.state = value.value;
localSsrInfo.stateDecodingPromise.value = true;
}).catch((e) => {
localSsrInfo.stateDecodingPromise.error = e;
});
}
if (ssrInfo.stateDecodingPromise.error) {
throw ssrInfo.stateDecodingPromise.error;
}
if (!ssrInfo.stateDecodingPromise.value) {
throw ssrInfo.stateDecodingPromise;
}
let routes = createClientRoutes(
ssrInfo.manifest.routes,
ssrInfo.routeModules,
ssrInfo.context.state,
ssrInfo.context.ssr,
ssrInfo.context.isSpaMode
);
let hydrationData = void 0;
if (ssrInfo.context.isSpaMode) {
let { loaderData } = ssrInfo.context.state;
if (ssrInfo.manifest.routes.root?.hasLoader && loaderData && "root" in loaderData) {
hydrationData = {
loaderData: {
root: loaderData.root
}
};
}
} else {
hydrationData = getHydrationData(
ssrInfo.context.state,
routes,
(routeId) => ({
clientLoader: ssrInfo.routeModules[routeId]?.clientLoader,
hasLoader: ssrInfo.manifest.routes[routeId]?.hasLoader === true,
hasHydrateFallback: ssrInfo.routeModules[routeId]?.HydrateFallback != null
}),
window.location,
window.__reactRouterContext?.basename,
ssrInfo.context.isSpaMode
);
if (hydrationData && hydrationData.errors) {
hydrationData.errors = deserializeErrors(hydrationData.errors);
}
}
let router2 = createRouter({
routes,
history: createBrowserHistory(),
basename: ssrInfo.context.basename,
unstable_getContext,
hydrationData,
hydrationRouteProperties,
mapRouteProperties,
future: {
unstable_middleware: ssrInfo.context.future.unstable_middleware
},
dataStrategy: getTurboStreamSingleFetchDataStrategy(
() => router2,
ssrInfo.manifest,
ssrInfo.routeModules,
ssrInfo.context.ssr,
ssrInfo.context.basename
),
patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction(
ssrInfo.manifest,
ssrInfo.routeModules,
ssrInfo.context.ssr,
ssrInfo.context.routeDiscovery,
ssrInfo.context.isSpaMode,
ssrInfo.context.basename
)
});
ssrInfo.router = router2;
if (router2.state.initialized) {
ssrInfo.routerInitialized = true;
router2.initialize();
}
router2.createRoutesForHMR = /* spacer so ts-ignore does not affect the right hand of the assignment */
createClientRoutesWithHMRRevalidationOptOut;
window.__reactRouterDataRouter = router2;
return router2;
}
function HydratedRouter(props) {
if (!router) {
router = createHydratedRouter({
unstable_getContext: props.unstable_getContext
});
}
let [criticalCss, setCriticalCss] = React2.useState(
process.env.NODE_ENV === "development" ? ssrInfo?.context.criticalCss : void 0
);
React2.useEffect(() => {
if (process.env.NODE_ENV === "development") {
setCriticalCss(void 0);
}
}, []);
React2.useEffect(() => {
if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
document.querySelectorAll(`[${CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
}
}, [criticalCss]);
let [location, setLocation] = React2.useState(router.state.location);
React2.useLayoutEffect(() => {
if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {
ssrInfo.routerInitialized = true;
ssrInfo.router.initialize();
}
}, []);
React2.useLayoutEffect(() => {
if (ssrInfo && ssrInfo.router) {
return ssrInfo.router.subscribe((newState) => {
if (newState.location !== location) {
setLocation(newState.location);
}
});
}
}, [location]);
invariant(ssrInfo, "ssrInfo unavailable for HydratedRouter");
useFogOFWarDiscovery(
router,
ssrInfo.manifest,
ssrInfo.routeModules,
ssrInfo.context.ssr,
ssrInfo.context.routeDiscovery,
ssrInfo.context.isSpaMode
);
return (
// This fragment is important to ensure we match the <ServerRouter> JSX
// structure so that useId values hydrate correctly
/* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
FrameworkContext.Provider,
{
value: {
manifest: ssrInfo.manifest,
routeModules: ssrInfo.routeModules,
future: ssrInfo.context.future,
criticalCss,
ssr: ssrInfo.context.ssr,
isSpaMode: ssrInfo.context.isSpaMode,
routeDiscovery: ssrInfo.context.routeDiscovery
}
},
/* @__PURE__ */ React2.createElement(RemixErrorBoundary, { location }, /* @__PURE__ */ React2.createElement(RouterProvider2, { router }))
), /* @__PURE__ */ React2.createElement(React2.Fragment, null))
);
}
export {
HydratedRouter,
RouterProvider2 as RouterProvider
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
export { f as Await, g as MemoryRouter, h as Navigate, i as Outlet, j as Route, k as Router, l as RouterProvider, m as Routes, W as UNSAFE_WithComponentProps, v as UNSAFE_WithErrorBoundaryProps, t as UNSAFE_WithHydrateFallbackProps } from './components-CjQijYga.mjs';
export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-KLg-U4nr.mjs';
import './route-data-CqEmXQub.mjs';
import 'react';

View File

@ -0,0 +1,3 @@
export { h as Await, V as BrowserRouter, _ as Form, W as HashRouter, X as Link, am as Links, i as MemoryRouter, al as Meta, Z as NavLink, j as Navigate, k as Outlet, l as Route, m as Router, n as RouterProvider, o as Routes, $ as ScrollRestoration, aj as StaticRouter, ak as StaticRouterProvider, ay as UNSAFE_WithComponentProps, aC as UNSAFE_WithErrorBoundaryProps, aA as UNSAFE_WithHydrateFallbackProps, Y as unstable_HistoryRouter } from './index-react-server-client-Bi_fx8qz.js';
import './routeModules-BR2FO0ix.js';
import 'react';

View File

@ -0,0 +1,61 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
* react-router v7.7.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
"use client";
var _chunkR73PQUJUjs = require('./chunk-R73PQUJU.js');
var _chunkK7YFBME3js = require('./chunk-K7YFBME3.js');
exports.Await = _chunkR73PQUJUjs.Await; exports.BrowserRouter = _chunkR73PQUJUjs.BrowserRouter; exports.Form = _chunkR73PQUJUjs.Form; exports.HashRouter = _chunkR73PQUJUjs.HashRouter; exports.Link = _chunkR73PQUJUjs.Link; exports.Links = _chunkK7YFBME3js.Links; exports.MemoryRouter = _chunkR73PQUJUjs.MemoryRouter; exports.Meta = _chunkK7YFBME3js.Meta; exports.NavLink = _chunkR73PQUJUjs.NavLink; exports.Navigate = _chunkR73PQUJUjs.Navigate; exports.Outlet = _chunkR73PQUJUjs.Outlet; exports.Route = _chunkR73PQUJUjs.Route; exports.Router = _chunkR73PQUJUjs.Router; exports.RouterProvider = _chunkR73PQUJUjs.RouterProvider; exports.Routes = _chunkR73PQUJUjs.Routes; exports.ScrollRestoration = _chunkR73PQUJUjs.ScrollRestoration; exports.StaticRouter = _chunkR73PQUJUjs.StaticRouter; exports.StaticRouterProvider = _chunkR73PQUJUjs.StaticRouterProvider; exports.UNSAFE_WithComponentProps = _chunkR73PQUJUjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkR73PQUJUjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkR73PQUJUjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkR73PQUJUjs.HistoryRouter;

View File

@ -0,0 +1,59 @@
/**
* react-router v7.7.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
"use client";
import {
Await,
BrowserRouter,
Form,
HashRouter,
HistoryRouter,
Link,
Links,
MemoryRouter,
Meta,
NavLink,
Navigate,
Outlet,
Route,
Router,
RouterProvider,
Routes,
ScrollRestoration,
StaticRouter,
StaticRouterProvider,
WithComponentProps,
WithErrorBoundaryProps,
WithHydrateFallbackProps
} from "./chunk-C37GKA54.mjs";
export {
Await,
BrowserRouter,
Form,
HashRouter,
Link,
Links,
MemoryRouter,
Meta,
NavLink,
Navigate,
Outlet,
Route,
Router,
RouterProvider,
Routes,
ScrollRestoration,
StaticRouter,
StaticRouterProvider,
WithComponentProps as UNSAFE_WithComponentProps,
WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps,
WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps,
HistoryRouter as unstable_HistoryRouter
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1426
node_modules/react-router/dist/development/index.d.mts generated vendored Normal file

File diff suppressed because it is too large Load Diff

1643
node_modules/react-router/dist/development/index.d.ts generated vendored Normal file

File diff suppressed because it is too large Load Diff

2889
node_modules/react-router/dist/development/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

273
node_modules/react-router/dist/development/index.mjs generated vendored Normal file
View File

@ -0,0 +1,273 @@
/**
* react-router v7.7.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
"use client";
import {
RSCDefaultRootErrorBoundary,
RSCHydratedRouter,
RSCStaticRouter,
ServerMode,
ServerRouter,
createCallServer,
createCookie,
createCookieSessionStorage,
createMemorySessionStorage,
createRequestHandler,
createRoutesStub,
createSession,
createSessionStorage,
deserializeErrors,
getHydrationData,
getRSCStream,
href,
isCookie,
isSession,
routeRSCServerRequest,
setDevServerHooks
} from "./chunk-KIUJAIYX.mjs";
import {
Action,
Await,
BrowserRouter,
DataRouterContext,
DataRouterStateContext,
ErrorResponseImpl,
FetchersContext,
Form,
FrameworkContext,
HashRouter,
HistoryRouter,
IDLE_BLOCKER,
IDLE_FETCHER,
IDLE_NAVIGATION,
Link,
Links,
LocationContext,
MemoryRouter,
Meta,
NavLink,
Navigate,
NavigationContext,
Outlet,
PrefetchPageLinks,
RemixErrorBoundary,
Route,
RouteContext,
Router,
RouterProvider,
Routes,
Scripts,
ScrollRestoration,
SingleFetchRedirectSymbol,
StaticRouter,
StaticRouterProvider,
ViewTransitionContext,
WithComponentProps,
WithErrorBoundaryProps,
WithHydrateFallbackProps,
createBrowserHistory,
createBrowserRouter,
createClientRoutes,
createClientRoutesWithHMRRevalidationOptOut,
createHashRouter,
createMemoryRouter,
createPath,
createRouter,
createRoutesFromChildren,
createRoutesFromElements,
createSearchParams,
createStaticHandler2 as createStaticHandler,
createStaticRouter,
data,
decodeViaTurboStream,
generatePath,
getPatchRoutesOnNavigationFunction,
getTurboStreamSingleFetchDataStrategy,
hydrationRouteProperties,
invariant,
isRouteErrorResponse,
mapRouteProperties,
matchPath,
matchRoutes,
parsePath,
redirect,
redirectDocument,
renderMatches,
replace,
resolvePath,
shouldHydrateRouteLoader,
unstable_RouterContextProvider,
unstable_createContext,
useActionData,
useAsyncError,
useAsyncValue,
useBeforeUnload,
useBlocker,
useFetcher,
useFetchers,
useFogOFWarDiscovery,
useFormAction,
useHref,
useInRouterContext,
useLinkClickHandler,
useLoaderData,
useLocation,
useMatch,
useMatches,
useNavigate,
useNavigation,
useNavigationType,
useOutlet,
useOutletContext,
useParams,
usePrompt,
useResolvedPath,
useRevalidator,
useRouteError,
useRouteLoaderData,
useRoutes,
useScrollRestoration,
useSearchParams,
useSubmit,
useViewTransitionState,
withComponentProps,
withErrorBoundaryProps,
withHydrateFallbackProps
} from "./chunk-C37GKA54.mjs";
export {
Await,
BrowserRouter,
Form,
HashRouter,
IDLE_BLOCKER,
IDLE_FETCHER,
IDLE_NAVIGATION,
Link,
Links,
MemoryRouter,
Meta,
NavLink,
Navigate,
Action as NavigationType,
Outlet,
PrefetchPageLinks,
Route,
Router,
RouterProvider,
Routes,
Scripts,
ScrollRestoration,
ServerRouter,
StaticRouter,
StaticRouterProvider,
DataRouterContext as UNSAFE_DataRouterContext,
DataRouterStateContext as UNSAFE_DataRouterStateContext,
ErrorResponseImpl as UNSAFE_ErrorResponseImpl,
FetchersContext as UNSAFE_FetchersContext,
FrameworkContext as UNSAFE_FrameworkContext,
LocationContext as UNSAFE_LocationContext,
NavigationContext as UNSAFE_NavigationContext,
RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary,
RemixErrorBoundary as UNSAFE_RemixErrorBoundary,
RouteContext as UNSAFE_RouteContext,
ServerMode as UNSAFE_ServerMode,
SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol,
ViewTransitionContext as UNSAFE_ViewTransitionContext,
WithComponentProps as UNSAFE_WithComponentProps,
WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps,
WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps,
createBrowserHistory as UNSAFE_createBrowserHistory,
createClientRoutes as UNSAFE_createClientRoutes,
createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut,
createRouter as UNSAFE_createRouter,
decodeViaTurboStream as UNSAFE_decodeViaTurboStream,
deserializeErrors as UNSAFE_deserializeErrors,
getHydrationData as UNSAFE_getHydrationData,
getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction,
getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy,
hydrationRouteProperties as UNSAFE_hydrationRouteProperties,
invariant as UNSAFE_invariant,
mapRouteProperties as UNSAFE_mapRouteProperties,
shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader,
useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery,
useScrollRestoration as UNSAFE_useScrollRestoration,
withComponentProps as UNSAFE_withComponentProps,
withErrorBoundaryProps as UNSAFE_withErrorBoundaryProps,
withHydrateFallbackProps as UNSAFE_withHydrateFallbackProps,
createBrowserRouter,
createCookie,
createCookieSessionStorage,
createHashRouter,
createMemoryRouter,
createMemorySessionStorage,
createPath,
createRequestHandler,
createRoutesFromChildren,
createRoutesFromElements,
createRoutesStub,
createSearchParams,
createSession,
createSessionStorage,
createStaticHandler,
createStaticRouter,
data,
generatePath,
href,
isCookie,
isRouteErrorResponse,
isSession,
matchPath,
matchRoutes,
parsePath,
redirect,
redirectDocument,
renderMatches,
replace,
resolvePath,
HistoryRouter as unstable_HistoryRouter,
RSCHydratedRouter as unstable_RSCHydratedRouter,
RSCStaticRouter as unstable_RSCStaticRouter,
unstable_RouterContextProvider,
createCallServer as unstable_createCallServer,
unstable_createContext,
getRSCStream as unstable_getRSCStream,
routeRSCServerRequest as unstable_routeRSCServerRequest,
setDevServerHooks as unstable_setDevServerHooks,
usePrompt as unstable_usePrompt,
useActionData,
useAsyncError,
useAsyncValue,
useBeforeUnload,
useBlocker,
useFetcher,
useFetchers,
useFormAction,
useHref,
useInRouterContext,
useLinkClickHandler,
useLoaderData,
useLocation,
useMatch,
useMatches,
useNavigate,
useNavigation,
useNavigationType,
useOutlet,
useOutletContext,
useParams,
useResolvedPath,
useRevalidator,
useRouteError,
useRouteLoaderData,
useRoutes,
useSearchParams,
useSubmit,
useViewTransitionState
};

View File

@ -0,0 +1,146 @@
import { n as RouteModule, o as LinkDescriptor, c as Location, p as Pretty, q as MetaDescriptor, G as GetLoaderData, r as ServerDataFunctionArgs, s as unstable_MiddlewareNextFunction, t as ClientDataFunctionArgs, v as ServerDataFrom, w as Normalize, x as GetActionData } from '../../route-data-CqEmXQub.mjs';
import { R as RouteFiles, P as Pages } from '../../register-DiOIlEq5.mjs';
import 'react';
type MaybePromise<T> = T | Promise<T>;
type Props = {
params: unknown;
loaderData: unknown;
actionData: unknown;
};
type RouteInfo = Props & {
module: RouteModule;
matches: Array<MatchInfo>;
};
type MatchInfo = {
id: string;
module: RouteModule;
};
type MetaMatch<T extends MatchInfo> = Pretty<{
id: T["id"];
params: Record<string, string | undefined>;
pathname: string;
meta: MetaDescriptor[];
data: GetLoaderData<T["module"]>;
handle?: unknown;
error?: unknown;
}>;
type MetaMatches<T extends Array<MatchInfo>> = T extends [infer F extends MatchInfo, ...infer R extends Array<MatchInfo>] ? [MetaMatch<F>, ...MetaMatches<R>] : Array<MetaMatch<MatchInfo> | undefined>;
type CreateMetaArgs<T extends RouteInfo> = {
/** This is the current router `Location` object. This is useful for generating tags for routes at specific paths or query parameters. */
location: Location;
/** {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route. */
params: T["params"];
/** The return value for this route's server loader function */
data: T["loaderData"] | undefined;
/** Thrown errors that trigger error boundaries will be passed to the meta function. This is useful for generating metadata for error pages. */
error?: unknown;
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
matches: MetaMatches<T["matches"]>;
};
type MetaDescriptors = MetaDescriptor[];
type HeadersArgs = {
loaderHeaders: Headers;
parentHeaders: Headers;
actionHeaders: Headers;
errorHeaders: Headers | undefined;
};
type CreateServerMiddlewareFunction<T extends RouteInfo> = (args: ServerDataFunctionArgs<T["params"]>, next: unstable_MiddlewareNextFunction<Response>) => MaybePromise<Response | void>;
type CreateClientMiddlewareFunction<T extends RouteInfo> = (args: ClientDataFunctionArgs<T["params"]>, next: unstable_MiddlewareNextFunction<undefined>) => MaybePromise<void>;
type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T["params"]>;
type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T["params"]> & {
/** This is an asynchronous function to get the data from the server loader for this route. On client-side navigations, this will make a {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server loader. If you opt-into running your clientLoader on hydration, then this function will return the data that was already loaded on the server (via Promise.resolve). */
serverLoader: () => Promise<ServerDataFrom<T["module"]["loader"]>>;
};
type CreateServerActionArgs<T extends RouteInfo> = ServerDataFunctionArgs<T["params"]>;
type CreateClientActionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T["params"]> & {
/** This is an asynchronous function that makes the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server action for this route. */
serverAction: () => Promise<ServerDataFrom<T["module"]["action"]>>;
};
type CreateHydrateFallbackProps<T extends RouteInfo> = {
params: T["params"];
loaderData?: T["loaderData"];
actionData?: T["actionData"];
};
type Match<T extends MatchInfo> = Pretty<{
id: T["id"];
params: Record<string, string | undefined>;
pathname: string;
data: GetLoaderData<T["module"]>;
handle: unknown;
}>;
type Matches<T extends Array<MatchInfo>> = T extends [infer F extends MatchInfo, ...infer R extends Array<MatchInfo>] ? [Match<F>, ...Matches<R>] : Array<Match<MatchInfo> | undefined>;
type CreateComponentProps<T extends RouteInfo> = {
/**
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
* @example
* // app/routes.ts
* route("teams/:teamId", "./team.tsx"),
*
* // app/team.tsx
* export default function Component({
* params,
* }: Route.ComponentProps) {
* params.teamId;
* // ^ string
* }
**/
params: T["params"];
/** The data returned from the `loader` or `clientLoader` */
loaderData: T["loaderData"];
/** The data returned from the `action` or `clientAction` following an action submission. */
actionData?: T["actionData"];
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
matches: Matches<T["matches"]>;
};
type CreateErrorBoundaryProps<T extends RouteInfo> = {
/**
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
* @example
* // app/routes.ts
* route("teams/:teamId", "./team.tsx"),
*
* // app/team.tsx
* export function ErrorBoundary({
* params,
* }: Route.ErrorBoundaryProps) {
* params.teamId;
* // ^ string
* }
**/
params: T["params"];
error: unknown;
loaderData?: T["loaderData"];
actionData?: T["actionData"];
};
type GetAnnotations<Info extends RouteInfo> = {
LinkDescriptors: LinkDescriptor[];
LinksFunction: () => LinkDescriptor[];
MetaArgs: CreateMetaArgs<Info>;
MetaDescriptors: MetaDescriptors;
MetaFunction: (args: CreateMetaArgs<Info>) => MetaDescriptors;
HeadersArgs: HeadersArgs;
HeadersFunction: (args: HeadersArgs) => Headers | HeadersInit;
unstable_MiddlewareFunction: CreateServerMiddlewareFunction<Info>;
unstable_ClientMiddlewareFunction: CreateClientMiddlewareFunction<Info>;
LoaderArgs: CreateServerLoaderArgs<Info>;
ClientLoaderArgs: CreateClientLoaderArgs<Info>;
ActionArgs: CreateServerActionArgs<Info>;
ClientActionArgs: CreateClientActionArgs<Info>;
HydrateFallbackProps: CreateHydrateFallbackProps<Info>;
ComponentProps: CreateComponentProps<Info>;
ErrorBoundaryProps: CreateErrorBoundaryProps<Info>;
};
type Params<RouteFile extends keyof RouteFiles> = Normalize<Pages[RouteFiles[RouteFile]["page"]]["params"]>;
type GetInfo<T extends {
file: keyof RouteFiles;
module: RouteModule;
}> = {
params: Params<T["file"]>;
loaderData: GetLoaderData<T["module"]>;
actionData: GetActionData<T["module"]>;
};
export type { GetAnnotations, GetInfo };

View File

@ -0,0 +1,146 @@
import { R as RouteModule, L as LinkDescriptor, a as Location, P as Pretty, M as MetaDescriptor, G as GetLoaderData, S as ServerDataFunctionArgs, u as unstable_MiddlewareNextFunction, C as ClientDataFunctionArgs, b as ServerDataFrom, N as Normalize, c as GetActionData } from '../../routeModules-BR2FO0ix.js';
import { R as RouteFiles, P as Pages } from '../../register-DiOIlEq5.js';
import 'react';
type MaybePromise<T> = T | Promise<T>;
type Props = {
params: unknown;
loaderData: unknown;
actionData: unknown;
};
type RouteInfo = Props & {
module: RouteModule;
matches: Array<MatchInfo>;
};
type MatchInfo = {
id: string;
module: RouteModule;
};
type MetaMatch<T extends MatchInfo> = Pretty<{
id: T["id"];
params: Record<string, string | undefined>;
pathname: string;
meta: MetaDescriptor[];
data: GetLoaderData<T["module"]>;
handle?: unknown;
error?: unknown;
}>;
type MetaMatches<T extends Array<MatchInfo>> = T extends [infer F extends MatchInfo, ...infer R extends Array<MatchInfo>] ? [MetaMatch<F>, ...MetaMatches<R>] : Array<MetaMatch<MatchInfo> | undefined>;
type CreateMetaArgs<T extends RouteInfo> = {
/** This is the current router `Location` object. This is useful for generating tags for routes at specific paths or query parameters. */
location: Location;
/** {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route. */
params: T["params"];
/** The return value for this route's server loader function */
data: T["loaderData"] | undefined;
/** Thrown errors that trigger error boundaries will be passed to the meta function. This is useful for generating metadata for error pages. */
error?: unknown;
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
matches: MetaMatches<T["matches"]>;
};
type MetaDescriptors = MetaDescriptor[];
type HeadersArgs = {
loaderHeaders: Headers;
parentHeaders: Headers;
actionHeaders: Headers;
errorHeaders: Headers | undefined;
};
type CreateServerMiddlewareFunction<T extends RouteInfo> = (args: ServerDataFunctionArgs<T["params"]>, next: unstable_MiddlewareNextFunction<Response>) => MaybePromise<Response | void>;
type CreateClientMiddlewareFunction<T extends RouteInfo> = (args: ClientDataFunctionArgs<T["params"]>, next: unstable_MiddlewareNextFunction<undefined>) => MaybePromise<void>;
type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T["params"]>;
type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T["params"]> & {
/** This is an asynchronous function to get the data from the server loader for this route. On client-side navigations, this will make a {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server loader. If you opt-into running your clientLoader on hydration, then this function will return the data that was already loaded on the server (via Promise.resolve). */
serverLoader: () => Promise<ServerDataFrom<T["module"]["loader"]>>;
};
type CreateServerActionArgs<T extends RouteInfo> = ServerDataFunctionArgs<T["params"]>;
type CreateClientActionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T["params"]> & {
/** This is an asynchronous function that makes the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server action for this route. */
serverAction: () => Promise<ServerDataFrom<T["module"]["action"]>>;
};
type CreateHydrateFallbackProps<T extends RouteInfo> = {
params: T["params"];
loaderData?: T["loaderData"];
actionData?: T["actionData"];
};
type Match<T extends MatchInfo> = Pretty<{
id: T["id"];
params: Record<string, string | undefined>;
pathname: string;
data: GetLoaderData<T["module"]>;
handle: unknown;
}>;
type Matches<T extends Array<MatchInfo>> = T extends [infer F extends MatchInfo, ...infer R extends Array<MatchInfo>] ? [Match<F>, ...Matches<R>] : Array<Match<MatchInfo> | undefined>;
type CreateComponentProps<T extends RouteInfo> = {
/**
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
* @example
* // app/routes.ts
* route("teams/:teamId", "./team.tsx"),
*
* // app/team.tsx
* export default function Component({
* params,
* }: Route.ComponentProps) {
* params.teamId;
* // ^ string
* }
**/
params: T["params"];
/** The data returned from the `loader` or `clientLoader` */
loaderData: T["loaderData"];
/** The data returned from the `action` or `clientAction` following an action submission. */
actionData?: T["actionData"];
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
matches: Matches<T["matches"]>;
};
type CreateErrorBoundaryProps<T extends RouteInfo> = {
/**
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
* @example
* // app/routes.ts
* route("teams/:teamId", "./team.tsx"),
*
* // app/team.tsx
* export function ErrorBoundary({
* params,
* }: Route.ErrorBoundaryProps) {
* params.teamId;
* // ^ string
* }
**/
params: T["params"];
error: unknown;
loaderData?: T["loaderData"];
actionData?: T["actionData"];
};
type GetAnnotations<Info extends RouteInfo> = {
LinkDescriptors: LinkDescriptor[];
LinksFunction: () => LinkDescriptor[];
MetaArgs: CreateMetaArgs<Info>;
MetaDescriptors: MetaDescriptors;
MetaFunction: (args: CreateMetaArgs<Info>) => MetaDescriptors;
HeadersArgs: HeadersArgs;
HeadersFunction: (args: HeadersArgs) => Headers | HeadersInit;
unstable_MiddlewareFunction: CreateServerMiddlewareFunction<Info>;
unstable_ClientMiddlewareFunction: CreateClientMiddlewareFunction<Info>;
LoaderArgs: CreateServerLoaderArgs<Info>;
ClientLoaderArgs: CreateClientLoaderArgs<Info>;
ActionArgs: CreateServerActionArgs<Info>;
ClientActionArgs: CreateClientActionArgs<Info>;
HydrateFallbackProps: CreateHydrateFallbackProps<Info>;
ComponentProps: CreateComponentProps<Info>;
ErrorBoundaryProps: CreateErrorBoundaryProps<Info>;
};
type Params<RouteFile extends keyof RouteFiles> = Normalize<Pages[RouteFiles[RouteFile]["page"]]["params"]>;
type GetInfo<T extends {
file: keyof RouteFiles;
module: RouteModule;
}> = {
params: Params<T["file"]>;
loaderData: GetLoaderData<T["module"]>;
actionData: GetActionData<T["module"]>;
};
export type { GetAnnotations, GetInfo };

View File

@ -0,0 +1,10 @@
"use strict";/**
* react-router v7.7.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/

View File

@ -0,0 +1,10 @@
/**
* react-router v7.7.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/

View File

@ -0,0 +1,24 @@
/**
* Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
* React Router should handle this for you via type generation.
*
* For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
*/
interface Register {
}
type AnyParams = Record<string, string | undefined>;
type AnyPages = Record<string, {
params: AnyParams;
}>;
type Pages = Register extends {
pages: infer Registered extends AnyPages;
} ? Registered : AnyPages;
type AnyRouteFiles = Record<string, {
id: string;
page: string;
}>;
type RouteFiles = Register extends {
routeFiles: infer Registered extends AnyRouteFiles;
} ? Registered : AnyRouteFiles;
export type { Pages as P, RouteFiles as R, Register as a };

View File

@ -0,0 +1,24 @@
/**
* Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
* React Router should handle this for you via type generation.
*
* For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
*/
interface Register {
}
type AnyParams = Record<string, string | undefined>;
type AnyPages = Record<string, {
params: AnyParams;
}>;
type Pages = Register extends {
pages: infer Registered extends AnyPages;
} ? Registered : AnyPages;
type AnyRouteFiles = Record<string, {
id: string;
page: string;
}>;
type RouteFiles = Register extends {
routeFiles: infer Registered extends AnyRouteFiles;
} ? Registered : AnyRouteFiles;
export type { Pages as P, RouteFiles as R, Register as a };

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,226 @@
import { AsyncLocalStorage } from 'node:async_hooks';
import * as React from 'react';
import { u as unstable_RouterContextProvider, i as ActionFunction, C as ClientActionFunction, j as ClientLoaderFunction, k as HeadersFunction, l as LinksFunction, m as LoaderFunction, M as MetaFunction, S as ShouldRevalidateFunction, c as Location, h as Params } from './route-data-CqEmXQub.mjs';
type ServerContext = {
redirect?: Response;
};
declare global {
var ___reactRouterServerStorage___: AsyncLocalStorage<ServerContext> | undefined;
}
type RSCRouteConfigEntryBase = {
action?: ActionFunction;
clientAction?: ClientActionFunction;
clientLoader?: ClientLoaderFunction;
ErrorBoundary?: React.ComponentType<any>;
handle?: any;
headers?: HeadersFunction;
HydrateFallback?: React.ComponentType<any>;
Layout?: React.ComponentType<any>;
links?: LinksFunction;
loader?: LoaderFunction;
meta?: MetaFunction;
shouldRevalidate?: ShouldRevalidateFunction;
};
type RSCRouteConfigEntry = RSCRouteConfigEntryBase & {
id: string;
path?: string;
Component?: React.ComponentType<any>;
lazy?: () => Promise<RSCRouteConfigEntryBase & ({
default?: React.ComponentType<any>;
Component?: never;
} | {
default?: never;
Component?: React.ComponentType<any>;
})>;
} & ({
index: true;
} | {
children?: RSCRouteConfigEntry[];
});
type RSCRouteConfig = Array<RSCRouteConfigEntry>;
type RSCRouteManifest = {
clientAction?: ClientActionFunction;
clientLoader?: ClientLoaderFunction;
element?: React.ReactElement | false;
errorElement?: React.ReactElement;
handle?: any;
hasAction: boolean;
hasComponent: boolean;
hasErrorBoundary: boolean;
hasLoader: boolean;
hydrateFallbackElement?: React.ReactElement;
id: string;
index?: boolean;
links?: LinksFunction;
meta?: MetaFunction;
parentId?: string;
path?: string;
shouldRevalidate?: ShouldRevalidateFunction;
};
type RSCRouteMatch = RSCRouteManifest & {
params: Params;
pathname: string;
pathnameBase: string;
};
type RSCRenderPayload = {
type: "render";
actionData: Record<string, any> | null;
basename: string | undefined;
errors: Record<string, any> | null;
loaderData: Record<string, any>;
location: Location;
matches: RSCRouteMatch[];
patches?: RSCRouteManifest[];
nonce?: string;
formState?: unknown;
};
type RSCManifestPayload = {
type: "manifest";
patches: RSCRouteManifest[];
};
type RSCActionPayload = {
type: "action";
actionResult: Promise<unknown>;
rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>;
};
type RSCRedirectPayload = {
type: "redirect";
status: number;
location: string;
replace: boolean;
reload: boolean;
actionResult?: Promise<unknown>;
};
type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload;
type RSCMatch = {
statusCode: number;
headers: Headers;
payload: RSCPayload;
};
type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
temporaryReferences: unknown;
}) => Promise<unknown[]>;
type LoadServerActionFunction = (id: string) => Promise<Function>;
/**
* Matches the given routes to a Request and returns a RSC Response encoding an
* `RSCPayload` for consumption by a RSC enabled client router.
*
* @example
* import {
* createTemporaryReferenceSet,
* decodeAction,
* decodeReply,
* loadServerAction,
* renderToReadableStream,
* } from "@vitejs/plugin-rsc/rsc";
* import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";
*
* matchRSCServerRequest({
* createTemporaryReferenceSet,
* decodeAction,
* decodeFormState,
* decodeReply,
* loadServerAction,
* request,
* routes: routes(),
* generateResponse(match) {
* return new Response(
* renderToReadableStream(match.payload),
* {
* status: match.statusCode,
* headers: match.headers,
* }
* );
* },
* });
*
* @name unstable_matchRSCServerRequest
* @public
* @category RSC
* @mode data
* @param opts Options
* @param opts.basename The basename to use when matching the request.
* @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction`
* function, responsible for loading a server action.
* @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply`
* function, used to decode the server function's arguments and bind them to the
* implementation for invocation by the router.
* @param opts.decodeFormState A function responsible for decoding form state for
* progressively enhanceable forms with `useActionState` using your
* `react-server-dom-xyz/server`'s `decodeFormState`.
* @param opts.generateResponse A function responsible for using your
* `renderToReadableStream` to generate a Response encoding the `RSCPayload`.
* @param opts.loadServerAction Your `react-server-dom-xyz/server`'s
* `loadServerAction` function, used to load a server action by ID.
* @param opts.request The request to match against.
* @param opts.requestContext An instance of `unstable_RouterContextProvider`
* that should be created per request, to be passed to loaders, actions and middleware.
* @param opts.routes Your route definitions.
* @param opts.createTemporaryReferenceSet A function that returns a temporary
* reference set for the request, used to track temporary references in the RSC stream.
* @param opts.onError An optional error handler that will be called with any
* errors that occur during the request processing.
* @returns A Response that contains the RSC data for hydration.
*/
declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
createTemporaryReferenceSet: () => unknown;
basename?: string;
decodeReply?: DecodeReplyFunction;
decodeAction?: DecodeActionFunction;
decodeFormState?: DecodeFormStateFunction;
requestContext?: unstable_RouterContextProvider;
loadServerAction?: LoadServerActionFunction;
onError?: (error: unknown) => void;
request: Request;
routes: RSCRouteConfigEntry[];
generateResponse: (match: RSCMatch, { temporaryReferences, }: {
temporaryReferences: unknown;
}) => Response;
}): Promise<Response>;
declare global {
interface Window {
__FLIGHT_DATA: any[];
}
}
/**
* Get the prerendered RSC stream for hydration. Usually passed directly to your
* `react-server-dom-xyz/client`'s `createFromReadableStream`.
*
* @example
* import { startTransition, StrictMode } from "react";
* import { hydrateRoot } from "react-dom/client";
* import {
* unstable_getRSCStream as getRSCStream,
* unstable_RSCHydratedRouter as RSCHydratedRouter,
* } from "react-router";
* import type { unstable_RSCPayload as RSCPayload } from "react-router";
*
* createFromReadableStream(getRSCStream()).then(
* (payload: RSCServerPayload) => {
* startTransition(async () => {
* hydrateRoot(
* document,
* <StrictMode>
* <RSCHydratedRouter ...props />
* </StrictMode>,
* {
* // Options
* }
* );
* });
* }
* );
*
* @name unstable_getRSCStream
* @public
* @category RSC
* @mode data
* @returns A `ReadableStream` that contains the RSC data for hydration.
*/
declare function getRSCStream(): ReadableStream<any>;
export { type DecodeActionFunction as D, type LoadServerActionFunction as L, type RSCPayload as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, type RSCManifestPayload as c, type RSCMatch as d, type RSCRenderPayload as e, type RSCRouteManifest as f, getRSCStream as g, type RSCRouteMatch as h, type RSCRouteConfigEntry as i, type RSCRouteConfig as j, matchRSCServerRequest as m };

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,802 @@
import { R as Router$1, I as InitialEntry, T as To, a as RelativeRoutingType, N as NonIndexRouteObject, L as LazyRouteFunction, b as IndexRouteObject, c as Location, A as Action, d as Navigator, e as RouterInit, F as FutureConfig, H as HydrationState, D as DataStrategyFunction, P as PatchRoutesOnNavigationFunction, f as RouteObject, g as RouteMatch, h as Params, U as UIMatch } from './route-data-CqEmXQub.mjs';
import * as React from 'react';
declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & {
hasErrorBoundary: boolean;
};
declare const hydrationRouteProperties: (keyof RouteObject)[];
/**
* @category Data Routers
*/
interface MemoryRouterOpts {
/**
* Basename path for the application.
*/
basename?: string;
/**
* Function to provide the initial context values for all client side
* navigations/fetches
*/
unstable_getContext?: RouterInit["unstable_getContext"];
/**
* Future flags to enable for the router.
*/
future?: Partial<FutureConfig>;
/**
* Hydration data to initialize the router with if you have already performed
* data loading on the server.
*/
hydrationData?: HydrationState;
/**
* Initial entries in the in-memory history stack
*/
initialEntries?: InitialEntry[];
/**
* Index of {@link initialEntries} the application should initialize to
*/
initialIndex?: number;
/**
* Override the default data strategy of loading in parallel.
* Only intended for advanced usage.
*/
dataStrategy?: DataStrategyFunction;
/**
* Lazily define portions of the route tree on navigations.
*/
patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction;
}
/**
* Create a new {@link DataRouter} that manages the application path using an
* in-memory [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
* stack. Useful for non-browser environments without a DOM API.
*
* @public
* @category Data Routers
* @mode data
* @param routes Application routes
* @param opts Options
* @param {MemoryRouterOpts.basename} opts.basename n/a
* @param {MemoryRouterOpts.dataStrategy} opts.dataStrategy n/a
* @param {MemoryRouterOpts.future} opts.future n/a
* @param {MemoryRouterOpts.unstable_getContext} opts.unstable_getContext n/a
* @param {MemoryRouterOpts.hydrationData} opts.hydrationData n/a
* @param {MemoryRouterOpts.initialEntries} opts.initialEntries n/a
* @param {MemoryRouterOpts.initialIndex} opts.initialIndex n/a
* @param {MemoryRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a
* @returns An initialized {@link DataRouter} to pass to {@link RouterProvider | `<RouterProvider>`}
*/
declare function createMemoryRouter(routes: RouteObject[], opts?: MemoryRouterOpts): Router$1;
/**
* @category Types
*/
interface RouterProviderProps {
/**
* The {@link DataRouter} instance to use for navigation and data fetching.
*/
router: Router$1;
/**
* The [`ReactDOM.flushSync`](https://react.dev/reference/react-dom/flushSync)
* implementation to use for flushing updates.
*
* You usually don't have to worry about this:
* - The `RouterProvider` exported from `react-router/dom` handles this internally for you
* - If you are rendering in a non-DOM environment, you can import
* `RouterProvider` from `react-router` and ignore this prop
*/
flushSync?: (fn: () => unknown) => undefined;
}
/**
* Render the UI for the given {@link DataRouter}. This component should
* typically be at the top of an app's element tree.
*
* @example
* import { createBrowserRouter } from "react-router";
* import { RouterProvider } from "react-router/dom";
* import { createRoot } from "react-dom/client";
*
* const router = createBrowserRouter(routes);
* createRoot(document.getElementById("root")).render(
* <RouterProvider router={router} />
* );
*
* @public
* @category Data Routers
* @mode data
* @param props Props
* @param {RouterProviderProps.flushSync} props.flushSync n/a
* @param {RouterProviderProps.router} props.router n/a
* @returns React element for the rendered router
*/
declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, }: RouterProviderProps): React.ReactElement;
/**
* @category Types
*/
interface MemoryRouterProps {
/**
* Application basename
*/
basename?: string;
/**
* Nested {@link Route} elements describing the route tree
*/
children?: React.ReactNode;
/**
* Initial entries in the in-memory history stack
*/
initialEntries?: InitialEntry[];
/**
* Index of {@link initialEntries} the application should initialize to
*/
initialIndex?: number;
}
/**
* A declarative {@link Router | `<Router>`} that stores all entries in memory.
*
* @public
* @category Declarative Routers
* @mode declarative
* @param props Props
* @param {MemoryRouterProps.basename} props.basename n/a
* @param {MemoryRouterProps.children} props.children n/a
* @param {MemoryRouterProps.initialEntries} props.initialEntries n/a
* @param {MemoryRouterProps.initialIndex} props.initialIndex n/a
* @returns A declarative in memory router for client side routing.
*/
declare function MemoryRouter({ basename, children, initialEntries, initialIndex, }: MemoryRouterProps): React.ReactElement;
/**
* @category Types
*/
interface NavigateProps {
/**
* The path to navigate to. This can be a string or a {@link Path} object
*/
to: To;
/**
* Whether to replace the current entry in the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
* stack
*/
replace?: boolean;
/**
* State to pass to the new {@link Location} to store in [`history.state`](https://developer.mozilla.org/en-US/docs/Web/API/History/state).
*/
state?: any;
/**
* How to interpret relative routing in the {@link to} prop.
* See {@link RelativeRoutingType}.
*/
relative?: RelativeRoutingType;
}
/**
* A component-based version of {@link useNavigate} to use in a
* [`React.Component` class](https://react.dev/reference/react/Component) where
* hooks cannot be used.
*
* It's recommended to avoid using this component in favor of {@link useNavigate}.
*
* @example
* <Navigate to="/tasks" />
*
* @public
* @category Components
* @param props Props
* @param {NavigateProps.relative} props.relative n/a
* @param {NavigateProps.replace} props.replace n/a
* @param {NavigateProps.state} props.state n/a
* @param {NavigateProps.to} props.to n/a
* @returns {void}
*
*/
declare function Navigate({ to, replace, state, relative, }: NavigateProps): null;
/**
* @category Types
*/
interface OutletProps {
/**
* Provides a context value to the element tree below the outlet. Use when
* the parent route needs to provide values to child routes.
*
* ```tsx
* <Outlet context={myContextValue} />
* ```
*
* Access the context with {@link useOutletContext}.
*/
context?: unknown;
}
/**
* Renders the matching child route of a parent route or nothing if no child
* route matches.
*
* @example
* import { Outlet } from "react-router";
*
* export default function SomeParent() {
* return (
* <div>
* <h1>Parent Content</h1>
* <Outlet />
* </div>
* );
* }
*
* @public
* @category Components
* @param props Props
* @param {OutletProps.context} props.context n/a
* @returns React element for the rendered outlet or `null` if no child route matches.
*/
declare function Outlet(props: OutletProps): React.ReactElement | null;
/**
* @category Types
*/
interface PathRouteProps {
/**
* Whether the path should be case-sensitive. Defaults to `false`.
*/
caseSensitive?: NonIndexRouteObject["caseSensitive"];
/**
* The path pattern to match. If unspecified or empty, then this becomes a
* layout route.
*/
path?: NonIndexRouteObject["path"];
/**
* The unique identifier for this route (for use with {@link DataRouter}s)
*/
id?: NonIndexRouteObject["id"];
/**
* A function that returns a promise that resolves to the route object.
* Used for code-splitting routes.
* See [`lazy`](../../start/data/route-object#lazy).
*/
lazy?: LazyRouteFunction<NonIndexRouteObject>;
/**
* The route loader.
* See [`loader`](../../start/data/route-object#loader).
*/
loader?: NonIndexRouteObject["loader"];
/**
* The route action.
* See [`action`](../../start/data/route-object#action).
*/
action?: NonIndexRouteObject["action"];
hasErrorBoundary?: NonIndexRouteObject["hasErrorBoundary"];
/**
* The route shouldRevalidate function.
* See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate).
*/
shouldRevalidate?: NonIndexRouteObject["shouldRevalidate"];
/**
* The route handle.
*/
handle?: NonIndexRouteObject["handle"];
/**
* Whether this is an index route.
*/
index?: false;
/**
* Child Route components
*/
children?: React.ReactNode;
/**
* The React element to render when this Route matches.
* Mutually exclusive with {@link Component}.
*/
element?: React.ReactNode | null;
/**
* The React element to render while this router is loading data.
* Mutually exclusive with {@link HydrateFallback}.
*/
hydrateFallbackElement?: React.ReactNode | null;
/**
* The React element to render at this route if an error occurs.
* Mutually exclusive with {@link ErrorBoundary}.
*/
errorElement?: React.ReactNode | null;
/**
* The React Component to render when this route matches.
* Mutually exclusive with {@link element}.
*/
Component?: React.ComponentType | null;
/**
* The React Component to render while this router is loading data.
* Mutually exclusive with {@link hydrateFallbackElement}.
*/
HydrateFallback?: React.ComponentType | null;
/**
* The React Component to render at this route if an error occurs.
* Mutually exclusive with {@link errorElement}.
*/
ErrorBoundary?: React.ComponentType | null;
}
/**
* @category Types
*/
interface LayoutRouteProps extends PathRouteProps {
}
/**
* @category Types
*/
interface IndexRouteProps {
/**
* Whether the path should be case-sensitive. Defaults to `false`.
*/
caseSensitive?: IndexRouteObject["caseSensitive"];
/**
* The path pattern to match. If unspecified or empty, then this becomes a
* layout route.
*/
path?: IndexRouteObject["path"];
/**
* The unique identifier for this route (for use with {@link DataRouter}s)
*/
id?: IndexRouteObject["id"];
/**
* A function that returns a promise that resolves to the route object.
* Used for code-splitting routes.
* See [`lazy`](../../start/data/route-object#lazy).
*/
lazy?: LazyRouteFunction<IndexRouteObject>;
/**
* The route loader.
* See [`loader`](../../start/data/route-object#loader).
*/
loader?: IndexRouteObject["loader"];
/**
* The route action.
* See [`action`](../../start/data/route-object#action).
*/
action?: IndexRouteObject["action"];
hasErrorBoundary?: IndexRouteObject["hasErrorBoundary"];
/**
* The route shouldRevalidate function.
* See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate).
*/
shouldRevalidate?: IndexRouteObject["shouldRevalidate"];
/**
* The route handle.
*/
handle?: IndexRouteObject["handle"];
/**
* Whether this is an index route.
*/
index: true;
/**
* Child Route components
*/
children?: undefined;
/**
* The React element to render when this Route matches.
* Mutually exclusive with {@link Component}.
*/
element?: React.ReactNode | null;
/**
* The React element to render while this router is loading data.
* Mutually exclusive with {@link HydrateFallback}.
*/
hydrateFallbackElement?: React.ReactNode | null;
/**
* The React element to render at this route if an error occurs.
* Mutually exclusive with {@link ErrorBoundary}.
*/
errorElement?: React.ReactNode | null;
/**
* The React Component to render when this route matches.
* Mutually exclusive with {@link element}.
*/
Component?: React.ComponentType | null;
/**
* The React Component to render while this router is loading data.
* Mutually exclusive with {@link hydrateFallbackElement}.
*/
HydrateFallback?: React.ComponentType | null;
/**
* The React Component to render at this route if an error occurs.
* Mutually exclusive with {@link errorElement}.
*/
ErrorBoundary?: React.ComponentType | null;
}
type RouteProps = PathRouteProps | LayoutRouteProps | IndexRouteProps;
/**
* Configures an element to render when a pattern matches the current location.
* It must be rendered within a {@link Routes} element. Note that these routes
* do not participate in data loading, actions, code splitting, or any other
* route module features.
*
* @example
* // Usually used in a declarative router
* function App() {
* return (
* <BrowserRouter>
* <Routes>
* <Route index element={<StepOne />} />
* <Route path="step-2" element={<StepTwo />} />
* <Route path="step-3" element={<StepThree />} />
* </Routes>
* </BrowserRouter>
* );
* }
*
* // But can be used with a data router as well if you prefer the JSX notation
* const routes = createRoutesFromElements(
* <>
* <Route index loader={step1Loader} Component={StepOne} />
* <Route path="step-2" loader={step2Loader} Component={StepTwo} />
* <Route path="step-3" loader={step3Loader} Component={StepThree} />
* </>
* );
*
* const router = createBrowserRouter(routes);
*
* function App() {
* return <RouterProvider router={router} />;
* }
*
* @public
* @category Components
* @param props Props
* @param {PathRouteProps.action} props.action n/a
* @param {PathRouteProps.caseSensitive} props.caseSensitive n/a
* @param {PathRouteProps.Component} props.Component n/a
* @param {PathRouteProps.children} props.children n/a
* @param {PathRouteProps.element} props.element n/a
* @param {PathRouteProps.ErrorBoundary} props.ErrorBoundary n/a
* @param {PathRouteProps.errorElement} props.errorElement n/a
* @param {PathRouteProps.handle} props.handle n/a
* @param {PathRouteProps.HydrateFallback} props.HydrateFallback n/a
* @param {PathRouteProps.hydrateFallbackElement} props.hydrateFallbackElement n/a
* @param {PathRouteProps.id} props.id n/a
* @param {PathRouteProps.index} props.index n/a
* @param {PathRouteProps.lazy} props.lazy n/a
* @param {PathRouteProps.loader} props.loader n/a
* @param {PathRouteProps.path} props.path n/a
* @param {PathRouteProps.shouldRevalidate} props.shouldRevalidate n/a
* @returns {void}
*/
declare function Route(props: RouteProps): React.ReactElement | null;
/**
* @category Types
*/
interface RouterProps {
/**
* The base path for the application. This is prepended to all locations
*/
basename?: string;
/**
* Nested {@link Route} elements describing the route tree
*/
children?: React.ReactNode;
/**
* The location to match against. Defaults to the current location.
* This can be a string or a {@link Location} object.
*/
location: Partial<Location> | string;
/**
* The type of navigation that triggered this location change.
* Defaults to {@link NavigationType.Pop}.
*/
navigationType?: Action;
/**
* The navigator to use for navigation. This is usually a history object
* or a custom navigator that implements the {@link Navigator} interface.
*/
navigator: Navigator;
/**
* Whether this router is static or not (used for SSR). If `true`, the router
* will not be reactive to location changes.
*/
static?: boolean;
}
/**
* Provides location context for the rest of the app.
*
* Note: You usually won't render a `<Router>` directly. Instead, you'll render a
* router that is more specific to your environment such as a {@link BrowserRouter}
* in web browsers or a {@link ServerRouter} for server rendering.
*
* @public
* @category Declarative Routers
* @mode declarative
* @param props Props
* @param {RouterProps.basename} props.basename n/a
* @param {RouterProps.children} props.children n/a
* @param {RouterProps.location} props.location n/a
* @param {RouterProps.navigationType} props.navigationType n/a
* @param {RouterProps.navigator} props.navigator n/a
* @param {RouterProps.static} props.static n/a
* @returns React element for the rendered router or `null` if the location does
* not match the {@link props.basename}
*/
declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, }: RouterProps): React.ReactElement | null;
/**
* @category Types
*/
interface RoutesProps {
/**
* Nested {@link Route} elements
*/
children?: React.ReactNode;
/**
* The {@link Location} to match against. Defaults to the current location.
*/
location?: Partial<Location> | string;
}
/**
* Renders a branch of {@link Route | `<Route>`s} that best matches the current
* location. Note that these routes do not participate in [data loading](../../start/framework/route-module#loader),
* [`action`](../../start/framework/route-module#action), code splitting, or
* any other [route module](../../start/framework/route-module) features.
*
* @example
* import { Route, Routes } from "react-router";
*
* <Routes>
* <Route index element={<StepOne />} />
* <Route path="step-2" element={<StepTwo />} />
* <Route path="step-3" element={<StepThree />}>
* </Routes>
*
* @public
* @category Components
* @param props Props
* @param {RoutesProps.children} props.children n/a
* @param {RoutesProps.location} props.location n/a
* @returns React element for the rendered routes or `null` if no route matches
*/
declare function Routes({ children, location, }: RoutesProps): React.ReactElement | null;
interface AwaitResolveRenderFunction<Resolve = any> {
(data: Awaited<Resolve>): React.ReactNode;
}
/**
* @category Types
*/
interface AwaitProps<Resolve> {
/**
* When using a function, the resolved value is provided as the parameter.
*
* ```tsx [2]
* <Await resolve={reviewsPromise}>
* {(resolvedReviews) => <Reviews items={resolvedReviews} />}
* </Await>
* ```
*
* When using React elements, {@link useAsyncValue} will provide the
* resolved value:
*
* ```tsx [2]
* <Await resolve={reviewsPromise}>
* <Reviews />
* </Await>
*
* function Reviews() {
* const resolvedReviews = useAsyncValue();
* return <div>...</div>;
* }
* ```
*/
children: React.ReactNode | AwaitResolveRenderFunction<Resolve>;
/**
* The error element renders instead of the `children` when the [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
* rejects.
*
* ```tsx
* <Await
* errorElement={<div>Oops</div>}
* resolve={reviewsPromise}
* >
* <Reviews />
* </Await>
* ```
*
* To provide a more contextual error, you can use the {@link useAsyncError} in a
* child component
*
* ```tsx
* <Await
* errorElement={<ReviewsError />}
* resolve={reviewsPromise}
* >
* <Reviews />
* </Await>
*
* function ReviewsError() {
* const error = useAsyncError();
* return <div>Error loading reviews: {error.message}</div>;
* }
* ```
*
* If you do not provide an `errorElement`, the rejected value will bubble up
* to the nearest route-level [`ErrorBoundary`](../../start/framework/route-module#errorboundary)
* and be accessible via the {@link useRouteError} hook.
*/
errorElement?: React.ReactNode;
/**
* Takes a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
* returned from a [`loader`](../../start/framework/route-module#loader) to be
* resolved and rendered.
*
* ```tsx
* import { Await, useLoaderData } from "react-router";
*
* export async function loader() {
* let reviews = getReviews(); // not awaited
* let book = await getBook();
* return {
* book,
* reviews, // this is a promise
* };
* }
*
* export default function Book() {
* const {
* book,
* reviews, // this is the same promise
* } = useLoaderData();
*
* return (
* <div>
* <h1>{book.title}</h1>
* <p>{book.description}</p>
* <React.Suspense fallback={<ReviewsSkeleton />}>
* <Await
* // and is the promise we pass to Await
* resolve={reviews}
* >
* <Reviews />
* </Await>
* </React.Suspense>
* </div>
* );
* }
* ```
*/
resolve: Resolve;
}
/**
* Used to render promise values with automatic error handling.
*
* **Note:** `<Await>` expects to be rendered inside a [`<React.Suspense>`](https://react.dev/reference/react/Suspense)
*
* @example
* import { Await, useLoaderData } from "react-router";
*
* export async function loader() {
* // not awaited
* const reviews = getReviews();
* // awaited (blocks the transition)
* const book = await fetch("/api/book").then((res) => res.json());
* return { book, reviews };
* }
*
* function Book() {
* const { book, reviews } = useLoaderData();
* return (
* <div>
* <h1>{book.title}</h1>
* <p>{book.description}</p>
* <React.Suspense fallback={<ReviewsSkeleton />}>
* <Await
* resolve={reviews}
* errorElement={
* <div>Could not load reviews 😬</div>
* }
* children={(resolvedReviews) => (
* <Reviews items={resolvedReviews} />
* )}
* />
* </React.Suspense>
* </div>
* );
* }
*
* @public
* @category Components
* @mode framework
* @mode data
* @param props Props
* @param {AwaitProps.children} props.children n/a
* @param {AwaitProps.errorElement} props.errorElement n/a
* @param {AwaitProps.resolve} props.resolve n/a
* @returns React element for the rendered awaited value
*/
declare function Await<Resolve>({ children, errorElement, resolve, }: AwaitProps<Resolve>): React.JSX.Element;
/**
* Creates a route config from a React "children" object, which is usually
* either a `<Route>` element or an array of them. Used internally by
* `<Routes>` to create a route config from its children.
*
* @category Utils
* @mode data
* @param children The React children to convert into a route config
* @param parentPath The path of the parent route, used to generate unique IDs.
* @returns An array of {@link RouteObject}s that can be used with a {@link DataRouter}
*/
declare function createRoutesFromChildren(children: React.ReactNode, parentPath?: number[]): RouteObject[];
/**
* Create route objects from JSX elements instead of arrays of objects.
*
* @example
* const routes = createRoutesFromElements(
* <>
* <Route index loader={step1Loader} Component={StepOne} />
* <Route path="step-2" loader={step2Loader} Component={StepTwo} />
* <Route path="step-3" loader={step3Loader} Component={StepThree} />
* </>
* );
*
* const router = createBrowserRouter(routes);
*
* function App() {
* return <RouterProvider router={router} />;
* }
*
* @name createRoutesFromElements
* @public
* @category Utils
* @mode data
* @param children The React children to convert into a route config
* @param parentPath The path of the parent route, used to generate unique IDs.
* This is used for internal recursion and is not intended to be used by the
* application developer.
* @returns An array of {@link RouteObject}s that can be used with a {@link DataRouter}
*/
declare const createRoutesFromElements: typeof createRoutesFromChildren;
/**
* Renders the result of {@link matchRoutes} into a React element.
*
* @public
* @category Utils
* @param matches The array of {@link RouteMatch | route matches} to render
* @returns A React element that renders the matched routes or `null` if no matches
*/
declare function renderMatches(matches: RouteMatch[] | null): React.ReactElement | null;
declare function useRouteComponentProps(): {
params: Readonly<Params<string>>;
loaderData: any;
actionData: any;
matches: UIMatch<unknown, unknown>[];
};
type RouteComponentProps = ReturnType<typeof useRouteComponentProps>;
type RouteComponentType = React.ComponentType<RouteComponentProps>;
declare function WithComponentProps({ children, }: {
children: React.ReactElement;
}): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
declare function withComponentProps(Component: RouteComponentType): () => React.ReactElement<{
params: Readonly<Params<string>>;
loaderData: any;
actionData: any;
matches: UIMatch<unknown, unknown>[];
}, string | React.JSXElementConstructor<any>>;
declare function useHydrateFallbackProps(): {
params: Readonly<Params<string>>;
loaderData: any;
actionData: any;
};
type HydrateFallbackProps = ReturnType<typeof useHydrateFallbackProps>;
type HydrateFallbackType = React.ComponentType<HydrateFallbackProps>;
declare function WithHydrateFallbackProps({ children, }: {
children: React.ReactElement;
}): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
declare function withHydrateFallbackProps(HydrateFallback: HydrateFallbackType): () => React.ReactElement<{
params: Readonly<Params<string>>;
loaderData: any;
actionData: any;
}, string | React.JSXElementConstructor<any>>;
declare function useErrorBoundaryProps(): {
params: Readonly<Params<string>>;
loaderData: any;
actionData: any;
error: unknown;
};
type ErrorBoundaryProps = ReturnType<typeof useErrorBoundaryProps>;
type ErrorBoundaryType = React.ComponentType<ErrorBoundaryProps>;
declare function WithErrorBoundaryProps({ children, }: {
children: React.ReactElement;
}): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
declare function withErrorBoundaryProps(ErrorBoundary: ErrorBoundaryType): () => React.ReactElement<{
params: Readonly<Params<string>>;
loaderData: any;
actionData: any;
error: unknown;
}, string | React.JSXElementConstructor<any>>;
export { type AwaitProps as A, type ErrorBoundaryType as E, type HydrateFallbackType as H, type IndexRouteProps as I, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateProps as N, type OutletProps as O, type PathRouteProps as P, type RouterProviderProps as R, WithComponentProps as W, type RouteComponentType as a, type MemoryRouterProps as b, type RouteProps as c, type RouterProps as d, type RoutesProps as e, Await as f, MemoryRouter as g, Navigate as h, Outlet as i, Route as j, Router as k, RouterProvider as l, Routes as m, createMemoryRouter as n, createRoutesFromChildren as o, createRoutesFromElements as p, hydrationRouteProperties as q, renderMatches as r, mapRouteProperties as s, WithHydrateFallbackProps as t, withHydrateFallbackProps as u, WithErrorBoundaryProps as v, withComponentProps as w, withErrorBoundaryProps as x };

View File

@ -0,0 +1,32 @@
import * as React from 'react';
import { R as RouterProviderProps$1 } from './components-CjQijYga.mjs';
import './browser-7LYX59NK.mjs';
import { e as RouterInit } from './route-data-CqEmXQub.mjs';
import 'node:async_hooks';
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
interface HydratedRouterProps {
/**
* Context object to passed through to `createBrowserRouter` and made available
* to `clientLoader`/`clientActon` functions
*/
unstable_getContext?: RouterInit["unstable_getContext"];
}
/**
* Framework-mode router component to be used to to hydrate a router from a
* `ServerRouter`. See [`entry.client.tsx`](../api/framework-conventions/entry.client.tsx).
*
* @public
* @category Framework Routers
* @mode framework
* @param props Props
* @param props.unstable_getContext Context object to passed through to
* {@link createBrowserRouter} and made available to `clientLoader`/`clientAction`
* functions
* @returns A React element that represents the hydrated application.
*/
declare function HydratedRouter(props: HydratedRouterProps): React.JSX.Element;
export { HydratedRouter, RouterProvider, type RouterProviderProps };

View File

@ -0,0 +1,29 @@
import * as React from 'react';
import { RouterProviderProps as RouterProviderProps$1, RouterInit } from 'react-router';
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
interface HydratedRouterProps {
/**
* Context object to passed through to `createBrowserRouter` and made available
* to `clientLoader`/`clientActon` functions
*/
unstable_getContext?: RouterInit["unstable_getContext"];
}
/**
* Framework-mode router component to be used to to hydrate a router from a
* `ServerRouter`. See [`entry.client.tsx`](../api/framework-conventions/entry.client.tsx).
*
* @public
* @category Framework Routers
* @mode framework
* @param props Props
* @param props.unstable_getContext Context object to passed through to
* {@link createBrowserRouter} and made available to `clientLoader`/`clientAction`
* functions
* @returns A React element that represents the hydrated application.
*/
declare function HydratedRouter(props: HydratedRouterProps): React.JSX.Element;
export { HydratedRouter, RouterProvider, type RouterProviderProps };

234
node_modules/react-router/dist/production/dom-export.js generated vendored Normal file
View File

@ -0,0 +1,234 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
* react-router v7.7.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
"use client";
var _chunk7OQROU2Djs = require('./chunk-7OQROU2D.js');
// lib/dom-export/dom-router-provider.tsx
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react);
var _reactdom = require('react-dom'); var ReactDOM = _interopRequireWildcard(_reactdom);
var _reactrouter = require('react-router');
function RouterProvider(props) {
return /* @__PURE__ */ React.createElement(_reactrouter.RouterProvider, { flushSync: ReactDOM.flushSync, ...props });
}
// lib/dom-export/hydrated-router.tsx
var ssrInfo = null;
var router = null;
function initSsrInfo() {
if (!ssrInfo && window.__reactRouterContext && window.__reactRouterManifest && window.__reactRouterRouteModules) {
if (window.__reactRouterManifest.sri === true) {
const importMap = document.querySelector("script[rr-importmap]");
if (_optionalChain([importMap, 'optionalAccess', _ => _.textContent])) {
try {
window.__reactRouterManifest.sri = JSON.parse(
importMap.textContent
).integrity;
} catch (err) {
console.error("Failed to parse import map", err);
}
}
}
ssrInfo = {
context: window.__reactRouterContext,
manifest: window.__reactRouterManifest,
routeModules: window.__reactRouterRouteModules,
stateDecodingPromise: void 0,
router: void 0,
routerInitialized: false
};
}
}
function createHydratedRouter({
unstable_getContext
}) {
initSsrInfo();
if (!ssrInfo) {
throw new Error(
"You must be using the SSR features of React Router in order to skip passing a `router` prop to `<RouterProvider>`"
);
}
let localSsrInfo = ssrInfo;
if (!ssrInfo.stateDecodingPromise) {
let stream = ssrInfo.context.stream;
_reactrouter.UNSAFE_invariant.call(void 0, stream, "No stream found for single fetch decoding");
ssrInfo.context.stream = void 0;
ssrInfo.stateDecodingPromise = _reactrouter.UNSAFE_decodeViaTurboStream.call(void 0, stream, window).then((value) => {
ssrInfo.context.state = value.value;
localSsrInfo.stateDecodingPromise.value = true;
}).catch((e) => {
localSsrInfo.stateDecodingPromise.error = e;
});
}
if (ssrInfo.stateDecodingPromise.error) {
throw ssrInfo.stateDecodingPromise.error;
}
if (!ssrInfo.stateDecodingPromise.value) {
throw ssrInfo.stateDecodingPromise;
}
let routes = _reactrouter.UNSAFE_createClientRoutes.call(void 0,
ssrInfo.manifest.routes,
ssrInfo.routeModules,
ssrInfo.context.state,
ssrInfo.context.ssr,
ssrInfo.context.isSpaMode
);
let hydrationData = void 0;
if (ssrInfo.context.isSpaMode) {
let { loaderData } = ssrInfo.context.state;
if (_optionalChain([ssrInfo, 'access', _2 => _2.manifest, 'access', _3 => _3.routes, 'access', _4 => _4.root, 'optionalAccess', _5 => _5.hasLoader]) && loaderData && "root" in loaderData) {
hydrationData = {
loaderData: {
root: loaderData.root
}
};
}
} else {
hydrationData = _reactrouter.UNSAFE_getHydrationData.call(void 0,
ssrInfo.context.state,
routes,
(routeId) => ({
clientLoader: _optionalChain([ssrInfo, 'access', _6 => _6.routeModules, 'access', _7 => _7[routeId], 'optionalAccess', _8 => _8.clientLoader]),
hasLoader: _optionalChain([ssrInfo, 'access', _9 => _9.manifest, 'access', _10 => _10.routes, 'access', _11 => _11[routeId], 'optionalAccess', _12 => _12.hasLoader]) === true,
hasHydrateFallback: _optionalChain([ssrInfo, 'access', _13 => _13.routeModules, 'access', _14 => _14[routeId], 'optionalAccess', _15 => _15.HydrateFallback]) != null
}),
window.location,
_optionalChain([window, 'access', _16 => _16.__reactRouterContext, 'optionalAccess', _17 => _17.basename]),
ssrInfo.context.isSpaMode
);
if (hydrationData && hydrationData.errors) {
hydrationData.errors = _reactrouter.UNSAFE_deserializeErrors.call(void 0, hydrationData.errors);
}
}
let router2 = _reactrouter.UNSAFE_createRouter.call(void 0, {
routes,
history: _reactrouter.UNSAFE_createBrowserHistory.call(void 0, ),
basename: ssrInfo.context.basename,
unstable_getContext,
hydrationData,
hydrationRouteProperties: _reactrouter.UNSAFE_hydrationRouteProperties,
mapRouteProperties: _reactrouter.UNSAFE_mapRouteProperties,
future: {
unstable_middleware: ssrInfo.context.future.unstable_middleware
},
dataStrategy: _reactrouter.UNSAFE_getTurboStreamSingleFetchDataStrategy.call(void 0,
() => router2,
ssrInfo.manifest,
ssrInfo.routeModules,
ssrInfo.context.ssr,
ssrInfo.context.basename
),
patchRoutesOnNavigation: _reactrouter.UNSAFE_getPatchRoutesOnNavigationFunction.call(void 0,
ssrInfo.manifest,
ssrInfo.routeModules,
ssrInfo.context.ssr,
ssrInfo.context.routeDiscovery,
ssrInfo.context.isSpaMode,
ssrInfo.context.basename
)
});
ssrInfo.router = router2;
if (router2.state.initialized) {
ssrInfo.routerInitialized = true;
router2.initialize();
}
router2.createRoutesForHMR = /* spacer so ts-ignore does not affect the right hand of the assignment */
_reactrouter.UNSAFE_createClientRoutesWithHMRRevalidationOptOut;
window.__reactRouterDataRouter = router2;
return router2;
}
function HydratedRouter(props) {
if (!router) {
router = createHydratedRouter({
unstable_getContext: props.unstable_getContext
});
}
let [criticalCss, setCriticalCss] = React2.useState(
process.env.NODE_ENV === "development" ? _optionalChain([ssrInfo, 'optionalAccess', _18 => _18.context, 'access', _19 => _19.criticalCss]) : void 0
);
React2.useEffect(() => {
if (process.env.NODE_ENV === "development") {
setCriticalCss(void 0);
}
}, []);
React2.useEffect(() => {
if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
document.querySelectorAll(`[${_chunk7OQROU2Djs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
}
}, [criticalCss]);
let [location, setLocation] = React2.useState(router.state.location);
React2.useLayoutEffect(() => {
if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {
ssrInfo.routerInitialized = true;
ssrInfo.router.initialize();
}
}, []);
React2.useLayoutEffect(() => {
if (ssrInfo && ssrInfo.router) {
return ssrInfo.router.subscribe((newState) => {
if (newState.location !== location) {
setLocation(newState.location);
}
});
}
}, [location]);
_reactrouter.UNSAFE_invariant.call(void 0, ssrInfo, "ssrInfo unavailable for HydratedRouter");
_reactrouter.UNSAFE_useFogOFWarDiscovery.call(void 0,
router,
ssrInfo.manifest,
ssrInfo.routeModules,
ssrInfo.context.ssr,
ssrInfo.context.routeDiscovery,
ssrInfo.context.isSpaMode
);
return (
// This fragment is important to ensure we match the <ServerRouter> JSX
// structure so that useId values hydrate correctly
/* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
_reactrouter.UNSAFE_FrameworkContext.Provider,
{
value: {
manifest: ssrInfo.manifest,
routeModules: ssrInfo.routeModules,
future: ssrInfo.context.future,
criticalCss,
ssr: ssrInfo.context.ssr,
isSpaMode: ssrInfo.context.isSpaMode,
routeDiscovery: ssrInfo.context.routeDiscovery
}
},
/* @__PURE__ */ React2.createElement(_reactrouter.UNSAFE_RemixErrorBoundary, { location }, /* @__PURE__ */ React2.createElement(RouterProvider, { router }))
), /* @__PURE__ */ React2.createElement(React2.Fragment, null))
);
}
exports.HydratedRouter = HydratedRouter; exports.RouterProvider = RouterProvider;

View File

@ -0,0 +1,234 @@
/**
* react-router v7.7.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
"use client";
import {
deserializeErrors,
getHydrationData
} from "./chunk-K3SBCRK4.mjs";
import {
CRITICAL_CSS_DATA_ATTRIBUTE,
FrameworkContext,
RemixErrorBoundary,
RouterProvider,
createBrowserHistory,
createClientRoutes,
createClientRoutesWithHMRRevalidationOptOut,
createRouter,
decodeViaTurboStream,
getPatchRoutesOnNavigationFunction,
getTurboStreamSingleFetchDataStrategy,
hydrationRouteProperties,
invariant,
mapRouteProperties,
useFogOFWarDiscovery
} from "./chunk-IZ57JD2V.mjs";
// lib/dom-export/dom-router-provider.tsx
import * as React from "react";
import * as ReactDOM from "react-dom";
function RouterProvider2(props) {
return /* @__PURE__ */ React.createElement(RouterProvider, { flushSync: ReactDOM.flushSync, ...props });
}
// lib/dom-export/hydrated-router.tsx
import * as React2 from "react";
var ssrInfo = null;
var router = null;
function initSsrInfo() {
if (!ssrInfo && window.__reactRouterContext && window.__reactRouterManifest && window.__reactRouterRouteModules) {
if (window.__reactRouterManifest.sri === true) {
const importMap = document.querySelector("script[rr-importmap]");
if (importMap?.textContent) {
try {
window.__reactRouterManifest.sri = JSON.parse(
importMap.textContent
).integrity;
} catch (err) {
console.error("Failed to parse import map", err);
}
}
}
ssrInfo = {
context: window.__reactRouterContext,
manifest: window.__reactRouterManifest,
routeModules: window.__reactRouterRouteModules,
stateDecodingPromise: void 0,
router: void 0,
routerInitialized: false
};
}
}
function createHydratedRouter({
unstable_getContext
}) {
initSsrInfo();
if (!ssrInfo) {
throw new Error(
"You must be using the SSR features of React Router in order to skip passing a `router` prop to `<RouterProvider>`"
);
}
let localSsrInfo = ssrInfo;
if (!ssrInfo.stateDecodingPromise) {
let stream = ssrInfo.context.stream;
invariant(stream, "No stream found for single fetch decoding");
ssrInfo.context.stream = void 0;
ssrInfo.stateDecodingPromise = decodeViaTurboStream(stream, window).then((value) => {
ssrInfo.context.state = value.value;
localSsrInfo.stateDecodingPromise.value = true;
}).catch((e) => {
localSsrInfo.stateDecodingPromise.error = e;
});
}
if (ssrInfo.stateDecodingPromise.error) {
throw ssrInfo.stateDecodingPromise.error;
}
if (!ssrInfo.stateDecodingPromise.value) {
throw ssrInfo.stateDecodingPromise;
}
let routes = createClientRoutes(
ssrInfo.manifest.routes,
ssrInfo.routeModules,
ssrInfo.context.state,
ssrInfo.context.ssr,
ssrInfo.context.isSpaMode
);
let hydrationData = void 0;
if (ssrInfo.context.isSpaMode) {
let { loaderData } = ssrInfo.context.state;
if (ssrInfo.manifest.routes.root?.hasLoader && loaderData && "root" in loaderData) {
hydrationData = {
loaderData: {
root: loaderData.root
}
};
}
} else {
hydrationData = getHydrationData(
ssrInfo.context.state,
routes,
(routeId) => ({
clientLoader: ssrInfo.routeModules[routeId]?.clientLoader,
hasLoader: ssrInfo.manifest.routes[routeId]?.hasLoader === true,
hasHydrateFallback: ssrInfo.routeModules[routeId]?.HydrateFallback != null
}),
window.location,
window.__reactRouterContext?.basename,
ssrInfo.context.isSpaMode
);
if (hydrationData && hydrationData.errors) {
hydrationData.errors = deserializeErrors(hydrationData.errors);
}
}
let router2 = createRouter({
routes,
history: createBrowserHistory(),
basename: ssrInfo.context.basename,
unstable_getContext,
hydrationData,
hydrationRouteProperties,
mapRouteProperties,
future: {
unstable_middleware: ssrInfo.context.future.unstable_middleware
},
dataStrategy: getTurboStreamSingleFetchDataStrategy(
() => router2,
ssrInfo.manifest,
ssrInfo.routeModules,
ssrInfo.context.ssr,
ssrInfo.context.basename
),
patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction(
ssrInfo.manifest,
ssrInfo.routeModules,
ssrInfo.context.ssr,
ssrInfo.context.routeDiscovery,
ssrInfo.context.isSpaMode,
ssrInfo.context.basename
)
});
ssrInfo.router = router2;
if (router2.state.initialized) {
ssrInfo.routerInitialized = true;
router2.initialize();
}
router2.createRoutesForHMR = /* spacer so ts-ignore does not affect the right hand of the assignment */
createClientRoutesWithHMRRevalidationOptOut;
window.__reactRouterDataRouter = router2;
return router2;
}
function HydratedRouter(props) {
if (!router) {
router = createHydratedRouter({
unstable_getContext: props.unstable_getContext
});
}
let [criticalCss, setCriticalCss] = React2.useState(
process.env.NODE_ENV === "development" ? ssrInfo?.context.criticalCss : void 0
);
React2.useEffect(() => {
if (process.env.NODE_ENV === "development") {
setCriticalCss(void 0);
}
}, []);
React2.useEffect(() => {
if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
document.querySelectorAll(`[${CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
}
}, [criticalCss]);
let [location, setLocation] = React2.useState(router.state.location);
React2.useLayoutEffect(() => {
if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {
ssrInfo.routerInitialized = true;
ssrInfo.router.initialize();
}
}, []);
React2.useLayoutEffect(() => {
if (ssrInfo && ssrInfo.router) {
return ssrInfo.router.subscribe((newState) => {
if (newState.location !== location) {
setLocation(newState.location);
}
});
}
}, [location]);
invariant(ssrInfo, "ssrInfo unavailable for HydratedRouter");
useFogOFWarDiscovery(
router,
ssrInfo.manifest,
ssrInfo.routeModules,
ssrInfo.context.ssr,
ssrInfo.context.routeDiscovery,
ssrInfo.context.isSpaMode
);
return (
// This fragment is important to ensure we match the <ServerRouter> JSX
// structure so that useId values hydrate correctly
/* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
FrameworkContext.Provider,
{
value: {
manifest: ssrInfo.manifest,
routeModules: ssrInfo.routeModules,
future: ssrInfo.context.future,
criticalCss,
ssr: ssrInfo.context.ssr,
isSpaMode: ssrInfo.context.isSpaMode,
routeDiscovery: ssrInfo.context.routeDiscovery
}
},
/* @__PURE__ */ React2.createElement(RemixErrorBoundary, { location }, /* @__PURE__ */ React2.createElement(RouterProvider2, { router }))
), /* @__PURE__ */ React2.createElement(React2.Fragment, null))
);
}
export {
HydratedRouter,
RouterProvider2 as RouterProvider
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
export { f as Await, g as MemoryRouter, h as Navigate, i as Outlet, j as Route, k as Router, l as RouterProvider, m as Routes, W as UNSAFE_WithComponentProps, v as UNSAFE_WithErrorBoundaryProps, t as UNSAFE_WithHydrateFallbackProps } from './components-CjQijYga.mjs';
export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-KLg-U4nr.mjs';
import './route-data-CqEmXQub.mjs';
import 'react';

View File

@ -0,0 +1,3 @@
export { h as Await, V as BrowserRouter, _ as Form, W as HashRouter, X as Link, am as Links, i as MemoryRouter, al as Meta, Z as NavLink, j as Navigate, k as Outlet, l as Route, m as Router, n as RouterProvider, o as Routes, $ as ScrollRestoration, aj as StaticRouter, ak as StaticRouterProvider, ay as UNSAFE_WithComponentProps, aC as UNSAFE_WithErrorBoundaryProps, aA as UNSAFE_WithHydrateFallbackProps, Y as unstable_HistoryRouter } from './index-react-server-client-Bi_fx8qz.js';
import './routeModules-BR2FO0ix.js';
import 'react';

View File

@ -0,0 +1,61 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
* react-router v7.7.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
"use client";
var _chunk4DGLNKXFjs = require('./chunk-4DGLNKXF.js');
var _chunk7OQROU2Djs = require('./chunk-7OQROU2D.js');
exports.Await = _chunk4DGLNKXFjs.Await; exports.BrowserRouter = _chunk4DGLNKXFjs.BrowserRouter; exports.Form = _chunk4DGLNKXFjs.Form; exports.HashRouter = _chunk4DGLNKXFjs.HashRouter; exports.Link = _chunk4DGLNKXFjs.Link; exports.Links = _chunk7OQROU2Djs.Links; exports.MemoryRouter = _chunk4DGLNKXFjs.MemoryRouter; exports.Meta = _chunk7OQROU2Djs.Meta; exports.NavLink = _chunk4DGLNKXFjs.NavLink; exports.Navigate = _chunk4DGLNKXFjs.Navigate; exports.Outlet = _chunk4DGLNKXFjs.Outlet; exports.Route = _chunk4DGLNKXFjs.Route; exports.Router = _chunk4DGLNKXFjs.Router; exports.RouterProvider = _chunk4DGLNKXFjs.RouterProvider; exports.Routes = _chunk4DGLNKXFjs.Routes; exports.ScrollRestoration = _chunk4DGLNKXFjs.ScrollRestoration; exports.StaticRouter = _chunk4DGLNKXFjs.StaticRouter; exports.StaticRouterProvider = _chunk4DGLNKXFjs.StaticRouterProvider; exports.UNSAFE_WithComponentProps = _chunk4DGLNKXFjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunk4DGLNKXFjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunk4DGLNKXFjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunk4DGLNKXFjs.HistoryRouter;

View File

@ -0,0 +1,59 @@
/**
* react-router v7.7.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
"use client";
import {
Await,
BrowserRouter,
Form,
HashRouter,
HistoryRouter,
Link,
Links,
MemoryRouter,
Meta,
NavLink,
Navigate,
Outlet,
Route,
Router,
RouterProvider,
Routes,
ScrollRestoration,
StaticRouter,
StaticRouterProvider,
WithComponentProps,
WithErrorBoundaryProps,
WithHydrateFallbackProps
} from "./chunk-IZ57JD2V.mjs";
export {
Await,
BrowserRouter,
Form,
HashRouter,
Link,
Links,
MemoryRouter,
Meta,
NavLink,
Navigate,
Outlet,
Route,
Router,
RouterProvider,
Routes,
ScrollRestoration,
StaticRouter,
StaticRouterProvider,
WithComponentProps as UNSAFE_WithComponentProps,
WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps,
WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps,
HistoryRouter as unstable_HistoryRouter
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1426
node_modules/react-router/dist/production/index.d.mts generated vendored Normal file

File diff suppressed because it is too large Load Diff

1643
node_modules/react-router/dist/production/index.d.ts generated vendored Normal file

File diff suppressed because it is too large Load Diff

2889
node_modules/react-router/dist/production/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

273
node_modules/react-router/dist/production/index.mjs generated vendored Normal file
View File

@ -0,0 +1,273 @@
/**
* react-router v7.7.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
"use client";
import {
RSCDefaultRootErrorBoundary,
RSCHydratedRouter,
RSCStaticRouter,
ServerMode,
ServerRouter,
createCallServer,
createCookie,
createCookieSessionStorage,
createMemorySessionStorage,
createRequestHandler,
createRoutesStub,
createSession,
createSessionStorage,
deserializeErrors,
getHydrationData,
getRSCStream,
href,
isCookie,
isSession,
routeRSCServerRequest,
setDevServerHooks
} from "./chunk-K3SBCRK4.mjs";
import {
Action,
Await,
BrowserRouter,
DataRouterContext,
DataRouterStateContext,
ErrorResponseImpl,
FetchersContext,
Form,
FrameworkContext,
HashRouter,
HistoryRouter,
IDLE_BLOCKER,
IDLE_FETCHER,
IDLE_NAVIGATION,
Link,
Links,
LocationContext,
MemoryRouter,
Meta,
NavLink,
Navigate,
NavigationContext,
Outlet,
PrefetchPageLinks,
RemixErrorBoundary,
Route,
RouteContext,
Router,
RouterProvider,
Routes,
Scripts,
ScrollRestoration,
SingleFetchRedirectSymbol,
StaticRouter,
StaticRouterProvider,
ViewTransitionContext,
WithComponentProps,
WithErrorBoundaryProps,
WithHydrateFallbackProps,
createBrowserHistory,
createBrowserRouter,
createClientRoutes,
createClientRoutesWithHMRRevalidationOptOut,
createHashRouter,
createMemoryRouter,
createPath,
createRouter,
createRoutesFromChildren,
createRoutesFromElements,
createSearchParams,
createStaticHandler2 as createStaticHandler,
createStaticRouter,
data,
decodeViaTurboStream,
generatePath,
getPatchRoutesOnNavigationFunction,
getTurboStreamSingleFetchDataStrategy,
hydrationRouteProperties,
invariant,
isRouteErrorResponse,
mapRouteProperties,
matchPath,
matchRoutes,
parsePath,
redirect,
redirectDocument,
renderMatches,
replace,
resolvePath,
shouldHydrateRouteLoader,
unstable_RouterContextProvider,
unstable_createContext,
useActionData,
useAsyncError,
useAsyncValue,
useBeforeUnload,
useBlocker,
useFetcher,
useFetchers,
useFogOFWarDiscovery,
useFormAction,
useHref,
useInRouterContext,
useLinkClickHandler,
useLoaderData,
useLocation,
useMatch,
useMatches,
useNavigate,
useNavigation,
useNavigationType,
useOutlet,
useOutletContext,
useParams,
usePrompt,
useResolvedPath,
useRevalidator,
useRouteError,
useRouteLoaderData,
useRoutes,
useScrollRestoration,
useSearchParams,
useSubmit,
useViewTransitionState,
withComponentProps,
withErrorBoundaryProps,
withHydrateFallbackProps
} from "./chunk-IZ57JD2V.mjs";
export {
Await,
BrowserRouter,
Form,
HashRouter,
IDLE_BLOCKER,
IDLE_FETCHER,
IDLE_NAVIGATION,
Link,
Links,
MemoryRouter,
Meta,
NavLink,
Navigate,
Action as NavigationType,
Outlet,
PrefetchPageLinks,
Route,
Router,
RouterProvider,
Routes,
Scripts,
ScrollRestoration,
ServerRouter,
StaticRouter,
StaticRouterProvider,
DataRouterContext as UNSAFE_DataRouterContext,
DataRouterStateContext as UNSAFE_DataRouterStateContext,
ErrorResponseImpl as UNSAFE_ErrorResponseImpl,
FetchersContext as UNSAFE_FetchersContext,
FrameworkContext as UNSAFE_FrameworkContext,
LocationContext as UNSAFE_LocationContext,
NavigationContext as UNSAFE_NavigationContext,
RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary,
RemixErrorBoundary as UNSAFE_RemixErrorBoundary,
RouteContext as UNSAFE_RouteContext,
ServerMode as UNSAFE_ServerMode,
SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol,
ViewTransitionContext as UNSAFE_ViewTransitionContext,
WithComponentProps as UNSAFE_WithComponentProps,
WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps,
WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps,
createBrowserHistory as UNSAFE_createBrowserHistory,
createClientRoutes as UNSAFE_createClientRoutes,
createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut,
createRouter as UNSAFE_createRouter,
decodeViaTurboStream as UNSAFE_decodeViaTurboStream,
deserializeErrors as UNSAFE_deserializeErrors,
getHydrationData as UNSAFE_getHydrationData,
getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction,
getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy,
hydrationRouteProperties as UNSAFE_hydrationRouteProperties,
invariant as UNSAFE_invariant,
mapRouteProperties as UNSAFE_mapRouteProperties,
shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader,
useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery,
useScrollRestoration as UNSAFE_useScrollRestoration,
withComponentProps as UNSAFE_withComponentProps,
withErrorBoundaryProps as UNSAFE_withErrorBoundaryProps,
withHydrateFallbackProps as UNSAFE_withHydrateFallbackProps,
createBrowserRouter,
createCookie,
createCookieSessionStorage,
createHashRouter,
createMemoryRouter,
createMemorySessionStorage,
createPath,
createRequestHandler,
createRoutesFromChildren,
createRoutesFromElements,
createRoutesStub,
createSearchParams,
createSession,
createSessionStorage,
createStaticHandler,
createStaticRouter,
data,
generatePath,
href,
isCookie,
isRouteErrorResponse,
isSession,
matchPath,
matchRoutes,
parsePath,
redirect,
redirectDocument,
renderMatches,
replace,
resolvePath,
HistoryRouter as unstable_HistoryRouter,
RSCHydratedRouter as unstable_RSCHydratedRouter,
RSCStaticRouter as unstable_RSCStaticRouter,
unstable_RouterContextProvider,
createCallServer as unstable_createCallServer,
unstable_createContext,
getRSCStream as unstable_getRSCStream,
routeRSCServerRequest as unstable_routeRSCServerRequest,
setDevServerHooks as unstable_setDevServerHooks,
usePrompt as unstable_usePrompt,
useActionData,
useAsyncError,
useAsyncValue,
useBeforeUnload,
useBlocker,
useFetcher,
useFetchers,
useFormAction,
useHref,
useInRouterContext,
useLinkClickHandler,
useLoaderData,
useLocation,
useMatch,
useMatches,
useNavigate,
useNavigation,
useNavigationType,
useOutlet,
useOutletContext,
useParams,
useResolvedPath,
useRevalidator,
useRouteError,
useRouteLoaderData,
useRoutes,
useSearchParams,
useSubmit,
useViewTransitionState
};

View File

@ -0,0 +1,146 @@
import { n as RouteModule, o as LinkDescriptor, c as Location, p as Pretty, q as MetaDescriptor, G as GetLoaderData, r as ServerDataFunctionArgs, s as unstable_MiddlewareNextFunction, t as ClientDataFunctionArgs, v as ServerDataFrom, w as Normalize, x as GetActionData } from '../../route-data-CqEmXQub.mjs';
import { R as RouteFiles, P as Pages } from '../../register-DiOIlEq5.mjs';
import 'react';
type MaybePromise<T> = T | Promise<T>;
type Props = {
params: unknown;
loaderData: unknown;
actionData: unknown;
};
type RouteInfo = Props & {
module: RouteModule;
matches: Array<MatchInfo>;
};
type MatchInfo = {
id: string;
module: RouteModule;
};
type MetaMatch<T extends MatchInfo> = Pretty<{
id: T["id"];
params: Record<string, string | undefined>;
pathname: string;
meta: MetaDescriptor[];
data: GetLoaderData<T["module"]>;
handle?: unknown;
error?: unknown;
}>;
type MetaMatches<T extends Array<MatchInfo>> = T extends [infer F extends MatchInfo, ...infer R extends Array<MatchInfo>] ? [MetaMatch<F>, ...MetaMatches<R>] : Array<MetaMatch<MatchInfo> | undefined>;
type CreateMetaArgs<T extends RouteInfo> = {
/** This is the current router `Location` object. This is useful for generating tags for routes at specific paths or query parameters. */
location: Location;
/** {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route. */
params: T["params"];
/** The return value for this route's server loader function */
data: T["loaderData"] | undefined;
/** Thrown errors that trigger error boundaries will be passed to the meta function. This is useful for generating metadata for error pages. */
error?: unknown;
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
matches: MetaMatches<T["matches"]>;
};
type MetaDescriptors = MetaDescriptor[];
type HeadersArgs = {
loaderHeaders: Headers;
parentHeaders: Headers;
actionHeaders: Headers;
errorHeaders: Headers | undefined;
};
type CreateServerMiddlewareFunction<T extends RouteInfo> = (args: ServerDataFunctionArgs<T["params"]>, next: unstable_MiddlewareNextFunction<Response>) => MaybePromise<Response | void>;
type CreateClientMiddlewareFunction<T extends RouteInfo> = (args: ClientDataFunctionArgs<T["params"]>, next: unstable_MiddlewareNextFunction<undefined>) => MaybePromise<void>;
type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T["params"]>;
type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T["params"]> & {
/** This is an asynchronous function to get the data from the server loader for this route. On client-side navigations, this will make a {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server loader. If you opt-into running your clientLoader on hydration, then this function will return the data that was already loaded on the server (via Promise.resolve). */
serverLoader: () => Promise<ServerDataFrom<T["module"]["loader"]>>;
};
type CreateServerActionArgs<T extends RouteInfo> = ServerDataFunctionArgs<T["params"]>;
type CreateClientActionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T["params"]> & {
/** This is an asynchronous function that makes the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server action for this route. */
serverAction: () => Promise<ServerDataFrom<T["module"]["action"]>>;
};
type CreateHydrateFallbackProps<T extends RouteInfo> = {
params: T["params"];
loaderData?: T["loaderData"];
actionData?: T["actionData"];
};
type Match<T extends MatchInfo> = Pretty<{
id: T["id"];
params: Record<string, string | undefined>;
pathname: string;
data: GetLoaderData<T["module"]>;
handle: unknown;
}>;
type Matches<T extends Array<MatchInfo>> = T extends [infer F extends MatchInfo, ...infer R extends Array<MatchInfo>] ? [Match<F>, ...Matches<R>] : Array<Match<MatchInfo> | undefined>;
type CreateComponentProps<T extends RouteInfo> = {
/**
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
* @example
* // app/routes.ts
* route("teams/:teamId", "./team.tsx"),
*
* // app/team.tsx
* export default function Component({
* params,
* }: Route.ComponentProps) {
* params.teamId;
* // ^ string
* }
**/
params: T["params"];
/** The data returned from the `loader` or `clientLoader` */
loaderData: T["loaderData"];
/** The data returned from the `action` or `clientAction` following an action submission. */
actionData?: T["actionData"];
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
matches: Matches<T["matches"]>;
};
type CreateErrorBoundaryProps<T extends RouteInfo> = {
/**
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
* @example
* // app/routes.ts
* route("teams/:teamId", "./team.tsx"),
*
* // app/team.tsx
* export function ErrorBoundary({
* params,
* }: Route.ErrorBoundaryProps) {
* params.teamId;
* // ^ string
* }
**/
params: T["params"];
error: unknown;
loaderData?: T["loaderData"];
actionData?: T["actionData"];
};
type GetAnnotations<Info extends RouteInfo> = {
LinkDescriptors: LinkDescriptor[];
LinksFunction: () => LinkDescriptor[];
MetaArgs: CreateMetaArgs<Info>;
MetaDescriptors: MetaDescriptors;
MetaFunction: (args: CreateMetaArgs<Info>) => MetaDescriptors;
HeadersArgs: HeadersArgs;
HeadersFunction: (args: HeadersArgs) => Headers | HeadersInit;
unstable_MiddlewareFunction: CreateServerMiddlewareFunction<Info>;
unstable_ClientMiddlewareFunction: CreateClientMiddlewareFunction<Info>;
LoaderArgs: CreateServerLoaderArgs<Info>;
ClientLoaderArgs: CreateClientLoaderArgs<Info>;
ActionArgs: CreateServerActionArgs<Info>;
ClientActionArgs: CreateClientActionArgs<Info>;
HydrateFallbackProps: CreateHydrateFallbackProps<Info>;
ComponentProps: CreateComponentProps<Info>;
ErrorBoundaryProps: CreateErrorBoundaryProps<Info>;
};
type Params<RouteFile extends keyof RouteFiles> = Normalize<Pages[RouteFiles[RouteFile]["page"]]["params"]>;
type GetInfo<T extends {
file: keyof RouteFiles;
module: RouteModule;
}> = {
params: Params<T["file"]>;
loaderData: GetLoaderData<T["module"]>;
actionData: GetActionData<T["module"]>;
};
export type { GetAnnotations, GetInfo };

View File

@ -0,0 +1,146 @@
import { R as RouteModule, L as LinkDescriptor, a as Location, P as Pretty, M as MetaDescriptor, G as GetLoaderData, S as ServerDataFunctionArgs, u as unstable_MiddlewareNextFunction, C as ClientDataFunctionArgs, b as ServerDataFrom, N as Normalize, c as GetActionData } from '../../routeModules-BR2FO0ix.js';
import { R as RouteFiles, P as Pages } from '../../register-DiOIlEq5.js';
import 'react';
type MaybePromise<T> = T | Promise<T>;
type Props = {
params: unknown;
loaderData: unknown;
actionData: unknown;
};
type RouteInfo = Props & {
module: RouteModule;
matches: Array<MatchInfo>;
};
type MatchInfo = {
id: string;
module: RouteModule;
};
type MetaMatch<T extends MatchInfo> = Pretty<{
id: T["id"];
params: Record<string, string | undefined>;
pathname: string;
meta: MetaDescriptor[];
data: GetLoaderData<T["module"]>;
handle?: unknown;
error?: unknown;
}>;
type MetaMatches<T extends Array<MatchInfo>> = T extends [infer F extends MatchInfo, ...infer R extends Array<MatchInfo>] ? [MetaMatch<F>, ...MetaMatches<R>] : Array<MetaMatch<MatchInfo> | undefined>;
type CreateMetaArgs<T extends RouteInfo> = {
/** This is the current router `Location` object. This is useful for generating tags for routes at specific paths or query parameters. */
location: Location;
/** {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route. */
params: T["params"];
/** The return value for this route's server loader function */
data: T["loaderData"] | undefined;
/** Thrown errors that trigger error boundaries will be passed to the meta function. This is useful for generating metadata for error pages. */
error?: unknown;
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
matches: MetaMatches<T["matches"]>;
};
type MetaDescriptors = MetaDescriptor[];
type HeadersArgs = {
loaderHeaders: Headers;
parentHeaders: Headers;
actionHeaders: Headers;
errorHeaders: Headers | undefined;
};
type CreateServerMiddlewareFunction<T extends RouteInfo> = (args: ServerDataFunctionArgs<T["params"]>, next: unstable_MiddlewareNextFunction<Response>) => MaybePromise<Response | void>;
type CreateClientMiddlewareFunction<T extends RouteInfo> = (args: ClientDataFunctionArgs<T["params"]>, next: unstable_MiddlewareNextFunction<undefined>) => MaybePromise<void>;
type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T["params"]>;
type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T["params"]> & {
/** This is an asynchronous function to get the data from the server loader for this route. On client-side navigations, this will make a {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server loader. If you opt-into running your clientLoader on hydration, then this function will return the data that was already loaded on the server (via Promise.resolve). */
serverLoader: () => Promise<ServerDataFrom<T["module"]["loader"]>>;
};
type CreateServerActionArgs<T extends RouteInfo> = ServerDataFunctionArgs<T["params"]>;
type CreateClientActionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T["params"]> & {
/** This is an asynchronous function that makes the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server action for this route. */
serverAction: () => Promise<ServerDataFrom<T["module"]["action"]>>;
};
type CreateHydrateFallbackProps<T extends RouteInfo> = {
params: T["params"];
loaderData?: T["loaderData"];
actionData?: T["actionData"];
};
type Match<T extends MatchInfo> = Pretty<{
id: T["id"];
params: Record<string, string | undefined>;
pathname: string;
data: GetLoaderData<T["module"]>;
handle: unknown;
}>;
type Matches<T extends Array<MatchInfo>> = T extends [infer F extends MatchInfo, ...infer R extends Array<MatchInfo>] ? [Match<F>, ...Matches<R>] : Array<Match<MatchInfo> | undefined>;
type CreateComponentProps<T extends RouteInfo> = {
/**
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
* @example
* // app/routes.ts
* route("teams/:teamId", "./team.tsx"),
*
* // app/team.tsx
* export default function Component({
* params,
* }: Route.ComponentProps) {
* params.teamId;
* // ^ string
* }
**/
params: T["params"];
/** The data returned from the `loader` or `clientLoader` */
loaderData: T["loaderData"];
/** The data returned from the `action` or `clientAction` following an action submission. */
actionData?: T["actionData"];
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
matches: Matches<T["matches"]>;
};
type CreateErrorBoundaryProps<T extends RouteInfo> = {
/**
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
* @example
* // app/routes.ts
* route("teams/:teamId", "./team.tsx"),
*
* // app/team.tsx
* export function ErrorBoundary({
* params,
* }: Route.ErrorBoundaryProps) {
* params.teamId;
* // ^ string
* }
**/
params: T["params"];
error: unknown;
loaderData?: T["loaderData"];
actionData?: T["actionData"];
};
type GetAnnotations<Info extends RouteInfo> = {
LinkDescriptors: LinkDescriptor[];
LinksFunction: () => LinkDescriptor[];
MetaArgs: CreateMetaArgs<Info>;
MetaDescriptors: MetaDescriptors;
MetaFunction: (args: CreateMetaArgs<Info>) => MetaDescriptors;
HeadersArgs: HeadersArgs;
HeadersFunction: (args: HeadersArgs) => Headers | HeadersInit;
unstable_MiddlewareFunction: CreateServerMiddlewareFunction<Info>;
unstable_ClientMiddlewareFunction: CreateClientMiddlewareFunction<Info>;
LoaderArgs: CreateServerLoaderArgs<Info>;
ClientLoaderArgs: CreateClientLoaderArgs<Info>;
ActionArgs: CreateServerActionArgs<Info>;
ClientActionArgs: CreateClientActionArgs<Info>;
HydrateFallbackProps: CreateHydrateFallbackProps<Info>;
ComponentProps: CreateComponentProps<Info>;
ErrorBoundaryProps: CreateErrorBoundaryProps<Info>;
};
type Params<RouteFile extends keyof RouteFiles> = Normalize<Pages[RouteFiles[RouteFile]["page"]]["params"]>;
type GetInfo<T extends {
file: keyof RouteFiles;
module: RouteModule;
}> = {
params: Params<T["file"]>;
loaderData: GetLoaderData<T["module"]>;
actionData: GetActionData<T["module"]>;
};
export type { GetAnnotations, GetInfo };

View File

@ -0,0 +1,10 @@
"use strict";/**
* react-router v7.7.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/

View File

@ -0,0 +1,10 @@
/**
* react-router v7.7.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/

View File

@ -0,0 +1,24 @@
/**
* Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
* React Router should handle this for you via type generation.
*
* For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
*/
interface Register {
}
type AnyParams = Record<string, string | undefined>;
type AnyPages = Record<string, {
params: AnyParams;
}>;
type Pages = Register extends {
pages: infer Registered extends AnyPages;
} ? Registered : AnyPages;
type AnyRouteFiles = Record<string, {
id: string;
page: string;
}>;
type RouteFiles = Register extends {
routeFiles: infer Registered extends AnyRouteFiles;
} ? Registered : AnyRouteFiles;
export type { Pages as P, RouteFiles as R, Register as a };

View File

@ -0,0 +1,24 @@
/**
* Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
* React Router should handle this for you via type generation.
*
* For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
*/
interface Register {
}
type AnyParams = Record<string, string | undefined>;
type AnyPages = Record<string, {
params: AnyParams;
}>;
type Pages = Register extends {
pages: infer Registered extends AnyPages;
} ? Registered : AnyPages;
type AnyRouteFiles = Record<string, {
id: string;
page: string;
}>;
type RouteFiles = Register extends {
routeFiles: infer Registered extends AnyRouteFiles;
} ? Registered : AnyRouteFiles;
export type { Pages as P, RouteFiles as R, Register as a };

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

162
node_modules/react-router/package.json generated vendored Normal file
View File

@ -0,0 +1,162 @@
{
"name": "react-router",
"version": "7.7.1",
"description": "Declarative routing for React",
"keywords": [
"react",
"router",
"route",
"routing",
"history",
"link"
],
"repository": {
"type": "git",
"url": "https://github.com/remix-run/react-router",
"directory": "packages/react-router"
},
"license": "MIT",
"author": "Remix Software <hello@remix.run>",
"sideEffects": false,
"types": "./dist/development/index.d.ts",
"main": "./dist/development/index.js",
"module": "./dist/development/index.mjs",
"exports": {
".": {
"react-server": {
"module": "./dist/development/index-react-server.mjs",
"default": "./dist/development/index-react-server.js"
},
"node": {
"types": "./dist/development/index.d.ts",
"module": "./dist/development/index.mjs",
"module-sync": "./dist/development/index.mjs",
"default": "./dist/development/index.js"
},
"module": {
"types": "./dist/development/index.d.mts",
"default": "./dist/development/index.mjs"
},
"import": {
"types": "./dist/development/index.d.mts",
"default": "./dist/development/index.mjs"
},
"default": {
"types": "./dist/development/index.d.ts",
"default": "./dist/development/index.js"
}
},
"./dom": {
"node": {
"types": "./dist/development/dom-export.d.ts",
"module": "./dist/development/dom-export.mjs",
"module-sync": "./dist/development/dom-export.mjs",
"default": "./dist/development/dom-export.js"
},
"module": {
"types": "./dist/development/dom-export.d.mts",
"default": "./dist/development/dom-export.mjs"
},
"import": {
"types": "./dist/development/dom-export.d.mts",
"default": "./dist/development/dom-export.mjs"
},
"default": {
"types": "./dist/development/dom-export.d.ts",
"default": "./dist/development/dom-export.js"
}
},
"./internal": {
"node": {
"types": "./dist/development/lib/types/internal.d.ts"
},
"import": {
"types": "./dist/development/lib/types/internal.d.mts"
},
"default": {
"types": "./dist/development/lib/types/index.d.ts"
}
},
"./internal/react-server-client": {
"react-server": {
"module": "./dist/development/index-react-server-client.mjs",
"default": "./dist/development/index-react-server-client.js"
},
"node": {
"types": "./dist/development/index.d.ts",
"module": "./dist/development/index.mjs",
"module-sync": "./dist/development/index.mjs",
"default": "./dist/development/index.js"
},
"module": {
"types": "./dist/development/index.d.mts",
"default": "./dist/development/index.mjs"
},
"import": {
"types": "./dist/development/index.d.mts",
"default": "./dist/development/index.mjs"
},
"default": {
"types": "./dist/development/index.d.ts",
"default": "./dist/development/index.js"
}
},
"./package.json": "./package.json"
},
"wireit": {
"build": {
"command": "premove dist && tsup && tsup --config tsup.config.rsc.ts",
"files": [
"lib/**",
"*.ts",
"tsconfig.json",
"package.json"
],
"output": [
"dist/**"
]
}
},
"dependencies": {
"cookie": "^1.0.1",
"set-cookie-parser": "^2.6.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0",
"@testing-library/user-event": "^14.6.1",
"@types/set-cookie-parser": "^2.4.1",
"jest-environment-jsdom": "^29.6.2",
"premove": "^4.0.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-test-renderer": "^19.1.0",
"tsup": "^8.3.0",
"typescript": "^5.1.6",
"undici": "^6.19.2",
"wireit": "0.14.9"
},
"peerDependencies": {
"react": ">=18",
"react-dom": ">=18"
},
"peerDependenciesMeta": {
"react-dom": {
"optional": true
}
},
"files": [
"dist/",
"CHANGELOG.md",
"LICENSE.md",
"README.md"
],
"engines": {
"node": ">=20.0.0"
},
"scripts": {
"build": "wireit",
"watch": "tsup --watch & tsup --config tsup.config.rsc.ts --watch",
"typecheck": "tsc"
}
}

21
node_modules/set-cookie-parser/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Nathan Friedly <nathan@nfriedly.com> (http://nfriedly.com/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

202
node_modules/set-cookie-parser/README.md generated vendored Normal file
View File

@ -0,0 +1,202 @@
# set-cookie-parser
[![Node.js CI](https://github.com/nfriedly/set-cookie-parser/actions/workflows/node.js.yml/badge.svg)](https://github.com/nfriedly/set-cookie-parser/actions/workflows/node.js.yml)
[![NPM version][npm-image]][npm-url]
[![npm downloads](https://img.shields.io/npm/dm/set-cookie-parser)][npm-url]
---
**Note for current users:** I'm considering some changes for the next major version and would appreciate your feedback: https://github.com/nfriedly/set-cookie-parser/discussions/68
---
Parses set-cookie headers into JavaScript objects
Accepts a single `set-cookie` header value, an array of `set-cookie` header values, a Node.js response object, or a `fetch()` `Response` object that may have 0 or more `set-cookie` headers.
Also accepts an optional options object. Defaults:
```js
{
decodeValues: true, // Calls decodeURIComponent on each value - default: true
map: false, // Return an object instead of an array - default: false
silent: false, // Suppress the warning that is logged when called on a request instead of a response - default: false
}
```
Returns either an array of cookie objects or a map of name => cookie object with `{map: true}`. Each cookie object will have, at a minimum `name` and `value` properties, and may have additional properties depending on the set-cookie header:
* `name` - cookie name (string)
* `value` - cookie value (string)
* `path` - URL path to limit the scope to (string or undefined)
* `domain` - domain to expand the scope to (string or undefined, may begin with "." to indicate the named domain or any subdomain of it)
* `expires` - absolute expiration date for the cookie (Date object or undefined)
* `maxAge` - relative expiration time of the cookie in seconds from when the client receives it (integer or undefined)
* Note: when using with [express's res.cookie() method](http://expressjs.com/en/4x/api.html#res.cookie), multiply `maxAge` by 1000 to convert to milliseconds.
* `secure` - indicates cookie should only be sent over HTTPs (true or undefined)
* `httpOnly` - indicates cookie should *not* be accessible to client-side JavaScript (true or undefined)
* `sameSite` - indicates if cookie should be included in cross-site requests ([more info](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value)) (string or undefined)
* Note: valid values are `"Strict"`, `"Lax"`, and `"None"`, but set-cookie-parser coppies the value verbatim and does *not* perform any validation.
* `partitioned` - indicates cookie should be scoped to the combination of 3rd party domain + top page domain ([more info](https://developer.mozilla.org/en-US/docs/Web/Privacy/Privacy_sandbox/Partitioned_cookies)) (true or undefined)
(The output format is loosely based on the input format of https://www.npmjs.com/package/cookie)
## Install
```sh
$ npm install --save set-cookie-parser
```
## Usage
### Get array of cookie objects
```js
var http = require('http');
var setCookie = require('set-cookie-parser');
http.get('http://example.com', function(res) {
var cookies = setCookie.parse(res, {
decodeValues: true // default: true
});
cookies.forEach(console.log);
}
```
Example output:
```js
[
{
name: 'bam',
value: 'baz'
},
{
name: 'foo',
value: 'bar',
path: '/',
expires: new Date('Tue Jul 01 2025 06:01:11 GMT-0400 (EDT)'),
maxAge: 1000,
domain: '.example.com',
secure: true,
httpOnly: true,
sameSite: 'lax'
}
]
```
### Get map of cookie objects
```js
var http = require('http');
var setCookie = require('set-cookie-parser');
http.get('http://example.com', function(res) {
var cookies = setCookie.parse(res, {
decodeValues: true, // default: true
map: true // default: false
});
var desiredCookie = cookies['session'];
console.log(desiredCookie);
});
```
Example output:
```js
{
bam: {
name: 'bam',
value: 'baz'
},
foo: {
name: 'foo',
value: 'bar',
path: '/',
expires: new Date('Tue Jul 01 2025 06:01:11 GMT-0400 (EDT)'),
maxAge: 1000,
domain: '.example.com',
secure: true,
httpOnly: true,
sameSite: 'lax'
}
}
```
### Creating a new, modified set-cookie header
This library can be used in conjunction with the [cookie](https://www.npmjs.com/package/cookie) library to modify and replace set-cookie headers:
```js
const libCookie = require('cookie');
const setCookie = require('set-cookie-parser');
function modifySetCookie(res){
// parse the set-cookie headers with this library
let cookies = setCookie.parse(res);
// modify the cookies here
// ...
// create new set-cookie headers using the cookie library
res.headers['set-cookie'] = cookies.map(function(cookie) {
return libCookie.serialize(cookie.name, cookie.value, cookie);
});
}
```
See a real-world example of this in [unblocker](https://github.com/nfriedly/node-unblocker/blob/08a89ec27274b46dcd80d0a324a59406f2bdad3d/lib/cookies.js#L67-L85)
## Usage in React Native (and with some other fetch implementations)
React Native follows the Fetch spec more closely and combines all of the Set-Cookie header values into a single string.
The `splitCookiesString` method reverses this.
```js
var setCookie = require('set-cookie-parser');
var response = fetch(/*...*/);
// This is mainly for React Native; Node.js does not combine set-cookie headers.
var combinedCookieHeader = response.headers.get('Set-Cookie');
var splitCookieHeaders = setCookie.splitCookiesString(combinedCookieHeader)
var cookies = setCookie.parse(splitCookieHeaders);
console.log(cookies); // should be an array of cookies
```
This behavior may become a default part of parse in the next major release, but requires the extra step for now.
Note that the `fetch()` spec now includes a `getSetCookie()` method that provides un-combined `Set-Cookie` headers. This library will automatically use that method if it is present.
## API
### parse(input, [options])
Parses cookies from a string, array of strings, or a http response object.
Always returns an array, regardless of input format. (Unless the `map` option is set, in which case it always returns an object.)
### parseString(individualSetCookieHeader, [options])
Parses a single set-cookie header value string. Options default is `{decodeValues: true}`. Used under-the-hood by `parse()`.
Returns an object.
### splitCookiesString(combinedSetCookieHeader)
It's uncommon, but the HTTP spec does allow for multiple of the same header to have their values combined (comma-separated) into a single header.
This method splits apart a combined header without choking on commas that appear within a cookie's value (or expiration date).
Returns an array of strings that may be passed to `parse()`.
## References
* [RFC 6265: HTTP State Management Mechanism](https://tools.ietf.org/html/rfc6265)
* [draft-ietf-httpbis-rfc6265bis-10](https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html)
## License
MIT © [Nathan Friedly](http://www.nfriedly.com/)
[npm-image]: https://badge.fury.io/js/set-cookie-parser.svg
[npm-url]: https://npmjs.org/package/set-cookie-parser

224
node_modules/set-cookie-parser/lib/set-cookie.js generated vendored Normal file
View File

@ -0,0 +1,224 @@
"use strict";
var defaultParseOptions = {
decodeValues: true,
map: false,
silent: false,
};
function isNonEmptyString(str) {
return typeof str === "string" && !!str.trim();
}
function parseString(setCookieValue, options) {
var parts = setCookieValue.split(";").filter(isNonEmptyString);
var nameValuePairStr = parts.shift();
var parsed = parseNameValuePair(nameValuePairStr);
var name = parsed.name;
var value = parsed.value;
options = options
? Object.assign({}, defaultParseOptions, options)
: defaultParseOptions;
try {
value = options.decodeValues ? decodeURIComponent(value) : value; // decode cookie value
} catch (e) {
console.error(
"set-cookie-parser encountered an error while decoding a cookie with value '" +
value +
"'. Set options.decodeValues to false to disable this feature.",
e
);
}
var cookie = {
name: name,
value: value,
};
parts.forEach(function (part) {
var sides = part.split("=");
var key = sides.shift().trimLeft().toLowerCase();
var value = sides.join("=");
if (key === "expires") {
cookie.expires = new Date(value);
} else if (key === "max-age") {
cookie.maxAge = parseInt(value, 10);
} else if (key === "secure") {
cookie.secure = true;
} else if (key === "httponly") {
cookie.httpOnly = true;
} else if (key === "samesite") {
cookie.sameSite = value;
} else if (key === "partitioned") {
cookie.partitioned = true;
} else {
cookie[key] = value;
}
});
return cookie;
}
function parseNameValuePair(nameValuePairStr) {
// Parses name-value-pair according to rfc6265bis draft
var name = "";
var value = "";
var nameValueArr = nameValuePairStr.split("=");
if (nameValueArr.length > 1) {
name = nameValueArr.shift();
value = nameValueArr.join("="); // everything after the first =, joined by a "=" if there was more than one part
} else {
value = nameValuePairStr;
}
return { name: name, value: value };
}
function parse(input, options) {
options = options
? Object.assign({}, defaultParseOptions, options)
: defaultParseOptions;
if (!input) {
if (!options.map) {
return [];
} else {
return {};
}
}
if (input.headers) {
if (typeof input.headers.getSetCookie === "function") {
// for fetch responses - they combine headers of the same type in the headers array,
// but getSetCookie returns an uncombined array
input = input.headers.getSetCookie();
} else if (input.headers["set-cookie"]) {
// fast-path for node.js (which automatically normalizes header names to lower-case
input = input.headers["set-cookie"];
} else {
// slow-path for other environments - see #25
var sch =
input.headers[
Object.keys(input.headers).find(function (key) {
return key.toLowerCase() === "set-cookie";
})
];
// warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36
if (!sch && input.headers.cookie && !options.silent) {
console.warn(
"Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
);
}
input = sch;
}
}
if (!Array.isArray(input)) {
input = [input];
}
if (!options.map) {
return input.filter(isNonEmptyString).map(function (str) {
return parseString(str, options);
});
} else {
var cookies = {};
return input.filter(isNonEmptyString).reduce(function (cookies, str) {
var cookie = parseString(str, options);
cookies[cookie.name] = cookie;
return cookies;
}, cookies);
}
}
/*
Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas
that are within a single set-cookie field-value, such as in the Expires portion.
This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2
Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128
React Native's fetch does this for *every* header, including set-cookie.
Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25
Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation
*/
function splitCookiesString(cookiesString) {
if (Array.isArray(cookiesString)) {
return cookiesString;
}
if (typeof cookiesString !== "string") {
return [];
}
var cookiesStrings = [];
var pos = 0;
var start;
var ch;
var lastComma;
var nextStart;
var cookiesSeparatorFound;
function skipWhitespace() {
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
pos += 1;
}
return pos < cookiesString.length;
}
function notSpecialChar() {
ch = cookiesString.charAt(pos);
return ch !== "=" && ch !== ";" && ch !== ",";
}
while (pos < cookiesString.length) {
start = pos;
cookiesSeparatorFound = false;
while (skipWhitespace()) {
ch = cookiesString.charAt(pos);
if (ch === ",") {
// ',' is a cookie separator if we have later first '=', not ';' or ','
lastComma = pos;
pos += 1;
skipWhitespace();
nextStart = pos;
while (pos < cookiesString.length && notSpecialChar()) {
pos += 1;
}
// currently special character
if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
// we found cookies separator
cookiesSeparatorFound = true;
// pos is inside the next cookie, so back up and return it.
pos = nextStart;
cookiesStrings.push(cookiesString.substring(start, lastComma));
start = pos;
} else {
// in param ',' or param separator ';',
// we continue from that comma
pos = lastComma + 1;
}
} else {
pos += 1;
}
}
if (!cookiesSeparatorFound || pos >= cookiesString.length) {
cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
}
}
return cookiesStrings;
}
module.exports = parse;
module.exports.parse = parse;
module.exports.parseString = parseString;
module.exports.splitCookiesString = splitCookiesString;

45
node_modules/set-cookie-parser/package.json generated vendored Normal file
View File

@ -0,0 +1,45 @@
{
"name": "set-cookie-parser",
"version": "2.7.1",
"description": "Parses set-cookie headers into objects",
"homepage": "https://github.com/nfriedly/set-cookie-parser",
"repository": "nfriedly/set-cookie-parser",
"author": {
"name": "Nathan Friedly",
"url": "http://nfriedly.com/"
},
"files": [
"lib"
],
"main": "./lib/set-cookie.js",
"sideEffects": false,
"keywords": [
"set-cookie",
"set",
"cookie",
"cookies",
"header",
"parse",
"parser"
],
"devDependencies": {
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"husky": "^9.0.11",
"mocha": "^10.3.0",
"prettier": "^3.2.5",
"pretty-quick": "^4.0.0",
"sinon": "^17.0.1"
},
"scripts": {
"lint": "eslint . --ignore-pattern '!.eslintrc.js'",
"test": "npm run lint && mocha",
"autofix": "npm run lint -- --fix",
"precommit": "npm test"
},
"license": "MIT",
"prettier": {
"trailingComma": "es5"
}
}

56
package-lock.json generated
View File

@ -7,7 +7,17 @@
"": {
"dependencies": {
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"react-router-dom": "^7.7.1"
}
},
"node_modules/cookie": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-1.0.2.tgz",
"integrity": "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==",
"license": "MIT",
"engines": {
"node": ">=18"
}
},
"node_modules/react": {
@ -31,11 +41,55 @@
"react": "^19.1.0"
}
},
"node_modules/react-router": {
"version": "7.7.1",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.7.1.tgz",
"integrity": "sha512-jVKHXoWRIsD/qS6lvGveckwb862EekvapdHJN/cGmzw40KnJH5gg53ujOJ4qX6EKIK9LSBfFed/xiQ5yeXNrUA==",
"license": "MIT",
"dependencies": {
"cookie": "^1.0.1",
"set-cookie-parser": "^2.6.0"
},
"engines": {
"node": ">=20.0.0"
},
"peerDependencies": {
"react": ">=18",
"react-dom": ">=18"
},
"peerDependenciesMeta": {
"react-dom": {
"optional": true
}
}
},
"node_modules/react-router-dom": {
"version": "7.7.1",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.7.1.tgz",
"integrity": "sha512-bavdk2BA5r3MYalGKZ01u8PGuDBloQmzpBZVhDLrOOv1N943Wq6dcM9GhB3x8b7AbqPMEezauv4PeGkAJfy7FQ==",
"license": "MIT",
"dependencies": {
"react-router": "7.7.1"
},
"engines": {
"node": ">=20.0.0"
},
"peerDependencies": {
"react": ">=18",
"react-dom": ">=18"
}
},
"node_modules/scheduler": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.26.0.tgz",
"integrity": "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA==",
"license": "MIT"
},
"node_modules/set-cookie-parser": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz",
"integrity": "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==",
"license": "MIT"
}
}
}

View File

@ -1,6 +1,7 @@
{
"dependencies": {
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"react-router-dom": "^7.7.1"
}
}