@reckona/mreact-router 0.0.88 → 0.0.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/config.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  export type AppRouterBuildTarget = "node" | "cloudflare" | "aws-lambda";
2
+ export type AppRouterClientConsoleMethod = "debug" | "error" | "info" | "log" | "trace" | "warn";
2
3
  export type AppRouterClientSourceMapMode = "none" | "hidden" | "linked";
3
4
  export type AppRouterClientSourceMapOption = boolean | AppRouterClientSourceMapMode;
5
+ export interface AppRouterProductionOptions {
6
+ dropClientConsole?: boolean | readonly AppRouterClientConsoleMethod[] | undefined;
7
+ }
4
8
  export interface AppRouterProjectOptions {
5
9
  assetBaseUrl?: string | undefined;
6
10
  buildTargets?: readonly AppRouterBuildTarget[] | undefined;
@@ -16,6 +20,7 @@ export interface AppRouterProjectOptions {
16
20
  appDir?: string | undefined;
17
21
  allowedSourceDirs?: readonly string[] | undefined;
18
22
  projectRoot?: string | undefined;
23
+ production?: AppRouterProductionOptions | undefined;
19
24
  publicDir?: string | undefined;
20
25
  publicAssetBaseUrl?: string | undefined;
21
26
  routesDir?: string | undefined;
@@ -25,12 +30,14 @@ export interface ResolvedAppRouterProject {
25
30
  assetBaseUrl?: string | undefined;
26
31
  buildTargets: readonly AppRouterBuildTarget[];
27
32
  clientSourceMaps: AppRouterClientSourceMapMode;
33
+ clientConsolePureFunctions?: readonly string[] | undefined;
28
34
  projectRoot: string;
29
35
  publicAssetBaseUrl?: string | undefined;
30
36
  publicDir: string;
31
37
  routesDir: string;
32
38
  }
33
39
  export declare function resolveAppRouterProjectOptions(options: AppRouterProjectOptions): ResolvedAppRouterProject;
40
+ export declare function resolveClientConsolePureFunctions(value: AppRouterProductionOptions["dropClientConsole"]): readonly string[] | undefined;
34
41
  export declare function resolveClientSourceMapMode(value: AppRouterClientSourceMapOption | undefined): AppRouterClientSourceMapMode;
35
42
  export declare function resolveBuildTargets(targets: readonly AppRouterBuildTarget[] | undefined): readonly AppRouterBuildTarget[];
36
43
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,YAAY,GAAG,YAAY,CAAC;AACxE,MAAM,MAAM,4BAA4B,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACxE,MAAM,MAAM,8BAA8B,GAAG,OAAO,GAAG,4BAA4B,CAAC;AAEpF,MAAM,WAAW,uBAAuB;IACtC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,YAAY,CAAC,EAAE,SAAS,oBAAoB,EAAE,GAAG,SAAS,CAAC;IAC3D,gBAAgB,CAAC,EAAE,8BAA8B,GAAG,SAAS,CAAC;IAC9D;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAClD,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED,MAAM,WAAW,wBAAwB;IACvC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,YAAY,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC9C,gBAAgB,EAAE,4BAA4B,CAAC;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,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AE,MAAM,GAAG,SAAS,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED,MAAM,WAAW,wBAAwB;IACvC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,YAAY,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC9C,gBAAgB,EAAE,4BAA4B,CAAC;IAC/C,0BAA0B,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,uBAAuB,GAC/B,wBAAwB,CA8C1B;AAYD,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,0BAA0B,CAAC,mBAAmB,CAAC,GACrD,SAAS,MAAM,EAAE,GAAG,SAAS,CAmB/B;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,8BAA8B,GAAG,SAAS,GAChD,4BAA4B,CAgB9B;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,SAAS,oBAAoB,EAAE,GAAG,SAAS,GACnD,SAAS,oBAAoB,EAAE,CAoBjC"}
package/dist/config.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { isAbsolute, relative, resolve } from "node:path";
2
2
  export function resolveAppRouterProjectOptions(options) {
3
+ const clientConsolePureFunctions = resolveClientConsolePureFunctions(options.production?.dropClientConsole);
3
4
  if (options.appDir !== undefined &&
4
5
  options.projectRoot === undefined &&
5
6
  options.routesDir === undefined) {
@@ -9,6 +10,7 @@ export function resolveAppRouterProjectOptions(options) {
9
10
  ...(options.assetBaseUrl === undefined ? {} : { assetBaseUrl: options.assetBaseUrl }),
10
11
  buildTargets: resolveBuildTargets(options.buildTargets),
11
12
  clientSourceMaps: resolveClientSourceMapMode(options.clientSourceMaps),
13
+ ...(clientConsolePureFunctions === undefined ? {} : { clientConsolePureFunctions }),
12
14
  projectRoot: appDir,
13
15
  ...(options.publicAssetBaseUrl === undefined
14
16
  ? {}
@@ -23,6 +25,7 @@ export function resolveAppRouterProjectOptions(options) {
23
25
  ...(options.assetBaseUrl === undefined ? {} : { assetBaseUrl: options.assetBaseUrl }),
24
26
  buildTargets: resolveBuildTargets(options.buildTargets),
25
27
  clientSourceMaps: resolveClientSourceMapMode(options.clientSourceMaps),
28
+ ...(clientConsolePureFunctions === undefined ? {} : { clientConsolePureFunctions }),
26
29
  projectRoot,
27
30
  ...(options.publicAssetBaseUrl === undefined
28
31
  ? {}
@@ -31,6 +34,30 @@ export function resolveAppRouterProjectOptions(options) {
31
34
  routesDir: resolveProjectPath(projectRoot, options.routesDir ?? "src/app", "routesDir"),
32
35
  };
33
36
  }
37
+ const defaultDroppedClientConsoleMethods = ["debug", "info", "log"];
38
+ const supportedClientConsoleMethods = new Set([
39
+ "debug",
40
+ "error",
41
+ "info",
42
+ "log",
43
+ "trace",
44
+ "warn",
45
+ ]);
46
+ export function resolveClientConsolePureFunctions(value) {
47
+ if (value === undefined || value === false) {
48
+ return undefined;
49
+ }
50
+ const methods = value === true ? defaultDroppedClientConsoleMethods : value;
51
+ const uniqueMethods = [...new Set(methods)];
52
+ for (const method of uniqueMethods) {
53
+ if (!supportedClientConsoleMethods.has(method)) {
54
+ throw new Error(`Unsupported mreactRouter production.dropClientConsole method ${JSON.stringify(method)}. Expected "debug", "error", "info", "log", "trace", or "warn".`);
55
+ }
56
+ }
57
+ return uniqueMethods.length === 0
58
+ ? undefined
59
+ : uniqueMethods.map((method) => `console.${method}`);
60
+ }
34
61
  export function resolveClientSourceMapMode(value) {
35
62
  if (value === undefined || value === false || value === "none") {
36
63
  return "none";
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"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,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 { isAbsolute, relative, resolve } from \"node:path\";\n\nexport type AppRouterBuildTarget = \"node\" | \"cloudflare\" | \"aws-lambda\";\nexport type AppRouterClientSourceMapMode = \"none\" | \"hidden\" | \"linked\";\nexport type AppRouterClientSourceMapOption = boolean | AppRouterClientSourceMapMode;\n\nexport interface AppRouterProjectOptions {\n assetBaseUrl?: string | 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 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 buildTargets: readonly AppRouterBuildTarget[];\n clientSourceMaps: AppRouterClientSourceMapMode;\n projectRoot: string;\n publicAssetBaseUrl?: string | undefined;\n publicDir: string;\n routesDir: string;\n}\n\nexport function resolveAppRouterProjectOptions(\n options: AppRouterProjectOptions,\n): ResolvedAppRouterProject {\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 buildTargets: resolveBuildTargets(options.buildTargets),\n clientSourceMaps: resolveClientSourceMapMode(options.clientSourceMaps),\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\n return {\n allowedSourceDirs: (options.allowedSourceDirs ?? [\"src\"]).map((directory) =>\n resolveProjectPath(projectRoot, directory, \"allowedSourceDirs\"),\n ),\n ...(options.assetBaseUrl === undefined ? {} : { assetBaseUrl: options.assetBaseUrl }),\n buildTargets: resolveBuildTargets(options.buildTargets),\n clientSourceMaps: resolveClientSourceMapMode(options.clientSourceMaps),\n projectRoot,\n ...(options.publicAssetBaseUrl === undefined\n ? {}\n : { publicAssetBaseUrl: options.publicAssetBaseUrl }),\n publicDir: resolveProjectPath(projectRoot, options.publicDir ?? \"public\", \"publicDir\"),\n routesDir: resolveProjectPath(projectRoot, options.routesDir ?? \"src/app\", \"routesDir\"),\n };\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\", \"cloudflare\"];\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":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4C1D,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,SAAS,KAAK,SAAS,EAC/B,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEvC,OAAO;YACL,iBAAiB,EAAE,CAAC,OAAO,CAAC,iBAAiB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAC3E,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,mBAAmB,CAAC,CAC3D;YACD,GAAG,CAAC,OAAO,C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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 { isAbsolute, relative, resolve } from \"node:path\";\n\nexport type AppRouterBuildTarget = \"node\" | \"cloudflare\" | \"aws-lambda\";\nexport type AppRouterClientConsoleMethod = \"debug\" | \"error\" | \"info\" | \"log\" | \"trace\" | \"warn\";\nexport type AppRouterClientSourceMapMode = \"none\" | \"hidden\" | \"linked\";\nexport type AppRouterClientSourceMapOption = boolean | AppRouterClientSourceMapMode;\n\nexport interface AppRouterProductionOptions {\n dropClientConsole?: boolean | readonly AppRouterClientConsoleMethod[] | undefined;\n}\n\nexport interface AppRouterProjectOptions {\n assetBaseUrl?: string | 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 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 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\n return {\n allowedSourceDirs: (options.allowedSourceDirs ?? [\"src\"]).map((directory) =>\n resolveProjectPath(projectRoot, directory, \"allowedSourceDirs\"),\n ),\n ...(options.assetBaseUrl === undefined ? {} : { assetBaseUrl: options.assetBaseUrl }),\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: resolveProjectPath(projectRoot, options.routesDir ?? \"src/app\", \"routesDir\"),\n };\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\", \"cloudflare\"];\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"]}
package/dist/index.d.ts CHANGED
@@ -39,7 +39,7 @@ export declare const getSession: typeof getSessionInternal;
39
39
  export declare const rotateSession: typeof rotateSessionInternal;
40
40
  export type { AwsLambdaArtifactManifest, BuildAppOptions, BuildAppResult, BuiltImportPolicyArtifact, CloudflarePagesArtifactManifest, PackageAwsLambdaArtifactOptions, PackageCloudflarePagesArtifactOptions, } from "./build.js";
41
41
  export type { InferLoaderData, LayoutProps, LoaderContext, GenerateMetadataContext, ManifestContext, ManifestDescriptor, MetadataImage, MetadataScalar, MetadataThemeColor, MetadataViewport, MReactNode, PageProps, RobotsContext, RobotsManifest, RobotsRule, RouteHeadDescriptor, RouteHandlerContext, RouteMetadata, RouteParams, RouteSecurityHeaders, RouteStrictTransportSecurity, SitemapContext, SitemapEntry, } from "./types.js";
42
- export type { AppRouterBuildTarget, AppRouterClientSourceMapMode, AppRouterClientSourceMapOption, } from "./config.js";
42
+ export type { AppRouterBuildTarget, AppRouterClientConsoleMethod, AppRouterClientSourceMapMode, AppRouterClientSourceMapOption, AppRouterProductionOptions, } from "./config.js";
43
43
  export type { AssetHelperOptions, AssetLinkDescriptor, AssetManifest, AssetManifestEntry, } from "./assets.js";
44
44
  export type { AppRouterCache, AppRouterCacheEntry, CacheControlOptions, MemoryRouteCacheOptions, RouteCachePolicy, } from "./cache.js";
45
45
  export type { CookieOptions } from "./cookies.js";
@@ -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,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;A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IAAI,kBAAkB,EAChC,aAAa,IAAI,qBAAqB,GACvC,MAAM,cAAc,CAAC;AAQtB;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,gCAAgC,CAAC;AACzE;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,qBAAqB,CAAC;AACnD;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,sBAAsB,CAAC;AACrD;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAC7C;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAkFnD,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAkBnB,OAAO,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 { Link, linkProps } from \"./link.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} 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 * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const createMemorySessionStore = createMemorySessionStoreInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const createSession = createSessionInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const destroySession = destroySessionInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const getSession = getSessionInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const rotateSession = rotateSessionInternal;\nexport type {\n AwsLambdaArtifactManifest,\n BuildAppOptions,\n BuildAppResult,\n BuiltImportPolicyArtifact,\n CloudflarePagesArtifactManifest,\n PackageAwsLambdaArtifactOptions,\n PackageCloudflarePagesArtifactOptions,\n} from \"./build.js\";\nexport type {\n InferLoaderData,\n LayoutProps,\n LoaderContext,\n GenerateMetadataContext,\n ManifestContext,\n ManifestDescriptor,\n MetadataImage,\n MetadataScalar,\n MetadataThemeColor,\n MetadataViewport,\n MReactNode,\n PageProps,\n RobotsContext,\n RobotsManifest,\n RobotsRule,\n RouteHeadDescriptor,\n RouteHandlerContext,\n RouteMetadata,\n RouteParams,\n RouteSecurityHeaders,\n RouteStrictTransportSecurity,\n SitemapContext,\n SitemapEntry,\n} from \"./types.js\";\nexport type {\n AppRouterBuildTarget,\n AppRouterClientSourceMapMode,\n AppRouterClientSourceMapOption,\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\";\nexport type {\n LinkOptions,\n LinkPrefetch,\n LinkProps,\n LinkScroll,\n LinkTransition,\n} from \"./link.js\";\nexport type {\n AppRouterNavigationState,\n AppRouterNavigationStateListener,\n AppRouterNavigationType,\n} from \"./navigation-state.js\";\nexport type { RouterRuntimeCacheStat } from \"./runtime-cache.js\";\nexport type { MemorySessionStoreOptionsInternal as MemorySessionStoreOptions };\nexport type {\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 * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type SessionCookieOptions = SessionCookieOptionsInternal;\n/**\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type SessionRecord<TData = unknown> = SessionRecordInternal<TData>;\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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BAAwB,GAAG,gCAAgC,CAAC;AACzE;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,qBAAqB,CAAC;AACnD;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,sBAAsB,CAAC;AACrD;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAC7C;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAoFnD,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAkBnB,OAAO,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 { Link, linkProps } from \"./link.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} 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 * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const createMemorySessionStore = createMemorySessionStoreInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const createSession = createSessionInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const destroySession = destroySessionInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const getSession = getSessionInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const rotateSession = rotateSessionInternal;\nexport type {\n AwsLambdaArtifactManifest,\n BuildAppOptions,\n BuildAppResult,\n BuiltImportPolicyArtifact,\n CloudflarePagesArtifactManifest,\n PackageAwsLambdaArtifactOptions,\n PackageCloudflarePagesArtifactOptions,\n} from \"./build.js\";\nexport type {\n InferLoaderData,\n LayoutProps,\n LoaderContext,\n GenerateMetadataContext,\n ManifestContext,\n ManifestDescriptor,\n MetadataImage,\n MetadataScalar,\n MetadataThemeColor,\n MetadataViewport,\n MReactNode,\n PageProps,\n RobotsContext,\n RobotsManifest,\n RobotsRule,\n RouteHeadDescriptor,\n RouteHandlerContext,\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\";\nexport type {\n LinkOptions,\n LinkPrefetch,\n LinkProps,\n LinkScroll,\n LinkTransition,\n} from \"./link.js\";\nexport type {\n AppRouterNavigationState,\n AppRouterNavigationStateListener,\n AppRouterNavigationType,\n} from \"./navigation-state.js\";\nexport type { RouterRuntimeCacheStat } from \"./runtime-cache.js\";\nexport type { MemorySessionStoreOptionsInternal as MemorySessionStoreOptions };\nexport type {\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 * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type SessionCookieOptions = SessionCookieOptionsInternal;\n/**\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type SessionRecord<TData = unknown> = SessionRecordInternal<TData>;\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reckona/mreact-router",
3
- "version": "0.0.88",
3
+ "version": "0.0.89",
4
4
  "description": "File-system app router, SSR, actions, and deployment adapters for mreact.",
5
5
  "keywords": [
6
6
  "jsx",
@@ -105,20 +105,20 @@
105
105
  },
106
106
  "dependencies": {
107
107
  "typescript": "^6.0.3",
108
- "@reckona/mreact-compat": "0.0.88",
109
- "@reckona/mreact-compiler": "0.0.88",
110
- "@reckona/mreact-query": "0.0.88",
111
- "@reckona/mreact-devtools": "0.0.88",
112
- "@reckona/mreact-reactive-core": "0.0.88",
113
- "@reckona/mreact": "0.0.88",
114
- "@reckona/mreact-reactive-dom": "0.0.88",
115
- "@reckona/mreact-server": "0.0.88",
116
- "@reckona/mreact-shared": "0.0.88"
108
+ "@reckona/mreact": "0.0.89",
109
+ "@reckona/mreact-compat": "0.0.89",
110
+ "@reckona/mreact-compiler": "0.0.89",
111
+ "@reckona/mreact-devtools": "0.0.89",
112
+ "@reckona/mreact-reactive-core": "0.0.89",
113
+ "@reckona/mreact-query": "0.0.89",
114
+ "@reckona/mreact-reactive-dom": "0.0.89",
115
+ "@reckona/mreact-shared": "0.0.89",
116
+ "@reckona/mreact-server": "0.0.89"
117
117
  },
118
118
  "peerDependencies": {
119
119
  "vite": ">=8 <9"
120
120
  },
121
121
  "optionalDependencies": {
122
- "@reckona/mreact-router-native": "0.0.88"
122
+ "@reckona/mreact-router-native": "0.0.89"
123
123
  }
124
124
  }
package/src/build.ts CHANGED
@@ -260,6 +260,7 @@ export async function buildApp(options: BuildAppOptions): Promise<BuildAppResult
260
260
  appDir: project.routesDir,
261
261
  assetBaseUrl: project.assetBaseUrl,
262
262
  clientDir,
263
+ clientConsolePureFunctions: project.clientConsolePureFunctions,
263
264
  clientRouteInferenceCache,
264
265
  projectRoot: project.projectRoot,
265
266
  routes,
@@ -270,7 +271,7 @@ export async function buildApp(options: BuildAppOptions): Promise<BuildAppResult
270
271
  const navigationRuntimeScript = clientRoutes.some(
271
272
  (route) => route.navigation === true && !route.client,
272
273
  )
273
- ? await writeNavigationRuntimeBundle(clientDir)
274
+ ? await writeNavigationRuntimeBundle(clientDir, project.clientConsolePureFunctions)
274
275
  : undefined;
275
276
  const clientManifestRoutes =
276
277
  navigationRuntimeScript === undefined
@@ -2614,6 +2615,7 @@ async function writeClientRouteBundles(options: {
2614
2615
  appDir: string;
2615
2616
  assetBaseUrl?: string | undefined;
2616
2617
  clientDir: string;
2618
+ clientConsolePureFunctions?: readonly string[] | undefined;
2617
2619
  clientRouteInferenceCache: ClientRouteInferenceCache;
2618
2620
  projectRoot: string;
2619
2621
  routes: readonly AppRoute[];
@@ -2682,6 +2684,7 @@ async function writeClientRouteBundles(options: {
2682
2684
  clientReferenceImports: references.clientReferenceImports,
2683
2685
  clientReferenceManifest: references.clientReferenceManifest,
2684
2686
  clientNavigation: detectClientNavigationHint(source),
2687
+ dropConsoleFunctions: options.clientConsolePureFunctions,
2685
2688
  filename: route.file,
2686
2689
  minify: true,
2687
2690
  routePath: route.path,
@@ -2704,6 +2707,7 @@ async function writeClientRouteBundles(options: {
2704
2707
  try {
2705
2708
  output = await buildClientRouteBatchOutput({
2706
2709
  assetBaseUrl: options.assetBaseUrl,
2710
+ dropConsoleFunctions: options.clientConsolePureFunctions,
2707
2711
  minify: true,
2708
2712
  projectRoot: options.projectRoot,
2709
2713
  routes: clientEntries.map((entry) => entry.build),
@@ -2864,8 +2868,12 @@ function applyClientSourceMapReference(options: {
2864
2868
  : `${code}\n//# sourceMappingURL=${options.scriptBasename}.map`;
2865
2869
  }
2866
2870
 
2867
- async function writeNavigationRuntimeBundle(clientDir: string): Promise<string> {
2871
+ async function writeNavigationRuntimeBundle(
2872
+ clientDir: string,
2873
+ dropConsoleFunctions: readonly string[] | undefined,
2874
+ ): Promise<string> {
2868
2875
  const output = await buildNavigationRuntimeBundle({
2876
+ dropConsoleFunctions,
2869
2877
  minify: true,
2870
2878
  sourceMap: false,
2871
2879
  });
@@ -14,6 +14,7 @@ export interface RouterBundleOptions {
14
14
  base?: string | undefined;
15
15
  code: string;
16
16
  define?: Record<string, string> | undefined;
17
+ dropConsoleFunctions?: readonly string[] | undefined;
17
18
  externalizeAppSourceModuleDirs?: readonly string[] | undefined;
18
19
  filename: string;
19
20
  minify?: boolean | undefined;
@@ -30,6 +31,7 @@ export interface RouterBundleOptions {
30
31
  export interface RouterBundleModulesOptions {
31
32
  base?: string | undefined;
32
33
  define?: Record<string, string> | undefined;
34
+ dropConsoleFunctions?: readonly string[] | undefined;
33
35
  entries: readonly RouterBundleEntryOptions[];
34
36
  minify?: boolean | undefined;
35
37
  platform: "browser" | "node";
@@ -177,6 +179,7 @@ export async function bundleRouterModule(
177
179
  write: false,
178
180
  rolldownOptions: {
179
181
  input: entryId,
182
+ ...routerBundleTreeshakeOptions(options.dropConsoleFunctions),
180
183
  output: {
181
184
  codeSplitting: false,
182
185
  entryFileNames: outfile,
@@ -257,6 +260,7 @@ export async function bundleRouterModules(
257
260
  write: false,
258
261
  rolldownOptions: {
259
262
  input,
263
+ ...routerBundleTreeshakeOptions(options.dropConsoleFunctions),
260
264
  output: {
261
265
  chunkFileNames: "assets/chunks/[name].[hash].js",
262
266
  entryFileNames: "assets/routes/[name].[hash].js",
@@ -457,6 +461,14 @@ async function resolveAppSourceImport(id: string, resolveDir: string): Promise<s
457
461
  return undefined;
458
462
  }
459
463
 
464
+ function routerBundleTreeshakeOptions(
465
+ dropConsoleFunctions: readonly string[] | undefined,
466
+ ): { treeshake: { manualPureFunctions: readonly string[] } } | {} {
467
+ return dropConsoleFunctions === undefined || dropConsoleFunctions.length === 0
468
+ ? {}
469
+ : { treeshake: { manualPureFunctions: dropConsoleFunctions } };
470
+ }
471
+
460
472
  function stripSourceMappingUrl(code: string): string {
461
473
  return code.replace(/\n?\/\/# sourceMappingURL=[^\n]+\.map\s*$/u, "");
462
474
  }
package/src/client.ts CHANGED
@@ -29,6 +29,10 @@ import {
29
29
  type RouterBundleAssetOutput,
30
30
  type RouterBundleChunkOutput,
31
31
  } from "./bundle-pipeline.js";
32
+ import {
33
+ resolveClientConsolePureFunctions,
34
+ type AppRouterProductionOptions,
35
+ } from "./config.js";
32
36
  import type { AppRoute } from "./routes.js";
33
37
  import { existingRouteShellCandidates } from "./route-shells.js";
34
38
  import {
@@ -65,6 +69,8 @@ export interface BuildClientRouteOutputOptions {
65
69
  clientBoundaryImports?: readonly string[] | undefined;
66
70
  clientReferenceImports?: readonly ClientReferenceImport[] | undefined;
67
71
  clientReferenceManifest?: readonly ClientReferenceMetadata[] | undefined;
72
+ dropClientConsole?: AppRouterProductionOptions["dropClientConsole"] | undefined;
73
+ dropConsoleFunctions?: readonly string[] | undefined;
68
74
  filename: string;
69
75
  minify?: boolean | undefined;
70
76
  routePath: string;
@@ -1422,6 +1428,7 @@ export async function buildClientRouteBundle(options: {
1422
1428
 
1423
1429
  export async function buildNavigationRuntimeBundle(
1424
1430
  options: {
1431
+ dropConsoleFunctions?: readonly string[] | undefined;
1425
1432
  minify?: boolean;
1426
1433
  sourceMap?: boolean;
1427
1434
  } = {},
@@ -1431,6 +1438,9 @@ export async function buildNavigationRuntimeBundle(
1431
1438
  filename: "__mreact_navigation_runtime.tsx",
1432
1439
  routePath: "/__mreact_navigation_runtime",
1433
1440
  clientNavigation: true,
1441
+ ...(options.dropConsoleFunctions === undefined
1442
+ ? {}
1443
+ : { dropConsoleFunctions: options.dropConsoleFunctions }),
1434
1444
  ...(options.minify === undefined ? {} : { minify: options.minify }),
1435
1445
  ...(options.sourceMap === undefined ? {} : { sourceMap: options.sourceMap }),
1436
1446
  });
@@ -1440,12 +1450,15 @@ export async function buildClientRouteOutput(
1440
1450
  options: BuildClientRouteOutputOptions,
1441
1451
  ): Promise<{ code: string; map?: string }> {
1442
1452
  const entry = await buildClientRouteEntrySource(options);
1453
+ const dropConsoleFunctions =
1454
+ options.dropConsoleFunctions ?? resolveClientConsolePureFunctions(options.dropClientConsole);
1443
1455
  const bundled = await bundleRouterModule({
1444
1456
  code: entry.code,
1445
1457
  define: {
1446
1458
  __MREACT_CLIENT_DEVTOOLS__: "false",
1447
1459
  },
1448
1460
  filename: options.filename,
1461
+ dropConsoleFunctions,
1449
1462
  minify: options.minify === true,
1450
1463
  platform: "browser",
1451
1464
  preserveExports: true,
@@ -1462,6 +1475,7 @@ export async function buildClientRouteOutput(
1462
1475
 
1463
1476
  export async function buildClientRouteBatchOutput(options: {
1464
1477
  assetBaseUrl?: string | undefined;
1478
+ dropConsoleFunctions?: readonly string[] | undefined;
1465
1479
  minify?: boolean;
1466
1480
  projectRoot?: string | undefined;
1467
1481
  routes: readonly BuildClientRouteOutputOptions[];
@@ -1496,6 +1510,7 @@ export async function buildClientRouteBatchOutput(options: {
1496
1510
  plugins: [workspaceRuntimePlugin({ routeFiles: entries.map((entry) => entry.filename) })],
1497
1511
  root: options.projectRoot,
1498
1512
  sourceMap: options.sourceMap,
1513
+ dropConsoleFunctions: options.dropConsoleFunctions,
1499
1514
  vitePlugins: options.vitePlugins,
1500
1515
  });
1501
1516
  const entryChunks = new Map(
@@ -2239,8 +2254,10 @@ function __mreactApplyNavigationHtml(html, url) {
2239
2254
 
2240
2255
  __mreactMarkRouteHydrating();
2241
2256
  __mreactSyncHeadMetadata(template.content, html);
2242
- __mreactUnmountCompatBoundaries(currentMarker);
2243
- __mreactResumeNode(currentMarker, nextMarker);
2257
+ if (!__mreactApplyNavigationShellHtml(currentMarker, nextMarker)) {
2258
+ __mreactUnmountCompatBoundaries(currentMarker);
2259
+ __mreactResumeNode(currentMarker, nextMarker);
2260
+ }
2244
2261
  ${routeCleanupNavigationDispose} __mreactSyncRouteDataScripts(template.content, currentRouteId, nextRouteId);
2245
2262
 
2246
2263
  const script = template.content.querySelector('script[type="module"][src]')?.getAttribute("src");
@@ -2256,6 +2273,111 @@ ${routeCleanupNavigationDispose} __mreactSyncRouteDataScripts(template.content,
2256
2273
  return true;
2257
2274
  }
2258
2275
 
2276
+ function __mreactApplyNavigationShellHtml(currentMarker, nextMarker) {
2277
+ const target = __mreactNavigationShellSyncTarget(currentMarker, nextMarker);
2278
+
2279
+ if (target === null) {
2280
+ return false;
2281
+ }
2282
+
2283
+ __mreactUnmountCompatBoundaries(target.current);
2284
+ __mreactResumeNode(target.current, target.next);
2285
+ return true;
2286
+ }
2287
+
2288
+ function __mreactNavigationShellSyncTarget(currentMarker, nextMarker) {
2289
+ const currentShells = __mreactMarkerShellAncestors(currentMarker);
2290
+ const nextShells = __mreactMarkerShellAncestors(nextMarker);
2291
+ const commonLength = Math.min(currentShells.length, nextShells.length);
2292
+ let commonIndex = -1;
2293
+
2294
+ for (let index = 0; index < commonLength; index += 1) {
2295
+ if (!__mreactSameNavigationShellBoundary(currentShells[index], nextShells[index])) {
2296
+ break;
2297
+ }
2298
+
2299
+ commonIndex = index;
2300
+ }
2301
+
2302
+ if (commonIndex >= 0) {
2303
+ return __mreactNavigationShellDomTarget(currentShells[commonIndex], nextShells[commonIndex]);
2304
+ }
2305
+
2306
+ if (currentShells.length === 0 || nextShells.length === 0) {
2307
+ return null;
2308
+ }
2309
+
2310
+ const currentRoot = currentShells[0];
2311
+ const nextRoot = nextShells[0];
2312
+
2313
+ if (currentRoot.tagName !== nextRoot.tagName) {
2314
+ return null;
2315
+ }
2316
+
2317
+ return __mreactNavigationShellDomTarget(currentRoot, nextRoot);
2318
+ }
2319
+
2320
+ function __mreactMarkerShellAncestors(marker) {
2321
+ const shells = [];
2322
+ let current = marker.parentElement;
2323
+
2324
+ while (current !== null) {
2325
+ if (__mreactIsNavigationShellBoundary(current)) {
2326
+ shells.push(current);
2327
+ }
2328
+
2329
+ current = current.parentElement;
2330
+ }
2331
+
2332
+ shells.reverse();
2333
+ return shells;
2334
+ }
2335
+
2336
+ function __mreactIsNavigationShellBoundary(element) {
2337
+ return element.hasAttribute("data-mreact-layout-boundary") ||
2338
+ element.hasAttribute("data-mreact-template-boundary");
2339
+ }
2340
+
2341
+ function __mreactSameNavigationShellBoundary(current, next) {
2342
+ const currentKind = __mreactNavigationShellBoundaryKind(current);
2343
+ const nextKind = __mreactNavigationShellBoundaryKind(next);
2344
+
2345
+ if (currentKind === null || currentKind !== nextKind || current.tagName !== next.tagName) {
2346
+ return false;
2347
+ }
2348
+
2349
+ const attribute = currentKind === "layout"
2350
+ ? "data-mreact-layout-boundary"
2351
+ : "data-mreact-template-boundary";
2352
+
2353
+ return current.getAttribute(attribute) === next.getAttribute(attribute);
2354
+ }
2355
+
2356
+ function __mreactNavigationShellBoundaryKind(element) {
2357
+ if (element.hasAttribute("data-mreact-layout-boundary")) {
2358
+ return "layout";
2359
+ }
2360
+
2361
+ if (element.hasAttribute("data-mreact-template-boundary")) {
2362
+ return "template";
2363
+ }
2364
+
2365
+ return null;
2366
+ }
2367
+
2368
+ function __mreactNavigationShellDomTarget(currentShell, nextShell) {
2369
+ if (currentShell.tagName === "HTML" && nextShell.tagName === "HTML") {
2370
+ const currentBody = currentShell.querySelector("body");
2371
+ const nextBody = nextShell.querySelector("body");
2372
+
2373
+ if (currentBody !== null && nextBody !== null) {
2374
+ return { current: currentBody, next: nextBody };
2375
+ }
2376
+ }
2377
+
2378
+ return { current: currentShell, next: nextShell };
2379
+ }
2380
+
2259
2381
  function __mreactSyncHeadMetadata(root, html) {
2260
2382
  __mreactSyncHtmlLang(root, html);
2261
2383