@tanstack/start-server-core 1.120.4-alpha.2 → 1.120.4-alpha.21
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/cjs/createStartHandler.cjs +26 -9
- package/dist/cjs/createStartHandler.cjs.map +1 -1
- package/dist/cjs/index.cjs +0 -3
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +0 -1
- package/dist/cjs/server-functions-handler.cjs +1 -10
- package/dist/cjs/server-functions-handler.cjs.map +1 -1
- package/dist/cjs/server-functions-handler.d.cts +0 -1
- package/dist/cjs/serverRoute.cjs.map +1 -1
- package/dist/cjs/serverRoute.d.cts +1 -1
- package/dist/cjs/ssr-server.cjs +3 -2
- package/dist/cjs/ssr-server.cjs.map +1 -1
- package/dist/esm/createStartHandler.js +27 -10
- package/dist/esm/createStartHandler.js.map +1 -1
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +0 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/server-functions-handler.d.ts +0 -1
- package/dist/esm/server-functions-handler.js +1 -10
- package/dist/esm/server-functions-handler.js.map +1 -1
- package/dist/esm/serverRoute.d.ts +1 -1
- package/dist/esm/serverRoute.js.map +1 -1
- package/dist/esm/ssr-server.js +3 -2
- package/dist/esm/ssr-server.js.map +1 -1
- package/package.json +3 -4
- package/src/createStartHandler.ts +31 -13
- package/src/index.tsx +0 -2
- package/src/server-functions-handler.ts +3 -16
- package/src/serverRoute.ts +1 -1
- package/src/ssr-server.ts +2 -0
- package/dist/cjs/undici.cjs +0 -14
- package/dist/cjs/undici.cjs.map +0 -1
- package/dist/cjs/undici.d.cts +0 -43
- package/dist/esm/undici.d.ts +0 -43
- package/dist/esm/undici.js +0 -14
- package/dist/esm/undici.js.map +0 -1
- package/src/undici.ts +0 -60
package/dist/cjs/undici.d.cts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { setGlobalOrigin } from 'undici';
|
|
2
|
-
/**
|
|
3
|
-
* DO NOT USE THIS FUNCTION. THIS FUNCTION IS FOR INTERNAL USE ONLY.
|
|
4
|
-
*
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare const __setGlobalOrigin: typeof setGlobalOrigin;
|
|
8
|
-
/**
|
|
9
|
-
* DO NOT USE THIS FUNCTION. THIS FUNCTION IS FOR INTERNAL USE ONLY.
|
|
10
|
-
*
|
|
11
|
-
* Constructs an absolute URL from the given request object and options.
|
|
12
|
-
*
|
|
13
|
-
* @internal
|
|
14
|
-
* @param req - The `Request` object containing the headers to extract the host and protocol.
|
|
15
|
-
* @param options - Configuration options for determining the trust level of proxy headers.
|
|
16
|
-
* @param options.trustProxy - If `true`, the function will trust the `x-forwarded-host` and `x-forwarded-proto` headers
|
|
17
|
-
* to determine the host and protocol. Defaults to `false`.
|
|
18
|
-
* @returns The absolute URL constructed from the request headers as a string.
|
|
19
|
-
* @throws Will throw an error if the `host` cannot be determined from the request headers.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```ts
|
|
23
|
-
* // Example usage:
|
|
24
|
-
* const req = new Request('http://example.com', {
|
|
25
|
-
* headers: {
|
|
26
|
-
* 'host': 'example.com',
|
|
27
|
-
* 'x-forwarded-host': 'proxy.example.com',
|
|
28
|
-
* 'x-forwarded-proto': 'https',
|
|
29
|
-
* },
|
|
30
|
-
* });
|
|
31
|
-
*
|
|
32
|
-
* // Without trusting proxy headers
|
|
33
|
-
* const url1 = getAbsoluteUrl(req);
|
|
34
|
-
* console.log(url1); // Output: "http://example.com"
|
|
35
|
-
*
|
|
36
|
-
* // With trusting proxy headers
|
|
37
|
-
* const url2 = getAbsoluteUrl(req, { trustProxy: true });
|
|
38
|
-
* console.log(url2); // Output: "https://proxy.example.com"
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare function __getAbsoluteUrl(req: Request, options?: {
|
|
42
|
-
trustProxy: boolean;
|
|
43
|
-
}): string;
|
package/dist/esm/undici.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { setGlobalOrigin } from 'undici';
|
|
2
|
-
/**
|
|
3
|
-
* DO NOT USE THIS FUNCTION. THIS FUNCTION IS FOR INTERNAL USE ONLY.
|
|
4
|
-
*
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare const __setGlobalOrigin: typeof setGlobalOrigin;
|
|
8
|
-
/**
|
|
9
|
-
* DO NOT USE THIS FUNCTION. THIS FUNCTION IS FOR INTERNAL USE ONLY.
|
|
10
|
-
*
|
|
11
|
-
* Constructs an absolute URL from the given request object and options.
|
|
12
|
-
*
|
|
13
|
-
* @internal
|
|
14
|
-
* @param req - The `Request` object containing the headers to extract the host and protocol.
|
|
15
|
-
* @param options - Configuration options for determining the trust level of proxy headers.
|
|
16
|
-
* @param options.trustProxy - If `true`, the function will trust the `x-forwarded-host` and `x-forwarded-proto` headers
|
|
17
|
-
* to determine the host and protocol. Defaults to `false`.
|
|
18
|
-
* @returns The absolute URL constructed from the request headers as a string.
|
|
19
|
-
* @throws Will throw an error if the `host` cannot be determined from the request headers.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```ts
|
|
23
|
-
* // Example usage:
|
|
24
|
-
* const req = new Request('http://example.com', {
|
|
25
|
-
* headers: {
|
|
26
|
-
* 'host': 'example.com',
|
|
27
|
-
* 'x-forwarded-host': 'proxy.example.com',
|
|
28
|
-
* 'x-forwarded-proto': 'https',
|
|
29
|
-
* },
|
|
30
|
-
* });
|
|
31
|
-
*
|
|
32
|
-
* // Without trusting proxy headers
|
|
33
|
-
* const url1 = getAbsoluteUrl(req);
|
|
34
|
-
* console.log(url1); // Output: "http://example.com"
|
|
35
|
-
*
|
|
36
|
-
* // With trusting proxy headers
|
|
37
|
-
* const url2 = getAbsoluteUrl(req, { trustProxy: true });
|
|
38
|
-
* console.log(url2); // Output: "https://proxy.example.com"
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare function __getAbsoluteUrl(req: Request, options?: {
|
|
42
|
-
trustProxy: boolean;
|
|
43
|
-
}): string;
|
package/dist/esm/undici.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { setGlobalOrigin } from "undici";
|
|
2
|
-
const __setGlobalOrigin = setGlobalOrigin;
|
|
3
|
-
function __getAbsoluteUrl(req, options = { trustProxy: false }) {
|
|
4
|
-
const headers = req.headers;
|
|
5
|
-
const host = options.trustProxy ? headers.get("x-forwarded-host") || headers.get("host") : headers.get("host");
|
|
6
|
-
const protocol = options.trustProxy ? headers.get("x-forwarded-proto") || "http" : "http";
|
|
7
|
-
if (!host) throw new Error("Cannot determine host from request headers");
|
|
8
|
-
return `${protocol}://${host}`;
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
__getAbsoluteUrl,
|
|
12
|
-
__setGlobalOrigin
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=undici.js.map
|
package/dist/esm/undici.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"undici.js","sources":["../../src/undici.ts"],"sourcesContent":["import { setGlobalOrigin } from 'undici'\n\n/**\n * DO NOT USE THIS FUNCTION. THIS FUNCTION IS FOR INTERNAL USE ONLY.\n *\n * @internal\n */\nexport const __setGlobalOrigin = setGlobalOrigin\n\n/**\n * DO NOT USE THIS FUNCTION. THIS FUNCTION IS FOR INTERNAL USE ONLY.\n *\n * Constructs an absolute URL from the given request object and options.\n *\n * @internal\n * @param req - The `Request` object containing the headers to extract the host and protocol.\n * @param options - Configuration options for determining the trust level of proxy headers.\n * @param options.trustProxy - If `true`, the function will trust the `x-forwarded-host` and `x-forwarded-proto` headers\n * to determine the host and protocol. Defaults to `false`.\n * @returns The absolute URL constructed from the request headers as a string.\n * @throws Will throw an error if the `host` cannot be determined from the request headers.\n *\n * @example\n * ```ts\n * // Example usage:\n * const req = new Request('http://example.com', {\n * headers: {\n * 'host': 'example.com',\n * 'x-forwarded-host': 'proxy.example.com',\n * 'x-forwarded-proto': 'https',\n * },\n * });\n *\n * // Without trusting proxy headers\n * const url1 = getAbsoluteUrl(req);\n * console.log(url1); // Output: \"http://example.com\"\n *\n * // With trusting proxy headers\n * const url2 = getAbsoluteUrl(req, { trustProxy: true });\n * console.log(url2); // Output: \"https://proxy.example.com\"\n * ```\n */\nexport function __getAbsoluteUrl(\n req: Request,\n options: { trustProxy: boolean } = { trustProxy: false },\n): string {\n const headers = req.headers\n\n const host = options.trustProxy\n ? headers.get('x-forwarded-host') || headers.get('host')\n : headers.get('host')\n\n const protocol = options.trustProxy\n ? headers.get('x-forwarded-proto') || 'http'\n : 'http'\n\n if (!host) throw new Error('Cannot determine host from request headers')\n\n return `${protocol}://${host}`\n}\n"],"names":[],"mappings":";AAOO,MAAM,oBAAoB;AAmC1B,SAAS,iBACd,KACA,UAAmC,EAAE,YAAY,SACzC;AACR,QAAM,UAAU,IAAI;AAEpB,QAAM,OAAO,QAAQ,aACjB,QAAQ,IAAI,kBAAkB,KAAK,QAAQ,IAAI,MAAM,IACrD,QAAQ,IAAI,MAAM;AAEtB,QAAM,WAAW,QAAQ,aACrB,QAAQ,IAAI,mBAAmB,KAAK,SACpC;AAEJ,MAAI,CAAC,KAAY,OAAA,IAAI,MAAM,4CAA4C;AAEhE,SAAA,GAAG,QAAQ,MAAM,IAAI;AAC9B;"}
|
package/src/undici.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { setGlobalOrigin } from 'undici'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* DO NOT USE THIS FUNCTION. THIS FUNCTION IS FOR INTERNAL USE ONLY.
|
|
5
|
-
*
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export const __setGlobalOrigin = setGlobalOrigin
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* DO NOT USE THIS FUNCTION. THIS FUNCTION IS FOR INTERNAL USE ONLY.
|
|
12
|
-
*
|
|
13
|
-
* Constructs an absolute URL from the given request object and options.
|
|
14
|
-
*
|
|
15
|
-
* @internal
|
|
16
|
-
* @param req - The `Request` object containing the headers to extract the host and protocol.
|
|
17
|
-
* @param options - Configuration options for determining the trust level of proxy headers.
|
|
18
|
-
* @param options.trustProxy - If `true`, the function will trust the `x-forwarded-host` and `x-forwarded-proto` headers
|
|
19
|
-
* to determine the host and protocol. Defaults to `false`.
|
|
20
|
-
* @returns The absolute URL constructed from the request headers as a string.
|
|
21
|
-
* @throws Will throw an error if the `host` cannot be determined from the request headers.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```ts
|
|
25
|
-
* // Example usage:
|
|
26
|
-
* const req = new Request('http://example.com', {
|
|
27
|
-
* headers: {
|
|
28
|
-
* 'host': 'example.com',
|
|
29
|
-
* 'x-forwarded-host': 'proxy.example.com',
|
|
30
|
-
* 'x-forwarded-proto': 'https',
|
|
31
|
-
* },
|
|
32
|
-
* });
|
|
33
|
-
*
|
|
34
|
-
* // Without trusting proxy headers
|
|
35
|
-
* const url1 = getAbsoluteUrl(req);
|
|
36
|
-
* console.log(url1); // Output: "http://example.com"
|
|
37
|
-
*
|
|
38
|
-
* // With trusting proxy headers
|
|
39
|
-
* const url2 = getAbsoluteUrl(req, { trustProxy: true });
|
|
40
|
-
* console.log(url2); // Output: "https://proxy.example.com"
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
export function __getAbsoluteUrl(
|
|
44
|
-
req: Request,
|
|
45
|
-
options: { trustProxy: boolean } = { trustProxy: false },
|
|
46
|
-
): string {
|
|
47
|
-
const headers = req.headers
|
|
48
|
-
|
|
49
|
-
const host = options.trustProxy
|
|
50
|
-
? headers.get('x-forwarded-host') || headers.get('host')
|
|
51
|
-
: headers.get('host')
|
|
52
|
-
|
|
53
|
-
const protocol = options.trustProxy
|
|
54
|
-
? headers.get('x-forwarded-proto') || 'http'
|
|
55
|
-
: 'http'
|
|
56
|
-
|
|
57
|
-
if (!host) throw new Error('Cannot determine host from request headers')
|
|
58
|
-
|
|
59
|
-
return `${protocol}://${host}`
|
|
60
|
-
}
|