@react-router/dev 0.0.0-experimental-3278f3ca6 → 0.0.0-experimental-312bddb22

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
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-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/cli/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/cli/run.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
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-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
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-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
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-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
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-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/invariant.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/routes.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -12,7 +12,7 @@ declare const traverse: {
12
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
13
  clearNode: (node: Babel.Node, opts?: Babel.RemovePropertiesOptions | undefined) => void;
14
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;
15
+ hasType: (tree: Babel.Node, type: "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" | "File" | "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;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
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-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
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-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
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-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
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-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -77,7 +77,9 @@ export type ReactRouterConfig = {
77
77
  * An array of URLs to prerender to HTML files at build time. Can also be a
78
78
  * function returning an array to dynamically generate URLs.
79
79
  */
80
- prerender?: Array<string> | (() => Array<string> | Promise<Array<string>>);
80
+ prerender?: boolean | Array<string> | ((args: {
81
+ getStaticPaths: () => string[];
82
+ }) => Array<string> | Promise<Array<string>>);
81
83
  /**
82
84
  * An array of React Router plugin config presets to ease integration with
83
85
  * other platforms and tools.
@@ -125,9 +127,10 @@ export type ResolvedReactRouterConfig = Readonly<{
125
127
  */
126
128
  future: FutureConfig;
127
129
  /**
128
- * An array of URLs to prerender to HTML files at build time.
130
+ * An array of URLs to prerender to HTML files at build time. Can also be a
131
+ * function returning an array to dynamically generate URLs.
129
132
  */
130
- prerender: Array<string> | null;
133
+ prerender: ReactRouterConfig["prerender"];
131
134
  /**
132
135
  * An object of all available routes, keyed by route id.
133
136
  */
@@ -186,9 +189,12 @@ export declare function resolveReactRouterConfig({ rootDirectory, reactRouterUse
186
189
  */
187
190
  future: FutureConfig;
188
191
  /**
189
- * An array of URLs to prerender to HTML files at build time.
192
+ * An array of URLs to prerender to HTML files at build time. Can also be a
193
+ * function returning an array to dynamically generate URLs.
190
194
  */
191
- prerender: string[] | null;
195
+ prerender: boolean | string[] | ((args: {
196
+ getStaticPaths: () => string[];
197
+ }) => string[] | Promise<string[]>) | undefined;
192
198
  /**
193
199
  * An object of all available routes, keyed by route id.
194
200
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -117,7 +117,7 @@ async function resolveReactRouterConfig({
117
117
  basename,
118
118
  buildDirectory: userBuildDirectory,
119
119
  buildEnd,
120
- prerender: prerenderConfig,
120
+ prerender,
121
121
  serverBuildFile,
122
122
  serverBundles,
123
123
  serverModuleFormat,
@@ -132,16 +132,10 @@ async function resolveReactRouterConfig({
132
132
  console.warn(colors__default["default"].yellow(colors__default["default"].bold("⚠️ SPA Mode: ") + "the `serverBundles` config is invalid with " + "`ssr:false` and will be ignored`"));
133
133
  serverBundles = undefined;
134
134
  }
135
- let prerender = null;
136
- if (prerenderConfig) {
137
- if (Array.isArray(prerenderConfig)) {
138
- prerender = prerenderConfig;
139
- } else if (typeof prerenderConfig === "function") {
140
- prerender = await prerenderConfig();
141
- } else {
142
- logger.error(colors__default["default"].red("The `prerender` config must be an array of string paths, or a function " + "returning an array of string paths"));
143
- process.exit(1);
144
- }
135
+ let isValidPrerenderConfig = prerender == null || typeof prerender === "boolean" || Array.isArray(prerender) || typeof prerender === "function";
136
+ if (!isValidPrerenderConfig) {
137
+ logger.error(colors__default["default"].red("The `prerender` config must be a boolean, an array of string paths, " + "or a function returning a boolean or array of string paths"));
138
+ process.exit(1);
145
139
  }
146
140
  let appDirectory = path__default["default"].resolve(rootDirectory, userAppDirectory || "app");
147
141
  let buildDirectory = path__default["default"].resolve(rootDirectory, userBuildDirectory);
package/dist/vite/dev.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
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-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
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-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
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-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -802,7 +802,7 @@ const reactRouterVitePlugin = _config => {
802
802
  if (movedAssetPaths.length) {
803
803
  viteConfig.logger.info(["", `${colors__default["default"].green("✓")} ${movedAssetPaths.length} asset${movedAssetPaths.length > 1 ? "s" : ""} moved from React Router server build to client assets.`, ...movedAssetPaths.map(movedAssetPath => colors__default["default"].dim(path__namespace.relative(ctx.rootDirectory, movedAssetPath))), ""].join("\n"));
804
804
  }
805
- if (ctx.reactRouterConfig.prerender != null) {
805
+ if (ctx.reactRouterConfig.prerender != null && ctx.reactRouterConfig.prerender !== false) {
806
806
  // If we have prerender routes, that takes precedence over SPA mode
807
807
  // which is ssr:false and only the rot route being rendered
808
808
  await handlePrerender(viteConfig, ctx.reactRouterConfig, serverBuildDirectory, clientBuildDirectory);
@@ -1168,7 +1168,17 @@ async function handlePrerender(viteConfig, reactRouterConfig, serverBuildDirecto
1168
1168
  handler
1169
1169
  } = await getPrerenderBuildAndHandler(viteConfig, reactRouterConfig, serverBuildDirectory);
1170
1170
  let routes = createPrerenderRoutes(build.routes);
1171
- let routesToPrerender = reactRouterConfig.prerender || ["/"];
1171
+ let routesToPrerender;
1172
+ if (typeof reactRouterConfig.prerender === "boolean") {
1173
+ invariant["default"](reactRouterConfig.prerender, "Expected prerender:true");
1174
+ routesToPrerender = determineStaticPrerenderRoutes(routes, viteConfig, true);
1175
+ } else if (typeof reactRouterConfig.prerender === "function") {
1176
+ routesToPrerender = await reactRouterConfig.prerender({
1177
+ getStaticPaths: () => determineStaticPrerenderRoutes(routes, viteConfig, false)
1178
+ });
1179
+ } else {
1180
+ routesToPrerender = reactRouterConfig.prerender || ["/"];
1181
+ }
1172
1182
  let requestInit = {
1173
1183
  headers: {
1174
1184
  // Header that can be used in the loader to know if you're running at
@@ -1186,6 +1196,34 @@ async function handlePrerender(viteConfig, reactRouterConfig, serverBuildDirecto
1186
1196
  }
1187
1197
  await prerenderManifest(build, clientBuildDirectory, reactRouterConfig, viteConfig);
1188
1198
  }
1199
+ function determineStaticPrerenderRoutes(routes, viteConfig, isBooleanUsage = false) {
1200
+ // Always start with the root/index route included
1201
+ let paths = ["/"];
1202
+ let paramRoutes = [];
1203
+ // Then recursively add any new path defined by the tree
1204
+ function recurse(subtree, prefix = "") {
1205
+ for (let route of subtree) {
1206
+ let newPath = [prefix, route.path].join("/").replace(/\/\/+/g, "/");
1207
+ if (route.path) {
1208
+ let segments = route.path.split("/");
1209
+ if (segments.some(s => s.startsWith(":") || s === "*")) {
1210
+ paramRoutes.push(route.path);
1211
+ } else {
1212
+ paths.push(newPath);
1213
+ }
1214
+ }
1215
+ if (route.children) {
1216
+ recurse(route.children, newPath);
1217
+ }
1218
+ }
1219
+ }
1220
+ recurse(routes);
1221
+ if (isBooleanUsage && paramRoutes) {
1222
+ viteConfig.logger.warn("The following paths were not prerendered because Dynamic Param and Splat " + "routes cannot be prerendered when using `prerender:true`. You may want to " + "consider using the `prerender()` API if you wish to prerender slug and " + "splat routes.");
1223
+ }
1224
+ // Clean double slashes and remove trailing slashes
1225
+ return paths.map(p => p.replace(/\/\/+/g, "/").replace(/(.+)\/$/, "$1"));
1226
+ }
1189
1227
  async function prerenderData(handler, prerenderPath, clientBuildDirectory, reactRouterConfig, viteConfig, requestInit) {
1190
1228
  let normalizedPath = `${reactRouterConfig.basename}${prerenderPath === "/" ? "/_root.data" : `${prerenderPath.replace(/\/$/, "")}.data`}`.replace(/\/\/+/g, "/");
1191
1229
  let request = new Request(`http://localhost${normalizedPath}`, requestInit);
@@ -1220,10 +1258,7 @@ async function prerenderManifest(build, clientBuildDirectory, reactRouterConfig,
1220
1258
  let outdir = path__namespace.relative(process.cwd(), clientBuildDirectory);
1221
1259
  let outfile = path__namespace.join(outdir, ...normalizedPath.split("/"));
1222
1260
  await fse__namespace.ensureDir(path__namespace.dirname(outfile));
1223
- let manifestData = JSON.stringify({
1224
- notFoundPaths: [],
1225
- patches: build.assets.routes
1226
- });
1261
+ let manifestData = JSON.stringify(build.assets.routes);
1227
1262
  await fse__namespace.outputFile(outfile, manifestData);
1228
1263
  viteConfig.logger.info(`Prerender: Generated ${colors__default["default"].bold(outfile)}`);
1229
1264
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
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-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
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-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
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-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/vite/vmod.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
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-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/vite.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-3278f3ca6
2
+ * @react-router/dev v0.0.0-experimental-312bddb22
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-router/dev",
3
- "version": "0.0.0-experimental-3278f3ca6",
3
+ "version": "0.0.0-experimental-312bddb22",
4
4
  "description": "Dev tools and CLI for React Router",
5
5
  "homepage": "https://reactrouter.com",
6
6
  "bugs": {
@@ -58,7 +58,7 @@
58
58
  "set-cookie-parser": "^2.6.0",
59
59
  "vite-node": "^1.6.0",
60
60
  "valibot": "^0.41.0",
61
- "@react-router/node": "0.0.0-experimental-3278f3ca6"
61
+ "@react-router/node": "0.0.0-experimental-312bddb22"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@types/babel__core": "^7.20.5",
@@ -84,15 +84,15 @@
84
84
  "tiny-invariant": "^1.2.0",
85
85
  "vite": "^5.1.0",
86
86
  "wrangler": "^3.28.2",
87
- "@react-router/serve": "0.0.0-experimental-3278f3ca6",
88
- "react-router": "^0.0.0-experimental-3278f3ca6"
87
+ "@react-router/serve": "0.0.0-experimental-312bddb22",
88
+ "react-router": "^0.0.0-experimental-312bddb22"
89
89
  },
90
90
  "peerDependencies": {
91
91
  "typescript": "^5.1.0",
92
92
  "vite": "^5.1.0",
93
93
  "wrangler": "^3.28.2",
94
- "@react-router/serve": "^0.0.0-experimental-3278f3ca6",
95
- "react-router": "^0.0.0-experimental-3278f3ca6"
94
+ "@react-router/serve": "^0.0.0-experimental-312bddb22",
95
+ "react-router": "^0.0.0-experimental-312bddb22"
96
96
  },
97
97
  "peerDependenciesMeta": {
98
98
  "@react-router/serve": {