@teyik0/furin 0.1.0-alpha.10

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 (87) hide show
  1. package/dist/adapter/bun.d.ts +3 -0
  2. package/dist/adapter/static.d.ts +3 -0
  3. package/dist/build/client.d.ts +25 -0
  4. package/dist/build/compile-entry.d.ts +35 -0
  5. package/dist/build/entry-template.d.ts +26 -0
  6. package/dist/build/hydrate.d.ts +24 -0
  7. package/dist/build/index.d.ts +7 -0
  8. package/dist/build/index.js +4716 -0
  9. package/dist/build/route-types.d.ts +21 -0
  10. package/dist/build/scan-server.d.ts +8 -0
  11. package/dist/build/server-routes-entry.d.ts +35 -0
  12. package/dist/build/shared.d.ts +11 -0
  13. package/dist/build/types.d.ts +76 -0
  14. package/dist/cli/config.d.ts +9 -0
  15. package/dist/cli/index.d.ts +2 -0
  16. package/dist/cli/index.js +4751 -0
  17. package/dist/client.d.ts +195 -0
  18. package/dist/client.js +20 -0
  19. package/dist/config.d.ts +50 -0
  20. package/dist/config.js +28 -0
  21. package/dist/context-logger.d.ts +28 -0
  22. package/dist/dev-page-plugin.d.ts +109 -0
  23. package/dist/error.d.ts +23 -0
  24. package/dist/furin.d.ts +52 -0
  25. package/dist/furin.js +3948 -0
  26. package/dist/internal.d.ts +33 -0
  27. package/dist/link.d.ts +454 -0
  28. package/dist/link.js +1790 -0
  29. package/dist/not-found.d.ts +19 -0
  30. package/dist/plugin/index.d.ts +20 -0
  31. package/dist/plugin/index.js +1408 -0
  32. package/dist/plugin/transform-client.d.ts +9 -0
  33. package/dist/render/assemble.d.ts +15 -0
  34. package/dist/render/boundaries.d.ts +79 -0
  35. package/dist/render/cache.d.ts +96 -0
  36. package/dist/render/default-screens.d.ts +11 -0
  37. package/dist/render/digest.d.ts +16 -0
  38. package/dist/render/element.d.ts +8 -0
  39. package/dist/render/index.d.ts +53 -0
  40. package/dist/render/loaders.d.ts +21 -0
  41. package/dist/render/shell.d.ts +29 -0
  42. package/dist/render/template.d.ts +6 -0
  43. package/dist/router.d.ts +96 -0
  44. package/dist/router.js +2693 -0
  45. package/dist/runtime-env.d.ts +3 -0
  46. package/dist/utils.d.ts +6 -0
  47. package/package.json +77 -0
  48. package/src/adapter/README.md +13 -0
  49. package/src/adapter/bun.ts +239 -0
  50. package/src/adapter/static.ts +341 -0
  51. package/src/build/client.ts +153 -0
  52. package/src/build/compile-entry.ts +129 -0
  53. package/src/build/entry-template.ts +126 -0
  54. package/src/build/hydrate.ts +250 -0
  55. package/src/build/index.ts +151 -0
  56. package/src/build/route-types.ts +89 -0
  57. package/src/build/scan-server.ts +110 -0
  58. package/src/build/server-routes-entry.ts +55 -0
  59. package/src/build/shared.ts +78 -0
  60. package/src/build/types.ts +85 -0
  61. package/src/cli/config.ts +68 -0
  62. package/src/cli/index.ts +115 -0
  63. package/src/client.ts +278 -0
  64. package/src/config.ts +66 -0
  65. package/src/context-logger.ts +74 -0
  66. package/src/dev-page-plugin.ts +434 -0
  67. package/src/env.d.ts +49 -0
  68. package/src/error.ts +32 -0
  69. package/src/furin.ts +383 -0
  70. package/src/internal.ts +51 -0
  71. package/src/link.tsx +1578 -0
  72. package/src/not-found.ts +40 -0
  73. package/src/plugin/index.ts +80 -0
  74. package/src/plugin/transform-client.ts +372 -0
  75. package/src/render/assemble.ts +66 -0
  76. package/src/render/boundaries.tsx +176 -0
  77. package/src/render/cache.ts +251 -0
  78. package/src/render/default-screens.tsx +299 -0
  79. package/src/render/digest.ts +71 -0
  80. package/src/render/element.tsx +119 -0
  81. package/src/render/index.ts +867 -0
  82. package/src/render/loaders.ts +127 -0
  83. package/src/render/shell.ts +187 -0
  84. package/src/render/template.ts +55 -0
  85. package/src/router.ts +779 -0
  86. package/src/runtime-env.ts +6 -0
  87. package/src/utils.ts +68 -0
@@ -0,0 +1,3 @@
1
+ import type { BuildAppOptions, TargetBuildManifest } from "../build/types.ts";
2
+ import type { ResolvedRoute, RootLayout } from "../router.ts";
3
+ export declare function buildBunTarget(routes: ResolvedRoute[], rootDir: string, buildRoot: string, root: RootLayout, serverEntry: string | null, options: BuildAppOptions): Promise<TargetBuildManifest>;
@@ -0,0 +1,3 @@
1
+ import type { BuildAppOptions, StaticTargetBuildManifest } from "../build/types.ts";
2
+ import type { ResolvedRoute, RootLayout } from "../router.ts";
3
+ export declare function buildStaticTarget(routes: ResolvedRoute[], rootDir: string, buildRoot: string, root: RootLayout, options: BuildAppOptions): Promise<StaticTargetBuildManifest>;
@@ -0,0 +1,25 @@
1
+ import type { ResolvedRoute } from "../router";
2
+ import type { BuildClientOptions } from "./types";
3
+ export interface BuildClientResult {
4
+ /** Public paths of all CSS chunks, e.g. `["/_client/chunk-abc.css"]` */
5
+ cssChunks: string[];
6
+ /** Public path of the JS entry chunk, e.g. `/_client/chunk-abc.js` */
7
+ entryChunk: string;
8
+ }
9
+ /**
10
+ * Builds the production client bundle via Bun.build() using _hydrate.tsx as
11
+ * the JS entrypoint (NOT an HTML entrypoint). Bun produces:
12
+ * <outDir>/client/chunk-*.js — code-split bundles
13
+ * <outDir>/client/chunk-*.css — extracted CSS (if imported)
14
+ *
15
+ * Returns the chunk paths so the caller can compute a `buildId` and write
16
+ * `index.html` with the correct meta tag. Using an HTML entrypoint with
17
+ * code-splitting causes a Bun bug where the output index.html references a
18
+ * leaf chunk instead of the actual entry chunk, preventing React from mounting
19
+ * in production.
20
+ *
21
+ * The output index.html is NOT served to browsers directly. The server reads
22
+ * it as an SSR template, injects the pre-rendered React HTML into
23
+ * <!--ssr-outlet-->, and sends the complete page.
24
+ */
25
+ export declare function buildClient(routes: ResolvedRoute[], { outDir, rootLayout, plugins, publicPath, basePath }: BuildClientOptions): Promise<BuildClientResult>;
@@ -0,0 +1,35 @@
1
+ export interface CompileEntryOptions {
2
+ buildId: string | undefined;
3
+ embed: {
4
+ clientDir: string;
5
+ } | undefined;
6
+ outDir: string;
7
+ publicDir: string | undefined;
8
+ rootConventions: {
9
+ errorPath: string | undefined;
10
+ notFoundPath: string | undefined;
11
+ } | undefined;
12
+ rootPath: string;
13
+ routeMetadata: Record<string, {
14
+ segmentBoundaries: Array<{
15
+ depth: number;
16
+ path: string;
17
+ errorPath: string | undefined;
18
+ notFoundPath: string | undefined;
19
+ }>;
20
+ }> | undefined;
21
+ routes: Array<{
22
+ mode: "ssr" | "ssg" | "isr";
23
+ path: string;
24
+ pattern: string;
25
+ }>;
26
+ serverEntry: string;
27
+ }
28
+ /**
29
+ * Generates a single `_compile-entry.ts` that:
30
+ * 1. Statically imports every page module so Bun bundles them into the binary
31
+ * 2. Optionally embeds client assets via `with { type: "file" }` (embed mode)
32
+ * 3. Sets production mode and registers everything in a single CompileContext
33
+ * 4. Dynamically imports server.ts to boot the app
34
+ */
35
+ export declare function generateCompileEntry(options: CompileEntryOptions): string;
@@ -0,0 +1,26 @@
1
+ export interface EntryTemplateOptions {
2
+ buildId?: string;
3
+ extraContext?: string[];
4
+ extraImports?: string[];
5
+ headerComment: string;
6
+ rootConventions?: {
7
+ errorPath?: string;
8
+ notFoundPath?: string;
9
+ };
10
+ rootPath: string;
11
+ routeMetadata?: Record<string, {
12
+ segmentBoundaries: Array<{
13
+ depth: number;
14
+ path: string;
15
+ errorPath?: string;
16
+ notFoundPath?: string;
17
+ }>;
18
+ }>;
19
+ routes: Array<{
20
+ mode: "ssr" | "ssg" | "isr";
21
+ path: string;
22
+ pattern: string;
23
+ }>;
24
+ serverEntry: string;
25
+ }
26
+ export declare function buildEntrySource(options: EntryTemplateOptions): string;
@@ -0,0 +1,24 @@
1
+ import type { ResolvedRoute } from "../router";
2
+ import type { BuildClientOptions } from "./types";
3
+ /**
4
+ * Generates the client hydration entry.
5
+ *
6
+ * Renders into <div id="root"> (the SSR outlet element) and retains the React
7
+ * root across hot reloads via import.meta.hot.data.root so React Fast Refresh
8
+ * applies in-place instead of remounting.
9
+ *
10
+ * @param routes - Resolved routes to include in the hydration manifest.
11
+ * @param rootLayout - Absolute path to the root layout module.
12
+ * @param basePath - Optional sub-path prefix for static deployments (e.g. "/furin").
13
+ * When set, the generated code strips the prefix from `window.location.pathname`
14
+ * before matching routes, and passes `basePath` to `RouterProvider` so SPA
15
+ * navigation uses the correct physical URLs.
16
+ */
17
+ export declare function generateHydrateEntry(routes: ResolvedRoute[], rootLayout: string, basePath: string): string;
18
+ /**
19
+ * Writes _hydrate.tsx + index.html to outDir for dev (Bun HMR) mode.
20
+ *
21
+ * Only rewrites a file when its content has actually changed so Bun's --hot
22
+ * watcher does not trigger a spurious reload on every server restart.
23
+ */
24
+ export declare function writeDevFiles(routes: ResolvedRoute[], { outDir, rootLayout, basePath }: BuildClientOptions, projectRoot: string): void;
@@ -0,0 +1,7 @@
1
+ import type { BuildAppOptions, BuildAppResult } from "./types";
2
+ export { buildClient } from "./client";
3
+ export { writeDevFiles } from "./hydrate";
4
+ export { patternToTypeString, schemaToTypeString, writeRouteTypes } from "./route-types";
5
+ export type { BuildAppOptions, BuildAppResult, BuildClientOptions, BuildManifest, BuildRouteManifestEntry, TargetBuildManifest, } from "./types";
6
+ export declare const BUILD_OUTPUT_DIR = ".furin/build";
7
+ export declare function buildApp(options: BuildAppOptions): Promise<BuildAppResult>;