what-server 0.12.0 → 0.12.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.
- package/node.d.ts +55 -0
- package/package.json +5 -4
package/node.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// what-server/node — declarations for the package's `node` export condition
|
|
2
|
+
// (src/node.js). These entry points import node:http and node:fs, so they exist
|
|
3
|
+
// only under Node. Declaring them in index.d.ts instead would promise every
|
|
4
|
+
// browser and edge consumer six functions their runtime does not have.
|
|
5
|
+
|
|
6
|
+
export * from './index.js';
|
|
7
|
+
import type { RequestHandlerOptions, RenderRequestContext, DocumentOptions } from './index.js';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/** Convert a Web-Fetch handler into a Node (req, res) listener. */
|
|
11
|
+
export function toNodeListener(
|
|
12
|
+
handler: (request: Request) => Promise<Response> | Response,
|
|
13
|
+
): (req: any, res: any) => Promise<void>;
|
|
14
|
+
|
|
15
|
+
/** connect/express middleware. Calls next() on a 404 so other routes can answer. */
|
|
16
|
+
export function whatMiddleware(options?: RequestHandlerOptions): (req: any, res: any, next?: () => void) => Promise<void>;
|
|
17
|
+
|
|
18
|
+
/** A ready-to-listen node:http server. Starts `scheduler` and stops it on SIGTERM/SIGINT. */
|
|
19
|
+
// Structural, not `import('node:http').Server`. Referencing a Node builtin here
|
|
20
|
+
// would make @types/node a hard requirement for every consumer of what-server,
|
|
21
|
+
// including the browser and edge ones that never touch this entry point. The
|
|
22
|
+
// runtime value IS an http.Server; this types what callers actually do with it.
|
|
23
|
+
export interface NodeHttpServer {
|
|
24
|
+
listen(...args: any[]): NodeHttpServer;
|
|
25
|
+
close(callback?: (err?: Error) => void): NodeHttpServer;
|
|
26
|
+
address(): string | { address: string; family: string; port: number } | null;
|
|
27
|
+
on(event: string, listener: (...args: any[]) => void): NodeHttpServer;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function createServer(options?: RequestHandlerOptions & { scheduler?: { start(): void; stop(): void } }): NodeHttpServer;
|
|
31
|
+
|
|
32
|
+
/** Vercel Functions entry: a Web-Fetch handler. */
|
|
33
|
+
export function createVercelHandler(options?: RequestHandlerOptions): (request: Request) => Promise<Response>;
|
|
34
|
+
|
|
35
|
+
export interface VercelOutputOptions {
|
|
36
|
+
outDir?: string;
|
|
37
|
+
functionName?: string;
|
|
38
|
+
runtime?: string;
|
|
39
|
+
files?: Record<string, string> | null;
|
|
40
|
+
handler?: string;
|
|
41
|
+
staticDir?: string | null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Write a Vercel Build Output API v3 directory. */
|
|
45
|
+
export function buildVercelOutput(options?: VercelOutputOptions): Promise<{ outDir: string; written: string[] }>;
|
|
46
|
+
|
|
47
|
+
export interface ExportStaticOptions {
|
|
48
|
+
routes?: any[];
|
|
49
|
+
outDir: string;
|
|
50
|
+
render?: (pageModule: any, reqCtx: RenderRequestContext) => Promise<string> | string;
|
|
51
|
+
documentOptions?: DocumentOptions;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Pre-render every `static` and `hybrid` route to files under `outDir`. */
|
|
55
|
+
export function exportStatic(options?: ExportStaticOptions): Promise<string[]>;
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "what-server",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
4
4
|
"description": "What Framework - SSR, islands architecture, static generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"types": "index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"types": "./index.d.ts",
|
|
11
10
|
"node": {
|
|
12
11
|
"types": "./node.d.ts",
|
|
13
12
|
"production": "./dist/node.min.js",
|
|
14
13
|
"import": "./src/node.js",
|
|
15
14
|
"default": "./src/node.js"
|
|
16
15
|
},
|
|
16
|
+
"types": "./index.d.ts",
|
|
17
17
|
"production": "./dist/index.min.js",
|
|
18
18
|
"import": "./src/index.js",
|
|
19
19
|
"default": "./src/index.js"
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"src",
|
|
35
35
|
"dist/**/*.min.js",
|
|
36
36
|
"index.d.ts",
|
|
37
|
+
"node.d.ts",
|
|
37
38
|
"islands.d.ts"
|
|
38
39
|
],
|
|
39
40
|
"sideEffects": [
|
|
@@ -50,8 +51,8 @@
|
|
|
50
51
|
"author": "ZVN DEV (https://zvndev.com)",
|
|
51
52
|
"license": "MIT",
|
|
52
53
|
"peerDependencies": {
|
|
53
|
-
"what-core": "^0.12.
|
|
54
|
-
"what-router": "^0.12.
|
|
54
|
+
"what-core": "^0.12.2",
|
|
55
|
+
"what-router": "^0.12.2"
|
|
55
56
|
},
|
|
56
57
|
"peerDependenciesMeta": {
|
|
57
58
|
"what-router": {
|