@trpc/server 11.0.0-rc.566 → 11.0.0-rc.567
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/dist/adapters/express.js +4 -4
- package/dist/adapters/express.mjs +4 -4
- package/dist/adapters/next.d.ts.map +1 -1
- package/dist/adapters/next.js +26 -32
- package/dist/adapters/next.mjs +27 -33
- package/dist/adapters/node-http/incomingMessageToRequest.d.ts.map +1 -1
- package/dist/adapters/node-http/incomingMessageToRequest.js +2 -1
- package/dist/adapters/node-http/incomingMessageToRequest.mjs +2 -1
- package/dist/adapters/node-http/index.js +1 -0
- package/dist/adapters/node-http/index.mjs +1 -1
- package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts +5 -1
- package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts.map +1 -1
- package/dist/adapters/node-http/nodeHTTPRequestHandler.js +91 -56
- package/dist/adapters/node-http/nodeHTTPRequestHandler.mjs +91 -57
- package/dist/adapters/standalone.d.ts +5 -2
- package/dist/adapters/standalone.d.ts.map +1 -1
- package/dist/adapters/standalone.js +25 -14
- package/dist/adapters/standalone.mjs +26 -15
- package/dist/bundle-analysis.json +113 -108
- package/dist/unstable-core-do-not-import/http/toURL.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/http/toURL.js +12 -2
- package/dist/unstable-core-do-not-import/http/toURL.mjs +12 -2
- package/package.json +2 -2
- package/src/adapters/express.ts +4 -4
- package/src/adapters/next.ts +33 -35
- package/src/adapters/node-http/incomingMessageToRequest.ts +2 -1
- package/src/adapters/node-http/nodeHTTPRequestHandler.ts +109 -62
- package/src/adapters/standalone.ts +32 -16
- package/src/unstable-core-do-not-import/http/toURL.ts +14 -4
|
@@ -5,23 +5,34 @@ var toURL = require('../unstable-core-do-not-import/http/toURL.js');
|
|
|
5
5
|
require('../unstable-core-do-not-import/rootConfig.js');
|
|
6
6
|
var nodeHTTPRequestHandler = require('./node-http/nodeHTTPRequestHandler.js');
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/ function createHTTPHandler(opts) {
|
|
11
|
+
return (req, res)=>{
|
|
12
|
+
let path = '';
|
|
13
|
+
try {
|
|
14
|
+
const url = toURL.toURL(req.url);
|
|
15
|
+
// get procedure path and remove the leading slash
|
|
16
|
+
// /procedure -> procedure
|
|
17
|
+
path = url.pathname.slice(1);
|
|
18
|
+
nodeHTTPRequestHandler.nodeHTTPRequestHandler({
|
|
19
|
+
...opts,
|
|
20
|
+
req,
|
|
21
|
+
res,
|
|
22
|
+
path
|
|
23
|
+
});
|
|
24
|
+
} catch (cause) {
|
|
25
|
+
nodeHTTPRequestHandler.internal_exceptionHandler({
|
|
26
|
+
req,
|
|
27
|
+
res,
|
|
28
|
+
path,
|
|
29
|
+
...opts
|
|
30
|
+
})(cause);
|
|
31
|
+
}
|
|
20
32
|
};
|
|
21
33
|
}
|
|
22
34
|
function createHTTPServer(opts) {
|
|
23
|
-
|
|
24
|
-
return http.createServer(handler);
|
|
35
|
+
return http.createServer(createHTTPHandler(opts));
|
|
25
36
|
}
|
|
26
37
|
|
|
27
38
|
exports.createHTTPHandler = createHTTPHandler;
|
|
@@ -1,25 +1,36 @@
|
|
|
1
1
|
import http from 'node:http';
|
|
2
2
|
import { toURL } from '../unstable-core-do-not-import/http/toURL.mjs';
|
|
3
3
|
import '../unstable-core-do-not-import/rootConfig.mjs';
|
|
4
|
-
import { nodeHTTPRequestHandler } from './node-http/nodeHTTPRequestHandler.mjs';
|
|
4
|
+
import { nodeHTTPRequestHandler, internal_exceptionHandler } from './node-http/nodeHTTPRequestHandler.mjs';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/ function createHTTPHandler(opts) {
|
|
9
|
+
return (req, res)=>{
|
|
10
|
+
let path = '';
|
|
11
|
+
try {
|
|
12
|
+
const url = toURL(req.url);
|
|
13
|
+
// get procedure path and remove the leading slash
|
|
14
|
+
// /procedure -> procedure
|
|
15
|
+
path = url.pathname.slice(1);
|
|
16
|
+
nodeHTTPRequestHandler({
|
|
17
|
+
...opts,
|
|
18
|
+
req,
|
|
19
|
+
res,
|
|
20
|
+
path
|
|
21
|
+
});
|
|
22
|
+
} catch (cause) {
|
|
23
|
+
internal_exceptionHandler({
|
|
24
|
+
req,
|
|
25
|
+
res,
|
|
26
|
+
path,
|
|
27
|
+
...opts
|
|
28
|
+
})(cause);
|
|
29
|
+
}
|
|
18
30
|
};
|
|
19
31
|
}
|
|
20
32
|
function createHTTPServer(opts) {
|
|
21
|
-
|
|
22
|
-
return http.createServer(handler);
|
|
33
|
+
return http.createServer(createHTTPHandler(opts));
|
|
23
34
|
}
|
|
24
35
|
|
|
25
36
|
export { createHTTPHandler, createHTTPServer };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 24.
|
|
2
|
+
"bundleSize": 141654,
|
|
3
|
+
"bundleOrigSize": 188624,
|
|
4
|
+
"bundleReduction": 24.9,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dependents": [
|
|
15
15
|
"/src/unstable-core-do-not-import.ts"
|
|
16
16
|
],
|
|
17
|
-
"percent": 13.
|
|
17
|
+
"percent": 13.02,
|
|
18
18
|
"reduction": 0
|
|
19
19
|
},
|
|
20
20
|
{
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"/src/unstable-core-do-not-import.ts",
|
|
32
32
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
33
33
|
],
|
|
34
|
-
"percent": 12.
|
|
34
|
+
"percent": 12.4,
|
|
35
35
|
"reduction": 4.86
|
|
36
36
|
},
|
|
37
37
|
{
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dependents": [
|
|
48
48
|
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
49
49
|
],
|
|
50
|
-
"percent": 11.
|
|
50
|
+
"percent": 11.5,
|
|
51
51
|
"reduction": 0
|
|
52
52
|
},
|
|
53
53
|
{
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"/src/unstable-core-do-not-import.ts",
|
|
65
65
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
66
66
|
],
|
|
67
|
-
"percent": 6.
|
|
67
|
+
"percent": 6.62,
|
|
68
68
|
"reduction": 12.3
|
|
69
69
|
},
|
|
70
70
|
{
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"/src/unstable-core-do-not-import.ts",
|
|
80
80
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
81
81
|
],
|
|
82
|
-
"percent": 5.
|
|
82
|
+
"percent": 5.43,
|
|
83
83
|
"reduction": 0
|
|
84
84
|
},
|
|
85
85
|
{
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"/src/unstable-core-do-not-import.ts",
|
|
98
98
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
99
99
|
],
|
|
100
|
-
"percent": 4.
|
|
100
|
+
"percent": 4.53,
|
|
101
101
|
"reduction": 40.09
|
|
102
102
|
},
|
|
103
103
|
{
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"/src/unstable-core-do-not-import.ts",
|
|
113
113
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
114
114
|
],
|
|
115
|
-
"percent": 4.
|
|
115
|
+
"percent": 4.09,
|
|
116
116
|
"reduction": 64.74
|
|
117
117
|
},
|
|
118
118
|
{
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"dependents": [
|
|
127
127
|
"/src/adapters/aws-lambda/index.ts"
|
|
128
128
|
],
|
|
129
|
-
"percent": 3.
|
|
129
|
+
"percent": 3.82,
|
|
130
130
|
"reduction": 11.38
|
|
131
131
|
},
|
|
132
132
|
{
|
|
@@ -145,36 +145,37 @@
|
|
|
145
145
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
146
146
|
"/src/observable/operators.ts"
|
|
147
147
|
],
|
|
148
|
-
"percent": 3.
|
|
148
|
+
"percent": 3.16,
|
|
149
149
|
"reduction": 0
|
|
150
150
|
},
|
|
151
151
|
{
|
|
152
|
-
"id": "/src/adapters/
|
|
153
|
-
"size":
|
|
154
|
-
"origSize":
|
|
152
|
+
"id": "/src/adapters/node-http/nodeHTTPRequestHandler.ts",
|
|
153
|
+
"size": 4029,
|
|
154
|
+
"origSize": 4276,
|
|
155
155
|
"renderedExports": [
|
|
156
|
-
"
|
|
156
|
+
"internal_exceptionHandler",
|
|
157
|
+
"nodeHTTPRequestHandler"
|
|
157
158
|
],
|
|
158
159
|
"removedExports": [],
|
|
159
160
|
"dependents": [
|
|
160
|
-
"/src/adapters/
|
|
161
|
+
"/src/adapters/node-http/index.ts"
|
|
161
162
|
],
|
|
162
|
-
"percent": 2.
|
|
163
|
-
"reduction":
|
|
163
|
+
"percent": 2.84,
|
|
164
|
+
"reduction": 5.78
|
|
164
165
|
},
|
|
165
166
|
{
|
|
166
|
-
"id": "/src/adapters/
|
|
167
|
-
"size":
|
|
168
|
-
"origSize":
|
|
167
|
+
"id": "/src/adapters/next-app-dir/nextAppDirCaller.ts",
|
|
168
|
+
"size": 3221,
|
|
169
|
+
"origSize": 4160,
|
|
169
170
|
"renderedExports": [
|
|
170
|
-
"
|
|
171
|
+
"nextAppDirCaller"
|
|
171
172
|
],
|
|
172
173
|
"removedExports": [],
|
|
173
174
|
"dependents": [
|
|
174
|
-
"/src/adapters/
|
|
175
|
+
"/src/adapters/next-app-dir.ts"
|
|
175
176
|
],
|
|
176
|
-
"percent": 2.
|
|
177
|
-
"reduction":
|
|
177
|
+
"percent": 2.27,
|
|
178
|
+
"reduction": 22.57
|
|
178
179
|
},
|
|
179
180
|
{
|
|
180
181
|
"id": "/src/observable/operators.ts",
|
|
@@ -189,7 +190,7 @@
|
|
|
189
190
|
"dependents": [
|
|
190
191
|
"/src/observable/index.ts"
|
|
191
192
|
],
|
|
192
|
-
"percent": 1.
|
|
193
|
+
"percent": 1.95,
|
|
193
194
|
"reduction": 0
|
|
194
195
|
},
|
|
195
196
|
{
|
|
@@ -209,7 +210,7 @@
|
|
|
209
210
|
"/src/unstable-core-do-not-import/initTRPC.ts",
|
|
210
211
|
"/src/unstable-core-do-not-import/router.ts"
|
|
211
212
|
],
|
|
212
|
-
"percent": 1.
|
|
213
|
+
"percent": 1.94,
|
|
213
214
|
"reduction": 45.94
|
|
214
215
|
},
|
|
215
216
|
{
|
|
@@ -223,7 +224,7 @@
|
|
|
223
224
|
"dependents": [
|
|
224
225
|
"/src/unstable-core-do-not-import.ts"
|
|
225
226
|
],
|
|
226
|
-
"percent": 1.
|
|
227
|
+
"percent": 1.9,
|
|
227
228
|
"reduction": 40.98
|
|
228
229
|
},
|
|
229
230
|
{
|
|
@@ -243,7 +244,7 @@
|
|
|
243
244
|
"/src/unstable-core-do-not-import/initTRPC.ts",
|
|
244
245
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
245
246
|
],
|
|
246
|
-
"percent": 1.
|
|
247
|
+
"percent": 1.85,
|
|
247
248
|
"reduction": 55.78
|
|
248
249
|
},
|
|
249
250
|
{
|
|
@@ -259,7 +260,7 @@
|
|
|
259
260
|
"/src/unstable-core-do-not-import.ts",
|
|
260
261
|
"/src/unstable-core-do-not-import/router.ts"
|
|
261
262
|
],
|
|
262
|
-
"percent": 1.
|
|
263
|
+
"percent": 1.64,
|
|
263
264
|
"reduction": 0
|
|
264
265
|
},
|
|
265
266
|
{
|
|
@@ -273,13 +274,13 @@
|
|
|
273
274
|
"dependents": [
|
|
274
275
|
"/src/adapters/fetch/index.ts"
|
|
275
276
|
],
|
|
276
|
-
"percent": 1.
|
|
277
|
+
"percent": 1.59,
|
|
277
278
|
"reduction": 2.17
|
|
278
279
|
},
|
|
279
280
|
{
|
|
280
281
|
"id": "/src/adapters/node-http/incomingMessageToRequest.ts",
|
|
281
|
-
"size":
|
|
282
|
-
"origSize":
|
|
282
|
+
"size": 2207,
|
|
283
|
+
"origSize": 2588,
|
|
283
284
|
"renderedExports": [
|
|
284
285
|
"incomingMessageToRequest"
|
|
285
286
|
],
|
|
@@ -289,7 +290,7 @@
|
|
|
289
290
|
"/src/adapters/node-http/nodeHTTPRequestHandler.ts"
|
|
290
291
|
],
|
|
291
292
|
"percent": 1.56,
|
|
292
|
-
"reduction":
|
|
293
|
+
"reduction": 14.72
|
|
293
294
|
},
|
|
294
295
|
{
|
|
295
296
|
"id": "/src/adapters/next-app-dir/rethrowNextErrors.ts",
|
|
@@ -302,7 +303,7 @@
|
|
|
302
303
|
"dependents": [
|
|
303
304
|
"/src/adapters/next-app-dir/nextAppDirCaller.ts"
|
|
304
305
|
],
|
|
305
|
-
"percent": 1.
|
|
306
|
+
"percent": 1.45,
|
|
306
307
|
"reduction": 5.79
|
|
307
308
|
},
|
|
308
309
|
{
|
|
@@ -316,7 +317,7 @@
|
|
|
316
317
|
"dependents": [
|
|
317
318
|
"/src/adapters/fastify/index.ts"
|
|
318
319
|
],
|
|
319
|
-
"percent": 1.
|
|
320
|
+
"percent": 1.26,
|
|
320
321
|
"reduction": 29.88
|
|
321
322
|
},
|
|
322
323
|
{
|
|
@@ -333,6 +334,7 @@
|
|
|
333
334
|
"/src/unstable-core-do-not-import.ts",
|
|
334
335
|
"/src/unstable-core-do-not-import/http/parseConnectionParams.ts",
|
|
335
336
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
337
|
+
"/src/unstable-core-do-not-import/http/toURL.ts",
|
|
336
338
|
"/src/unstable-core-do-not-import/middleware.ts",
|
|
337
339
|
"/src/unstable-core-do-not-import/router.ts",
|
|
338
340
|
"/src/unstable-core-do-not-import/http/contentType.ts",
|
|
@@ -340,7 +342,7 @@
|
|
|
340
342
|
"/src/unstable-core-do-not-import/stream/jsonl.ts",
|
|
341
343
|
"/src/unstable-core-do-not-import/stream/sse.ts"
|
|
342
344
|
],
|
|
343
|
-
"percent": 1.
|
|
345
|
+
"percent": 1.22,
|
|
344
346
|
"reduction": 19.47
|
|
345
347
|
},
|
|
346
348
|
{
|
|
@@ -352,7 +354,7 @@
|
|
|
352
354
|
],
|
|
353
355
|
"removedExports": [],
|
|
354
356
|
"dependents": [],
|
|
355
|
-
"percent": 1.
|
|
357
|
+
"percent": 1.2,
|
|
356
358
|
"reduction": 19.29
|
|
357
359
|
},
|
|
358
360
|
{
|
|
@@ -365,21 +367,9 @@
|
|
|
365
367
|
],
|
|
366
368
|
"removedExports": [],
|
|
367
369
|
"dependents": [],
|
|
368
|
-
"percent": 1.
|
|
370
|
+
"percent": 1.14,
|
|
369
371
|
"reduction": 27.47
|
|
370
372
|
},
|
|
371
|
-
{
|
|
372
|
-
"id": "/src/adapters/next.ts",
|
|
373
|
-
"size": 1543,
|
|
374
|
-
"origSize": 2112,
|
|
375
|
-
"renderedExports": [
|
|
376
|
-
"createNextApiHandler"
|
|
377
|
-
],
|
|
378
|
-
"removedExports": [],
|
|
379
|
-
"dependents": [],
|
|
380
|
-
"percent": 1.1,
|
|
381
|
-
"reduction": 26.94
|
|
382
|
-
},
|
|
383
373
|
{
|
|
384
374
|
"id": "/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts",
|
|
385
375
|
"size": 1438,
|
|
@@ -394,9 +384,21 @@
|
|
|
394
384
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
395
385
|
"/src/unstable-core-do-not-import/error/getErrorShape.ts"
|
|
396
386
|
],
|
|
397
|
-
"percent": 1.
|
|
387
|
+
"percent": 1.02,
|
|
398
388
|
"reduction": 16.73
|
|
399
389
|
},
|
|
390
|
+
{
|
|
391
|
+
"id": "/src/adapters/next.ts",
|
|
392
|
+
"size": 1374,
|
|
393
|
+
"origSize": 2152,
|
|
394
|
+
"renderedExports": [
|
|
395
|
+
"createNextApiHandler"
|
|
396
|
+
],
|
|
397
|
+
"removedExports": [],
|
|
398
|
+
"dependents": [],
|
|
399
|
+
"percent": 0.97,
|
|
400
|
+
"reduction": 36.15
|
|
401
|
+
},
|
|
400
402
|
{
|
|
401
403
|
"id": "/src/unstable-core-do-not-import/parser.ts",
|
|
402
404
|
"size": 1297,
|
|
@@ -441,7 +443,7 @@
|
|
|
441
443
|
"/src/unstable-core-do-not-import/stream/jsonl.ts",
|
|
442
444
|
"/src/unstable-core-do-not-import/stream/sse.ts"
|
|
443
445
|
],
|
|
444
|
-
"percent": 0.
|
|
446
|
+
"percent": 0.84,
|
|
445
447
|
"reduction": 28.34
|
|
446
448
|
},
|
|
447
449
|
{
|
|
@@ -456,7 +458,7 @@
|
|
|
456
458
|
"/src/adapters/fastify/index.ts",
|
|
457
459
|
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
458
460
|
],
|
|
459
|
-
"percent": 0.
|
|
461
|
+
"percent": 0.8,
|
|
460
462
|
"reduction": 47.59
|
|
461
463
|
},
|
|
462
464
|
{
|
|
@@ -472,7 +474,7 @@
|
|
|
472
474
|
"/src/unstable-core-do-not-import.ts",
|
|
473
475
|
"/src/unstable-core-do-not-import/http/contentType.ts"
|
|
474
476
|
],
|
|
475
|
-
"percent": 0.
|
|
477
|
+
"percent": 0.78,
|
|
476
478
|
"reduction": 15.08
|
|
477
479
|
},
|
|
478
480
|
{
|
|
@@ -486,7 +488,7 @@
|
|
|
486
488
|
"dependents": [
|
|
487
489
|
"/src/unstable-core-do-not-import.ts"
|
|
488
490
|
],
|
|
489
|
-
"percent": 0.
|
|
491
|
+
"percent": 0.75,
|
|
490
492
|
"reduction": 0
|
|
491
493
|
},
|
|
492
494
|
{
|
|
@@ -521,9 +523,22 @@
|
|
|
521
523
|
"/src/unstable-core-do-not-import/stream/sse.ts",
|
|
522
524
|
"/src/unstable-core-do-not-import/stream/utils/createReadableStream.ts"
|
|
523
525
|
],
|
|
524
|
-
"percent": 0.
|
|
526
|
+
"percent": 0.69,
|
|
525
527
|
"reduction": 15.69
|
|
526
528
|
},
|
|
529
|
+
{
|
|
530
|
+
"id": "/src/adapters/standalone.ts",
|
|
531
|
+
"size": 781,
|
|
532
|
+
"origSize": 1831,
|
|
533
|
+
"renderedExports": [
|
|
534
|
+
"createHTTPHandler",
|
|
535
|
+
"createHTTPServer"
|
|
536
|
+
],
|
|
537
|
+
"removedExports": [],
|
|
538
|
+
"dependents": [],
|
|
539
|
+
"percent": 0.55,
|
|
540
|
+
"reduction": 57.35
|
|
541
|
+
},
|
|
527
542
|
{
|
|
528
543
|
"id": "/src/unstable-core-do-not-import/stream/tracked.ts",
|
|
529
544
|
"size": 780,
|
|
@@ -538,7 +553,7 @@
|
|
|
538
553
|
"/src/unstable-core-do-not-import.ts",
|
|
539
554
|
"/src/unstable-core-do-not-import/stream/sse.ts"
|
|
540
555
|
],
|
|
541
|
-
"percent": 0.
|
|
556
|
+
"percent": 0.55,
|
|
542
557
|
"reduction": 44.37
|
|
543
558
|
},
|
|
544
559
|
{
|
|
@@ -580,7 +595,7 @@
|
|
|
580
595
|
"dependents": [
|
|
581
596
|
"/src/unstable-core-do-not-import.ts"
|
|
582
597
|
],
|
|
583
|
-
"percent": 0.
|
|
598
|
+
"percent": 0.47,
|
|
584
599
|
"reduction": 0.6
|
|
585
600
|
},
|
|
586
601
|
{
|
|
@@ -595,21 +610,22 @@
|
|
|
595
610
|
"/src/unstable-core-do-not-import.ts",
|
|
596
611
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts"
|
|
597
612
|
],
|
|
598
|
-
"percent": 0.
|
|
613
|
+
"percent": 0.44,
|
|
599
614
|
"reduction": 43.49
|
|
600
615
|
},
|
|
601
616
|
{
|
|
602
|
-
"id": "/src/
|
|
603
|
-
"size":
|
|
604
|
-
"origSize":
|
|
617
|
+
"id": "/src/unstable-core-do-not-import/http/toURL.ts",
|
|
618
|
+
"size": 343,
|
|
619
|
+
"origSize": 377,
|
|
605
620
|
"renderedExports": [
|
|
606
|
-
"
|
|
607
|
-
"createHTTPServer"
|
|
621
|
+
"toURL"
|
|
608
622
|
],
|
|
609
623
|
"removedExports": [],
|
|
610
|
-
"dependents": [
|
|
611
|
-
|
|
612
|
-
|
|
624
|
+
"dependents": [
|
|
625
|
+
"/src/unstable-core-do-not-import.ts"
|
|
626
|
+
],
|
|
627
|
+
"percent": 0.24,
|
|
628
|
+
"reduction": 9.02
|
|
613
629
|
},
|
|
614
630
|
{
|
|
615
631
|
"id": "/src/unstable-core-do-not-import/rootConfig.ts",
|
|
@@ -626,18 +642,6 @@
|
|
|
626
642
|
"percent": 0.24,
|
|
627
643
|
"reduction": 89.5
|
|
628
644
|
},
|
|
629
|
-
{
|
|
630
|
-
"id": "/src/adapters/express.ts",
|
|
631
|
-
"size": 280,
|
|
632
|
-
"origSize": 1034,
|
|
633
|
-
"renderedExports": [
|
|
634
|
-
"createExpressMiddleware"
|
|
635
|
-
],
|
|
636
|
-
"removedExports": [],
|
|
637
|
-
"dependents": [],
|
|
638
|
-
"percent": 0.2,
|
|
639
|
-
"reduction": 72.92
|
|
640
|
-
},
|
|
641
645
|
{
|
|
642
646
|
"id": "/src/unstable-core-do-not-import/http/contentTypeParsers.ts",
|
|
643
647
|
"size": 277,
|
|
@@ -652,6 +656,18 @@
|
|
|
652
656
|
"percent": 0.2,
|
|
653
657
|
"reduction": 68.45
|
|
654
658
|
},
|
|
659
|
+
{
|
|
660
|
+
"id": "/src/adapters/express.ts",
|
|
661
|
+
"size": 254,
|
|
662
|
+
"origSize": 1008,
|
|
663
|
+
"renderedExports": [
|
|
664
|
+
"createExpressMiddleware"
|
|
665
|
+
],
|
|
666
|
+
"removedExports": [],
|
|
667
|
+
"dependents": [],
|
|
668
|
+
"percent": 0.18,
|
|
669
|
+
"reduction": 74.8
|
|
670
|
+
},
|
|
655
671
|
{
|
|
656
672
|
"id": "/src/adapters/next-app-dir/notFound.ts",
|
|
657
673
|
"size": 218,
|
|
@@ -663,23 +679,9 @@
|
|
|
663
679
|
"dependents": [
|
|
664
680
|
"/src/adapters/next-app-dir.ts"
|
|
665
681
|
],
|
|
666
|
-
"percent": 0.
|
|
682
|
+
"percent": 0.15,
|
|
667
683
|
"reduction": 36.26
|
|
668
684
|
},
|
|
669
|
-
{
|
|
670
|
-
"id": "/src/unstable-core-do-not-import/http/toURL.ts",
|
|
671
|
-
"size": 158,
|
|
672
|
-
"origSize": 184,
|
|
673
|
-
"renderedExports": [
|
|
674
|
-
"toURL"
|
|
675
|
-
],
|
|
676
|
-
"removedExports": [],
|
|
677
|
-
"dependents": [
|
|
678
|
-
"/src/unstable-core-do-not-import.ts"
|
|
679
|
-
],
|
|
680
|
-
"percent": 0.11,
|
|
681
|
-
"reduction": 14.13
|
|
682
|
-
},
|
|
683
685
|
{
|
|
684
686
|
"id": "/src/unstable-core-do-not-import/procedure.ts",
|
|
685
687
|
"size": 75,
|
|
@@ -718,7 +720,8 @@
|
|
|
718
720
|
"renderedExports": [],
|
|
719
721
|
"removedExports": [],
|
|
720
722
|
"dependents": [
|
|
721
|
-
"/src/adapters/ws.ts"
|
|
723
|
+
"/src/adapters/ws.ts",
|
|
724
|
+
"/src/adapters/node-http/incomingMessageToRequest.ts"
|
|
722
725
|
],
|
|
723
726
|
"percent": 0,
|
|
724
727
|
"reduction": 100
|
|
@@ -760,7 +763,9 @@
|
|
|
760
763
|
"renderedExports": [],
|
|
761
764
|
"removedExports": [],
|
|
762
765
|
"dependents": [
|
|
766
|
+
"/src/adapters/next.ts",
|
|
763
767
|
"/src/adapters/ws.ts",
|
|
768
|
+
"/src/adapters/node-http/nodeHTTPRequestHandler.ts",
|
|
764
769
|
"/src/adapters/next-app-dir/nextAppDirCaller.ts"
|
|
765
770
|
],
|
|
766
771
|
"percent": 0,
|
|
@@ -788,16 +793,6 @@
|
|
|
788
793
|
"percent": 0,
|
|
789
794
|
"reduction": 100
|
|
790
795
|
},
|
|
791
|
-
{
|
|
792
|
-
"id": "/src/adapters/fastify/index.ts",
|
|
793
|
-
"size": 0,
|
|
794
|
-
"origSize": 78,
|
|
795
|
-
"renderedExports": [],
|
|
796
|
-
"removedExports": [],
|
|
797
|
-
"dependents": [],
|
|
798
|
-
"percent": 0,
|
|
799
|
-
"reduction": 100
|
|
800
|
-
},
|
|
801
796
|
{
|
|
802
797
|
"id": "/src/adapters/fetch/index.ts",
|
|
803
798
|
"size": 0,
|
|
@@ -815,13 +810,23 @@
|
|
|
815
810
|
"renderedExports": [],
|
|
816
811
|
"removedExports": [],
|
|
817
812
|
"dependents": [
|
|
818
|
-
"/src/adapters/next.ts",
|
|
819
813
|
"/src/adapters/express.ts",
|
|
814
|
+
"/src/adapters/next.ts",
|
|
820
815
|
"/src/adapters/standalone.ts",
|
|
821
816
|
"/src/adapters/fastify/fastifyRequestHandler.ts"
|
|
822
817
|
],
|
|
823
818
|
"percent": 0,
|
|
824
819
|
"reduction": 100
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
"id": "/src/adapters/fastify/index.ts",
|
|
823
|
+
"size": 0,
|
|
824
|
+
"origSize": 78,
|
|
825
|
+
"renderedExports": [],
|
|
826
|
+
"removedExports": [],
|
|
827
|
+
"dependents": [],
|
|
828
|
+
"percent": 0,
|
|
829
|
+
"reduction": 100
|
|
825
830
|
}
|
|
826
831
|
],
|
|
827
832
|
"moduleCount": 55
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toURL.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/toURL.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toURL.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/toURL.ts"],"names":[],"mappings":"AAEA,wBAAgB,KAAK,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG,CAchD"}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var TRPCError = require('../error/TRPCError.js');
|
|
4
|
+
|
|
3
5
|
function toURL(urlOrPathname) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
try {
|
|
7
|
+
const url = urlOrPathname.startsWith('/') ? `http://127.0.0.1${urlOrPathname}` : urlOrPathname;
|
|
8
|
+
return new URL(url);
|
|
9
|
+
} catch (cause) {
|
|
10
|
+
throw new TRPCError.TRPCError({
|
|
11
|
+
code: 'BAD_REQUEST',
|
|
12
|
+
message: 'Invalid URL',
|
|
13
|
+
cause
|
|
14
|
+
});
|
|
15
|
+
}
|
|
6
16
|
}
|
|
7
17
|
|
|
8
18
|
exports.toURL = toURL;
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
import { TRPCError } from '../error/TRPCError.mjs';
|
|
2
|
+
|
|
1
3
|
function toURL(urlOrPathname) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
+
try {
|
|
5
|
+
const url = urlOrPathname.startsWith('/') ? `http://127.0.0.1${urlOrPathname}` : urlOrPathname;
|
|
6
|
+
return new URL(url);
|
|
7
|
+
} catch (cause) {
|
|
8
|
+
throw new TRPCError({
|
|
9
|
+
code: 'BAD_REQUEST',
|
|
10
|
+
message: 'Invalid URL',
|
|
11
|
+
cause
|
|
12
|
+
});
|
|
13
|
+
}
|
|
4
14
|
}
|
|
5
15
|
|
|
6
16
|
export { toURL };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/server",
|
|
3
|
-
"version": "11.0.0-rc.
|
|
3
|
+
"version": "11.0.0-rc.567+6a4d42917",
|
|
4
4
|
"description": "The tRPC server library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -149,5 +149,5 @@
|
|
|
149
149
|
"funding": [
|
|
150
150
|
"https://trpc.io/sponsor"
|
|
151
151
|
],
|
|
152
|
-
"gitHead": "
|
|
152
|
+
"gitHead": "6a4d4291712c31c98c3375b4ac36266670c27388"
|
|
153
153
|
}
|