@react-router/dev 0.0.0-experimental-ce4015162 → 0.0.0-experimental-8cee090e4
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 +17 -0
- package/dist/{build-BzQqIPQx.js → build-B3Cfdu0l.js} +2 -2
- package/dist/cli/index.js +7 -8
- package/dist/{config-DOhNF86o.d.ts → config-DvmRcD4Z.d.ts} +1 -2
- package/dist/config.d.ts +2 -2
- package/dist/config.js +1 -1
- package/dist/{dev--vS8KUm0.js → dev-CJPpPQeG.js} +2 -2
- package/dist/{routes-DWLkrlkM.js → routes-sm_wl6yW.js} +10 -3
- package/dist/routes.d.ts +1 -1
- package/dist/routes.js +2 -2
- package/dist/{typegen-DfdqqoXA.js → typegen-DTHWSW2W.js} +57 -41
- package/dist/vite.js +78 -34
- package/package.json +26 -29
- package/dist/invariant-BCP1NPJ8.js +0 -19
- package/dist/vite-oFg2Sopv.js +0 -41
- /package/dist/{routes-BbocpwgJ.d.ts → routes-Kx8VZRs3.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# `@react-router/dev`
|
|
2
2
|
|
|
3
|
+
## v7.16.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Stabilize `future.unstable_trailingSlashAwareDataRequests` as `future.v8_trailingSlashAwareDataRequests` ([#15098](https://github.com/remix-run/react-router/pull/15098))
|
|
8
|
+
- The unstable flag is no longer supported and will error during config resolution
|
|
9
|
+
|
|
10
|
+
- Log future flag warnings for upcoming React Router v8 flags ([#15029](https://github.com/remix-run/react-router/pull/15029))
|
|
11
|
+
- `v8_middleware`, `v8_splitRouteModules`, `v8_viteEnvironmentApi`, `v8_passThroughRequests`, `v8_trailingSlashAwareDataRequests`
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies:
|
|
16
|
+
- [`react-router@7.16.0`](https://github.com/remix-run/react-router/releases/tag/react-router@7.16.0)
|
|
17
|
+
- [`@react-router/node@7.16.0`](https://github.com/remix-run/react-router/releases/tag/@react-router/node@7.16.0)
|
|
18
|
+
- [`@react-router/serve@7.16.0`](https://github.com/remix-run/react-router/releases/tag/@react-router/serve@7.16.0)
|
|
19
|
+
|
|
3
20
|
## v7.15.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v0.0.0-experimental-
|
|
2
|
+
* @react-router/dev v0.0.0-experimental-8cee090e4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import { g as preloadVite, h as getVite } from "./typegen-DTHWSW2W.js";
|
|
12
12
|
//#region vite/build.ts
|
|
13
13
|
async function build(root, viteBuildOptions) {
|
|
14
14
|
await preloadVite();
|
package/dist/cli/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* @react-router/dev v0.0.0-experimental-
|
|
3
|
+
* @react-router/dev v0.0.0-experimental-8cee090e4
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) Remix Software Inc.
|
|
6
6
|
*
|
|
@@ -9,16 +9,15 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @license MIT
|
|
11
11
|
*/
|
|
12
|
-
import { l as loadConfig, n as watch, t as run$1 } from "../typegen-
|
|
13
|
-
import { i as preloadVite, r as getVite } from "../vite-oFg2Sopv.js";
|
|
12
|
+
import { g as preloadVite, h as getVite, l as loadConfig, n as watch, t as run$1 } from "../typegen-DTHWSW2W.js";
|
|
14
13
|
import { createRequire } from "node:module";
|
|
14
|
+
import fs, { existsSync } from "node:fs";
|
|
15
|
+
import * as path$1 from "node:path";
|
|
16
|
+
import path from "node:path";
|
|
15
17
|
import arg from "arg";
|
|
16
18
|
import semver from "semver";
|
|
17
19
|
import colors from "picocolors";
|
|
18
|
-
import fs, { existsSync } from "node:fs";
|
|
19
20
|
import { copyFile, readFile, writeFile } from "node:fs/promises";
|
|
20
|
-
import * as path$1 from "node:path";
|
|
21
|
-
import path from "node:path";
|
|
22
21
|
import exitHook from "exit-hook";
|
|
23
22
|
import { readPackageJSON } from "pkg-types";
|
|
24
23
|
import "react-router";
|
|
@@ -142,7 +141,7 @@ async function routes(rootDirectory, flags = {}) {
|
|
|
142
141
|
}
|
|
143
142
|
async function build(root, options = {}) {
|
|
144
143
|
root = resolveRootDirectory(root, options);
|
|
145
|
-
let { build } = await import("../build-
|
|
144
|
+
let { build } = await import("../build-B3Cfdu0l.js");
|
|
146
145
|
if (options.profile) await start();
|
|
147
146
|
try {
|
|
148
147
|
await build(root, options);
|
|
@@ -151,7 +150,7 @@ async function build(root, options = {}) {
|
|
|
151
150
|
}
|
|
152
151
|
}
|
|
153
152
|
async function dev(root, options = {}) {
|
|
154
|
-
let { dev } = await import("../dev
|
|
153
|
+
let { dev } = await import("../dev-CJPpPQeG.js");
|
|
155
154
|
if (options.profile) await start();
|
|
156
155
|
exitHook(() => stop(console.info));
|
|
157
156
|
root = resolveRootDirectory(root, options);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { i as RouteManifestEntry, n as RouteConfigEntry, r as RouteManifest } from "./routes-
|
|
2
|
+
import { i as RouteManifestEntry, n as RouteConfigEntry, r as RouteManifest } from "./routes-Kx8VZRs3.js";
|
|
3
3
|
import * as Vite from "vite";
|
|
4
4
|
|
|
5
5
|
//#region config/config.d.ts
|
|
@@ -39,7 +39,6 @@ type ServerBundlesBuildManifest = BaseBuildManifest & {
|
|
|
39
39
|
type ServerModuleFormat = "esm" | "cjs";
|
|
40
40
|
interface FutureConfig {
|
|
41
41
|
unstable_optimizeDeps: boolean;
|
|
42
|
-
unstable_trailingSlashAwareDataRequests: boolean;
|
|
43
42
|
}
|
|
44
43
|
type SplitRouteModulesOption = boolean | "enforce";
|
|
45
44
|
type BuildManifest = DefaultBuildManifest | ServerBundlesBuildManifest;
|
package/dist/config.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { i as ServerBundlesFunction, n as Preset, r as ReactRouterConfig, t as BuildManifest } from "./config-
|
|
3
|
-
export {
|
|
2
|
+
import { i as ServerBundlesFunction, n as Preset, r as ReactRouterConfig, t as BuildManifest } from "./config-DvmRcD4Z.js";
|
|
3
|
+
export type { BuildManifest, ReactRouterConfig as Config, Preset, ServerBundlesFunction };
|
package/dist/config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v0.0.0-experimental-
|
|
2
|
+
* @react-router/dev v0.0.0-experimental-8cee090e4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import { g as preloadVite, h as getVite } from "./typegen-DTHWSW2W.js";
|
|
12
12
|
import { n as start, r as stop, t as getSession } from "./cli/index.js";
|
|
13
13
|
import colors from "picocolors";
|
|
14
14
|
//#region vite/dev.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v0.0.0-experimental-
|
|
2
|
+
* @react-router/dev v0.0.0-experimental-8cee090e4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8,10 +8,17 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import { t as invariant } from "./invariant-BCP1NPJ8.js";
|
|
12
11
|
import * as Path from "pathe";
|
|
13
12
|
import pick from "lodash/pick.js";
|
|
14
13
|
import * as v from "valibot";
|
|
14
|
+
//#region invariant.ts
|
|
15
|
+
function invariant(value, message) {
|
|
16
|
+
if (value === false || value === null || typeof value === "undefined") {
|
|
17
|
+
console.error("The following error is a bug in React Router; please open an issue! https://github.com/remix-run/react-router/issues/new/choose");
|
|
18
|
+
throw new Error(message);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
15
22
|
//#region config/routes.ts
|
|
16
23
|
function setAppDirectory(directory) {
|
|
17
24
|
globalThis.__reactRouterAppDirectory = directory;
|
|
@@ -184,4 +191,4 @@ function joinRoutePaths(path1, path2) {
|
|
|
184
191
|
return [path1.replace(/\/+$/, ""), path2.replace(/^\/+/, "")].join("/");
|
|
185
192
|
}
|
|
186
193
|
//#endregion
|
|
187
|
-
export { prefix as a, setAppDirectory as c, layout as i, validateRouteConfig as l, getAppDirectory as n, relative as o, index as r, route as s, configRoutesToRouteManifest as t };
|
|
194
|
+
export { prefix as a, setAppDirectory as c, layout as i, validateRouteConfig as l, getAppDirectory as n, relative as o, index as r, route as s, configRoutesToRouteManifest as t, invariant as u };
|
package/dist/routes.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as getAppDirectory, c as prefix, l as relative, n as RouteConfigEntry, o as index, s as layout, t as RouteConfig, u as route } from "./routes-
|
|
2
|
+
import { a as getAppDirectory, c as prefix, l as relative, n as RouteConfigEntry, o as index, s as layout, t as RouteConfig, u as route } from "./routes-Kx8VZRs3.js";
|
|
3
3
|
export { type RouteConfig, type RouteConfigEntry, getAppDirectory, index, layout, prefix, relative, route };
|
package/dist/routes.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v0.0.0-experimental-
|
|
2
|
+
* @react-router/dev v0.0.0-experimental-8cee090e4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import { a as prefix, i as layout, n as getAppDirectory, o as relative, r as index, s as route } from "./routes-
|
|
11
|
+
import { a as prefix, i as layout, n as getAppDirectory, o as relative, r as index, s as route } from "./routes-sm_wl6yW.js";
|
|
12
12
|
export { getAppDirectory, index, layout, prefix, relative, route };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v0.0.0-experimental-
|
|
2
|
+
* @react-router/dev v0.0.0-experimental-8cee090e4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8,11 +8,10 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
12
|
-
import { c as setAppDirectory, l as validateRouteConfig, t as configRoutesToRouteManifest } from "./routes-DWLkrlkM.js";
|
|
11
|
+
import { c as setAppDirectory, l as validateRouteConfig, t as configRoutesToRouteManifest, u as invariant } from "./routes-sm_wl6yW.js";
|
|
13
12
|
import { createRequire } from "node:module";
|
|
14
|
-
import colors from "picocolors";
|
|
15
13
|
import fs from "node:fs";
|
|
14
|
+
import colors from "picocolors";
|
|
16
15
|
import fs$1 from "node:fs/promises";
|
|
17
16
|
import { readPackageJSON, sortPackage, updatePackage } from "pkg-types";
|
|
18
17
|
import { execSync } from "node:child_process";
|
|
@@ -41,6 +40,33 @@ var __exportAll = (all, no_symbols) => {
|
|
|
41
40
|
return target;
|
|
42
41
|
};
|
|
43
42
|
//#endregion
|
|
43
|
+
//#region config/is-react-router-repo.ts
|
|
44
|
+
const nodeRequire$2 = createRequire(import.meta.url);
|
|
45
|
+
function isReactRouterRepo() {
|
|
46
|
+
let serverRuntimePath = path.dirname(nodeRequire$2.resolve("@react-router/node/package.json"));
|
|
47
|
+
return path.basename(path.resolve(serverRuntimePath, "..")) === "packages";
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region vite/vite.ts
|
|
51
|
+
const nodeRequire$1 = createRequire(import.meta.url);
|
|
52
|
+
let vite;
|
|
53
|
+
const viteImportSpecifier = isReactRouterRepo() ? `file:///${path.normalize(nodeRequire$1.resolve("vite/package.json", { paths: [process.cwd()] })).replace("package.json", "dist/node/index.js")}` : "vite";
|
|
54
|
+
async function preloadVite() {
|
|
55
|
+
vite = await import(viteImportSpecifier);
|
|
56
|
+
}
|
|
57
|
+
function getVite() {
|
|
58
|
+
invariant(vite, "getVite() called before preloadVite()");
|
|
59
|
+
return vite;
|
|
60
|
+
}
|
|
61
|
+
function defineCompilerOptions(options) {
|
|
62
|
+
let vite = getVite();
|
|
63
|
+
return parseInt(vite.version.split(".")[0], 10) >= 8 ? { oxc: options.oxc } : { esbuild: options.esbuild };
|
|
64
|
+
}
|
|
65
|
+
function defineOptimizeDepsCompilerOptions(options) {
|
|
66
|
+
let vite = getVite();
|
|
67
|
+
return parseInt(vite.version.split(".")[0], 10) >= 8 ? { rolldownOptions: options.rolldown } : { esbuildOptions: options.esbuild };
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
44
70
|
//#region vite/ssr-externals.ts
|
|
45
71
|
const ssrExternals = isReactRouterRepo() ? [
|
|
46
72
|
"react-router",
|
|
@@ -52,15 +78,10 @@ const ssrExternals = isReactRouterRepo() ? [
|
|
|
52
78
|
"@react-router/serve"
|
|
53
79
|
] : void 0;
|
|
54
80
|
//#endregion
|
|
55
|
-
//#region vite/vite-
|
|
81
|
+
//#region vite/vite-runner.ts
|
|
56
82
|
async function createContext$1({ root, mode, customLogger }) {
|
|
57
83
|
await preloadVite();
|
|
58
84
|
const vite = getVite();
|
|
59
|
-
const [{ ViteNodeServer }, { ViteNodeRunner }, { installSourcemapsSupport }] = await Promise.all([
|
|
60
|
-
import("vite-node/server"),
|
|
61
|
-
import("vite-node/client"),
|
|
62
|
-
import("vite-node/source-map")
|
|
63
|
-
]);
|
|
64
85
|
const devServer = await vite.createServer({
|
|
65
86
|
root,
|
|
66
87
|
mode,
|
|
@@ -75,24 +96,21 @@ async function createContext$1({ root, mode, customLogger }) {
|
|
|
75
96
|
css: { postcss: {} },
|
|
76
97
|
configFile: false,
|
|
77
98
|
envFile: false,
|
|
78
|
-
plugins: []
|
|
99
|
+
plugins: [],
|
|
100
|
+
environments: { __config_loader: {
|
|
101
|
+
consumer: "server",
|
|
102
|
+
dev: { createEnvironment: (name, config, context) => vite.createRunnableDevEnvironment(name, config) }
|
|
103
|
+
} }
|
|
79
104
|
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
105
|
+
const environment = devServer.environments.__config_loader;
|
|
106
|
+
if (!vite.isRunnableDevEnvironment(environment)) {
|
|
107
|
+
await devServer.close();
|
|
108
|
+
throw new Error("React Router config loading requires Vite's __config_loader environment to be runnable.");
|
|
109
|
+
}
|
|
83
110
|
return {
|
|
84
111
|
devServer,
|
|
85
|
-
|
|
86
|
-
runner:
|
|
87
|
-
root: devServer.config.root,
|
|
88
|
-
base: devServer.config.base,
|
|
89
|
-
fetchModule(id) {
|
|
90
|
-
return server.fetchModule(id);
|
|
91
|
-
},
|
|
92
|
-
resolveId(id, importer) {
|
|
93
|
-
return server.resolveId(id, importer);
|
|
94
|
-
}
|
|
95
|
-
})
|
|
112
|
+
environment,
|
|
113
|
+
runner: environment.runner
|
|
96
114
|
};
|
|
97
115
|
}
|
|
98
116
|
//#endregion
|
|
@@ -168,11 +186,11 @@ function err(error) {
|
|
|
168
186
|
error
|
|
169
187
|
};
|
|
170
188
|
}
|
|
171
|
-
async function resolveConfig({ root,
|
|
189
|
+
async function resolveConfig({ root, viteRunnerContext, reactRouterConfigFile, skipRoutes, validateConfig }) {
|
|
172
190
|
let reactRouterUserConfig = {};
|
|
173
191
|
if (reactRouterConfigFile) try {
|
|
174
192
|
if (!fs.existsSync(reactRouterConfigFile)) return err(`${reactRouterConfigFile} no longer exists`);
|
|
175
|
-
let configModule = await
|
|
193
|
+
let configModule = await viteRunnerContext.runner.import(reactRouterConfigFile);
|
|
176
194
|
if (configModule.default === void 0) return err(`${reactRouterConfigFile} must provide a default export`);
|
|
177
195
|
if (typeof configModule.default !== "object") return err(`${reactRouterConfigFile} must export a config`);
|
|
178
196
|
reactRouterUserConfig = configModule.default;
|
|
@@ -235,7 +253,7 @@ async function resolveConfig({ root, viteNodeContext, reactRouterConfigFile, ski
|
|
|
235
253
|
try {
|
|
236
254
|
if (!routeConfigFile) return err(`Route config file not found at "${path.relative(root, path.join(appDirectory, "routes.ts"))}".`);
|
|
237
255
|
setAppDirectory(appDirectory);
|
|
238
|
-
let routeConfigExport = (await
|
|
256
|
+
let routeConfigExport = (await viteRunnerContext.runner.import(path.join(appDirectory, routeConfigFile))).default;
|
|
239
257
|
let result = validateRouteConfig({
|
|
240
258
|
routeConfigFile,
|
|
241
259
|
routeConfig: await routeConfigExport
|
|
@@ -260,12 +278,10 @@ async function resolveConfig({ root, viteNodeContext, reactRouterConfigFile, ski
|
|
|
260
278
|
if (futureConfig) {
|
|
261
279
|
if ("unstable_splitRouteModules" in futureConfig || "v8_splitRouteModules" in futureConfig) return err("The `future.v8_splitRouteModules` flag has been moved to a top-level `config.splitRouteModules` field (default `true`)");
|
|
262
280
|
if ("unstable_viteEnvironmentApi" in futureConfig || "v8_viteEnvironmentApi" in futureConfig) return err("The `future.v8_viteEnvironmentApi` flag has been removed because Vite Environment API usage is now always enabled");
|
|
281
|
+
if ("unstable_trailingSlashAwareDataRequests" in futureConfig || "v8_trailingSlashAwareDataRequests" in futureConfig) return err("The `future.v8_trailingSlashAwareDataRequests` flag has been removed because trailing slash-aware data requests are now the default behavior");
|
|
263
282
|
if ("unstable_subResourceIntegrity" in futureConfig) return err("The `future.unstable_subResourceIntegrity` flag has been stabilized and moved to a top-level `config.subResourceIntegrity` field");
|
|
264
283
|
}
|
|
265
|
-
let future = {
|
|
266
|
-
unstable_optimizeDeps: userAndPresetConfigs.future?.unstable_optimizeDeps ?? false,
|
|
267
|
-
unstable_trailingSlashAwareDataRequests: userAndPresetConfigs.future?.unstable_trailingSlashAwareDataRequests ?? false
|
|
268
|
-
};
|
|
284
|
+
let future = { unstable_optimizeDeps: userAndPresetConfigs.future?.unstable_optimizeDeps ?? false };
|
|
269
285
|
let allowedActionOrigins = userAndPresetConfigs.allowedActionOrigins ?? false;
|
|
270
286
|
let splitRouteModules = userAndPresetConfigs.splitRouteModules ?? true;
|
|
271
287
|
let subResourceIntegrity = userAndPresetConfigs.subResourceIntegrity ?? false;
|
|
@@ -293,7 +309,7 @@ async function resolveConfig({ root, viteNodeContext, reactRouterConfigFile, ski
|
|
|
293
309
|
async function createConfigLoader({ rootDirectory: root, watch, mode, skipRoutes, validateConfig }) {
|
|
294
310
|
root = path.normalize(root ?? process.env.REACT_ROUTER_ROOT ?? process.cwd());
|
|
295
311
|
let vite = await import("vite");
|
|
296
|
-
let
|
|
312
|
+
let viteRunnerContext = await createContext$1({
|
|
297
313
|
root,
|
|
298
314
|
mode,
|
|
299
315
|
customLogger: vite.createLogger("warn", { prefix: "[react-router]" })
|
|
@@ -305,7 +321,7 @@ async function createConfigLoader({ rootDirectory: root, watch, mode, skipRoutes
|
|
|
305
321
|
updateReactRouterConfigFile();
|
|
306
322
|
let getConfig = () => resolveConfig({
|
|
307
323
|
root,
|
|
308
|
-
|
|
324
|
+
viteRunnerContext,
|
|
309
325
|
reactRouterConfigFile,
|
|
310
326
|
skipRoutes,
|
|
311
327
|
validateConfig
|
|
@@ -342,9 +358,9 @@ async function createConfigLoader({ rootDirectory: root, watch, mode, skipRoutes
|
|
|
342
358
|
let rootRelativeFilepath = path.relative(root, filepath);
|
|
343
359
|
let configFileAddedOrRemoved = fileAddedOrRemoved && isEntryFile("react-router.config", rootRelativeFilepath);
|
|
344
360
|
if (configFileAddedOrRemoved) updateReactRouterConfigFile();
|
|
345
|
-
if (!(configFileAddedOrRemoved || Boolean(
|
|
346
|
-
|
|
347
|
-
|
|
361
|
+
if (!(configFileAddedOrRemoved || Boolean(viteRunnerContext.environment.moduleGraph.getModuleById(filepath))) && !appFileAddedOrRemoved) return;
|
|
362
|
+
viteRunnerContext.environment.moduleGraph.invalidateAll();
|
|
363
|
+
viteRunnerContext.runner.clearCache();
|
|
348
364
|
let result = await getConfig();
|
|
349
365
|
let prevAppDirectory = appDirectory;
|
|
350
366
|
appDirectory = path.normalize((result.value ?? currentConfig).appDirectory);
|
|
@@ -352,9 +368,9 @@ async function createConfigLoader({ rootDirectory: root, watch, mode, skipRoutes
|
|
|
352
368
|
fsWatcher.unwatch(prevAppDirectory);
|
|
353
369
|
fsWatcher.add(appDirectory);
|
|
354
370
|
}
|
|
355
|
-
let configCodeChanged = configFileAddedOrRemoved || reactRouterConfigFile !== void 0 && isEntryFileDependency(
|
|
371
|
+
let configCodeChanged = configFileAddedOrRemoved || reactRouterConfigFile !== void 0 && isEntryFileDependency(viteRunnerContext.environment.moduleGraph, reactRouterConfigFile, filepath);
|
|
356
372
|
let routeConfigFile = !skipRoutes ? findEntry(appDirectory, "routes", { absolute: true }) : void 0;
|
|
357
|
-
let routeConfigCodeChanged = routeConfigFile !== void 0 && isEntryFileDependency(
|
|
373
|
+
let routeConfigCodeChanged = routeConfigFile !== void 0 && isEntryFileDependency(viteRunnerContext.environment.moduleGraph, routeConfigFile, filepath);
|
|
358
374
|
let configChanged = result.ok && !isEqual(omitRoutes(currentConfig), omitRoutes(result.value));
|
|
359
375
|
let routeConfigChanged = result.ok && !isEqual(currentConfig?.routes, result.value.routes);
|
|
360
376
|
for (let handler of changeHandlers) handler({
|
|
@@ -375,7 +391,7 @@ async function createConfigLoader({ rootDirectory: root, watch, mode, skipRoutes
|
|
|
375
391
|
},
|
|
376
392
|
close: async () => {
|
|
377
393
|
changeHandlers = [];
|
|
378
|
-
await
|
|
394
|
+
await viteRunnerContext.devServer.close();
|
|
379
395
|
await fsWatcher?.close();
|
|
380
396
|
}
|
|
381
397
|
};
|
|
@@ -838,4 +854,4 @@ async function watch(rootDirectory, { mode, logger, rsc }) {
|
|
|
838
854
|
return { close: async () => await ctx.configLoader.close() };
|
|
839
855
|
}
|
|
840
856
|
//#endregion
|
|
841
|
-
export { t$1 as a, createConfigLoader as c, resolveRSCEntryFiles as d, ssrExternals as f, parse$1 as i, loadConfig as l, watch as n, traverse as o, generate as r, configRouteToBranchRoute as s, run as t, resolveEntryFiles as u };
|
|
857
|
+
export { t$1 as a, createConfigLoader as c, resolveRSCEntryFiles as d, ssrExternals as f, preloadVite as g, getVite as h, parse$1 as i, loadConfig as l, defineOptimizeDepsCompilerOptions as m, watch as n, traverse as o, defineCompilerOptions as p, generate as r, configRouteToBranchRoute as s, run as t, resolveEntryFiles as u };
|
package/dist/vite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v0.0.0-experimental-
|
|
2
|
+
* @react-router/dev v0.0.0-experimental-8cee090e4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8,15 +8,14 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import { a as t, c as createConfigLoader, d as resolveRSCEntryFiles, f as ssrExternals, i as parse$1, n as watch, o as traverse, r as generate, s as configRouteToBranchRoute, u as resolveEntryFiles } from "./typegen-
|
|
12
|
-
import {
|
|
13
|
-
import { i as preloadVite, n as defineOptimizeDepsCompilerOptions, r as getVite, t as defineCompilerOptions } from "./vite-oFg2Sopv.js";
|
|
11
|
+
import { a as t, c as createConfigLoader, d as resolveRSCEntryFiles, f as ssrExternals, g as preloadVite, h as getVite, i as parse$1, m as defineOptimizeDepsCompilerOptions, n as watch, o as traverse, p as defineCompilerOptions, r as generate, s as configRouteToBranchRoute, u as resolveEntryFiles } from "./typegen-DTHWSW2W.js";
|
|
12
|
+
import { u as invariant } from "./routes-sm_wl6yW.js";
|
|
14
13
|
import { createRequire } from "node:module";
|
|
15
|
-
import colors from "picocolors";
|
|
16
14
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
17
|
-
import { cp, mkdir, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
|
|
18
15
|
import * as path$2 from "node:path";
|
|
19
16
|
import path from "node:path";
|
|
17
|
+
import colors from "picocolors";
|
|
18
|
+
import { cp, mkdir, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
|
|
20
19
|
import { createRequestHandler, matchRoutes, unstable_setDevServerHooks } from "react-router";
|
|
21
20
|
import * as Path from "pathe";
|
|
22
21
|
import path$1, { join } from "pathe";
|
|
@@ -1173,6 +1172,13 @@ const reactRouterVitePlugin = () => {
|
|
|
1173
1172
|
let logger;
|
|
1174
1173
|
let firstLoad = true;
|
|
1175
1174
|
let ctx;
|
|
1175
|
+
let closePluginResources = async () => {
|
|
1176
|
+
await viteChildCompiler?.close();
|
|
1177
|
+
viteChildCompiler = null;
|
|
1178
|
+
await reactRouterConfigLoader.close();
|
|
1179
|
+
await (await typegenWatcherPromise)?.close();
|
|
1180
|
+
typegenWatcherPromise = void 0;
|
|
1181
|
+
};
|
|
1176
1182
|
/** Mutates `ctx` as a side effect */
|
|
1177
1183
|
let updatePluginContext = async () => {
|
|
1178
1184
|
let reactRouterConfig;
|
|
@@ -1523,19 +1529,23 @@ const reactRouterVitePlugin = () => {
|
|
|
1523
1529
|
async buildApp(builder) {
|
|
1524
1530
|
invariant(viteConfig);
|
|
1525
1531
|
viteConfig.logger.info("Using Vite Environment API");
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1532
|
+
try {
|
|
1533
|
+
let { reactRouterConfig } = ctx;
|
|
1534
|
+
await cleanBuildDirectory(viteConfig, ctx);
|
|
1535
|
+
await builder.build(builder.environments.client);
|
|
1536
|
+
let serverEnvironments = getServerEnvironmentValues(ctx, builder.environments);
|
|
1537
|
+
await Promise.all(serverEnvironments.map(builder.build));
|
|
1538
|
+
await cleanViteManifests(environments, ctx);
|
|
1539
|
+
let { buildManifest } = ctx;
|
|
1540
|
+
invariant(buildManifest, "Expected build manifest");
|
|
1541
|
+
await reactRouterConfig.buildEnd?.({
|
|
1542
|
+
buildManifest,
|
|
1543
|
+
reactRouterConfig,
|
|
1544
|
+
viteConfig
|
|
1545
|
+
});
|
|
1546
|
+
} finally {
|
|
1547
|
+
await closePluginResources();
|
|
1548
|
+
}
|
|
1539
1549
|
}
|
|
1540
1550
|
}
|
|
1541
1551
|
};
|
|
@@ -1604,7 +1614,9 @@ const reactRouterVitePlugin = () => {
|
|
|
1604
1614
|
});
|
|
1605
1615
|
},
|
|
1606
1616
|
processRequestError: (error) => {
|
|
1607
|
-
if (error instanceof Error)
|
|
1617
|
+
if (error instanceof Error) {
|
|
1618
|
+
if (!getVite().isRunnableDevEnvironment(viteDevServer.environments.ssr)) viteDevServer.ssrFixStacktrace(error);
|
|
1619
|
+
}
|
|
1608
1620
|
}
|
|
1609
1621
|
});
|
|
1610
1622
|
reactRouterConfigLoader.onChange(async ({ result, configCodeChanged, routeConfigCodeChanged, configChanged, routeConfigChanged }) => {
|
|
@@ -1786,9 +1798,7 @@ const reactRouterVitePlugin = () => {
|
|
|
1786
1798
|
if (handledAssetPaths.length) viteConfig.logger.info("");
|
|
1787
1799
|
} },
|
|
1788
1800
|
async buildEnd() {
|
|
1789
|
-
await
|
|
1790
|
-
await reactRouterConfigLoader.close();
|
|
1791
|
-
await (await typegenWatcherPromise)?.close();
|
|
1801
|
+
if (viteConfig?.command !== "build") await closePluginResources();
|
|
1792
1802
|
}
|
|
1793
1803
|
},
|
|
1794
1804
|
{
|
|
@@ -2629,7 +2639,8 @@ function getPrerenderConcurrencyConfig$1(reactRouterConfig) {
|
|
|
2629
2639
|
return concurrency;
|
|
2630
2640
|
}
|
|
2631
2641
|
function createDataRequest(prerenderPath, reactRouterConfig, onlyRoutes, isResourceRoute) {
|
|
2632
|
-
let
|
|
2642
|
+
let dataRequestPath = prerenderPath.endsWith("/") ? `${prerenderPath}_.data` : `${prerenderPath}.data`;
|
|
2643
|
+
let normalizedPath = `${reactRouterConfig.basename}${dataRequestPath}`.replace(/\/\/+/g, "/");
|
|
2633
2644
|
let url = new URL(`http://localhost${normalizedPath}`);
|
|
2634
2645
|
if (onlyRoutes?.length) url.searchParams.set("_routes", onlyRoutes.join(","));
|
|
2635
2646
|
return {
|
|
@@ -2977,6 +2988,11 @@ ${result}`;
|
|
|
2977
2988
|
}
|
|
2978
2989
|
};
|
|
2979
2990
|
}
|
|
2991
|
+
function createClientRouteModuleForOptimizeDepsScan(code) {
|
|
2992
|
+
const ast = parse$1(code, { sourceType: "module" });
|
|
2993
|
+
removeExports(ast, SERVER_ROUTE_EXPORTS);
|
|
2994
|
+
return generate(ast);
|
|
2995
|
+
}
|
|
2980
2996
|
function createId(id, type, value) {
|
|
2981
2997
|
let [base, ...rest] = id.split("?");
|
|
2982
2998
|
const searchParams = new URLSearchParams(rest.join("?"));
|
|
@@ -3182,6 +3198,11 @@ function reactRouterRSCVitePlugin() {
|
|
|
3182
3198
|
logger = (await import("vite")).createLogger(viteUserConfig.logLevel, { prefix: "[react-router]" });
|
|
3183
3199
|
entries = await resolveRSCEntryFiles({ reactRouterConfig: config });
|
|
3184
3200
|
let viteNormalizePath = (await import("vite")).normalizePath;
|
|
3201
|
+
let optimizeDepsEntries = getOptimizeDepsEntries({
|
|
3202
|
+
entryClientFilePath: entries.client,
|
|
3203
|
+
reactRouterConfig: config
|
|
3204
|
+
});
|
|
3205
|
+
let routeFiles = new Set(Object.values(config.routes).map((route) => resolveRelativeRouteFilePath(route, config)));
|
|
3185
3206
|
return {
|
|
3186
3207
|
resolve: { dedupe: [
|
|
3187
3208
|
"react",
|
|
@@ -3198,12 +3219,15 @@ function reactRouterRSCVitePlugin() {
|
|
|
3198
3219
|
}) ? ["react-server-dom-webpack"] : []
|
|
3199
3220
|
] },
|
|
3200
3221
|
optimizeDeps: {
|
|
3201
|
-
entries:
|
|
3202
|
-
entryClientFilePath: entries.client,
|
|
3203
|
-
reactRouterConfig: config
|
|
3204
|
-
}),
|
|
3222
|
+
entries: optimizeDepsEntries,
|
|
3205
3223
|
...defineOptimizeDepsCompilerOptions({
|
|
3206
|
-
rolldown: {
|
|
3224
|
+
rolldown: {
|
|
3225
|
+
transform: { jsx: "react-jsx" },
|
|
3226
|
+
plugins: config.future.unstable_optimizeDeps ? [createRSCOptimizeDepsRouteModulesPlugin({
|
|
3227
|
+
routeFiles,
|
|
3228
|
+
transformToJs
|
|
3229
|
+
})] : []
|
|
3230
|
+
},
|
|
3207
3231
|
esbuild: { jsx: "automatic" }
|
|
3208
3232
|
}),
|
|
3209
3233
|
include: [
|
|
@@ -3219,9 +3243,7 @@ function reactRouterRSCVitePlugin() {
|
|
|
3219
3243
|
"react-router",
|
|
3220
3244
|
"react-router/dom",
|
|
3221
3245
|
"react-router/internal/react-server-client"
|
|
3222
|
-
]
|
|
3223
|
-
"react-router > cookie",
|
|
3224
|
-
"react-router > set-cookie-parser"
|
|
3246
|
+
]
|
|
3225
3247
|
]
|
|
3226
3248
|
},
|
|
3227
3249
|
...defineCompilerOptions({
|
|
@@ -3332,8 +3354,11 @@ format: config.serverModuleFormat }
|
|
|
3332
3354
|
};
|
|
3333
3355
|
}
|
|
3334
3356
|
},
|
|
3335
|
-
|
|
3336
|
-
|
|
3357
|
+
buildApp: {
|
|
3358
|
+
order: "post",
|
|
3359
|
+
async handler() {
|
|
3360
|
+
await configLoader.close();
|
|
3361
|
+
}
|
|
3337
3362
|
}
|
|
3338
3363
|
},
|
|
3339
3364
|
(() => {
|
|
@@ -3536,6 +3561,25 @@ function invalidateVirtualModules(viteDevServer) {
|
|
|
3536
3561
|
function getRootDirectory(viteUserConfig) {
|
|
3537
3562
|
return viteUserConfig.root ?? process.env.REACT_ROUTER_ROOT ?? process.cwd();
|
|
3538
3563
|
}
|
|
3564
|
+
const jsRouteModuleRE = /\.[cm]?[jt]sx?$/;
|
|
3565
|
+
function createRSCOptimizeDepsRouteModulesPlugin({ routeFiles, transformToJs }) {
|
|
3566
|
+
return {
|
|
3567
|
+
name: "react-router:rsc-optimize-deps-route-modules",
|
|
3568
|
+
transform: {
|
|
3569
|
+
filter: { id: jsRouteModuleRE },
|
|
3570
|
+
async handler(code, id) {
|
|
3571
|
+
let filename = id.split("?")[0];
|
|
3572
|
+
let normalizedFilename = getVite().normalizePath(filename);
|
|
3573
|
+
if (!routeFiles.has(normalizedFilename)) return;
|
|
3574
|
+
return {
|
|
3575
|
+
code: createClientRouteModuleForOptimizeDepsScan(await transformToJs(code, filename)).code,
|
|
3576
|
+
map: null,
|
|
3577
|
+
moduleType: "js"
|
|
3578
|
+
};
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3581
|
+
};
|
|
3582
|
+
}
|
|
3539
3583
|
const getClientBuildDirectory = (reactRouterConfig) => path$1.join(reactRouterConfig.buildDirectory, "client");
|
|
3540
3584
|
function getPrerenderConcurrencyConfig(reactRouterConfig) {
|
|
3541
3585
|
let concurrency = 1;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-router/dev",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-experimental-
|
|
4
|
+
"version": "0.0.0-experimental-8cee090e4",
|
|
5
5
|
"description": "Dev tools and CLI for React Router",
|
|
6
6
|
"homepage": "https://reactrouter.com",
|
|
7
7
|
"bugs": {
|
|
@@ -62,19 +62,19 @@
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@babel/core": "^7.29.
|
|
66
|
-
"@babel/generator": "^7.29.
|
|
67
|
-
"@babel/parser": "^7.29.
|
|
68
|
-
"@babel/plugin-syntax-jsx": "^7.
|
|
69
|
-
"@babel/preset-typescript": "^7.
|
|
70
|
-
"@babel/traverse": "^7.29.
|
|
71
|
-
"@babel/types": "^7.29.
|
|
72
|
-
"@remix-run/node-fetch-server": "^0.13.
|
|
65
|
+
"@babel/core": "^7.29.7",
|
|
66
|
+
"@babel/generator": "^7.29.7",
|
|
67
|
+
"@babel/parser": "^7.29.7",
|
|
68
|
+
"@babel/plugin-syntax-jsx": "^7.29.7",
|
|
69
|
+
"@babel/preset-typescript": "^7.29.7",
|
|
70
|
+
"@babel/traverse": "^7.29.7",
|
|
71
|
+
"@babel/types": "^7.29.7",
|
|
72
|
+
"@remix-run/node-fetch-server": "^0.13.3",
|
|
73
73
|
"arg": "^5.0.1",
|
|
74
74
|
"babel-dead-code-elimination": "^1.0.12",
|
|
75
75
|
"chokidar": "^5.0.0",
|
|
76
76
|
"dedent": "^1.7.2",
|
|
77
|
-
"es-module-lexer": "^2.
|
|
77
|
+
"es-module-lexer": "^2.1.0",
|
|
78
78
|
"exit-hook": "5.1.0",
|
|
79
79
|
"isbot": "^5.1.40",
|
|
80
80
|
"jsesc": "3.1.0",
|
|
@@ -84,46 +84,43 @@
|
|
|
84
84
|
"picocolors": "^1.1.1",
|
|
85
85
|
"pkg-types": "^2.3.1",
|
|
86
86
|
"prettier": "^3.8.3",
|
|
87
|
-
"react-refresh": "^0.
|
|
88
|
-
"semver": "^7.8.
|
|
89
|
-
"tinyglobby": "^0.2.
|
|
90
|
-
"valibot": "^1.4.
|
|
91
|
-
"
|
|
92
|
-
"@react-router/node": "0.0.0-experimental-ce4015162"
|
|
87
|
+
"react-refresh": "^0.18.0",
|
|
88
|
+
"semver": "^7.8.1",
|
|
89
|
+
"tinyglobby": "^0.2.16",
|
|
90
|
+
"valibot": "^1.4.1",
|
|
91
|
+
"@react-router/node": "0.0.0-experimental-8cee090e4"
|
|
93
92
|
},
|
|
94
93
|
"devDependencies": {
|
|
95
94
|
"@types/babel__core": "^7.20.5",
|
|
96
95
|
"@types/babel__generator": "^7.27.0",
|
|
97
96
|
"@types/babel__traverse": "^7.28.0",
|
|
98
97
|
"@types/dedent": "^0.7.0",
|
|
99
|
-
"@types/
|
|
100
|
-
"@types/jest": "^29.5.4",
|
|
98
|
+
"@types/jest": "^30.0.0",
|
|
101
99
|
"@types/jsesc": "^3.0.1",
|
|
102
100
|
"@types/lodash": "^4.17.24",
|
|
103
|
-
"@types/node": "^22.19.
|
|
101
|
+
"@types/node": "^22.19.19",
|
|
104
102
|
"@types/npmcli__package-json": "^4.0.0",
|
|
105
103
|
"@types/semver": "^7.7.1",
|
|
106
|
-
"@vitejs/plugin-rsc": "~0.5.
|
|
104
|
+
"@vitejs/plugin-rsc": "~0.5.26",
|
|
107
105
|
"esbuild-register": "^3.6.0",
|
|
108
106
|
"execa": "9.6.1",
|
|
109
|
-
"express": "^4.19.2",
|
|
110
107
|
"fast-glob": "3.3.3",
|
|
111
|
-
"tsdown": "^0.
|
|
108
|
+
"tsdown": "^0.22.0",
|
|
112
109
|
"typescript": "^6.0.3",
|
|
113
110
|
"vite": "^7.0.0",
|
|
114
|
-
"wireit": "0.14.
|
|
115
|
-
"wrangler": "^4.
|
|
116
|
-
"@react-router/serve": "0.0.0-experimental-
|
|
117
|
-
"react-router": "^0.0.0-experimental-
|
|
111
|
+
"wireit": "0.14.12",
|
|
112
|
+
"wrangler": "^4.95.0",
|
|
113
|
+
"@react-router/serve": "0.0.0-experimental-8cee090e4",
|
|
114
|
+
"react-router": "^0.0.0-experimental-8cee090e4"
|
|
118
115
|
},
|
|
119
116
|
"peerDependencies": {
|
|
120
|
-
"@vitejs/plugin-rsc": "~0.5.
|
|
117
|
+
"@vitejs/plugin-rsc": "~0.5.26",
|
|
121
118
|
"react-server-dom-webpack": "^19.2.6",
|
|
122
119
|
"typescript": "^5.1.0 || ^6.0.0",
|
|
123
120
|
"vite": "^7.0.0 || ^8.0.0",
|
|
124
121
|
"wrangler": "^4.0.0",
|
|
125
|
-
"
|
|
126
|
-
"react-router": "^0.0.0-experimental-
|
|
122
|
+
"react-router": "^0.0.0-experimental-8cee090e4",
|
|
123
|
+
"@react-router/serve": "^0.0.0-experimental-8cee090e4"
|
|
127
124
|
},
|
|
128
125
|
"peerDependenciesMeta": {
|
|
129
126
|
"@vitejs/plugin-rsc": {
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @react-router/dev v0.0.0-experimental-ce4015162
|
|
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
|
-
//#region invariant.ts
|
|
12
|
-
function invariant(value, message) {
|
|
13
|
-
if (value === false || value === null || typeof value === "undefined") {
|
|
14
|
-
console.error("The following error is a bug in React Router; please open an issue! https://github.com/remix-run/react-router/issues/new/choose");
|
|
15
|
-
throw new Error(message);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
//#endregion
|
|
19
|
-
export { invariant as t };
|
package/dist/vite-oFg2Sopv.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @react-router/dev v0.0.0-experimental-ce4015162
|
|
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
|
-
import { t as invariant } from "./invariant-BCP1NPJ8.js";
|
|
12
|
-
import { createRequire } from "node:module";
|
|
13
|
-
import path from "pathe";
|
|
14
|
-
//#region config/is-react-router-repo.ts
|
|
15
|
-
const nodeRequire$1 = createRequire(import.meta.url);
|
|
16
|
-
function isReactRouterRepo() {
|
|
17
|
-
let serverRuntimePath = path.dirname(nodeRequire$1.resolve("@react-router/node/package.json"));
|
|
18
|
-
return path.basename(path.resolve(serverRuntimePath, "..")) === "packages";
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region vite/vite.ts
|
|
22
|
-
const nodeRequire = createRequire(import.meta.url);
|
|
23
|
-
let vite;
|
|
24
|
-
const viteImportSpecifier = isReactRouterRepo() ? `file:///${path.normalize(nodeRequire.resolve("vite/package.json", { paths: [process.cwd()] })).replace("package.json", "dist/node/index.js")}` : "vite";
|
|
25
|
-
async function preloadVite() {
|
|
26
|
-
vite = await import(viteImportSpecifier);
|
|
27
|
-
}
|
|
28
|
-
function getVite() {
|
|
29
|
-
invariant(vite, "getVite() called before preloadVite()");
|
|
30
|
-
return vite;
|
|
31
|
-
}
|
|
32
|
-
function defineCompilerOptions(options) {
|
|
33
|
-
let vite = getVite();
|
|
34
|
-
return parseInt(vite.version.split(".")[0], 10) >= 8 ? { oxc: options.oxc } : { esbuild: options.esbuild };
|
|
35
|
-
}
|
|
36
|
-
function defineOptimizeDepsCompilerOptions(options) {
|
|
37
|
-
let vite = getVite();
|
|
38
|
-
return parseInt(vite.version.split(".")[0], 10) >= 8 ? { rolldownOptions: options.rolldown } : { esbuildOptions: options.esbuild };
|
|
39
|
-
}
|
|
40
|
-
//#endregion
|
|
41
|
-
export { isReactRouterRepo as a, preloadVite as i, defineOptimizeDepsCompilerOptions as n, getVite as r, defineCompilerOptions as t };
|
|
File without changes
|