@kubun/plugin-http-api 0.16.0 → 0.18.0

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.
Files changed (2) hide show
  1. package/lib/index.d.ts +7 -2
  2. package/package.json +3 -3
package/lib/index.d.ts CHANGED
@@ -1,8 +1,13 @@
1
+ export type HTTPProtocolHandlerContext = {
2
+ localAddress: string | null;
3
+ remoteAddress: string | null;
4
+ secure: boolean;
5
+ };
1
6
  export type HTTPPluginAPI = {
2
7
  /** Resolves when the HTTP server is accepting connections. */
3
8
  listening: Promise<void>;
4
- registerRoute: (method: string, path: string, handler: (c: unknown) => unknown) => void;
5
- registerProtocol: (name: string, fetch: (req: Request) => Response | Promise<Response>) => void;
9
+ registerRoute: (method: string, path: string, handler: (c: unknown, context: HTTPProtocolHandlerContext) => unknown) => void;
10
+ registerProtocol: (name: string, fetch: (req: Request, context: HTTPProtocolHandlerContext) => Response | Promise<Response>) => void;
6
11
  getPort: () => number;
7
12
  getURL: () => string;
8
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubun/plugin-http-api",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "keywords": [],
5
5
  "license": "see LICENSE.md",
6
6
  "sideEffects": false,
@@ -20,8 +20,8 @@
20
20
  "scripts": {
21
21
  "build": "pnpm run build:clean && pnpm run build:js && pnpm run build:types",
22
22
  "build:clean": "del lib",
23
- "build:js": "swc src -d ./lib --config-file ../../node_modules/@kigu/dev/swc.json --strip-leading-paths",
24
- "build:types": "tsc --emitDeclarationOnly --skipLibCheck",
23
+ "build:js": "del 'lib/**/*.js' && swc src -d ./lib --config-file ../../node_modules/@kigu/dev/swc.json --strip-leading-paths",
24
+ "build:types": "del 'lib/**/*.d.ts' 'lib/**/*.d.ts.map' && tsc --emitDeclarationOnly --skipLibCheck",
25
25
  "build:types:ci": "tsc --emitDeclarationOnly --declarationMap false",
26
26
  "test": "pnpm run test:types",
27
27
  "test:types": "tsc --noEmit --skipLibCheck"