@react-router/dev 0.0.0-experimental-7b411a741 → 0.0.0-experimental-79e23be50

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/dist/config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-7b411a741
2
+ * @react-router/dev v0.0.0-experimental-79e23be50
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -15,29 +15,202 @@ Object.defineProperty(exports, '__esModule', { value: true });
15
15
  var node_child_process = require('node:child_process');
16
16
  var path = require('node:path');
17
17
  var fse = require('fs-extra');
18
+ var colors = require('picocolors');
19
+ var pick = require('lodash/pick');
20
+ var omit = require('lodash/omit');
18
21
  var PackageJson = require('@npmcli/package-json');
19
22
  var routes = require('./config/routes.js');
20
- var serverModes = require('./config/serverModes.js');
21
- var flatRoutes = require('./config/flat-routes.js');
23
+ var flatRoutes = require('./config/flatRoutes.js');
22
24
  var detectPackageManager = require('./cli/detectPackageManager.js');
23
25
 
24
26
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
25
27
 
26
28
  var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
27
29
  var fse__default = /*#__PURE__*/_interopDefaultLegacy(fse);
30
+ var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
31
+ var pick__default = /*#__PURE__*/_interopDefaultLegacy(pick);
32
+ var omit__default = /*#__PURE__*/_interopDefaultLegacy(omit);
28
33
  var PackageJson__default = /*#__PURE__*/_interopDefaultLegacy(PackageJson);
29
34
 
30
- async function resolveConfig(appConfig, {
35
+ const excludedConfigPresetKeys = ["presets"];
36
+ // Only expose a subset of route properties to the "serverBundles" function
37
+ const branchRouteProperties = ["id", "path", "file", "index"];
38
+ const configRouteToBranchRoute = configRoute => pick__default["default"](configRoute, branchRouteProperties);
39
+ let mergeReactRouterConfig = (...configs) => {
40
+ let reducer = (configA, configB) => {
41
+ let mergeRequired = key => configA[key] !== undefined && configB[key] !== undefined;
42
+ return {
43
+ ...configA,
44
+ ...configB,
45
+ ...(mergeRequired("buildEnd") ? {
46
+ buildEnd: async (...args) => {
47
+ var _configA$buildEnd, _configB$buildEnd;
48
+ await Promise.all([(_configA$buildEnd = configA.buildEnd) === null || _configA$buildEnd === void 0 ? void 0 : _configA$buildEnd.call(configA, ...args), (_configB$buildEnd = configB.buildEnd) === null || _configB$buildEnd === void 0 ? void 0 : _configB$buildEnd.call(configB, ...args)]);
49
+ }
50
+ } : {}),
51
+ ...(mergeRequired("future") ? {
52
+ future: {
53
+ ...configA.future,
54
+ ...configB.future
55
+ }
56
+ } : {}),
57
+ ...(mergeRequired("ignoredRouteFiles") ? {
58
+ ignoredRouteFiles: Array.from(new Set([...(configA.ignoredRouteFiles ?? []), ...(configB.ignoredRouteFiles ?? [])]))
59
+ } : {}),
60
+ ...(mergeRequired("presets") ? {
61
+ presets: [...(configA.presets ?? []), ...(configB.presets ?? [])]
62
+ } : {}),
63
+ ...(mergeRequired("routes") ? {
64
+ routes: async (...args) => {
65
+ var _configA$routes, _configB$routes;
66
+ let [routesA, routesB] = await Promise.all([(_configA$routes = configA.routes) === null || _configA$routes === void 0 ? void 0 : _configA$routes.call(configA, ...args), (_configB$routes = configB.routes) === null || _configB$routes === void 0 ? void 0 : _configB$routes.call(configB, ...args)]);
67
+ return {
68
+ ...routesA,
69
+ ...routesB
70
+ };
71
+ }
72
+ } : {})
73
+ };
74
+ };
75
+ return configs.reduce(reducer, {});
76
+ };
77
+ // Inlined from https://github.com/jsdf/deep-freeze
78
+ let deepFreeze = o => {
79
+ Object.freeze(o);
80
+ let oIsFunction = typeof o === "function";
81
+ let hasOwnProp = Object.prototype.hasOwnProperty;
82
+ Object.getOwnPropertyNames(o).forEach(function (prop) {
83
+ if (hasOwnProp.call(o, prop) && (oIsFunction ? prop !== "caller" && prop !== "callee" && prop !== "arguments" : true) && o[prop] !== null && (typeof o[prop] === "object" || typeof o[prop] === "function") && !Object.isFrozen(o[prop])) {
84
+ deepFreeze(o[prop]);
85
+ }
86
+ });
87
+ return o;
88
+ };
89
+ async function resolveReactRouterConfig({
31
90
  rootDirectory,
32
- serverMode = serverModes.ServerMode.Production,
33
- isSpaMode = false
91
+ reactRouterUserConfig,
92
+ viteUserConfig,
93
+ viteCommand
34
94
  }) {
35
- var _appConfig$future, _appConfig$future2, _appConfig$future3, _appConfig$future4, _appConfig$future5;
36
- if (!serverModes.isValidServerMode(serverMode)) {
37
- throw new Error(`Invalid server mode "${serverMode}"`);
95
+ var _viteUserConfig$serve;
96
+ let presets = (await Promise.all((reactRouterUserConfig.presets ?? []).map(async preset => {
97
+ if (!preset.name) {
98
+ throw new Error("React Router presets must have a `name` property defined.");
99
+ }
100
+ if (!preset.reactRouterConfig) {
101
+ return null;
102
+ }
103
+ let configPreset = omit__default["default"](await preset.reactRouterConfig({
104
+ reactRouterUserConfig
105
+ }), excludedConfigPresetKeys);
106
+ return configPreset;
107
+ }))).filter(function isNotNull(value) {
108
+ return value !== null;
109
+ });
110
+ let defaults = {
111
+ basename: "/",
112
+ buildDirectory: "build",
113
+ manifest: false,
114
+ serverBuildFile: "index.js",
115
+ serverModuleFormat: "esm",
116
+ ssr: true
117
+ };
118
+ let {
119
+ appDirectory: userAppDirectory,
120
+ basename,
121
+ buildDirectory: userBuildDirectory,
122
+ buildEnd,
123
+ future: userFuture,
124
+ ignoredRouteFiles,
125
+ manifest,
126
+ routes: userRoutesFunction,
127
+ serverBuildFile,
128
+ serverBundles,
129
+ serverModuleFormat,
130
+ ssr
131
+ } = {
132
+ ...defaults,
133
+ // Default values should be completely overridden by user/preset config, not merged
134
+ ...mergeReactRouterConfig(...presets, reactRouterUserConfig)
135
+ };
136
+ let isSpaMode = !ssr;
137
+ // Log warning for incompatible vite config flags
138
+ if (isSpaMode && serverBundles) {
139
+ console.warn(colors__default["default"].yellow(colors__default["default"].bold("⚠️ SPA Mode: ") + "the `serverBundles` config is invalid with " + "`ssr:false` and will be ignored`"));
140
+ serverBundles = undefined;
141
+ }
142
+ let appDirectory = path__default["default"].resolve(rootDirectory, userAppDirectory || "app");
143
+ let buildDirectory = path__default["default"].resolve(rootDirectory, userBuildDirectory);
144
+ let publicPath = viteUserConfig.base ?? "/";
145
+ if (basename !== "/" && viteCommand === "serve" && !((_viteUserConfig$serve = viteUserConfig.server) !== null && _viteUserConfig$serve !== void 0 && _viteUserConfig$serve.middlewareMode) && !basename.startsWith(publicPath)) {
146
+ throw new Error("When using the React Router `basename` and the Vite `base` config, " + "the `basename` config must begin with `base` for the default " + "Vite dev server.");
38
147
  }
39
- let serverModuleFormat = appConfig.serverModuleFormat || "esm";
40
- let appDirectory = path__default["default"].resolve(rootDirectory, appConfig.appDirectory || "app");
148
+ let rootRouteFile = findEntry(appDirectory, "root");
149
+ if (!rootRouteFile) {
150
+ throw new Error(`Missing "root" route file in ${appDirectory}`);
151
+ }
152
+ let routes$1 = {
153
+ root: {
154
+ path: "",
155
+ id: "root",
156
+ file: rootRouteFile
157
+ }
158
+ };
159
+ if (fse__default["default"].existsSync(path__default["default"].resolve(appDirectory, "routes"))) {
160
+ let fileRoutes = flatRoutes.flatRoutes(appDirectory, ignoredRouteFiles);
161
+ for (let route of Object.values(fileRoutes)) {
162
+ routes$1[route.id] = {
163
+ ...route,
164
+ parentId: route.parentId || "root"
165
+ };
166
+ }
167
+ }
168
+ if (userRoutesFunction) {
169
+ let userRoutes = await userRoutesFunction(routes.defineRoutes);
170
+ for (let route of Object.values(userRoutes)) {
171
+ routes$1[route.id] = {
172
+ ...route,
173
+ parentId: route.parentId || "root"
174
+ };
175
+ }
176
+ }
177
+ let future = {
178
+ v3_fetcherPersist: (userFuture === null || userFuture === void 0 ? void 0 : userFuture.v3_fetcherPersist) === true,
179
+ v3_relativeSplatPath: (userFuture === null || userFuture === void 0 ? void 0 : userFuture.v3_relativeSplatPath) === true,
180
+ v3_throwAbortReason: (userFuture === null || userFuture === void 0 ? void 0 : userFuture.v3_throwAbortReason) === true,
181
+ unstable_singleFetch: (userFuture === null || userFuture === void 0 ? void 0 : userFuture.unstable_singleFetch) === true
182
+ };
183
+ let reactRouterConfig = deepFreeze({
184
+ appDirectory,
185
+ basename,
186
+ buildDirectory,
187
+ buildEnd,
188
+ future,
189
+ manifest,
190
+ publicPath,
191
+ routes: routes$1,
192
+ serverBuildFile,
193
+ serverBundles,
194
+ serverModuleFormat,
195
+ ssr
196
+ });
197
+ for (let preset of reactRouterUserConfig.presets ?? []) {
198
+ var _preset$reactRouterCo;
199
+ await ((_preset$reactRouterCo = preset.reactRouterConfigResolved) === null || _preset$reactRouterCo === void 0 ? void 0 : _preset$reactRouterCo.call(preset, {
200
+ reactRouterConfig
201
+ }));
202
+ }
203
+ return reactRouterConfig;
204
+ }
205
+ async function resolveEntryFiles({
206
+ rootDirectory,
207
+ reactRouterConfig
208
+ }) {
209
+ let {
210
+ appDirectory,
211
+ future
212
+ } = reactRouterConfig;
213
+ let isSpaMode = !reactRouterConfig.ssr;
41
214
  let defaultsDirectory = path__default["default"].resolve(__dirname, "config", "defaults");
42
215
  let userEntryClientFile = findEntry(appDirectory, "entry.client");
43
216
  let userEntryServerFile = findEntry(appDirectory, "entry.server");
@@ -45,12 +218,12 @@ async function resolveConfig(appConfig, {
45
218
  let entryClientFile = userEntryClientFile || "entry.client.tsx";
46
219
  let pkgJson = await PackageJson__default["default"].load(rootDirectory);
47
220
  let deps = pkgJson.content.dependencies ?? {};
48
- if (isSpaMode && ((_appConfig$future = appConfig.future) === null || _appConfig$future === void 0 ? void 0 : _appConfig$future.unstable_singleFetch) != true) {
221
+ if (isSpaMode && (future === null || future === void 0 ? void 0 : future.unstable_singleFetch) != true) {
49
222
  // This is a super-simple default since we don't need streaming in SPA Mode.
50
223
  // We can include this in a remix-spa template, but right now `npx remix reveal`
51
224
  // will still expose the streaming template since that command doesn't have
52
225
  // access to the `ssr:false` flag in the vite config (the streaming template
53
- // works just fine so maybe instea dof having this we _only have this version
226
+ // works just fine so maybe instead of having this we _only have this version
54
227
  // in the template...). We let users manage an entry.server file in SPA Mode
55
228
  // so they can de ide if they want to hydrate the full document or just an
56
229
  // embedded `<div id="app">` or whatever.
@@ -81,50 +254,11 @@ async function resolveConfig(appConfig, {
81
254
  }
82
255
  entryServerFile = `entry.server.${serverRuntime}.tsx`;
83
256
  }
84
- let entryClientFilePath = userEntryClientFile ? path__default["default"].resolve(appDirectory, userEntryClientFile) : path__default["default"].resolve(defaultsDirectory, entryClientFile);
85
- let entryServerFilePath = userEntryServerFile ? path__default["default"].resolve(appDirectory, userEntryServerFile) : path__default["default"].resolve(defaultsDirectory, entryServerFile);
86
- let rootRouteFile = findEntry(appDirectory, "root");
87
- if (!rootRouteFile) {
88
- throw new Error(`Missing "root" route file in ${appDirectory}`);
89
- }
90
- let routes$1 = {
91
- root: {
92
- path: "",
93
- id: "root",
94
- file: rootRouteFile
95
- }
96
- };
97
- if (fse__default["default"].existsSync(path__default["default"].resolve(appDirectory, "routes"))) {
98
- let fileRoutes = flatRoutes.flatRoutes(appDirectory, appConfig.ignoredRouteFiles);
99
- for (let route of Object.values(fileRoutes)) {
100
- routes$1[route.id] = {
101
- ...route,
102
- parentId: route.parentId || "root"
103
- };
104
- }
105
- }
106
- if (appConfig.routes) {
107
- let manualRoutes = await appConfig.routes(routes.defineRoutes);
108
- for (let route of Object.values(manualRoutes)) {
109
- routes$1[route.id] = {
110
- ...route,
111
- parentId: route.parentId || "root"
112
- };
113
- }
114
- }
115
- let future = {
116
- v3_fetcherPersist: ((_appConfig$future2 = appConfig.future) === null || _appConfig$future2 === void 0 ? void 0 : _appConfig$future2.v3_fetcherPersist) === true,
117
- v3_relativeSplatPath: ((_appConfig$future3 = appConfig.future) === null || _appConfig$future3 === void 0 ? void 0 : _appConfig$future3.v3_relativeSplatPath) === true,
118
- v3_throwAbortReason: ((_appConfig$future4 = appConfig.future) === null || _appConfig$future4 === void 0 ? void 0 : _appConfig$future4.v3_throwAbortReason) === true,
119
- unstable_singleFetch: ((_appConfig$future5 = appConfig.future) === null || _appConfig$future5 === void 0 ? void 0 : _appConfig$future5.unstable_singleFetch) === true
120
- };
257
+ let entryClientFilePath = userEntryClientFile ? path__default["default"].resolve(reactRouterConfig.appDirectory, userEntryClientFile) : path__default["default"].resolve(defaultsDirectory, entryClientFile);
258
+ let entryServerFilePath = userEntryServerFile ? path__default["default"].resolve(reactRouterConfig.appDirectory, userEntryServerFile) : path__default["default"].resolve(defaultsDirectory, entryServerFile);
121
259
  return {
122
- appDirectory,
123
260
  entryClientFilePath,
124
- entryServerFilePath,
125
- routes: routes$1,
126
- serverModuleFormat,
127
- future
261
+ entryServerFilePath
128
262
  };
129
263
  }
130
264
  const entryExts = [".js", ".jsx", ".ts", ".tsx"];
@@ -135,18 +269,11 @@ function findEntry(dir, basename) {
135
269
  }
136
270
  return undefined;
137
271
  }
138
- function findConfig(dir, basename, extensions) {
139
- for (let ext of extensions) {
140
- let name = basename + ext;
141
- let file = path__default["default"].join(dir, name);
142
- if (fse__default["default"].existsSync(file)) return file;
143
- }
144
- return undefined;
145
- }
146
272
  let disjunctionListFormat = new Intl.ListFormat("en", {
147
273
  style: "long",
148
274
  type: "disjunction"
149
275
  });
150
276
 
151
- exports.findConfig = findConfig;
152
- exports.resolveConfig = resolveConfig;
277
+ exports.configRouteToBranchRoute = configRouteToBranchRoute;
278
+ exports.resolveEntryFiles = resolveEntryFiles;
279
+ exports.resolveReactRouterConfig = resolveReactRouterConfig;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * as cli from "./cli/index";
2
2
  export type { Manifest as AssetsManifest } from "./manifest";
3
- export type { BuildManifest, Preset, ServerBundlesFunction, VitePluginConfig, } from "./vite";
3
+ export type { BuildManifest, Preset, ServerBundlesFunction, VitePluginConfig, } from "./config";
4
4
  export { vitePlugin, cloudflareDevProxyVitePlugin } from "./vite";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-7b411a741
2
+ * @react-router/dev v0.0.0-experimental-79e23be50
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/invariant.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-7b411a741
2
+ * @react-router/dev v0.0.0-experimental-79e23be50
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-7b411a741
2
+ * @react-router/dev v0.0.0-experimental-79e23be50
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-7b411a741
2
+ * @react-router/dev v0.0.0-experimental-79e23be50
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -16,6 +16,7 @@ var path = require('node:path');
16
16
  var fse = require('fs-extra');
17
17
  var colors = require('picocolors');
18
18
  var plugin = require('./plugin.js');
19
+ var config = require('../config.js');
19
20
  var invariant = require('../invariant.js');
20
21
  var importViteEsmSync = require('./import-vite-esm-sync.js');
21
22
 
@@ -94,7 +95,7 @@ async function getServerBuilds(ctx) {
94
95
  await Promise.all(getAddressableRoutes(routes).map(async route => {
95
96
  let branch = getRouteBranch(routes, route.id);
96
97
  let serverBundleId = await serverBundles({
97
- branch: branch.map(route => plugin.configRouteToBranchRoute({
98
+ branch: branch.map(route => config.configRouteToBranchRoute({
98
99
  ...route,
99
100
  // Ensure absolute paths are passed to the serverBundles function
100
101
  file: path__default["default"].join(resolvedAppDirectory, route.file)
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-7b411a741
2
+ * @react-router/dev v0.0.0-experimental-79e23be50
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/vite/dev.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-7b411a741
2
+ * @react-router/dev v0.0.0-experimental-79e23be50
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-7b411a741
2
+ * @react-router/dev v0.0.0-experimental-79e23be50
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,4 +1,3 @@
1
1
  import type { ReactRouterVitePlugin } from "./plugin";
2
- export type { BuildManifest, Preset, VitePluginConfig, ServerBundlesFunction, } from "./plugin";
3
2
  export declare const vitePlugin: ReactRouterVitePlugin;
4
3
  export { cloudflareDevProxyVitePlugin } from "./cloudflare-proxy-plugin";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-7b411a741
2
+ * @react-router/dev v0.0.0-experimental-79e23be50
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-7b411a741
2
+ * @react-router/dev v0.0.0-experimental-79e23be50
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,7 +1,7 @@
1
1
  import type * as Vite from "vite";
2
- import type { ConfigRoute, RouteManifest } from "../config/routes";
3
- import type { AppConfig as RemixEsbuildUserConfig, RemixConfig as ResolvedRemixEsbuildConfig } from "../config";
2
+ import { type RouteManifest } from "../config/routes";
4
3
  import type { Manifest as ReactRouterManifest } from "../manifest";
4
+ import { type VitePluginConfig, type ResolvedVitePluginConfig } from "../config";
5
5
  export declare function resolveViteConfig({ configFile, mode, root, }: {
6
6
  configFile?: string;
7
7
  mode?: string;
@@ -43,100 +43,6 @@ export declare function loadPluginContext({ configFile, root, }: {
43
43
  configFile?: string;
44
44
  root?: string;
45
45
  }): Promise<ReactRouterPluginContext>;
46
- declare const branchRouteProperties: readonly ["id", "path", "file", "index"];
47
- type BranchRoute = Pick<ConfigRoute, (typeof branchRouteProperties)[number]>;
48
- export declare const configRouteToBranchRoute: (configRoute: ConfigRoute) => BranchRoute;
49
- export type ServerBundlesFunction = (args: {
50
- branch: BranchRoute[];
51
- }) => string | Promise<string>;
52
- type BaseBuildManifest = {
53
- routes: RouteManifest;
54
- };
55
- type DefaultBuildManifest = BaseBuildManifest & {
56
- serverBundles?: never;
57
- routeIdToServerBundleId?: never;
58
- };
59
- export type ServerBundlesBuildManifest = BaseBuildManifest & {
60
- serverBundles: {
61
- [serverBundleId: string]: {
62
- id: string;
63
- file: string;
64
- };
65
- };
66
- routeIdToServerBundleId: Record<string, string>;
67
- };
68
- export type BuildManifest = DefaultBuildManifest | ServerBundlesBuildManifest;
69
- declare const excludedConfigPresetKeys: readonly ["presets"];
70
- type ExcludedConfigPresetKey = (typeof excludedConfigPresetKeys)[number];
71
- type ConfigPreset = Omit<VitePluginConfig, ExcludedConfigPresetKey>;
72
- export type Preset = {
73
- name: string;
74
- reactRouterConfig?: (args: {
75
- reactRouterUserConfig: VitePluginConfig;
76
- }) => ConfigPreset | Promise<ConfigPreset>;
77
- reactRouterConfigResolved?: (args: {
78
- reactRouterConfig: ResolvedVitePluginConfig;
79
- }) => void | Promise<void>;
80
- };
81
- export type VitePluginConfig = RemixEsbuildUserConfig & {
82
- /**
83
- * The react router app basename. Defaults to `"/"`.
84
- */
85
- basename?: string;
86
- /**
87
- * The path to the build directory, relative to the project. Defaults to
88
- * `"build"`.
89
- */
90
- buildDirectory?: string;
91
- /**
92
- * A function that is called after the full React Router build is complete.
93
- */
94
- buildEnd?: BuildEndHook;
95
- /**
96
- * Whether to write a `"manifest.json"` file to the build directory.`
97
- * Defaults to `false`.
98
- */
99
- manifest?: boolean;
100
- /**
101
- * An array of React Router plugin config presets to ease integration with
102
- * other platforms and tools.
103
- */
104
- presets?: Array<Preset>;
105
- /**
106
- * The file name of the server build output. This file
107
- * should end in a `.js` extension and should be deployed to your server.
108
- * Defaults to `"index.js"`.
109
- */
110
- serverBuildFile?: string;
111
- /**
112
- * A function for assigning routes to different server bundles. This
113
- * function should return a server bundle ID which will be used as the
114
- * bundle's directory name within the server build directory.
115
- */
116
- serverBundles?: ServerBundlesFunction;
117
- /**
118
- * Enable server-side rendering for your application. Disable to use "SPA
119
- * Mode", which will request the `/` path at build-time and save it as an
120
- * `index.html` file with your assets so your application can be deployed as a
121
- * SPA without server-rendering. Default's to `true`.
122
- */
123
- ssr?: boolean;
124
- };
125
- type BuildEndHook = (args: {
126
- buildManifest: BuildManifest | undefined;
127
- reactRouterConfig: ResolvedVitePluginConfig;
128
- viteConfig: Vite.ResolvedConfig;
129
- }) => void | Promise<void>;
130
- export type ResolvedVitePluginConfig = Readonly<Pick<ResolvedRemixEsbuildConfig, "appDirectory" | "future" | "routes" | "serverModuleFormat"> & {
131
- basename: string;
132
- buildDirectory: string;
133
- buildEnd?: BuildEndHook;
134
- manifest: boolean;
135
- publicPath: string;
136
- serverBuildFile: string;
137
- serverBundles?: ServerBundlesFunction;
138
- ssr: boolean;
139
- }>;
140
46
  export type ServerBundleBuildConfig = {
141
47
  routes: RouteManifest;
142
48
  serverBundleId: string;