@bleedingdev/modern-js-renderer-octane 0.0.0-stage → 3.9.3-ultramodern.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.
- package/LICENSE +21 -0
- package/bin/octane-tsc.mjs +4 -0
- package/dist/cjs/bootstrap.js +68 -0
- package/dist/cjs/client.js +421 -0
- package/dist/cjs/entry-application.js +88 -0
- package/dist/cjs/entry-client.js +95 -0
- package/dist/cjs/entry-server.js +135 -0
- package/dist/cjs/federation-context.js +72 -0
- package/dist/cjs/federation.js +205 -0
- package/dist/cjs/i18n/I18nProvider.js +59 -0
- package/dist/cjs/i18n/LocalizedLink.js +80 -0
- package/dist/cjs/i18n/context.js +41 -0
- package/dist/cjs/i18n/index.js +83 -0
- package/dist/cjs/i18n/languageSync.js +99 -0
- package/dist/cjs/i18n/types.js +18 -0
- package/dist/cjs/i18n/useI18n.js +110 -0
- package/dist/cjs/i18n-external-snapshot.js +645 -0
- package/dist/cjs/index.js +46 -0
- package/dist/cjs/manifest.js +167 -0
- package/dist/cjs/plugin/compiler.js +122 -0
- package/dist/cjs/plugin/create.js +266 -0
- package/dist/cjs/plugin/index.js +151 -0
- package/dist/cjs/plugin/profile.js +91 -0
- package/dist/cjs/plugin/source.js +56 -0
- package/dist/cjs/router-client.js +139 -0
- package/dist/cjs/router-external-snapshot.js +291 -0
- package/dist/cjs/router-handler.js +171 -0
- package/dist/cjs/router-server-cleanup.js +46 -0
- package/dist/cjs/router-server-snapshot.js +405 -0
- package/dist/cjs/router-server.js +100 -0
- package/dist/cjs/router-snapshot.js +270 -0
- package/dist/cjs/router.js +218 -0
- package/dist/cjs/routes.js +190 -0
- package/dist/cjs/server.js +245 -0
- package/dist/cjs/typecheck.js +615 -0
- package/dist/cjs/worker-federation-context.js +63 -0
- package/dist/cjs/worker-federation-contexts.js +97 -0
- package/dist/cjs/worker-federation.js +97 -0
- package/dist/esm/bootstrap.mjs +24 -0
- package/dist/esm/client.mjs +377 -0
- package/dist/esm/entry-application.mjs +44 -0
- package/dist/esm/entry-client.mjs +57 -0
- package/dist/esm/entry-server.mjs +91 -0
- package/dist/esm/federation-context.mjs +25 -0
- package/dist/esm/federation.mjs +167 -0
- package/dist/esm/i18n/I18nProvider.mjs +21 -0
- package/dist/esm/i18n/LocalizedLink.mjs +42 -0
- package/dist/esm/i18n/context.mjs +3 -0
- package/dist/esm/i18n/index.mjs +8 -0
- package/dist/esm/i18n/languageSync.mjs +61 -0
- package/dist/esm/i18n/types.mjs +0 -0
- package/dist/esm/i18n/useI18n.mjs +72 -0
- package/dist/esm/i18n-external-snapshot.mjs +576 -0
- package/dist/esm/index.mjs +8 -0
- package/dist/esm/manifest.mjs +117 -0
- package/dist/esm/router-client.mjs +98 -0
- package/dist/esm/router-external-snapshot.mjs +244 -0
- package/dist/esm/router-handler.mjs +133 -0
- package/dist/esm/router-server-cleanup.mjs +8 -0
- package/dist/esm/router-server-snapshot.mjs +367 -0
- package/dist/esm/router-server.mjs +11 -0
- package/dist/esm/router-snapshot.mjs +199 -0
- package/dist/esm/router.mjs +94 -0
- package/dist/esm/routes.mjs +134 -0
- package/dist/esm/server.mjs +204 -0
- package/dist/esm/worker-federation-context.mjs +19 -0
- package/dist/esm/worker-federation-contexts.mjs +47 -0
- package/dist/esm/worker-federation.mjs +59 -0
- package/dist/esm-node/bootstrap.mjs +24 -0
- package/dist/esm-node/manifest.mjs +117 -0
- package/dist/esm-node/plugin/compiler.mjs +67 -0
- package/dist/esm-node/plugin/create.mjs +228 -0
- package/dist/esm-node/plugin/index.mjs +103 -0
- package/dist/esm-node/plugin/profile.mjs +53 -0
- package/dist/esm-node/plugin/source.mjs +7 -0
- package/dist/esm-node/typecheck.mjs +560 -0
- package/dist/types/bootstrap.d.ts +10 -0
- package/dist/types/client.d.ts +40 -0
- package/dist/types/entry-application.d.ts +19 -0
- package/dist/types/entry-client.d.ts +10 -0
- package/dist/types/entry-server.d.ts +14 -0
- package/dist/types/federation-context.d.ts +28 -0
- package/dist/types/federation.d.ts +20 -0
- package/dist/types/i18n/I18nProvider.d.ts +8 -0
- package/dist/types/i18n/LocalizedLink.d.ts +14 -0
- package/dist/types/i18n/context.d.ts +9 -0
- package/dist/types/i18n/index.d.ts +9 -0
- package/dist/types/i18n/languageSync.d.ts +26 -0
- package/dist/types/i18n/types.d.ts +34 -0
- package/dist/types/i18n/useI18n.d.ts +21 -0
- package/dist/types/i18n-external-snapshot.d.ts +43 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/manifest.d.ts +34 -0
- package/dist/types/plugin/compiler-manifest.d.cts +10 -0
- package/dist/types/plugin/compiler.d.ts +5 -0
- package/dist/types/plugin/create.d.ts +23 -0
- package/dist/types/plugin/index.d.ts +3 -0
- package/dist/types/plugin/profile.d.ts +2 -0
- package/dist/types/plugin/source.d.ts +1 -0
- package/dist/types/plugin/svg-component-template.d.cts +6 -0
- package/dist/types/router-client.d.ts +12 -0
- package/dist/types/router-external-snapshot.d.ts +10 -0
- package/dist/types/router-handler.d.ts +13 -0
- package/dist/types/router-server-cleanup.d.ts +3 -0
- package/dist/types/router-server-snapshot.d.ts +15 -0
- package/dist/types/router-server.d.ts +11 -0
- package/dist/types/router-snapshot.d.ts +14 -0
- package/dist/types/router.d.ts +30 -0
- package/dist/types/routes.d.ts +20 -0
- package/dist/types/server.d.ts +47 -0
- package/dist/types/typecheck.d.ts +31 -0
- package/dist/types/worker-federation-context.d.ts +34 -0
- package/dist/types/worker-federation-contexts.d.ts +25 -0
- package/dist/types/worker-federation.d.ts +20 -0
- package/package.json +278 -4
- package/src/bootstrap.ts +60 -0
- package/src/client.ts +568 -0
- package/src/entry-application.ts +76 -0
- package/src/entry-client.ts +90 -0
- package/src/entry-server.ts +153 -0
- package/src/federation-context.ts +53 -0
- package/src/federation.ts +307 -0
- package/src/i18n/I18nProvider.ts +47 -0
- package/src/i18n/LocalizedLink.ts +86 -0
- package/src/i18n/context.ts +12 -0
- package/src/i18n/index.ts +31 -0
- package/src/i18n/languageSync.ts +132 -0
- package/src/i18n/types.ts +36 -0
- package/src/i18n/useI18n.ts +119 -0
- package/src/i18n-external-snapshot.ts +803 -0
- package/src/index.ts +10 -0
- package/src/manifest.ts +253 -0
- package/src/plugin/compiler-manifest.cjs +204 -0
- package/src/plugin/compiler.ts +104 -0
- package/src/plugin/create.ts +273 -0
- package/src/plugin/index.ts +107 -0
- package/src/plugin/profile.ts +50 -0
- package/src/plugin/source.ts +16 -0
- package/src/plugin/svg-component-template.cjs +17 -0
- package/src/router-client.ts +144 -0
- package/src/router-external-snapshot.ts +363 -0
- package/src/router-handler.ts +185 -0
- package/src/router-server-cleanup.ts +11 -0
- package/src/router-server-snapshot.ts +564 -0
- package/src/router-server.ts +21 -0
- package/src/router-snapshot.ts +251 -0
- package/src/router.ts +192 -0
- package/src/routes.ts +274 -0
- package/src/server.ts +340 -0
- package/src/typecheck.ts +723 -0
- package/src/worker-federation-context.ts +51 -0
- package/src/worker-federation-contexts.ts +91 -0
- package/src/worker-federation.ts +120 -0
- package/README.md +0 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { NativeWorkerDispatchOptions } from '@modern-js/renderer-core/server';
|
|
2
|
+
import { type AdmitWorkerRendererContract, createWorkerFederationHandler } from '@modern-js/renderer-core/worker-federation';
|
|
3
|
+
import { prepareExternalSnapshotRequest } from 'octane/server';
|
|
4
|
+
type NativeSnapshotRequest = Awaited<ReturnType<typeof prepareExternalSnapshotRequest>>;
|
|
5
|
+
type HandlerOptions = Parameters<typeof createWorkerFederationHandler<NativeSnapshotRequest>>[0];
|
|
6
|
+
/** The compiled registry pins its renderer publication and literal imports. */
|
|
7
|
+
export interface OctaneWorkerFederationRegistry {
|
|
8
|
+
initialize(options: Omit<HandlerOptions, 'publication' | 'exposes'> & {
|
|
9
|
+
publication: unknown;
|
|
10
|
+
}): (request: Request) => Promise<Response | undefined>;
|
|
11
|
+
}
|
|
12
|
+
/** Created per dispatch; no publisher or native snapshot cache crosses documents. */
|
|
13
|
+
export declare function createNativeWorkerFederationRuntime<Bindings extends object>(options: NativeWorkerDispatchOptions<Bindings>, compiler: {
|
|
14
|
+
readonly admitRendererContract: AdmitWorkerRendererContract;
|
|
15
|
+
readonly registry?: OctaneWorkerFederationRegistry;
|
|
16
|
+
}): {
|
|
17
|
+
transport: import("@modern-js/renderer-core/worker-federation").WorkerFederationTransport | undefined;
|
|
18
|
+
handleRequest: (request: Request) => Promise<Response | undefined>;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,280 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bleedingdev/modern-js-renderer-octane",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "3.9.3-ultramodern.10",
|
|
4
|
+
"description": "UltraModern native Octane application adapter.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/ultramodernjs/ultramodern.js.git",
|
|
9
|
+
"directory": "packages/runtime/renderer-octane"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"src",
|
|
14
|
+
"bin"
|
|
15
|
+
],
|
|
16
|
+
"main": "./dist/cjs/index.js",
|
|
17
|
+
"types": "./dist/types/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": {
|
|
21
|
+
"types": "./dist/types/index.d.ts",
|
|
22
|
+
"default": "./dist/esm/index.mjs"
|
|
23
|
+
},
|
|
24
|
+
"require": {
|
|
25
|
+
"types": "./dist/types/index.d.ts",
|
|
26
|
+
"default": "./dist/cjs/index.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"./client": {
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./dist/types/client.d.ts",
|
|
32
|
+
"default": "./dist/esm/client.mjs"
|
|
33
|
+
},
|
|
34
|
+
"require": {
|
|
35
|
+
"types": "./dist/types/client.d.ts",
|
|
36
|
+
"default": "./dist/cjs/client.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"./federation": {
|
|
40
|
+
"import": {
|
|
41
|
+
"types": "./dist/types/federation.d.ts",
|
|
42
|
+
"default": "./dist/esm/federation.mjs"
|
|
43
|
+
},
|
|
44
|
+
"require": {
|
|
45
|
+
"types": "./dist/types/federation.d.ts",
|
|
46
|
+
"default": "./dist/cjs/federation.js"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"./server": {
|
|
50
|
+
"import": {
|
|
51
|
+
"types": "./dist/types/server.d.ts",
|
|
52
|
+
"default": "./dist/esm/server.mjs"
|
|
53
|
+
},
|
|
54
|
+
"require": {
|
|
55
|
+
"types": "./dist/types/server.d.ts",
|
|
56
|
+
"default": "./dist/cjs/server.js"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"./router": {
|
|
60
|
+
"import": {
|
|
61
|
+
"types": "./dist/types/router.d.ts",
|
|
62
|
+
"default": "./dist/esm/router.mjs"
|
|
63
|
+
},
|
|
64
|
+
"require": {
|
|
65
|
+
"types": "./dist/types/router.d.ts",
|
|
66
|
+
"default": "./dist/cjs/router.js"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"./router-client": {
|
|
70
|
+
"import": {
|
|
71
|
+
"types": "./dist/types/router-client.d.ts",
|
|
72
|
+
"default": "./dist/esm/router-client.mjs"
|
|
73
|
+
},
|
|
74
|
+
"require": {
|
|
75
|
+
"types": "./dist/types/router-client.d.ts",
|
|
76
|
+
"default": "./dist/cjs/router-client.js"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"./router-server": {
|
|
80
|
+
"import": {
|
|
81
|
+
"types": "./dist/types/router-server.d.ts",
|
|
82
|
+
"default": "./dist/esm/router-server.mjs"
|
|
83
|
+
},
|
|
84
|
+
"require": {
|
|
85
|
+
"types": "./dist/types/router-server.d.ts",
|
|
86
|
+
"default": "./dist/cjs/router-server.js"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"./manifest": {
|
|
90
|
+
"import": {
|
|
91
|
+
"types": "./dist/types/manifest.d.ts",
|
|
92
|
+
"default": "./dist/esm/manifest.mjs"
|
|
93
|
+
},
|
|
94
|
+
"require": {
|
|
95
|
+
"types": "./dist/types/manifest.d.ts",
|
|
96
|
+
"default": "./dist/cjs/manifest.js"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"./typecheck": {
|
|
100
|
+
"types": "./dist/types/typecheck.d.ts",
|
|
101
|
+
"node": {
|
|
102
|
+
"import": "./dist/esm-node/typecheck.mjs",
|
|
103
|
+
"require": "./dist/cjs/typecheck.js"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"./i18n": {
|
|
107
|
+
"import": {
|
|
108
|
+
"types": "./dist/types/i18n/index.d.ts",
|
|
109
|
+
"default": "./dist/esm/i18n/index.mjs"
|
|
110
|
+
},
|
|
111
|
+
"require": {
|
|
112
|
+
"types": "./dist/types/i18n/index.d.ts",
|
|
113
|
+
"default": "./dist/cjs/i18n/index.js"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"./entry-client": {
|
|
117
|
+
"import": {
|
|
118
|
+
"types": "./dist/types/entry-client.d.ts",
|
|
119
|
+
"default": "./dist/esm/entry-client.mjs"
|
|
120
|
+
},
|
|
121
|
+
"require": {
|
|
122
|
+
"types": "./dist/types/entry-client.d.ts",
|
|
123
|
+
"default": "./dist/cjs/entry-client.js"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"./entry-server": {
|
|
127
|
+
"import": {
|
|
128
|
+
"types": "./dist/types/entry-server.d.ts",
|
|
129
|
+
"default": "./dist/esm/entry-server.mjs"
|
|
130
|
+
},
|
|
131
|
+
"require": {
|
|
132
|
+
"types": "./dist/types/entry-server.d.ts",
|
|
133
|
+
"default": "./dist/cjs/entry-server.js"
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"./plugin": {
|
|
137
|
+
"import": {
|
|
138
|
+
"types": "./dist/types/plugin/index.d.ts",
|
|
139
|
+
"default": "./dist/esm-node/plugin/index.mjs"
|
|
140
|
+
},
|
|
141
|
+
"require": {
|
|
142
|
+
"types": "./dist/types/plugin/index.d.ts",
|
|
143
|
+
"default": "./dist/cjs/plugin/index.js"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"./package.json": "./package.json",
|
|
147
|
+
"./router-external-snapshot": {
|
|
148
|
+
"import": {
|
|
149
|
+
"types": "./dist/types/router-external-snapshot.d.ts",
|
|
150
|
+
"default": "./dist/esm/router-external-snapshot.mjs"
|
|
151
|
+
},
|
|
152
|
+
"require": {
|
|
153
|
+
"types": "./dist/types/router-external-snapshot.d.ts",
|
|
154
|
+
"default": "./dist/cjs/router-external-snapshot.js"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"./i18n-external-snapshot": {
|
|
158
|
+
"import": {
|
|
159
|
+
"types": "./dist/types/i18n-external-snapshot.d.ts",
|
|
160
|
+
"default": "./dist/esm/i18n-external-snapshot.mjs"
|
|
161
|
+
},
|
|
162
|
+
"require": {
|
|
163
|
+
"types": "./dist/types/i18n-external-snapshot.d.ts",
|
|
164
|
+
"default": "./dist/cjs/i18n-external-snapshot.js"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"./worker-federation-contexts": {
|
|
168
|
+
"import": {
|
|
169
|
+
"types": "./dist/types/worker-federation-contexts.d.ts",
|
|
170
|
+
"default": "./dist/esm/worker-federation-contexts.mjs"
|
|
171
|
+
},
|
|
172
|
+
"require": {
|
|
173
|
+
"types": "./dist/types/worker-federation-contexts.d.ts",
|
|
174
|
+
"default": "./dist/cjs/worker-federation-contexts.js"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"bin": {
|
|
179
|
+
"octane-tsc": "bin/octane-tsc.mjs"
|
|
180
|
+
},
|
|
181
|
+
"engines": {
|
|
182
|
+
"node": ">=26.12.0"
|
|
183
|
+
},
|
|
184
|
+
"dependencies": {
|
|
185
|
+
"@modern-js/renderer-core": "npm:@bleedingdev/modern-js-renderer-core@3.9.3-ultramodern.10",
|
|
186
|
+
"@volar/language-core": "2.4.28",
|
|
187
|
+
"jsonc-parser": "3.3.1",
|
|
188
|
+
"seroval": "1.6.9",
|
|
189
|
+
"seroval-plugins": "1.6.9",
|
|
190
|
+
"typescript": "7.0.2"
|
|
191
|
+
},
|
|
192
|
+
"peerDependencies": {
|
|
193
|
+
"@modern-js/i18n-runtime-extensions": "3.9.3-ultramodern.10",
|
|
194
|
+
"@octanejs/rspack-plugin": "0.2.4",
|
|
195
|
+
"@octanejs/tanstack-router": "0.2.10",
|
|
196
|
+
"@rsbuild/core": "2.2.13",
|
|
197
|
+
"@tanstack/router-core": "1.171.38",
|
|
198
|
+
"@tsrx/oxc": "0.20.0",
|
|
199
|
+
"i18next": ">=25.7.4",
|
|
200
|
+
"octane": "0.13.8"
|
|
201
|
+
},
|
|
202
|
+
"peerDependenciesMeta": {
|
|
203
|
+
"@modern-js/i18n-runtime-extensions": {
|
|
204
|
+
"optional": true
|
|
205
|
+
},
|
|
206
|
+
"@octanejs/rspack-plugin": {
|
|
207
|
+
"optional": true
|
|
208
|
+
},
|
|
209
|
+
"@octanejs/tanstack-router": {
|
|
210
|
+
"optional": true
|
|
211
|
+
},
|
|
212
|
+
"@rsbuild/core": {
|
|
213
|
+
"optional": true
|
|
214
|
+
},
|
|
215
|
+
"@tsrx/oxc": {
|
|
216
|
+
"optional": true
|
|
217
|
+
},
|
|
218
|
+
"i18next": {
|
|
219
|
+
"optional": true
|
|
220
|
+
},
|
|
221
|
+
"octane": {
|
|
222
|
+
"optional": true
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"devDependencies": {
|
|
226
|
+
"@modern-js/i18n-runtime-extensions": "npm:@bleedingdev/modern-js-i18n-runtime-extensions@3.9.3-ultramodern.10",
|
|
227
|
+
"@modern-js/tsconfig": "npm:@bleedingdev/modern-js-tsconfig@3.9.3-ultramodern.10",
|
|
228
|
+
"@octanejs/rspack-plugin": "https://github.com/BleedingDev/octane/releases/download/ultramodern-octane-2383d2ab1e70/octanejs-rspack-plugin-0.2.4.tgz",
|
|
229
|
+
"@octanejs/tanstack-router": "https://github.com/BleedingDev/octane/releases/download/ultramodern-octane-2383d2ab1e70/octanejs-tanstack-router-0.2.10.tgz",
|
|
230
|
+
"@rsbuild/core": "2.2.13",
|
|
231
|
+
"@rslib/core": "1.0.3",
|
|
232
|
+
"@scripts/rstest-config": "2.66.0",
|
|
233
|
+
"@tanstack/router-core": "https://github.com/BleedingDev/router/releases/download/ultramodern-router-core-585d3233f7f5/tanstack-router-core-1.171.38.tgz",
|
|
234
|
+
"@tsrx/oxc": "0.20.0",
|
|
235
|
+
"@types/jsdom": "27.0.0",
|
|
236
|
+
"@types/node": "^26.6.5",
|
|
237
|
+
"happy-dom": "^21.0.4",
|
|
238
|
+
"i18next": "26.4.6",
|
|
239
|
+
"jsdom": "30.0.1",
|
|
240
|
+
"octane": "https://github.com/BleedingDev/octane/releases/download/ultramodern-octane-2383d2ab1e70/octane-0.13.8.tgz",
|
|
241
|
+
"typescript": "7.0.2"
|
|
242
|
+
},
|
|
243
|
+
"sideEffects": false,
|
|
244
|
+
"publishConfig": {
|
|
245
|
+
"access": "public"
|
|
246
|
+
},
|
|
247
|
+
"ultramodern": {
|
|
248
|
+
"nativeArtifacts": {
|
|
249
|
+
"octane": {
|
|
250
|
+
"request": "https://github.com/BleedingDev/octane/releases/download/ultramodern-octane-2383d2ab1e70/octane-0.13.8.tgz",
|
|
251
|
+
"version": "0.13.8",
|
|
252
|
+
"integrity": "sha512-ryNxtzX4pwMVHNhWyEYG8VnpRUByWUDhtVDpYlQkeqipTSF7s8cP86CzBl/miNCruE48D27mnR7E8UW6V1fEnA=="
|
|
253
|
+
},
|
|
254
|
+
"@octanejs/tanstack-router": {
|
|
255
|
+
"request": "https://github.com/BleedingDev/octane/releases/download/ultramodern-octane-2383d2ab1e70/octanejs-tanstack-router-0.2.10.tgz",
|
|
256
|
+
"version": "0.2.10",
|
|
257
|
+
"integrity": "sha512-wdnPhVZSQqZg2DDllUyz4RZufn7I0GEnPKrb/CB21Z8JYKnunAtZn41Dma/+xhg5xvN/USnIg9Eyyf2nbJgxMQ=="
|
|
258
|
+
},
|
|
259
|
+
"@octanejs/rspack-plugin": {
|
|
260
|
+
"request": "https://github.com/BleedingDev/octane/releases/download/ultramodern-octane-2383d2ab1e70/octanejs-rspack-plugin-0.2.4.tgz",
|
|
261
|
+
"version": "0.2.4",
|
|
262
|
+
"integrity": "sha512-I8m/d/oj3Qh8nG5nqkWD90m8qgNwlPK9oNh5tlVvGNdSYCTLddRG7Og8wpYKFAGxe2D+0zOIhYGarC0ZKZgSzw=="
|
|
263
|
+
},
|
|
264
|
+
"@tanstack/router-core": {
|
|
265
|
+
"request": "https://github.com/BleedingDev/router/releases/download/ultramodern-router-core-585d3233f7f5/tanstack-router-core-1.171.38.tgz",
|
|
266
|
+
"version": "1.171.38",
|
|
267
|
+
"integrity": "sha512-d/aGvcyEVwDh2Cn9MuZM1n1dqTIqkFYi7AHY2Na/6x/a0jVSDVTNVVVY7QEsuKFXktaJF9zjVwetaRm/0MALZg=="
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
"sourceName": "@modern-js/renderer-octane"
|
|
271
|
+
},
|
|
272
|
+
"scripts": {
|
|
273
|
+
"build": "rslib build && tsc -p tsconfig.types.json",
|
|
274
|
+
"test": "rstest"
|
|
275
|
+
},
|
|
276
|
+
"homepage": "https://github.com/ultramodernjs/ultramodern.js#readme",
|
|
277
|
+
"bugs": {
|
|
278
|
+
"url": "https://github.com/ultramodernjs/ultramodern.js/issues"
|
|
279
|
+
}
|
|
280
|
+
}
|
package/src/bootstrap.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type DocumentBootstrap,
|
|
3
|
+
readDocumentBootstrap,
|
|
4
|
+
} from '@modern-js/renderer-core/document';
|
|
5
|
+
import {
|
|
6
|
+
type RendererIdentity,
|
|
7
|
+
readRendererIdentity,
|
|
8
|
+
} from '@modern-js/renderer-core/identity';
|
|
9
|
+
|
|
10
|
+
export interface OctaneDocumentBootstrap extends DocumentBootstrap {
|
|
11
|
+
/** Actual native client compilation hash, separate from application identity. */
|
|
12
|
+
readonly nativeHydrationBuildId: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function assertNativeHydrationBuildId(
|
|
16
|
+
value: unknown,
|
|
17
|
+
): asserts value is string {
|
|
18
|
+
if (typeof value !== 'string' || value.trim().length === 0) {
|
|
19
|
+
throw new Error(
|
|
20
|
+
'An Octane document requires its native client compilation identity.',
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function assertOctaneIdentity(identity: RendererIdentity): void {
|
|
26
|
+
readRendererIdentity(identity, identity);
|
|
27
|
+
if (identity.renderer !== 'octane') {
|
|
28
|
+
throw new Error(
|
|
29
|
+
'An Octane application requires an Octane renderer identity.',
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Read the server's bootstrap and require this exact native client build. */
|
|
35
|
+
export function readOctaneDocumentBootstrap(
|
|
36
|
+
document: Document,
|
|
37
|
+
expectedIdentity: RendererIdentity,
|
|
38
|
+
expectedNativeHydrationBuildId?: string,
|
|
39
|
+
): OctaneDocumentBootstrap {
|
|
40
|
+
assertOctaneIdentity(expectedIdentity);
|
|
41
|
+
const { identity, documentId, hydrating, nativeHydrationBuildId } =
|
|
42
|
+
readDocumentBootstrap(document, expectedIdentity, [
|
|
43
|
+
'nativeHydrationBuildId',
|
|
44
|
+
]);
|
|
45
|
+
assertNativeHydrationBuildId(nativeHydrationBuildId);
|
|
46
|
+
if (
|
|
47
|
+
expectedNativeHydrationBuildId !== undefined &&
|
|
48
|
+
nativeHydrationBuildId !== expectedNativeHydrationBuildId
|
|
49
|
+
) {
|
|
50
|
+
throw new Error(
|
|
51
|
+
'Octane hydration bytes belong to a different native client compilation.',
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
return Object.freeze({
|
|
55
|
+
identity,
|
|
56
|
+
documentId,
|
|
57
|
+
hydrating,
|
|
58
|
+
nativeHydrationBuildId,
|
|
59
|
+
});
|
|
60
|
+
}
|