@reckona/mreact-router 0.0.188 → 0.0.190

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 (69) hide show
  1. package/README.md +16 -3
  2. package/bin/mreact-router.js +23 -0
  3. package/dist/adapters/aws-lambda.d.ts +33 -13
  4. package/dist/adapters/aws-lambda.d.ts.map +1 -1
  5. package/dist/adapters/aws-lambda.js +128 -20
  6. package/dist/adapters/aws-lambda.js.map +1 -1
  7. package/dist/adapters/cloudflare.d.ts +18 -0
  8. package/dist/adapters/cloudflare.d.ts.map +1 -1
  9. package/dist/adapters/cloudflare.js.map +1 -1
  10. package/dist/adapters/edge.d.ts +2 -0
  11. package/dist/adapters/edge.d.ts.map +1 -1
  12. package/dist/adapters/edge.js.map +1 -1
  13. package/dist/adapters/node.d.ts +16 -2
  14. package/dist/adapters/node.d.ts.map +1 -1
  15. package/dist/adapters/node.js.map +1 -1
  16. package/dist/cache.d.ts +8 -0
  17. package/dist/cache.d.ts.map +1 -1
  18. package/dist/cache.js +34 -13
  19. package/dist/cache.js.map +1 -1
  20. package/dist/cli-options.d.ts +1 -1
  21. package/dist/cli-options.d.ts.map +1 -1
  22. package/dist/cli-options.js +21 -3
  23. package/dist/cli-options.js.map +1 -1
  24. package/dist/cli.js +0 -0
  25. package/dist/client.d.ts +1 -1
  26. package/dist/client.d.ts.map +1 -1
  27. package/dist/client.js +1 -0
  28. package/dist/client.js.map +1 -1
  29. package/dist/config.d.ts +4 -0
  30. package/dist/config.d.ts.map +1 -1
  31. package/dist/config.js +6 -2
  32. package/dist/config.js.map +1 -1
  33. package/dist/index.d.ts +19 -16
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +15 -5
  36. package/dist/index.js.map +1 -1
  37. package/dist/link.d.ts +22 -1
  38. package/dist/link.d.ts.map +1 -1
  39. package/dist/link.js +130 -5
  40. package/dist/link.js.map +1 -1
  41. package/dist/render.d.ts.map +1 -1
  42. package/dist/render.js +514 -517
  43. package/dist/render.js.map +1 -1
  44. package/dist/request.d.ts +10 -0
  45. package/dist/request.d.ts.map +1 -0
  46. package/dist/request.js +6 -0
  47. package/dist/request.js.map +1 -0
  48. package/dist/typed-routes.d.ts +4 -5
  49. package/dist/typed-routes.d.ts.map +1 -1
  50. package/dist/typed-routes.js.map +1 -1
  51. package/dist/vite.d.ts +6 -0
  52. package/dist/vite.d.ts.map +1 -1
  53. package/dist/vite.js +4 -1
  54. package/dist/vite.js.map +1 -1
  55. package/package.json +19 -13
  56. package/src/adapters/aws-lambda.ts +227 -56
  57. package/src/adapters/cloudflare.ts +59 -0
  58. package/src/adapters/edge.ts +14 -0
  59. package/src/adapters/node.ts +44 -2
  60. package/src/cache.ts +39 -17
  61. package/src/cli-options.ts +28 -6
  62. package/src/client.ts +2 -1
  63. package/src/config.ts +10 -2
  64. package/src/index.ts +56 -10
  65. package/src/link.ts +205 -10
  66. package/src/render.ts +5 -7
  67. package/src/request.ts +35 -0
  68. package/src/typed-routes.ts +4 -4
  69. package/src/vite.ts +30 -1
package/dist/config.d.ts CHANGED
@@ -2,6 +2,10 @@
2
2
  * Selects the deployment runtime artifacts emitted by an app-router build.
3
3
  */
4
4
  export type AppRouterBuildTarget = "node" | "cloudflare" | "aws-lambda";
5
+ export declare const appRouterBuildTargetMetadata: {
6
+ readonly allTargets: readonly ["node", "cloudflare", "aws-lambda"];
7
+ readonly defaultTargets: readonly ["node"];
8
+ };
5
9
  /**
6
10
  * Names a browser console method that can be stripped from client bundles.
7
11
  */
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,YAAY,GAAG,YAAY,CAAC;AACxE;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;AACjG;;GAE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jC,OAAO,EAAE,SAAS,oBAAoB,EAAE,GAAG,SAAS,GACnD,SAAS,oBAAoB,EAAE,CAoBjC"}
package/dist/config.js CHANGED
@@ -1,4 +1,8 @@
1
1
  import { basename, dirname, isAbsolute, relative, resolve } from "node:path";
2
+ export const appRouterBuildTargetMetadata = {
3
+ allTargets: ["node", "cloudflare", "aws-lambda"],
4
+ defaultTargets: ["node"],
5
+ };
2
6
  export function resolveAppRouterProjectOptions(options) {
3
7
  const clientConsolePureFunctions = resolveClientConsolePureFunctions(options.production?.dropClientConsole);
4
8
  if (options.appDir !== undefined &&
@@ -84,14 +88,14 @@ export function resolveClientSourceMapMode(value) {
84
88
  }
85
89
  export function resolveBuildTargets(targets) {
86
90
  if (targets === undefined) {
87
- return ["node"];
91
+ return appRouterBuildTargetMetadata.defaultTargets;
88
92
  }
89
93
  const uniqueTargets = [...new Set(targets)];
90
94
  if (uniqueTargets.length === 0) {
91
95
  throw new Error("mreactRouter buildTargets must include at least one target.");
92
96
  }
93
97
  for (const target of uniqueTargets) {
94
- if (target !== "node" && target !== "cloudflare" && target !== "aws-lambda") {
98
+ if (!appRouterBuildTargetMetadata.allTargets.some((supported) => supported === target)) {
95
99
  throw new Error(`Unsupported mreactRouter build target ${JSON.stringify(target)}. Expected "node", "cloudflare", or "aws-lambda".`);
96
100
  }
97
101
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6D7E,MAAM,UAAU,8BAA8B,CAC5C,OAAgC;IAEhC,MAAM,0BAA0B,GAAG,iCAAiC,CAClE,OAAO,CAAC,UAAU,EAAE,iBAAiB,CACtC,CAAC;IAEF,IACE,OAAO,CAAC,MAAM,KAAK,SAAS;QAC5B,OAAO,CAAC,WAAW,KAAK,SAAS;QACjC,OAAO,CAAC,SA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M,IAAI,KAAK,CACb,gBAAgB,UAAU,kDAAkD,IAAI,KAAK,UAAU,KAAK,YAAY,EAAE,CACnH,CAAC;IACJ,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,WAAW,CAAC,IAAY,EAAE,IAAY;IAC7C,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY,EAAE,IAAY;IACnD,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAE1C,OAAO,YAAY,KAAK,EAAE,IAAI,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;AAC9F,CAAC","sourcesContent":["import { basename, dirname, isAbsolute, relative, resolve } from \"node:path\";\n\n/**\n * Selects the deployment runtime artifacts emitted by an app-router build.\n */\nexport type AppRouterBuildTarget = \"node\" | \"cloudflare\" | \"aws-lambda\";\n/**\n * Names a browser console method that can be stripped from client bundles.\n */\nexport type AppRouterClientConsoleMethod = \"debug\" | \"error\" | \"info\" | \"log\" | \"trace\" | \"warn\";\n/**\n * Controls how client bundle source maps are generated.\n */\nexport type AppRouterClientSourceMapMode = \"none\" | \"hidden\" | \"linked\";\n/**\n * Configures client source map output with a boolean shortcut or explicit mode.\n */\nexport type AppRouterClientSourceMapOption = boolean | AppRouterClientSourceMapMode;\n\n/**\n * Configures production-only app-router build behavior.\n */\nexport interface AppRouterProductionOptions {\n dropClientConsole?: boolean | readonly AppRouterClientConsoleMethod[] | undefined;\n}\n\nexport interface AppRouterProjectOptions {\n assetBaseUrl?: string | undefined;\n buildConcurrency?: number | undefined;\n buildTargets?: readonly AppRouterBuildTarget[] | undefined;\n clientSourceMaps?: AppRouterClientSourceMapOption | undefined;\n /**\n * Legacy route root. When provided without routesDir/projectRoot, this keeps\n * the historical \"appDir is the whole app boundary\" behavior.\n *\n * @deprecated Use projectRoot + routesDir instead. The legacy appDir shortcut\n * is kept for direct tests and older programmatic callers and is planned for\n * removal after 0.1.0.\n */\n appDir?: string | undefined;\n allowedSourceDirs?: readonly string[] | undefined;\n projectRoot?: string | undefined;\n production?: AppRouterProductionOptions | undefined;\n publicDir?: string | undefined;\n publicAssetBaseUrl?: string | undefined;\n routesDir?: string | undefined;\n}\n\nexport interface ResolvedAppRouterProject {\n allowedSourceDirs: readonly string[];\n assetBaseUrl?: string | undefined;\n buildConcurrency?: number | undefined;\n buildTargets: readonly AppRouterBuildTarget[];\n clientSourceMaps: AppRouterClientSourceMapMode;\n clientConsolePureFunctions?: readonly string[] | undefined;\n projectRoot: string;\n publicAssetBaseUrl?: string | undefined;\n publicDir: string;\n routesDir: string;\n}\n\nexport function resolveAppRouterProjectOptions(\n options: AppRouterProjectOptions,\n): ResolvedAppRouterProject {\n const clientConsolePureFunctions = resolveClientConsolePureFunctions(\n options.production?.dropClientConsole,\n );\n\n if (\n options.appDir !== undefined &&\n options.projectRoot === undefined &&\n options.routesDir === undefined\n ) {\n const appDir = resolve(options.appDir);\n\n return {\n allowedSourceDirs: (options.allowedSourceDirs ?? [appDir]).map((directory) =>\n resolveProjectPath(appDir, directory, \"allowedSourceDirs\"),\n ),\n ...(options.assetBaseUrl === undefined ? {} : { assetBaseUrl: options.assetBaseUrl }),\n ...(options.buildConcurrency === undefined\n ? {}\n : { buildConcurrency: options.buildConcurrency }),\n buildTargets: resolveBuildTargets(options.buildTargets),\n clientSourceMaps: resolveClientSourceMapMode(options.clientSourceMaps),\n ...(clientConsolePureFunctions === undefined ? {} : { clientConsolePureFunctions }),\n projectRoot: appDir,\n ...(options.publicAssetBaseUrl === undefined\n ? {}\n : { publicAssetBaseUrl: options.publicAssetBaseUrl }),\n publicDir: resolveProjectPath(appDir, options.publicDir ?? \"public\", \"publicDir\"),\n routesDir: appDir,\n };\n }\n\n const projectRoot = resolve(options.projectRoot ?? process.cwd());\n const routesDir = resolveProjectPath(projectRoot, options.routesDir ?? \"src/app\", \"routesDir\");\n const defaultAllowedSourceDirs =\n options.routesDir === undefined ? [\"src\"] : [defaultAllowedSourceDir(projectRoot, routesDir)];\n\n return {\n allowedSourceDirs: (options.allowedSourceDirs ?? defaultAllowedSourceDirs).map((directory) =>\n resolveProjectPath(projectRoot, directory, \"allowedSourceDirs\"),\n ),\n ...(options.assetBaseUrl === undefined ? {} : { assetBaseUrl: options.assetBaseUrl }),\n ...(options.buildConcurrency === undefined\n ? {}\n : { buildConcurrency: options.buildConcurrency }),\n buildTargets: resolveBuildTargets(options.buildTargets),\n clientSourceMaps: resolveClientSourceMapMode(options.clientSourceMaps),\n ...(clientConsolePureFunctions === undefined ? {} : { clientConsolePureFunctions }),\n projectRoot,\n ...(options.publicAssetBaseUrl === undefined\n ? {}\n : { publicAssetBaseUrl: options.publicAssetBaseUrl }),\n publicDir: resolveProjectPath(projectRoot, options.publicDir ?? \"public\", \"publicDir\"),\n routesDir,\n };\n}\n\nfunction defaultAllowedSourceDir(projectRoot: string, routesDir: string): string {\n const sourceRoot = dirname(routesDir);\n return basename(routesDir) === \"app\" && sourceRoot !== projectRoot ? sourceRoot : routesDir;\n}\n\nconst defaultDroppedClientConsoleMethods = [\"debug\", \"info\", \"log\"] as const;\nconst supportedClientConsoleMethods = new Set<AppRouterClientConsoleMethod>([\n \"debug\",\n \"error\",\n \"info\",\n \"log\",\n \"trace\",\n \"warn\",\n]);\n\nexport function resolveClientConsolePureFunctions(\n value: AppRouterProductionOptions[\"dropClientConsole\"],\n): readonly string[] | undefined {\n if (value === undefined || value === false) {\n return undefined;\n }\n\n const methods = value === true ? defaultDroppedClientConsoleMethods : value;\n const uniqueMethods = [...new Set(methods)];\n\n for (const method of uniqueMethods) {\n if (!supportedClientConsoleMethods.has(method)) {\n throw new Error(\n `Unsupported mreactRouter production.dropClientConsole method ${JSON.stringify(method)}. Expected \"debug\", \"error\", \"info\", \"log\", \"trace\", or \"warn\".`,\n );\n }\n }\n\n return uniqueMethods.length === 0\n ? undefined\n : uniqueMethods.map((method) => `console.${method}`);\n}\n\nexport function resolveClientSourceMapMode(\n value: AppRouterClientSourceMapOption | undefined,\n): AppRouterClientSourceMapMode {\n if (value === undefined || value === false || value === \"none\") {\n return \"none\";\n }\n\n if (value === true || value === \"linked\") {\n return \"linked\";\n }\n\n if (value === \"hidden\") {\n return \"hidden\";\n }\n\n throw new Error(\n `Unsupported mreactRouter clientSourceMaps value ${JSON.stringify(value)}. Expected false, true, \"none\", \"hidden\", or \"linked\".`,\n );\n}\n\nexport function resolveBuildTargets(\n targets: readonly AppRouterBuildTarget[] | undefined,\n): readonly AppRouterBuildTarget[] {\n if (targets === undefined) {\n return [\"node\"];\n }\n\n const uniqueTargets = [...new Set(targets)];\n\n if (uniqueTargets.length === 0) {\n throw new Error(\"mreactRouter buildTargets must include at least one target.\");\n }\n\n for (const target of uniqueTargets) {\n if (target !== \"node\" && target !== \"cloudflare\" && target !== \"aws-lambda\") {\n throw new Error(\n `Unsupported mreactRouter build target ${JSON.stringify(target)}. Expected \"node\", \"cloudflare\", or \"aws-lambda\".`,\n );\n }\n }\n\n return uniqueTargets;\n}\n\nfunction resolveProjectPath(root: string, path: string, optionName: string): string {\n const resolvedPath = resolvePath(root, path);\n\n if (!isInsideDirectory(root, resolvedPath)) {\n throw new Error(\n `mreactRouter ${optionName} must resolve inside projectRoot. projectRoot: ${root}; ${optionName}: ${resolvedPath}`,\n );\n }\n\n return resolvedPath;\n}\n\nfunction resolvePath(root: string, path: string): string {\n return isAbsolute(path) ? resolve(path) : resolve(root, path);\n}\n\nfunction isInsideDirectory(root: string, path: string): boolean {\n const relativePath = relative(root, path);\n\n return relativePath === \"\" || (!relativePath.startsWith(\"..\") && !isAbsolute(relativePath));\n}\n"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names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,KAAK,MAAM,MAAM,IAAI,aAAa,EAAE,CAAC;QACnC,IAAI,CAAC,4BAA4B,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,MAAM,CAAC,EAAE,CAAC;YACvF,MAAM,IAAI,KAAK,CACb,yCAAyC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,mDAAmD,CACnH,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAY,EAAE,IAAY,EAAE,UAAkB;IACxE,MAAM,YAAY,GAAG,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAE7C,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CACb,gBAAgB,UAAU,kDAAkD,IAAI,KAAK,UAAU,KAAK,YAAY,EAAE,CACnH,CAAC;IACJ,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,WAAW,CAAC,IAAY,EAAE,IAAY;IAC7C,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY,EAAE,IAAY;IACnD,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAE1C,OAAO,YAAY,KAAK,EAAE,IAAI,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;AAC9F,CAAC","sourcesContent":["import { basename, dirname, isAbsolute, relative, resolve } from \"node:path\";\n\n/**\n * Selects the deployment runtime artifacts emitted by an app-router build.\n */\nexport type AppRouterBuildTarget = \"node\" | \"cloudflare\" | \"aws-lambda\";\n\nexport const appRouterBuildTargetMetadata = {\n allTargets: [\"node\", \"cloudflare\", \"aws-lambda\"],\n defaultTargets: [\"node\"],\n} as const satisfies {\n allTargets: readonly AppRouterBuildTarget[];\n defaultTargets: readonly AppRouterBuildTarget[];\n};\n/**\n * Names a browser console method that can be stripped from client bundles.\n */\nexport type AppRouterClientConsoleMethod = \"debug\" | \"error\" | \"info\" | \"log\" | \"trace\" | \"warn\";\n/**\n * Controls how client bundle source maps are generated.\n */\nexport type AppRouterClientSourceMapMode = \"none\" | \"hidden\" | \"linked\";\n/**\n * Configures client source map output with a boolean shortcut or explicit mode.\n */\nexport type AppRouterClientSourceMapOption = boolean | AppRouterClientSourceMapMode;\n\n/**\n * Configures production-only app-router build behavior.\n */\nexport interface AppRouterProductionOptions {\n dropClientConsole?: boolean | readonly AppRouterClientConsoleMethod[] | undefined;\n}\n\nexport interface AppRouterProjectOptions {\n assetBaseUrl?: string | undefined;\n buildConcurrency?: number | undefined;\n buildTargets?: readonly AppRouterBuildTarget[] | undefined;\n clientSourceMaps?: AppRouterClientSourceMapOption | undefined;\n /**\n * Legacy route root. When provided without routesDir/projectRoot, this keeps\n * the historical \"appDir is the whole app boundary\" behavior.\n *\n * @deprecated Use projectRoot + routesDir instead. The legacy appDir shortcut\n * is kept for direct tests and older programmatic callers and is planned for\n * removal after 0.1.0.\n */\n appDir?: string | undefined;\n allowedSourceDirs?: readonly string[] | undefined;\n projectRoot?: string | undefined;\n production?: AppRouterProductionOptions | undefined;\n publicDir?: string | undefined;\n publicAssetBaseUrl?: string | undefined;\n routesDir?: string | undefined;\n}\n\nexport interface ResolvedAppRouterProject {\n allowedSourceDirs: readonly string[];\n assetBaseUrl?: string | undefined;\n buildConcurrency?: number | undefined;\n buildTargets: readonly AppRouterBuildTarget[];\n clientSourceMaps: AppRouterClientSourceMapMode;\n clientConsolePureFunctions?: readonly string[] | undefined;\n projectRoot: string;\n publicAssetBaseUrl?: string | undefined;\n publicDir: string;\n routesDir: string;\n}\n\nexport function resolveAppRouterProjectOptions(\n options: AppRouterProjectOptions,\n): ResolvedAppRouterProject {\n const clientConsolePureFunctions = resolveClientConsolePureFunctions(\n options.production?.dropClientConsole,\n );\n\n if (\n options.appDir !== undefined &&\n options.projectRoot === undefined &&\n options.routesDir === undefined\n ) {\n const appDir = resolve(options.appDir);\n\n return {\n allowedSourceDirs: (options.allowedSourceDirs ?? [appDir]).map((directory) =>\n resolveProjectPath(appDir, directory, \"allowedSourceDirs\"),\n ),\n ...(options.assetBaseUrl === undefined ? {} : { assetBaseUrl: options.assetBaseUrl }),\n ...(options.buildConcurrency === undefined\n ? {}\n : { buildConcurrency: options.buildConcurrency }),\n buildTargets: resolveBuildTargets(options.buildTargets),\n clientSourceMaps: resolveClientSourceMapMode(options.clientSourceMaps),\n ...(clientConsolePureFunctions === undefined ? {} : { clientConsolePureFunctions }),\n projectRoot: appDir,\n ...(options.publicAssetBaseUrl === undefined\n ? {}\n : { publicAssetBaseUrl: options.publicAssetBaseUrl }),\n publicDir: resolveProjectPath(appDir, options.publicDir ?? \"public\", \"publicDir\"),\n routesDir: appDir,\n };\n }\n\n const projectRoot = resolve(options.projectRoot ?? process.cwd());\n const routesDir = resolveProjectPath(projectRoot, options.routesDir ?? \"src/app\", \"routesDir\");\n const defaultAllowedSourceDirs =\n options.routesDir === undefined ? [\"src\"] : [defaultAllowedSourceDir(projectRoot, routesDir)];\n\n return {\n allowedSourceDirs: (options.allowedSourceDirs ?? defaultAllowedSourceDirs).map((directory) =>\n resolveProjectPath(projectRoot, directory, \"allowedSourceDirs\"),\n ),\n ...(options.assetBaseUrl === undefined ? {} : { assetBaseUrl: options.assetBaseUrl }),\n ...(options.buildConcurrency === undefined\n ? {}\n : { buildConcurrency: options.buildConcurrency }),\n buildTargets: resolveBuildTargets(options.buildTargets),\n clientSourceMaps: resolveClientSourceMapMode(options.clientSourceMaps),\n ...(clientConsolePureFunctions === undefined ? {} : { clientConsolePureFunctions }),\n projectRoot,\n ...(options.publicAssetBaseUrl === undefined\n ? {}\n : { publicAssetBaseUrl: options.publicAssetBaseUrl }),\n publicDir: resolveProjectPath(projectRoot, options.publicDir ?? \"public\", \"publicDir\"),\n routesDir,\n };\n}\n\nfunction defaultAllowedSourceDir(projectRoot: string, routesDir: string): string {\n const sourceRoot = dirname(routesDir);\n return basename(routesDir) === \"app\" && sourceRoot !== projectRoot ? sourceRoot : routesDir;\n}\n\nconst defaultDroppedClientConsoleMethods = [\"debug\", \"info\", \"log\"] as const;\nconst supportedClientConsoleMethods = new Set<AppRouterClientConsoleMethod>([\n \"debug\",\n \"error\",\n \"info\",\n \"log\",\n \"trace\",\n \"warn\",\n]);\n\nexport function resolveClientConsolePureFunctions(\n value: AppRouterProductionOptions[\"dropClientConsole\"],\n): readonly string[] | undefined {\n if (value === undefined || value === false) {\n return undefined;\n }\n\n const methods = value === true ? defaultDroppedClientConsoleMethods : value;\n const uniqueMethods = [...new Set(methods)];\n\n for (const method of uniqueMethods) {\n if (!supportedClientConsoleMethods.has(method)) {\n throw new Error(\n `Unsupported mreactRouter production.dropClientConsole method ${JSON.stringify(method)}. Expected \"debug\", \"error\", \"info\", \"log\", \"trace\", or \"warn\".`,\n );\n }\n }\n\n return uniqueMethods.length === 0\n ? undefined\n : uniqueMethods.map((method) => `console.${method}`);\n}\n\nexport function resolveClientSourceMapMode(\n value: AppRouterClientSourceMapOption | undefined,\n): AppRouterClientSourceMapMode {\n if (value === undefined || value === false || value === \"none\") {\n return \"none\";\n }\n\n if (value === true || value === \"linked\") {\n return \"linked\";\n }\n\n if (value === \"hidden\") {\n return \"hidden\";\n }\n\n throw new Error(\n `Unsupported mreactRouter clientSourceMaps value ${JSON.stringify(value)}. Expected false, true, \"none\", \"hidden\", or \"linked\".`,\n );\n}\n\nexport function resolveBuildTargets(\n targets: readonly AppRouterBuildTarget[] | undefined,\n): readonly AppRouterBuildTarget[] {\n if (targets === undefined) {\n return appRouterBuildTargetMetadata.defaultTargets;\n }\n\n const uniqueTargets = [...new Set(targets)];\n\n if (uniqueTargets.length === 0) {\n throw new Error(\"mreactRouter buildTargets must include at least one target.\");\n }\n\n for (const target of uniqueTargets) {\n if (!appRouterBuildTargetMetadata.allTargets.some((supported) => supported === target)) {\n throw new Error(\n `Unsupported mreactRouter build target ${JSON.stringify(target)}. Expected \"node\", \"cloudflare\", or \"aws-lambda\".`,\n );\n }\n }\n\n return uniqueTargets;\n}\n\nfunction resolveProjectPath(root: string, path: string, optionName: string): string {\n const resolvedPath = resolvePath(root, path);\n\n if (!isInsideDirectory(root, resolvedPath)) {\n throw new Error(\n `mreactRouter ${optionName} must resolve inside projectRoot. projectRoot: ${root}; ${optionName}: ${resolvedPath}`,\n );\n }\n\n return resolvedPath;\n}\n\nfunction resolvePath(root: string, path: string): string {\n return isAbsolute(path) ? resolve(path) : resolve(root, path);\n}\n\nfunction isInsideDirectory(root: string, path: string): boolean {\n const relativePath = relative(root, path);\n\n return relativePath === \"\" || (!relativePath.startsWith(\"..\") && !isAbsolute(relativePath));\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export { defer, isDeferredLoaderData } from "./deferred.js";
7
7
  export type { DeferredLoaderData } from "./deferred.js";
8
8
  export { definePage } from "./types.js";
9
9
  export { Link, linkProps } from "./link.js";
10
+ export type { LinkSerializableAttribute, LinkSinkChild, LinkSinkProps } from "./link.js";
10
11
  export { href } from "./typed-routes.js";
11
12
  export { parseMultipartStream } from "./multipart.js";
12
13
  export type { MultipartFixedLengthStream, MultipartStreamFieldOptions, MultipartStreamParseOptions, MultipartStreamPart, } from "./multipart.js";
@@ -14,44 +15,44 @@ export { getNavigationState, subscribeNavigationState } from "./navigation-state
14
15
  export { getRouterRuntimeCacheStats } from "./runtime-cache.js";
15
16
  export type { HttpUpgradeHandler } from "./upgrade.js";
16
17
  export { cookies, headers, html, isNotFoundError, isRedirectError, json, next, notFound, parseForm, redirect, redirect303, redirectExternal, rewrite, textError, throwNotFound, } from "./navigation.js";
17
- export type { ParseSchema } from "./navigation.js";
18
+ export type { MiddlewareNext, ParseSchema, RedirectOptions, RequestCookies } from "./navigation.js";
18
19
  export { createMemoryPrerenderStore } from "./prerender-store.js";
19
20
  export { getServerRuntimeState } from "./runtime-state.js";
20
- import { createMemorySessionStore as createMemorySessionStoreInternal, createSession as createSessionInternal, destroySession as destroySessionInternal, getSession as getSessionInternal, rotateSession as rotateSessionInternal } from "./session.js";
21
21
  import type { MemorySessionStoreOptions as MemorySessionStoreOptionsInternal, SessionCookieOptions as SessionCookieOptionsInternal, SessionRecord as SessionRecordInternal, SessionStore as SessionStoreInternal } from "./session.js";
22
22
  /**
23
23
  * Creates a deprecated process-local session store alias.
24
24
  *
25
25
  * @deprecated Import session helpers from `@reckona/mreact-auth` instead.
26
26
  */
27
- export declare const createMemorySessionStore: typeof createMemorySessionStoreInternal;
27
+ export declare function createMemorySessionStore<TData = unknown>(options?: MemorySessionStoreOptionsInternal): SessionStoreInternal<TData>;
28
28
  /**
29
29
  * Creates a deprecated session record and cookie alias.
30
30
  *
31
31
  * @deprecated Import session helpers from `@reckona/mreact-auth` instead.
32
32
  */
33
- export declare const createSession: typeof createSessionInternal;
33
+ export declare function createSession<TData>(response: Response, store: SessionStoreInternal<TData>, data: TData, options?: SessionCookieOptionsInternal): Promise<SessionRecordInternal<TData>>;
34
34
  /**
35
35
  * Destroys a session through a deprecated router session alias.
36
36
  *
37
37
  * @deprecated Import session helpers from `@reckona/mreact-auth` instead.
38
38
  */
39
- export declare const destroySession: typeof destroySessionInternal;
39
+ export declare function destroySession<TData>(request: Request, response: Response, store: SessionStoreInternal<TData>, options?: SessionCookieOptionsInternal): Promise<void>;
40
40
  /**
41
41
  * Reads a session through a deprecated router session alias.
42
42
  *
43
43
  * @deprecated Import session helpers from `@reckona/mreact-auth` instead.
44
44
  */
45
- export declare const getSession: typeof getSessionInternal;
45
+ export declare function getSession<TData>(request: Request, store: SessionStoreInternal<TData>, options?: SessionCookieOptionsInternal): Promise<SessionRecordInternal<TData> | undefined>;
46
46
  /**
47
47
  * Rotates a session through a deprecated router session alias.
48
48
  *
49
49
  * @deprecated Import session helpers from `@reckona/mreact-auth` instead.
50
50
  */
51
- export declare const rotateSession: typeof rotateSessionInternal;
52
- export type { AwsLambdaArtifactManifest, BuildAppPhase, BuildAppPhaseTiming, BuildAppOptions, BuildAppProgressEvent, BuildAppResult, BuiltImportPolicyArtifact, CloudflarePagesArtifactManifest, PackageAwsLambdaArtifactOptions, PackageCloudflarePagesArtifactOptions, } from "./build.js";
51
+ export declare function rotateSession<TData>(request: Request, response: Response, store: SessionStoreInternal<TData>, options?: SessionCookieOptionsInternal): Promise<SessionRecordInternal<TData> | undefined>;
52
+ export type { AwsLambdaArtifactManifest, BuildAppPhase, BuildAppPhaseTiming, BuildAppOptions, BuildAppProgressEvent, BuildAppResult, BuiltImportPolicyArtifact, BuiltPrerenderedRoute, BuiltRouteSourceAnalysisSummary, BuiltServerModuleArtifact, BuiltServerModuleOutput, CloudflarePagesArtifactManifest, PackageAwsLambdaArtifactOptions, PackageCloudflarePagesArtifactOptions, } from "./build.js";
53
+ export type { AppRouterProjectOptions } from "./config.js";
53
54
  export type { ServerActionContext } from "./actions.js";
54
- export type { AppRouteHref, AppRouteLinkHref, AppRouteLinkHrefSuffix, AppRouteLinkPathname, AppRouteLinkSegment, AppRouteLinkSegments, DynamicHrefOptions, RouteParamsFor, RouteSearchParams, RouteSearchValue, StaticHrefOptions, } from "./typed-routes.js";
55
+ export type { AppRouteHref, AppRouteLinkHref, AppRouteLinkHrefSuffix, AppRouteLinkPathname, AppRouteLinkSegment, AppRouteLinkSegments, DynamicHrefOptions, RouteParamsFor, RouteSearchParams, RouteSearchValue, SegmentRouteParam, StaticHrefOptions, ExtractRouteParams, HasRouteParams, Simplify, } from "./typed-routes.js";
55
56
  export type { InferLoaderData, InferLoaderParams, LayoutProps, LoaderContext, GenerateMetadataContext, ManifestContext, ManifestDescriptor, MetadataImage, MetadataScalar, MetadataThemeColor, MetadataViewport, MReactNode, PageProps, PageComponent, RobotsContext, RobotsManifest, RobotsRule, RouteHeadDescriptor, RouteHandlerContext, RouteLoader, RouteMetadata, RouteParams, RouteSecurityHeaders, RouteStrictTransportSecurity, SitemapContext, SitemapEntry, } from "./types.js";
56
57
  export type { AppRouterBuildTarget, AppRouterClientConsoleMethod, AppRouterClientSourceMapMode, AppRouterClientSourceMapOption, AppRouterProductionOptions, } from "./config.js";
57
58
  export type { AssetHelperOptions, AssetLinkDescriptor, AssetManifest, AssetManifestEntry, } from "./assets.js";
@@ -64,7 +65,7 @@ export type { AppRouteDeclarations, ConcreteLinkHrefGuard, LinkChild, LinkHref,
64
65
  export type { AppRouterNavigationState, AppRouterNavigationStateListener, AppRouterNavigationType, } from "./navigation-state.js";
65
66
  export type { RouterRuntimeCacheStat } from "./runtime-cache.js";
66
67
  /** Configures the deprecated router memory session store alias. */
67
- export type { MemorySessionStoreOptionsInternal as MemorySessionStoreOptions };
68
+ export type { MemorySessionStoreOptions } from "./session.js";
68
69
  export type { AppRouterCspInlineNonceWarningLogEvent, AppRouterLogError, AppRouterLogEvent, AppRouterLogger, AppRouterLogLevel, AppRouterRuntime, AppRouterRequestEndLogEvent, AppRouterRequestErrorLogEvent, AppRouterRenderTimingLogEvent, AppRouterRequestStartLogEvent, AppRouterRequestTimingLogEvent, } from "./logger.js";
69
70
  export type { DetectedLocale, LocaleRoutingOptions, MessageTree } from "./i18n.js";
70
71
  export { createFormCsrfToken, formCsrfCookie, formCsrfFieldName, validateFormCsrf, } from "./csrf.js";
@@ -74,30 +75,32 @@ export type { AppRouterAllowedServerAction, AppRouterServerActionOptions, Prepar
74
75
  *
75
76
  * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.
76
77
  */
77
- export type SessionCookieOptions = SessionCookieOptionsInternal;
78
+ export type { SessionCookieOptions } from "./session.js";
78
79
  /**
79
80
  * Stores session data through the deprecated router session record alias.
80
81
  *
81
82
  * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.
82
83
  */
83
- export type SessionRecord<TData = unknown> = SessionRecordInternal<TData>;
84
+ export type { SessionRecord } from "./session.js";
84
85
  /**
85
86
  * Defines session persistence through the deprecated router session store alias.
86
87
  *
87
88
  * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.
88
89
  */
89
- export type SessionStore<TData = unknown> = SessionStoreInternal<TData>;
90
+ export type { SessionStore } from "./session.js";
90
91
  export { startDevServer } from "./dev-server.js";
91
92
  export type { StartDevServerOptions } from "./dev-server.js";
92
93
  export { renderAppRequest } from "./render.js";
93
- export type { AppRouterResponseHook, AppRouterResponseHookContext, RenderAppRequestOptions, } from "./render.js";
94
+ export type { AppRouterRenderPreload, AppRouterResponseHook, AppRouterResponseHookContext, RenderAppRequestOptions, } from "./render.js";
94
95
  export { parseTraceContext, traceContextFromRequest, } from "./trace.js";
95
96
  export type { RouterInstrumentation, RouterMiddlewareEndInstrumentationEvent, RouterMiddlewareInstrumentationEvent, RouterRequestEndInstrumentationEvent, RouterRequestInstrumentationEvent, RouterRouteEndInstrumentationEvent, RouterRouteInstrumentationEvent, RouterTraceContext, } from "./trace.js";
96
- export type { FileSystemPrerenderStoreOptions, KeyValuePrerenderStoreAdapter, KeyValuePrerenderStoreOptions, MemoryPrerenderStoreOptions, } from "./prerender-store.js";
97
+ export type { FileSystemPrerenderStoreOptions, KeyValuePrerenderStoreAdapter, KeyValuePrerenderStoreOptions, MemoryPrerenderStoreEntry, MemoryPrerenderStoreOptions, } from "./prerender-store.js";
97
98
  export { createFileSystemPrerenderStore, createKeyValuePrerenderStore } from "./prerender-store.js";
98
99
  export { preloadBuiltAppRuntime, renderBuiltAppRequest, startServer } from "./serve.js";
99
- export type { BuiltAppRuntimePreloadMode, AppRouterPrerenderStore, BuiltAppRuntimePreloadStrategy, RenderBuiltAppRequestOptions, RequestHostPolicy, StartServerOptions, } from "./serve.js";
100
+ export type { BuiltAppRuntimePreloadMode, AppRouterPrerenderStore, BuiltAppRuntimePreloadStrategy, RenderBuiltAppRequestOptions, RequestHostPolicy, ResponseSinkStrategy, StartServerOptions, } from "./serve.js";
100
101
  export { matchRoute, scanAppRoutes } from "./routes.js";
102
+ export type { CachedClientRouteSource, ClientRouteInferenceCache } from "./client.js";
103
+ export type { RouteMatcher, ScanAppRoutesOptions } from "./routes.js";
101
104
  export type { AppFileConvention } from "./file-conventions.js";
102
105
  export type { AppAssetRoute, AppMetadataRoute, AppRoute, MatchedRoute, PageRoute, RouteSegment, ServerRoute, } from "./routes.js";
103
106
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC5D,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,E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ACjC,kCAAkC,EAClC,+BAA+B,EAC/B,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,+BAA+B,EAC/B,6BAA6B,EAC7B,6BAA6B,EAC7B,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,8BAA8B,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACxF,YAAY,EACV,0BAA0B,EAC1B,uBAAuB,EACvB,8BAA8B,EAC9B,4BAA4B,EAC5B,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACxD,YAAY,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACtF,YAAY,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACtE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,WAAW,GACZ,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -19,31 +19,41 @@ import { createMemorySessionStore as createMemorySessionStoreInternal, createSes
19
19
  *
20
20
  * @deprecated Import session helpers from `@reckona/mreact-auth` instead.
21
21
  */
22
- export const createMemorySessionStore = createMemorySessionStoreInternal;
22
+ export function createMemorySessionStore(options = {}) {
23
+ return createMemorySessionStoreInternal(options);
24
+ }
23
25
  /**
24
26
  * Creates a deprecated session record and cookie alias.
25
27
  *
26
28
  * @deprecated Import session helpers from `@reckona/mreact-auth` instead.
27
29
  */
28
- export const createSession = createSessionInternal;
30
+ export async function createSession(response, store, data, options = {}) {
31
+ return createSessionInternal(response, store, data, options);
32
+ }
29
33
  /**
30
34
  * Destroys a session through a deprecated router session alias.
31
35
  *
32
36
  * @deprecated Import session helpers from `@reckona/mreact-auth` instead.
33
37
  */
34
- export const destroySession = destroySessionInternal;
38
+ export async function destroySession(request, response, store, options = {}) {
39
+ return destroySessionInternal(request, response, store, options);
40
+ }
35
41
  /**
36
42
  * Reads a session through a deprecated router session alias.
37
43
  *
38
44
  * @deprecated Import session helpers from `@reckona/mreact-auth` instead.
39
45
  */
40
- export const getSession = getSessionInternal;
46
+ export async function getSession(request, store, options = {}) {
47
+ return getSessionInternal(request, store, options);
48
+ }
41
49
  /**
42
50
  * Rotates a session through a deprecated router session alias.
43
51
  *
44
52
  * @deprecated Import session helpers from `@reckona/mreact-auth` instead.
45
53
  */
46
- export const rotateSession = rotateSessionInternal;
54
+ export async function rotateSession(request, response, store, options = {}) {
55
+ return rotateSessionInternal(request, response, store, options);
56
+ }
47
57
  export { createFormCsrfToken, formCsrfCookie, formCsrfFieldName, validateFormCsrf, } from "./csrf.js";
48
58
  export { startDevServer } from "./dev-server.js";
49
59
  export { renderAppRequest } from "./render.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,UAAU,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AO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAM/C,OAAO,EACL,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,YAAY,CAAC;AAiBpB,OAAO,EAAE,8BAA8B,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AASxF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { buildApp, packageAwsLambdaArtifact, packageCloudflarePagesArtifact } from \"./build.js\";\nexport { assetHref, assetPreloadLinks } from \"./assets.js\";\nexport { cacheControl, createMemoryRouteCache, revalidatePath } from \"./cache.js\";\nexport { deleteCookie, parseCookieHeader, serializeCookie, setCookie } from \"./cookies.js\";\nexport { defineMessages, detectLocale } from \"./i18n.js\";\nexport { defer, isDeferredLoaderData } from \"./deferred.js\";\nexport type { DeferredLoaderData } from \"./deferred.js\";\nexport { definePage } from \"./types.js\";\nexport { Link, linkProps } from \"./link.js\";\nexport { href } from \"./typed-routes.js\";\nexport { parseMultipartStream } from \"./multipart.js\";\nexport type {\n MultipartFixedLengthStream,\n MultipartStreamFieldOptions,\n MultipartStreamParseOptions,\n MultipartStreamPart,\n} from \"./multipart.js\";\nexport { getNavigationState, subscribeNavigationState } from \"./navigation-state.js\";\nexport { getRouterRuntimeCacheStats } from \"./runtime-cache.js\";\nexport type { HttpUpgradeHandler } from \"./upgrade.js\";\nexport {\n cookies,\n headers,\n html,\n isNotFoundError,\n isRedirectError,\n json,\n next,\n notFound,\n parseForm,\n redirect,\n redirect303,\n redirectExternal,\n rewrite,\n textError,\n throwNotFound,\n} from \"./navigation.js\";\nexport type { ParseSchema } from \"./navigation.js\";\nexport { createMemoryPrerenderStore } from \"./prerender-store.js\";\nexport { getServerRuntimeState } from \"./runtime-state.js\";\nimport {\n createMemorySessionStore as createMemorySessionStoreInternal,\n createSession as createSessionInternal,\n destroySession as destroySessionInternal,\n getSession as getSessionInternal,\n rotateSession as rotateSessionInternal,\n} from \"./session.js\";\nimport type {\n MemorySessionStoreOptions as MemorySessionStoreOptionsInternal,\n SessionCookieOptions as SessionCookieOptionsInternal,\n SessionRecord as SessionRecordInternal,\n SessionStore as SessionStoreInternal,\n} from \"./session.js\";\n\n/**\n * Creates a deprecated process-local session store alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const createMemorySessionStore = createMemorySessionStoreInternal;\n/**\n * Creates a deprecated session record and cookie alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const createSession = createSessionInternal;\n/**\n * Destroys a session through a deprecated router session alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const destroySession = destroySessionInternal;\n/**\n * Reads a session through a deprecated router session alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const getSession = getSessionInternal;\n/**\n * Rotates a session through a deprecated router session alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const rotateSession = rotateSessionInternal;\nexport type {\n AwsLambdaArtifactManifest,\n BuildAppPhase,\n BuildAppPhaseTiming,\n BuildAppOptions,\n BuildAppProgressEvent,\n BuildAppResult,\n BuiltImportPolicyArtifact,\n CloudflarePagesArtifactManifest,\n PackageAwsLambdaArtifactOptions,\n PackageCloudflarePagesArtifactOptions,\n} from \"./build.js\";\nexport type { ServerActionContext } from \"./actions.js\";\nexport type {\n AppRouteHref,\n AppRouteLinkHref,\n AppRouteLinkHrefSuffix,\n AppRouteLinkPathname,\n AppRouteLinkSegment,\n AppRouteLinkSegments,\n DynamicHrefOptions,\n RouteParamsFor,\n RouteSearchParams,\n RouteSearchValue,\n StaticHrefOptions,\n} from \"./typed-routes.js\";\nexport type {\n InferLoaderData,\n InferLoaderParams,\n LayoutProps,\n LoaderContext,\n GenerateMetadataContext,\n ManifestContext,\n ManifestDescriptor,\n MetadataImage,\n MetadataScalar,\n MetadataThemeColor,\n MetadataViewport,\n MReactNode,\n PageProps,\n PageComponent,\n RobotsContext,\n RobotsManifest,\n RobotsRule,\n RouteHeadDescriptor,\n RouteHandlerContext,\n RouteLoader,\n RouteMetadata,\n RouteParams,\n RouteSecurityHeaders,\n RouteStrictTransportSecurity,\n SitemapContext,\n SitemapEntry,\n} from \"./types.js\";\nexport type {\n AppRouterBuildTarget,\n AppRouterClientConsoleMethod,\n AppRouterClientSourceMapMode,\n AppRouterClientSourceMapOption,\n AppRouterProductionOptions,\n} from \"./config.js\";\nexport type {\n AssetHelperOptions,\n AssetLinkDescriptor,\n AssetManifest,\n AssetManifestEntry,\n} from \"./assets.js\";\nexport type {\n AppRouterCache,\n AppRouterCacheEntry,\n CacheControlOptions,\n MemoryRouteCacheOptions,\n RouteCachePolicy,\n} from \"./cache.js\";\nexport type { CookieOptions } from \"./cookies.js\";\nexport type { AppRouterImportPolicy } from \"./import-policy.js\";\n/** Re-exports link types used by the router root entrypoint. */\nexport type {\n AppRouteDeclarations,\n ConcreteLinkHrefGuard,\n LinkChild,\n LinkHref,\n LinkOptions,\n LinkPrefetch,\n LinkProps,\n RegisteredAppRoutePath,\n LinkScroll,\n LinkTransition,\n TrustedLinkHtml,\n} from \"./link.js\";\n/** Re-exports client navigation state types used by the router root entrypoint. */\nexport type {\n AppRouterNavigationState,\n AppRouterNavigationStateListener,\n AppRouterNavigationType,\n} from \"./navigation-state.js\";\nexport type { RouterRuntimeCacheStat } from \"./runtime-cache.js\";\n/** Configures the deprecated router memory session store alias. */\nexport type { MemorySessionStoreOptionsInternal as MemorySessionStoreOptions };\nexport type {\n AppRouterCspInlineNonceWarningLogEvent,\n AppRouterLogError,\n AppRouterLogEvent,\n AppRouterLogger,\n AppRouterLogLevel,\n AppRouterRuntime,\n AppRouterRequestEndLogEvent,\n AppRouterRequestErrorLogEvent,\n AppRouterRenderTimingLogEvent,\n AppRouterRequestStartLogEvent,\n AppRouterRequestTimingLogEvent,\n} from \"./logger.js\";\nexport type { DetectedLocale, LocaleRoutingOptions, MessageTree } from \"./i18n.js\";\nexport {\n createFormCsrfToken,\n formCsrfCookie,\n formCsrfFieldName,\n validateFormCsrf,\n} from \"./csrf.js\";\nexport type {\n AppRouterAllowedServerAction,\n AppRouterServerActionOptions,\n PreparedFormActionReference,\n} from \"./actions.js\";\n/**\n * Configures the deprecated router session cookie alias.\n *\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type SessionCookieOptions = SessionCookieOptionsInternal;\n/**\n * Stores session data through the deprecated router session record alias.\n *\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type SessionRecord<TData = unknown> = SessionRecordInternal<TData>;\n/**\n * Defines session persistence through the deprecated router session store alias.\n *\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type SessionStore<TData = unknown> = SessionStoreInternal<TData>;\nexport { startDevServer } from \"./dev-server.js\";\nexport type { StartDevServerOptions } from \"./dev-server.js\";\nexport { renderAppRequest } from \"./render.js\";\nexport type {\n AppRouterResponseHook,\n AppRouterResponseHookContext,\n RenderAppRequestOptions,\n} from \"./render.js\";\nexport {\n parseTraceContext,\n traceContextFromRequest,\n} from \"./trace.js\";\nexport type {\n RouterInstrumentation,\n RouterMiddlewareEndInstrumentationEvent,\n RouterMiddlewareInstrumentationEvent,\n RouterRequestEndInstrumentationEvent,\n RouterRequestInstrumentationEvent,\n RouterRouteEndInstrumentationEvent,\n RouterRouteInstrumentationEvent,\n RouterTraceContext,\n} from \"./trace.js\";\nexport type {\n FileSystemPrerenderStoreOptions,\n KeyValuePrerenderStoreAdapter,\n KeyValuePrerenderStoreOptions,\n MemoryPrerenderStoreOptions,\n} from \"./prerender-store.js\";\nexport { createFileSystemPrerenderStore, createKeyValuePrerenderStore } from \"./prerender-store.js\";\nexport { preloadBuiltAppRuntime, renderBuiltAppRequest, startServer } from \"./serve.js\";\nexport type {\n BuiltAppRuntimePreloadMode,\n AppRouterPrerenderStore,\n BuiltAppRuntimePreloadStrategy,\n RenderBuiltAppRequestOptions,\n RequestHostPolicy,\n StartServerOptions,\n} from \"./serve.js\";\nexport { matchRoute, scanAppRoutes } from \"./routes.js\";\nexport type { AppFileConvention } from \"./file-conventions.js\";\nexport type {\n AppAssetRoute,\n AppMetadataRoute,\n AppRoute,\n MatchedRoute,\n PageRoute,\n RouteSegment,\n ServerRoute,\n} from \"./routes.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAOtD,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EACL,OAAO,EACP,OAAO,EACP,IAAI,EACJ,eAAe,EACf,eAAe,EACf,IAAI,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C,OAAO,GAAiC,EAAE;IAE1C,OAAO,qBAAqB,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAClE,CAAC;AA2HD,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAwBnB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAO/C,OAAO,EACL,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,YAAY,CAAC;AAkBpB,OAAO,EAAE,8BAA8B,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAUxF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { buildApp, packageAwsLambdaArtifact, packageCloudflarePagesArtifact } from \"./build.js\";\nexport { assetHref, assetPreloadLinks } from \"./assets.js\";\nexport { cacheControl, createMemoryRouteCache, revalidatePath } from \"./cache.js\";\nexport { deleteCookie, parseCookieHeader, serializeCookie, setCookie } from \"./cookies.js\";\nexport { defineMessages, detectLocale } from \"./i18n.js\";\nexport { defer, isDeferredLoaderData } from \"./deferred.js\";\nexport type { DeferredLoaderData } from \"./deferred.js\";\nexport { definePage } from \"./types.js\";\nexport { Link, linkProps } from \"./link.js\";\nexport type { LinkSerializableAttribute, LinkSinkChild, LinkSinkProps } from \"./link.js\";\nexport { href } from \"./typed-routes.js\";\nexport { parseMultipartStream } from \"./multipart.js\";\nexport type {\n MultipartFixedLengthStream,\n MultipartStreamFieldOptions,\n MultipartStreamParseOptions,\n MultipartStreamPart,\n} from \"./multipart.js\";\nexport { getNavigationState, subscribeNavigationState } from \"./navigation-state.js\";\nexport { getRouterRuntimeCacheStats } from \"./runtime-cache.js\";\nexport type { HttpUpgradeHandler } from \"./upgrade.js\";\nexport {\n cookies,\n headers,\n html,\n isNotFoundError,\n isRedirectError,\n json,\n next,\n notFound,\n parseForm,\n redirect,\n redirect303,\n redirectExternal,\n rewrite,\n textError,\n throwNotFound,\n} from \"./navigation.js\";\nexport type { MiddlewareNext, ParseSchema, RedirectOptions, RequestCookies } from \"./navigation.js\";\nexport { createMemoryPrerenderStore } from \"./prerender-store.js\";\nexport { getServerRuntimeState } from \"./runtime-state.js\";\nimport {\n createMemorySessionStore as createMemorySessionStoreInternal,\n createSession as createSessionInternal,\n destroySession as destroySessionInternal,\n getSession as getSessionInternal,\n rotateSession as rotateSessionInternal,\n} from \"./session.js\";\nimport type {\n MemorySessionStoreOptions as MemorySessionStoreOptionsInternal,\n SessionCookieOptions as SessionCookieOptionsInternal,\n SessionRecord as SessionRecordInternal,\n SessionStore as SessionStoreInternal,\n} from \"./session.js\";\n\n/**\n * Creates a deprecated process-local session store alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport function createMemorySessionStore<TData = unknown>(\n options: MemorySessionStoreOptionsInternal = {},\n): SessionStoreInternal<TData> {\n return createMemorySessionStoreInternal<TData>(options);\n}\n/**\n * Creates a deprecated session record and cookie alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport async function createSession<TData>(\n response: Response,\n store: SessionStoreInternal<TData>,\n data: TData,\n options: SessionCookieOptionsInternal = {},\n): Promise<SessionRecordInternal<TData>> {\n return createSessionInternal(response, store, data, options);\n}\n/**\n * Destroys a session through a deprecated router session alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport async function destroySession<TData>(\n request: Request,\n response: Response,\n store: SessionStoreInternal<TData>,\n options: SessionCookieOptionsInternal = {},\n): Promise<void> {\n return destroySessionInternal(request, response, store, options);\n}\n/**\n * Reads a session through a deprecated router session alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport async function getSession<TData>(\n request: Request,\n store: SessionStoreInternal<TData>,\n options: SessionCookieOptionsInternal = {},\n): Promise<SessionRecordInternal<TData> | undefined> {\n return getSessionInternal(request, store, options);\n}\n/**\n * Rotates a session through a deprecated router session alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport async function rotateSession<TData>(\n request: Request,\n response: Response,\n store: SessionStoreInternal<TData>,\n options: SessionCookieOptionsInternal = {},\n): Promise<SessionRecordInternal<TData> | undefined> {\n return rotateSessionInternal(request, response, store, options);\n}\nexport type {\n AwsLambdaArtifactManifest,\n BuildAppPhase,\n BuildAppPhaseTiming,\n BuildAppOptions,\n BuildAppProgressEvent,\n BuildAppResult,\n BuiltImportPolicyArtifact,\n BuiltPrerenderedRoute,\n BuiltRouteSourceAnalysisSummary,\n BuiltServerModuleArtifact,\n BuiltServerModuleOutput,\n CloudflarePagesArtifactManifest,\n PackageAwsLambdaArtifactOptions,\n PackageCloudflarePagesArtifactOptions,\n} from \"./build.js\";\nexport type { AppRouterProjectOptions } from \"./config.js\";\nexport type { ServerActionContext } from \"./actions.js\";\nexport type {\n AppRouteHref,\n AppRouteLinkHref,\n AppRouteLinkHrefSuffix,\n AppRouteLinkPathname,\n AppRouteLinkSegment,\n AppRouteLinkSegments,\n DynamicHrefOptions,\n RouteParamsFor,\n RouteSearchParams,\n RouteSearchValue,\n SegmentRouteParam,\n StaticHrefOptions,\n ExtractRouteParams,\n HasRouteParams,\n Simplify,\n} from \"./typed-routes.js\";\nexport type {\n InferLoaderData,\n InferLoaderParams,\n LayoutProps,\n LoaderContext,\n GenerateMetadataContext,\n ManifestContext,\n ManifestDescriptor,\n MetadataImage,\n MetadataScalar,\n MetadataThemeColor,\n MetadataViewport,\n MReactNode,\n PageProps,\n PageComponent,\n RobotsContext,\n RobotsManifest,\n RobotsRule,\n RouteHeadDescriptor,\n RouteHandlerContext,\n RouteLoader,\n RouteMetadata,\n RouteParams,\n RouteSecurityHeaders,\n RouteStrictTransportSecurity,\n SitemapContext,\n SitemapEntry,\n} from \"./types.js\";\nexport type {\n AppRouterBuildTarget,\n AppRouterClientConsoleMethod,\n AppRouterClientSourceMapMode,\n AppRouterClientSourceMapOption,\n AppRouterProductionOptions,\n} from \"./config.js\";\nexport type {\n AssetHelperOptions,\n AssetLinkDescriptor,\n AssetManifest,\n AssetManifestEntry,\n} from \"./assets.js\";\nexport type {\n AppRouterCache,\n AppRouterCacheEntry,\n CacheControlOptions,\n MemoryRouteCacheOptions,\n RouteCachePolicy,\n} from \"./cache.js\";\nexport type { CookieOptions } from \"./cookies.js\";\nexport type { AppRouterImportPolicy } from \"./import-policy.js\";\n/** Re-exports link types used by the router root entrypoint. */\nexport type {\n AppRouteDeclarations,\n ConcreteLinkHrefGuard,\n LinkChild,\n LinkHref,\n LinkOptions,\n LinkPrefetch,\n LinkProps,\n RegisteredAppRoutePath,\n LinkScroll,\n LinkTransition,\n TrustedLinkHtml,\n} from \"./link.js\";\n/** Re-exports client navigation state types used by the router root entrypoint. */\nexport type {\n AppRouterNavigationState,\n AppRouterNavigationStateListener,\n AppRouterNavigationType,\n} from \"./navigation-state.js\";\nexport type { RouterRuntimeCacheStat } from \"./runtime-cache.js\";\n/** Configures the deprecated router memory session store alias. */\nexport type { MemorySessionStoreOptions } from \"./session.js\";\nexport type {\n AppRouterCspInlineNonceWarningLogEvent,\n AppRouterLogError,\n AppRouterLogEvent,\n AppRouterLogger,\n AppRouterLogLevel,\n AppRouterRuntime,\n AppRouterRequestEndLogEvent,\n AppRouterRequestErrorLogEvent,\n AppRouterRenderTimingLogEvent,\n AppRouterRequestStartLogEvent,\n AppRouterRequestTimingLogEvent,\n} from \"./logger.js\";\nexport type { DetectedLocale, LocaleRoutingOptions, MessageTree } from \"./i18n.js\";\nexport {\n createFormCsrfToken,\n formCsrfCookie,\n formCsrfFieldName,\n validateFormCsrf,\n} from \"./csrf.js\";\nexport type {\n AppRouterAllowedServerAction,\n AppRouterServerActionOptions,\n PreparedFormActionReference,\n} from \"./actions.js\";\n/**\n * Configures the deprecated router session cookie alias.\n *\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type { SessionCookieOptions } from \"./session.js\";\n/**\n * Stores session data through the deprecated router session record alias.\n *\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type { SessionRecord } from \"./session.js\";\n/**\n * Defines session persistence through the deprecated router session store alias.\n *\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type { SessionStore } from \"./session.js\";\nexport { startDevServer } from \"./dev-server.js\";\nexport type { StartDevServerOptions } from \"./dev-server.js\";\nexport { renderAppRequest } from \"./render.js\";\nexport type {\n AppRouterRenderPreload,\n AppRouterResponseHook,\n AppRouterResponseHookContext,\n RenderAppRequestOptions,\n} from \"./render.js\";\nexport {\n parseTraceContext,\n traceContextFromRequest,\n} from \"./trace.js\";\nexport type {\n RouterInstrumentation,\n RouterMiddlewareEndInstrumentationEvent,\n RouterMiddlewareInstrumentationEvent,\n RouterRequestEndInstrumentationEvent,\n RouterRequestInstrumentationEvent,\n RouterRouteEndInstrumentationEvent,\n RouterRouteInstrumentationEvent,\n RouterTraceContext,\n} from \"./trace.js\";\nexport type {\n FileSystemPrerenderStoreOptions,\n KeyValuePrerenderStoreAdapter,\n KeyValuePrerenderStoreOptions,\n MemoryPrerenderStoreEntry,\n MemoryPrerenderStoreOptions,\n} from \"./prerender-store.js\";\nexport { createFileSystemPrerenderStore, createKeyValuePrerenderStore } from \"./prerender-store.js\";\nexport { preloadBuiltAppRuntime, renderBuiltAppRequest, startServer } from \"./serve.js\";\nexport type {\n BuiltAppRuntimePreloadMode,\n AppRouterPrerenderStore,\n BuiltAppRuntimePreloadStrategy,\n RenderBuiltAppRequestOptions,\n RequestHostPolicy,\n ResponseSinkStrategy,\n StartServerOptions,\n} from \"./serve.js\";\nexport { matchRoute, scanAppRoutes } from \"./routes.js\";\nexport type { CachedClientRouteSource, ClientRouteInferenceCache } from \"./client.js\";\nexport type { RouteMatcher, ScanAppRoutesOptions } from \"./routes.js\";\nexport type { AppFileConvention } from \"./file-conventions.js\";\nexport type {\n AppAssetRoute,\n AppMetadataRoute,\n AppRoute,\n MatchedRoute,\n PageRoute,\n RouteSegment,\n ServerRoute,\n} from \"./routes.js\";\n"]}
package/dist/link.d.ts CHANGED
@@ -58,6 +58,27 @@ export interface LinkProps<Href extends string = LinkHref> extends LinkOptions<H
58
58
  children?: LinkChild;
59
59
  [attribute: string]: unknown;
60
60
  }
61
+ /** Represents attributes that can be serialized when Link writes to an HtmlSink. */
62
+ export type LinkSerializableAttribute = boolean | number | string | null | undefined;
63
+ /** Represents child values that an HtmlSink Link can serialize without a browser DOM. */
64
+ export type LinkSinkChild = boolean | number | string | null | undefined | TrustedLinkHtml | readonly LinkSinkChild[];
65
+ /** Configures an HtmlSink Link without browser-only event handlers or refs. */
66
+ export interface LinkSinkProps extends LinkOptions<string> {
67
+ children?: LinkSinkChild;
68
+ class?: string | undefined;
69
+ className?: string | undefined;
70
+ download?: string | boolean | undefined;
71
+ id?: string | undefined;
72
+ name?: string | undefined;
73
+ rel?: string | undefined;
74
+ role?: string | undefined;
75
+ style?: Readonly<Record<string, boolean | number | string | null | undefined>> | undefined;
76
+ tabIndex?: number | undefined;
77
+ target?: string | undefined;
78
+ title?: string | undefined;
79
+ [ariaAttribute: `aria-${string}`]: LinkSerializableAttribute;
80
+ [dataAttribute: `data-${string}`]: LinkSerializableAttribute;
81
+ }
61
82
  /**
62
83
  * Converts router link options into anchor attributes consumed by the client navigation runtime.
63
84
  *
@@ -76,5 +97,5 @@ export type ConcreteLinkHrefGuard<Href extends string> = [RegisteredAppRoutePath
76
97
  * In JSX it returns an anchor element compatible with the mreact runtime; during server streaming it can also write directly to an `HtmlSink`. Unsafe URL attribute values are dropped during rendering.
77
98
  */
78
99
  export declare function Link<const Href extends LinkHref>(props: LinkProps<Href> & ConcreteLinkHrefGuard<Href>): ReactCompatElement;
79
- export declare function Link(sink: HtmlSink, props: LinkProps<string>): void;
100
+ export declare function Link(sink: HtmlSink, props: LinkSinkProps): void;
80
101
  //# sourceMappingURL=link.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,6DAA6D;AAC7D,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAE3B,QAAA,MAAM,iBAAiB,eAAuD,CAAC;AAE/E;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC;AAClE;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,UAAU,CAAC;AAC5C;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AACrD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAAE,QAAQ,CAAC,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACvE;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,IAAI,GAAG,eAAe,GAAG,SAAS,SAAS,EAAE,CAAC;AACxF;;GAEG;AACH,MAAM,WAAW,oBAAoB;CAAG;AACxC;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,oBAAoB,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAA;CAAE,GAC3F,OAAO,CAAC,IAAI,EAAE,IAAI,MAAM,EAAE,CAAC,GAC3B,KAAK,CAAC;AACV;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,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escape";
2
2
  import { safeUrlAttributeValue } from "@reckona/mreact-shared/url-safety";
3
3
  const TRUSTED_LINK_HTML = Symbol.for("modular.react.router.trusted_link_html");
4
+ const VALID_LINK_ATTRIBUTE_NAME = /^[A-Za-z_][\w.\-:]*$/;
4
5
  /**
5
6
  * Converts router link options into anchor attributes consumed by the client navigation runtime.
6
7
  *
@@ -16,18 +17,39 @@ export function linkProps(options) {
16
17
  ...(options.scroll === undefined || options.scroll === "top"
17
18
  ? {}
18
19
  : { "data-mreact-scroll": options.scroll }),
19
- ...(options.transition === undefined || options.transition === false || options.transition === "none"
20
+ ...(options.transition === undefined ||
21
+ options.transition === false ||
22
+ options.transition === "none"
20
23
  ? {}
21
24
  : { "data-mreact-transition": options.transition }),
22
25
  };
23
26
  }
24
27
  export function Link(sinkOrProps, maybeProps) {
25
28
  if (maybeProps !== undefined) {
29
+ reportUnsupportedSinkProps(maybeProps);
26
30
  sinkOrProps.append(renderLinkString(maybeProps));
27
31
  return;
28
32
  }
29
33
  return renderLink(sinkOrProps);
30
34
  }
35
+ function reportUnsupportedSinkProps(props) {
36
+ const nodeEnv = globalThis.process?.env?.NODE_ENV;
37
+ if (nodeEnv === "production") {
38
+ return;
39
+ }
40
+ const unsupported = Object.entries(props)
41
+ .filter(([name, value]) => name === "ref" ||
42
+ typeof value === "function" ||
43
+ typeof value === "symbol" ||
44
+ isLinkEventAttributeName(name) ||
45
+ (name === "children" && !isSerializableSinkChild(value)) ||
46
+ (name !== "children" && name !== "style" && typeof value === "object" && value !== null) ||
47
+ (name !== "children" && !isSafeLinkAttributeName(attributeName(name))))
48
+ .map(([name]) => name);
49
+ if (unsupported.length > 0) {
50
+ console.warn(`[MR_LINK_SINK_UNSUPPORTED_PROP] HtmlSink Link cannot serialize browser-only props: ${unsupported.join(", ")}. Render Link through JSX for event handlers and refs.`);
51
+ }
52
+ }
31
53
  Link.trustedHtml = (html) => ({
32
54
  [TRUSTED_LINK_HTML]: html,
33
55
  });
@@ -44,10 +66,11 @@ function renderLink(props) {
44
66
  }
45
67
  function renderLinkString(props) {
46
68
  const { href, prefetch, reload, scroll, transition, ...rest } = props;
47
- return renderAnchorString({
69
+ const propsWithLinkAttrs = {
48
70
  ...rest,
49
71
  ...linkProps({ href, prefetch, reload, scroll, transition }),
50
- });
72
+ };
73
+ return `<a${renderAnchorAttributes(propsWithLinkAttrs)}>${renderSinkChildren(props.children)}</a>`;
51
74
  }
52
75
  function createAnchorElement(props) {
53
76
  const anchor = document.createElement("a");
@@ -56,15 +79,47 @@ function createAnchorElement(props) {
56
79
  appendLinkChild(anchor, value);
57
80
  continue;
58
81
  }
82
+ if (name === "ref") {
83
+ if (typeof value === "function") {
84
+ value(anchor);
85
+ }
86
+ else if (typeof value === "object" && value !== null && "current" in value) {
87
+ value.current = anchor;
88
+ }
89
+ continue;
90
+ }
91
+ if (/^on[A-Z]/.test(name) && typeof value === "function") {
92
+ const capture = name.endsWith("Capture");
93
+ const eventName = name.slice(2, capture ? -"Capture".length : undefined).toLowerCase();
94
+ anchor.addEventListener(eventName, value, capture);
95
+ continue;
96
+ }
97
+ if (isLinkEventAttributeName(name)) {
98
+ reportRejectedBrowserEventProp(name);
99
+ continue;
100
+ }
101
+ if (name === "style" && typeof value === "object" && value !== null) {
102
+ for (const [property, styleValue] of Object.entries(value)) {
103
+ const cssProperty = linkStylePropertyName(property);
104
+ const cssValue = linkStyleValue(styleValue);
105
+ if (cssProperty !== undefined && cssValue !== undefined) {
106
+ anchor.style.setProperty(cssProperty, cssValue);
107
+ }
108
+ }
109
+ continue;
110
+ }
59
111
  if (!shouldSetAttribute(name, value)) {
60
112
  continue;
61
113
  }
62
114
  const attrName = attributeName(name);
115
+ if (!isSafeLinkAttributeName(attrName)) {
116
+ continue;
117
+ }
63
118
  const safeValue = safeUrlAttributeValue(attrName, String(value));
64
119
  if (safeValue === undefined) {
65
120
  continue;
66
121
  }
67
- anchor.setAttribute(attrName, safeValue);
122
+ anchor.setAttribute(attrName, value === true ? "" : safeValue);
68
123
  }
69
124
  return anchor;
70
125
  }
@@ -90,10 +145,31 @@ function renderAnchorString(props) {
90
145
  function renderAnchorAttributes(props) {
91
146
  const attrs = [];
92
147
  for (const [name, value] of Object.entries(props)) {
93
- if (name === "children" || !shouldSetAttribute(name, value)) {
148
+ if (name === "children" || isLinkEventAttributeName(name) || !shouldSetAttribute(name, value)) {
149
+ continue;
150
+ }
151
+ if (name !== "style" && typeof value === "object" && value !== null) {
94
152
  continue;
95
153
  }
96
154
  const attrName = attributeName(name);
155
+ if (!isSafeLinkAttributeName(attrName)) {
156
+ continue;
157
+ }
158
+ if (name === "style" && typeof value === "object" && value !== null) {
159
+ const style = Object.entries(value)
160
+ .flatMap(([property, styleValue]) => {
161
+ const cssProperty = linkStylePropertyName(property);
162
+ const cssValue = linkStyleValue(styleValue);
163
+ return cssProperty === undefined || cssValue === undefined
164
+ ? []
165
+ : [`${cssProperty}:${cssValue}`];
166
+ })
167
+ .join(";");
168
+ if (style !== "") {
169
+ attrs.push(`${escapeHtmlAttribute(attrName)}="${escapeHtmlAttribute(style)}"`);
170
+ }
171
+ continue;
172
+ }
97
173
  const attrValue = String(value);
98
174
  const safeValue = safeUrlAttributeValue(attrName, attrValue);
99
175
  if (safeValue === undefined) {
@@ -115,6 +191,29 @@ function shouldSetAttribute(name, value) {
115
191
  function attributeName(name) {
116
192
  return name === "className" ? "class" : name;
117
193
  }
194
+ function isSafeLinkAttributeName(name) {
195
+ return VALID_LINK_ATTRIBUTE_NAME.test(name);
196
+ }
197
+ function isLinkEventAttributeName(name) {
198
+ return /^on/i.test(name);
199
+ }
200
+ function reportRejectedBrowserEventProp(name) {
201
+ const nodeEnv = globalThis.process?.env?.NODE_ENV;
202
+ if (nodeEnv !== "production") {
203
+ console.warn(`[MR_LINK_UNSAFE_EVENT_PROP] Link rejected event-like prop ${JSON.stringify(name)}. Pass a supported camel-cased function handler such as onClick instead.`);
204
+ }
205
+ }
206
+ function linkStylePropertyName(property) {
207
+ const cssProperty = property.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
208
+ return /^(?:--[a-zA-Z0-9_-]+|[a-zA-Z][a-zA-Z0-9-]*)$/.test(cssProperty) ? cssProperty : undefined;
209
+ }
210
+ function linkStyleValue(value) {
211
+ if (value === null || value === undefined || value === false) {
212
+ return undefined;
213
+ }
214
+ const cssValue = String(value);
215
+ return /[;{}]/.test(cssValue) ? undefined : cssValue;
216
+ }
118
217
  function renderChildren(child) {
119
218
  if (child === null || child === undefined || typeof child === "boolean") {
120
219
  return "";
@@ -127,6 +226,32 @@ function renderChildren(child) {
127
226
  }
128
227
  return escapeHtmlText(child);
129
228
  }
229
+ function renderSinkChildren(child) {
230
+ if (child === null || child === undefined || typeof child === "boolean") {
231
+ return "";
232
+ }
233
+ if (Array.isArray(child)) {
234
+ return child.map(renderSinkChildren).join("");
235
+ }
236
+ if (isTrustedLinkHtml(child)) {
237
+ return child[TRUSTED_LINK_HTML];
238
+ }
239
+ if (typeof child === "object") {
240
+ return "";
241
+ }
242
+ return escapeHtmlText(String(child));
243
+ }
244
+ function isSerializableSinkChild(value) {
245
+ if (value === null ||
246
+ value === undefined ||
247
+ typeof value === "boolean" ||
248
+ typeof value === "number" ||
249
+ typeof value === "string" ||
250
+ isTrustedLinkHtml(value)) {
251
+ return true;
252
+ }
253
+ return Array.isArray(value) && value.every(isSerializableSinkChild);
254
+ }
130
255
  function isTrustedLinkHtml(value) {
131
256
  return (typeof value === "object" &&
132
257
  value !== null &&