@react-router/dev 0.0.0-experimental-3bba3331c → 0.0.0-experimental-07f9b5e04
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/cli/commands.js +1 -1
- package/dist/cli/detectPackageManager.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/run.js +1 -1
- package/dist/cli/useJavascript.js +1 -1
- package/dist/colors.js +1 -1
- package/dist/config/format.js +1 -1
- package/dist/config/routes.js +1 -1
- package/dist/invariant.js +1 -1
- package/dist/routes.js +1 -1
- package/dist/typescript/plugin.js +1 -1
- package/dist/typescript/typegen.js +17 -12
- package/dist/vite/babel.js +1 -1
- package/dist/vite/build.js +1 -1
- package/dist/vite/cloudflare-dev-proxy.js +1 -1
- package/dist/vite/cloudflare.js +1 -1
- package/dist/vite/combine-urls.js +1 -1
- package/dist/vite/config.js +1 -1
- package/dist/vite/dev.js +1 -1
- package/dist/vite/import-vite-esm-sync.js +1 -1
- package/dist/vite/node-adapter.js +1 -1
- package/dist/vite/plugin.js +9 -8
- package/dist/vite/profiler.js +1 -1
- package/dist/vite/remove-exports.js +1 -1
- package/dist/vite/resolve-file-url.js +1 -1
- package/dist/vite/static/refresh-utils.cjs +16 -15
- package/dist/vite/styles.js +1 -1
- package/dist/vite/vite-node.js +1 -1
- package/dist/vite/vmod.js +1 -1
- package/dist/vite/with-props.js +1 -1
- package/dist/vite.js +1 -1
- package/package.json +6 -6
package/dist/cli/commands.js
CHANGED
package/dist/cli/index.js
CHANGED
package/dist/cli/run.js
CHANGED
package/dist/colors.js
CHANGED
package/dist/config/format.js
CHANGED
package/dist/config/routes.js
CHANGED
package/dist/invariant.js
CHANGED
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-07f9b5e04
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -55,7 +55,9 @@ function getPath(ctx, route) {
|
|
|
55
55
|
async function watch(ctx) {
|
|
56
56
|
const appDirectory = Path__namespace.normalize(ctx.appDirectory);
|
|
57
57
|
const routesTsPath = Path__namespace.join(appDirectory, "routes.ts");
|
|
58
|
-
const routesViteNodeContext = await viteNode.createContext(
|
|
58
|
+
const routesViteNodeContext = await viteNode.createContext({
|
|
59
|
+
root: ctx.rootDirectory
|
|
60
|
+
});
|
|
59
61
|
async function getRoutes() {
|
|
60
62
|
routesViteNodeContext.devServer.moduleGraph.invalidateAll();
|
|
61
63
|
routesViteNodeContext.runner.moduleCache.clear();
|
|
@@ -88,6 +90,7 @@ async function writeAll(ctx, routes) {
|
|
|
88
90
|
force: true
|
|
89
91
|
});
|
|
90
92
|
Object.values(routes).forEach(route => {
|
|
93
|
+
if (!fs__default["default"].existsSync(Path__namespace.join(ctx.appDirectory, route.file))) return;
|
|
91
94
|
const typesPath = getPath(ctx, route);
|
|
92
95
|
const content = getModule(routes, route);
|
|
93
96
|
fs__default["default"].mkdirSync(Path__namespace.dirname(typesPath), {
|
|
@@ -98,24 +101,26 @@ async function writeAll(ctx, routes) {
|
|
|
98
101
|
}
|
|
99
102
|
function getModule(routes, route) {
|
|
100
103
|
return dedent__default["default"]`
|
|
101
|
-
//
|
|
104
|
+
// React Router generated types for route:
|
|
105
|
+
// ${route.file}
|
|
106
|
+
|
|
102
107
|
import * as T from "react-router/types"
|
|
103
108
|
|
|
104
109
|
export type Params = {${formattedParamsProperties(routes, route)}}
|
|
105
110
|
|
|
106
111
|
type Route = typeof import("./${Pathe__namespace.filename(route.file)}")
|
|
107
112
|
|
|
108
|
-
export type LoaderData = T.
|
|
109
|
-
export type ActionData = T.
|
|
113
|
+
export type LoaderData = T.CreateLoaderData<Route>
|
|
114
|
+
export type ActionData = T.CreateActionData<Route>
|
|
110
115
|
|
|
111
|
-
export type LoaderArgs = T.
|
|
112
|
-
export type ClientLoaderArgs = T.
|
|
113
|
-
export type ActionArgs = T.
|
|
114
|
-
export type ClientActionArgs = T.
|
|
116
|
+
export type LoaderArgs = T.CreateServerLoaderArgs<Params>
|
|
117
|
+
export type ClientLoaderArgs = T.CreateClientLoaderArgs<Params, Route>
|
|
118
|
+
export type ActionArgs = T.CreateServerActionArgs<Params>
|
|
119
|
+
export type ClientActionArgs = T.CreateClientActionArgs<Params, Route>
|
|
115
120
|
|
|
116
|
-
export type HydrateFallbackProps = T.
|
|
117
|
-
export type DefaultProps = T.
|
|
118
|
-
export type ErrorBoundaryProps = T.
|
|
121
|
+
export type HydrateFallbackProps = T.CreateHydrateFallbackProps<Params>
|
|
122
|
+
export type DefaultProps = T.CreateDefaultProps<Params, LoaderData, ActionData>
|
|
123
|
+
export type ErrorBoundaryProps = T.CreateErrorBoundaryProps<Params, LoaderData, ActionData>
|
|
119
124
|
`;
|
|
120
125
|
}
|
|
121
126
|
function formattedParamsProperties(routes, route) {
|
package/dist/vite/babel.js
CHANGED
package/dist/vite/build.js
CHANGED
package/dist/vite/cloudflare.js
CHANGED
package/dist/vite/config.js
CHANGED
package/dist/vite/dev.js
CHANGED
package/dist/vite/plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v0.0.0-experimental-
|
|
2
|
+
* @react-router/dev v0.0.0-experimental-07f9b5e04
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -428,7 +428,7 @@ const reactRouterVitePlugin = _config => {
|
|
|
428
428
|
...nonFingerprintedValues
|
|
429
429
|
};
|
|
430
430
|
// Write the browser manifest to disk as part of the build process
|
|
431
|
-
await writeFileSafe(path__namespace.join(getClientBuildDirectory(ctx.reactRouterConfig), manifestPath), `window.
|
|
431
|
+
await writeFileSafe(path__namespace.join(getClientBuildDirectory(ctx.reactRouterConfig), manifestPath), `window.__reactRouterManifest=${JSON.stringify(reactRouterBrowserManifest)};`);
|
|
432
432
|
// The server manifest is the same as the browser manifest, except for
|
|
433
433
|
// server bundle builds which only includes routes for the current bundle,
|
|
434
434
|
// otherwise the server and client have the same routes
|
|
@@ -655,7 +655,7 @@ const reactRouterVitePlugin = _config => {
|
|
|
655
655
|
// disk from the child compiler. This is important in the
|
|
656
656
|
// production build because the child compiler is a Vite dev
|
|
657
657
|
// server and will generate incorrect manifests.
|
|
658
|
-
.filter(plugin => typeof plugin === "object" && plugin !== null && "name" in plugin && plugin.name !== "react-router" && plugin.name !== "react-router-hmr-updates")]
|
|
658
|
+
.filter(plugin => typeof plugin === "object" && plugin !== null && "name" in plugin && plugin.name !== "react-router" && plugin.name !== "react-router-route-exports" && plugin.name !== "react-router-hmr-updates")]
|
|
659
659
|
});
|
|
660
660
|
await viteChildCompiler.pluginContainer.buildStart({});
|
|
661
661
|
},
|
|
@@ -836,7 +836,7 @@ const reactRouterVitePlugin = _config => {
|
|
|
836
836
|
let reactRouterManifestString = jsesc__default["default"](reactRouterManifest, {
|
|
837
837
|
es6: true
|
|
838
838
|
});
|
|
839
|
-
return `window.
|
|
839
|
+
return `window.__reactRouterManifest=${reactRouterManifestString};`;
|
|
840
840
|
}
|
|
841
841
|
}
|
|
842
842
|
}
|
|
@@ -895,10 +895,9 @@ const reactRouterVitePlugin = _config => {
|
|
|
895
895
|
}, withProps.plugin, {
|
|
896
896
|
name: "react-router-route-exports",
|
|
897
897
|
async transform(code, id, options) {
|
|
898
|
-
if (options !== null && options !== void 0 && options.ssr) return;
|
|
899
898
|
let route = getRoute(ctx.reactRouterConfig, id);
|
|
900
899
|
if (!route) return;
|
|
901
|
-
if (!ctx.reactRouterConfig.ssr) {
|
|
900
|
+
if (!(options !== null && options !== void 0 && options.ssr) && !ctx.reactRouterConfig.ssr) {
|
|
902
901
|
let serverOnlyExports = esModuleLexer.parse(code)[1].map(exp => exp.n).filter(exp => SERVER_ONLY_ROUTE_EXPORTS.includes(exp));
|
|
903
902
|
if (serverOnlyExports.length > 0) {
|
|
904
903
|
let str = serverOnlyExports.map(e => `\`${e}\``).join(", ");
|
|
@@ -917,7 +916,9 @@ const reactRouterVitePlugin = _config => {
|
|
|
917
916
|
let ast = parser.parse(code, {
|
|
918
917
|
sourceType: "module"
|
|
919
918
|
});
|
|
920
|
-
|
|
919
|
+
if (!(options !== null && options !== void 0 && options.ssr)) {
|
|
920
|
+
removeExports.removeExports(ast, SERVER_ONLY_ROUTE_EXPORTS);
|
|
921
|
+
}
|
|
921
922
|
withProps.transform(ast);
|
|
922
923
|
return babel.generate(ast, {
|
|
923
924
|
sourceMaps: true,
|
|
@@ -1242,7 +1243,7 @@ function validatePrerenderedResponse(response, html, prefix, path) {
|
|
|
1242
1243
|
}
|
|
1243
1244
|
}
|
|
1244
1245
|
function validatePrerenderedHtml(html, prefix) {
|
|
1245
|
-
if (!html.includes("window.
|
|
1246
|
+
if (!html.includes("window.__reactRouterContext =") || !html.includes("window.__reactRouterRouteModules =")) {
|
|
1246
1247
|
throw new Error(`${prefix}: Did you forget to include <Scripts/> in your root route? ` + "Your pre-rendered HTML files cannot hydrate without `<Scripts />`.");
|
|
1247
1248
|
}
|
|
1248
1249
|
}
|
package/dist/vite/profiler.js
CHANGED
|
@@ -13,7 +13,7 @@ function debounce(fn, delay) {
|
|
|
13
13
|
const enqueueUpdate = debounce(async () => {
|
|
14
14
|
let manifest;
|
|
15
15
|
if (routeUpdates.size > 0) {
|
|
16
|
-
manifest = JSON.parse(JSON.stringify(
|
|
16
|
+
manifest = JSON.parse(JSON.stringify(__reactRouterManifest));
|
|
17
17
|
|
|
18
18
|
for (let route of routeUpdates.values()) {
|
|
19
19
|
manifest.routes[route.id] = route;
|
|
@@ -28,18 +28,19 @@ const enqueueUpdate = debounce(async () => {
|
|
|
28
28
|
// react-refresh takes care of updating these in-place,
|
|
29
29
|
// if we don't preserve existing values we'll loose state.
|
|
30
30
|
default: imported.default
|
|
31
|
-
? window.
|
|
31
|
+
? window.__reactRouterRouteModules[route.id]?.default ??
|
|
32
|
+
imported.default
|
|
32
33
|
: imported.default,
|
|
33
34
|
ErrorBoundary: imported.ErrorBoundary
|
|
34
|
-
? window.
|
|
35
|
+
? window.__reactRouterRouteModules[route.id]?.ErrorBoundary ??
|
|
35
36
|
imported.ErrorBoundary
|
|
36
37
|
: imported.ErrorBoundary,
|
|
37
38
|
HydrateFallback: imported.HydrateFallback
|
|
38
|
-
? window.
|
|
39
|
+
? window.__reactRouterRouteModules[route.id]?.HydrateFallback ??
|
|
39
40
|
imported.HydrateFallback
|
|
40
41
|
: imported.HydrateFallback,
|
|
41
42
|
};
|
|
42
|
-
window.
|
|
43
|
+
window.__reactRouterRouteModules[route.id] = routeModule;
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
let needsRevalidation = new Set(
|
|
@@ -48,27 +49,27 @@ const enqueueUpdate = debounce(async () => {
|
|
|
48
49
|
.map((route) => route.id)
|
|
49
50
|
);
|
|
50
51
|
|
|
51
|
-
let routes =
|
|
52
|
+
let routes = __reactRouterInstance.createRoutesForHMR(
|
|
52
53
|
needsRevalidation,
|
|
53
54
|
manifest.routes,
|
|
54
|
-
window.
|
|
55
|
-
window.
|
|
56
|
-
window.
|
|
55
|
+
window.__reactRouterRouteModules,
|
|
56
|
+
window.__reactRouterContext.future,
|
|
57
|
+
window.__reactRouterContext.isSpaMode
|
|
57
58
|
);
|
|
58
|
-
|
|
59
|
+
__reactRouterInstance._internalSetRoutes(routes);
|
|
59
60
|
routeUpdates.clear();
|
|
60
61
|
window.__reactRouterRouteModuleUpdates.clear();
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
try {
|
|
64
|
-
window.
|
|
65
|
-
await
|
|
65
|
+
window.__reactRouterHdrActive = true;
|
|
66
|
+
await __reactRouterInstance.revalidate();
|
|
66
67
|
} finally {
|
|
67
|
-
window.
|
|
68
|
+
window.__reactRouterHdrActive = false;
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
if (manifest) {
|
|
71
|
-
Object.assign(window.
|
|
72
|
+
Object.assign(window.__reactRouterManifest, manifest);
|
|
72
73
|
}
|
|
73
74
|
exports.performReactRefresh();
|
|
74
75
|
}, 16);
|
|
@@ -152,7 +153,7 @@ const routeUpdates = new Map();
|
|
|
152
153
|
window.__reactRouterRouteModuleUpdates = new Map();
|
|
153
154
|
|
|
154
155
|
import.meta.hot.on("react-router:hmr", async ({ route }) => {
|
|
155
|
-
window.
|
|
156
|
+
window.__reactRouterClearCriticalCss();
|
|
156
157
|
|
|
157
158
|
if (route) {
|
|
158
159
|
routeUpdates.set(route.id, route);
|
package/dist/vite/styles.js
CHANGED
package/dist/vite/vite-node.js
CHANGED
package/dist/vite/vmod.js
CHANGED
package/dist/vite/with-props.js
CHANGED
package/dist/vite.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-router/dev",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-07f9b5e04",
|
|
4
4
|
"description": "Dev tools and CLI for React Router",
|
|
5
5
|
"homepage": "https://reactrouter.com",
|
|
6
6
|
"bugs": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"set-cookie-parser": "^2.6.0",
|
|
62
62
|
"valibot": "^0.41.0",
|
|
63
63
|
"vite-node": "^1.6.0",
|
|
64
|
-
"@react-router/node": "0.0.0-experimental-
|
|
64
|
+
"@react-router/node": "0.0.0-experimental-07f9b5e04"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/babel__core": "^7.20.5",
|
|
@@ -87,15 +87,15 @@
|
|
|
87
87
|
"tiny-invariant": "^1.2.0",
|
|
88
88
|
"vite": "^5.1.0",
|
|
89
89
|
"wrangler": "^3.28.2",
|
|
90
|
-
"@react-router/serve": "0.0.0-experimental-
|
|
91
|
-
"react-router": "^0.0.0-experimental-
|
|
90
|
+
"@react-router/serve": "0.0.0-experimental-07f9b5e04",
|
|
91
|
+
"react-router": "^0.0.0-experimental-07f9b5e04"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"typescript": "^5.1.0",
|
|
95
95
|
"vite": "^5.1.0",
|
|
96
96
|
"wrangler": "^3.28.2",
|
|
97
|
-
"@react-router/serve": "^0.0.0-experimental-
|
|
98
|
-
"react-router": "^0.0.0-experimental-
|
|
97
|
+
"@react-router/serve": "^0.0.0-experimental-07f9b5e04",
|
|
98
|
+
"react-router": "^0.0.0-experimental-07f9b5e04"
|
|
99
99
|
},
|
|
100
100
|
"peerDependenciesMeta": {
|
|
101
101
|
"@react-router/serve": {
|