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

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,164 @@
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
+ unstable_optimizeDeps: boolean;
41
+ }
42
+ type BuildManifest = DefaultBuildManifest | ServerBundlesBuildManifest;
43
+ type BuildEndHook = (args: {
44
+ buildManifest: BuildManifest | undefined;
45
+ reactRouterConfig: ResolvedReactRouterConfig;
46
+ viteConfig: Vite.ResolvedConfig;
47
+ }) => void | Promise<void>;
48
+ type ReactRouterConfig = {
49
+ /**
50
+ * The path to the `app` directory, relative to the root directory. Defaults
51
+ * to `"app"`.
52
+ */
53
+ appDirectory?: string;
54
+ /**
55
+ * The output format of the server build. Defaults to "esm".
56
+ */
57
+ serverModuleFormat?: ServerModuleFormat;
58
+ /**
59
+ * Enabled future flags
60
+ */
61
+ future?: [keyof FutureConfig] extends [never] ? {
62
+ [key: string]: never;
63
+ } : Partial<FutureConfig>;
64
+ /**
65
+ * The React Router app basename. Defaults to `"/"`.
66
+ */
67
+ basename?: string;
68
+ /**
69
+ * The path to the build directory, relative to the project. Defaults to
70
+ * `"build"`.
71
+ */
72
+ buildDirectory?: string;
73
+ /**
74
+ * A function that is called after the full React Router build is complete.
75
+ */
76
+ buildEnd?: BuildEndHook;
77
+ /**
78
+ * An array of URLs to prerender to HTML files at build time. Can also be a
79
+ * function returning an array to dynamically generate URLs.
80
+ */
81
+ prerender?: boolean | Array<string> | ((args: {
82
+ getStaticPaths: () => string[];
83
+ }) => Array<string> | Promise<Array<string>>);
84
+ /**
85
+ * An array of React Router plugin config presets to ease integration with
86
+ * other platforms and tools.
87
+ */
88
+ presets?: Array<Preset>;
89
+ /**
90
+ * The file name of the server build output. This file
91
+ * should end in a `.js` extension and should be deployed to your server.
92
+ * Defaults to `"index.js"`.
93
+ */
94
+ serverBuildFile?: string;
95
+ /**
96
+ * A function for assigning routes to different server bundles. This
97
+ * function should return a server bundle ID which will be used as the
98
+ * bundle's directory name within the server build directory.
99
+ */
100
+ serverBundles?: ServerBundlesFunction;
101
+ /**
102
+ * Enable server-side rendering for your application. Disable to use "SPA
103
+ * Mode", which will request the `/` path at build-time and save it as an
104
+ * `index.html` file with your assets so your application can be deployed as a
105
+ * SPA without server-rendering. Default's to `true`.
106
+ */
107
+ ssr?: boolean;
108
+ };
109
+ type ResolvedReactRouterConfig = Readonly<{
110
+ /**
111
+ * The absolute path to the application source directory.
112
+ */
113
+ appDirectory: string;
114
+ /**
115
+ * The React Router app basename. Defaults to `"/"`.
116
+ */
117
+ basename: string;
118
+ /**
119
+ * The absolute path to the build directory.
120
+ */
121
+ buildDirectory: string;
122
+ /**
123
+ * A function that is called after the full React Router build is complete.
124
+ */
125
+ buildEnd?: BuildEndHook;
126
+ /**
127
+ * Enabled future flags
128
+ */
129
+ future: FutureConfig;
130
+ /**
131
+ * An array of URLs to prerender to HTML files at build time. Can also be a
132
+ * function returning an array to dynamically generate URLs.
133
+ */
134
+ prerender: ReactRouterConfig["prerender"];
135
+ /**
136
+ * An object of all available routes, keyed by route id.
137
+ */
138
+ routes: RouteManifest;
139
+ /**
140
+ * The file name of the server build output. This file
141
+ * should end in a `.js` extension and should be deployed to your server.
142
+ * Defaults to `"index.js"`.
143
+ */
144
+ serverBuildFile: string;
145
+ /**
146
+ * A function for assigning routes to different server bundles. This
147
+ * function should return a server bundle ID which will be used as the
148
+ * bundle's directory name within the server build directory.
149
+ */
150
+ serverBundles?: ServerBundlesFunction;
151
+ /**
152
+ * The output format of the server build. Defaults to "esm".
153
+ */
154
+ serverModuleFormat: ServerModuleFormat;
155
+ /**
156
+ * Enable server-side rendering for your application. Disable to use "SPA
157
+ * Mode", which will request the `/` path at build-time and save it as an
158
+ * `index.html` file with your assets so your application can be deployed as a
159
+ * SPA without server-rendering. Default's to `true`.
160
+ */
161
+ ssr: boolean;
162
+ }>;
163
+
164
+ export type { BuildManifest, ReactRouterConfig as Config, Preset, ServerBundlesFunction };
package/dist/config.js ADDED
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @react-router/dev v7.0.0
3
+ *
4
+ * Copyright (c) Remix Software Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ "use strict";
12
+ var __defProp = Object.defineProperty;
13
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
14
+ var __getOwnPropNames = Object.getOwnPropertyNames;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+
26
+ // config.ts
27
+ var config_exports = {};
28
+ module.exports = __toCommonJS(config_exports);
package/dist/routes.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v7.0.0-pre.5
2
+ * @react-router/dev v7.0.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -44,13 +44,13 @@ __export(routes_exports, {
44
44
  index: () => index,
45
45
  layout: () => layout,
46
46
  prefix: () => prefix,
47
- relative: () => relative,
47
+ relative: () => relative2,
48
48
  route: () => route
49
49
  });
50
50
  module.exports = __toCommonJS(routes_exports);
51
51
 
52
52
  // config/routes.ts
53
- var import_node_path = require("path");
53
+ var Path = __toESM(require("pathe"));
54
54
  var v = __toESM(require("valibot"));
55
55
  var import_pick = __toESM(require("lodash/pick"));
56
56
 
@@ -141,7 +141,7 @@ function prefix(prefixPath, routes) {
141
141
  return route2;
142
142
  });
143
143
  }
144
- function relative(directory) {
144
+ function relative2(directory) {
145
145
  return {
146
146
  /**
147
147
  * Helper function for creating a route config entry, for use within
@@ -150,7 +150,7 @@ function relative(directory) {
150
150
  * `relative` call that created this helper.
151
151
  */
152
152
  route: (path, file, ...rest) => {
153
- return route(path, (0, import_node_path.resolve)(directory, file), ...rest);
153
+ return route(path, Path.resolve(directory, file), ...rest);
154
154
  },
155
155
  /**
156
156
  * Helper function for creating a route config entry for an index route, for
@@ -159,7 +159,7 @@ function relative(directory) {
159
159
  * `relative` call that created this helper.
160
160
  */
161
161
  index: (file, ...rest) => {
162
- return index((0, import_node_path.resolve)(directory, file), ...rest);
162
+ return index(Path.resolve(directory, file), ...rest);
163
163
  },
164
164
  /**
165
165
  * Helper function for creating a route config entry for a layout route, for
@@ -168,7 +168,7 @@ function relative(directory) {
168
168
  * `relative` call that created this helper.
169
169
  */
170
170
  layout: (file, ...rest) => {
171
- return layout((0, import_node_path.resolve)(directory, file), ...rest);
171
+ return layout(Path.resolve(directory, file), ...rest);
172
172
  },
173
173
  // Passthrough of helper functions that don't need relative scoping so that
174
174
  // a complete API is still provided.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v7.0.0-pre.5
2
+ * @react-router/dev v7.0.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/vite.d.ts CHANGED
@@ -1,169 +1,11 @@
1
1
  import * as Vite from 'vite';
2
- import { R as RouteManifest, a as RouteManifestEntry } from './routes-C14jcF98.js';
2
+ import './routes-C14jcF98.js';
3
3
  import 'valibot';
4
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[];
5
+ type ReactRouterVitePlugin = () => Vite.Plugin[];
164
6
  /**
165
7
  * React Router [Vite plugin.](https://vitejs.dev/guide/using-plugins.html)
166
8
  */
167
9
  declare const reactRouterVitePlugin: ReactRouterVitePlugin;
168
10
 
169
- export { type BuildManifest, type Preset, type ReactRouterConfig, type ServerBundlesFunction, reactRouterVitePlugin as reactRouter };
11
+ export { reactRouterVitePlugin as reactRouter };