alepha 0.15.2 → 0.15.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 (132) hide show
  1. package/README.md +68 -80
  2. package/dist/api/audits/index.d.ts +332 -332
  3. package/dist/api/audits/index.d.ts.map +1 -1
  4. package/dist/api/files/index.d.ts +170 -170
  5. package/dist/api/files/index.d.ts.map +1 -1
  6. package/dist/api/jobs/index.d.ts +151 -151
  7. package/dist/api/keys/index.d.ts +195 -195
  8. package/dist/api/keys/index.d.ts.map +1 -1
  9. package/dist/api/parameters/index.d.ts +260 -260
  10. package/dist/api/users/index.d.ts +22 -11
  11. package/dist/api/users/index.d.ts.map +1 -1
  12. package/dist/api/users/index.js +7 -2
  13. package/dist/api/users/index.js.map +1 -1
  14. package/dist/api/verifications/index.d.ts +128 -128
  15. package/dist/api/verifications/index.d.ts.map +1 -1
  16. package/dist/bucket/index.d.ts +8 -0
  17. package/dist/bucket/index.d.ts.map +1 -1
  18. package/dist/bucket/index.js +7 -2
  19. package/dist/bucket/index.js.map +1 -1
  20. package/dist/cli/index.d.ts +191 -74
  21. package/dist/cli/index.d.ts.map +1 -1
  22. package/dist/cli/index.js +215 -48
  23. package/dist/cli/index.js.map +1 -1
  24. package/dist/command/index.d.ts +10 -0
  25. package/dist/command/index.d.ts.map +1 -1
  26. package/dist/command/index.js +67 -13
  27. package/dist/command/index.js.map +1 -1
  28. package/dist/core/index.browser.js +28 -21
  29. package/dist/core/index.browser.js.map +1 -1
  30. package/dist/core/index.d.ts.map +1 -1
  31. package/dist/core/index.js +28 -21
  32. package/dist/core/index.js.map +1 -1
  33. package/dist/core/index.native.js +28 -21
  34. package/dist/core/index.native.js.map +1 -1
  35. package/dist/email/index.d.ts +8 -0
  36. package/dist/email/index.d.ts.map +1 -1
  37. package/dist/email/index.js +7 -2
  38. package/dist/email/index.js.map +1 -1
  39. package/dist/mcp/index.d.ts +5 -5
  40. package/dist/orm/index.bun.js +32 -16
  41. package/dist/orm/index.bun.js.map +1 -1
  42. package/dist/orm/index.d.ts +4 -1
  43. package/dist/orm/index.d.ts.map +1 -1
  44. package/dist/orm/index.js +34 -22
  45. package/dist/orm/index.js.map +1 -1
  46. package/dist/react/router/index.browser.js +9 -15
  47. package/dist/react/router/index.browser.js.map +1 -1
  48. package/dist/react/router/index.d.ts +295 -407
  49. package/dist/react/router/index.d.ts.map +1 -1
  50. package/dist/react/router/index.js +566 -776
  51. package/dist/react/router/index.js.map +1 -1
  52. package/dist/redis/index.d.ts +19 -19
  53. package/dist/security/index.d.ts +42 -42
  54. package/dist/security/index.d.ts.map +1 -1
  55. package/dist/security/index.js +8 -7
  56. package/dist/security/index.js.map +1 -1
  57. package/dist/server/auth/index.d.ts +167 -167
  58. package/dist/server/core/index.d.ts +9 -9
  59. package/dist/server/health/index.d.ts +17 -17
  60. package/dist/server/links/index.d.ts +39 -39
  61. package/dist/server/static/index.js +7 -2
  62. package/dist/server/static/index.js.map +1 -1
  63. package/dist/server/swagger/index.d.ts +8 -0
  64. package/dist/server/swagger/index.d.ts.map +1 -1
  65. package/dist/server/swagger/index.js +7 -2
  66. package/dist/server/swagger/index.js.map +1 -1
  67. package/dist/sms/index.d.ts +8 -0
  68. package/dist/sms/index.d.ts.map +1 -1
  69. package/dist/sms/index.js +7 -2
  70. package/dist/sms/index.js.map +1 -1
  71. package/dist/system/index.browser.js +734 -12
  72. package/dist/system/index.browser.js.map +1 -1
  73. package/dist/system/index.d.ts +8 -0
  74. package/dist/system/index.d.ts.map +1 -1
  75. package/dist/system/index.js +7 -2
  76. package/dist/system/index.js.map +1 -1
  77. package/dist/vite/index.d.ts +1 -1
  78. package/dist/vite/index.js +15 -7
  79. package/dist/vite/index.js.map +1 -1
  80. package/package.json +4 -2
  81. package/src/api/logs/TODO.md +13 -10
  82. package/src/cli/apps/AlephaPackageBuilderCli.ts +9 -0
  83. package/src/cli/atoms/buildOptions.ts +99 -9
  84. package/src/cli/commands/build.ts +149 -32
  85. package/src/cli/commands/db.ts +5 -7
  86. package/src/cli/commands/init.spec.ts +50 -6
  87. package/src/cli/commands/init.ts +28 -5
  88. package/src/cli/providers/ViteDevServerProvider.ts +1 -10
  89. package/src/cli/services/AlephaCliUtils.ts +16 -0
  90. package/src/cli/services/PackageManagerUtils.ts +2 -0
  91. package/src/cli/services/ProjectScaffolder.spec.ts +97 -0
  92. package/src/cli/services/ProjectScaffolder.ts +28 -6
  93. package/src/cli/templates/agentMd.ts +6 -1
  94. package/src/cli/templates/apiAppSecurityTs.ts +11 -0
  95. package/src/cli/templates/apiIndexTs.ts +18 -4
  96. package/src/cli/templates/webAppRouterTs.ts +25 -1
  97. package/src/cli/templates/webHelloComponentTsx.ts +15 -5
  98. package/src/command/helpers/Runner.spec.ts +135 -0
  99. package/src/command/helpers/Runner.ts +4 -1
  100. package/src/command/providers/CliProvider.spec.ts +325 -0
  101. package/src/command/providers/CliProvider.ts +117 -7
  102. package/src/core/Alepha.ts +32 -25
  103. package/src/orm/index.bun.ts +1 -1
  104. package/src/orm/index.ts +2 -6
  105. package/src/orm/providers/drivers/BunSqliteProvider.ts +4 -1
  106. package/src/orm/providers/drivers/CloudflareD1Provider.ts +57 -30
  107. package/src/orm/providers/drivers/DatabaseProvider.ts +9 -1
  108. package/src/orm/providers/drivers/NodeSqliteProvider.ts +4 -1
  109. package/src/react/router/hooks/useActive.ts +1 -1
  110. package/src/react/router/hooks/useRouter.ts +1 -1
  111. package/src/react/router/index.ts +4 -0
  112. package/src/react/router/primitives/$page.browser.spec.tsx +24 -24
  113. package/src/react/router/primitives/$page.spec.tsx +0 -32
  114. package/src/react/router/primitives/$page.ts +6 -14
  115. package/src/react/router/providers/ReactBrowserProvider.ts +6 -3
  116. package/src/react/router/providers/ReactPageProvider.ts +1 -1
  117. package/src/react/router/providers/ReactPreloadProvider.spec.ts +142 -0
  118. package/src/react/router/providers/ReactPreloadProvider.ts +85 -0
  119. package/src/react/router/providers/ReactServerProvider.ts +7 -78
  120. package/src/react/router/providers/ReactServerTemplateProvider.spec.ts +210 -0
  121. package/src/react/router/providers/ReactServerTemplateProvider.ts +228 -665
  122. package/src/react/router/services/ReactRouter.ts +13 -13
  123. package/src/security/__tests__/ServerSecurityProvider.spec.ts +77 -0
  124. package/src/security/providers/ServerSecurityProvider.ts +30 -22
  125. package/src/server/core/providers/NodeHttpServerProvider.spec.ts +9 -3
  126. package/src/system/index.browser.ts +25 -0
  127. package/src/system/index.workerd.ts +1 -0
  128. package/src/system/providers/FileSystemProvider.ts +8 -0
  129. package/src/system/providers/NodeFileSystemProvider.ts +11 -2
  130. package/src/vite/tasks/buildServer.ts +2 -12
  131. package/src/vite/tasks/generateCloudflare.ts +10 -7
  132. package/src/vite/tasks/generateDocker.ts +4 -0
@@ -1,11 +1,11 @@
1
- import * as alepha16 from "alepha";
1
+ import * as alepha6 from "alepha";
2
2
  import { Alepha, AlephaError, Async, FileLike, Json, KIND, Primitive, Static, StreamLike, TObject, TSchema } from "alepha";
3
3
  import { DateTimeProvider } from "alepha/datetime";
4
4
  import { ClientOnlyProps } from "alepha/react";
5
5
  import { ServerHandler, ServerRequest, ServerRouterProvider } from "alepha/server";
6
6
  import { ServerRouteCache } from "alepha/server/cache";
7
7
  import { LinkProvider } from "alepha/server/links";
8
- import * as alepha_logger2 from "alepha/logger";
8
+ import * as alepha_logger0 from "alepha/logger";
9
9
  import * as react0 from "react";
10
10
  import { AnchorHTMLAttributes, CSSProperties, FC, ReactNode } from "react";
11
11
  import * as react_jsx_runtime0 from "react/jsx-runtime";
@@ -47,8 +47,8 @@ declare class Redirection extends AlephaError {
47
47
  }
48
48
  //#endregion
49
49
  //#region ../../src/react/router/providers/ReactPageProvider.d.ts
50
- declare const envSchema$1: alepha16.TObject<{
51
- REACT_STRICT_MODE: alepha16.TBoolean;
50
+ declare const envSchema$1: alepha6.TObject<{
51
+ REACT_STRICT_MODE: alepha6.TBoolean;
52
52
  }>;
53
53
  declare module "alepha" {
54
54
  interface Env extends Partial<Static<typeof envSchema$1>> {}
@@ -57,7 +57,7 @@ declare module "alepha" {
57
57
  * Handle page routes for React applications. (Browser and Server)
58
58
  */
59
59
  declare class ReactPageProvider {
60
- protected readonly log: alepha_logger2.Logger;
60
+ protected readonly log: alepha_logger0.Logger;
61
61
  protected readonly env: {
62
62
  REACT_STRICT_MODE: boolean;
63
63
  };
@@ -93,7 +93,7 @@ declare class ReactPageProvider {
93
93
  }, params?: Record<string, any>): string;
94
94
  compile(path: string, params?: Record<string, string>): string;
95
95
  protected renderView(index: number, path: string, view: ReactNode | undefined, page: PageRoute): ReactNode;
96
- protected readonly configure: alepha16.HookPrimitive<"configure">;
96
+ protected readonly configure: alepha6.HookPrimitive<"configure">;
97
97
  protected map(pages: Array<PagePrimitive>, target: PagePrimitive): PageRouteEntry;
98
98
  add(entry: PageRouteEntry): void;
99
99
  protected createMatch(page: PageRoute): string;
@@ -518,7 +518,6 @@ interface PagePrimitiveOptions<TConfig extends PageConfigSchema = PageConfigSche
518
518
  */
519
519
  [PAGE_PRELOAD_KEY]?: string;
520
520
  }
521
- type ErrorHandler = (error: Error, state: ReactRouterState) => ReactNode | Redirection | undefined;
522
521
  declare class PagePrimitive<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> extends Primitive<PagePrimitiveOptions<TConfig, TProps, TPropsParent>> {
523
522
  protected readonly reactPageService: ReactPageService;
524
523
  protected onInit(): void;
@@ -534,9 +533,8 @@ declare class PagePrimitive<TConfig extends PageConfigSchema = PageConfigSchema,
534
533
  html: string;
535
534
  response: Response;
536
535
  }>;
537
- match(url: string): boolean;
538
- pathname(config: any): string;
539
536
  }
537
+ type ErrorHandler = (error: Error, state: ReactRouterState) => ReactNode | Redirection | undefined;
540
538
  interface PageConfigSchema {
541
539
  query?: TSchema;
542
540
  params?: TSchema;
@@ -578,7 +576,7 @@ type CssAnimation = {
578
576
  };
579
577
  //#endregion
580
578
  //#region ../../src/react/router/services/ReactRouter.d.ts
581
- interface RouterGoOptions {
579
+ interface RouterPushOptions {
582
580
  replace?: boolean;
583
581
  params?: Record<string, string>;
584
582
  query?: Record<string, string>;
@@ -624,10 +622,10 @@ declare class ReactRouter<T extends object> {
624
622
  back(): Promise<void>;
625
623
  forward(): Promise<void>;
626
624
  invalidate(props?: Record<string, any>): Promise<void>;
627
- go(path: string, options?: RouterGoOptions): Promise<void>;
628
- go(path: keyof VirtualRouter<T>, options?: RouterGoOptions): Promise<void>;
629
- anchor(path: string, options?: RouterGoOptions): AnchorProps;
630
- anchor(path: keyof VirtualRouter<T>, options?: RouterGoOptions): AnchorProps;
625
+ push(path: string, options?: RouterPushOptions): Promise<void>;
626
+ push(path: keyof VirtualRouter<T>, options?: RouterPushOptions): Promise<void>;
627
+ anchor(path: string, options?: RouterPushOptions): AnchorProps;
628
+ anchor(path: keyof VirtualRouter<T>, options?: RouterPushOptions): AnchorProps;
631
629
  base(path: string): string;
632
630
  /**
633
631
  * Set query params.
@@ -652,12 +650,12 @@ interface BrowserRoute extends Route {
652
650
  * Implementation of AlephaRouter for React in browser environment.
653
651
  */
654
652
  declare class ReactBrowserRouterProvider extends RouterProvider<BrowserRoute> {
655
- protected readonly log: alepha_logger2.Logger;
653
+ protected readonly log: alepha_logger0.Logger;
656
654
  protected readonly alepha: Alepha;
657
655
  protected readonly pageApi: ReactPageProvider;
658
656
  protected readonly browserHeadProvider: BrowserHeadProvider;
659
657
  add(entry: PageRouteEntry): void;
660
- protected readonly configure: alepha16.HookPrimitive<"configure">;
658
+ protected readonly configure: alepha6.HookPrimitive<"configure">;
661
659
  transition(url: URL, previous?: PreviousLayerData[], meta?: {}): Promise<string | void>;
662
660
  root(state: ReactRouterState): ReactNode;
663
661
  }
@@ -666,8 +664,8 @@ declare class ReactBrowserRouterProvider extends RouterProvider<BrowserRoute> {
666
664
  /**
667
665
  * React browser renderer configuration atom
668
666
  */
669
- declare const reactBrowserOptions: alepha16.Atom<alepha16.TObject<{
670
- scrollRestoration: alepha16.TUnsafe<"top" | "manual">;
667
+ declare const reactBrowserOptions: alepha6.Atom<alepha6.TObject<{
668
+ scrollRestoration: alepha6.TUnsafe<"top" | "manual">;
671
669
  }>, "alepha.react.browser.options">;
672
670
  type ReactBrowserRendererOptions = Static<typeof reactBrowserOptions.schema>;
673
671
  declare module "alepha" {
@@ -676,7 +674,7 @@ declare module "alepha" {
676
674
  }
677
675
  }
678
676
  declare class ReactBrowserProvider {
679
- protected readonly log: alepha_logger2.Logger;
677
+ protected readonly log: alepha_logger0.Logger;
680
678
  protected readonly client: LinkProvider;
681
679
  protected readonly alepha: Alepha;
682
680
  protected readonly router: ReactBrowserRouterProvider;
@@ -708,14 +706,14 @@ declare class ReactBrowserProvider {
708
706
  get url(): string;
709
707
  pushState(path: string, replace?: boolean): void;
710
708
  invalidate(props?: Record<string, any>): Promise<void>;
711
- go(url: string, options?: RouterGoOptions): Promise<void>;
709
+ push(url: string, options?: RouterPushOptions): Promise<void>;
712
710
  protected render(options?: RouterRenderOptions): Promise<void>;
713
711
  /**
714
712
  * Get embedded layers from the server.
715
713
  */
716
714
  protected getHydrationState(): ReactHydrationState | undefined;
717
- protected readonly onTransitionEnd: alepha16.HookPrimitive<"react:transition:end">;
718
- readonly ready: alepha16.HookPrimitive<"ready">;
715
+ protected readonly onTransitionEnd: alepha6.HookPrimitive<"react:transition:end">;
716
+ readonly ready: alepha6.HookPrimitive<"ready">;
719
717
  }
720
718
  type ReactHydrationState = {
721
719
  layers?: Array<PreviousLayerData>;
@@ -1104,13 +1102,217 @@ interface UseQueryParamsHookOptions {
1104
1102
  * }
1105
1103
  *
1106
1104
  * const router = useRouter<App>();
1107
- * router.go("home"); // typesafe
1105
+ * router.push("home"); // typesafe
1108
1106
  */
1109
1107
  declare const useRouter: <T extends object = any>() => ReactRouter<T>;
1110
1108
  //#endregion
1111
1109
  //#region ../../src/react/router/hooks/useRouterState.d.ts
1112
1110
  declare const useRouterState: () => ReactRouterState;
1113
1111
  //#endregion
1112
+ //#region ../../src/react/router/atoms/ssrManifestAtom.d.ts
1113
+ /**
1114
+ * Schema for the SSR manifest atom.
1115
+ */
1116
+ declare const ssrManifestAtomSchema: alepha6.TObject<{
1117
+ /**
1118
+ * Base path for assets (from Vite's base config).
1119
+ * Used to prefix asset URLs when serving from a subpath.
1120
+ * @example "/devtools" or "/"
1121
+ */
1122
+ base: alepha6.TOptional<alepha6.TString>;
1123
+ /**
1124
+ * Preload manifest mapping short keys to source paths.
1125
+ * Generated by viteAlephaSsrPreload plugin at build time.
1126
+ */
1127
+ preload: alepha6.TOptional<alepha6.TRecord<"^.*$", alepha6.TString>>;
1128
+ /**
1129
+ * Client manifest mapping source files to their output information.
1130
+ * Only includes fields actually used for preloading.
1131
+ */
1132
+ client: alepha6.TOptional<alepha6.TRecord<"^.*$", alepha6.TObject<{
1133
+ file: alepha6.TString;
1134
+ isEntry: alepha6.TOptional<alepha6.TBoolean>;
1135
+ imports: alepha6.TOptional<alepha6.TArray<alepha6.TString>>;
1136
+ css: alepha6.TOptional<alepha6.TArray<alepha6.TString>>;
1137
+ }>>>;
1138
+ }>;
1139
+ /**
1140
+ * Type for the SSR manifest schema.
1141
+ */
1142
+ type SsrManifestAtomSchema = typeof ssrManifestAtomSchema;
1143
+ //#endregion
1144
+ //#region ../../src/react/router/providers/SSRManifestProvider.d.ts
1145
+ /**
1146
+ * Provider for SSR manifest data used for module preloading.
1147
+ *
1148
+ * The manifest is populated at build time by embedding data into the
1149
+ * generated index.js via the ssrManifestAtom. This eliminates filesystem
1150
+ * reads at runtime, making it optimal for serverless deployments.
1151
+ *
1152
+ * Manifest files are generated during `vite build`:
1153
+ * - manifest.json (client manifest)
1154
+ * - preload-manifest.json (from viteAlephaSsrPreload plugin)
1155
+ */
1156
+ declare class SSRManifestProvider {
1157
+ protected readonly alepha: Alepha;
1158
+ /**
1159
+ * Get the manifest from the store at runtime.
1160
+ * This ensures the manifest is available even when set after module load.
1161
+ */
1162
+ protected get manifest(): Static<SsrManifestAtomSchema>;
1163
+ /**
1164
+ * Get the base path for assets (from Vite's base config).
1165
+ * Returns empty string if base is "/" (default), otherwise returns the base path.
1166
+ */
1167
+ protected get base(): string;
1168
+ /**
1169
+ * Get the preload manifest.
1170
+ */
1171
+ protected get preloadManifest(): PreloadManifest | undefined;
1172
+ /**
1173
+ * Get the client manifest.
1174
+ */
1175
+ protected get clientManifest(): ClientManifest | undefined;
1176
+ /**
1177
+ * Resolve a preload key to its source path.
1178
+ *
1179
+ * The key is a short hash injected by viteAlephaSsrPreload plugin,
1180
+ * which maps to the full source path in the preload manifest.
1181
+ *
1182
+ * @param key - Short hash key (e.g., "a1b2c3d4")
1183
+ * @returns Source path (e.g., "src/pages/UserDetail.tsx") or undefined
1184
+ */
1185
+ resolvePreloadKey(key: string): string | undefined;
1186
+ /**
1187
+ * Get all chunks required for a source file, including transitive dependencies.
1188
+ *
1189
+ * Uses the client manifest to recursively resolve all imported chunks.
1190
+ *
1191
+ * @param sourcePath - Source file path (e.g., "src/pages/Home.tsx")
1192
+ * @returns Array of chunk URLs to preload, or empty array if not found
1193
+ */
1194
+ getChunks(sourcePath: string): string[];
1195
+ /**
1196
+ * Find manifest entry for a source path, trying different extensions.
1197
+ */
1198
+ protected findManifestEntry(sourcePath: string): {
1199
+ file: string;
1200
+ isEntry?: boolean;
1201
+ imports?: string[];
1202
+ css?: string[];
1203
+ } | undefined;
1204
+ /**
1205
+ * Recursively collect all chunk URLs for a manifest entry.
1206
+ */
1207
+ protected collectChunksRecursive(key: string, chunks: Set<string>, visited: Set<string>): void;
1208
+ /**
1209
+ * Collect modulepreload links for a route and its parent chain.
1210
+ */
1211
+ collectPreloadLinks(route: PageRoute): Array<{
1212
+ rel: string;
1213
+ href: string;
1214
+ as?: string;
1215
+ crossorigin?: string;
1216
+ }>;
1217
+ /**
1218
+ * Get all chunks for multiple source files.
1219
+ *
1220
+ * @param sourcePaths - Array of source file paths
1221
+ * @returns Deduplicated array of chunk URLs
1222
+ */
1223
+ getChunksForMultiple(sourcePaths: string[]): string[];
1224
+ /**
1225
+ * Check if manifest is loaded and available.
1226
+ */
1227
+ isAvailable(): boolean;
1228
+ /**
1229
+ * Cached entry assets - computed once at first access.
1230
+ */
1231
+ protected cachedEntryAssets: EntryAssets | null;
1232
+ /**
1233
+ * Get the entry point assets (main entry.js and associated CSS files).
1234
+ *
1235
+ * These assets are always required for all pages and can be preloaded
1236
+ * before page-specific loaders run.
1237
+ *
1238
+ * @returns Entry assets with js and css paths, or null if manifest unavailable
1239
+ */
1240
+ getEntryAssets(): EntryAssets | null;
1241
+ /**
1242
+ * Build preload link tags for entry assets.
1243
+ *
1244
+ * @returns Array of link objects ready to be rendered
1245
+ */
1246
+ getEntryPreloadLinks(): Array<{
1247
+ rel: string;
1248
+ href: string;
1249
+ as?: string;
1250
+ crossorigin?: string;
1251
+ }>;
1252
+ }
1253
+ /**
1254
+ * Entry assets structure containing the main entry JS and associated CSS files.
1255
+ */
1256
+ interface EntryAssets {
1257
+ /** Main entry JavaScript file (e.g., "/assets/entry.abc123.js") */
1258
+ js?: string;
1259
+ /** Associated CSS files (e.g., ["/assets/style.abc123.css"]) */
1260
+ css: string[];
1261
+ }
1262
+ /**
1263
+ * Client manifest structure from Vite.
1264
+ * Only includes fields actually used for preloading.
1265
+ */
1266
+ interface ClientManifest {
1267
+ [key: string]: {
1268
+ file: string;
1269
+ isEntry?: boolean;
1270
+ imports?: string[];
1271
+ css?: string[];
1272
+ };
1273
+ }
1274
+ /**
1275
+ * Preload manifest mapping short keys to source paths.
1276
+ * Generated by viteAlephaSsrPreload plugin at build time.
1277
+ */
1278
+ type PreloadManifest = Record<string, string>;
1279
+ //#endregion
1280
+ //#region ../../src/react/router/providers/ReactPreloadProvider.d.ts
1281
+ /**
1282
+ * Adds HTTP Link headers for preloading entry assets.
1283
+ *
1284
+ * Benefits:
1285
+ * - Early Hints (103): Servers can send preload hints before the full response
1286
+ * - CDN optimization: Many CDNs use Link headers to optimize asset delivery
1287
+ * - Browser prefetching: Browsers can start fetching resources earlier
1288
+ *
1289
+ * The Link header is computed once at first request and cached for reuse.
1290
+ */
1291
+ declare class ReactPreloadProvider {
1292
+ protected readonly alepha: Alepha;
1293
+ protected readonly ssrManifest: SSRManifestProvider;
1294
+ /**
1295
+ * Cached Link header value - computed once, reused for all requests.
1296
+ */
1297
+ protected cachedLinkHeader: string | null | undefined;
1298
+ /**
1299
+ * Build the Link header string from entry assets.
1300
+ *
1301
+ * Format: <url>; rel=preload; as=type, <url>; rel=modulepreload
1302
+ *
1303
+ * @returns Link header string or null if no assets
1304
+ */
1305
+ protected buildLinkHeader(): string | null;
1306
+ /**
1307
+ * Get the cached Link header, computing it on first access.
1308
+ */
1309
+ protected getLinkHeader(): string | null;
1310
+ /**
1311
+ * Add Link header to HTML responses for asset preloading.
1312
+ */
1313
+ protected readonly onResponse: alepha6.HookPrimitive<"server:onResponse">;
1314
+ }
1315
+ //#endregion
1114
1316
  //#region ../../src/system/providers/FileSystemProvider.d.ts
1115
1317
  /**
1116
1318
  * Options for creating a file from a URL
@@ -1289,8 +1491,16 @@ interface CpOptions {
1289
1491
  interface MkdirOptions {
1290
1492
  /**
1291
1493
  * If true, creates parent directories as needed
1494
+ *
1495
+ * @default true
1292
1496
  */
1293
1497
  recursive?: boolean;
1498
+ /**
1499
+ * If true, does not throw an error if the directory already exists
1500
+ *
1501
+ * @default true
1502
+ */
1503
+ force?: boolean;
1294
1504
  /**
1295
1505
  * File mode (permission and sticky bits)
1296
1506
  */
@@ -1403,202 +1613,94 @@ declare abstract class FileSystemProvider {
1403
1613
  //#endregion
1404
1614
  //#region ../../src/react/router/providers/ReactServerTemplateProvider.d.ts
1405
1615
  /**
1406
- * Handles HTML template parsing, preprocessing, and streaming for SSR.
1407
- *
1408
- * Responsibilities:
1409
- * - Parse template once at startup into logical slots
1410
- * - Pre-encode static parts as Uint8Array for zero-copy streaming
1411
- * - Render dynamic parts (attributes, head content) efficiently
1412
- * - Build hydration data for client-side rehydration
1616
+ * Handles HTML streaming for SSR.
1413
1617
  *
1414
- * This provider is injected into ReactServerProvider to handle all
1415
- * template-related operations, keeping ReactServerProvider focused
1416
- * on request handling and React rendering coordination.
1618
+ * Uses hardcoded HTML structure - all customization via $head primitive.
1619
+ * Pre-encodes static parts as Uint8Array for zero-copy streaming.
1417
1620
  */
1418
1621
  declare class ReactServerTemplateProvider {
1419
- protected readonly log: alepha_logger2.Logger;
1622
+ protected readonly log: alepha_logger0.Logger;
1420
1623
  protected readonly alepha: Alepha;
1421
1624
  /**
1422
- * Shared TextEncoder instance - reused across all requests.
1625
+ * Shared TextEncoder - reused across all requests.
1423
1626
  */
1424
1627
  protected readonly encoder: TextEncoder;
1425
1628
  /**
1426
- * Pre-encoded common strings for streaming.
1427
- */
1428
- protected readonly ENCODED: {
1629
+ * Pre-encoded static HTML parts for zero-copy streaming.
1630
+ */
1631
+ protected readonly SLOTS: {
1632
+ readonly DOCTYPE: Uint8Array<ArrayBuffer>;
1633
+ readonly HTML_OPEN: Uint8Array<ArrayBuffer>;
1634
+ readonly HTML_CLOSE: Uint8Array<ArrayBuffer>;
1635
+ readonly HEAD_OPEN: Uint8Array<ArrayBuffer>;
1636
+ readonly HEAD_CLOSE: Uint8Array<ArrayBuffer>;
1637
+ readonly BODY_OPEN: Uint8Array<ArrayBuffer>;
1638
+ readonly BODY_CLOSE: Uint8Array<ArrayBuffer>;
1639
+ readonly ROOT_OPEN: Uint8Array<ArrayBuffer>;
1640
+ readonly ROOT_CLOSE: Uint8Array<ArrayBuffer>;
1641
+ readonly BODY_HTML_CLOSE: Uint8Array<ArrayBuffer>;
1429
1642
  readonly HYDRATION_PREFIX: Uint8Array<ArrayBuffer>;
1430
1643
  readonly HYDRATION_SUFFIX: Uint8Array<ArrayBuffer>;
1431
- readonly EMPTY: Uint8Array<ArrayBuffer>;
1432
1644
  };
1433
1645
  /**
1434
- * Cached template slots - parsed once, reused for all requests.
1646
+ * Early head content (charset, viewport, entry assets).
1647
+ * Set once during configuration, reused for all requests.
1435
1648
  */
1436
- protected slots: TemplateSlots | null;
1649
+ protected earlyHeadContent: string;
1437
1650
  /**
1438
1651
  * Root element ID for React mounting.
1439
1652
  */
1440
- get rootId(): string;
1653
+ readonly rootId = "root";
1441
1654
  /**
1442
- * Regex pattern for matching the root div and extracting its content.
1655
+ * Regex for extracting root div content from HTML.
1443
1656
  */
1444
- get rootDivRegex(): RegExp;
1657
+ readonly rootDivRegex: RegExp;
1445
1658
  /**
1446
- * Extract the content inside the root div from HTML.
1447
- *
1448
- * @param html - Full HTML string
1449
- * @returns The content inside the root div, or undefined if not found
1659
+ * Extract content inside the root div from HTML.
1450
1660
  */
1451
1661
  extractRootContent(html: string): string | undefined;
1452
1662
  /**
1453
- * Check if template has been parsed and slots are available.
1454
- */
1455
- isReady(): boolean;
1456
- /**
1457
- * Get the parsed template slots.
1458
- * Throws if template hasn't been parsed yet.
1459
- */
1460
- getSlots(): TemplateSlots;
1461
- /**
1462
- * Parse an HTML template into logical slots for efficient streaming.
1463
- *
1464
- * This should be called once during server startup/configuration.
1465
- * The parsed slots are cached and reused for all requests.
1466
- */
1467
- parseTemplate(template: string): TemplateSlots;
1468
- /**
1469
- * Parse HTML attributes string into a record.
1470
- *
1471
- * Handles: key="value", key='value', key=value, and boolean key
1663
+ * Set early head content (charset, viewport, entry assets).
1664
+ * Called once during server configuration.
1472
1665
  */
1473
- protected parseAttributes(attrStr: string): Record<string, string>;
1666
+ setEarlyHeadContent(entryAssets: string, globalHead?: SimpleHead): void;
1474
1667
  /**
1475
1668
  * Render attributes record to HTML string.
1476
- *
1477
- * @param attrs - Attributes to render
1478
- * @returns HTML attribute string like ` lang="en" class="dark"`
1479
1669
  */
1480
- renderAttributes(attrs: Record<string, string>): string;
1481
- /**
1482
- * Render merged HTML attributes (original + dynamic).
1483
- */
1484
- renderMergedHtmlAttrs(dynamicAttrs?: Record<string, string>): string;
1485
- /**
1486
- * Render merged body attributes (original + dynamic).
1487
- */
1488
- renderMergedBodyAttrs(dynamicAttrs?: Record<string, string>): string;
1670
+ renderAttributes(attrs?: Record<string, string>): string;
1489
1671
  /**
1490
1672
  * Render head content (title, meta, link, script tags).
1491
- *
1492
- * @param head - Head data to render
1493
- * @param includeOriginal - Whether to include original head content
1494
- * @returns HTML string with head content
1495
- */
1496
- renderHeadContent(head?: SimpleHead, includeOriginal?: boolean): string;
1497
- /**
1498
- * Render a meta tag.
1499
1673
  */
1500
- protected renderMetaTag(meta: {
1501
- name?: string;
1502
- property?: string;
1503
- content: string;
1504
- }): string;
1505
- /**
1506
- * Render a link tag.
1507
- */
1508
- protected renderLinkTag(link: {
1509
- rel: string;
1510
- href: string;
1511
- type?: string;
1512
- as?: string;
1513
- crossorigin?: string;
1514
- }): string;
1515
- /**
1516
- * Render a script tag.
1517
- */
1518
- protected renderScriptTag(script: string | (Record<string, string | boolean | undefined> & {
1519
- content?: string;
1520
- })): string;
1674
+ renderHeadContent(head?: SimpleHead): string;
1521
1675
  /**
1522
1676
  * Escape HTML special characters.
1523
1677
  */
1524
1678
  escapeHtml(str: string): string;
1525
1679
  /**
1526
1680
  * Safely serialize data to JSON for embedding in HTML.
1527
- * Escapes characters that could break out of script tags.
1528
1681
  */
1529
1682
  safeJsonSerialize(data: unknown): string;
1530
1683
  /**
1531
1684
  * Build hydration data from router state.
1532
- *
1533
- * This creates the data structure that will be serialized to window.__ssr
1534
- * for client-side rehydration.
1535
1685
  */
1536
1686
  buildHydrationData(state: ReactRouterState): HydrationData;
1537
1687
  /**
1538
- * Stream the body content: body tag, root div, React content, hydration, and closing tags.
1539
- *
1540
- * If an error occurs during React streaming, it injects error HTML instead of aborting,
1541
- * ensuring users see an error message rather than a white screen.
1542
- */
1543
- protected streamBodyContent(controller: ReadableStreamDefaultController<Uint8Array>, reactStream: ReadableStream<Uint8Array>, state: ReactRouterState, hydration: boolean): Promise<void>;
1544
- /**
1545
- * Create a ReadableStream that streams the HTML template with React content.
1546
- *
1547
- * This is the main entry point for SSR streaming. It:
1548
- * 1. Sends <head> immediately (browser starts downloading assets)
1549
- * 2. Streams React content as it renders
1550
- * 3. Appends hydration script and closing tags
1551
- *
1552
- * @param reactStream - ReadableStream from renderToReadableStream
1553
- * @param state - Router state with head data
1554
- * @param options - Streaming options
1555
- */
1556
- createHtmlStream(reactStream: ReadableStream<Uint8Array>, state: ReactRouterState, options?: {
1557
- hydration?: boolean;
1558
- onError?: (error: unknown) => void;
1559
- }): ReadableStream<Uint8Array>;
1560
- /**
1561
- * Early head content for preloading.
1562
- *
1563
- * Contains entry assets (JS + CSS) that are always required and can be
1564
- * sent before page loaders run.
1565
- */
1566
- protected earlyHeadContent: string;
1567
- /**
1568
- * Set the early head content (entry script + CSS).
1569
- *
1570
- * Also strips these assets from the original head content to avoid duplicates,
1571
- * since we're moving them to the early phase.
1572
- *
1573
- * Automatically prepends critical meta tags (charset, viewport) if not present
1574
- * in $head configuration, ensuring they're sent as early as possible.
1575
- *
1576
- * @param content - HTML string with entry assets
1577
- * @param globalHead - Global head configuration from $head primitives
1578
- * @param entryAssets - Entry asset paths to strip from original head
1688
+ * Pipe React stream to controller with backpressure handling.
1689
+ * Returns true if stream completed successfully, false if error occurred.
1579
1690
  */
1580
- setEarlyHeadContent(content: string, globalHead?: SimpleHead, entryAssets?: {
1581
- js?: string;
1582
- css: string[];
1583
- }): void;
1691
+ protected pipeReactStream(controller: ReadableStreamDefaultController<Uint8Array>, reactStream: ReadableStream<Uint8Array>, state: ReactRouterState): Promise<boolean>;
1584
1692
  /**
1585
- * Escape special regex characters in a string.
1693
+ * Stream complete HTML document (head already closed).
1694
+ * Used by both createHtmlStream and late phase of createEarlyHtmlStream.
1586
1695
  */
1587
- protected escapeRegExp(str: string): string;
1696
+ protected streamBodyAndClose(controller: ReadableStreamDefaultController<Uint8Array>, reactStream: ReadableStream<Uint8Array>, state: ReactRouterState, hydration: boolean): Promise<void>;
1588
1697
  /**
1589
- * Create an optimized HTML stream with early head streaming.
1590
- *
1591
- * This version sends critical assets (entry.js, CSS) BEFORE page loaders run,
1592
- * allowing the browser to start downloading them immediately.
1698
+ * Create HTML stream with early head optimization.
1593
1699
  *
1594
1700
  * Flow:
1595
1701
  * 1. Send DOCTYPE, <html>, <head> open, entry preloads (IMMEDIATE)
1596
- * 2. Run async work (createLayers, etc.)
1702
+ * 2. Run async work (page loaders)
1597
1703
  * 3. Send rest of head, body, React content, hydration
1598
- *
1599
- * @param globalHead - Global head with htmlAttributes (from $head primitives)
1600
- * @param asyncWork - Async function to run between early head and rest of stream
1601
- * @param options - Streaming options
1602
1704
  */
1603
1705
  createEarlyHtmlStream(globalHead: SimpleHead, asyncWork: () => Promise<{
1604
1706
  state: ReactRouterState;
@@ -1610,59 +1712,26 @@ declare class ReactServerTemplateProvider {
1610
1712
  onError?: (error: unknown) => void;
1611
1713
  }): ReadableStream<Uint8Array>;
1612
1714
  /**
1613
- * Inject error HTML into the stream when an error occurs during streaming.
1614
- *
1615
- * Uses the router state's onError handler to render the error component,
1616
- * falling back to ErrorViewer if no custom handler is defined.
1617
- * Renders using renderToString to produce static HTML.
1618
- *
1619
- * Since we may have already sent partial HTML (DOCTYPE, <html>, <head>),
1620
- * we need to complete the document with an error message instead of aborting.
1621
- *
1622
- * Handles different states:
1623
- * - headClosed=false, bodyStarted=false: Need to add head content, close head, open body, add error, close all
1624
- * - headClosed=true, bodyStarted=false: Need to open body, add error, close all
1625
- * - headClosed=true, bodyStarted=true: Already inside root div, add error, close all
1715
+ * Create HTML stream (non-early version, for testing/prerender).
1716
+ */
1717
+ createHtmlStream(reactStream: ReadableStream<Uint8Array>, state: ReactRouterState, options?: {
1718
+ hydration?: boolean;
1719
+ onError?: (error: unknown) => void;
1720
+ }): ReadableStream<Uint8Array>;
1721
+ /**
1722
+ * Inject error HTML when streaming fails.
1626
1723
  */
1627
- protected injectErrorHtml(controller: ReadableStreamDefaultController<Uint8Array>, encoder: TextEncoder, slots: TemplateSlots, error: unknown, routerState: ReactRouterState | undefined, streamState: {
1724
+ protected injectErrorHtml(controller: ReadableStreamDefaultController<Uint8Array>, error: unknown, routerState: ReactRouterState | undefined, streamState: {
1628
1725
  headClosed: boolean;
1629
1726
  bodyStarted: boolean;
1630
1727
  }): void;
1631
1728
  /**
1632
- * Render an error to HTML string using the router's error handler.
1633
- *
1634
- * Falls back to ErrorViewer if:
1635
- * - No router state is available
1636
- * - The error handler returns null/undefined
1637
- * - The error handler itself throws
1729
+ * Render error to HTML string.
1638
1730
  */
1639
1731
  protected renderErrorToString(error: Error, routerState: ReactRouterState | undefined): string;
1640
1732
  }
1641
1733
  /**
1642
- * Template slots - the template split into logical parts for efficient streaming.
1643
- *
1644
- * Static parts are pre-encoded as Uint8Array for zero-copy streaming.
1645
- * Dynamic parts (attributes, head content) are kept as strings/objects for merging.
1646
- */
1647
- interface TemplateSlots {
1648
- doctype: Uint8Array;
1649
- htmlOpen: Uint8Array;
1650
- htmlClose: Uint8Array;
1651
- headOpen: Uint8Array;
1652
- headClose: Uint8Array;
1653
- bodyOpen: Uint8Array;
1654
- bodyClose: Uint8Array;
1655
- rootOpen: Uint8Array;
1656
- rootClose: Uint8Array;
1657
- scriptClose: Uint8Array;
1658
- htmlOriginalAttrs: Record<string, string>;
1659
- bodyOriginalAttrs: Record<string, string>;
1660
- headOriginalContent: string;
1661
- beforeRoot: string;
1662
- afterRoot: string;
1663
- }
1664
- /**
1665
- * Hydration state that gets serialized to window.__ssr
1734
+ * Hydration state serialized to window.__ssr
1666
1735
  */
1667
1736
  interface HydrationData {
1668
1737
  layers: Array<{
@@ -1676,174 +1745,6 @@ interface HydrationData {
1676
1745
  [key: string]: unknown;
1677
1746
  }
1678
1747
  //#endregion
1679
- //#region ../../src/react/router/atoms/ssrManifestAtom.d.ts
1680
- /**
1681
- * Schema for the SSR manifest atom.
1682
- */
1683
- declare const ssrManifestAtomSchema: alepha16.TObject<{
1684
- /**
1685
- * Base path for assets (from Vite's base config).
1686
- * Used to prefix asset URLs when serving from a subpath.
1687
- * @example "/devtools" or "/"
1688
- */
1689
- base: alepha16.TOptional<alepha16.TString>;
1690
- /**
1691
- * Preload manifest mapping short keys to source paths.
1692
- * Generated by viteAlephaSsrPreload plugin at build time.
1693
- */
1694
- preload: alepha16.TOptional<alepha16.TRecord<"^.*$", alepha16.TString>>;
1695
- /**
1696
- * Client manifest mapping source files to their output information.
1697
- * Only includes fields actually used for preloading.
1698
- */
1699
- client: alepha16.TOptional<alepha16.TRecord<"^.*$", alepha16.TObject<{
1700
- file: alepha16.TString;
1701
- isEntry: alepha16.TOptional<alepha16.TBoolean>;
1702
- imports: alepha16.TOptional<alepha16.TArray<alepha16.TString>>;
1703
- css: alepha16.TOptional<alepha16.TArray<alepha16.TString>>;
1704
- }>>>;
1705
- }>;
1706
- /**
1707
- * Type for the SSR manifest schema.
1708
- */
1709
- type SsrManifestAtomSchema = typeof ssrManifestAtomSchema;
1710
- //#endregion
1711
- //#region ../../src/react/router/providers/SSRManifestProvider.d.ts
1712
- /**
1713
- * Provider for SSR manifest data used for module preloading.
1714
- *
1715
- * The manifest is populated at build time by embedding data into the
1716
- * generated index.js via the ssrManifestAtom. This eliminates filesystem
1717
- * reads at runtime, making it optimal for serverless deployments.
1718
- *
1719
- * Manifest files are generated during `vite build`:
1720
- * - manifest.json (client manifest)
1721
- * - preload-manifest.json (from viteAlephaSsrPreload plugin)
1722
- */
1723
- declare class SSRManifestProvider {
1724
- protected readonly alepha: Alepha;
1725
- /**
1726
- * Get the manifest from the store at runtime.
1727
- * This ensures the manifest is available even when set after module load.
1728
- */
1729
- protected get manifest(): Static<SsrManifestAtomSchema>;
1730
- /**
1731
- * Get the base path for assets (from Vite's base config).
1732
- * Returns empty string if base is "/" (default), otherwise returns the base path.
1733
- */
1734
- protected get base(): string;
1735
- /**
1736
- * Get the preload manifest.
1737
- */
1738
- protected get preloadManifest(): PreloadManifest | undefined;
1739
- /**
1740
- * Get the client manifest.
1741
- */
1742
- protected get clientManifest(): ClientManifest | undefined;
1743
- /**
1744
- * Resolve a preload key to its source path.
1745
- *
1746
- * The key is a short hash injected by viteAlephaSsrPreload plugin,
1747
- * which maps to the full source path in the preload manifest.
1748
- *
1749
- * @param key - Short hash key (e.g., "a1b2c3d4")
1750
- * @returns Source path (e.g., "src/pages/UserDetail.tsx") or undefined
1751
- */
1752
- resolvePreloadKey(key: string): string | undefined;
1753
- /**
1754
- * Get all chunks required for a source file, including transitive dependencies.
1755
- *
1756
- * Uses the client manifest to recursively resolve all imported chunks.
1757
- *
1758
- * @param sourcePath - Source file path (e.g., "src/pages/Home.tsx")
1759
- * @returns Array of chunk URLs to preload, or empty array if not found
1760
- */
1761
- getChunks(sourcePath: string): string[];
1762
- /**
1763
- * Find manifest entry for a source path, trying different extensions.
1764
- */
1765
- protected findManifestEntry(sourcePath: string): {
1766
- file: string;
1767
- isEntry?: boolean;
1768
- imports?: string[];
1769
- css?: string[];
1770
- } | undefined;
1771
- /**
1772
- * Recursively collect all chunk URLs for a manifest entry.
1773
- */
1774
- protected collectChunksRecursive(key: string, chunks: Set<string>, visited: Set<string>): void;
1775
- /**
1776
- * Collect modulepreload links for a route and its parent chain.
1777
- */
1778
- collectPreloadLinks(route: PageRoute): Array<{
1779
- rel: string;
1780
- href: string;
1781
- as?: string;
1782
- crossorigin?: string;
1783
- }>;
1784
- /**
1785
- * Get all chunks for multiple source files.
1786
- *
1787
- * @param sourcePaths - Array of source file paths
1788
- * @returns Deduplicated array of chunk URLs
1789
- */
1790
- getChunksForMultiple(sourcePaths: string[]): string[];
1791
- /**
1792
- * Check if manifest is loaded and available.
1793
- */
1794
- isAvailable(): boolean;
1795
- /**
1796
- * Cached entry assets - computed once at first access.
1797
- */
1798
- protected cachedEntryAssets: EntryAssets | null;
1799
- /**
1800
- * Get the entry point assets (main entry.js and associated CSS files).
1801
- *
1802
- * These assets are always required for all pages and can be preloaded
1803
- * before page-specific loaders run.
1804
- *
1805
- * @returns Entry assets with js and css paths, or null if manifest unavailable
1806
- */
1807
- getEntryAssets(): EntryAssets | null;
1808
- /**
1809
- * Build preload link tags for entry assets.
1810
- *
1811
- * @returns Array of link objects ready to be rendered
1812
- */
1813
- getEntryPreloadLinks(): Array<{
1814
- rel: string;
1815
- href: string;
1816
- as?: string;
1817
- crossorigin?: string;
1818
- }>;
1819
- }
1820
- /**
1821
- * Entry assets structure containing the main entry JS and associated CSS files.
1822
- */
1823
- interface EntryAssets {
1824
- /** Main entry JavaScript file (e.g., "/assets/entry.abc123.js") */
1825
- js?: string;
1826
- /** Associated CSS files (e.g., ["/assets/style.abc123.css"]) */
1827
- css: string[];
1828
- }
1829
- /**
1830
- * Client manifest structure from Vite.
1831
- * Only includes fields actually used for preloading.
1832
- */
1833
- interface ClientManifest {
1834
- [key: string]: {
1835
- file: string;
1836
- isEntry?: boolean;
1837
- imports?: string[];
1838
- css?: string[];
1839
- };
1840
- }
1841
- /**
1842
- * Preload manifest mapping short keys to source paths.
1843
- * Generated by viteAlephaSsrPreload plugin at build time.
1844
- */
1845
- type PreloadManifest = Record<string, string>;
1846
- //#endregion
1847
1748
  //#region ../../src/react/router/providers/ReactServerProvider.d.ts
1848
1749
  /**
1849
1750
  * React server provider responsible for SSR and static file serving.
@@ -1867,7 +1768,7 @@ declare class ReactServerProvider {
1867
1768
  readonly expires: "0";
1868
1769
  };
1869
1770
  protected readonly fs: FileSystemProvider;
1870
- protected readonly log: alepha_logger2.Logger;
1771
+ protected readonly log: alepha_logger0.Logger;
1871
1772
  protected readonly alepha: Alepha;
1872
1773
  protected readonly env: {
1873
1774
  REACT_SSR_ENABLED?: boolean | undefined;
@@ -1892,27 +1793,16 @@ declare class ReactServerProvider {
1892
1793
  /**
1893
1794
  * Configure the React server provider.
1894
1795
  */
1895
- readonly onConfigure: alepha16.HookPrimitive<"configure">;
1896
- /**
1897
- * Get the current HTML template.
1898
- */
1899
- get template(): string;
1796
+ readonly onConfigure: alepha6.HookPrimitive<"configure">;
1900
1797
  /**
1901
1798
  * Register all pages as server routes.
1902
1799
  */
1903
- protected registerPages(templateLoader: TemplateLoader): Promise<void>;
1800
+ protected registerPages(): void;
1904
1801
  /**
1905
1802
  * Set up early head content with entry assets.
1906
1803
  *
1907
1804
  * This content is sent immediately when streaming starts, before page loaders run,
1908
1805
  * allowing the browser to start downloading entry.js and CSS files early.
1909
- *
1910
- * Uses <script type="module"> instead of <link rel="modulepreload"> for JS
1911
- * because the script needs to execute anyway - this way the browser starts
1912
- * downloading, parsing, AND will execute as soon as ready.
1913
- *
1914
- * Also injects critical meta tags (charset, viewport) if not specified in $head,
1915
- * and strips these assets from the original template head to avoid duplicates.
1916
1806
  */
1917
1807
  protected setupEarlyHeadContent(): void;
1918
1808
  /**
@@ -1926,7 +1816,7 @@ declare class ReactServerProvider {
1926
1816
  /**
1927
1817
  * Create the request handler for a page route.
1928
1818
  */
1929
- protected createHandler(route: PageRoute, templateLoader: TemplateLoader): ServerHandler;
1819
+ protected createHandler(route: PageRoute): ServerHandler;
1930
1820
  /**
1931
1821
  * Core page rendering logic shared between SSR handler and static prerendering.
1932
1822
  *
@@ -1958,25 +1848,23 @@ declare class ReactServerProvider {
1958
1848
  */
1959
1849
  protected streamToString(stream: ReadableStream<Uint8Array>): Promise<string>;
1960
1850
  }
1961
- type TemplateLoader = () => Promise<string | undefined>;
1962
- declare const envSchema: alepha16.TObject<{
1963
- REACT_SSR_ENABLED: alepha16.TOptional<alepha16.TBoolean>;
1851
+ declare const envSchema: alepha6.TObject<{
1852
+ REACT_SSR_ENABLED: alepha6.TOptional<alepha6.TBoolean>;
1964
1853
  }>;
1965
1854
  declare module "alepha" {
1966
1855
  interface Env extends Partial<Static<typeof envSchema>> {}
1967
1856
  interface State {
1968
1857
  "alepha.react.server.ssr"?: boolean;
1969
- "alepha.react.server.template"?: string;
1970
1858
  }
1971
1859
  }
1972
1860
  /**
1973
1861
  * React server provider configuration atom
1974
1862
  */
1975
- declare const reactServerOptions: alepha16.Atom<alepha16.TObject<{
1976
- publicDir: alepha16.TString;
1977
- staticServer: alepha16.TObject<{
1978
- disabled: alepha16.TBoolean;
1979
- path: alepha16.TString;
1863
+ declare const reactServerOptions: alepha6.Atom<alepha6.TObject<{
1864
+ publicDir: alepha6.TString;
1865
+ staticServer: alepha6.TObject<{
1866
+ disabled: alepha6.TBoolean;
1867
+ path: alepha6.TString;
1980
1868
  }>;
1981
1869
  }>, "alepha.react.server.options">;
1982
1870
  type ReactServerProviderOptions = Static<typeof reactServerOptions.schema>;
@@ -2062,7 +1950,7 @@ declare module "alepha" {
2062
1950
  * @see {@link $page}
2063
1951
  * @module alepha.react.router
2064
1952
  */
2065
- declare const AlephaReactRouter: alepha16.Service<alepha16.Module>;
1953
+ declare const AlephaReactRouter: alepha6.Service<alepha6.Module>;
2066
1954
  //#endregion
2067
- export { $page, AlephaReactRouter, AnchorProps, ClientManifest, ConcretePageRoute, CreateLayersResult, EntryAssets, ErrorHandler, ErrorViewer, HydrationData, Layer, Link, type LinkProps, _default as NestedView, NestedViewProps, NotFound, PAGE_PRELOAD_KEY, PageAnimation, PageConfigSchema, PageLoader, PagePrimitive, PagePrimitiveOptions, PagePrimitiveRenderOptions, PagePrimitiveRenderResult, PageRequestConfig, PageRoute, PageRouteEntry, PreloadManifest, PreviousLayerData, ReactBrowserProvider, ReactBrowserRendererOptions, ReactHydrationState, ReactPageProvider, ReactPageService, ReactRouter, ReactRouterState, ReactServerProvider, ReactServerProviderOptions, ReactServerTemplateProvider, Redirection, type RouterGoOptions, RouterLayerContext, RouterLayerContextValue, RouterRenderOptions, RouterStackItem, SSRManifestProvider, TPropsDefault, TPropsParentDefault, TemplateSlots, TransitionOptions, UseActiveHook, UseActiveOptions, UseQueryParamsHookOptions, VirtualRouter, isPageRoute, reactBrowserOptions, reactServerOptions, useActive, useQueryParams, useRouter, useRouterState };
1955
+ export { $page, AlephaReactRouter, AnchorProps, ClientManifest, ConcretePageRoute, CreateLayersResult, EntryAssets, ErrorHandler, ErrorViewer, HydrationData, Layer, Link, type LinkProps, _default as NestedView, NestedViewProps, NotFound, PAGE_PRELOAD_KEY, PageAnimation, PageConfigSchema, PageLoader, PagePrimitive, PagePrimitiveOptions, PagePrimitiveRenderOptions, PagePrimitiveRenderResult, PageRequestConfig, PageRoute, PageRouteEntry, PreloadManifest, PreviousLayerData, ReactBrowserProvider, ReactBrowserRendererOptions, ReactHydrationState, ReactPageProvider, ReactPageService, ReactPreloadProvider, ReactRouter, ReactRouterState, ReactServerProvider, ReactServerProviderOptions, ReactServerTemplateProvider, Redirection, RouterLayerContext, RouterLayerContextValue, type RouterPushOptions, RouterRenderOptions, RouterStackItem, SSRManifestProvider, TPropsDefault, TPropsParentDefault, TransitionOptions, UseActiveHook, UseActiveOptions, UseQueryParamsHookOptions, VirtualRouter, isPageRoute, reactBrowserOptions, reactServerOptions, useActive, useQueryParams, useRouter, useRouterState };
2068
1956
  //# sourceMappingURL=index.d.ts.map