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

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,405 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ prepareOctaneRouterSerialization: ()=>prepareOctaneRouterSerialization
32
+ });
33
+ const data_namespaceObject = require("@modern-js/renderer-core/data");
34
+ const session_namespaceObject = require("@modern-js/renderer-core/session");
35
+ const tanstack_router_namespaceObject = require("@octanejs/tanstack-router");
36
+ const external_router_server_cleanup_js_namespaceObject = require("./router-server-cleanup.js");
37
+ const external_router_snapshot_js_namespaceObject = require("./router-snapshot.js");
38
+ const external_routes_js_namespaceObject = require("./routes.js");
39
+ const ERROR_FIELDS = new Set([
40
+ 'name',
41
+ 'message',
42
+ 'stack',
43
+ 'cause'
44
+ ]);
45
+ const ROUTE_ERROR_FIELDS = new Set([
46
+ ...ERROR_FIELDS,
47
+ 'routeId',
48
+ 'status',
49
+ 'data'
50
+ ]);
51
+ const errorConstructors = new Map([
52
+ [
53
+ Error.prototype,
54
+ Error
55
+ ],
56
+ [
57
+ TypeError.prototype,
58
+ TypeError
59
+ ],
60
+ [
61
+ RangeError.prototype,
62
+ RangeError
63
+ ],
64
+ [
65
+ SyntaxError.prototype,
66
+ SyntaxError
67
+ ],
68
+ [
69
+ ReferenceError.prototype,
70
+ ReferenceError
71
+ ],
72
+ [
73
+ URIError.prototype,
74
+ URIError
75
+ ],
76
+ [
77
+ EvalError.prototype,
78
+ EvalError
79
+ ]
80
+ ]);
81
+ const owners = new WeakMap();
82
+ function prepareOctaneRouterSerialization(router, session, options = {}) {
83
+ session.signal.throwIfAborted();
84
+ if (owners.has(router)) throw (0, external_router_snapshot_js_namespaceObject.invalid)('a router already has a request serialization owner');
85
+ const adapterProperty = Object.getOwnPropertyDescriptor(router.options, 'serializationAdapters');
86
+ const dehydrateProperty = Object.getOwnPropertyDescriptor(router.options, 'dehydrate');
87
+ if (adapterProperty?.get || adapterProperty?.set || dehydrateProperty?.get || dehydrateProperty?.set) throw (0, external_router_snapshot_js_namespaceObject.invalid)('native serializer options must be owned data properties');
88
+ const consumerAdapters = adapterProperty?.value ?? [];
89
+ if (!Array.isArray(consumerAdapters) || Object.getPrototypeOf(consumerAdapters) !== Array.prototype) throw (0, external_router_snapshot_js_namespaceObject.invalid)('native serializationAdapters must be an owned array');
90
+ const adapterFields = (0, external_router_snapshot_js_namespaceObject.descriptors)(consumerAdapters);
91
+ if (consumerAdapters.length > 1 || 1 === consumerAdapters.length && adapterFields['0']?.value !== external_router_snapshot_js_namespaceObject.octaneRouterSnapshotAdapter || Object.keys(adapterFields).length !== consumerAdapters.length + 1) throw (0, external_router_snapshot_js_namespaceObject.invalid)('custom serializationAdapters are not admitted in framework SSR; return supported public data');
92
+ const consumerDehydrate = dehydrateProperty?.value;
93
+ if (void 0 !== consumerDehydrate && 'function' != typeof consumerDehydrate) throw (0, external_router_snapshot_js_namespaceObject.invalid)('native dehydrate must be an owned function');
94
+ owners.set(router, session);
95
+ const production = options.production ?? 'production' === process.env['NODE_ENV'];
96
+ const policy = (0, data_namespaceObject.createRequestDataPolicy)([
97
+ session,
98
+ session.request,
99
+ session.platform,
100
+ session.platform.bindings,
101
+ ...options.forbiddenValues ?? []
102
+ ]);
103
+ const copies = new WeakMap();
104
+ const projectedRoots = new WeakSet();
105
+ let nativeRoot;
106
+ let released = false;
107
+ let failure;
108
+ const fail = (error)=>{
109
+ failure ??= error;
110
+ session.fail(failure);
111
+ (0, external_router_server_cleanup_js_namespaceObject.cleanupOctaneRouterSSR)(router);
112
+ throw failure;
113
+ };
114
+ const assertActive = ()=>{
115
+ if (void 0 !== failure) throw failure;
116
+ session.signal.throwIfAborted();
117
+ };
118
+ function copyPublic(value) {
119
+ policy.assertValue(value);
120
+ return copyValue(value);
121
+ }
122
+ function copyValue(value) {
123
+ if (null === value || 'object' != typeof value) return value;
124
+ const fields = (0, external_router_snapshot_js_namespaceObject.descriptors)(value);
125
+ const previous = copies.get(value);
126
+ if (previous) return previous;
127
+ const prototype = Object.getPrototypeOf(value);
128
+ let result;
129
+ if (prototype === Date.prototype) result = new Date(Date.prototype.valueOf.call(value));
130
+ else if (prototype === RegExp.prototype) {
131
+ const source = Object.getOwnPropertyDescriptor(RegExp.prototype, 'source').get.call(value);
132
+ const flags = [
133
+ 'hasIndices',
134
+ 'global',
135
+ 'ignoreCase',
136
+ 'multiline',
137
+ 'dotAll',
138
+ 'unicode',
139
+ 'unicodeSets',
140
+ 'sticky'
141
+ ];
142
+ const letters = [
143
+ 'd',
144
+ 'g',
145
+ 'i',
146
+ 'm',
147
+ 's',
148
+ 'u',
149
+ 'v',
150
+ 'y'
151
+ ];
152
+ const enabled = flags.map((flag, index)=>Object.getOwnPropertyDescriptor(RegExp.prototype, flag)?.get?.call(value) ? letters[index] : '').join('');
153
+ result = new RegExp(source, enabled);
154
+ } else result = prototype === Map.prototype ? new Map() : prototype === Set.prototype ? new Set() : Array.isArray(value) ? [] : Object.create(prototype);
155
+ copies.set(value, result);
156
+ if (prototype === Map.prototype) for (const [key, item] of Map.prototype.entries.call(value))Map.prototype.set.call(result, copyValue(key), copyValue(item));
157
+ else if (prototype === Set.prototype) for (const item of Set.prototype.values.call(value))Set.prototype.add.call(result, copyValue(item));
158
+ for (const [key, field] of Object.entries(fields))if (!Array.isArray(value) || 'length' !== key) Object.defineProperty(result, key, {
159
+ ...field,
160
+ value: copyValue(field.value)
161
+ });
162
+ if (Array.isArray(value)) Object.defineProperty(result, 'length', fields['length']);
163
+ if (!Object.isExtensible(value)) Object.preventExtensions(result);
164
+ return result;
165
+ }
166
+ function copyError(value) {
167
+ if (null === value || 'object' != typeof value) return copyPublic(value);
168
+ policy.assertRoot(value);
169
+ const prototype = Object.getPrototypeOf(value);
170
+ const routeError = prototype === external_routes_js_namespaceObject.RouteDataError.prototype;
171
+ const Constructor = errorConstructors.get(prototype);
172
+ if (!routeError && !Constructor) return copyPublic(value);
173
+ const fields = (0, external_router_snapshot_js_namespaceObject.descriptors)(value, routeError ? ROUTE_ERROR_FIELDS : ERROR_FIELDS, true);
174
+ if ('[object Error]' !== Object.prototype.toString.call(value)) throw (0, external_router_snapshot_js_namespaceObject.invalid)('an error requires genuine native Error slots');
175
+ const name = fields['name'] ? (0, external_router_snapshot_js_namespaceObject.stringField)(fields, 'name') : routeError ? 'Error' : Constructor.name;
176
+ const message = fields['message'] ? (0, external_router_snapshot_js_namespaceObject.stringField)(fields, 'message') : '';
177
+ const stack = production ? void 0 : fields['stack']?.value;
178
+ if (void 0 !== stack && 'string' != typeof stack) throw (0, external_router_snapshot_js_namespaceObject.invalid)('stack must be a data string');
179
+ const cause = fields['cause'] ? copyPublic(fields['cause'].value) : void 0;
180
+ const projectedData = routeError ? copyPublic(fields['data']?.value) : void 0;
181
+ const previous = copies.get(value);
182
+ if (previous) return previous;
183
+ if (routeError) {
184
+ const routeId = (0, external_router_snapshot_js_namespaceObject.stringField)(fields, 'routeId');
185
+ const status = fields['status']?.value;
186
+ if (!routeId || !Number.isInteger(status) || status < 400 || status > 599) throw (0, external_router_snapshot_js_namespaceObject.invalid)('a route error has invalid identity or status');
187
+ const result = {
188
+ kind: external_router_snapshot_js_namespaceObject.ROUTE_ERROR_KIND,
189
+ routeId,
190
+ status,
191
+ name,
192
+ message,
193
+ data: projectedData,
194
+ ...void 0 === stack ? {} : {
195
+ stack
196
+ },
197
+ ...fields['cause'] ? {
198
+ cause
199
+ } : {}
200
+ };
201
+ copies.set(value, result);
202
+ return result;
203
+ }
204
+ const publicError = production ? (0, data_namespaceObject.publicDataError)(value, true) : {
205
+ name,
206
+ message
207
+ };
208
+ const result = {
209
+ kind: external_router_snapshot_js_namespaceObject.NATIVE_ERROR_KIND,
210
+ type: production ? 'Error' : Constructor.name,
211
+ name: publicError.name,
212
+ message: publicError.message,
213
+ ...void 0 === stack ? {} : {
214
+ stack
215
+ },
216
+ ...!production && fields['cause'] ? {
217
+ cause
218
+ } : {}
219
+ };
220
+ copies.set(value, result);
221
+ return result;
222
+ }
223
+ function copyPromise(value) {
224
+ policy.assertRoot(value);
225
+ if (Reflect.ownKeys(value).length > 0) throw (0, external_router_snapshot_js_namespaceObject.invalid)('deferred values require native Promises without own fields');
226
+ const previous = copies.get(value);
227
+ if (previous) return previous;
228
+ const checked = Promise.prototype.then.call(value, (settled)=>{
229
+ try {
230
+ if (released || session.signal.aborted) throw (0, external_router_snapshot_js_namespaceObject.invalid)('the request serialization owner was released');
231
+ policy.assertRoot(value);
232
+ return copyPublic(settled);
233
+ } catch (error) {
234
+ return fail(error);
235
+ }
236
+ }, (reason)=>{
237
+ if (released || session.signal.aborted) throw (0, external_router_snapshot_js_namespaceObject.invalid)('the request serialization owner was released');
238
+ let projected;
239
+ try {
240
+ policy.assertRoot(value);
241
+ projected = copyError(reason);
242
+ } catch (error) {
243
+ return fail(error);
244
+ }
245
+ throw projected;
246
+ });
247
+ copies.set(value, checked);
248
+ Promise.prototype.then.call(checked, void 0, ()=>{});
249
+ return checked;
250
+ }
251
+ function copyLoader(value) {
252
+ if ((0, external_router_snapshot_js_namespaceObject.nativePromise)(value)) return copyPromise(value);
253
+ if (!(0, external_router_snapshot_js_namespaceObject.record)(value)) return copyPublic(value);
254
+ policy.assertRoot(value);
255
+ const fields = (0, external_router_snapshot_js_namespaceObject.descriptors)(value);
256
+ if (!Object.values(fields).some((field)=>(0, external_router_snapshot_js_namespaceObject.nativePromise)(field.value))) return copyPublic(value);
257
+ const previous = copies.get(value);
258
+ if (previous) return previous;
259
+ const result = Object.create(Object.getPrototypeOf(value));
260
+ copies.set(value, result);
261
+ for (const [key, field] of Object.entries(fields))Object.defineProperty(result, key, {
262
+ ...field,
263
+ value: (0, external_router_snapshot_js_namespaceObject.nativePromise)(field.value) ? copyPromise(field.value) : copyPublic(field.value)
264
+ });
265
+ if (!Object.isExtensible(value)) Object.preventExtensions(result);
266
+ return result;
267
+ }
268
+ function projectRoot(value) {
269
+ assertActive();
270
+ assertMatches();
271
+ if (!(0, external_router_snapshot_js_namespaceObject.record)(value) || Object.getPrototypeOf(value) !== Object.prototype) throw (0, external_router_snapshot_js_namespaceObject.invalid)('the first native serializer value must be its fresh outer record');
272
+ const fields = (0, external_router_snapshot_js_namespaceObject.descriptors)(value, external_router_snapshot_js_namespaceObject.NATIVE_ROOT_FIELDS);
273
+ const matches = fields['matches']?.value;
274
+ if (!fields['manifest'] || !Array.isArray(matches)) throw (0, external_router_snapshot_js_namespaceObject.invalid)('the native outer record shape changed');
275
+ const arrayFields = (0, external_router_snapshot_js_namespaceObject.descriptors)(matches);
276
+ const projectedMatches = [];
277
+ for(let index = 0; index < matches.length; index++){
278
+ const match = arrayFields[String(index)]?.value;
279
+ if (!(0, external_router_snapshot_js_namespaceObject.record)(match)) throw (0, external_router_snapshot_js_namespaceObject.invalid)('native matches must be dense records');
280
+ const matchFields = (0, external_router_snapshot_js_namespaceObject.descriptors)(match, external_router_snapshot_js_namespaceObject.MATCH_FIELDS);
281
+ const projected = {};
282
+ const id = (0, external_router_snapshot_js_namespaceObject.stringField)(matchFields, 'i');
283
+ const status = (0, external_router_snapshot_js_namespaceObject.stringField)(matchFields, 's');
284
+ const updatedAt = matchFields['u']?.value;
285
+ if (!id || 'number' != typeof updatedAt || !Number.isFinite(updatedAt)) throw (0, external_router_snapshot_js_namespaceObject.invalid)('native match metadata changed');
286
+ if (![
287
+ 'pending',
288
+ 'success',
289
+ 'error',
290
+ 'notFound',
291
+ 'redirected'
292
+ ].includes(status)) throw (0, external_router_snapshot_js_namespaceObject.invalid)('native match status changed');
293
+ projected['i'] = id;
294
+ projected['u'] = updatedAt;
295
+ projected['s'] = status;
296
+ for (const [key, field] of Object.entries(matchFields))if ('i' !== key && 'u' !== key && 's' !== key) projected[key] = 'l' === key ? copyLoader(field.value) : 'e' === key ? copyError(field.value) : copyPublic(field.value);
297
+ projectedMatches.push(projected);
298
+ }
299
+ const result = {
300
+ manifest: copyPublic(fields['manifest'].value),
301
+ matches: projectedMatches
302
+ };
303
+ if (fields['lastMatchId']) result['lastMatchId'] = (0, external_router_snapshot_js_namespaceObject.stringField)(fields, 'lastMatchId');
304
+ if (fields['dehydratedData']) result['dehydratedData'] = copyPublic(fields['dehydratedData'].value);
305
+ projectedRoots.add(result);
306
+ return result;
307
+ }
308
+ const adapter = Object.freeze((0, tanstack_router_namespaceObject.createSerializationAdapter)({
309
+ key: external_router_snapshot_js_namespaceObject.ADAPTER_KEY,
310
+ test (value) {
311
+ if (null === value || 'object' != typeof value || projectedRoots.has(value)) return false;
312
+ if (nativeRoot) return false;
313
+ nativeRoot = value;
314
+ return true;
315
+ },
316
+ toSerializable (value) {
317
+ try {
318
+ return projectRoot(value);
319
+ } catch (error) {
320
+ return fail(error);
321
+ }
322
+ },
323
+ fromSerializable: external_router_snapshot_js_namespaceObject.octaneRouterSnapshotAdapter.fromSerializable
324
+ }));
325
+ const adapters = Object.freeze([
326
+ adapter
327
+ ]);
328
+ const wrappedDehydrate = async ()=>{
329
+ try {
330
+ assertMatches();
331
+ const result = 'function' == typeof consumerDehydrate ? await (0, session_namespaceObject.untilAborted)(Reflect.apply(consumerDehydrate, router.options, []), session.signal) : void 0;
332
+ assertMatches();
333
+ return result;
334
+ } catch (error) {
335
+ return fail(error);
336
+ }
337
+ };
338
+ const nativeOptions = {
339
+ ...router.options,
340
+ serializationAdapters: adapters,
341
+ dehydrate: wrappedDehydrate
342
+ };
343
+ router.update(nativeOptions);
344
+ session.registerCleanup(()=>{
345
+ released = true;
346
+ (0, external_router_server_cleanup_js_namespaceObject.cleanupOctaneRouterSSR)(router);
347
+ });
348
+ function assertMatches() {
349
+ try {
350
+ assertActive();
351
+ const currentAdapters = Object.getOwnPropertyDescriptor(router.options, 'serializationAdapters');
352
+ const currentDehydrate = Object.getOwnPropertyDescriptor(router.options, 'dehydrate');
353
+ if (currentAdapters?.get || currentAdapters?.set || currentAdapters?.value !== adapters || currentDehydrate?.get || currentDehydrate?.set || currentDehydrate?.value !== wrappedDehydrate) throw (0, external_router_snapshot_js_namespaceObject.invalid)('the request serializer owner was replaced');
354
+ for (const match of router.stores.matches.get()){
355
+ const prototype = Object.getPrototypeOf(match);
356
+ if (prototype !== Object.prototype && null !== prototype) throw (0, external_router_snapshot_js_namespaceObject.invalid)('native matches require owned plain records');
357
+ for (const key of [
358
+ 'id',
359
+ 'routeId',
360
+ 'updatedAt',
361
+ 'status',
362
+ '__beforeLoadContext',
363
+ 'loaderData',
364
+ 'error',
365
+ 'ssr',
366
+ 'globalNotFound',
367
+ 'styles',
368
+ 'headScripts'
369
+ ]){
370
+ const field = Object.getOwnPropertyDescriptor(match, key);
371
+ if (field?.get || field?.set) throw (0, external_router_snapshot_js_namespaceObject.invalid)('native match fields must be owned values before dehydrate');
372
+ if (!field && prototype && Object.getOwnPropertyDescriptor(prototype, key)) throw (0, external_router_snapshot_js_namespaceObject.invalid)('native match fields cannot be inherited');
373
+ if (('id' === key || 'routeId' === key) && ('string' != typeof field?.value || !field.value)) throw (0, external_router_snapshot_js_namespaceObject.invalid)('native match identity must be an owned nonempty string');
374
+ if ('updatedAt' === key && ('number' != typeof field?.value || !Number.isFinite(field.value))) throw (0, external_router_snapshot_js_namespaceObject.invalid)('native updatedAt must be an owned finite number');
375
+ if ('status' === key && ('string' != typeof field?.value || ![
376
+ 'pending',
377
+ 'success',
378
+ 'error',
379
+ 'notFound',
380
+ 'redirected'
381
+ ].includes(field.value))) throw (0, external_router_snapshot_js_namespaceObject.invalid)('native status must be an owned supported string');
382
+ if (('styles' === key || 'headScripts' === key) && field?.value !== void 0) {
383
+ const value = field.value;
384
+ if (!Array.isArray(value) || Object.getPrototypeOf(value) !== Array.prototype) throw (0, external_router_snapshot_js_namespaceObject.invalid)('native styles/headScripts are not admitted by the fragment host');
385
+ const fields = (0, external_router_snapshot_js_namespaceObject.descriptors)(value);
386
+ if (fields['length']?.value !== 0 || 1 !== Reflect.ownKeys(value).length) throw (0, external_router_snapshot_js_namespaceObject.invalid)('native styles/headScripts are not admitted by the fragment host');
387
+ }
388
+ }
389
+ }
390
+ } catch (error) {
391
+ fail(error);
392
+ }
393
+ }
394
+ return {
395
+ assertActive,
396
+ assertMatches
397
+ };
398
+ }
399
+ exports.prepareOctaneRouterSerialization = __webpack_exports__.prepareOctaneRouterSerialization;
400
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
401
+ "prepareOctaneRouterSerialization"
402
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
403
+ Object.defineProperty(exports, '__esModule', {
404
+ value: true
405
+ });
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ var __webpack_modules__ = {
3
+ "./router-handler" (module) {
4
+ module.exports = require("./router-handler.js");
5
+ },
6
+ "./router-injection" (module) {
7
+ module.exports = require("./router-injection.js");
8
+ },
9
+ "./router-server-snapshot" (module) {
10
+ module.exports = require("./router-server-snapshot.js");
11
+ },
12
+ "@octanejs/tanstack-router" (module) {
13
+ module.exports = require("@octanejs/tanstack-router");
14
+ },
15
+ "@octanejs/tanstack-router/ssr/server" (module) {
16
+ module.exports = require("@octanejs/tanstack-router/ssr/server");
17
+ },
18
+ "octane/server" (module) {
19
+ module.exports = require("octane/server");
20
+ }
21
+ };
22
+ var __webpack_module_cache__ = {};
23
+ function __webpack_require__(moduleId) {
24
+ var cachedModule = __webpack_module_cache__[moduleId];
25
+ if (void 0 !== cachedModule) return cachedModule.exports;
26
+ var module = __webpack_module_cache__[moduleId] = {
27
+ exports: {}
28
+ };
29
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
30
+ return module.exports;
31
+ }
32
+ (()=>{
33
+ __webpack_require__.n = (module)=>{
34
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
35
+ __webpack_require__.d(getter, {
36
+ a: getter
37
+ });
38
+ return getter;
39
+ };
40
+ })();
41
+ (()=>{
42
+ __webpack_require__.d = (exports1, getters, values)=>{
43
+ var define = (defs, kind)=>{
44
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
45
+ enumerable: true,
46
+ [kind]: defs[key]
47
+ });
48
+ };
49
+ define(getters, "get");
50
+ define(values, "value");
51
+ };
52
+ })();
53
+ (()=>{
54
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
55
+ })();
56
+ (()=>{
57
+ __webpack_require__.r = (exports1)=>{
58
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
59
+ value: 'Module'
60
+ });
61
+ Object.defineProperty(exports1, '__esModule', {
62
+ value: true
63
+ });
64
+ };
65
+ })();
66
+ var __webpack_exports__ = {};
67
+ (()=>{
68
+ __webpack_require__.r(__webpack_exports__);
69
+ var _octanejs_tanstack_router__rspack_import_0 = __webpack_require__("@octanejs/tanstack-router");
70
+ var octane_server__rspack_import_1 = __webpack_require__("octane/server");
71
+ var _octanejs_tanstack_router_ssr_server__rspack_import_2 = __webpack_require__("@octanejs/tanstack-router/ssr/server");
72
+ var __rspack_reexport = {};
73
+ for(const __rspack_import_key in _octanejs_tanstack_router_ssr_server__rspack_import_2)if ([
74
+ "createOctaneRequestHandler",
75
+ "prepareOctaneRouterSerialization",
76
+ "default",
77
+ "OctaneRouterServer",
78
+ "createOctaneRouterInjection"
79
+ ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_octanejs_tanstack_router_ssr_server__rspack_import_2[__rspack_import_key];
80
+ __webpack_require__.d(__webpack_exports__, __rspack_reexport);
81
+ var _router_handler__rspack_import_3 = __webpack_require__("./router-handler");
82
+ var _router_injection__rspack_import_4 = __webpack_require__("./router-injection");
83
+ var _router_server_snapshot__rspack_import_5 = __webpack_require__("./router-server-snapshot");
84
+ function OctaneRouterServer({ router }) {
85
+ return (0, octane_server__rspack_import_1.createElement)(_octanejs_tanstack_router__rspack_import_0.RouterProvider, {
86
+ router
87
+ });
88
+ }
89
+ __webpack_require__.d(__webpack_exports__, {
90
+ OctaneRouterServer: ()=>OctaneRouterServer,
91
+ createOctaneRequestHandler: ()=>_router_handler__rspack_import_3.createOctaneRequestHandler,
92
+ createOctaneRouterInjection: ()=>_router_injection__rspack_import_4.createOctaneRouterInjection,
93
+ prepareOctaneRouterSerialization: ()=>_router_server_snapshot__rspack_import_5.prepareOctaneRouterSerialization
94
+ });
95
+ })();
96
+ exports.OctaneRouterServer = __webpack_exports__.OctaneRouterServer;
97
+ exports.createOctaneRequestHandler = __webpack_exports__.createOctaneRequestHandler;
98
+ exports.createOctaneRouterInjection = __webpack_exports__.createOctaneRouterInjection;
99
+ exports.prepareOctaneRouterSerialization = __webpack_exports__.prepareOctaneRouterSerialization;
100
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
101
+ "OctaneRouterServer",
102
+ "createOctaneRequestHandler",
103
+ "createOctaneRouterInjection",
104
+ "prepareOctaneRouterSerialization"
105
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
106
+ Object.defineProperty(exports, '__esModule', {
107
+ value: true
108
+ });