@teyik0/furin 0.2.0-alpha.1 → 0.2.0-alpha.3

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 (84) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +33 -33
  3. package/dist/adapter/static.d.ts +1 -1
  4. package/dist/build/compile-entry.ts +109 -109
  5. package/dist/build/entry-template.ts +156 -156
  6. package/dist/build/index.js +1724 -687
  7. package/dist/build/route-types.d.ts +3 -1
  8. package/dist/build/server-routes-entry.ts +36 -36
  9. package/dist/build/shared.d.ts +1 -0
  10. package/dist/build/ssg-cache.d.ts +1 -1
  11. package/dist/cli/index.js +1673 -658
  12. package/dist/client/link.js +883 -89
  13. package/dist/client/router/index.d.ts +4 -0
  14. package/dist/client/router/link-utils.d.ts +3 -1
  15. package/dist/client/router/navigation.d.ts +10 -0
  16. package/dist/client/router/provider.d.ts +1 -1
  17. package/dist/client/router/search/index.d.ts +18 -0
  18. package/dist/client/router/search-store.d.ts +21 -0
  19. package/dist/client/router/types.d.ts +14 -1
  20. package/dist/client/sync.d.ts +25 -0
  21. package/dist/client.d.ts +1 -0
  22. package/dist/client.js +44 -0
  23. package/dist/furin.d.ts +9 -1
  24. package/dist/furin.js +1578 -258
  25. package/dist/server/auto-invalidate/runtime.d.ts +1 -1
  26. package/dist/server/dev-page-plugin.d.ts +3 -0
  27. package/dist/server/render/assemble.d.ts +2 -0
  28. package/dist/server/render/isr.d.ts +2 -1
  29. package/dist/server/render/ssg.d.ts +3 -2
  30. package/dist/server/render/ssr.d.ts +5 -4
  31. package/dist/server/router/hmr.d.ts +4 -3
  32. package/dist/server/router/index.d.ts +1 -1
  33. package/dist/server/router/index.js +1 -2
  34. package/dist/server/router/index.ts +1 -2
  35. package/dist/server/router/plugin.d.ts +2 -1
  36. package/dist/server/router/schemas.d.ts +25 -17
  37. package/dist/server/sync/config.d.ts +6 -0
  38. package/dist/server/sync/index.d.ts +4 -0
  39. package/dist/server/sync/plugin.d.ts +369 -0
  40. package/dist/server/sync/stream.d.ts +47 -0
  41. package/dist/shared/search-params.d.ts +17 -0
  42. package/package.json +10 -5
  43. package/src/adapter/README.md +13 -13
  44. package/src/adapter/static.ts +23 -6
  45. package/src/build/client.ts +152 -149
  46. package/src/build/compile-entry.ts +109 -109
  47. package/src/build/entry-template.ts +156 -156
  48. package/src/build/hydrate.ts +340 -331
  49. package/src/build/index.ts +152 -152
  50. package/src/build/route-types.ts +145 -115
  51. package/src/build/scan-server.ts +95 -95
  52. package/src/build/server-routes-entry.ts +36 -36
  53. package/src/build/shared.ts +80 -78
  54. package/src/build/ssg-cache.ts +32 -31
  55. package/src/build/types.ts +89 -89
  56. package/src/client/link.tsx +13 -4
  57. package/src/client/router/context.ts +2 -0
  58. package/src/client/router/index.ts +9 -0
  59. package/src/client/router/link-utils.ts +184 -180
  60. package/src/client/router/navigation.ts +61 -0
  61. package/src/client/router/provider.tsx +804 -723
  62. package/src/client/router/search/index.ts +99 -0
  63. package/src/client/router/search-store.ts +86 -0
  64. package/src/client/router/types.ts +276 -263
  65. package/src/client/sync.ts +98 -0
  66. package/src/client.ts +369 -355
  67. package/src/furin.ts +465 -437
  68. package/src/server/auto-invalidate/runtime.ts +134 -133
  69. package/src/server/dev-page-plugin.ts +454 -449
  70. package/src/server/render/assemble.ts +160 -133
  71. package/src/server/render/isr.ts +323 -295
  72. package/src/server/render/not-found.ts +2 -0
  73. package/src/server/render/ssg.ts +15 -4
  74. package/src/server/render/ssr.ts +585 -545
  75. package/src/server/router/hmr.ts +14 -10
  76. package/src/server/router/index.ts +1 -2
  77. package/src/server/router/patterns.ts +5 -0
  78. package/src/server/router/plugin.ts +384 -401
  79. package/src/server/router/schemas.ts +172 -57
  80. package/src/server/sync/config.ts +29 -0
  81. package/src/server/sync/index.ts +14 -0
  82. package/src/server/sync/plugin.ts +108 -0
  83. package/src/server/sync/stream.ts +144 -0
  84. package/src/shared/search-params.ts +182 -0
@@ -1,4 +1,4 @@
1
- import type { ResolvedRoute } from "../server/router/index.ts";
1
+ import { type ResolvedRoute } from "../server/router/index.ts";
2
2
  /** @internal Exported for unit testing only. */
3
3
  export declare function patternToTypeString(pattern: string): string;
4
4
  /**
@@ -9,6 +9,8 @@ export declare function patternToTypeString(pattern: string): string;
9
9
  * @internal Exported for unit testing only.
10
10
  */
11
11
  export declare function schemaToTypeString(schema: unknown): string;
12
+ /** @internal Exported for unit testing only. */
13
+ export declare function schemaToInputTypeString(schema: unknown): string;
12
14
  /**
13
15
  * Generates furin-env.d.ts at the project root — augments RouteManifest
14
16
  * in furin/link so that <Link to="..."> has type-safe autocompletion and
@@ -1,36 +1,36 @@
1
- import { writeFileSync } from "node:fs";
2
- import { join } from "node:path";
3
- import { buildEntrySource, type BuildEntryOptions } from "./entry-template";
4
- import { ensureDir } from "./shared";
5
-
6
- /**
7
- * Generates `server.ts` — an intermediate entry used to produce `server.js`.
8
- *
9
- * Equivalent to `_compile-entry.ts` but for disk (non-binary) production builds:
10
- * 1. Statically imports every page module so Bun bundles them into server.js
11
- * 2. Sets production mode and registers everything in a single CompileContext
12
- * 3. Imports server.ts to boot the app
13
- *
14
- * This file is intermediate: `adapter/bun.ts` runs `Bun.build()` on it to produce
15
- * the self-contained `server.js` bundle, then deletes this file.
16
- */
17
- export function generateServerRoutesEntry(options: BuildEntryOptions): string {
18
- const { buildId, outDir, rootPath, routes, serverEntry, rootConventions, routeMetadata, ssgCache } =
19
- options;
20
- ensureDir(outDir);
21
- const source = buildEntrySource({
22
- buildId,
23
- headerComment: "// Auto-generated by furin build — do not edit",
24
- rootPath,
25
- routes,
26
- serverEntry,
27
- rootConventions,
28
- routeMetadata,
29
- ssgCache,
30
- });
31
-
32
- // Named "server.ts" so Bun.build() outputs "server.js"
33
- const entryPath = join(outDir, "server.ts");
34
- writeFileSync(entryPath, source);
35
- return entryPath;
36
- }
1
+ import { writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { buildEntrySource, type BuildEntryOptions } from "./entry-template";
4
+ import { ensureDir } from "./shared";
5
+
6
+ /**
7
+ * Generates `server.ts` — an intermediate entry used to produce `server.js`.
8
+ *
9
+ * Equivalent to `_compile-entry.ts` but for disk (non-binary) production builds:
10
+ * 1. Statically imports every page module so Bun bundles them into server.js
11
+ * 2. Sets production mode and registers everything in a single CompileContext
12
+ * 3. Imports server.ts to boot the app
13
+ *
14
+ * This file is intermediate: `adapter/bun.ts` runs `Bun.build()` on it to produce
15
+ * the self-contained `server.js` bundle, then deletes this file.
16
+ */
17
+ export function generateServerRoutesEntry(options: BuildEntryOptions): string {
18
+ const { buildId, outDir, rootPath, routes, serverEntry, rootConventions, routeMetadata, ssgCache } =
19
+ options;
20
+ ensureDir(outDir);
21
+ const source = buildEntrySource({
22
+ buildId,
23
+ headerComment: "// Auto-generated by furin build — do not edit",
24
+ rootPath,
25
+ routes,
26
+ serverEntry,
27
+ rootConventions,
28
+ routeMetadata,
29
+ ssgCache,
30
+ });
31
+
32
+ // Named "server.ts" so Bun.build() outputs "server.js"
33
+ const entryPath = join(outDir, "server.ts");
34
+ writeFileSync(entryPath, source);
35
+ return entryPath;
36
+ }
@@ -3,6 +3,7 @@ import type { ResolvedRoute } from "../server/router/index.ts";
3
3
  import type { BuildRouteManifestEntry, TargetBuildManifest } from "./types";
4
4
  export declare const CLIENT_MODULE_PATH: string;
5
5
  export declare const LINK_MODULE_PATH: string;
6
+ export declare const SEARCH_MODULE_PATH: string;
6
7
  export declare function ensureDir(path: string): void;
7
8
  export declare function toPosixPath(path: string): string;
8
9
  export declare function collectFilesRecursive(dir: string): string[];
@@ -1,4 +1,4 @@
1
1
  import type { SsgCacheEntry } from "../server/cache/index.ts";
2
- import type { ResolvedRoute, RootLayout } from "../server/router/index.ts";
2
+ import { type ResolvedRoute, type RootLayout } from "../server/router/index.ts";
3
3
  export type SSGCacheSnapshot = Record<string, SsgCacheEntry>;
4
4
  export declare function buildSSGCacheSnapshot(routes: ResolvedRoute[], root: RootLayout, origin: string): Promise<SSGCacheSnapshot>;