@react-router/dev 7.0.0-pre.3 → 7.0.0-pre.5

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.
@@ -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 './config/routes.ts';
2
- import './vite/config.ts';
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.3
2
+ * @react-router/dev v7.0.0-pre.5
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1 +1,23 @@
1
- export { cloudflareDevProxyVitePlugin as cloudflareDevProxy } from './cloudflare-dev-proxy.ts';
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 };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v7.0.0-pre.3
2
+ * @react-router/dev v7.0.0-pre.5
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/vite.d.ts CHANGED
@@ -1,2 +1,169 @@
1
- export { BuildManifest, Preset, ReactRouterConfig, ServerBundlesFunction } from './vite/config.ts';
2
- export { reactRouterVitePlugin as reactRouter } from './vite/plugin.ts';
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
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v7.0.0-pre.3
2
+ * @react-router/dev v7.0.0-pre.5
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-router/dev",
3
- "version": "7.0.0-pre.3",
3
+ "version": "7.0.0-pre.5",
4
4
  "description": "Dev tools and CLI for React Router",
5
5
  "homepage": "https://reactrouter.com",
6
6
  "bugs": {
@@ -12,7 +12,6 @@
12
12
  "directory": "packages/react-router-dev"
13
13
  },
14
14
  "license": "MIT",
15
- "main": "./dist/typescript/plugin.ts",
16
15
  "exports": {
17
16
  "./routes": {
18
17
  "types": "./dist/routes.d.ts",
@@ -61,7 +60,6 @@
61
60
  "@npmcli/package-json": "^4.0.1",
62
61
  "arg": "^5.0.1",
63
62
  "babel-dead-code-elimination": "^1.0.6",
64
- "chalk": "^4.1.2",
65
63
  "chokidar": "^4.0.0",
66
64
  "dedent": "^1.5.3",
67
65
  "es-module-lexer": "^1.3.1",
@@ -71,7 +69,7 @@
71
69
  "jsesc": "3.0.2",
72
70
  "lodash": "^4.17.21",
73
71
  "pathe": "^1.1.2",
74
- "picocolors": "^1.0.0",
72
+ "picocolors": "^1.1.1",
75
73
  "picomatch": "^2.3.1",
76
74
  "prettier": "^2.7.1",
77
75
  "react-refresh": "^0.14.0",
@@ -79,7 +77,7 @@
79
77
  "set-cookie-parser": "^2.6.0",
80
78
  "valibot": "^0.41.0",
81
79
  "vite-node": "^1.6.0",
82
- "@react-router/node": "7.0.0-pre.3"
80
+ "@react-router/node": "7.0.0-pre.5"
83
81
  },
84
82
  "devDependencies": {
85
83
  "@types/babel__core": "^7.20.5",
@@ -108,15 +106,15 @@
108
106
  "vite": "^5.1.0",
109
107
  "wireit": "0.14.9",
110
108
  "wrangler": "^3.28.2",
111
- "@react-router/serve": "7.0.0-pre.3",
112
- "react-router": "^7.0.0-pre.3"
109
+ "@react-router/serve": "7.0.0-pre.5",
110
+ "react-router": "^7.0.0-pre.5"
113
111
  },
114
112
  "peerDependencies": {
115
113
  "typescript": "^5.1.0",
116
114
  "vite": "^5.1.0",
117
115
  "wrangler": "^3.28.2",
118
- "@react-router/serve": "^7.0.0-pre.3",
119
- "react-router": "^7.0.0-pre.3"
116
+ "@react-router/serve": "^7.0.0-pre.5",
117
+ "react-router": "^7.0.0-pre.5"
120
118
  },
121
119
  "peerDependenciesMeta": {
122
120
  "@react-router/serve": {
@@ -1,7 +0,0 @@
1
- import ts from 'typescript/lib/tsserverlibrary';
2
-
3
- declare function init(): {
4
- create: (info: ts.server.PluginCreateInfo) => ts.LanguageService;
5
- };
6
-
7
- export { init as default };