@react-router/dev 0.0.0-experimental-49eef6a01 → 0.0.0-experimental-a26b992a1

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.
Files changed (55) hide show
  1. package/bin.js +1 -1
  2. package/dist/cli/commands.js +1 -1
  3. package/dist/cli/detectPackageManager.js +1 -1
  4. package/dist/cli/index.d.ts +1 -1
  5. package/dist/cli/index.js +7 -6
  6. package/dist/cli/run.js +1 -1
  7. package/dist/cli/useJavascript.js +1 -1
  8. package/dist/colors.js +1 -1
  9. package/dist/config/defaults/entry.client.tsx +1 -1
  10. package/dist/config/format.js +1 -1
  11. package/dist/config/routes.d.ts +77 -50
  12. package/dist/config/routes.js +175 -43
  13. package/dist/invariant.js +1 -1
  14. package/dist/routes.d.ts +2 -0
  15. package/dist/routes.js +23 -0
  16. package/dist/vite/babel.d.ts +10 -10
  17. package/dist/vite/babel.js +1 -1
  18. package/dist/vite/build.js +2 -2
  19. package/dist/vite/cloudflare-dev-proxy.d.ts +7 -1
  20. package/dist/vite/cloudflare-dev-proxy.js +23 -7
  21. package/dist/vite/cloudflare.d.ts +1 -0
  22. package/dist/vite/cloudflare.js +19 -0
  23. package/dist/vite/combine-urls.d.ts +1 -0
  24. package/dist/vite/combine-urls.js +20 -0
  25. package/dist/{config.d.ts → vite/config.d.ts} +15 -27
  26. package/dist/{config.js → vite/config.js} +62 -45
  27. package/dist/vite/dev.js +1 -1
  28. package/dist/vite/import-vite-esm-sync.js +1 -1
  29. package/dist/vite/node-adapter.js +1 -1
  30. package/dist/vite/plugin.d.ts +6 -3
  31. package/dist/vite/plugin.js +145 -121
  32. package/dist/vite/profiler.js +1 -1
  33. package/dist/vite/remove-exports.d.ts +2 -2
  34. package/dist/vite/remove-exports.js +113 -243
  35. package/dist/vite/resolve-file-url.js +1 -1
  36. package/dist/vite/static/refresh-utils.cjs +7 -26
  37. package/dist/vite/styles.d.ts +3 -2
  38. package/dist/vite/styles.js +23 -2
  39. package/dist/vite/vmod.js +1 -1
  40. package/dist/vite/with-props.d.ts +4 -0
  41. package/dist/vite/with-props.js +151 -0
  42. package/dist/vite.d.ts +2 -0
  43. package/dist/{cli.js → vite.js} +7 -8
  44. package/package.json +21 -12
  45. package/dist/config/findConfig.d.ts +0 -1
  46. package/dist/config/findConfig.js +0 -32
  47. package/dist/config/flatRoutes.d.ts +0 -14
  48. package/dist/config/flatRoutes.js +0 -418
  49. package/dist/index.d.ts +0 -4
  50. package/dist/index.js +0 -23
  51. package/dist/vite/define-route.d.ts +0 -5
  52. package/dist/vite/define-route.js +0 -207
  53. package/dist/vite/index.d.ts +0 -3
  54. package/dist/vite/index.js +0 -31
  55. /package/dist/{cli.d.ts → vite/combine-urls-test.d.ts} +0 -0
package/bin.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- require("./dist/cli");
2
+ require("./dist/cli/index");
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-49eef6a01
2
+ * @react-router/dev v0.0.0-experimental-a26b992a1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-49eef6a01
2
+ * @react-router/dev v0.0.0-experimental-a26b992a1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1 +1 @@
1
- export { run } from "./run";
1
+ export {};
package/dist/cli/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-49eef6a01
2
+ * @react-router/dev v0.0.0-experimental-a26b992a1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -10,10 +10,11 @@
10
10
  */
11
11
  'use strict';
12
12
 
13
- Object.defineProperty(exports, '__esModule', { value: true });
14
-
15
13
  var run = require('./run.js');
16
14
 
17
-
18
-
19
- exports.run = run.run;
15
+ run.run().then(() => {
16
+ process.exit(0);
17
+ }, error => {
18
+ if (error) console.error(error);
19
+ process.exit(1);
20
+ });
package/dist/cli/run.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-49eef6a01
2
+ * @react-router/dev v0.0.0-experimental-a26b992a1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-49eef6a01
2
+ * @react-router/dev v0.0.0-experimental-a26b992a1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/colors.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-49eef6a01
2
+ * @react-router/dev v0.0.0-experimental-a26b992a1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,6 +1,6 @@
1
1
  import { startTransition, StrictMode } from "react";
2
2
  import { hydrateRoot } from "react-dom/client";
3
- import { HydratedRouter } from "react-router";
3
+ import { HydratedRouter } from "react-router/dom";
4
4
 
5
5
  startTransition(() => {
6
6
  hydrateRoot(
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-49eef6a01
2
+ * @react-router/dev v0.0.0-experimental-a26b992a1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,8 +1,11 @@
1
+ import * as v from "valibot";
2
+ export declare function setAppDirectory(directory: string): void;
1
3
  /**
2
- * A route that was created using `defineRoutes` or created conventionally from
3
- * looking at the files on the filesystem.
4
+ * Provides the absolute path to the app directory, for use within `routes.ts`.
5
+ * This is designed to support resolving file system routes.
4
6
  */
5
- export interface ConfigRoute {
7
+ export declare function getAppDirectory(): string;
8
+ export interface RouteManifestEntry {
6
9
  /**
7
10
  * The path this route uses to match on the URL pathname.
8
11
  */
@@ -32,67 +35,91 @@ export interface ConfigRoute {
32
35
  file: string;
33
36
  }
34
37
  export interface RouteManifest {
35
- [routeId: string]: ConfigRoute;
38
+ [routeId: string]: RouteManifestEntry;
36
39
  }
37
- export interface DefineRouteOptions {
38
- /**
39
- * Should be `true` if the route `path` is case-sensitive. Defaults to
40
- * `false`.
41
- */
42
- caseSensitive?: boolean;
40
+ /**
41
+ * Configuration for an individual route, for use within `routes.ts`. As a
42
+ * convenience, route config entries can be created with the {@link route},
43
+ * {@link index} and {@link layout} helper functions.
44
+ */
45
+ export interface RouteConfigEntry {
43
46
  /**
44
- * Should be `true` if this is an index route that does not allow child routes.
47
+ * The unique id for this route.
45
48
  */
46
- index?: boolean;
49
+ id?: string;
47
50
  /**
48
- * An optional unique id string for this route. Use this if you need to aggregate
49
- * two or more routes with the same route file.
51
+ * The path this route uses to match on the URL pathname.
50
52
  */
51
- id?: string;
52
- }
53
- interface DefineRouteChildren {
54
- (): void;
55
- }
56
- /**
57
- * A function for defining a route that is passed as the argument to the
58
- * `defineRoutes` callback.
59
- *
60
- * Calls to this function are designed to be nested, using the `children`
61
- * callback argument.
62
- *
63
- * defineRoutes(route => {
64
- * route('/', 'pages/layout', () => {
65
- * route('react-router', 'pages/react-router');
66
- * route('reach-ui', 'pages/reach-ui');
67
- * });
68
- * });
69
- */
70
- export interface DefineRouteFunction {
71
- (
53
+ path?: string;
72
54
  /**
73
- * The path this route uses to match the URL pathname.
55
+ * Should be `true` if it is an index route. This disallows child routes.
74
56
  */
75
- path: string | undefined,
57
+ index?: boolean;
76
58
  /**
77
- * The path to the file that exports the React component rendered by this
78
- * route as its default export, relative to the `app` directory.
59
+ * Should be `true` if the `path` is case-sensitive. Defaults to `false`.
79
60
  */
80
- file: string,
61
+ caseSensitive?: boolean;
81
62
  /**
82
- * Options for defining routes, or a function for defining child routes.
63
+ * The path to the entry point for this route, relative to
64
+ * `config.appDirectory`.
83
65
  */
84
- optionsOrChildren?: DefineRouteOptions | DefineRouteChildren,
66
+ file: string;
85
67
  /**
86
- * A function for defining child routes.
68
+ * The child routes.
87
69
  */
88
- children?: DefineRouteChildren): void;
70
+ children?: RouteConfigEntry[];
89
71
  }
90
- export type DefineRoutesFunction = typeof defineRoutes;
72
+ export declare const routeConfigEntrySchema: v.BaseSchema<RouteConfigEntry, any, v.BaseIssue<unknown>>;
73
+ export declare const resolvedRouteConfigSchema: v.ArraySchema<v.BaseSchema<RouteConfigEntry, any, v.BaseIssue<unknown>>, undefined>;
74
+ type ResolvedRouteConfig = v.InferInput<typeof resolvedRouteConfigSchema>;
75
+ /**
76
+ * Route config to be exported via the `routes` export within `routes.ts`.
77
+ */
78
+ export type RouteConfig = ResolvedRouteConfig | Promise<ResolvedRouteConfig>;
79
+ export declare function validateRouteConfig({ routeConfigFile, routeConfig, }: {
80
+ routeConfigFile: string;
81
+ routeConfig: unknown;
82
+ }): {
83
+ valid: false;
84
+ message: string;
85
+ } | {
86
+ valid: true;
87
+ };
88
+ declare const createConfigRouteOptionKeys: ["id", "index", "caseSensitive"];
89
+ type CreateRouteOptions = Pick<RouteConfigEntry, (typeof createConfigRouteOptionKeys)[number]>;
90
+ /**
91
+ * Helper function for creating a route config entry, for use within
92
+ * `routes.ts`.
93
+ */
94
+ declare function createRoute(path: string | null | undefined, file: string, children?: RouteConfigEntry[]): RouteConfigEntry;
95
+ declare function createRoute(path: string | null | undefined, file: string, options: CreateRouteOptions, children?: RouteConfigEntry[]): RouteConfigEntry;
96
+ declare const createIndexOptionKeys: ["id"];
97
+ type CreateIndexOptions = Pick<RouteConfigEntry, (typeof createIndexOptionKeys)[number]>;
98
+ /**
99
+ * Helper function for creating a route config entry for an index route, for use
100
+ * within `routes.ts`.
101
+ */
102
+ declare function createIndex(file: string, options?: CreateIndexOptions): RouteConfigEntry;
103
+ declare const createLayoutOptionKeys: ["id"];
104
+ type CreateLayoutOptions = Pick<RouteConfigEntry, (typeof createLayoutOptionKeys)[number]>;
105
+ /**
106
+ * Helper function for creating a route config entry for a layout route, for use
107
+ * within `routes.ts`.
108
+ */
109
+ declare function createLayout(file: string, children?: RouteConfigEntry[]): RouteConfigEntry;
110
+ declare function createLayout(file: string, options: CreateLayoutOptions, children?: RouteConfigEntry[]): RouteConfigEntry;
111
+ export declare const route: typeof createRoute;
112
+ export declare const index: typeof createIndex;
113
+ export declare const layout: typeof createLayout;
91
114
  /**
92
- * A function for defining routes programmatically, instead of using the
93
- * filesystem convention.
115
+ * Creates a set of route config helpers that resolve file paths relative to the
116
+ * given directory, for use within `routes.ts`. This is designed to support
117
+ * splitting route config into multiple files within different directories.
94
118
  */
95
- export declare function defineRoutes(callback: (defineRoute: DefineRouteFunction) => void): RouteManifest;
96
- export declare function createRouteId(file: string): string;
97
- export declare function normalizeSlashes(file: string): string;
119
+ export declare function relative(directory: string): {
120
+ route: typeof route;
121
+ index: typeof index;
122
+ layout: typeof layout;
123
+ };
124
+ export declare function configRoutesToRouteManifest(routes: RouteConfigEntry[], rootId?: string): RouteManifest;
98
125
  export {};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-49eef6a01
2
+ * @react-router/dev v0.0.0-experimental-a26b992a1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -13,6 +13,11 @@
13
13
  Object.defineProperty(exports, '__esModule', { value: true });
14
14
 
15
15
  var path = require('node:path');
16
+ var v = require('valibot');
17
+ var pick = require('lodash/pick');
18
+ var invariant = require('../invariant.js');
19
+
20
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
21
 
17
22
  function _interopNamespace(e) {
18
23
  if (e && e.__esModule) return e;
@@ -32,62 +37,189 @@ function _interopNamespace(e) {
32
37
  return Object.freeze(n);
33
38
  }
34
39
 
35
- var path__namespace = /*#__PURE__*/_interopNamespace(path);
40
+ var v__namespace = /*#__PURE__*/_interopNamespace(v);
41
+ var pick__default = /*#__PURE__*/_interopDefaultLegacy(pick);
36
42
 
43
+ let appDirectory;
44
+ function setAppDirectory(directory) {
45
+ appDirectory = directory;
46
+ }
37
47
  /**
38
- * A function for defining routes programmatically, instead of using the
39
- * filesystem convention.
48
+ * Provides the absolute path to the app directory, for use within `routes.ts`.
49
+ * This is designed to support resolving file system routes.
40
50
  */
41
- function defineRoutes(callback) {
42
- let routes = Object.create(null);
43
- let parentRoutes = [];
44
- let alreadyReturned = false;
45
- let defineRoute = (path, file, optionsOrChildren, children) => {
46
- if (alreadyReturned) {
47
- throw new Error("You tried to define routes asynchronously but started defining " + "routes before the async work was done. Please await all async " + "data before calling `defineRoutes()`");
48
- }
49
- let options;
50
- if (typeof optionsOrChildren === "function") {
51
- // route(path, file, children)
52
- options = {};
53
- children = optionsOrChildren;
54
- } else {
55
- // route(path, file, options, children)
56
- // route(path, file, options)
57
- options = optionsOrChildren || {};
51
+ function getAppDirectory() {
52
+ invariant["default"](appDirectory);
53
+ return appDirectory;
54
+ }
55
+ const routeConfigEntrySchema = v__namespace.pipe(v__namespace.custom(value => {
56
+ return !(typeof value === "object" && value !== null && "then" in value && "catch" in value);
57
+ }, "Invalid type: Expected object but received a promise. Did you forget to await?"), v__namespace.object({
58
+ id: v__namespace.optional(v__namespace.string()),
59
+ path: v__namespace.optional(v__namespace.string()),
60
+ index: v__namespace.optional(v__namespace.boolean()),
61
+ caseSensitive: v__namespace.optional(v__namespace.boolean()),
62
+ file: v__namespace.string(),
63
+ children: v__namespace.optional(v__namespace.array(v__namespace.lazy(() => routeConfigEntrySchema)))
64
+ }));
65
+ const resolvedRouteConfigSchema = v__namespace.array(routeConfigEntrySchema);
66
+ function validateRouteConfig({
67
+ routeConfigFile,
68
+ routeConfig
69
+ }) {
70
+ if (!routeConfig) {
71
+ return {
72
+ valid: false,
73
+ message: `No "routes" export defined in "${routeConfigFile}.`
74
+ };
75
+ }
76
+ if (!Array.isArray(routeConfig)) {
77
+ return {
78
+ valid: false,
79
+ message: `Route config in "${routeConfigFile}" must be an array.`
80
+ };
81
+ }
82
+ let {
83
+ issues
84
+ } = v__namespace.safeParse(resolvedRouteConfigSchema, routeConfig);
85
+ if (issues !== null && issues !== void 0 && issues.length) {
86
+ let {
87
+ root,
88
+ nested
89
+ } = v__namespace.flatten(issues);
90
+ return {
91
+ valid: false,
92
+ message: [`Route config in "${routeConfigFile}" is invalid.`, root ? `${root}` : [], nested ? Object.entries(nested).map(([path, message]) => `Path: routes.${path}\n${message}`) : []].flat().join("\n\n")
93
+ };
94
+ }
95
+ return {
96
+ valid: true
97
+ };
98
+ }
99
+ const createConfigRouteOptionKeys = ["id", "index", "caseSensitive"];
100
+ function createRoute(path, file, optionsOrChildren, children) {
101
+ let options = {};
102
+ if (Array.isArray(optionsOrChildren) || !optionsOrChildren) {
103
+ children = optionsOrChildren;
104
+ } else {
105
+ options = optionsOrChildren;
106
+ }
107
+ return {
108
+ file,
109
+ children,
110
+ path: path ?? undefined,
111
+ ...pick__default["default"](options, createConfigRouteOptionKeys)
112
+ };
113
+ }
114
+ const createIndexOptionKeys = ["id"];
115
+ /**
116
+ * Helper function for creating a route config entry for an index route, for use
117
+ * within `routes.ts`.
118
+ */
119
+ function createIndex(file, options) {
120
+ return {
121
+ file,
122
+ index: true,
123
+ ...pick__default["default"](options, createIndexOptionKeys)
124
+ };
125
+ }
126
+ const createLayoutOptionKeys = ["id"];
127
+ function createLayout(file, optionsOrChildren, children) {
128
+ let options = {};
129
+ if (Array.isArray(optionsOrChildren) || !optionsOrChildren) {
130
+ children = optionsOrChildren;
131
+ } else {
132
+ options = optionsOrChildren;
133
+ }
134
+ return {
135
+ file,
136
+ children,
137
+ ...pick__default["default"](options, createLayoutOptionKeys)
138
+ };
139
+ }
140
+ const route = createRoute;
141
+ const index = createIndex;
142
+ const layout = createLayout;
143
+ /**
144
+ * Creates a set of route config helpers that resolve file paths relative to the
145
+ * given directory, for use within `routes.ts`. This is designed to support
146
+ * splitting route config into multiple files within different directories.
147
+ */
148
+ function relative(directory) {
149
+ return {
150
+ /**
151
+ * Helper function for creating a route config entry, for use within
152
+ * `routes.ts`. Note that this helper has been scoped, meaning that file
153
+ * path will be resolved relative to the directory provided to the
154
+ * `relative` call that created this helper.
155
+ */
156
+ route: (path$1, file, ...rest) => {
157
+ return route(path$1, path.resolve(directory, file), ...rest);
158
+ },
159
+ /**
160
+ * Helper function for creating a route config entry for an index route, for
161
+ * use within `routes.ts`. Note that this helper has been scoped, meaning
162
+ * that file path will be resolved relative to the directory provided to the
163
+ * `relative` call that created this helper.
164
+ */
165
+ index: (file, ...rest) => {
166
+ return index(path.resolve(directory, file), ...rest);
167
+ },
168
+ /**
169
+ * Helper function for creating a route config entry for a layout route, for
170
+ * use within `routes.ts`. Note that this helper has been scoped, meaning
171
+ * that file path will be resolved relative to the directory provided to the
172
+ * `relative` call that created this helper.
173
+ */
174
+ layout: (file, ...rest) => {
175
+ return layout(path.resolve(directory, file), ...rest);
58
176
  }
59
- let route = {
60
- path: path ? path : undefined,
61
- index: options.index ? true : undefined,
62
- caseSensitive: options.caseSensitive ? true : undefined,
63
- id: options.id || createRouteId(file),
64
- parentId: parentRoutes.length > 0 ? parentRoutes[parentRoutes.length - 1].id : "root",
65
- file
177
+ };
178
+ }
179
+ function configRoutesToRouteManifest(routes, rootId = "root") {
180
+ let routeManifest = {};
181
+ function walk(route, parentId) {
182
+ let id = route.id || createRouteId(route.file);
183
+ let manifestItem = {
184
+ id,
185
+ parentId,
186
+ file: route.file,
187
+ path: route.path,
188
+ index: route.index,
189
+ caseSensitive: route.caseSensitive
66
190
  };
67
- if (route.id in routes) {
68
- throw new Error(`Unable to define routes with duplicate route id: "${route.id}"`);
191
+ if (routeManifest.hasOwnProperty(id)) {
192
+ throw new Error(`Unable to define routes with duplicate route id: "${id}"`);
69
193
  }
70
- routes[route.id] = route;
71
- if (children) {
72
- parentRoutes.push(route);
73
- children();
74
- parentRoutes.pop();
194
+ routeManifest[id] = manifestItem;
195
+ if (route.children) {
196
+ for (let child of route.children) {
197
+ walk(child, id);
198
+ }
75
199
  }
76
- };
77
- callback(defineRoute);
78
- alreadyReturned = true;
79
- return routes;
200
+ }
201
+ for (let route of routes) {
202
+ walk(route, rootId);
203
+ }
204
+ return routeManifest;
80
205
  }
81
206
  function createRouteId(file) {
82
207
  return normalizeSlashes(stripFileExtension(file));
83
208
  }
84
209
  function normalizeSlashes(file) {
85
- return file.split(path__namespace.win32.sep).join("/");
210
+ return file.split(path.win32.sep).join("/");
86
211
  }
87
212
  function stripFileExtension(file) {
88
213
  return file.replace(/\.[a-z0-9]+$/i, "");
89
214
  }
90
215
 
91
- exports.createRouteId = createRouteId;
92
- exports.defineRoutes = defineRoutes;
93
- exports.normalizeSlashes = normalizeSlashes;
216
+ exports.configRoutesToRouteManifest = configRoutesToRouteManifest;
217
+ exports.getAppDirectory = getAppDirectory;
218
+ exports.index = index;
219
+ exports.layout = layout;
220
+ exports.relative = relative;
221
+ exports.resolvedRouteConfigSchema = resolvedRouteConfigSchema;
222
+ exports.route = route;
223
+ exports.routeConfigEntrySchema = routeConfigEntrySchema;
224
+ exports.setAppDirectory = setAppDirectory;
225
+ exports.validateRouteConfig = validateRouteConfig;
package/dist/invariant.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-49eef6a01
2
+ * @react-router/dev v0.0.0-experimental-a26b992a1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -0,0 +1,2 @@
1
+ export type { RouteConfig, RouteConfigEntry } from "./config/routes";
2
+ export { route, index, layout, relative, getAppDirectory, } from "./config/routes";
package/dist/routes.js ADDED
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @react-router/dev v0.0.0-experimental-a26b992a1
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 routes = require('./config/routes.js');
16
+
17
+
18
+
19
+ exports.getAppDirectory = routes.getAppDirectory;
20
+ exports.index = routes.index;
21
+ exports.layout = routes.layout;
22
+ exports.relative = routes.relative;
23
+ exports.route = routes.route;
@@ -1,20 +1,20 @@
1
1
  import type { NodePath } from "@babel/traverse";
2
- import type { types as BabelTypes } from "@babel/core";
3
- import { parse } from "@babel/parser";
2
+ import type { types as Babel } from "@babel/core";
3
+ import { parse, type ParseResult } from "@babel/parser";
4
4
  import * as t from "@babel/types";
5
5
  declare const traverse: {
6
- <S>(parent: BabelTypes.Node, opts: import("@babel/traverse").TraverseOptions<S>, scope: import("@babel/traverse").Scope | undefined, state: S, parentPath?: NodePath<BabelTypes.Node> | undefined): void;
7
- (parent: BabelTypes.Node, opts?: import("@babel/traverse").TraverseOptions<BabelTypes.Node> | undefined, scope?: import("@babel/traverse").Scope | undefined, state?: any, parentPath?: NodePath<BabelTypes.Node> | undefined): void;
6
+ <S>(parent: Babel.Node, opts: import("@babel/traverse").TraverseOptions<S>, scope: import("@babel/traverse").Scope | undefined, state: S, parentPath?: NodePath<Babel.Node> | undefined): void;
7
+ (parent: Babel.Node, opts?: import("@babel/traverse").TraverseOptions<Babel.Node> | undefined, scope?: import("@babel/traverse").Scope | undefined, state?: any, parentPath?: NodePath<Babel.Node> | undefined): void;
8
8
  visitors: typeof import("@babel/traverse").visitors;
9
9
  verify: typeof import("@babel/traverse").visitors.verify;
10
10
  explode: typeof import("@babel/traverse").visitors.explode;
11
- cheap: (node: BabelTypes.Node, enter: (node: BabelTypes.Node) => void) => void;
12
- node: (node: BabelTypes.Node, opts: import("@babel/traverse").TraverseOptions<BabelTypes.Node>, scope?: import("@babel/traverse").Scope | undefined, state?: any, path?: NodePath<BabelTypes.Node> | undefined, skipKeys?: Record<string, boolean> | undefined) => void;
13
- clearNode: (node: BabelTypes.Node, opts?: BabelTypes.RemovePropertiesOptions | undefined) => void;
14
- removeProperties: (tree: BabelTypes.Node, opts?: BabelTypes.RemovePropertiesOptions | undefined) => BabelTypes.Node;
15
- hasType: (tree: BabelTypes.Node, type: "File" | "FunctionDeclaration" | "FunctionExpression" | "ArrowFunctionExpression" | "Identifier" | "Program" | "AnyTypeAnnotation" | "ArgumentPlaceholder" | "ArrayExpression" | "ArrayPattern" | "ArrayTypeAnnotation" | "AssignmentExpression" | "AssignmentPattern" | "AwaitExpression" | "BigIntLiteral" | "BinaryExpression" | "BindExpression" | "BlockStatement" | "BooleanLiteral" | "BooleanLiteralTypeAnnotation" | "BooleanTypeAnnotation" | "BreakStatement" | "CallExpression" | "CatchClause" | "ClassAccessorProperty" | "ClassBody" | "ClassDeclaration" | "ClassExpression" | "ClassImplements" | "ClassMethod" | "ClassPrivateMethod" | "ClassPrivateProperty" | "ClassProperty" | "ConditionalExpression" | "ContinueStatement" | "DebuggerStatement" | "DecimalLiteral" | "DeclareClass" | "DeclareExportAllDeclaration" | "DeclareExportDeclaration" | "DeclareFunction" | "DeclareInterface" | "DeclareModule" | "DeclareModuleExports" | "DeclareOpaqueType" | "DeclareTypeAlias" | "DeclareVariable" | "DeclaredPredicate" | "Decorator" | "Directive" | "DirectiveLiteral" | "DoExpression" | "DoWhileStatement" | "EmptyStatement" | "EmptyTypeAnnotation" | "EnumBooleanBody" | "EnumBooleanMember" | "EnumDeclaration" | "EnumDefaultedMember" | "EnumNumberBody" | "EnumNumberMember" | "EnumStringBody" | "EnumStringMember" | "EnumSymbolBody" | "ExistsTypeAnnotation" | "ExportAllDeclaration" | "ExportDefaultDeclaration" | "ExportDefaultSpecifier" | "ExportNamedDeclaration" | "ExportNamespaceSpecifier" | "ExportSpecifier" | "ExpressionStatement" | "ForInStatement" | "ForOfStatement" | "ForStatement" | "FunctionTypeAnnotation" | "FunctionTypeParam" | "GenericTypeAnnotation" | "IfStatement" | "Import" | "ImportAttribute" | "ImportDeclaration" | "ImportDefaultSpecifier" | "ImportExpression" | "ImportNamespaceSpecifier" | "ImportSpecifier" | "IndexedAccessType" | "InferredPredicate" | "InterfaceDeclaration" | "InterfaceExtends" | "InterfaceTypeAnnotation" | "InterpreterDirective" | "IntersectionTypeAnnotation" | "JSXAttribute" | "JSXClosingElement" | "JSXClosingFragment" | "JSXElement" | "JSXEmptyExpression" | "JSXExpressionContainer" | "JSXFragment" | "JSXIdentifier" | "JSXMemberExpression" | "JSXNamespacedName" | "JSXOpeningElement" | "JSXOpeningFragment" | "JSXSpreadAttribute" | "JSXSpreadChild" | "JSXText" | "LabeledStatement" | "LogicalExpression" | "MemberExpression" | "MetaProperty" | "MixedTypeAnnotation" | "ModuleExpression" | "NewExpression" | "Noop" | "NullLiteral" | "NullLiteralTypeAnnotation" | "NullableTypeAnnotation" | "NumberLiteral" | "NumberLiteralTypeAnnotation" | "NumberTypeAnnotation" | "NumericLiteral" | "ObjectExpression" | "ObjectMethod" | "ObjectPattern" | "ObjectProperty" | "ObjectTypeAnnotation" | "ObjectTypeCallProperty" | "ObjectTypeIndexer" | "ObjectTypeInternalSlot" | "ObjectTypeProperty" | "ObjectTypeSpreadProperty" | "OpaqueType" | "OptionalCallExpression" | "OptionalIndexedAccessType" | "OptionalMemberExpression" | "ParenthesizedExpression" | "PipelineBareFunction" | "PipelinePrimaryTopicReference" | "PipelineTopicExpression" | "Placeholder" | "PrivateName" | "QualifiedTypeIdentifier" | "RecordExpression" | "RegExpLiteral" | "RegexLiteral" | "RestElement" | "RestProperty" | "ReturnStatement" | "SequenceExpression" | "SpreadElement" | "SpreadProperty" | "StaticBlock" | "StringLiteral" | "StringLiteralTypeAnnotation" | "StringTypeAnnotation" | "Super" | "SwitchCase" | "SwitchStatement" | "SymbolTypeAnnotation" | "TSAnyKeyword" | "TSArrayType" | "TSAsExpression" | "TSBigIntKeyword" | "TSBooleanKeyword" | "TSCallSignatureDeclaration" | "TSConditionalType" | "TSConstructSignatureDeclaration" | "TSConstructorType" | "TSDeclareFunction" | "TSDeclareMethod" | "TSEnumDeclaration" | "TSEnumMember" | "TSExportAssignment" | "TSExpressionWithTypeArguments" | "TSExternalModuleReference" | "TSFunctionType" | "TSImportEqualsDeclaration" | "TSImportType" | "TSIndexSignature" | "TSIndexedAccessType" | "TSInferType" | "TSInstantiationExpression" | "TSInterfaceBody" | "TSInterfaceDeclaration" | "TSIntersectionType" | "TSIntrinsicKeyword" | "TSLiteralType" | "TSMappedType" | "TSMethodSignature" | "TSModuleBlock" | "TSModuleDeclaration" | "TSNamedTupleMember" | "TSNamespaceExportDeclaration" | "TSNeverKeyword" | "TSNonNullExpression" | "TSNullKeyword" | "TSNumberKeyword" | "TSObjectKeyword" | "TSOptionalType" | "TSParameterProperty" | "TSParenthesizedType" | "TSPropertySignature" | "TSQualifiedName" | "TSRestType" | "TSSatisfiesExpression" | "TSStringKeyword" | "TSSymbolKeyword" | "TSThisType" | "TSTupleType" | "TSTypeAliasDeclaration" | "TSTypeAnnotation" | "TSTypeAssertion" | "TSTypeLiteral" | "TSTypeOperator" | "TSTypeParameter" | "TSTypeParameterDeclaration" | "TSTypeParameterInstantiation" | "TSTypePredicate" | "TSTypeQuery" | "TSTypeReference" | "TSUndefinedKeyword" | "TSUnionType" | "TSUnknownKeyword" | "TSVoidKeyword" | "TaggedTemplateExpression" | "TemplateElement" | "TemplateLiteral" | "ThisExpression" | "ThisTypeAnnotation" | "ThrowStatement" | "TopicReference" | "TryStatement" | "TupleExpression" | "TupleTypeAnnotation" | "TypeAlias" | "TypeAnnotation" | "TypeCastExpression" | "TypeParameter" | "TypeParameterDeclaration" | "TypeParameterInstantiation" | "TypeofTypeAnnotation" | "UnaryExpression" | "UnionTypeAnnotation" | "UpdateExpression" | "V8IntrinsicIdentifier" | "VariableDeclaration" | "VariableDeclarator" | "Variance" | "VoidTypeAnnotation" | "WhileStatement" | "WithStatement" | "YieldExpression", denylistTypes?: string[] | undefined) => boolean;
11
+ cheap: (node: Babel.Node, enter: (node: Babel.Node) => void) => void;
12
+ node: (node: Babel.Node, opts: import("@babel/traverse").TraverseOptions<Babel.Node>, scope?: import("@babel/traverse").Scope | undefined, state?: any, path?: NodePath<Babel.Node> | undefined, skipKeys?: Record<string, boolean> | undefined) => void;
13
+ clearNode: (node: Babel.Node, opts?: Babel.RemovePropertiesOptions | undefined) => void;
14
+ removeProperties: (tree: Babel.Node, opts?: Babel.RemovePropertiesOptions | undefined) => Babel.Node;
15
+ hasType: (tree: Babel.Node, type: "File" | "ArrayPattern" | "ObjectPattern" | "Identifier" | "RestElement" | "AssignmentPattern" | "TSAsExpression" | "TSSatisfiesExpression" | "TSTypeAssertion" | "TSNonNullExpression" | "MemberExpression" | "TSParameterProperty" | "ObjectProperty" | "ArrayExpression" | "AssignmentExpression" | "BinaryExpression" | "CallExpression" | "ConditionalExpression" | "FunctionExpression" | "StringLiteral" | "NumericLiteral" | "NullLiteral" | "BooleanLiteral" | "RegExpLiteral" | "LogicalExpression" | "NewExpression" | "ObjectExpression" | "SequenceExpression" | "ParenthesizedExpression" | "ThisExpression" | "UnaryExpression" | "UpdateExpression" | "ArrowFunctionExpression" | "ClassExpression" | "ImportExpression" | "MetaProperty" | "Super" | "TaggedTemplateExpression" | "TemplateLiteral" | "YieldExpression" | "AwaitExpression" | "Import" | "BigIntLiteral" | "OptionalMemberExpression" | "OptionalCallExpression" | "TypeCastExpression" | "JSXElement" | "JSXFragment" | "BindExpression" | "DoExpression" | "RecordExpression" | "TupleExpression" | "DecimalLiteral" | "ModuleExpression" | "TopicReference" | "PipelineTopicExpression" | "PipelineBareFunction" | "PipelinePrimaryTopicReference" | "TSInstantiationExpression" | "PrivateName" | "AnyTypeAnnotation" | "ArgumentPlaceholder" | "ArrayTypeAnnotation" | "BlockStatement" | "BooleanLiteralTypeAnnotation" | "BooleanTypeAnnotation" | "BreakStatement" | "CatchClause" | "ClassAccessorProperty" | "ClassBody" | "ClassDeclaration" | "ClassImplements" | "ClassMethod" | "ClassPrivateMethod" | "ClassPrivateProperty" | "ClassProperty" | "ContinueStatement" | "DebuggerStatement" | "DeclareClass" | "DeclareExportAllDeclaration" | "DeclareExportDeclaration" | "DeclareFunction" | "DeclareInterface" | "DeclareModule" | "DeclareModuleExports" | "DeclareOpaqueType" | "DeclareTypeAlias" | "DeclareVariable" | "DeclaredPredicate" | "Decorator" | "Directive" | "DirectiveLiteral" | "DoWhileStatement" | "EmptyStatement" | "EmptyTypeAnnotation" | "EnumBooleanBody" | "EnumBooleanMember" | "EnumDeclaration" | "EnumDefaultedMember" | "EnumNumberBody" | "EnumNumberMember" | "EnumStringBody" | "EnumStringMember" | "EnumSymbolBody" | "ExistsTypeAnnotation" | "ExportAllDeclaration" | "ExportDefaultDeclaration" | "ExportDefaultSpecifier" | "ExportNamedDeclaration" | "ExportNamespaceSpecifier" | "ExportSpecifier" | "ExpressionStatement" | "ForInStatement" | "ForOfStatement" | "ForStatement" | "FunctionDeclaration" | "FunctionTypeAnnotation" | "FunctionTypeParam" | "GenericTypeAnnotation" | "IfStatement" | "ImportAttribute" | "ImportDeclaration" | "ImportDefaultSpecifier" | "ImportNamespaceSpecifier" | "ImportSpecifier" | "IndexedAccessType" | "InferredPredicate" | "InterfaceDeclaration" | "InterfaceExtends" | "InterfaceTypeAnnotation" | "InterpreterDirective" | "IntersectionTypeAnnotation" | "JSXAttribute" | "JSXClosingElement" | "JSXClosingFragment" | "JSXEmptyExpression" | "JSXExpressionContainer" | "JSXIdentifier" | "JSXMemberExpression" | "JSXNamespacedName" | "JSXOpeningElement" | "JSXOpeningFragment" | "JSXSpreadAttribute" | "JSXSpreadChild" | "JSXText" | "LabeledStatement" | "MixedTypeAnnotation" | "Noop" | "NullLiteralTypeAnnotation" | "NullableTypeAnnotation" | "NumberLiteral" | "NumberLiteralTypeAnnotation" | "NumberTypeAnnotation" | "ObjectMethod" | "ObjectTypeAnnotation" | "ObjectTypeCallProperty" | "ObjectTypeIndexer" | "ObjectTypeInternalSlot" | "ObjectTypeProperty" | "ObjectTypeSpreadProperty" | "OpaqueType" | "OptionalIndexedAccessType" | "Placeholder" | "Program" | "QualifiedTypeIdentifier" | "RegexLiteral" | "RestProperty" | "ReturnStatement" | "SpreadElement" | "SpreadProperty" | "StaticBlock" | "StringLiteralTypeAnnotation" | "StringTypeAnnotation" | "SwitchCase" | "SwitchStatement" | "SymbolTypeAnnotation" | "TSAnyKeyword" | "TSArrayType" | "TSBigIntKeyword" | "TSBooleanKeyword" | "TSCallSignatureDeclaration" | "TSConditionalType" | "TSConstructSignatureDeclaration" | "TSConstructorType" | "TSDeclareFunction" | "TSDeclareMethod" | "TSEnumDeclaration" | "TSEnumMember" | "TSExportAssignment" | "TSExpressionWithTypeArguments" | "TSExternalModuleReference" | "TSFunctionType" | "TSImportEqualsDeclaration" | "TSImportType" | "TSIndexSignature" | "TSIndexedAccessType" | "TSInferType" | "TSInterfaceBody" | "TSInterfaceDeclaration" | "TSIntersectionType" | "TSIntrinsicKeyword" | "TSLiteralType" | "TSMappedType" | "TSMethodSignature" | "TSModuleBlock" | "TSModuleDeclaration" | "TSNamedTupleMember" | "TSNamespaceExportDeclaration" | "TSNeverKeyword" | "TSNullKeyword" | "TSNumberKeyword" | "TSObjectKeyword" | "TSOptionalType" | "TSParenthesizedType" | "TSPropertySignature" | "TSQualifiedName" | "TSRestType" | "TSStringKeyword" | "TSSymbolKeyword" | "TSThisType" | "TSTupleType" | "TSTypeAliasDeclaration" | "TSTypeAnnotation" | "TSTypeLiteral" | "TSTypeOperator" | "TSTypeParameter" | "TSTypeParameterDeclaration" | "TSTypeParameterInstantiation" | "TSTypePredicate" | "TSTypeQuery" | "TSTypeReference" | "TSUndefinedKeyword" | "TSUnionType" | "TSUnknownKeyword" | "TSVoidKeyword" | "TemplateElement" | "ThisTypeAnnotation" | "ThrowStatement" | "TryStatement" | "TupleTypeAnnotation" | "TypeAlias" | "TypeAnnotation" | "TypeParameter" | "TypeParameterDeclaration" | "TypeParameterInstantiation" | "TypeofTypeAnnotation" | "UnionTypeAnnotation" | "V8IntrinsicIdentifier" | "VariableDeclaration" | "VariableDeclarator" | "Variance" | "VoidTypeAnnotation" | "WhileStatement" | "WithStatement", denylistTypes?: string[] | undefined) => boolean;
16
16
  cache: typeof import("@babel/traverse").cache;
17
17
  };
18
18
  declare const generate: typeof import("@babel/generator").default;
19
19
  export { traverse, generate, parse, t };
20
- export type { BabelTypes, NodePath };
20
+ export type { Babel, NodePath, ParseResult };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-49eef6a01
2
+ * @react-router/dev v0.0.0-experimental-a26b992a1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-49eef6a01
2
+ * @react-router/dev v0.0.0-experimental-a26b992a1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -16,7 +16,7 @@ var path = require('node:path');
16
16
  var fse = require('fs-extra');
17
17
  var colors = require('picocolors');
18
18
  var plugin = require('./plugin.js');
19
- var config = require('../config.js');
19
+ var config = require('./config.js');
20
20
  var invariant = require('../invariant.js');
21
21
  var importViteEsmSync = require('./import-vite-esm-sync.js');
22
22
 
@@ -9,7 +9,13 @@ type GetLoadContext<Env, Cf extends CfProperties> = (args: {
9
9
  request: Request;
10
10
  context: LoadContext<Env, Cf>;
11
11
  }) => AppLoadContext | Promise<AppLoadContext>;
12
- export declare const cloudflareDevProxyVitePlugin: <Env, Cf extends CfProperties>({ getLoadContext, ...options }?: {
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?: {
13
19
  getLoadContext?: GetLoadContext<Env, Cf>;
14
20
  } & GetPlatformProxyOptions) => Plugin;
15
21
  export {};