@bleedingdev/modern-js-renderer-core 0.0.0-bootstrap → 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.
- package/LICENSE +21 -0
- package/dist/cjs/abort.js +65 -0
- package/dist/cjs/adapter.js +62 -0
- package/dist/cjs/data/body.js +78 -0
- package/dist/cjs/data/client.js +409 -0
- package/dist/cjs/data/codec.js +168 -0
- package/dist/cjs/data/index.js +125 -0
- package/dist/cjs/data/private.js +77 -0
- package/dist/cjs/data/routes.js +149 -0
- package/dist/cjs/data/server.js +791 -0
- package/dist/cjs/data/static.js +110 -0
- package/dist/cjs/data/tree.js +231 -0
- package/dist/cjs/data/types.js +56 -0
- package/dist/cjs/document.js +184 -0
- package/dist/cjs/entry-client.js +142 -0
- package/dist/cjs/entry-server.js +253 -0
- package/dist/cjs/federation.js +80 -0
- package/dist/cjs/identity.js +120 -0
- package/dist/cjs/index.js +46 -0
- package/dist/cjs/localization.js +48 -0
- package/dist/cjs/router.js +293 -0
- package/dist/cjs/server/assets.js +56 -0
- package/dist/cjs/server/dispatch.js +351 -0
- package/dist/cjs/server/index.js +57 -0
- package/dist/cjs/server/types.js +18 -0
- package/dist/cjs/server/worker.js +73 -0
- package/dist/cjs/session/cache.js +172 -0
- package/dist/cjs/session/index.js +63 -0
- package/dist/cjs/session/request.js +269 -0
- package/dist/cjs/session/types.js +18 -0
- package/dist/esm/abort.mjs +27 -0
- package/dist/esm/adapter.mjs +21 -0
- package/dist/esm/data/body.mjs +40 -0
- package/dist/esm/data/client.mjs +368 -0
- package/dist/esm/data/codec.mjs +112 -0
- package/dist/esm/data/index.mjs +7 -0
- package/dist/esm/data/private.mjs +39 -0
- package/dist/esm/data/routes.mjs +108 -0
- package/dist/esm/data/server.mjs +723 -0
- package/dist/esm/data/static.mjs +51 -0
- package/dist/esm/data/tree.mjs +193 -0
- package/dist/esm/data/types.mjs +6 -0
- package/dist/esm/document.mjs +131 -0
- package/dist/esm/entry-client.mjs +104 -0
- package/dist/esm/entry-server.mjs +215 -0
- package/dist/esm/federation.mjs +36 -0
- package/dist/esm/identity.mjs +63 -0
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/localization.mjs +10 -0
- package/dist/esm/router.mjs +225 -0
- package/dist/esm/server/assets.mjs +15 -0
- package/dist/esm/server/dispatch.mjs +307 -0
- package/dist/esm/server/index.mjs +3 -0
- package/dist/esm/server/types.mjs +0 -0
- package/dist/esm/server/worker.mjs +35 -0
- package/dist/esm/session/cache.mjs +116 -0
- package/dist/esm/session/index.mjs +3 -0
- package/dist/esm/session/request.mjs +231 -0
- package/dist/esm/session/types.mjs +0 -0
- package/dist/esm-node/abort.mjs +28 -0
- package/dist/esm-node/adapter.mjs +22 -0
- package/dist/esm-node/data/body.mjs +41 -0
- package/dist/esm-node/data/client.mjs +369 -0
- package/dist/esm-node/data/codec.mjs +113 -0
- package/dist/esm-node/data/index.mjs +8 -0
- package/dist/esm-node/data/private.mjs +40 -0
- package/dist/esm-node/data/routes.mjs +109 -0
- package/dist/esm-node/data/server.mjs +724 -0
- package/dist/esm-node/data/static.mjs +52 -0
- package/dist/esm-node/data/tree.mjs +194 -0
- package/dist/esm-node/data/types.mjs +7 -0
- package/dist/esm-node/document.mjs +132 -0
- package/dist/esm-node/entry-client.mjs +105 -0
- package/dist/esm-node/entry-server.mjs +216 -0
- package/dist/esm-node/federation.mjs +37 -0
- package/dist/esm-node/identity.mjs +64 -0
- package/dist/esm-node/index.mjs +2 -0
- package/dist/esm-node/localization.mjs +11 -0
- package/dist/esm-node/router.mjs +226 -0
- package/dist/esm-node/server/assets.mjs +16 -0
- package/dist/esm-node/server/dispatch.mjs +308 -0
- package/dist/esm-node/server/index.mjs +4 -0
- package/dist/esm-node/server/types.mjs +1 -0
- package/dist/esm-node/server/worker.mjs +36 -0
- package/dist/esm-node/session/cache.mjs +117 -0
- package/dist/esm-node/session/index.mjs +4 -0
- package/dist/esm-node/session/request.mjs +232 -0
- package/dist/esm-node/session/types.mjs +1 -0
- package/dist/types/abort.d.ts +6 -0
- package/dist/types/adapter.d.ts +195 -0
- package/dist/types/data/body.d.ts +2 -0
- package/dist/types/data/client.d.ts +17 -0
- package/dist/types/data/codec.d.ts +14 -0
- package/dist/types/data/index.d.ts +8 -0
- package/dist/types/data/private.d.ts +6 -0
- package/dist/types/data/routes.d.ts +28 -0
- package/dist/types/data/server.d.ts +59 -0
- package/dist/types/data/static.d.ts +31 -0
- package/dist/types/data/tree.d.ts +3 -0
- package/dist/types/data/types.d.ts +104 -0
- package/dist/types/document.d.ts +76 -0
- package/dist/types/entry-client.d.ts +53 -0
- package/dist/types/entry-server.d.ts +63 -0
- package/dist/types/federation.d.ts +56 -0
- package/dist/types/identity.d.ts +27 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/localization.d.ts +58 -0
- package/dist/types/router.d.ts +201 -0
- package/dist/types/server/assets.d.ts +14 -0
- package/dist/types/server/dispatch.d.ts +11 -0
- package/dist/types/server/index.d.ts +4 -0
- package/dist/types/server/types.d.ts +64 -0
- package/dist/types/server/worker.d.ts +25 -0
- package/dist/types/session/cache.d.ts +25 -0
- package/dist/types/session/index.d.ts +4 -0
- package/dist/types/session/request.d.ts +8 -0
- package/dist/types/session/types.d.ts +48 -0
- package/package.json +159 -4
- package/src/abort.ts +40 -0
- package/src/adapter.ts +255 -0
- package/src/data/body.ts +43 -0
- package/src/data/client.ts +501 -0
- package/src/data/codec.ts +247 -0
- package/src/data/index.ts +8 -0
- package/src/data/private.ts +68 -0
- package/src/data/routes.ts +201 -0
- package/src/data/server.ts +977 -0
- package/src/data/static.ts +105 -0
- package/src/data/tree.ts +244 -0
- package/src/data/types.ts +98 -0
- package/src/document.ts +338 -0
- package/src/entry-client.ts +236 -0
- package/src/entry-server.ts +393 -0
- package/src/federation.ts +111 -0
- package/src/identity.ts +128 -0
- package/src/index.ts +7 -0
- package/src/localization.ts +77 -0
- package/src/router.ts +475 -0
- package/src/server/assets.ts +60 -0
- package/src/server/dispatch.ts +523 -0
- package/src/server/index.ts +16 -0
- package/src/server/types.ts +94 -0
- package/src/server/worker.ts +94 -0
- package/src/session/cache.ts +177 -0
- package/src/session/index.ts +11 -0
- package/src/session/request.ts +324 -0
- package/src/session/types.ts +60 -0
|
@@ -0,0 +1,791 @@
|
|
|
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
|
+
collectDataHeaders: ()=>cache_js_namespaceObject.responseHeaders,
|
|
32
|
+
createDataResponse: ()=>createDataResponse,
|
|
33
|
+
dataMetadataToDocumentPolicy: ()=>dataMetadataToDocumentPolicy,
|
|
34
|
+
deferData: ()=>deferData,
|
|
35
|
+
handleDataRequest: ()=>handleDataRequest,
|
|
36
|
+
invokeRouteData: ()=>invokeRouteData,
|
|
37
|
+
mergeDataResponseIntoResponse: ()=>mergeDataResponseIntoResponse,
|
|
38
|
+
mergeDataResponseMetadata: ()=>mergeDataResponseMetadata,
|
|
39
|
+
mergeHeaderFields: ()=>mergeHeaderFields,
|
|
40
|
+
normalizeDataResult: ()=>normalizeDataResult,
|
|
41
|
+
publicDataError: ()=>publicDataError
|
|
42
|
+
});
|
|
43
|
+
const external_abort_js_namespaceObject = require("../abort.js");
|
|
44
|
+
const external_identity_js_namespaceObject = require("../identity.js");
|
|
45
|
+
const cache_js_namespaceObject = require("../session/cache.js");
|
|
46
|
+
const external_body_js_namespaceObject = require("./body.js");
|
|
47
|
+
const external_codec_js_namespaceObject = require("./codec.js");
|
|
48
|
+
const external_private_js_namespaceObject = require("./private.js");
|
|
49
|
+
const external_types_js_namespaceObject = require("./types.js");
|
|
50
|
+
const DEFERRED = Symbol('ultramodern.data.deferred');
|
|
51
|
+
const REDIRECT_STATUSES = new Set([
|
|
52
|
+
301,
|
|
53
|
+
302,
|
|
54
|
+
303,
|
|
55
|
+
307,
|
|
56
|
+
308
|
|
57
|
+
]);
|
|
58
|
+
const BODYLESS_STATUSES = new Set([
|
|
59
|
+
204,
|
|
60
|
+
205,
|
|
61
|
+
304
|
|
62
|
+
]);
|
|
63
|
+
const REPRESENTATION_HEADERS = new Set([
|
|
64
|
+
'content-type',
|
|
65
|
+
'content-length',
|
|
66
|
+
'content-encoding',
|
|
67
|
+
'content-digest',
|
|
68
|
+
'repr-digest',
|
|
69
|
+
'digest',
|
|
70
|
+
'transfer-encoding',
|
|
71
|
+
'content-range',
|
|
72
|
+
'accept-ranges',
|
|
73
|
+
'content-disposition',
|
|
74
|
+
'content-language',
|
|
75
|
+
'content-location',
|
|
76
|
+
'etag',
|
|
77
|
+
'last-modified',
|
|
78
|
+
'location'
|
|
79
|
+
]);
|
|
80
|
+
function mergeHeaderFields(primary, secondary) {
|
|
81
|
+
const primaryNames = new Set(primary.map(([name])=>name.toLowerCase()));
|
|
82
|
+
return [
|
|
83
|
+
...primary.map(([name, value])=>[
|
|
84
|
+
name,
|
|
85
|
+
value
|
|
86
|
+
]),
|
|
87
|
+
...secondary.filter(([name])=>ACCUMULATED_HEADERS.has(name.toLowerCase()) || !primaryNames.has(name.toLowerCase())).map(([name, value])=>[
|
|
88
|
+
name,
|
|
89
|
+
value
|
|
90
|
+
])
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
const HOP_BY_HOP_HEADERS = new Set([
|
|
94
|
+
'connection',
|
|
95
|
+
'keep-alive',
|
|
96
|
+
'proxy-connection',
|
|
97
|
+
'te',
|
|
98
|
+
'trailer',
|
|
99
|
+
'upgrade'
|
|
100
|
+
]);
|
|
101
|
+
function projectedHeaderFilter(headers) {
|
|
102
|
+
const stripped = new Set([
|
|
103
|
+
...REPRESENTATION_HEADERS,
|
|
104
|
+
...HOP_BY_HOP_HEADERS
|
|
105
|
+
]);
|
|
106
|
+
for (const [name, value] of headers)if ('connection' === name.toLowerCase()) {
|
|
107
|
+
for (const field of value.split(','))if (field.trim()) stripped.add(field.trim().toLowerCase());
|
|
108
|
+
}
|
|
109
|
+
return (name)=>!stripped.has(name.toLowerCase());
|
|
110
|
+
}
|
|
111
|
+
const outcomePolicies = new WeakMap();
|
|
112
|
+
function deferData(critical, deferred, init) {
|
|
113
|
+
for (const record of [
|
|
114
|
+
critical,
|
|
115
|
+
deferred
|
|
116
|
+
]){
|
|
117
|
+
if (null === record || 'object' != typeof record || Object.getPrototypeOf(record) !== Object.prototype && null !== Object.getPrototypeOf(record)) throw new external_codec_js_namespaceObject.DataProtocolError('Deferred data requires plain critical and deferred records');
|
|
118
|
+
for (const key of Reflect.ownKeys(record)){
|
|
119
|
+
const descriptor = Object.getOwnPropertyDescriptor(record, key);
|
|
120
|
+
if (descriptor.get || descriptor.set) throw new external_codec_js_namespaceObject.DataProtocolError('Deferred data must not contain accessors');
|
|
121
|
+
if ('symbol' == typeof key || !descriptor.enumerable) throw new external_codec_js_namespaceObject.DataProtocolError('Deferred data keys must be enumerable strings');
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
(0, external_codec_js_namespaceObject.assertPublicData)(critical);
|
|
125
|
+
for (const [key, promise] of Object.entries(deferred)){
|
|
126
|
+
if (Object.hasOwn(critical, key) || !(promise instanceof Promise)) throw new external_codec_js_namespaceObject.DataProtocolError('Deferred data needs unique keys and Promise values');
|
|
127
|
+
promise.catch(()=>void 0);
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
[DEFERRED]: true,
|
|
131
|
+
critical,
|
|
132
|
+
deferred: Object.fromEntries(Object.entries(deferred)),
|
|
133
|
+
...void 0 === init ? {} : {
|
|
134
|
+
init
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function cacheLifetime(cacheControl) {
|
|
139
|
+
const directives = (0, cache_js_namespaceObject.parseCacheControl)(cacheControl);
|
|
140
|
+
if (!directives) return;
|
|
141
|
+
const names = new Set();
|
|
142
|
+
const ages = [];
|
|
143
|
+
for (const { name, value: raw } of directives){
|
|
144
|
+
if ('max-age' !== name && 's-maxage' !== name) continue;
|
|
145
|
+
if (void 0 === raw) return;
|
|
146
|
+
if (names.has(name) || !/^\d+$/.test(raw)) return;
|
|
147
|
+
const age = Number(raw);
|
|
148
|
+
if (!Number.isSafeInteger(age)) return;
|
|
149
|
+
names.add(name);
|
|
150
|
+
ages.push(age);
|
|
151
|
+
}
|
|
152
|
+
if (!names.has('max-age')) return;
|
|
153
|
+
return ages.length > 0 ? Math.min(...ages) : void 0;
|
|
154
|
+
}
|
|
155
|
+
const ACCUMULATED_HEADERS = new Set([
|
|
156
|
+
'set-cookie',
|
|
157
|
+
'vary',
|
|
158
|
+
'link',
|
|
159
|
+
'server-timing',
|
|
160
|
+
'content-security-policy',
|
|
161
|
+
'content-security-policy-report-only'
|
|
162
|
+
]);
|
|
163
|
+
function mergeDataResponseMetadata(outcomes, nativeResponse) {
|
|
164
|
+
const headers = new Headers();
|
|
165
|
+
let cachePolicy = 'public';
|
|
166
|
+
for (const outcome of outcomes){
|
|
167
|
+
for (const [name, value] of outcome.response.headers)if (ACCUMULATED_HEADERS.has(name.toLowerCase())) headers.append(name, value);
|
|
168
|
+
else headers.set(name, value);
|
|
169
|
+
if ('success' !== outcome.kind || 'no-store' === outcome.response.cachePolicy) cachePolicy = 'no-store';
|
|
170
|
+
else if ('private' === outcome.response.cachePolicy && 'public' === cachePolicy) cachePolicy = 'private';
|
|
171
|
+
}
|
|
172
|
+
const vary = headers.get('vary');
|
|
173
|
+
if (null !== vary) {
|
|
174
|
+
const fields = new Map();
|
|
175
|
+
for (const field of vary.split(',')){
|
|
176
|
+
const name = field.trim();
|
|
177
|
+
const key = name.toLowerCase();
|
|
178
|
+
if (name && !fields.has(key)) fields.set(key, name);
|
|
179
|
+
}
|
|
180
|
+
headers.set('vary', [
|
|
181
|
+
...fields.values()
|
|
182
|
+
].join(', '));
|
|
183
|
+
}
|
|
184
|
+
if (0 === outcomes.length || headers.has('set-cookie') || nativeResponse.status >= 400) cachePolicy = 'no-store';
|
|
185
|
+
if ('no-store' !== cachePolicy) {
|
|
186
|
+
const ages = outcomes.map((outcome)=>cacheLifetime(new Headers(outcome.response.headers).get('cache-control') ?? ''));
|
|
187
|
+
if ('public' === cachePolicy && ages.some((age)=>void 0 === age)) cachePolicy = 'no-store';
|
|
188
|
+
else {
|
|
189
|
+
const maxAge = Math.min(...ages.map((age)=>age ?? 0));
|
|
190
|
+
headers.set('cache-control', 'private' === cachePolicy ? `private, max-age=${maxAge}, must-revalidate` : `public, max-age=${maxAge}`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if ('no-store' === cachePolicy) headers.set('cache-control', 'no-store');
|
|
194
|
+
return {
|
|
195
|
+
status: nativeResponse.status,
|
|
196
|
+
statusText: nativeResponse.statusText ?? '',
|
|
197
|
+
headers: (0, cache_js_namespaceObject.responseHeaders)(headers),
|
|
198
|
+
cachePolicy
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
function dataMetadataToDocumentPolicy(metadata) {
|
|
202
|
+
const headers = new Headers();
|
|
203
|
+
const fields = [
|
|
204
|
+
...metadata.headers
|
|
205
|
+
];
|
|
206
|
+
const keep = projectedHeaderFilter(fields);
|
|
207
|
+
for (const [name, value] of fields)if (keep(name)) headers.append(name, value);
|
|
208
|
+
headers.set('content-type', 'text/html; charset=utf-8');
|
|
209
|
+
let cache = {
|
|
210
|
+
mode: 'no-store'
|
|
211
|
+
};
|
|
212
|
+
const cacheControl = headers.get('cache-control') ?? '';
|
|
213
|
+
const directives = cacheDirectiveNames(cacheControl);
|
|
214
|
+
if ('private' === metadata.cachePolicy) cache = {
|
|
215
|
+
mode: 'private'
|
|
216
|
+
};
|
|
217
|
+
if ('public' === metadata.cachePolicy && 200 === metadata.status && !headers.has('set-cookie') && !directives.has('private') && !directives.has('no-store') && !directives.has('no-cache') && !headers.get('vary')?.split(',').some((value)=>'*' === value.trim())) {
|
|
218
|
+
const maxAgeSeconds = cacheLifetime(cacheControl);
|
|
219
|
+
if (void 0 !== maxAgeSeconds) cache = {
|
|
220
|
+
mode: 'public',
|
|
221
|
+
maxAgeSeconds
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
if (headers.has('set-cookie') || metadata.status >= 400) cache = {
|
|
225
|
+
mode: 'no-store'
|
|
226
|
+
};
|
|
227
|
+
if ('no-store' === cache.mode) headers.set('cache-control', 'no-store');
|
|
228
|
+
else if ('private' === cache.mode && !directives.has('private')) headers.set('cache-control', 'private');
|
|
229
|
+
return {
|
|
230
|
+
kind: 'document',
|
|
231
|
+
status: metadata.status,
|
|
232
|
+
headers: (0, cache_js_namespaceObject.responseHeaders)(headers),
|
|
233
|
+
cache
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
function listFieldElements(value) {
|
|
237
|
+
const elements = [];
|
|
238
|
+
let current = '';
|
|
239
|
+
let quoted = false;
|
|
240
|
+
let bracketed = false;
|
|
241
|
+
for(let index = 0; index < value.length; index++){
|
|
242
|
+
const char = value[index];
|
|
243
|
+
if (quoted) {
|
|
244
|
+
current += char;
|
|
245
|
+
if ('\\' === char && index + 1 < value.length) current += value[++index];
|
|
246
|
+
else if ('"' === char) quoted = false;
|
|
247
|
+
} else if ('"' === char) {
|
|
248
|
+
quoted = true;
|
|
249
|
+
current += char;
|
|
250
|
+
} else if ('<' === char) {
|
|
251
|
+
bracketed = true;
|
|
252
|
+
current += char;
|
|
253
|
+
} else if ('>' === char) {
|
|
254
|
+
bracketed = false;
|
|
255
|
+
current += char;
|
|
256
|
+
} else if (',' !== char || bracketed) current += char;
|
|
257
|
+
else {
|
|
258
|
+
if (current.trim()) elements.push(current.trim());
|
|
259
|
+
current = '';
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (current.trim()) elements.push(current.trim());
|
|
263
|
+
return elements;
|
|
264
|
+
}
|
|
265
|
+
function mergeDataResponseIntoResponse(response, metadata) {
|
|
266
|
+
const headers = new Headers(response.headers);
|
|
267
|
+
const nativeCookies = headers.getSetCookie();
|
|
268
|
+
const metadataHeaders = dataMetadataToDocumentPolicy(metadata).headers;
|
|
269
|
+
const metadataCookies = [];
|
|
270
|
+
for (const [name, value] of metadataHeaders){
|
|
271
|
+
const headerName = name.toLowerCase();
|
|
272
|
+
if ('set-cookie' === headerName) metadataCookies.push(value);
|
|
273
|
+
else if (ACCUMULATED_HEADERS.has(headerName) && 'vary' !== headerName) {
|
|
274
|
+
const present = new Set(listFieldElements(headers.get(name) ?? ''));
|
|
275
|
+
const missing = listFieldElements(value).filter((item)=>!present.has(item));
|
|
276
|
+
if (missing.length) headers.append(name, missing.join(', '));
|
|
277
|
+
} else if ('vary' === headerName) {
|
|
278
|
+
const fields = new Map();
|
|
279
|
+
for (const field of `${headers.get('vary') ?? ''},${value}`.split(',')){
|
|
280
|
+
const item = field.trim();
|
|
281
|
+
if (item && !fields.has(item.toLowerCase())) fields.set(item.toLowerCase(), item);
|
|
282
|
+
}
|
|
283
|
+
headers.set('vary', [
|
|
284
|
+
...fields.values()
|
|
285
|
+
].join(', '));
|
|
286
|
+
} else if (!headers.has(name)) headers.set(name, value);
|
|
287
|
+
}
|
|
288
|
+
if (metadataCookies.length > 0) {
|
|
289
|
+
headers.delete('set-cookie');
|
|
290
|
+
const counts = new Map();
|
|
291
|
+
for (const cookie of metadataCookies){
|
|
292
|
+
headers.append('set-cookie', cookie);
|
|
293
|
+
counts.set(cookie, (counts.get(cookie) ?? 0) + 1);
|
|
294
|
+
}
|
|
295
|
+
for (const cookie of nativeCookies){
|
|
296
|
+
const remaining = counts.get(cookie) ?? 0;
|
|
297
|
+
if (remaining > 0) counts.set(cookie, remaining - 1);
|
|
298
|
+
else headers.append('set-cookie', cookie);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
headers.set('cache-control', 'no-store');
|
|
302
|
+
return new Response(response.body, {
|
|
303
|
+
status: response.status,
|
|
304
|
+
statusText: response.statusText,
|
|
305
|
+
headers
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
function cacheDirectiveNames(cacheControl) {
|
|
309
|
+
const directives = (0, cache_js_namespaceObject.parseCacheControl)(cacheControl);
|
|
310
|
+
return directives ? new Set(directives.map(({ name })=>name)) : new Set([
|
|
311
|
+
'no-store'
|
|
312
|
+
]);
|
|
313
|
+
}
|
|
314
|
+
function responseMetadata(init = {}) {
|
|
315
|
+
const status = init.status ?? 200;
|
|
316
|
+
if (!Number.isInteger(status) || status < 200 || status > 599) throw new external_codec_js_namespaceObject.DataProtocolError('A data response requires a valid HTTP response status');
|
|
317
|
+
const headers = new Headers(init.headers);
|
|
318
|
+
const directives = cacheDirectiveNames(headers.get('cache-control') ?? '');
|
|
319
|
+
return {
|
|
320
|
+
status,
|
|
321
|
+
statusText: init.statusText ?? '',
|
|
322
|
+
headers: (0, cache_js_namespaceObject.responseHeaders)(headers),
|
|
323
|
+
cachePolicy: directives.has('no-store') || directives.has('no-cache') ? 'no-store' : directives.has('private') ? 'private' : directives.has('public') ? 'public' : 'no-store'
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
const DOM_EXCEPTION_FIELDS = {
|
|
327
|
+
name: Object.getOwnPropertyDescriptor(DOMException.prototype, 'name')?.get,
|
|
328
|
+
message: Object.getOwnPropertyDescriptor(DOMException.prototype, 'message')?.get
|
|
329
|
+
};
|
|
330
|
+
function publicDataError(error, production = true) {
|
|
331
|
+
const fallback = {
|
|
332
|
+
name: 'Error',
|
|
333
|
+
message: 'Unexpected Server Error'
|
|
334
|
+
};
|
|
335
|
+
if (production) return fallback;
|
|
336
|
+
if (error instanceof Error || error instanceof DOMException) {
|
|
337
|
+
const field = (key)=>{
|
|
338
|
+
let object = error;
|
|
339
|
+
for(let depth = 0; null !== object && depth < 100; depth++){
|
|
340
|
+
const descriptor = Object.getOwnPropertyDescriptor(object, key);
|
|
341
|
+
if (descriptor) {
|
|
342
|
+
if ('string' == typeof descriptor.value) return descriptor.value;
|
|
343
|
+
const intrinsic = object === DOMException.prototype && 'stack' !== key ? DOM_EXCEPTION_FIELDS[key] : void 0;
|
|
344
|
+
if (intrinsic && descriptor.get === intrinsic) {
|
|
345
|
+
const value = intrinsic.call(error);
|
|
346
|
+
return 'string' == typeof value ? value : void 0;
|
|
347
|
+
}
|
|
348
|
+
break;
|
|
349
|
+
}
|
|
350
|
+
object = Object.getPrototypeOf(object);
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
try {
|
|
354
|
+
const name = field('name') ?? fallback.name;
|
|
355
|
+
const message = field('message') ?? fallback.message;
|
|
356
|
+
const stack = field('stack');
|
|
357
|
+
return {
|
|
358
|
+
name,
|
|
359
|
+
message,
|
|
360
|
+
...stack ? {
|
|
361
|
+
stack
|
|
362
|
+
} : {}
|
|
363
|
+
};
|
|
364
|
+
} catch {}
|
|
365
|
+
}
|
|
366
|
+
return fallback;
|
|
367
|
+
}
|
|
368
|
+
async function responseValue(response, signal) {
|
|
369
|
+
if (BODYLESS_STATUSES.has(response.status) || null === response.body) return;
|
|
370
|
+
const text = await (0, external_body_js_namespaceObject.readBoundedDataText)(response, signal);
|
|
371
|
+
if (/\bapplication\/(?:[^;]+\+)?json\b/i.test(response.headers.get('content-type') ?? '')) try {
|
|
372
|
+
return JSON.parse(text);
|
|
373
|
+
} catch {
|
|
374
|
+
throw new external_codec_js_namespaceObject.DataProtocolError('A data Response contains malformed JSON');
|
|
375
|
+
}
|
|
376
|
+
return text;
|
|
377
|
+
}
|
|
378
|
+
async function normalizeDataResult(value, options = {}) {
|
|
379
|
+
const thrown = options.thrown ?? false;
|
|
380
|
+
const production = options.production ?? true;
|
|
381
|
+
if (value instanceof Response) {
|
|
382
|
+
const response = responseMetadata(value);
|
|
383
|
+
if (REDIRECT_STATUSES.has(value.status)) {
|
|
384
|
+
const location = value.headers.get('location');
|
|
385
|
+
if (!location) throw new external_codec_js_namespaceObject.DataProtocolError('A redirect data Response requires Location');
|
|
386
|
+
value.body?.cancel().catch(()=>void 0);
|
|
387
|
+
return {
|
|
388
|
+
kind: 'redirect',
|
|
389
|
+
location,
|
|
390
|
+
response
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
const data = await responseValue(value, options.signal);
|
|
394
|
+
(0, external_codec_js_namespaceObject.assertPublicData)(data);
|
|
395
|
+
if (404 === value.status) return {
|
|
396
|
+
kind: 'not-found',
|
|
397
|
+
value: data,
|
|
398
|
+
thrown,
|
|
399
|
+
response
|
|
400
|
+
};
|
|
401
|
+
if (thrown || value.status >= 400) return {
|
|
402
|
+
kind: 'error',
|
|
403
|
+
error: {
|
|
404
|
+
name: 'DataResponseError',
|
|
405
|
+
message: value.status >= 500 && production ? 'Unexpected Server Error' : value.statusText || `Data request failed (${value.status})`
|
|
406
|
+
},
|
|
407
|
+
...value.status >= 500 && production ? {} : {
|
|
408
|
+
data
|
|
409
|
+
},
|
|
410
|
+
thrown,
|
|
411
|
+
response
|
|
412
|
+
};
|
|
413
|
+
return {
|
|
414
|
+
kind: 'success',
|
|
415
|
+
value: data,
|
|
416
|
+
response
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
if (thrown) return {
|
|
420
|
+
kind: 'error',
|
|
421
|
+
error: publicDataError(value, production),
|
|
422
|
+
thrown: true,
|
|
423
|
+
response: responseMetadata({
|
|
424
|
+
status: 500,
|
|
425
|
+
headers: {
|
|
426
|
+
'cache-control': 'no-store'
|
|
427
|
+
}
|
|
428
|
+
})
|
|
429
|
+
};
|
|
430
|
+
if (value && 'object' == typeof value && DEFERRED in value) {
|
|
431
|
+
const data = value;
|
|
432
|
+
const response = responseMetadata(data.init);
|
|
433
|
+
if (REDIRECT_STATUSES.has(response.status) || response.status >= 400 || BODYLESS_STATUSES.has(response.status)) throw new external_codec_js_namespaceObject.DataProtocolError('Deferred data must have a successful body-bearing response status');
|
|
434
|
+
return {
|
|
435
|
+
kind: 'deferred',
|
|
436
|
+
critical: data.critical,
|
|
437
|
+
deferred: data.deferred,
|
|
438
|
+
response
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
(0, external_codec_js_namespaceObject.assertPublicData)(value);
|
|
442
|
+
return {
|
|
443
|
+
kind: 'success',
|
|
444
|
+
value,
|
|
445
|
+
response: responseMetadata()
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
async function invokeRouteData(handler, input, options = {}) {
|
|
449
|
+
input.request.signal.throwIfAborted();
|
|
450
|
+
const policy = (0, external_private_js_namespaceObject.createRequestDataPolicy)([
|
|
451
|
+
input.context,
|
|
452
|
+
input.request,
|
|
453
|
+
...options.privateValues ?? []
|
|
454
|
+
]);
|
|
455
|
+
return invokeOwnedRouteData(handler, input, options, policy);
|
|
456
|
+
}
|
|
457
|
+
async function invokeOwnedRouteData(handler, input, options, policy) {
|
|
458
|
+
input.request.signal.throwIfAborted();
|
|
459
|
+
let value;
|
|
460
|
+
let thrown = false;
|
|
461
|
+
try {
|
|
462
|
+
value = await (0, external_abort_js_namespaceObject.untilAborted)(handler(input), input.request.signal);
|
|
463
|
+
} catch (error) {
|
|
464
|
+
input.request.signal.throwIfAborted();
|
|
465
|
+
value = error;
|
|
466
|
+
thrown = true;
|
|
467
|
+
}
|
|
468
|
+
if (input.request.signal.aborted) {
|
|
469
|
+
if (value instanceof Response) value.body?.cancel(input.request.signal.reason).catch(()=>void 0);
|
|
470
|
+
input.request.signal.throwIfAborted();
|
|
471
|
+
}
|
|
472
|
+
policy.assertRoot(value);
|
|
473
|
+
let outcome = await normalizeDataResult(value, {
|
|
474
|
+
...options,
|
|
475
|
+
thrown,
|
|
476
|
+
signal: input.request.signal
|
|
477
|
+
});
|
|
478
|
+
if ('deferred' === outcome.kind) {
|
|
479
|
+
policy.assertValue(outcome.critical);
|
|
480
|
+
outcome = {
|
|
481
|
+
...outcome,
|
|
482
|
+
deferred: Object.fromEntries(Object.entries(outcome.deferred).map(([key, promise])=>{
|
|
483
|
+
const checked = Promise.prototype.then.call(promise, (value)=>{
|
|
484
|
+
policy.assertValue(value);
|
|
485
|
+
return value;
|
|
486
|
+
}, (error)=>{
|
|
487
|
+
policy.assertRoot(error);
|
|
488
|
+
throw error;
|
|
489
|
+
});
|
|
490
|
+
checked.catch(()=>void 0);
|
|
491
|
+
return [
|
|
492
|
+
key,
|
|
493
|
+
checked
|
|
494
|
+
];
|
|
495
|
+
}))
|
|
496
|
+
};
|
|
497
|
+
} else policy.assertValue(publicOutcome(outcome));
|
|
498
|
+
outcomePolicies.set(outcome, policy);
|
|
499
|
+
return outcome;
|
|
500
|
+
}
|
|
501
|
+
function publicOutcome(outcome) {
|
|
502
|
+
const status = outcome.response.status;
|
|
503
|
+
switch(outcome.kind){
|
|
504
|
+
case 'success':
|
|
505
|
+
return {
|
|
506
|
+
kind: 'success',
|
|
507
|
+
value: outcome.value,
|
|
508
|
+
status
|
|
509
|
+
};
|
|
510
|
+
case 'deferred':
|
|
511
|
+
return {
|
|
512
|
+
kind: 'success',
|
|
513
|
+
value: outcome.critical,
|
|
514
|
+
status
|
|
515
|
+
};
|
|
516
|
+
case 'redirect':
|
|
517
|
+
return {
|
|
518
|
+
kind: 'redirect',
|
|
519
|
+
location: outcome.location,
|
|
520
|
+
status
|
|
521
|
+
};
|
|
522
|
+
case 'not-found':
|
|
523
|
+
return {
|
|
524
|
+
kind: 'not-found',
|
|
525
|
+
value: outcome.value,
|
|
526
|
+
thrown: outcome.thrown,
|
|
527
|
+
status
|
|
528
|
+
};
|
|
529
|
+
case 'error':
|
|
530
|
+
return {
|
|
531
|
+
kind: 'error',
|
|
532
|
+
error: outcome.error,
|
|
533
|
+
...Object.hasOwn(outcome, 'data') ? {
|
|
534
|
+
data: outcome.data
|
|
535
|
+
} : {},
|
|
536
|
+
thrown: outcome.thrown,
|
|
537
|
+
status
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function wireEnvelope(outcome, identity, routeId, operation) {
|
|
542
|
+
(0, external_identity_js_namespaceObject.identityCacheKey)(identity);
|
|
543
|
+
return {
|
|
544
|
+
version: external_types_js_namespaceObject.DATA_PROTOCOL_VERSION,
|
|
545
|
+
identity: {
|
|
546
|
+
renderer: identity.renderer,
|
|
547
|
+
appId: identity.appId,
|
|
548
|
+
entryName: identity.entryName,
|
|
549
|
+
protocolVersion: identity.protocolVersion,
|
|
550
|
+
buildId: identity.buildId
|
|
551
|
+
},
|
|
552
|
+
routeId,
|
|
553
|
+
operation,
|
|
554
|
+
outcome: publicOutcome(outcome),
|
|
555
|
+
...'deferred' === outcome.kind ? {
|
|
556
|
+
deferredKeys: Object.keys(outcome.deferred)
|
|
557
|
+
} : {}
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
function createDeferredStream(outcome, envelope, signal, production, onCancel, policy) {
|
|
561
|
+
const encoder = new TextEncoder();
|
|
562
|
+
const projectError = (error)=>{
|
|
563
|
+
try {
|
|
564
|
+
policy?.assertRoot(error);
|
|
565
|
+
} catch (violation) {
|
|
566
|
+
error = violation;
|
|
567
|
+
}
|
|
568
|
+
return publicDataError(error, production);
|
|
569
|
+
};
|
|
570
|
+
policy?.assertValue({
|
|
571
|
+
type: 'initial',
|
|
572
|
+
envelope
|
|
573
|
+
});
|
|
574
|
+
const initialBytes = encoder.encode(`${(0, external_codec_js_namespaceObject.serializePublicData)({
|
|
575
|
+
type: 'initial',
|
|
576
|
+
envelope
|
|
577
|
+
})}\n`);
|
|
578
|
+
const transport = new TransformStream();
|
|
579
|
+
const writer = transport.writable.getWriter();
|
|
580
|
+
let active = true;
|
|
581
|
+
let finished = false;
|
|
582
|
+
let cancelled = false;
|
|
583
|
+
const stopped = new AbortController();
|
|
584
|
+
const cancelResources = (reason)=>{
|
|
585
|
+
if (finished || cancelled) return;
|
|
586
|
+
cancelled = true;
|
|
587
|
+
stopped.abort(reason);
|
|
588
|
+
try {
|
|
589
|
+
Promise.resolve(onCancel?.(reason)).catch(()=>void 0);
|
|
590
|
+
} catch {}
|
|
591
|
+
};
|
|
592
|
+
const cleanup = ()=>{
|
|
593
|
+
if (!active) return;
|
|
594
|
+
active = false;
|
|
595
|
+
signal?.removeEventListener('abort', abort);
|
|
596
|
+
};
|
|
597
|
+
const abort = ()=>{
|
|
598
|
+
if (!active) return;
|
|
599
|
+
const reason = signal?.reason ?? new DOMException('The data request was aborted', 'AbortError');
|
|
600
|
+
cancelResources(reason);
|
|
601
|
+
cleanup();
|
|
602
|
+
writer.abort(reason).catch(()=>void 0);
|
|
603
|
+
};
|
|
604
|
+
let writes = Promise.resolve();
|
|
605
|
+
const write = (frame, encoded)=>{
|
|
606
|
+
const next = writes.then(async ()=>{
|
|
607
|
+
if (!active) return;
|
|
608
|
+
if (encoded) return void await writer.write(encoded);
|
|
609
|
+
let text;
|
|
610
|
+
try {
|
|
611
|
+
policy?.assertValue(frame);
|
|
612
|
+
text = (0, external_codec_js_namespaceObject.serializePublicData)(frame);
|
|
613
|
+
} catch (error) {
|
|
614
|
+
if ('resolve' !== frame.type) throw error;
|
|
615
|
+
text = (0, external_codec_js_namespaceObject.serializePublicData)({
|
|
616
|
+
type: 'reject',
|
|
617
|
+
key: frame.key,
|
|
618
|
+
error: projectError(error)
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
await writer.write(encoder.encode(`${text}\n`));
|
|
622
|
+
});
|
|
623
|
+
writes = next;
|
|
624
|
+
return next;
|
|
625
|
+
};
|
|
626
|
+
writer.closed.catch((reason)=>{
|
|
627
|
+
cancelResources(reason);
|
|
628
|
+
cleanup();
|
|
629
|
+
});
|
|
630
|
+
if (signal?.aborted) abort();
|
|
631
|
+
else signal?.addEventListener('abort', abort, {
|
|
632
|
+
once: true
|
|
633
|
+
});
|
|
634
|
+
(async ()=>{
|
|
635
|
+
await write({
|
|
636
|
+
type: 'initial',
|
|
637
|
+
envelope
|
|
638
|
+
}, initialBytes);
|
|
639
|
+
await Promise.all(Object.entries(outcome.deferred).map(async ([key, promise])=>{
|
|
640
|
+
let frame;
|
|
641
|
+
try {
|
|
642
|
+
const value = await (0, external_abort_js_namespaceObject.untilAborted)(promise, stopped.signal);
|
|
643
|
+
(0, external_codec_js_namespaceObject.assertPublicData)(value);
|
|
644
|
+
frame = {
|
|
645
|
+
type: 'resolve',
|
|
646
|
+
key,
|
|
647
|
+
value
|
|
648
|
+
};
|
|
649
|
+
} catch (error) {
|
|
650
|
+
frame = {
|
|
651
|
+
type: 'reject',
|
|
652
|
+
key,
|
|
653
|
+
error: projectError(error)
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
await write(frame);
|
|
657
|
+
}));
|
|
658
|
+
if (!active) return;
|
|
659
|
+
await write({
|
|
660
|
+
type: 'complete'
|
|
661
|
+
});
|
|
662
|
+
await writer.close();
|
|
663
|
+
finished = true;
|
|
664
|
+
cleanup();
|
|
665
|
+
})().catch((error)=>{
|
|
666
|
+
cancelResources(error);
|
|
667
|
+
cleanup();
|
|
668
|
+
writer.abort(error).catch(()=>void 0);
|
|
669
|
+
});
|
|
670
|
+
return transport.readable;
|
|
671
|
+
}
|
|
672
|
+
function createDataResponse(outcome, identity, options) {
|
|
673
|
+
const policy = outcomePolicies.get(outcome);
|
|
674
|
+
policy?.assertValue(publicOutcome(outcome));
|
|
675
|
+
const envelope = wireEnvelope(outcome, identity, options.routeId, options.operation);
|
|
676
|
+
const headers = new Headers();
|
|
677
|
+
const fields = [
|
|
678
|
+
...outcome.response.headers
|
|
679
|
+
];
|
|
680
|
+
const keep = projectedHeaderFilter(fields);
|
|
681
|
+
for (const [name, value] of fields)if (keep(name)) headers.append(name, value);
|
|
682
|
+
headers.set('x-modernjs-response', 'yes');
|
|
683
|
+
if (!headers.has('cache-control') || headers.has('set-cookie') || 'success' !== outcome.kind || 'no-store' === outcome.response.cachePolicy) headers.set('cache-control', 'no-store');
|
|
684
|
+
if ('redirect' === outcome.kind) headers.set('x-modernjs-redirect', outcome.location);
|
|
685
|
+
headers.set('content-type', `${'deferred' === outcome.kind ? external_types_js_namespaceObject.DATA_STREAM_CONTENT_TYPE : external_types_js_namespaceObject.DATA_CONTENT_TYPE}; charset=utf-8`);
|
|
686
|
+
const status = 'redirect' === outcome.kind || 206 === outcome.response.status || BODYLESS_STATUSES.has(outcome.response.status) ? 200 : outcome.response.status;
|
|
687
|
+
let body;
|
|
688
|
+
if ('deferred' === outcome.kind) body = createDeferredStream(outcome, envelope, options.signal, options.production ?? true, options.onCancel, policy);
|
|
689
|
+
else {
|
|
690
|
+
policy?.assertValue(envelope);
|
|
691
|
+
body = (0, external_codec_js_namespaceObject.serializePublicData)(envelope);
|
|
692
|
+
}
|
|
693
|
+
return new Response(body, {
|
|
694
|
+
status,
|
|
695
|
+
headers
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
async function handleDataRequest(options) {
|
|
699
|
+
const url = new URL(options.request.url);
|
|
700
|
+
const routeId = url.searchParams.get(external_types_js_namespaceObject.LOADER_ID_PARAM);
|
|
701
|
+
if (!routeId) return;
|
|
702
|
+
(0, external_identity_js_namespaceObject.identityCacheKey)(options.identity);
|
|
703
|
+
const context = options.context;
|
|
704
|
+
const cancellation = new AbortController();
|
|
705
|
+
const request = new Request(options.request, {
|
|
706
|
+
signal: AbortSignal.any([
|
|
707
|
+
options.request.signal,
|
|
708
|
+
cancellation.signal
|
|
709
|
+
])
|
|
710
|
+
});
|
|
711
|
+
request.signal.throwIfAborted();
|
|
712
|
+
const policy = (0, external_private_js_namespaceObject.createRequestDataPolicy)([
|
|
713
|
+
context,
|
|
714
|
+
options.request,
|
|
715
|
+
request,
|
|
716
|
+
...options.privateValues ?? []
|
|
717
|
+
]);
|
|
718
|
+
if (![
|
|
719
|
+
'GET',
|
|
720
|
+
'HEAD',
|
|
721
|
+
'POST',
|
|
722
|
+
'PUT',
|
|
723
|
+
'PATCH',
|
|
724
|
+
'DELETE'
|
|
725
|
+
].includes(request.method)) return new Response('Unsupported data method', {
|
|
726
|
+
status: 405,
|
|
727
|
+
headers: {
|
|
728
|
+
allow: 'GET, HEAD, POST, PUT, PATCH, DELETE',
|
|
729
|
+
'cache-control': 'no-store'
|
|
730
|
+
}
|
|
731
|
+
});
|
|
732
|
+
const operation = 'GET' === request.method || 'HEAD' === request.method ? 'loader' : 'action';
|
|
733
|
+
const selected = await (0, external_abort_js_namespaceObject.untilAborted)(options.selectRoute(request, routeId, operation), request.signal);
|
|
734
|
+
if (!selected || selected.routeId !== routeId) return new Response('Data route is not authorized for this URL', {
|
|
735
|
+
status: 403,
|
|
736
|
+
headers: {
|
|
737
|
+
'cache-control': 'no-store'
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
const productionOptions = void 0 === options.production ? {} : {
|
|
741
|
+
production: options.production
|
|
742
|
+
};
|
|
743
|
+
const outcome = await invokeOwnedRouteData(selected.handler, {
|
|
744
|
+
request,
|
|
745
|
+
routeId,
|
|
746
|
+
params: selected.params,
|
|
747
|
+
context
|
|
748
|
+
}, productionOptions, policy);
|
|
749
|
+
const response = createDataResponse(outcome, options.identity, {
|
|
750
|
+
routeId,
|
|
751
|
+
operation,
|
|
752
|
+
signal: request.signal,
|
|
753
|
+
...productionOptions,
|
|
754
|
+
onCancel: (reason)=>cancellation.abort(reason)
|
|
755
|
+
});
|
|
756
|
+
if ('HEAD' === request.method) {
|
|
757
|
+
response.body?.cancel().catch(()=>void 0);
|
|
758
|
+
return new Response(null, {
|
|
759
|
+
status: response.status,
|
|
760
|
+
headers: response.headers
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
return response;
|
|
764
|
+
}
|
|
765
|
+
exports.collectDataHeaders = __webpack_exports__.collectDataHeaders;
|
|
766
|
+
exports.createDataResponse = __webpack_exports__.createDataResponse;
|
|
767
|
+
exports.dataMetadataToDocumentPolicy = __webpack_exports__.dataMetadataToDocumentPolicy;
|
|
768
|
+
exports.deferData = __webpack_exports__.deferData;
|
|
769
|
+
exports.handleDataRequest = __webpack_exports__.handleDataRequest;
|
|
770
|
+
exports.invokeRouteData = __webpack_exports__.invokeRouteData;
|
|
771
|
+
exports.mergeDataResponseIntoResponse = __webpack_exports__.mergeDataResponseIntoResponse;
|
|
772
|
+
exports.mergeDataResponseMetadata = __webpack_exports__.mergeDataResponseMetadata;
|
|
773
|
+
exports.mergeHeaderFields = __webpack_exports__.mergeHeaderFields;
|
|
774
|
+
exports.normalizeDataResult = __webpack_exports__.normalizeDataResult;
|
|
775
|
+
exports.publicDataError = __webpack_exports__.publicDataError;
|
|
776
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
777
|
+
"collectDataHeaders",
|
|
778
|
+
"createDataResponse",
|
|
779
|
+
"dataMetadataToDocumentPolicy",
|
|
780
|
+
"deferData",
|
|
781
|
+
"handleDataRequest",
|
|
782
|
+
"invokeRouteData",
|
|
783
|
+
"mergeDataResponseIntoResponse",
|
|
784
|
+
"mergeDataResponseMetadata",
|
|
785
|
+
"mergeHeaderFields",
|
|
786
|
+
"normalizeDataResult",
|
|
787
|
+
"publicDataError"
|
|
788
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
789
|
+
Object.defineProperty(exports, '__esModule', {
|
|
790
|
+
value: true
|
|
791
|
+
});
|