@trpc/server 10.45.1-canary.20 → 10.45.1-canary.24
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/fetch/fetchRequestHandler.d.ts.map +1 -1
- package/dist/adapters/fetch/index.js +2 -1
- package/dist/adapters/fetch/index.mjs +2 -1
- package/dist/adapters/standalone.d.ts.map +1 -1
- package/dist/adapters/standalone.js +3 -3
- package/dist/adapters/standalone.mjs +3 -3
- package/dist/bundle-analysis.json +39 -24
- package/dist/http/toURL.d.ts +2 -0
- package/dist/http/toURL.d.ts.map +1 -0
- package/dist/toURL-8f0ea228.mjs +6 -0
- package/dist/toURL-b64256fe.js +8 -0
- package/dist/toURL-eeeff3d1.js +8 -0
- package/package.json +2 -2
- package/src/adapters/fetch/fetchRequestHandler.ts +2 -1
- package/src/adapters/standalone.ts +3 -5
- package/src/http/toURL.ts +7 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchRequestHandler.d.ts","sourceRoot":"","sources":["../../../src/adapters/fetch/fetchRequestHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"fetchRequestHandler.d.ts","sourceRoot":"","sources":["../../../src/adapters/fetch/fetchRequestHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAM5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,MAAM,0BAA0B,CAAC,OAAO,SAAS,SAAS,IAC9D,mBAAmB,CAAC,OAAO,CAAC,GAAG;IAC7B,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AASJ,wBAAsB,mBAAmB,CAAC,OAAO,SAAS,SAAS,EACjE,IAAI,EAAE,0BAA0B,CAAC,OAAO,CAAC,GACxC,OAAO,CAAC,QAAQ,CAAC,CAuGnB"}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
require('../../index-784ff647.js');
|
|
6
6
|
var resolveHTTPResponse = require('../../resolveHTTPResponse-b7a8a1c9.js');
|
|
7
7
|
var batchStreamFormatter = require('../../batchStreamFormatter-93cdcdd4.js');
|
|
8
|
+
var toURL = require('../../toURL-b64256fe.js');
|
|
8
9
|
require('../../codes-87f6824b.js');
|
|
9
10
|
require('../../config-194bdd43.js');
|
|
10
11
|
require('../../TRPCError-ca37bf1a.js');
|
|
@@ -25,7 +26,7 @@ async function fetchRequestHandler(opts) {
|
|
|
25
26
|
resHeaders
|
|
26
27
|
});
|
|
27
28
|
};
|
|
28
|
-
const url =
|
|
29
|
+
const url = toURL.toURL(opts.req.url);
|
|
29
30
|
const pathname = trimSlashes(url.pathname);
|
|
30
31
|
const endpoint = trimSlashes(opts.endpoint);
|
|
31
32
|
const path = trimSlashes(pathname.slice(endpoint.length));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '../../index-f91d720c.mjs';
|
|
2
2
|
import { r as resolveHTTPResponse } from '../../resolveHTTPResponse-2fc435bb.mjs';
|
|
3
3
|
import { g as getBatchStreamFormatter } from '../../batchStreamFormatter-fc1ffb26.mjs';
|
|
4
|
+
import { t as toURL } from '../../toURL-8f0ea228.mjs';
|
|
4
5
|
import '../../codes-c924c3db.mjs';
|
|
5
6
|
import '../../config-d5fdbd39.mjs';
|
|
6
7
|
import '../../TRPCError-98d44758.mjs';
|
|
@@ -21,7 +22,7 @@ async function fetchRequestHandler(opts) {
|
|
|
21
22
|
resHeaders
|
|
22
23
|
});
|
|
23
24
|
};
|
|
24
|
-
const url =
|
|
25
|
+
const url = toURL(opts.req.url);
|
|
25
26
|
const pathname = trimSlashes(url.pathname);
|
|
26
27
|
const endpoint = trimSlashes(opts.endpoint);
|
|
27
28
|
const path = trimSlashes(pathname.slice(endpoint.length));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../../src/adapters/standalone.ts"],"names":[],"mappings":";AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../../src/adapters/standalone.ts"],"names":[],"mappings":";AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,KAAK,EACV,8BAA8B,EAC9B,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAGrB,MAAM,MAAM,wBAAwB,CAAC,OAAO,SAAS,SAAS,IAC5D,sBAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;AAE7E,MAAM,MAAM,wBAAwB,GAAG,8BAA8B,CACnE,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,cAAc,CACpB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,OAAO,SAAS,SAAS,EACzD,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,SAEpB,KAAK,eAAe,OAAO,KAAK,cAAc,mBAelE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,SAAS,SAAS,EACxD,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC;;oBAOrB,MAAM,aAAa,MAAM;;;EAU5C"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var http = require('node:http');
|
|
6
|
+
var toURL = require('../toURL-b64256fe.js');
|
|
6
7
|
var nodeHTTPRequestHandler = require('../nodeHTTPRequestHandler-ad3e4860.js');
|
|
7
8
|
require('../index-784ff647.js');
|
|
8
9
|
require('../codes-87f6824b.js');
|
|
@@ -22,11 +23,10 @@ var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
|
|
|
22
23
|
|
|
23
24
|
function createHTTPHandler(opts) {
|
|
24
25
|
return async (req, res)=>{
|
|
25
|
-
|
|
26
|
-
const href = req.url.startsWith('/') ? `http://127.0.0.1${req.url}` : req.url;
|
|
26
|
+
const url = toURL.toURL(req.url);
|
|
27
27
|
// get procedure path and remove the leading slash
|
|
28
28
|
// /procedure -> procedure
|
|
29
|
-
const path =
|
|
29
|
+
const path = url.pathname.slice(1);
|
|
30
30
|
await nodeHTTPRequestHandler.nodeHTTPRequestHandler({
|
|
31
31
|
// FIXME: no typecasting should be needed here
|
|
32
32
|
...opts,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import http from 'node:http';
|
|
2
|
+
import { t as toURL } from '../toURL-8f0ea228.mjs';
|
|
2
3
|
import { n as nodeHTTPRequestHandler } from '../nodeHTTPRequestHandler-97af83bc.mjs';
|
|
3
4
|
import '../index-f91d720c.mjs';
|
|
4
5
|
import '../codes-c924c3db.mjs';
|
|
@@ -14,11 +15,10 @@ import '../contentType-3194ed5f.mjs';
|
|
|
14
15
|
|
|
15
16
|
function createHTTPHandler(opts) {
|
|
16
17
|
return async (req, res)=>{
|
|
17
|
-
|
|
18
|
-
const href = req.url.startsWith('/') ? `http://127.0.0.1${req.url}` : req.url;
|
|
18
|
+
const url = toURL(req.url);
|
|
19
19
|
// get procedure path and remove the leading slash
|
|
20
20
|
// /procedure -> procedure
|
|
21
|
-
const path =
|
|
21
|
+
const path = url.pathname.slice(1);
|
|
22
22
|
await nodeHTTPRequestHandler({
|
|
23
23
|
// FIXME: no typecasting should be needed here
|
|
24
24
|
...opts,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 41.
|
|
2
|
+
"bundleSize": 115299,
|
|
3
|
+
"bundleOrigSize": 197148,
|
|
4
|
+
"bundleReduction": 41.52,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/adapters/ws.ts",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"dependents": [
|
|
47
47
|
"/src/index.ts"
|
|
48
48
|
],
|
|
49
|
-
"percent": 6.
|
|
49
|
+
"percent": 6.27,
|
|
50
50
|
"reduction": 67.5
|
|
51
51
|
},
|
|
52
52
|
{
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"/src/deprecated/interop.ts",
|
|
93
93
|
"/src/core/initTRPC.ts"
|
|
94
94
|
],
|
|
95
|
-
"percent": 4.
|
|
95
|
+
"percent": 4.87,
|
|
96
96
|
"reduction": 51.74
|
|
97
97
|
},
|
|
98
98
|
{
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"/src/core/internals/mergeRouters.ts",
|
|
111
111
|
"/src/core/initTRPC.ts"
|
|
112
112
|
],
|
|
113
|
-
"percent": 4.
|
|
113
|
+
"percent": 4.47,
|
|
114
114
|
"reduction": 44.93
|
|
115
115
|
},
|
|
116
116
|
{
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"dependents": [
|
|
127
127
|
"/src/adapters/node-http/content-type/form-data/index.ts"
|
|
128
128
|
],
|
|
129
|
-
"percent": 4.
|
|
129
|
+
"percent": 4.28,
|
|
130
130
|
"reduction": 37.24
|
|
131
131
|
},
|
|
132
132
|
{
|
|
@@ -183,8 +183,8 @@
|
|
|
183
183
|
},
|
|
184
184
|
{
|
|
185
185
|
"id": "/src/adapters/fetch/fetchRequestHandler.ts",
|
|
186
|
-
"size":
|
|
187
|
-
"origSize":
|
|
186
|
+
"size": 3182,
|
|
187
|
+
"origSize": 3560,
|
|
188
188
|
"renderedExports": [
|
|
189
189
|
"fetchRequestHandler"
|
|
190
190
|
],
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
"/src/adapters/fetch/index.ts"
|
|
194
194
|
],
|
|
195
195
|
"percent": 2.76,
|
|
196
|
-
"reduction":
|
|
196
|
+
"reduction": 10.62
|
|
197
197
|
},
|
|
198
198
|
{
|
|
199
199
|
"id": "/src/adapters/aws-lambda/utils.ts",
|
|
@@ -284,7 +284,7 @@
|
|
|
284
284
|
"dependents": [
|
|
285
285
|
"/src/observable/index.ts"
|
|
286
286
|
],
|
|
287
|
-
"percent": 1.
|
|
287
|
+
"percent": 1.6,
|
|
288
288
|
"reduction": 6.8
|
|
289
289
|
},
|
|
290
290
|
{
|
|
@@ -521,29 +521,29 @@
|
|
|
521
521
|
"reduction": 23.99
|
|
522
522
|
},
|
|
523
523
|
{
|
|
524
|
-
"id": "/src/
|
|
525
|
-
"size":
|
|
526
|
-
"origSize":
|
|
524
|
+
"id": "/src/subscription.ts",
|
|
525
|
+
"size": 903,
|
|
526
|
+
"origSize": 1201,
|
|
527
527
|
"renderedExports": [
|
|
528
|
-
"
|
|
529
|
-
"createHTTPServer"
|
|
528
|
+
"subscriptionPullFactory"
|
|
530
529
|
],
|
|
531
530
|
"removedExports": [],
|
|
532
531
|
"dependents": [],
|
|
533
|
-
"percent": 0.
|
|
534
|
-
"reduction":
|
|
532
|
+
"percent": 0.78,
|
|
533
|
+
"reduction": 24.81
|
|
535
534
|
},
|
|
536
535
|
{
|
|
537
|
-
"id": "/src/
|
|
538
|
-
"size":
|
|
539
|
-
"origSize":
|
|
536
|
+
"id": "/src/adapters/standalone.ts",
|
|
537
|
+
"size": 897,
|
|
538
|
+
"origSize": 1618,
|
|
540
539
|
"renderedExports": [
|
|
541
|
-
"
|
|
540
|
+
"createHTTPHandler",
|
|
541
|
+
"createHTTPServer"
|
|
542
542
|
],
|
|
543
543
|
"removedExports": [],
|
|
544
544
|
"dependents": [],
|
|
545
545
|
"percent": 0.78,
|
|
546
|
-
"reduction":
|
|
546
|
+
"reduction": 44.56
|
|
547
547
|
},
|
|
548
548
|
{
|
|
549
549
|
"id": "/src/shared/transformTRPCResponse.ts",
|
|
@@ -801,6 +801,21 @@
|
|
|
801
801
|
"percent": 0.15,
|
|
802
802
|
"reduction": 25.74
|
|
803
803
|
},
|
|
804
|
+
{
|
|
805
|
+
"id": "/src/http/toURL.ts",
|
|
806
|
+
"size": 158,
|
|
807
|
+
"origSize": 184,
|
|
808
|
+
"renderedExports": [
|
|
809
|
+
"toURL"
|
|
810
|
+
],
|
|
811
|
+
"removedExports": [],
|
|
812
|
+
"dependents": [
|
|
813
|
+
"/src/adapters/standalone.ts",
|
|
814
|
+
"/src/adapters/fetch/fetchRequestHandler.ts"
|
|
815
|
+
],
|
|
816
|
+
"percent": 0.14,
|
|
817
|
+
"reduction": 14.13
|
|
818
|
+
},
|
|
804
819
|
{
|
|
805
820
|
"id": "/src/error/utils.ts",
|
|
806
821
|
"size": 157,
|
|
@@ -1008,5 +1023,5 @@
|
|
|
1008
1023
|
"reduction": 100
|
|
1009
1024
|
}
|
|
1010
1025
|
],
|
|
1011
|
-
"moduleCount":
|
|
1026
|
+
"moduleCount": 68
|
|
1012
1027
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toURL.d.ts","sourceRoot":"","sources":["../../src/http/toURL.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG,CAMhD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/server",
|
|
3
|
-
"version": "10.45.1-canary.
|
|
3
|
+
"version": "10.45.1-canary.24+3bdb43bde",
|
|
4
4
|
"description": "The tRPC server library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -173,5 +173,5 @@
|
|
|
173
173
|
"funding": [
|
|
174
174
|
"https://trpc.io/sponsor"
|
|
175
175
|
],
|
|
176
|
-
"gitHead": "
|
|
176
|
+
"gitHead": "3bdb43bdeb3f02850a67048ae2cf9b6be69b9ede"
|
|
177
177
|
}
|
|
@@ -3,6 +3,7 @@ import type { HTTPRequest } from '../../http';
|
|
|
3
3
|
import { getBatchStreamFormatter } from '../../http';
|
|
4
4
|
import type { HTTPResponse, ResponseChunk } from '../../http/internals/types';
|
|
5
5
|
import { resolveHTTPResponse } from '../../http/resolveHTTPResponse';
|
|
6
|
+
import { toURL } from '../../http/toURL';
|
|
6
7
|
import type { FetchHandlerOptions } from './types';
|
|
7
8
|
|
|
8
9
|
export type FetchHandlerRequestOptions<TRouter extends AnyRouter> =
|
|
@@ -27,7 +28,7 @@ export async function fetchRequestHandler<TRouter extends AnyRouter>(
|
|
|
27
28
|
return opts.createContext?.({ req: opts.req, resHeaders });
|
|
28
29
|
};
|
|
29
30
|
|
|
30
|
-
const url =
|
|
31
|
+
const url = toURL(opts.req.url);
|
|
31
32
|
|
|
32
33
|
const pathname = trimSlashes(url.pathname);
|
|
33
34
|
const endpoint = trimSlashes(opts.endpoint);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
2
|
import http from 'http';
|
|
3
3
|
import type { AnyRouter } from '../core';
|
|
4
|
+
import { toURL } from '../http/toURL';
|
|
4
5
|
import type {
|
|
5
6
|
NodeHTTPCreateContextFnOptions,
|
|
6
7
|
NodeHTTPHandlerOptions,
|
|
@@ -19,14 +20,11 @@ export function createHTTPHandler<TRouter extends AnyRouter>(
|
|
|
19
20
|
opts: CreateHTTPHandlerOptions<TRouter>,
|
|
20
21
|
) {
|
|
21
22
|
return async (req: http.IncomingMessage, res: http.ServerResponse) => {
|
|
22
|
-
|
|
23
|
-
const href = req.url!.startsWith('/')
|
|
24
|
-
? `http://127.0.0.1${req.url}`
|
|
25
|
-
: req.url!;
|
|
23
|
+
const url = toURL(req.url!);
|
|
26
24
|
|
|
27
25
|
// get procedure path and remove the leading slash
|
|
28
26
|
// /procedure -> procedure
|
|
29
|
-
const path =
|
|
27
|
+
const path = url.pathname.slice(1);
|
|
30
28
|
|
|
31
29
|
await nodeHTTPRequestHandler({
|
|
32
30
|
// FIXME: no typecasting should be needed here
|