@react-router/dev 7.0.0-pre.3 → 7.0.0-pre.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/cli/index.js +5 -159
- package/dist/routes-C14jcF98.d.ts +123 -0
- package/dist/routes.d.ts +2 -4
- package/dist/routes.js +1 -1
- package/dist/typescript/plugin.js +6 -6
- package/dist/vite/cloudflare.d.ts +23 -1
- package/dist/vite/cloudflare.js +1 -1
- package/dist/vite.d.ts +169 -2
- package/dist/vite.js +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v7.0.0-pre.
|
|
2
|
+
* @react-router/dev v7.0.0-pre.4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -18,9 +18,6 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
18
18
|
var __esm = (fn, res) => function __init() {
|
|
19
19
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
20
20
|
};
|
|
21
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
22
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
23
|
-
};
|
|
24
21
|
var __export = (target, all) => {
|
|
25
22
|
for (var name in all)
|
|
26
23
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -278,9 +275,9 @@ async function loadPluginContext({
|
|
|
278
275
|
}
|
|
279
276
|
return ctx;
|
|
280
277
|
}
|
|
281
|
-
function findConfig(dir,
|
|
278
|
+
function findConfig(dir, basename3, extensions) {
|
|
282
279
|
for (let ext of extensions) {
|
|
283
|
-
let name =
|
|
280
|
+
let name = basename3 + ext;
|
|
284
281
|
let file = path4.join(dir, name);
|
|
285
282
|
if (fse2.existsSync(file)) return file;
|
|
286
283
|
}
|
|
@@ -694,157 +691,6 @@ var init_dev = __esm({
|
|
|
694
691
|
}
|
|
695
692
|
});
|
|
696
693
|
|
|
697
|
-
// package.json
|
|
698
|
-
var require_package = __commonJS({
|
|
699
|
-
"package.json"(exports2, module2) {
|
|
700
|
-
module2.exports = {
|
|
701
|
-
name: "@react-router/dev",
|
|
702
|
-
version: "7.0.0-pre.3",
|
|
703
|
-
description: "Dev tools and CLI for React Router",
|
|
704
|
-
homepage: "https://reactrouter.com",
|
|
705
|
-
bugs: {
|
|
706
|
-
url: "https://github.com/remix-run/react-router/issues"
|
|
707
|
-
},
|
|
708
|
-
repository: {
|
|
709
|
-
type: "git",
|
|
710
|
-
url: "https://github.com/remix-run/react-router",
|
|
711
|
-
directory: "packages/react-router-dev"
|
|
712
|
-
},
|
|
713
|
-
license: "MIT",
|
|
714
|
-
main: "./dist/typescript/plugin.ts",
|
|
715
|
-
exports: {
|
|
716
|
-
"./routes": {
|
|
717
|
-
types: "./dist/routes.d.ts",
|
|
718
|
-
default: "./dist/routes.js"
|
|
719
|
-
},
|
|
720
|
-
"./vite": {
|
|
721
|
-
types: "./dist/vite.d.ts",
|
|
722
|
-
default: "./dist/vite.js"
|
|
723
|
-
},
|
|
724
|
-
"./vite/cloudflare": {
|
|
725
|
-
types: "./dist/vite/cloudflare.d.ts",
|
|
726
|
-
default: "./dist/vite/cloudflare.js"
|
|
727
|
-
},
|
|
728
|
-
"./package.json": "./package.json"
|
|
729
|
-
},
|
|
730
|
-
bin: {
|
|
731
|
-
"react-router": "bin.js"
|
|
732
|
-
},
|
|
733
|
-
scripts: {
|
|
734
|
-
build: "wireit"
|
|
735
|
-
},
|
|
736
|
-
wireit: {
|
|
737
|
-
build: {
|
|
738
|
-
command: "tsup",
|
|
739
|
-
files: [
|
|
740
|
-
"cli/**",
|
|
741
|
-
"config/**",
|
|
742
|
-
"typescript/**",
|
|
743
|
-
"vite/**",
|
|
744
|
-
"*.ts",
|
|
745
|
-
"bin.js",
|
|
746
|
-
"tsconfig.json",
|
|
747
|
-
"package.json"
|
|
748
|
-
],
|
|
749
|
-
output: [
|
|
750
|
-
"dist/**"
|
|
751
|
-
]
|
|
752
|
-
}
|
|
753
|
-
},
|
|
754
|
-
dependencies: {
|
|
755
|
-
"@babel/core": "^7.21.8",
|
|
756
|
-
"@babel/generator": "^7.21.5",
|
|
757
|
-
"@babel/parser": "^7.21.8",
|
|
758
|
-
"@babel/plugin-syntax-decorators": "^7.22.10",
|
|
759
|
-
"@babel/plugin-syntax-jsx": "^7.21.4",
|
|
760
|
-
"@babel/preset-typescript": "^7.21.5",
|
|
761
|
-
"@babel/traverse": "^7.23.2",
|
|
762
|
-
"@babel/types": "^7.22.5",
|
|
763
|
-
"@npmcli/package-json": "^4.0.1",
|
|
764
|
-
"@react-router/node": "workspace:*",
|
|
765
|
-
arg: "^5.0.1",
|
|
766
|
-
"babel-dead-code-elimination": "^1.0.6",
|
|
767
|
-
chalk: "^4.1.2",
|
|
768
|
-
chokidar: "^4.0.0",
|
|
769
|
-
dedent: "^1.5.3",
|
|
770
|
-
"es-module-lexer": "^1.3.1",
|
|
771
|
-
"exit-hook": "2.2.1",
|
|
772
|
-
"fs-extra": "^10.0.0",
|
|
773
|
-
"gunzip-maybe": "^1.4.2",
|
|
774
|
-
jsesc: "3.0.2",
|
|
775
|
-
lodash: "^4.17.21",
|
|
776
|
-
pathe: "^1.1.2",
|
|
777
|
-
picocolors: "^1.0.0",
|
|
778
|
-
picomatch: "^2.3.1",
|
|
779
|
-
prettier: "^2.7.1",
|
|
780
|
-
"react-refresh": "^0.14.0",
|
|
781
|
-
semver: "^7.3.7",
|
|
782
|
-
"set-cookie-parser": "^2.6.0",
|
|
783
|
-
valibot: "^0.41.0",
|
|
784
|
-
"vite-node": "^1.6.0"
|
|
785
|
-
},
|
|
786
|
-
devDependencies: {
|
|
787
|
-
"@react-router/serve": "workspace:*",
|
|
788
|
-
"@types/babel__core": "^7.20.5",
|
|
789
|
-
"@types/babel__generator": "^7.6.8",
|
|
790
|
-
"@types/babel__traverse": "^7.20.5",
|
|
791
|
-
"@types/dedent": "^0.7.0",
|
|
792
|
-
"@types/express": "^4.17.9",
|
|
793
|
-
"@types/fs-extra": "^8.1.2",
|
|
794
|
-
"@types/gunzip-maybe": "^1.4.0",
|
|
795
|
-
"@types/jsesc": "^3.0.1",
|
|
796
|
-
"@types/lodash": "^4.14.182",
|
|
797
|
-
"@types/node": "^18.17.1",
|
|
798
|
-
"@types/npmcli__package-json": "^4.0.0",
|
|
799
|
-
"@types/picomatch": "^2.3.0",
|
|
800
|
-
"@types/prettier": "^2.7.3",
|
|
801
|
-
"@types/set-cookie-parser": "^2.4.1",
|
|
802
|
-
dotenv: "^16.0.0",
|
|
803
|
-
"esbuild-register": "^3.3.2",
|
|
804
|
-
execa: "5.1.1",
|
|
805
|
-
express: "^4.19.2",
|
|
806
|
-
"fast-glob": "3.2.11",
|
|
807
|
-
"react-router": "workspace:^",
|
|
808
|
-
"strip-ansi": "^6.0.1",
|
|
809
|
-
"tiny-invariant": "^1.2.0",
|
|
810
|
-
tsup: "^8.3.0",
|
|
811
|
-
typescript: "^5.1.6",
|
|
812
|
-
vite: "^5.1.0",
|
|
813
|
-
wireit: "0.14.9",
|
|
814
|
-
wrangler: "^3.28.2"
|
|
815
|
-
},
|
|
816
|
-
peerDependencies: {
|
|
817
|
-
"@react-router/serve": "workspace:^",
|
|
818
|
-
"react-router": "workspace:^",
|
|
819
|
-
typescript: "^5.1.0",
|
|
820
|
-
vite: "^5.1.0",
|
|
821
|
-
wrangler: "^3.28.2"
|
|
822
|
-
},
|
|
823
|
-
peerDependenciesMeta: {
|
|
824
|
-
"@react-router/serve": {
|
|
825
|
-
optional: true
|
|
826
|
-
},
|
|
827
|
-
typescript: {
|
|
828
|
-
optional: true
|
|
829
|
-
},
|
|
830
|
-
wrangler: {
|
|
831
|
-
optional: true
|
|
832
|
-
}
|
|
833
|
-
},
|
|
834
|
-
engines: {
|
|
835
|
-
node: ">=20.0.0"
|
|
836
|
-
},
|
|
837
|
-
files: [
|
|
838
|
-
"dist/",
|
|
839
|
-
"bin.js",
|
|
840
|
-
"CHANGELOG.md",
|
|
841
|
-
"LICENSE.md",
|
|
842
|
-
"README.md"
|
|
843
|
-
]
|
|
844
|
-
};
|
|
845
|
-
}
|
|
846
|
-
});
|
|
847
|
-
|
|
848
694
|
// cli/run.ts
|
|
849
695
|
var import_arg = __toESM(require("arg"));
|
|
850
696
|
var import_semver = __toESM(require("semver"));
|
|
@@ -973,7 +819,7 @@ function getDirectory(ctx) {
|
|
|
973
819
|
function getPath(ctx, route) {
|
|
974
820
|
return Path.join(
|
|
975
821
|
getDirectory(ctx),
|
|
976
|
-
|
|
822
|
+
Path.basename(ctx.appDirectory),
|
|
977
823
|
Path.dirname(route.file),
|
|
978
824
|
"+types." + Pathe.filename(route.file) + ".d.ts"
|
|
979
825
|
);
|
|
@@ -1321,7 +1167,7 @@ async function run(argv = process.argv.slice(2)) {
|
|
|
1321
1167
|
return;
|
|
1322
1168
|
}
|
|
1323
1169
|
if (flags.version) {
|
|
1324
|
-
let version =
|
|
1170
|
+
let version = require("../package.json").version;
|
|
1325
1171
|
console.log(version);
|
|
1326
1172
|
return;
|
|
1327
1173
|
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
var __reactRouterAppDirectory: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Provides the absolute path to the app directory, for use within `routes.ts`.
|
|
8
|
+
* This is designed to support resolving file system routes.
|
|
9
|
+
*/
|
|
10
|
+
declare function getAppDirectory(): string;
|
|
11
|
+
interface RouteManifestEntry {
|
|
12
|
+
/**
|
|
13
|
+
* The path this route uses to match on the URL pathname.
|
|
14
|
+
*/
|
|
15
|
+
path?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Should be `true` if it is an index route. This disallows child routes.
|
|
18
|
+
*/
|
|
19
|
+
index?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Should be `true` if the `path` is case-sensitive. Defaults to `false`.
|
|
22
|
+
*/
|
|
23
|
+
caseSensitive?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The unique id for this route, named like its `file` but without the
|
|
26
|
+
* extension. So `app/routes/gists/$username.tsx` will have an `id` of
|
|
27
|
+
* `routes/gists/$username`.
|
|
28
|
+
*/
|
|
29
|
+
id: string;
|
|
30
|
+
/**
|
|
31
|
+
* The unique `id` for this route's parent route, if there is one.
|
|
32
|
+
*/
|
|
33
|
+
parentId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The path to the entry point for this route, relative to
|
|
36
|
+
* `config.appDirectory`.
|
|
37
|
+
*/
|
|
38
|
+
file: string;
|
|
39
|
+
}
|
|
40
|
+
interface RouteManifest {
|
|
41
|
+
[routeId: string]: RouteManifestEntry;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Configuration for an individual route, for use within `routes.ts`. As a
|
|
45
|
+
* convenience, route config entries can be created with the {@link route},
|
|
46
|
+
* {@link index} and {@link layout} helper functions.
|
|
47
|
+
*/
|
|
48
|
+
interface RouteConfigEntry {
|
|
49
|
+
/**
|
|
50
|
+
* The unique id for this route.
|
|
51
|
+
*/
|
|
52
|
+
id?: string;
|
|
53
|
+
/**
|
|
54
|
+
* The path this route uses to match on the URL pathname.
|
|
55
|
+
*/
|
|
56
|
+
path?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Should be `true` if it is an index route. This disallows child routes.
|
|
59
|
+
*/
|
|
60
|
+
index?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Should be `true` if the `path` is case-sensitive. Defaults to `false`.
|
|
63
|
+
*/
|
|
64
|
+
caseSensitive?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* The path to the entry point for this route, relative to
|
|
67
|
+
* `config.appDirectory`.
|
|
68
|
+
*/
|
|
69
|
+
file: string;
|
|
70
|
+
/**
|
|
71
|
+
* The child routes.
|
|
72
|
+
*/
|
|
73
|
+
children?: RouteConfigEntry[];
|
|
74
|
+
}
|
|
75
|
+
declare const resolvedRouteConfigSchema: v.ArraySchema<v.BaseSchema<RouteConfigEntry, any, v.BaseIssue<unknown>>, undefined>;
|
|
76
|
+
type ResolvedRouteConfig = v.InferInput<typeof resolvedRouteConfigSchema>;
|
|
77
|
+
/**
|
|
78
|
+
* Route config to be exported via the `routes` export within `routes.ts`.
|
|
79
|
+
*/
|
|
80
|
+
type RouteConfig = ResolvedRouteConfig | Promise<ResolvedRouteConfig>;
|
|
81
|
+
declare const createConfigRouteOptionKeys: ["id", "index", "caseSensitive"];
|
|
82
|
+
type CreateRouteOptions = Pick<RouteConfigEntry, (typeof createConfigRouteOptionKeys)[number]>;
|
|
83
|
+
/**
|
|
84
|
+
* Helper function for creating a route config entry, for use within
|
|
85
|
+
* `routes.ts`.
|
|
86
|
+
*/
|
|
87
|
+
declare function route(path: string | null | undefined, file: string, children?: RouteConfigEntry[]): RouteConfigEntry;
|
|
88
|
+
declare function route(path: string | null | undefined, file: string, options: CreateRouteOptions, children?: RouteConfigEntry[]): RouteConfigEntry;
|
|
89
|
+
declare const createIndexOptionKeys: ["id"];
|
|
90
|
+
type CreateIndexOptions = Pick<RouteConfigEntry, (typeof createIndexOptionKeys)[number]>;
|
|
91
|
+
/**
|
|
92
|
+
* Helper function for creating a route config entry for an index route, for use
|
|
93
|
+
* within `routes.ts`.
|
|
94
|
+
*/
|
|
95
|
+
declare function index(file: string, options?: CreateIndexOptions): RouteConfigEntry;
|
|
96
|
+
declare const createLayoutOptionKeys: ["id"];
|
|
97
|
+
type CreateLayoutOptions = Pick<RouteConfigEntry, (typeof createLayoutOptionKeys)[number]>;
|
|
98
|
+
/**
|
|
99
|
+
* Helper function for creating a route config entry for a layout route, for use
|
|
100
|
+
* within `routes.ts`.
|
|
101
|
+
*/
|
|
102
|
+
declare function layout(file: string, children?: RouteConfigEntry[]): RouteConfigEntry;
|
|
103
|
+
declare function layout(file: string, options: CreateLayoutOptions, children?: RouteConfigEntry[]): RouteConfigEntry;
|
|
104
|
+
/**
|
|
105
|
+
* Helper function for adding a path prefix to a set of routes without needing
|
|
106
|
+
* to introduce a parent route file, for use within `routes.ts`.
|
|
107
|
+
*/
|
|
108
|
+
declare function prefix(prefixPath: string, routes: RouteConfigEntry[]): RouteConfigEntry[];
|
|
109
|
+
declare const helpers: {
|
|
110
|
+
route: typeof route;
|
|
111
|
+
index: typeof index;
|
|
112
|
+
layout: typeof layout;
|
|
113
|
+
prefix: typeof prefix;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Creates a set of route config helpers that resolve file paths relative to the
|
|
118
|
+
* given directory, for use within `routes.ts`. This is designed to support
|
|
119
|
+
* splitting route config into multiple files within different directories.
|
|
120
|
+
*/
|
|
121
|
+
declare function relative(directory: string): typeof helpers;
|
|
122
|
+
|
|
123
|
+
export { type RouteManifest as R, type RouteManifestEntry as a, type RouteConfig as b, type RouteConfigEntry as c, relative as d, getAppDirectory as g, index as i, layout as l, prefix as p, route as r };
|
package/dist/routes.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
export { RouteConfig, RouteConfigEntry, getAppDirectory, index, layout, prefix, relative, route } from './
|
|
2
|
-
import '
|
|
3
|
-
import './vite/plugin.ts';
|
|
4
|
-
import './vite/cloudflare-dev-proxy.ts';
|
|
1
|
+
export { b as RouteConfig, c as RouteConfigEntry, g as getAppDirectory, i as index, l as layout, p as prefix, d as relative, r as route } from './routes-C14jcF98.js';
|
|
2
|
+
import 'valibot';
|
package/dist/routes.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v7.0.0-pre.
|
|
2
|
+
* @react-router/dev v7.0.0-pre.4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -184,9 +184,9 @@ var import_pick2 = __toESM(require("lodash/pick"));
|
|
|
184
184
|
var import_omit = __toESM(require("lodash/omit"));
|
|
185
185
|
var import_package_json = __toESM(require("@npmcli/package-json"));
|
|
186
186
|
var entryExts = [".js", ".jsx", ".ts", ".tsx"];
|
|
187
|
-
function findEntry(dir,
|
|
187
|
+
function findEntry(dir, basename3) {
|
|
188
188
|
for (let ext of entryExts) {
|
|
189
|
-
let file = import_node_path2.default.resolve(dir,
|
|
189
|
+
let file = import_node_path2.default.resolve(dir, basename3 + ext);
|
|
190
190
|
if (import_fs_extra.default.existsSync(file)) return import_node_path2.default.relative(dir, file);
|
|
191
191
|
}
|
|
192
192
|
return void 0;
|
|
@@ -302,9 +302,9 @@ var defaultEntriesDir = path4.resolve(
|
|
|
302
302
|
);
|
|
303
303
|
var defaultEntries = fse2.readdirSync(defaultEntriesDir).map((filename2) => path4.join(defaultEntriesDir, filename2));
|
|
304
304
|
invariant(defaultEntries.length > 0, "No default entries found");
|
|
305
|
-
function findConfig(dir,
|
|
305
|
+
function findConfig(dir, basename3, extensions) {
|
|
306
306
|
for (let ext of extensions) {
|
|
307
|
-
let name =
|
|
307
|
+
let name = basename3 + ext;
|
|
308
308
|
let file = path4.join(dir, name);
|
|
309
309
|
if (fse2.existsSync(file)) return file;
|
|
310
310
|
}
|
|
@@ -353,7 +353,7 @@ function getDirectory(ctx) {
|
|
|
353
353
|
function getPath(ctx, route) {
|
|
354
354
|
return Path.join(
|
|
355
355
|
getDirectory(ctx),
|
|
356
|
-
|
|
356
|
+
Path.basename(ctx.appDirectory),
|
|
357
357
|
Path.dirname(route.file),
|
|
358
358
|
"+types." + Pathe.filename(route.file) + ".d.ts"
|
|
359
359
|
);
|
|
@@ -1 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
import { AppLoadContext } from 'react-router';
|
|
2
|
+
import { Plugin } from 'vite';
|
|
3
|
+
import { GetPlatformProxyOptions, PlatformProxy } from 'wrangler';
|
|
4
|
+
|
|
5
|
+
type CfProperties = Record<string, unknown>;
|
|
6
|
+
type LoadContext<Env, Cf extends CfProperties> = {
|
|
7
|
+
cloudflare: Omit<PlatformProxy<Env, Cf>, "dispose">;
|
|
8
|
+
};
|
|
9
|
+
type GetLoadContext<Env, Cf extends CfProperties> = (args: {
|
|
10
|
+
request: Request;
|
|
11
|
+
context: LoadContext<Env, Cf>;
|
|
12
|
+
}) => AppLoadContext | Promise<AppLoadContext>;
|
|
13
|
+
/**
|
|
14
|
+
* Vite plugin that provides [Node proxies to local workerd
|
|
15
|
+
* bindings](https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy)
|
|
16
|
+
* to `context.cloudflare` in your server loaders and server actions during
|
|
17
|
+
* development.
|
|
18
|
+
*/
|
|
19
|
+
declare const cloudflareDevProxyVitePlugin: <Env, Cf extends CfProperties>(options?: {
|
|
20
|
+
getLoadContext?: GetLoadContext<Env, Cf>;
|
|
21
|
+
} & GetPlatformProxyOptions) => Plugin;
|
|
22
|
+
|
|
23
|
+
export { cloudflareDevProxyVitePlugin as cloudflareDevProxy };
|
package/dist/vite/cloudflare.js
CHANGED
package/dist/vite.d.ts
CHANGED
|
@@ -1,2 +1,169 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as Vite from 'vite';
|
|
2
|
+
import { R as RouteManifest, a as RouteManifestEntry } from './routes-C14jcF98.js';
|
|
3
|
+
import 'valibot';
|
|
4
|
+
|
|
5
|
+
declare const excludedConfigPresetKeys: readonly ["presets"];
|
|
6
|
+
type ExcludedConfigPresetKey = (typeof excludedConfigPresetKeys)[number];
|
|
7
|
+
type ConfigPreset = Omit<ReactRouterConfig, ExcludedConfigPresetKey>;
|
|
8
|
+
type Preset = {
|
|
9
|
+
name: string;
|
|
10
|
+
reactRouterConfig?: (args: {
|
|
11
|
+
reactRouterUserConfig: ReactRouterConfig;
|
|
12
|
+
}) => ConfigPreset | Promise<ConfigPreset>;
|
|
13
|
+
reactRouterConfigResolved?: (args: {
|
|
14
|
+
reactRouterConfig: ResolvedReactRouterConfig;
|
|
15
|
+
}) => void | Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
declare const branchRouteProperties: readonly ["id", "path", "file", "index"];
|
|
18
|
+
type BranchRoute = Pick<RouteManifestEntry, (typeof branchRouteProperties)[number]>;
|
|
19
|
+
type ServerBundlesFunction = (args: {
|
|
20
|
+
branch: BranchRoute[];
|
|
21
|
+
}) => string | Promise<string>;
|
|
22
|
+
type BaseBuildManifest = {
|
|
23
|
+
routes: RouteManifest;
|
|
24
|
+
};
|
|
25
|
+
type DefaultBuildManifest = BaseBuildManifest & {
|
|
26
|
+
serverBundles?: never;
|
|
27
|
+
routeIdToServerBundleId?: never;
|
|
28
|
+
};
|
|
29
|
+
type ServerBundlesBuildManifest = BaseBuildManifest & {
|
|
30
|
+
serverBundles: {
|
|
31
|
+
[serverBundleId: string]: {
|
|
32
|
+
id: string;
|
|
33
|
+
file: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
routeIdToServerBundleId: Record<string, string>;
|
|
37
|
+
};
|
|
38
|
+
type ServerModuleFormat = "esm" | "cjs";
|
|
39
|
+
interface FutureConfig {
|
|
40
|
+
}
|
|
41
|
+
type BuildManifest = DefaultBuildManifest | ServerBundlesBuildManifest;
|
|
42
|
+
type BuildEndHook = (args: {
|
|
43
|
+
buildManifest: BuildManifest | undefined;
|
|
44
|
+
reactRouterConfig: ResolvedReactRouterConfig;
|
|
45
|
+
viteConfig: Vite.ResolvedConfig;
|
|
46
|
+
}) => void | Promise<void>;
|
|
47
|
+
type ReactRouterConfig = {
|
|
48
|
+
/**
|
|
49
|
+
* The path to the `app` directory, relative to `remix.config.js`. Defaults
|
|
50
|
+
* to `"app"`.
|
|
51
|
+
*/
|
|
52
|
+
appDirectory?: string;
|
|
53
|
+
/**
|
|
54
|
+
* The output format of the server build. Defaults to "esm".
|
|
55
|
+
*/
|
|
56
|
+
serverModuleFormat?: ServerModuleFormat;
|
|
57
|
+
/**
|
|
58
|
+
* Enabled future flags
|
|
59
|
+
*/
|
|
60
|
+
future?: [keyof FutureConfig] extends [never] ? {
|
|
61
|
+
[key: string]: never;
|
|
62
|
+
} : Partial<FutureConfig>;
|
|
63
|
+
/**
|
|
64
|
+
* The React Router app basename. Defaults to `"/"`.
|
|
65
|
+
*/
|
|
66
|
+
basename?: string;
|
|
67
|
+
/**
|
|
68
|
+
* The path to the build directory, relative to the project. Defaults to
|
|
69
|
+
* `"build"`.
|
|
70
|
+
*/
|
|
71
|
+
buildDirectory?: string;
|
|
72
|
+
/**
|
|
73
|
+
* A function that is called after the full React Router build is complete.
|
|
74
|
+
*/
|
|
75
|
+
buildEnd?: BuildEndHook;
|
|
76
|
+
/**
|
|
77
|
+
* An array of URLs to prerender to HTML files at build time. Can also be a
|
|
78
|
+
* function returning an array to dynamically generate URLs.
|
|
79
|
+
*/
|
|
80
|
+
prerender?: boolean | Array<string> | ((args: {
|
|
81
|
+
getStaticPaths: () => string[];
|
|
82
|
+
}) => Array<string> | Promise<Array<string>>);
|
|
83
|
+
/**
|
|
84
|
+
* An array of React Router plugin config presets to ease integration with
|
|
85
|
+
* other platforms and tools.
|
|
86
|
+
*/
|
|
87
|
+
presets?: Array<Preset>;
|
|
88
|
+
/**
|
|
89
|
+
* The file name of the server build output. This file
|
|
90
|
+
* should end in a `.js` extension and should be deployed to your server.
|
|
91
|
+
* Defaults to `"index.js"`.
|
|
92
|
+
*/
|
|
93
|
+
serverBuildFile?: string;
|
|
94
|
+
/**
|
|
95
|
+
* A function for assigning routes to different server bundles. This
|
|
96
|
+
* function should return a server bundle ID which will be used as the
|
|
97
|
+
* bundle's directory name within the server build directory.
|
|
98
|
+
*/
|
|
99
|
+
serverBundles?: ServerBundlesFunction;
|
|
100
|
+
/**
|
|
101
|
+
* Enable server-side rendering for your application. Disable to use "SPA
|
|
102
|
+
* Mode", which will request the `/` path at build-time and save it as an
|
|
103
|
+
* `index.html` file with your assets so your application can be deployed as a
|
|
104
|
+
* SPA without server-rendering. Default's to `true`.
|
|
105
|
+
*/
|
|
106
|
+
ssr?: boolean;
|
|
107
|
+
};
|
|
108
|
+
type ResolvedReactRouterConfig = Readonly<{
|
|
109
|
+
/**
|
|
110
|
+
* The absolute path to the application source directory.
|
|
111
|
+
*/
|
|
112
|
+
appDirectory: string;
|
|
113
|
+
/**
|
|
114
|
+
* The React Router app basename. Defaults to `"/"`.
|
|
115
|
+
*/
|
|
116
|
+
basename: string;
|
|
117
|
+
/**
|
|
118
|
+
* The absolute path to the build directory.
|
|
119
|
+
*/
|
|
120
|
+
buildDirectory: string;
|
|
121
|
+
/**
|
|
122
|
+
* A function that is called after the full React Router build is complete.
|
|
123
|
+
*/
|
|
124
|
+
buildEnd?: BuildEndHook;
|
|
125
|
+
/**
|
|
126
|
+
* Enabled future flags
|
|
127
|
+
*/
|
|
128
|
+
future: FutureConfig;
|
|
129
|
+
/**
|
|
130
|
+
* An array of URLs to prerender to HTML files at build time. Can also be a
|
|
131
|
+
* function returning an array to dynamically generate URLs.
|
|
132
|
+
*/
|
|
133
|
+
prerender: ReactRouterConfig["prerender"];
|
|
134
|
+
/**
|
|
135
|
+
* An object of all available routes, keyed by route id.
|
|
136
|
+
*/
|
|
137
|
+
routes: RouteManifest;
|
|
138
|
+
/**
|
|
139
|
+
* The file name of the server build output. This file
|
|
140
|
+
* should end in a `.js` extension and should be deployed to your server.
|
|
141
|
+
* Defaults to `"index.js"`.
|
|
142
|
+
*/
|
|
143
|
+
serverBuildFile: string;
|
|
144
|
+
/**
|
|
145
|
+
* A function for assigning routes to different server bundles. This
|
|
146
|
+
* function should return a server bundle ID which will be used as the
|
|
147
|
+
* bundle's directory name within the server build directory.
|
|
148
|
+
*/
|
|
149
|
+
serverBundles?: ServerBundlesFunction;
|
|
150
|
+
/**
|
|
151
|
+
* The output format of the server build. Defaults to "esm".
|
|
152
|
+
*/
|
|
153
|
+
serverModuleFormat: ServerModuleFormat;
|
|
154
|
+
/**
|
|
155
|
+
* Enable server-side rendering for your application. Disable to use "SPA
|
|
156
|
+
* Mode", which will request the `/` path at build-time and save it as an
|
|
157
|
+
* `index.html` file with your assets so your application can be deployed as a
|
|
158
|
+
* SPA without server-rendering. Default's to `true`.
|
|
159
|
+
*/
|
|
160
|
+
ssr: boolean;
|
|
161
|
+
}>;
|
|
162
|
+
|
|
163
|
+
type ReactRouterVitePlugin = (config?: ReactRouterConfig) => Vite.Plugin[];
|
|
164
|
+
/**
|
|
165
|
+
* React Router [Vite plugin.](https://vitejs.dev/guide/using-plugins.html)
|
|
166
|
+
*/
|
|
167
|
+
declare const reactRouterVitePlugin: ReactRouterVitePlugin;
|
|
168
|
+
|
|
169
|
+
export { type BuildManifest, type Preset, type ReactRouterConfig, type ServerBundlesFunction, reactRouterVitePlugin as reactRouter };
|
package/dist/vite.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-router/dev",
|
|
3
|
-
"version": "7.0.0-pre.
|
|
3
|
+
"version": "7.0.0-pre.4",
|
|
4
4
|
"description": "Dev tools and CLI for React Router",
|
|
5
5
|
"homepage": "https://reactrouter.com",
|
|
6
6
|
"bugs": {
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"set-cookie-parser": "^2.6.0",
|
|
80
80
|
"valibot": "^0.41.0",
|
|
81
81
|
"vite-node": "^1.6.0",
|
|
82
|
-
"@react-router/node": "7.0.0-pre.
|
|
82
|
+
"@react-router/node": "7.0.0-pre.4"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@types/babel__core": "^7.20.5",
|
|
@@ -108,15 +108,15 @@
|
|
|
108
108
|
"vite": "^5.1.0",
|
|
109
109
|
"wireit": "0.14.9",
|
|
110
110
|
"wrangler": "^3.28.2",
|
|
111
|
-
"@react-router/serve": "7.0.0-pre.
|
|
112
|
-
"react-router": "^7.0.0-pre.
|
|
111
|
+
"@react-router/serve": "7.0.0-pre.4",
|
|
112
|
+
"react-router": "^7.0.0-pre.4"
|
|
113
113
|
},
|
|
114
114
|
"peerDependencies": {
|
|
115
115
|
"typescript": "^5.1.0",
|
|
116
116
|
"vite": "^5.1.0",
|
|
117
117
|
"wrangler": "^3.28.2",
|
|
118
|
-
"@react-router/serve": "^7.0.0-pre.
|
|
119
|
-
"react-router": "^7.0.0-pre.
|
|
118
|
+
"@react-router/serve": "^7.0.0-pre.4",
|
|
119
|
+
"react-router": "^7.0.0-pre.4"
|
|
120
120
|
},
|
|
121
121
|
"peerDependenciesMeta": {
|
|
122
122
|
"@react-router/serve": {
|