@react-router/dev 0.0.0-experimental-c0856287f

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 (68) hide show
  1. package/CHANGELOG.md +1773 -0
  2. package/LICENSE.md +23 -0
  3. package/README.md +13 -0
  4. package/dist/cli/commands.d.ts +12 -0
  5. package/dist/cli/commands.js +174 -0
  6. package/dist/cli/detectPackageManager.d.ts +10 -0
  7. package/dist/cli/detectPackageManager.js +39 -0
  8. package/dist/cli/index.d.ts +1 -0
  9. package/dist/cli/index.js +19 -0
  10. package/dist/cli/run.d.ts +5 -0
  11. package/dist/cli/run.js +180 -0
  12. package/dist/cli/useJavascript.d.ts +4 -0
  13. package/dist/cli/useJavascript.js +66 -0
  14. package/dist/cli.d.ts +1 -0
  15. package/dist/cli.js +21 -0
  16. package/dist/colors.d.ts +17 -0
  17. package/dist/colors.js +49 -0
  18. package/dist/config/defaults/entry.client.tsx +12 -0
  19. package/dist/config/defaults/entry.dev.d.ts +2 -0
  20. package/dist/config/defaults/entry.dev.ts +13 -0
  21. package/dist/config/defaults/entry.server.cloudflare.tsx +55 -0
  22. package/dist/config/defaults/entry.server.deno.tsx +55 -0
  23. package/dist/config/defaults/entry.server.node.tsx +155 -0
  24. package/dist/config/defaults/entry.server.spa.tsx +20 -0
  25. package/dist/config/flat-routes.d.ts +14 -0
  26. package/dist/config/flat-routes.js +418 -0
  27. package/dist/config/format.d.ts +5 -0
  28. package/dist/config/format.js +68 -0
  29. package/dist/config/routes.d.ts +98 -0
  30. package/dist/config/routes.js +93 -0
  31. package/dist/config/serverModes.d.ts +9 -0
  32. package/dist/config/serverModes.js +28 -0
  33. package/dist/config.d.ts +75 -0
  34. package/dist/config.js +152 -0
  35. package/dist/index.d.ts +4 -0
  36. package/dist/index.js +23 -0
  37. package/dist/invariant.d.ts +2 -0
  38. package/dist/invariant.js +22 -0
  39. package/dist/manifest.d.ts +28 -0
  40. package/dist/vite/babel.d.ts +20 -0
  41. package/dist/vite/babel.js +49 -0
  42. package/dist/vite/build.d.ts +15 -0
  43. package/dist/vite/build.js +271 -0
  44. package/dist/vite/cloudflare-proxy-plugin.d.ts +15 -0
  45. package/dist/vite/cloudflare-proxy-plugin.js +82 -0
  46. package/dist/vite/dev.d.ts +15 -0
  47. package/dist/vite/dev.js +81 -0
  48. package/dist/vite/import-vite-esm-sync.d.ts +4 -0
  49. package/dist/vite/import-vite-esm-sync.js +28 -0
  50. package/dist/vite/index.d.ts +4 -0
  51. package/dist/vite/index.js +30 -0
  52. package/dist/vite/node-adapter.d.ts +6 -0
  53. package/dist/vite/node-adapter.js +78 -0
  54. package/dist/vite/plugin.d.ts +165 -0
  55. package/dist/vite/plugin.js +1178 -0
  56. package/dist/vite/profiler.d.ts +5 -0
  57. package/dist/vite/profiler.js +55 -0
  58. package/dist/vite/remove-exports-test.d.ts +1 -0
  59. package/dist/vite/remove-exports.d.ts +2 -0
  60. package/dist/vite/remove-exports.js +278 -0
  61. package/dist/vite/resolve-file-url.d.ts +3 -0
  62. package/dist/vite/resolve-file-url.js +53 -0
  63. package/dist/vite/static/refresh-utils.cjs +185 -0
  64. package/dist/vite/styles.d.ts +13 -0
  65. package/dist/vite/styles.js +176 -0
  66. package/dist/vite/vmod.d.ts +3 -0
  67. package/dist/vite/vmod.js +21 -0
  68. package/package.json +107 -0
@@ -0,0 +1,165 @@
1
+ import type * as Vite from "vite";
2
+ import type { ConfigRoute, RouteManifest } from "../config/routes";
3
+ import type { AppConfig as RemixEsbuildUserConfig, RemixConfig as ResolvedRemixEsbuildConfig } from "../config";
4
+ import type { Manifest as ReactRouterManifest } from "../manifest";
5
+ export declare function resolveViteConfig({ configFile, mode, root, }: {
6
+ configFile?: string;
7
+ mode?: string;
8
+ root: string;
9
+ }): Promise<Readonly<Omit<Vite.UserConfig, "plugins" | "css" | "assetsInclude" | "optimizeDeps" | "worker" | "build"> & {
10
+ configFile: string | undefined;
11
+ configFileDependencies: string[];
12
+ inlineConfig: Vite.InlineConfig;
13
+ root: string;
14
+ base: string;
15
+ publicDir: string;
16
+ cacheDir: string;
17
+ command: "build" | "serve";
18
+ mode: string;
19
+ isWorker: boolean;
20
+ isProduction: boolean;
21
+ envDir: string;
22
+ env: Record<string, any>;
23
+ resolve: Required<Vite.ResolveOptions> & {
24
+ alias: Vite.Alias[];
25
+ };
26
+ plugins: readonly Vite.Plugin<any>[];
27
+ css: Vite.ResolvedCSSOptions;
28
+ esbuild: false | Vite.ESBuildOptions;
29
+ server: Vite.ResolvedServerOptions;
30
+ build: Vite.ResolvedBuildOptions;
31
+ preview: Vite.ResolvedPreviewOptions;
32
+ ssr: Vite.ResolvedSSROptions;
33
+ assetsInclude: (file: string) => boolean;
34
+ logger: Vite.Logger;
35
+ createResolver: (options?: Partial<Vite.InternalResolveOptions> | undefined) => Vite.ResolveFn;
36
+ optimizeDeps: Vite.DepOptimizationOptions;
37
+ worker: Vite.ResolvedWorkerOptions;
38
+ appType: Vite.AppType;
39
+ experimental: Vite.ExperimentalOptions;
40
+ } & Vite.PluginHookUtils>>;
41
+ export declare function extractPluginContext(viteConfig: Vite.ResolvedConfig): Promise<ReactRouterPluginContext | undefined>;
42
+ export declare function loadPluginContext({ configFile, root, }: {
43
+ configFile?: string;
44
+ root?: string;
45
+ }): Promise<ReactRouterPluginContext>;
46
+ declare const branchRouteProperties: readonly ["id", "path", "file", "index"];
47
+ type BranchRoute = Pick<ConfigRoute, (typeof branchRouteProperties)[number]>;
48
+ export declare const configRouteToBranchRoute: (configRoute: ConfigRoute) => BranchRoute;
49
+ export type ServerBundlesFunction = (args: {
50
+ branch: BranchRoute[];
51
+ }) => string | Promise<string>;
52
+ type BaseBuildManifest = {
53
+ routes: RouteManifest;
54
+ };
55
+ type DefaultBuildManifest = BaseBuildManifest & {
56
+ serverBundles?: never;
57
+ routeIdToServerBundleId?: never;
58
+ };
59
+ export type ServerBundlesBuildManifest = BaseBuildManifest & {
60
+ serverBundles: {
61
+ [serverBundleId: string]: {
62
+ id: string;
63
+ file: string;
64
+ };
65
+ };
66
+ routeIdToServerBundleId: Record<string, string>;
67
+ };
68
+ export type BuildManifest = DefaultBuildManifest | ServerBundlesBuildManifest;
69
+ declare const excludedConfigPresetKeys: readonly ["presets"];
70
+ type ExcludedConfigPresetKey = (typeof excludedConfigPresetKeys)[number];
71
+ type ConfigPreset = Omit<VitePluginConfig, ExcludedConfigPresetKey>;
72
+ export type Preset = {
73
+ name: string;
74
+ reactRouterConfig?: (args: {
75
+ reactRouterUserConfig: VitePluginConfig;
76
+ }) => ConfigPreset | Promise<ConfigPreset>;
77
+ reactRouterConfigResolved?: (args: {
78
+ reactRouterConfig: ResolvedVitePluginConfig;
79
+ }) => void | Promise<void>;
80
+ };
81
+ export type VitePluginConfig = RemixEsbuildUserConfig & {
82
+ /**
83
+ * The react router app basename. Defaults to `"/"`.
84
+ */
85
+ basename?: string;
86
+ /**
87
+ * The path to the build directory, relative to the project. Defaults to
88
+ * `"build"`.
89
+ */
90
+ buildDirectory?: string;
91
+ /**
92
+ * A function that is called after the full React Router build is complete.
93
+ */
94
+ buildEnd?: BuildEndHook;
95
+ /**
96
+ * Whether to write a `"manifest.json"` file to the build directory.`
97
+ * Defaults to `false`.
98
+ */
99
+ manifest?: boolean;
100
+ /**
101
+ * An array of React Router plugin config presets to ease integration with
102
+ * other platforms and tools.
103
+ */
104
+ presets?: Array<Preset>;
105
+ /**
106
+ * The file name of the server build output. This file
107
+ * should end in a `.js` extension and should be deployed to your server.
108
+ * Defaults to `"index.js"`.
109
+ */
110
+ serverBuildFile?: string;
111
+ /**
112
+ * A function for assigning routes to different server bundles. This
113
+ * function should return a server bundle ID which will be used as the
114
+ * bundle's directory name within the server build directory.
115
+ */
116
+ serverBundles?: ServerBundlesFunction;
117
+ /**
118
+ * Enable server-side rendering for your application. Disable to use "SPA
119
+ * Mode", which will request the `/` path at build-time and save it as an
120
+ * `index.html` file with your assets so your application can be deployed as a
121
+ * SPA without server-rendering. Default's to `true`.
122
+ */
123
+ ssr?: boolean;
124
+ };
125
+ type BuildEndHook = (args: {
126
+ buildManifest: BuildManifest | undefined;
127
+ reactRouterConfig: ResolvedVitePluginConfig;
128
+ viteConfig: Vite.ResolvedConfig;
129
+ }) => void | Promise<void>;
130
+ export type ResolvedVitePluginConfig = Readonly<Pick<ResolvedRemixEsbuildConfig, "appDirectory" | "future" | "routes" | "serverModuleFormat"> & {
131
+ basename: string;
132
+ buildDirectory: string;
133
+ buildEnd?: BuildEndHook;
134
+ manifest: boolean;
135
+ publicPath: string;
136
+ serverBuildFile: string;
137
+ serverBundles?: ServerBundlesFunction;
138
+ ssr: boolean;
139
+ }>;
140
+ export type ServerBundleBuildConfig = {
141
+ routes: RouteManifest;
142
+ serverBundleId: string;
143
+ };
144
+ type ReactRouterPluginSsrBuildContext = {
145
+ isSsrBuild: false;
146
+ getReactRouterServerManifest?: never;
147
+ serverBundleBuildConfig?: never;
148
+ } | {
149
+ isSsrBuild: true;
150
+ getReactRouterServerManifest: () => Promise<ReactRouterManifest>;
151
+ serverBundleBuildConfig: ServerBundleBuildConfig | null;
152
+ };
153
+ export type ReactRouterPluginContext = ReactRouterPluginSsrBuildContext & {
154
+ rootDirectory: string;
155
+ entryClientFilePath: string;
156
+ entryServerFilePath: string;
157
+ reactRouterConfig: ResolvedVitePluginConfig;
158
+ viteManifestEnabled: boolean;
159
+ };
160
+ export declare let getServerBuildDirectory: (ctx: ReactRouterPluginContext) => string;
161
+ type MaybePromise<T> = T | Promise<T>;
162
+ export declare let setReactRouterDevLoadContext: (loadContext: (request: Request) => MaybePromise<Record<string, unknown>>) => void;
163
+ export type ReactRouterVitePlugin = (config?: VitePluginConfig) => Vite.Plugin[];
164
+ export declare const reactRouterVitePlugin: ReactRouterVitePlugin;
165
+ export {};