@react-router/dev 7.0.0-pre.2 → 7.0.0-pre.3
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 +11 -0
- package/dist/cli/index.d.ts +2 -1
- package/dist/cli/index.js +1352 -8
- package/dist/routes.d.ts +4 -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 +1 -1
- package/dist/vite/cloudflare.js +171 -5
- package/dist/vite.d.ts +2 -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.d.ts +0 -129
- 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/routes.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export { RouteConfig, RouteConfigEntry, getAppDirectory, index, layout, prefix, relative, route } from './config/routes.ts';
|
|
2
|
+
import './vite/config.ts';
|
|
3
|
+
import './vite/plugin.ts';
|
|
4
|
+
import './vite/cloudflare-dev-proxy.ts';
|
package/dist/routes.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v7.0.0-pre.
|
|
2
|
+
* @react-router/dev v7.0.0-pre.3
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8,17 +8,187 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
"use strict";
|
|
12
|
+
var __create = Object.create;
|
|
13
|
+
var __defProp = Object.defineProperty;
|
|
14
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
15
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
16
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
17
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
18
|
+
var __export = (target, all) => {
|
|
19
|
+
for (var name in all)
|
|
20
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
21
|
+
};
|
|
22
|
+
var __copyProps = (to, from, except, desc) => {
|
|
23
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
24
|
+
for (let key of __getOwnPropNames(from))
|
|
25
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
26
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
27
|
+
}
|
|
28
|
+
return to;
|
|
29
|
+
};
|
|
30
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
31
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
32
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
33
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
34
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
35
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
36
|
+
mod
|
|
37
|
+
));
|
|
38
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
12
39
|
|
|
13
|
-
|
|
40
|
+
// routes.ts
|
|
41
|
+
var routes_exports = {};
|
|
42
|
+
__export(routes_exports, {
|
|
43
|
+
getAppDirectory: () => getAppDirectory,
|
|
44
|
+
index: () => index,
|
|
45
|
+
layout: () => layout,
|
|
46
|
+
prefix: () => prefix,
|
|
47
|
+
relative: () => relative,
|
|
48
|
+
route: () => route
|
|
49
|
+
});
|
|
50
|
+
module.exports = __toCommonJS(routes_exports);
|
|
14
51
|
|
|
15
|
-
|
|
52
|
+
// config/routes.ts
|
|
53
|
+
var import_node_path = require("path");
|
|
54
|
+
var v = __toESM(require("valibot"));
|
|
55
|
+
var import_pick = __toESM(require("lodash/pick"));
|
|
16
56
|
|
|
57
|
+
// invariant.ts
|
|
58
|
+
function invariant(value, message) {
|
|
59
|
+
if (value === false || value === null || typeof value === "undefined") {
|
|
60
|
+
console.error(
|
|
61
|
+
"The following error is a bug in React Router; please open an issue! https://github.com/remix-run/react-router/issues/new/choose"
|
|
62
|
+
);
|
|
63
|
+
throw new Error(message);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
17
66
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
67
|
+
// config/routes.ts
|
|
68
|
+
function getAppDirectory() {
|
|
69
|
+
invariant(globalThis.__reactRouterAppDirectory);
|
|
70
|
+
return globalThis.__reactRouterAppDirectory;
|
|
71
|
+
}
|
|
72
|
+
var routeConfigEntrySchema = v.pipe(
|
|
73
|
+
v.custom((value) => {
|
|
74
|
+
return !(typeof value === "object" && value !== null && "then" in value && "catch" in value);
|
|
75
|
+
}, "Invalid type: Expected object but received a promise. Did you forget to await?"),
|
|
76
|
+
v.object({
|
|
77
|
+
id: v.optional(v.string()),
|
|
78
|
+
path: v.optional(v.string()),
|
|
79
|
+
index: v.optional(v.boolean()),
|
|
80
|
+
caseSensitive: v.optional(v.boolean()),
|
|
81
|
+
file: v.string(),
|
|
82
|
+
children: v.optional(v.array(v.lazy(() => routeConfigEntrySchema)))
|
|
83
|
+
})
|
|
84
|
+
);
|
|
85
|
+
var resolvedRouteConfigSchema = v.array(routeConfigEntrySchema);
|
|
86
|
+
var createConfigRouteOptionKeys = [
|
|
87
|
+
"id",
|
|
88
|
+
"index",
|
|
89
|
+
"caseSensitive"
|
|
90
|
+
];
|
|
91
|
+
function route(path, file, optionsOrChildren, children) {
|
|
92
|
+
let options = {};
|
|
93
|
+
if (Array.isArray(optionsOrChildren) || !optionsOrChildren) {
|
|
94
|
+
children = optionsOrChildren;
|
|
95
|
+
} else {
|
|
96
|
+
options = optionsOrChildren;
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
file,
|
|
100
|
+
children,
|
|
101
|
+
path: path ?? void 0,
|
|
102
|
+
...(0, import_pick.default)(options, createConfigRouteOptionKeys)
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
var createIndexOptionKeys = ["id"];
|
|
106
|
+
function index(file, options) {
|
|
107
|
+
return {
|
|
108
|
+
file,
|
|
109
|
+
index: true,
|
|
110
|
+
...(0, import_pick.default)(options, createIndexOptionKeys)
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
var createLayoutOptionKeys = ["id"];
|
|
114
|
+
function layout(file, optionsOrChildren, children) {
|
|
115
|
+
let options = {};
|
|
116
|
+
if (Array.isArray(optionsOrChildren) || !optionsOrChildren) {
|
|
117
|
+
children = optionsOrChildren;
|
|
118
|
+
} else {
|
|
119
|
+
options = optionsOrChildren;
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
file,
|
|
123
|
+
children,
|
|
124
|
+
...(0, import_pick.default)(options, createLayoutOptionKeys)
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function prefix(prefixPath, routes) {
|
|
128
|
+
return routes.map((route2) => {
|
|
129
|
+
if (route2.index || typeof route2.path === "string") {
|
|
130
|
+
return {
|
|
131
|
+
...route2,
|
|
132
|
+
path: route2.path ? joinRoutePaths(prefixPath, route2.path) : prefixPath,
|
|
133
|
+
children: route2.children
|
|
134
|
+
};
|
|
135
|
+
} else if (route2.children) {
|
|
136
|
+
return {
|
|
137
|
+
...route2,
|
|
138
|
+
children: prefix(prefixPath, route2.children)
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
return route2;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function relative(directory) {
|
|
145
|
+
return {
|
|
146
|
+
/**
|
|
147
|
+
* Helper function for creating a route config entry, for use within
|
|
148
|
+
* `routes.ts`. Note that this helper has been scoped, meaning that file
|
|
149
|
+
* path will be resolved relative to the directory provided to the
|
|
150
|
+
* `relative` call that created this helper.
|
|
151
|
+
*/
|
|
152
|
+
route: (path, file, ...rest) => {
|
|
153
|
+
return route(path, (0, import_node_path.resolve)(directory, file), ...rest);
|
|
154
|
+
},
|
|
155
|
+
/**
|
|
156
|
+
* Helper function for creating a route config entry for an index route, for
|
|
157
|
+
* use within `routes.ts`. Note that this helper has been scoped, meaning
|
|
158
|
+
* that file path will be resolved relative to the directory provided to the
|
|
159
|
+
* `relative` call that created this helper.
|
|
160
|
+
*/
|
|
161
|
+
index: (file, ...rest) => {
|
|
162
|
+
return index((0, import_node_path.resolve)(directory, file), ...rest);
|
|
163
|
+
},
|
|
164
|
+
/**
|
|
165
|
+
* Helper function for creating a route config entry for a layout route, for
|
|
166
|
+
* use within `routes.ts`. Note that this helper has been scoped, meaning
|
|
167
|
+
* that file path will be resolved relative to the directory provided to the
|
|
168
|
+
* `relative` call that created this helper.
|
|
169
|
+
*/
|
|
170
|
+
layout: (file, ...rest) => {
|
|
171
|
+
return layout((0, import_node_path.resolve)(directory, file), ...rest);
|
|
172
|
+
},
|
|
173
|
+
// Passthrough of helper functions that don't need relative scoping so that
|
|
174
|
+
// a complete API is still provided.
|
|
175
|
+
prefix
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function joinRoutePaths(path1, path2) {
|
|
179
|
+
return [
|
|
180
|
+
path1.replace(/\/+$/, ""),
|
|
181
|
+
// Remove trailing slashes
|
|
182
|
+
path2.replace(/^\/+/, "")
|
|
183
|
+
// Remove leading slashes
|
|
184
|
+
].join("/");
|
|
185
|
+
}
|
|
186
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
187
|
+
0 && (module.exports = {
|
|
188
|
+
getAppDirectory,
|
|
189
|
+
index,
|
|
190
|
+
layout,
|
|
191
|
+
prefix,
|
|
192
|
+
relative,
|
|
193
|
+
route
|
|
194
|
+
});
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import ts from 'typescript/lib/tsserverlibrary';
|
|
2
|
+
|
|
3
|
+
declare function init(): {
|
|
3
4
|
create: (info: ts.server.PluginCreateInfo) => ts.LanguageService;
|
|
4
5
|
};
|
|
6
|
+
|
|
7
|
+
export { init as default };
|