@react-router/dev 7.0.0-pre.2 → 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 +20 -0
- package/dist/cli/index.d.ts +2 -1
- package/dist/cli/index.js +1198 -8
- package/dist/{config/routes.d.ts → routes-C14jcF98.d.ts} +15 -21
- package/dist/routes.d.ts +2 -2
- package/dist/routes.js +181 -11
- package/dist/typescript/plugin.d.ts +5 -2
- package/dist/typescript/plugin.js +479 -31
- package/dist/vite/cloudflare.d.ts +23 -1
- package/dist/vite/cloudflare.js +171 -5
- package/dist/vite.d.ts +169 -2
- package/dist/vite.js +2394 -5
- package/package.json +28 -7
- package/dist/cli/commands.d.ts +0 -13
- package/dist/cli/commands.js +0 -179
- package/dist/cli/detectPackageManager.d.ts +0 -10
- package/dist/cli/detectPackageManager.js +0 -39
- package/dist/cli/run.d.ts +0 -5
- package/dist/cli/run.js +0 -188
- package/dist/cli/useJavascript.d.ts +0 -4
- package/dist/cli/useJavascript.js +0 -66
- package/dist/colors.d.ts +0 -17
- package/dist/colors.js +0 -49
- package/dist/config/format.d.ts +0 -5
- package/dist/config/format.js +0 -68
- package/dist/config/routes.js +0 -253
- package/dist/config/serverModes.d.ts +0 -9
- package/dist/invariant.d.ts +0 -2
- package/dist/invariant.js +0 -20
- package/dist/manifest.d.ts +0 -28
- package/dist/typescript/typegen.d.ts +0 -10
- package/dist/typescript/typegen.js +0 -190
- package/dist/vite/babel.d.ts +0 -20
- package/dist/vite/babel.js +0 -49
- package/dist/vite/build.d.ts +0 -15
- package/dist/vite/build.js +0 -249
- package/dist/vite/cloudflare-dev-proxy.d.ts +0 -21
- package/dist/vite/cloudflare-dev-proxy.js +0 -89
- package/dist/vite/combine-urls-test.d.ts +0 -1
- package/dist/vite/combine-urls.d.ts +0 -1
- package/dist/vite/combine-urls.js +0 -20
- package/dist/vite/config.d.ts +0 -234
- package/dist/vite/config.js +0 -282
- package/dist/vite/dev.d.ts +0 -15
- package/dist/vite/dev.js +0 -81
- package/dist/vite/import-vite-esm-sync.d.ts +0 -4
- package/dist/vite/import-vite-esm-sync.js +0 -28
- package/dist/vite/node-adapter.d.ts +0 -6
- package/dist/vite/node-adapter.js +0 -90
- package/dist/vite/plugin.d.ts +0 -75
- package/dist/vite/plugin.js +0 -1301
- package/dist/vite/profiler.d.ts +0 -5
- package/dist/vite/profiler.js +0 -55
- package/dist/vite/remove-exports-test.d.ts +0 -1
- package/dist/vite/remove-exports.d.ts +0 -2
- package/dist/vite/remove-exports.js +0 -148
- package/dist/vite/resolve-file-url.d.ts +0 -3
- package/dist/vite/resolve-file-url.js +0 -53
- package/dist/vite/styles.d.ts +0 -14
- package/dist/vite/styles.js +0 -199
- package/dist/vite/vite-node.d.ts +0 -9
- package/dist/vite/vite-node.js +0 -57
- package/dist/vite/vmod.d.ts +0 -3
- package/dist/vite/vmod.js +0 -21
- package/dist/vite/with-props.d.ts +0 -4
- package/dist/vite/with-props.js +0 -151
- /package/dist/{vite/static → static}/refresh-utils.cjs +0 -0
package/dist/vite/build.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type * as Vite from "vite";
|
|
2
|
-
export interface ViteBuildOptions {
|
|
3
|
-
assetsInlineLimit?: number;
|
|
4
|
-
clearScreen?: boolean;
|
|
5
|
-
config?: string;
|
|
6
|
-
emptyOutDir?: boolean;
|
|
7
|
-
force?: boolean;
|
|
8
|
-
logLevel?: Vite.LogLevel;
|
|
9
|
-
minify?: Vite.BuildOptions["minify"];
|
|
10
|
-
mode?: string;
|
|
11
|
-
profile?: boolean;
|
|
12
|
-
sourcemapClient?: boolean | "inline" | "hidden";
|
|
13
|
-
sourcemapServer?: boolean | "inline" | "hidden";
|
|
14
|
-
}
|
|
15
|
-
export declare function build(root: string, { assetsInlineLimit, clearScreen, config: configFile, emptyOutDir, force, logLevel, minify, mode, sourcemapClient, sourcemapServer, }: ViteBuildOptions): Promise<void>;
|
package/dist/vite/build.js
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @react-router/dev v7.0.0-pre.2
|
|
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
|
-
|
|
13
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
-
|
|
15
|
-
var path = require('node:path');
|
|
16
|
-
var fse = require('fs-extra');
|
|
17
|
-
var colors = require('picocolors');
|
|
18
|
-
var plugin = require('./plugin.js');
|
|
19
|
-
var config = require('./config.js');
|
|
20
|
-
var invariant = require('../invariant.js');
|
|
21
|
-
var importViteEsmSync = require('./import-vite-esm-sync.js');
|
|
22
|
-
|
|
23
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
24
|
-
|
|
25
|
-
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
26
|
-
var fse__default = /*#__PURE__*/_interopDefaultLegacy(fse);
|
|
27
|
-
var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
|
|
28
|
-
|
|
29
|
-
function getAddressableRoutes(routes) {
|
|
30
|
-
let nonAddressableIds = new Set();
|
|
31
|
-
for (let id in routes) {
|
|
32
|
-
let route = routes[id];
|
|
33
|
-
// We omit the parent route of index routes since the index route takes ownership of its parent's path
|
|
34
|
-
if (route.index) {
|
|
35
|
-
invariant(route.parentId, `Expected index route "${route.id}" to have "parentId" set`);
|
|
36
|
-
nonAddressableIds.add(route.parentId);
|
|
37
|
-
}
|
|
38
|
-
// We omit pathless routes since they can only be addressed via descendant routes
|
|
39
|
-
if (typeof route.path !== "string" && !route.index) {
|
|
40
|
-
nonAddressableIds.add(id);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return Object.values(routes).filter(route => !nonAddressableIds.has(route.id));
|
|
44
|
-
}
|
|
45
|
-
function getRouteBranch(routes, routeId) {
|
|
46
|
-
let branch = [];
|
|
47
|
-
let currentRouteId = routeId;
|
|
48
|
-
while (currentRouteId) {
|
|
49
|
-
let route = routes[currentRouteId];
|
|
50
|
-
invariant(route, `Missing route for ${currentRouteId}`);
|
|
51
|
-
branch.push(route);
|
|
52
|
-
currentRouteId = route.parentId;
|
|
53
|
-
}
|
|
54
|
-
return branch.reverse();
|
|
55
|
-
}
|
|
56
|
-
async function getServerBuilds(ctx) {
|
|
57
|
-
let {
|
|
58
|
-
rootDirectory
|
|
59
|
-
} = ctx;
|
|
60
|
-
const {
|
|
61
|
-
routes,
|
|
62
|
-
serverBuildFile,
|
|
63
|
-
serverBundles,
|
|
64
|
-
appDirectory
|
|
65
|
-
} = ctx.reactRouterConfig;
|
|
66
|
-
let serverBuildDirectory = plugin.getServerBuildDirectory(ctx);
|
|
67
|
-
if (!serverBundles) {
|
|
68
|
-
return {
|
|
69
|
-
serverBuilds: [{
|
|
70
|
-
ssr: true
|
|
71
|
-
}],
|
|
72
|
-
buildManifest: {
|
|
73
|
-
routes
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
let {
|
|
78
|
-
normalizePath
|
|
79
|
-
} = await import('vite');
|
|
80
|
-
let resolvedAppDirectory = path__default["default"].resolve(rootDirectory, appDirectory);
|
|
81
|
-
let rootRelativeRoutes = Object.fromEntries(Object.entries(routes).map(([id, route]) => {
|
|
82
|
-
let filePath = path__default["default"].join(resolvedAppDirectory, route.file);
|
|
83
|
-
let rootRelativeFilePath = normalizePath(path__default["default"].relative(rootDirectory, filePath));
|
|
84
|
-
return [id, {
|
|
85
|
-
...route,
|
|
86
|
-
file: rootRelativeFilePath
|
|
87
|
-
}];
|
|
88
|
-
}));
|
|
89
|
-
let buildManifest = {
|
|
90
|
-
serverBundles: {},
|
|
91
|
-
routeIdToServerBundleId: {},
|
|
92
|
-
routes: rootRelativeRoutes
|
|
93
|
-
};
|
|
94
|
-
let serverBundleBuildConfigById = new Map();
|
|
95
|
-
await Promise.all(getAddressableRoutes(routes).map(async route => {
|
|
96
|
-
let branch = getRouteBranch(routes, route.id);
|
|
97
|
-
let serverBundleId = await serverBundles({
|
|
98
|
-
branch: branch.map(route => config.configRouteToBranchRoute({
|
|
99
|
-
...route,
|
|
100
|
-
// Ensure absolute paths are passed to the serverBundles function
|
|
101
|
-
file: path__default["default"].join(resolvedAppDirectory, route.file)
|
|
102
|
-
}))
|
|
103
|
-
});
|
|
104
|
-
if (typeof serverBundleId !== "string") {
|
|
105
|
-
throw new Error(`The "serverBundles" function must return a string`);
|
|
106
|
-
}
|
|
107
|
-
if (!/^[a-zA-Z0-9-_]+$/.test(serverBundleId)) {
|
|
108
|
-
throw new Error(`The "serverBundles" function must only return strings containing alphanumeric characters, hyphens and underscores.`);
|
|
109
|
-
}
|
|
110
|
-
buildManifest.routeIdToServerBundleId[route.id] = serverBundleId;
|
|
111
|
-
let relativeServerBundleDirectory = path__default["default"].relative(rootDirectory, path__default["default"].join(serverBuildDirectory, serverBundleId));
|
|
112
|
-
let serverBuildConfig = serverBundleBuildConfigById.get(serverBundleId);
|
|
113
|
-
if (!serverBuildConfig) {
|
|
114
|
-
buildManifest.serverBundles[serverBundleId] = {
|
|
115
|
-
id: serverBundleId,
|
|
116
|
-
file: normalizePath(path__default["default"].join(relativeServerBundleDirectory, serverBuildFile))
|
|
117
|
-
};
|
|
118
|
-
serverBuildConfig = {
|
|
119
|
-
routes: {},
|
|
120
|
-
serverBundleId
|
|
121
|
-
};
|
|
122
|
-
serverBundleBuildConfigById.set(serverBundleId, serverBuildConfig);
|
|
123
|
-
}
|
|
124
|
-
for (let route of branch) {
|
|
125
|
-
serverBuildConfig.routes[route.id] = route;
|
|
126
|
-
}
|
|
127
|
-
}));
|
|
128
|
-
let serverBuilds = Array.from(serverBundleBuildConfigById.values()).map(serverBundleBuildConfig => {
|
|
129
|
-
let serverBuild = {
|
|
130
|
-
ssr: true,
|
|
131
|
-
serverBundleBuildConfig
|
|
132
|
-
};
|
|
133
|
-
return serverBuild;
|
|
134
|
-
});
|
|
135
|
-
return {
|
|
136
|
-
serverBuilds,
|
|
137
|
-
buildManifest
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
async function cleanBuildDirectory(viteConfig, ctx) {
|
|
141
|
-
let buildDirectory = ctx.reactRouterConfig.buildDirectory;
|
|
142
|
-
let isWithinRoot = () => {
|
|
143
|
-
let relativePath = path__default["default"].relative(ctx.rootDirectory, buildDirectory);
|
|
144
|
-
return !relativePath.startsWith("..") && !path__default["default"].isAbsolute(relativePath);
|
|
145
|
-
};
|
|
146
|
-
if (viteConfig.build.emptyOutDir ?? isWithinRoot()) {
|
|
147
|
-
await fse__default["default"].remove(buildDirectory);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
function getViteManifestPaths(ctx, serverBuilds) {
|
|
151
|
-
let buildRelative = pathname => path__default["default"].resolve(ctx.reactRouterConfig.buildDirectory, pathname);
|
|
152
|
-
let viteManifestPaths = ["client/.vite/manifest.json", ...serverBuilds.map(({
|
|
153
|
-
serverBundleBuildConfig
|
|
154
|
-
}) => {
|
|
155
|
-
let serverBundleId = serverBundleBuildConfig === null || serverBundleBuildConfig === void 0 ? void 0 : serverBundleBuildConfig.serverBundleId;
|
|
156
|
-
let serverBundlePath = serverBundleId ? serverBundleId + "/" : "";
|
|
157
|
-
return `server/${serverBundlePath}.vite/manifest.json`;
|
|
158
|
-
})].map(srcPath => buildRelative(srcPath));
|
|
159
|
-
return viteManifestPaths;
|
|
160
|
-
}
|
|
161
|
-
async function build(root, {
|
|
162
|
-
assetsInlineLimit,
|
|
163
|
-
clearScreen,
|
|
164
|
-
config: configFile,
|
|
165
|
-
emptyOutDir,
|
|
166
|
-
force,
|
|
167
|
-
logLevel,
|
|
168
|
-
minify,
|
|
169
|
-
mode,
|
|
170
|
-
sourcemapClient,
|
|
171
|
-
sourcemapServer
|
|
172
|
-
}) {
|
|
173
|
-
var _reactRouterConfig$bu;
|
|
174
|
-
// Ensure Vite's ESM build is preloaded at the start of the process
|
|
175
|
-
// so it can be accessed synchronously via `importViteEsmSync`
|
|
176
|
-
await importViteEsmSync.preloadViteEsm();
|
|
177
|
-
let viteConfig = await plugin.resolveViteConfig({
|
|
178
|
-
configFile,
|
|
179
|
-
mode,
|
|
180
|
-
root
|
|
181
|
-
});
|
|
182
|
-
const ctx = await plugin.extractPluginContext(viteConfig);
|
|
183
|
-
if (!ctx) {
|
|
184
|
-
console.error(colors__default["default"].red("React Router Vite plugin not found in Vite config"));
|
|
185
|
-
process.exit(1);
|
|
186
|
-
}
|
|
187
|
-
let {
|
|
188
|
-
reactRouterConfig
|
|
189
|
-
} = ctx;
|
|
190
|
-
let vite = await import('vite');
|
|
191
|
-
async function viteBuild({
|
|
192
|
-
ssr,
|
|
193
|
-
serverBundleBuildConfig
|
|
194
|
-
}) {
|
|
195
|
-
await vite.build({
|
|
196
|
-
root,
|
|
197
|
-
mode,
|
|
198
|
-
configFile,
|
|
199
|
-
build: {
|
|
200
|
-
assetsInlineLimit,
|
|
201
|
-
emptyOutDir,
|
|
202
|
-
minify,
|
|
203
|
-
ssr,
|
|
204
|
-
sourcemap: ssr ? sourcemapServer : sourcemapClient
|
|
205
|
-
},
|
|
206
|
-
optimizeDeps: {
|
|
207
|
-
force
|
|
208
|
-
},
|
|
209
|
-
clearScreen,
|
|
210
|
-
logLevel,
|
|
211
|
-
...(serverBundleBuildConfig ? {
|
|
212
|
-
__reactRouterServerBundleBuildConfig: serverBundleBuildConfig
|
|
213
|
-
} : {})
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
await cleanBuildDirectory(viteConfig, ctx);
|
|
217
|
-
// Run the Vite client build first
|
|
218
|
-
await viteBuild({
|
|
219
|
-
ssr: false
|
|
220
|
-
});
|
|
221
|
-
// Then run Vite SSR builds in parallel
|
|
222
|
-
let {
|
|
223
|
-
serverBuilds,
|
|
224
|
-
buildManifest
|
|
225
|
-
} = await getServerBuilds(ctx);
|
|
226
|
-
await Promise.all(serverBuilds.map(viteBuild));
|
|
227
|
-
let viteManifestPaths = getViteManifestPaths(ctx, serverBuilds);
|
|
228
|
-
await Promise.all(viteManifestPaths.map(async viteManifestPath => {
|
|
229
|
-
let manifestExists = await fse__default["default"].pathExists(viteManifestPath);
|
|
230
|
-
if (!manifestExists) return;
|
|
231
|
-
// Delete original Vite manifest file if consumer doesn't want it
|
|
232
|
-
if (!ctx.viteManifestEnabled) {
|
|
233
|
-
await fse__default["default"].remove(viteManifestPath);
|
|
234
|
-
}
|
|
235
|
-
// Remove .vite dir if it's now empty
|
|
236
|
-
let viteDir = path__default["default"].dirname(viteManifestPath);
|
|
237
|
-
let viteDirFiles = await fse__default["default"].readdir(viteDir);
|
|
238
|
-
if (viteDirFiles.length === 0) {
|
|
239
|
-
await fse__default["default"].remove(viteDir);
|
|
240
|
-
}
|
|
241
|
-
}));
|
|
242
|
-
await ((_reactRouterConfig$bu = reactRouterConfig.buildEnd) === null || _reactRouterConfig$bu === void 0 ? void 0 : _reactRouterConfig$bu.call(reactRouterConfig, {
|
|
243
|
-
buildManifest,
|
|
244
|
-
reactRouterConfig,
|
|
245
|
-
viteConfig
|
|
246
|
-
}));
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
exports.build = build;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type AppLoadContext } from "react-router";
|
|
2
|
-
import { type Plugin } from "vite";
|
|
3
|
-
import { type GetPlatformProxyOptions, type PlatformProxy } from "wrangler";
|
|
4
|
-
type CfProperties = Record<string, unknown>;
|
|
5
|
-
type LoadContext<Env, Cf extends CfProperties> = {
|
|
6
|
-
cloudflare: Omit<PlatformProxy<Env, Cf>, "dispose">;
|
|
7
|
-
};
|
|
8
|
-
type GetLoadContext<Env, Cf extends CfProperties> = (args: {
|
|
9
|
-
request: Request;
|
|
10
|
-
context: LoadContext<Env, Cf>;
|
|
11
|
-
}) => AppLoadContext | Promise<AppLoadContext>;
|
|
12
|
-
/**
|
|
13
|
-
* Vite plugin that provides [Node proxies to local workerd
|
|
14
|
-
* bindings](https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy)
|
|
15
|
-
* to `context.cloudflare` in your server loaders and server actions during
|
|
16
|
-
* development.
|
|
17
|
-
*/
|
|
18
|
-
export declare const cloudflareDevProxyVitePlugin: <Env, Cf extends CfProperties>(options?: {
|
|
19
|
-
getLoadContext?: GetLoadContext<Env, Cf>;
|
|
20
|
-
} & GetPlatformProxyOptions) => Plugin;
|
|
21
|
-
export {};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @react-router/dev v7.0.0-pre.2
|
|
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
|
-
|
|
13
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
-
|
|
15
|
-
var reactRouter = require('react-router');
|
|
16
|
-
var nodeAdapter = require('./node-adapter.js');
|
|
17
|
-
|
|
18
|
-
let serverBuildId = "virtual:react-router/server-build";
|
|
19
|
-
function importWrangler() {
|
|
20
|
-
try {
|
|
21
|
-
return import('wrangler');
|
|
22
|
-
} catch (_) {
|
|
23
|
-
throw Error("Could not import `wrangler`. Do you have it installed?");
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
const PLUGIN_NAME = "react-router-cloudflare-vite-dev-proxy";
|
|
27
|
-
/**
|
|
28
|
-
* Vite plugin that provides [Node proxies to local workerd
|
|
29
|
-
* bindings](https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy)
|
|
30
|
-
* to `context.cloudflare` in your server loaders and server actions during
|
|
31
|
-
* development.
|
|
32
|
-
*/
|
|
33
|
-
const cloudflareDevProxyVitePlugin = (options = {}) => {
|
|
34
|
-
let {
|
|
35
|
-
getLoadContext,
|
|
36
|
-
...restOptions
|
|
37
|
-
} = options;
|
|
38
|
-
return {
|
|
39
|
-
name: PLUGIN_NAME,
|
|
40
|
-
config: () => ({
|
|
41
|
-
ssr: {
|
|
42
|
-
resolve: {
|
|
43
|
-
externalConditions: ["workerd", "worker"]
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}),
|
|
47
|
-
configResolved: viteConfig => {
|
|
48
|
-
let pluginIndex = name => viteConfig.plugins.findIndex(plugin => plugin.name === name);
|
|
49
|
-
let reactRouterPluginIndex = pluginIndex("react-router");
|
|
50
|
-
if (reactRouterPluginIndex >= 0 && reactRouterPluginIndex < pluginIndex(PLUGIN_NAME)) {
|
|
51
|
-
throw new Error(`The "${PLUGIN_NAME}" plugin should be placed before the React Router plugin in your Vite config file`);
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
configureServer: async viteDevServer => {
|
|
55
|
-
let {
|
|
56
|
-
getPlatformProxy
|
|
57
|
-
} = await importWrangler();
|
|
58
|
-
// Do not include `dispose` in Cloudflare context
|
|
59
|
-
let {
|
|
60
|
-
dispose,
|
|
61
|
-
...cloudflare
|
|
62
|
-
} = await getPlatformProxy(restOptions);
|
|
63
|
-
let context = {
|
|
64
|
-
cloudflare
|
|
65
|
-
};
|
|
66
|
-
return () => {
|
|
67
|
-
if (!viteDevServer.config.server.middlewareMode) {
|
|
68
|
-
viteDevServer.middlewares.use(async (nodeReq, nodeRes, next) => {
|
|
69
|
-
try {
|
|
70
|
-
let build = await viteDevServer.ssrLoadModule(serverBuildId);
|
|
71
|
-
let handler = reactRouter.createRequestHandler(build, "development");
|
|
72
|
-
let req = nodeAdapter.fromNodeRequest(nodeReq, nodeRes);
|
|
73
|
-
let loadContext = getLoadContext ? await getLoadContext({
|
|
74
|
-
request: req,
|
|
75
|
-
context
|
|
76
|
-
}) : context;
|
|
77
|
-
let res = await handler(req, loadContext);
|
|
78
|
-
await nodeAdapter.toNodeRequest(res, nodeRes);
|
|
79
|
-
} catch (error) {
|
|
80
|
-
next(error);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
exports.cloudflareDevProxyVitePlugin = cloudflareDevProxyVitePlugin;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function combineURLs(baseURL: string, relativeURL: string): string;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @react-router/dev v7.0.0-pre.2
|
|
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
|
-
|
|
13
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
-
|
|
15
|
-
// Borrowed from axios: https://github.com/axios/axios/blob/0e4f9fa29077ebee4499facea6be1492b42e8a26/lib/helpers/combineURLs.js#L11-L15
|
|
16
|
-
function combineURLs(baseURL, relativeURL) {
|
|
17
|
-
return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
exports.combineURLs = combineURLs;
|
package/dist/vite/config.d.ts
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import type * as Vite from "vite";
|
|
2
|
-
import type * as ViteNode from "./vite-node";
|
|
3
|
-
import { type RouteManifest, type RouteManifestEntry } from "../config/routes";
|
|
4
|
-
declare const excludedConfigPresetKeys: readonly ["presets"];
|
|
5
|
-
type ExcludedConfigPresetKey = (typeof excludedConfigPresetKeys)[number];
|
|
6
|
-
type ConfigPreset = Omit<ReactRouterConfig, ExcludedConfigPresetKey>;
|
|
7
|
-
export type Preset = {
|
|
8
|
-
name: string;
|
|
9
|
-
reactRouterConfig?: (args: {
|
|
10
|
-
reactRouterUserConfig: ReactRouterConfig;
|
|
11
|
-
}) => ConfigPreset | Promise<ConfigPreset>;
|
|
12
|
-
reactRouterConfigResolved?: (args: {
|
|
13
|
-
reactRouterConfig: ResolvedReactRouterConfig;
|
|
14
|
-
}) => void | Promise<void>;
|
|
15
|
-
};
|
|
16
|
-
declare const branchRouteProperties: readonly ["id", "path", "file", "index"];
|
|
17
|
-
type BranchRoute = Pick<RouteManifestEntry, (typeof branchRouteProperties)[number]>;
|
|
18
|
-
export declare const configRouteToBranchRoute: (configRoute: RouteManifestEntry) => BranchRoute;
|
|
19
|
-
export 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
|
-
export 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
|
-
export type BuildManifest = DefaultBuildManifest | ServerBundlesBuildManifest;
|
|
42
|
-
type BuildEndHook = (args: {
|
|
43
|
-
buildManifest: BuildManifest | undefined;
|
|
44
|
-
reactRouterConfig: ResolvedReactRouterConfig;
|
|
45
|
-
viteConfig: Vite.ResolvedConfig;
|
|
46
|
-
}) => void | Promise<void>;
|
|
47
|
-
export 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
|
-
export 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
|
-
export declare function resolvePublicPath(viteUserConfig: Vite.UserConfig): string;
|
|
163
|
-
export declare function resolveReactRouterConfig({ rootDirectory, reactRouterUserConfig, routeConfigChanged, viteUserConfig, viteCommand, routesViteNodeContext, }: {
|
|
164
|
-
rootDirectory: string;
|
|
165
|
-
reactRouterUserConfig: ReactRouterConfig;
|
|
166
|
-
routeConfigChanged: boolean;
|
|
167
|
-
viteUserConfig: Vite.UserConfig;
|
|
168
|
-
viteCommand: Vite.ConfigEnv["command"];
|
|
169
|
-
routesViteNodeContext: ViteNode.Context;
|
|
170
|
-
}): Promise<Readonly<{
|
|
171
|
-
/**
|
|
172
|
-
* The absolute path to the application source directory.
|
|
173
|
-
*/
|
|
174
|
-
appDirectory: string;
|
|
175
|
-
/**
|
|
176
|
-
* The React Router app basename. Defaults to `"/"`.
|
|
177
|
-
*/
|
|
178
|
-
basename: string;
|
|
179
|
-
/**
|
|
180
|
-
* The absolute path to the build directory.
|
|
181
|
-
*/
|
|
182
|
-
buildDirectory: string;
|
|
183
|
-
/**
|
|
184
|
-
* A function that is called after the full React Router build is complete.
|
|
185
|
-
*/
|
|
186
|
-
buildEnd?: BuildEndHook | undefined;
|
|
187
|
-
/**
|
|
188
|
-
* Enabled future flags
|
|
189
|
-
*/
|
|
190
|
-
future: FutureConfig;
|
|
191
|
-
/**
|
|
192
|
-
* An array of URLs to prerender to HTML files at build time. Can also be a
|
|
193
|
-
* function returning an array to dynamically generate URLs.
|
|
194
|
-
*/
|
|
195
|
-
prerender: boolean | string[] | ((args: {
|
|
196
|
-
getStaticPaths: () => string[];
|
|
197
|
-
}) => string[] | Promise<string[]>) | undefined;
|
|
198
|
-
/**
|
|
199
|
-
* An object of all available routes, keyed by route id.
|
|
200
|
-
*/
|
|
201
|
-
routes: RouteManifest;
|
|
202
|
-
/**
|
|
203
|
-
* The file name of the server build output. This file
|
|
204
|
-
* should end in a `.js` extension and should be deployed to your server.
|
|
205
|
-
* Defaults to `"index.js"`.
|
|
206
|
-
*/
|
|
207
|
-
serverBuildFile: string;
|
|
208
|
-
/**
|
|
209
|
-
* A function for assigning routes to different server bundles. This
|
|
210
|
-
* function should return a server bundle ID which will be used as the
|
|
211
|
-
* bundle's directory name within the server build directory.
|
|
212
|
-
*/
|
|
213
|
-
serverBundles?: ServerBundlesFunction | undefined;
|
|
214
|
-
/**
|
|
215
|
-
* The output format of the server build. Defaults to "esm".
|
|
216
|
-
*/
|
|
217
|
-
serverModuleFormat: ServerModuleFormat;
|
|
218
|
-
/**
|
|
219
|
-
* Enable server-side rendering for your application. Disable to use "SPA
|
|
220
|
-
* Mode", which will request the `/` path at build-time and save it as an
|
|
221
|
-
* `index.html` file with your assets so your application can be deployed as a
|
|
222
|
-
* SPA without server-rendering. Default's to `true`.
|
|
223
|
-
*/
|
|
224
|
-
ssr: boolean;
|
|
225
|
-
}>>;
|
|
226
|
-
export declare function resolveEntryFiles({ rootDirectory, reactRouterConfig, }: {
|
|
227
|
-
rootDirectory: string;
|
|
228
|
-
reactRouterConfig: ResolvedReactRouterConfig;
|
|
229
|
-
}): Promise<{
|
|
230
|
-
entryClientFilePath: string;
|
|
231
|
-
entryServerFilePath: string;
|
|
232
|
-
}>;
|
|
233
|
-
export declare function findEntry(dir: string, basename: string): string | undefined;
|
|
234
|
-
export {};
|