@bleedingdev/modern-js-renderer-octane 0.0.0-stage → 3.9.3-ultramodern.1

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 (138) hide show
  1. package/LICENSE +21 -0
  2. package/bin/octane-tsc.mjs +4 -0
  3. package/dist/cjs/bootstrap.js +68 -0
  4. package/dist/cjs/client.js +371 -0
  5. package/dist/cjs/entry-application.js +83 -0
  6. package/dist/cjs/entry-client.js +92 -0
  7. package/dist/cjs/entry-server.js +127 -0
  8. package/dist/cjs/federation-context.js +72 -0
  9. package/dist/cjs/federation.js +103 -0
  10. package/dist/cjs/i18n/I18nProvider.js +67 -0
  11. package/dist/cjs/i18n/LocalizedLink.js +89 -0
  12. package/dist/cjs/i18n/context.js +41 -0
  13. package/dist/cjs/i18n/index.js +86 -0
  14. package/dist/cjs/i18n/languageSync.js +99 -0
  15. package/dist/cjs/i18n/types.js +18 -0
  16. package/dist/cjs/i18n/useI18n.js +110 -0
  17. package/dist/cjs/index.js +46 -0
  18. package/dist/cjs/manifest.js +167 -0
  19. package/dist/cjs/plugin/compiler.js +125 -0
  20. package/dist/cjs/plugin/create.js +265 -0
  21. package/dist/cjs/plugin/index.js +151 -0
  22. package/dist/cjs/plugin/profile.js +89 -0
  23. package/dist/cjs/plugin/source.js +56 -0
  24. package/dist/cjs/router-client.js +139 -0
  25. package/dist/cjs/router-handler.js +168 -0
  26. package/dist/cjs/router-injection.js +139 -0
  27. package/dist/cjs/router-server-cleanup.js +46 -0
  28. package/dist/cjs/router-server-snapshot.js +405 -0
  29. package/dist/cjs/router-server.js +108 -0
  30. package/dist/cjs/router-snapshot.js +270 -0
  31. package/dist/cjs/router.js +218 -0
  32. package/dist/cjs/routes.js +187 -0
  33. package/dist/cjs/server.js +224 -0
  34. package/dist/cjs/typecheck.js +615 -0
  35. package/dist/esm/bootstrap.mjs +24 -0
  36. package/dist/esm/client.mjs +327 -0
  37. package/dist/esm/entry-application.mjs +39 -0
  38. package/dist/esm/entry-client.mjs +54 -0
  39. package/dist/esm/entry-server.mjs +86 -0
  40. package/dist/esm/federation-context.mjs +25 -0
  41. package/dist/esm/federation.mjs +65 -0
  42. package/dist/esm/i18n/I18nProvider.mjs +29 -0
  43. package/dist/esm/i18n/LocalizedLink.mjs +48 -0
  44. package/dist/esm/i18n/context.mjs +3 -0
  45. package/dist/esm/i18n/index.mjs +8 -0
  46. package/dist/esm/i18n/languageSync.mjs +61 -0
  47. package/dist/esm/i18n/types.mjs +0 -0
  48. package/dist/esm/i18n/useI18n.mjs +72 -0
  49. package/dist/esm/index.mjs +8 -0
  50. package/dist/esm/manifest.mjs +117 -0
  51. package/dist/esm/router-client.mjs +98 -0
  52. package/dist/esm/router-handler.mjs +130 -0
  53. package/dist/esm/router-injection.mjs +101 -0
  54. package/dist/esm/router-server-cleanup.mjs +8 -0
  55. package/dist/esm/router-server-snapshot.mjs +367 -0
  56. package/dist/esm/router-server.mjs +12 -0
  57. package/dist/esm/router-snapshot.mjs +199 -0
  58. package/dist/esm/router.mjs +94 -0
  59. package/dist/esm/routes.mjs +134 -0
  60. package/dist/esm/server.mjs +183 -0
  61. package/dist/esm-node/bootstrap.mjs +24 -0
  62. package/dist/esm-node/manifest.mjs +117 -0
  63. package/dist/esm-node/plugin/compiler.mjs +70 -0
  64. package/dist/esm-node/plugin/create.mjs +227 -0
  65. package/dist/esm-node/plugin/index.mjs +103 -0
  66. package/dist/esm-node/plugin/profile.mjs +51 -0
  67. package/dist/esm-node/plugin/source.mjs +7 -0
  68. package/dist/esm-node/typecheck.mjs +560 -0
  69. package/dist/types/bootstrap.d.ts +10 -0
  70. package/dist/types/client.d.ts +36 -0
  71. package/dist/types/entry-application.d.ts +19 -0
  72. package/dist/types/entry-client.d.ts +8 -0
  73. package/dist/types/entry-server.d.ts +11 -0
  74. package/dist/types/federation-context.d.ts +28 -0
  75. package/dist/types/federation.d.ts +18 -0
  76. package/dist/types/i18n/I18nProvider.d.ts +8 -0
  77. package/dist/types/i18n/LocalizedLink.d.ts +41 -0
  78. package/dist/types/i18n/context.d.ts +9 -0
  79. package/dist/types/i18n/index.d.ts +9 -0
  80. package/dist/types/i18n/languageSync.d.ts +26 -0
  81. package/dist/types/i18n/types.d.ts +34 -0
  82. package/dist/types/i18n/useI18n.d.ts +21 -0
  83. package/dist/types/index.d.ts +9 -0
  84. package/dist/types/manifest.d.ts +34 -0
  85. package/dist/types/plugin/compiler-manifest.d.cts +10 -0
  86. package/dist/types/plugin/compiler.d.ts +5 -0
  87. package/dist/types/plugin/create.d.ts +23 -0
  88. package/dist/types/plugin/index.d.ts +3 -0
  89. package/dist/types/plugin/profile.d.ts +2 -0
  90. package/dist/types/plugin/source.d.ts +1 -0
  91. package/dist/types/plugin/svg-component-template.d.cts +6 -0
  92. package/dist/types/router-client.d.ts +12 -0
  93. package/dist/types/router-handler.d.ts +13 -0
  94. package/dist/types/router-injection.d.ts +8 -0
  95. package/dist/types/router-server-cleanup.d.ts +3 -0
  96. package/dist/types/router-server-snapshot.d.ts +15 -0
  97. package/dist/types/router-server.d.ts +13 -0
  98. package/dist/types/router-snapshot.d.ts +14 -0
  99. package/dist/types/router.d.ts +30 -0
  100. package/dist/types/routes.d.ts +18 -0
  101. package/dist/types/server.d.ts +41 -0
  102. package/dist/types/typecheck.d.ts +31 -0
  103. package/package.json +216 -4
  104. package/src/bootstrap.ts +60 -0
  105. package/src/client.ts +485 -0
  106. package/src/entry-application.ts +72 -0
  107. package/src/entry-client.ts +80 -0
  108. package/src/entry-server.ts +142 -0
  109. package/src/federation-context.ts +53 -0
  110. package/src/federation.ts +158 -0
  111. package/src/i18n/I18nProvider.ts +56 -0
  112. package/src/i18n/LocalizedLink.ts +112 -0
  113. package/src/i18n/context.ts +12 -0
  114. package/src/i18n/index.ts +35 -0
  115. package/src/i18n/languageSync.ts +132 -0
  116. package/src/i18n/types.ts +36 -0
  117. package/src/i18n/useI18n.ts +119 -0
  118. package/src/index.ts +10 -0
  119. package/src/manifest.ts +253 -0
  120. package/src/plugin/compiler-manifest.cjs +178 -0
  121. package/src/plugin/compiler.ts +112 -0
  122. package/src/plugin/create.ts +272 -0
  123. package/src/plugin/index.ts +105 -0
  124. package/src/plugin/profile.ts +46 -0
  125. package/src/plugin/source.ts +16 -0
  126. package/src/plugin/svg-component-template.cjs +17 -0
  127. package/src/router-client.ts +144 -0
  128. package/src/router-handler.ts +182 -0
  129. package/src/router-injection.ts +145 -0
  130. package/src/router-server-cleanup.ts +11 -0
  131. package/src/router-server-snapshot.ts +564 -0
  132. package/src/router-server.ts +23 -0
  133. package/src/router-snapshot.ts +251 -0
  134. package/src/router.ts +192 -0
  135. package/src/routes.ts +263 -0
  136. package/src/server.ts +300 -0
  137. package/src/typecheck.ts +723 -0
  138. package/README.md +0 -3
@@ -0,0 +1,18 @@
1
+ import { type ComponentBody, type OctaneNode } from 'octane';
2
+ /** The native component shape exposed by a same-renderer Octane remote. */
3
+ export interface FederatedModule<P extends object> {
4
+ readonly default: ComponentBody<P>;
5
+ }
6
+ export interface FederatedComponentOptions {
7
+ /** Native content shown while loading, or after a failed server load. */
8
+ readonly fallback?: () => OctaneNode;
9
+ /** A positive load limit; the server defaults to 3000ms. */
10
+ readonly timeout?: number;
11
+ }
12
+ /**
13
+ * Render a native Octane remote by its `remote/Expose` id or a browser loader.
14
+ * Native Suspense owns server fallbacks, streamed styles and hydration adoption;
15
+ * browser failures reach the nearest native ErrorBoundary. A loader function is
16
+ * browser-only; use an id to render through the host's server federation runtime.
17
+ */
18
+ export declare function federatedComponent<P extends object = Record<string, never>>(remote: string | (() => Promise<FederatedModule<P>>), options?: FederatedComponentOptions): ComponentBody<P>;
@@ -0,0 +1,8 @@
1
+ import type { I18nContextValue } from './types';
2
+ export interface I18nProviderProps extends Omit<I18nContextValue, 'language'> {
3
+ children?: unknown;
4
+ }
5
+ export declare function I18nProvider(props: I18nProviderProps): import("octane").ElementDescriptor<{
6
+ value: I18nContextValue;
7
+ children: unknown;
8
+ }>;
@@ -0,0 +1,41 @@
1
+ import { type OctaneNode } from 'octane';
2
+ import { type LinkComponentProps } from '../router';
3
+ export interface LocalizedLinkProps {
4
+ /** A canonical, language-agnostic target, e.g. `/products/red-shoe`. */
5
+ to: string;
6
+ /** Localize for a specific language instead of the current one. */
7
+ language?: string;
8
+ children?: unknown;
9
+ class?: string;
10
+ activeProps?: LinkComponentProps<'a'>['activeProps'];
11
+ inactiveProps?: LinkComponentProps<'a'>['inactiveProps'];
12
+ activeOptions?: LinkComponentProps<'a'>['activeOptions'];
13
+ replace?: boolean;
14
+ preload?: LinkComponentProps<'a'>['preload'];
15
+ }
16
+ /**
17
+ * A thin wrapper over the native Octane router `Link`
18
+ * (`@octanejs/tanstack-router`'s precompiled `Link.tsrx`) that localizes a
19
+ * canonical `to` for the current (or an explicit) language before handing it
20
+ * to the real link — the same contract as `@modern-js/plugin-i18n`'s React
21
+ * `Link`. It resolves the href itself via the shared pathname helpers, so it
22
+ * works with or without the router's i18n `rewrite`. Every link, including
23
+ * one to another language, is the native `Link`: navigation, preloading and
24
+ * active state stay with the router.
25
+ *
26
+ * Under the i18n `rewrite` the router matches canonical paths and localizes
27
+ * outgoing locations to the current language, so a link to another language
28
+ * routes to the canonical `to` and publishes the target language's URL as a
29
+ * route mask (the rewrite keeps a mask's explicit language). The entry's
30
+ * router language synchronization (`syncWithRouter`) switches the i18next
31
+ * instance from the navigated URL, as it does for history navigation.
32
+ *
33
+ * No JSX: built with `createElement`, matching this package's existing
34
+ * style (see `src/routes.ts`).
35
+ */
36
+ export declare function LocalizedLink(props: LocalizedLinkProps): OctaneNode;
37
+ /**
38
+ * Language-invariant active check: `to="/products"` is active whether the
39
+ * current location is `/en/products` or `/produkty` under a mapped locale.
40
+ */
41
+ export declare function useIsLocalizedActive(canonicalTarget: string): boolean;
@@ -0,0 +1,9 @@
1
+ import type { I18nContextValue } from './types';
2
+ export type { I18nContextValue, I18nInstanceLike } from './types';
3
+ /**
4
+ * Octane's `createContext<T>(defaultValue: T)` requires a default (unlike
5
+ * Solid 2's default-less form), so a missing provider is detected by
6
+ * checking for `null` in `useI18n`/`useIsLocalizedActive` instead — the same
7
+ * guard shape `@modern-js/plugin-i18n`'s React `ModernI18nContext` uses.
8
+ */
9
+ export declare const I18nContext: import("octane").Context<I18nContextValue | null>;
@@ -0,0 +1,9 @@
1
+ export { createRequestLanguageRedirect, detectRequestLanguage, languageFromPathname, type RequestLanguageDetection, type ResolvedRequestLanguage, type ResolveRequestLanguageOptions, resolveRequestLanguage, } from '@modern-js/i18n-runtime-extensions/request-language';
2
+ export { createI18nSsrHandoffInlineData, I18N_SSR_HANDOFF_ELEMENT_ID, type I18nSsrHandoffPayload, type I18nSsrHandoffResources, readI18nSsrHandoff, } from '@modern-js/i18n-runtime-extensions/ssrLanguageHandoff';
3
+ export { type CreateI18nUrlRewriteOptions, createI18nUrlRewrite, type I18nLocationRewrite, } from '@modern-js/i18n-runtime-extensions/urlRewrite';
4
+ export { I18nContext } from './context';
5
+ export { I18nProvider, type I18nProviderProps } from './I18nProvider';
6
+ export { LocalizedLink, type LocalizedLinkProps, useIsLocalizedActive, } from './LocalizedLink';
7
+ export { type OctaneLatestLanguageSyncOptions, useLatestLanguageSync, } from './languageSync';
8
+ export type { I18nContextValue, I18nInstanceLike } from './types';
9
+ export { type UseI18nReturn, useI18n } from './useI18n';
@@ -0,0 +1,26 @@
1
+ import { type LanguageSyncFailure, type LanguageSyncPolicy } from '@modern-js/i18n-runtime-extensions/language-sync/controller';
2
+ export interface OctaneLatestLanguageSyncOptions<TTarget extends object> {
3
+ changeLanguage: (target: TTarget, language: string) => PromiseLike<unknown> | unknown;
4
+ commitLanguage: (target: TTarget, language: string) => void;
5
+ desiredLanguage?: string;
6
+ enabled?: boolean;
7
+ policy?: LanguageSyncPolicy;
8
+ readLanguage?: (target: TTarget) => string | undefined;
9
+ reportFailure?: (failure: LanguageSyncFailure) => void;
10
+ target?: TTarget;
11
+ }
12
+ /**
13
+ * Octane binding over the fork's renderer-neutral `Coordinator`/`Binding`
14
+ * pair (`@modern-js/i18n-runtime-extensions`'s `createLatestLanguageSyncBinding`):
15
+ * the same "latest intent wins, retry with backoff, report terminal failure"
16
+ * policy the React `useLatestLanguageSync` hook drives.
17
+ *
18
+ * Octane's own hook API (`useState`/`useEffect`/`useContext`/
19
+ * `useSyncExternalStore`, confirmed in `node_modules/octane/dist/runtime.d.ts`)
20
+ * is React-shaped, so this binding mirrors
21
+ * `i18n-extensions/src/language-sync/react.ts`'s `useLatestLanguageSync`
22
+ * directly — the Solid binding needed a `createEffect`/`onCleanup`
23
+ * reshaping for Solid 2's different (compute/effect-split, no
24
+ * `useEffect`-style dependency arrays) reactivity model; Octane does not.
25
+ */
26
+ export declare const useLatestLanguageSync: <TTarget extends object>({ changeLanguage, commitLanguage, desiredLanguage, enabled, policy, readLanguage, reportFailure, target, }: OctaneLatestLanguageSyncOptions<TTarget>) => ((language: string) => void);
@@ -0,0 +1,34 @@
1
+ import type { LocalisedUrlsOption } from '@modern-js/i18n-runtime-extensions/paths';
2
+ /**
3
+ * The slice of an i18next-shaped instance this binding needs. Deliberately
4
+ * not `@modern-js/plugin-i18n`'s `I18nInstance`: that type is intentionally
5
+ * narrowed (no index signature, non-overloaded methods — see plugin-i18n's
6
+ * fork notes) and, more importantly, the plugin package's peer dependencies
7
+ * require React/ReactDOM, which an Octane-only application must never need
8
+ * to install. `on`/`off` are real i18next `EventEmitter` methods this
9
+ * interface adds back for the reactive `languageChanged` subscription.
10
+ */
11
+ export interface I18nInstanceLike {
12
+ language: string;
13
+ t(key: string | string[], options?: Record<string, unknown>): string;
14
+ changeLanguage?(lng?: string): Promise<unknown> | unknown;
15
+ on?(event: 'languageChanged', callback: (lng: string) => void): void;
16
+ off?(event: 'languageChanged', callback: (lng: string) => void): void;
17
+ /** SSR per-request isolation: the server clones a base instance per request. */
18
+ cloneInstance?(options?: Record<string, unknown>): I18nInstanceLike;
19
+ }
20
+ export interface I18nContextValue {
21
+ /** Per-request instance. Never a module-level singleton. */
22
+ instance: I18nInstanceLike;
23
+ languages: readonly string[];
24
+ localisedUrls?: LocalisedUrlsOption;
25
+ /**
26
+ * Reactive current language, owned by `I18nProvider`'s own `useState` +
27
+ * one `languageChanged` subscription. `instance.language` is a plain
28
+ * mutable field, not itself reactive — Octane's context only re-renders
29
+ * consumers when the Provider commits a *new* `value` object (its
30
+ * `$$version` bumps), so every consumer reads this field off the context
31
+ * value instead of reaching into `instance.language` directly.
32
+ */
33
+ language: string;
34
+ }
@@ -0,0 +1,21 @@
1
+ import type { I18nInstanceLike } from './types';
2
+ export interface UseI18nReturn {
3
+ t: I18nInstanceLike['t'];
4
+ /** Current language. Re-renders the calling component on `languageChanged`. */
5
+ language: string;
6
+ languages: readonly string[];
7
+ /** The raw per-request instance, for advanced use (namespaces, `exists`, ...). */
8
+ instance: I18nInstanceLike;
9
+ /**
10
+ * Switches the i18next instance's language. With a router, also navigates to
11
+ * the localized path so the URL and active language stay aligned.
12
+ */
13
+ changeLanguage: (language: string) => Promise<void>;
14
+ }
15
+ /**
16
+ * Must render under `I18nProvider`; throws rather than silently reading a
17
+ * fallback instance when no provider is mounted (Octane's `createContext`
18
+ * requires a default value, so `I18nContext`'s default is `null` and this
19
+ * hook turns that into a loud error instead of a shared singleton).
20
+ */
21
+ export declare function useI18n(): UseI18nReturn;
@@ -0,0 +1,9 @@
1
+ export type { RendererIdentity } from '@modern-js/renderer-core/identity';
2
+ export type { OctaneDocumentBootstrap } from './bootstrap';
3
+ export declare const OCTANE_RUNTIME_PROFILE: Readonly<{
4
+ renderer: "octane";
5
+ runtime: "0.7.1+ultramodern.1331985ea3b0";
6
+ router: "0.1.60+ultramodern.0b9f76ee3003";
7
+ routerCore: "1.171.15";
8
+ history: "1.162.0";
9
+ }>;
@@ -0,0 +1,34 @@
1
+ import type { NativeCompilerArtifacts } from '@modern-js/renderer-core/adapter';
2
+ import { type RendererIdentity } from '@modern-js/renderer-core/identity';
3
+ export declare const OCTANE_RUNTIME_VERSION = "0.7.1+ultramodern.1331985ea3b0";
4
+ export declare const OCTANE_COMPILER_VERSION = "0.1.55";
5
+ export interface OctaneCompiledSource {
6
+ readonly resource: string;
7
+ readonly canonicalId: string;
8
+ readonly moduleId: string | number;
9
+ readonly transformKind: 'compile' | 'slots' | 'client-only-stub';
10
+ readonly emittedSourceSha256: string;
11
+ readonly assets: readonly string[];
12
+ }
13
+ export interface OctaneModuleManifest {
14
+ readonly schemaVersion: 1;
15
+ readonly renderer: 'octane';
16
+ readonly runtimeVersion: typeof OCTANE_RUNTIME_VERSION;
17
+ readonly compilerVersion: typeof OCTANE_COMPILER_VERSION;
18
+ readonly rendererIdentity: Readonly<RendererIdentity>;
19
+ readonly nativeHydrationBuildId: string;
20
+ readonly sourceModules: readonly OctaneCompiledSource[];
21
+ readonly assets: readonly {
22
+ readonly file: string;
23
+ readonly sha256: string;
24
+ }[];
25
+ }
26
+ export declare function octaneModuleManifestFileName(entryName: string): string;
27
+ /** Validates completed native bytes separately from the source/profile build. */
28
+ export declare function validateOctaneModuleManifest(value: unknown, expectedIdentity: RendererIdentity, expectedNativeHydrationBuildId?: string): OctaneModuleManifest;
29
+ /**
30
+ * The compiler artifact ABI. It lives in this runtime module, not in the
31
+ * build-only `./plugin`, because the production server validates manifests
32
+ * with it and deployments trace it from there.
33
+ */
34
+ export declare const compilerArtifacts: NativeCompilerArtifacts;
@@ -0,0 +1,10 @@
1
+ declare const _exports: {
2
+ OctaneCompilerManifestPlugin: typeof OctaneCompilerManifestPlugin;
3
+ };
4
+ export = _exports;
5
+ /** The released native compiler remains responsible for every transformation. */
6
+ declare class OctaneCompilerManifestPlugin {
7
+ options: any;
8
+ constructor(options: any);
9
+ apply(compiler: any): void;
10
+ }
@@ -0,0 +1,5 @@
1
+ import type { NativeRendererCompilerOptions } from '@modern-js/renderer-core/adapter';
2
+ import type { RsbuildPlugin } from '@rsbuild/core';
3
+ export declare function pluginSourceDirectory(): string;
4
+ /** Octane owns native compilation; UltraModern retains the application host. */
5
+ export declare function createOctaneCompilerPlugin(options: NativeRendererCompilerOptions): RsbuildPlugin;
@@ -0,0 +1,23 @@
1
+ export type OctaneAppSourceOptions = {
2
+ appId: string;
3
+ title: string;
4
+ entryName?: string;
5
+ appRole?: 'shell' | 'vertical';
6
+ sourceExtension: '.tsx' | '.tsrx';
7
+ jsxImportSource: string;
8
+ capabilities: {
9
+ ssr: boolean;
10
+ federation: boolean;
11
+ };
12
+ };
13
+ export type OctaneAppSourceArtifact = {
14
+ path: string;
15
+ content: string;
16
+ };
17
+ export type OctaneAppSources = {
18
+ sourceExtension: '.tsx';
19
+ jsxImportSource: 'octane';
20
+ artifacts: OctaneAppSourceArtifact[];
21
+ };
22
+ /** The renderer adapter owns entry generation, the document and hydration. */
23
+ export declare function generateOctaneAppSources(options: OctaneAppSourceOptions): OctaneAppSources;
@@ -0,0 +1,3 @@
1
+ import { type NativeRendererAdapter } from '@modern-js/renderer-core/adapter';
2
+ /** The build-side Octane renderer adapter UltraModern loads for `renderer: 'octane'`. */
3
+ export declare const rendererAdapter: NativeRendererAdapter<'octane'>;
@@ -0,0 +1,2 @@
1
+ import type { RendererBuildProfile } from '@modern-js/renderer-core/adapter';
2
+ export declare const octaneProfile: RendererBuildProfile<'octane'>;
@@ -0,0 +1 @@
1
+ export declare function assertOctaneEntrySource(source: string | false | undefined): Promise<void>;
@@ -0,0 +1,6 @@
1
+ export = _exports;
2
+ declare function _exports({ attributes, markup, origin, }: {
3
+ attributes: any;
4
+ markup: any;
5
+ origin: any;
6
+ }): string;
@@ -0,0 +1,12 @@
1
+ import { type AnyRouter } from '@octanejs/tanstack-router';
2
+ export interface OctaneRouterHydrationOptions {
3
+ signal?: AbortSignal;
4
+ }
5
+ /** Restore native SSR matches before Octane adopts the server's route ranges. */
6
+ export declare function prepareOctaneRouterHydration(router: AnyRouter, options?: OctaneRouterHydrationOptions): Promise<void>;
7
+ /** Adopt the native provider's ranges inside the admitted fragment host. */
8
+ export declare function OctaneRouterRoot({ router }: {
9
+ router: AnyRouter;
10
+ }): import("octane").ElementDescriptor<{
11
+ router: AnyRouter;
12
+ }>;
@@ -0,0 +1,13 @@
1
+ import type { RequestSession } from '@modern-js/renderer-core/session';
2
+ import { type AnyRouter } from '@octanejs/tanstack-router';
3
+ import { attachRouterServerSsrUtils, type RequestHandler } from '@octanejs/tanstack-router/ssr/server';
4
+ import { type OctaneRouterSerializationOptions } from './router-server-snapshot';
5
+ export interface OctaneRequestHandlerOptions<TRouter extends AnyRouter> {
6
+ createRouter(): TRouter;
7
+ request: Request;
8
+ session: RequestSession;
9
+ getRouterManifest?: () => Parameters<typeof attachRouterServerSsrUtils>[0]['manifest'] | Promise<Parameters<typeof attachRouterServerSsrUtils>[0]['manifest']>;
10
+ serialization?: OctaneRouterSerializationOptions;
11
+ }
12
+ /** Resolve native routes and HTTP disposition before the native document serializer. */
13
+ export declare function createOctaneRequestHandler<TRouter extends AnyRouter>({ createRouter, request, session, getRouterManifest, serialization, }: OctaneRequestHandlerOptions<TRouter>): RequestHandler<TRouter>;
@@ -0,0 +1,8 @@
1
+ import type { RequestSession } from '@modern-js/renderer-core/session';
2
+ import type { AnyRouter } from '@octanejs/tanstack-router';
3
+ import type { StreamInjectionSource } from 'octane/server';
4
+ export interface OctaneRouterInjectionOptions {
5
+ serializationTimeoutMs?: number;
6
+ }
7
+ /** Couple native router serialization to the response's single stream owner. */
8
+ export declare function createOctaneRouterInjection(router: AnyRouter, session: RequestSession, options?: OctaneRouterInjectionOptions): StreamInjectionSource;
@@ -0,0 +1,3 @@
1
+ import type { AnyRouter } from '@octanejs/tanstack-router';
2
+ /** The request handler, serializer and renderer share one native SSR owner. */
3
+ export declare function cleanupOctaneRouterSSR(router: AnyRouter): void;
@@ -0,0 +1,15 @@
1
+ import { type RequestSession } from '@modern-js/renderer-core/session';
2
+ import { type AnyRouter } from '@octanejs/tanstack-router';
3
+ export interface OctaneRouterSerializationOptions {
4
+ readonly production?: boolean;
5
+ /** Request-private records that are structurally ordinary JavaScript objects. */
6
+ readonly forbiddenValues?: readonly object[];
7
+ }
8
+ export interface OctaneRouterSerializationGuard {
9
+ /** Call immediately before native dehydrateMatch reads the internal matches. */
10
+ assertMatches(): void;
11
+ /** Native Seroval swallows errors; call after dehydrate and before responding. */
12
+ assertActive(): void;
13
+ }
14
+ /** Project the fresh native outer record before Seroval walks any application value. */
15
+ export declare function prepareOctaneRouterSerialization(router: AnyRouter, session: RequestSession, options?: OctaneRouterSerializationOptions): OctaneRouterSerializationGuard;
@@ -0,0 +1,13 @@
1
+ import { type AnyRouter } from '@octanejs/tanstack-router';
2
+ import { type ServerRenderNode } from 'octane/server';
3
+ export * from '@octanejs/tanstack-router/ssr/server';
4
+ export type { OctaneRequestHandlerOptions } from './router-handler';
5
+ export { createOctaneRequestHandler } from './router-handler';
6
+ export type { OctaneRouterInjectionOptions } from './router-injection';
7
+ export { createOctaneRouterInjection } from './router-injection';
8
+ export type { OctaneRouterSerializationGuard, OctaneRouterSerializationOptions, } from './router-server-snapshot';
9
+ export { prepareOctaneRouterSerialization } from './router-server-snapshot';
10
+ /** Render the native provider using the released Start server root contract. */
11
+ export declare function OctaneRouterServer({ router, }: {
12
+ router: AnyRouter;
13
+ }): ServerRenderNode;
@@ -0,0 +1,14 @@
1
+ import { DataProtocolError } from '@modern-js/renderer-core/data';
2
+ import { type AnySerializationAdapter } from '@octanejs/tanstack-router';
3
+ export declare const ADAPTER_KEY = "ultramodern.octane-public-snapshot.v1";
4
+ export declare const ROUTE_ERROR_KIND = "ultramodern-route-error";
5
+ export declare const NATIVE_ERROR_KIND = "ultramodern-native-error";
6
+ export declare const NATIVE_ROOT_FIELDS: Set<string>;
7
+ export declare const MATCH_FIELDS: Set<string>;
8
+ export declare function invalid(message: string): DataProtocolError;
9
+ export declare function descriptors(value: object, allowed?: ReadonlySet<string>, allowLazyStack?: boolean): Record<string, PropertyDescriptor>;
10
+ export declare function record(value: unknown): value is Record<string, unknown>;
11
+ export declare function stringField(fields: Record<string, PropertyDescriptor>, key: string): string;
12
+ export declare function nativePromise(value: unknown): value is Promise<unknown>;
13
+ export declare function clearStack(error: Error, stack: unknown): void;
14
+ export declare const octaneRouterSnapshotAdapter: AnySerializationAdapter;
@@ -0,0 +1,30 @@
1
+ import { type PublicDataOutcome } from '@modern-js/renderer-core/data';
2
+ import type { RendererIdentity } from '@modern-js/renderer-core/identity';
3
+ import { type AnyRouter } from '@octanejs/tanstack-router';
4
+ /** These bindings own matching, preloading, navigation and route component lifetimes. */
5
+ export * from '@octanejs/tanstack-router';
6
+ export { createRouter as createApplicationRouter, RouterProvider as ApplicationRouter, } from '@octanejs/tanstack-router';
7
+ export type { FileSystemDataModule, FileSystemRouteModule, FileSystemRouteOptions, } from './routes';
8
+ export { createFileSystemRouteTree, matchApplicationRouteIds, matchApplicationRoutes, RouteDataError, resolveRouteData, selectApplicationDataRoute, } from './routes';
9
+ /** Read the identity selected by this application's framework composition. */
10
+ export declare function useApplicationIdentity(): Readonly<RendererIdentity>;
11
+ /** Bind an action to its nearest native route, including ancestor layouts. */
12
+ export declare function useApplicationRouteId(): string;
13
+ export interface OctaneRouteActionOptions {
14
+ readonly router: AnyRouter;
15
+ readonly routeId: string;
16
+ readonly identity: RendererIdentity;
17
+ readonly url?: string | (() => string);
18
+ readonly method?: 'POST' | 'PUT' | 'PATCH' | 'DELETE';
19
+ readonly fetch?: typeof globalThis.fetch;
20
+ readonly signal?: AbortSignal;
21
+ }
22
+ /** Native useActionState owns submission state and the HTML form action. */
23
+ export declare function createOctaneRouteAction(input: OctaneRouteActionOptions): (_previous: PublicDataOutcome | undefined, formData: FormData) => Promise<PublicDataOutcome>;
24
+ export type OctaneRouteActionBinding = Pick<OctaneRouteActionOptions, 'url' | 'method' | 'fetch'>;
25
+ /**
26
+ * Bind an action to the nearest native route and to this component's
27
+ * lifetime: unmounting aborts a submission still in flight, so its late
28
+ * result cannot redirect or invalidate the route the user moved on to.
29
+ */
30
+ export declare function useOctaneRouteAction(binding?: OctaneRouteActionBinding): ReturnType<typeof createOctaneRouteAction>;
@@ -0,0 +1,18 @@
1
+ import type { DataOutcome, FileSystemRouteIR, PublicDataOutcome } from '@modern-js/renderer-core/data';
2
+ import { type FileSystemRouteOptions } from '@modern-js/renderer-core/router';
3
+ import { type AnyRoute, type AnyRouter, type ErrorRouteComponent, type NotFoundRouteComponent, type RouteComponent } from '@octanejs/tanstack-router';
4
+ export type { FileSystemDataModule, FileSystemRouteOptions, } from '@modern-js/renderer-core/router';
5
+ export { matchApplicationRouteIds, matchApplicationRoutes, RouteDataError, selectApplicationDataRoute, } from '@modern-js/renderer-core/router';
6
+ /** Generated imports contain native view bindings, keyed by the structural id. */
7
+ export interface FileSystemRouteModule {
8
+ component?: RouteComponent;
9
+ pendingComponent?: RouteComponent;
10
+ errorComponent?: ErrorRouteComponent;
11
+ notFoundComponent?: NotFoundRouteComponent;
12
+ validateSearch?: (search: Record<string, unknown>) => Record<string, unknown>;
13
+ head?: AnyRoute['options']['head'];
14
+ }
15
+ /** Native route boundaries decide how redirects, missing data and errors render. */
16
+ export declare function resolveRouteData(routeId: string, outcome: DataOutcome | PublicDataOutcome): unknown;
17
+ /** Pass filesystem structure to native factories without matching any URL. */
18
+ export declare function createFileSystemRouteTree<Context = unknown>(routes: readonly FileSystemRouteIR[], modules: Readonly<Record<string, FileSystemRouteModule>>, options?: FileSystemRouteOptions<Context, AnyRouter>): AnyRoute;
@@ -0,0 +1,41 @@
1
+ import { type DocumentAsset, type DocumentInlineData } from '@modern-js/renderer-core/document';
2
+ import type { NativeFederationBinding } from '@modern-js/renderer-core/federation';
3
+ import { type RequestSession, type ResponsePolicy } from '@modern-js/renderer-core/session';
4
+ import { type ServerRenderNode, type StreamOptions } from 'octane/server';
5
+ export interface OctaneDocumentOptions {
6
+ /** One identity for this response, shared with the client's signal receiver. */
7
+ readonly documentId: string;
8
+ /** Actual native client compilation hash, separate from application identity. */
9
+ readonly nativeHydrationBuildId: string;
10
+ readonly rootId?: string;
11
+ readonly lang?: string;
12
+ readonly nonce?: string;
13
+ readonly assets?: readonly DocumentAsset[];
14
+ /** Placed after the renderer bootstrap and before the entry scripts. */
15
+ readonly inlineData?: readonly DocumentInlineData[];
16
+ }
17
+ export type { DocumentInlineData as OctaneDocumentInlineData };
18
+ export interface OctaneDocumentResponseOptions<Bindings extends object = object> {
19
+ readonly session: RequestSession<Bindings>;
20
+ readonly document: OctaneDocumentOptions;
21
+ readonly responsePolicy?: ResponsePolicy;
22
+ /** Native route loading finishes its blocking HTTP work before rendering. */
23
+ readonly resolveResponse?: (session: RequestSession<Bindings>) => ResponsePolicy | Promise<ResponsePolicy>;
24
+ }
25
+ export interface RenderOctaneApplicationOptions<Bindings extends object = object> extends OctaneDocumentResponseOptions<Bindings> {
26
+ readonly App: ServerRenderNode;
27
+ readonly props?: unknown;
28
+ /** Native router serialization, owned by this request's router SSR context. */
29
+ readonly injection?: StreamOptions['injection'];
30
+ /** This server compilation's native Module Federation runtime. */
31
+ readonly federation?: NativeFederationBinding;
32
+ }
33
+ /** Deliver the CSR document; native browser mounting owns the empty root. */
34
+ export declare function renderOctaneCSRDocument<Bindings extends object>(input: OctaneDocumentResponseOptions<Bindings>): Promise<Response>;
35
+ /**
36
+ * Render a native Octane application into one request-owned HTML document.
37
+ * The dispatcher owns the session; this adapter owns native stream consumption
38
+ * and document placement. A late native error fails the body without changing
39
+ * the status and headers already sent to the client.
40
+ */
41
+ export declare function renderOctaneApplication<Bindings extends object>(input: RenderOctaneApplicationOptions<Bindings>): Promise<Response>;
@@ -0,0 +1,31 @@
1
+ export interface OctaneTypeDiagnostic {
2
+ fileName?: string;
3
+ pos: number;
4
+ end: number;
5
+ line?: number;
6
+ column?: number;
7
+ code: number | string;
8
+ category: 'error' | 'warning' | 'message';
9
+ text: string;
10
+ origin: 'typescript' | 'octane' | 'projection';
11
+ relatedInformation?: OctaneTypeDiagnostic[];
12
+ }
13
+ export interface OctaneTypecheckResult {
14
+ compilerVersion: string;
15
+ files: string[];
16
+ diagnostics: OctaneTypeDiagnostic[];
17
+ }
18
+ export interface OctaneTypecheckOptions {
19
+ project: string;
20
+ cwd?: string;
21
+ compilerOptions?: Record<string, unknown>;
22
+ }
23
+ /** Checks authored TSRX through Octane's public language projection and native TS7. */
24
+ export declare function checkOctaneProject(options: OctaneTypecheckOptions): OctaneTypecheckResult;
25
+ export declare function formatOctaneDiagnostic(diagnostic: OctaneTypeDiagnostic, cwd?: string): string;
26
+ /** Node CLI entry. Unsupported options fail visibly instead of being ignored. */
27
+ export declare function runOctaneTypecheck(argv: string[], io?: {
28
+ cwd?: string;
29
+ stdout?: (text: string) => void;
30
+ stderr?: (text: string) => void;
31
+ }): number;