@vercube/h3 0.0.3 → 0.0.5
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/index.d.mts +30 -0
- package/dist/index.mjs +1 -1
- package/package.json +4 -11
- package/dist/index.cjs +0 -58
- package/dist/index.d.ts +0 -25
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { App } from "@vercube/core";
|
|
2
|
+
import { EventHandler } from "h3";
|
|
3
|
+
|
|
4
|
+
//#region src/index.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Converts a Vercube application to an H3 event handler
|
|
8
|
+
*
|
|
9
|
+
* This adapter allows Vercube applications to be integrated with H3 servers by converting
|
|
10
|
+
* the Vercube request handling pipeline into an H3-compatible event handler.
|
|
11
|
+
*
|
|
12
|
+
* @param {App} app - The Vercube application instance to adapt
|
|
13
|
+
* @returns {EventHandler} An H3 event handler that processes requests through the Vercube app
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { createApp } from '@vercube/core'
|
|
18
|
+
* import { toH3 } from '@vercube/h3'
|
|
19
|
+
* import { H3 } from 'h3'
|
|
20
|
+
*
|
|
21
|
+
* const h3app = new H3()
|
|
22
|
+
* const app = await createApp()
|
|
23
|
+
*
|
|
24
|
+
* // Mount Vercube app at /api path
|
|
25
|
+
* h3app.all('/api/**', toH3(app))
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
declare function toH3(app: App): EventHandler;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { toH3 };
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercube/h3",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "H3 module for Vercube framework",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,24 +9,17 @@
|
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"sideEffects": false,
|
|
12
|
-
"type": "module",
|
|
13
12
|
"exports": {
|
|
14
|
-
".":
|
|
15
|
-
"types": "./dist/index.d.ts",
|
|
16
|
-
"import": "./dist/index.mjs",
|
|
17
|
-
"require": "./dist/index.cjs"
|
|
18
|
-
}
|
|
13
|
+
".": "./dist/index.mjs"
|
|
19
14
|
},
|
|
20
|
-
"
|
|
21
|
-
"module": "./dist/index.mjs",
|
|
22
|
-
"types": "./dist/index.d.ts",
|
|
15
|
+
"types": "./dist/index.d.mts",
|
|
23
16
|
"files": [
|
|
24
17
|
"dist",
|
|
25
18
|
"README.md"
|
|
26
19
|
],
|
|
27
20
|
"dependencies": {
|
|
28
21
|
"h3": "npm:h3-nightly@2x",
|
|
29
|
-
"@vercube/core": "0.0.
|
|
22
|
+
"@vercube/core": "0.0.5"
|
|
30
23
|
},
|
|
31
24
|
"publishConfig": {
|
|
32
25
|
"access": "public"
|
package/dist/index.cjs
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//#region rolldown:runtime
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
-
get: ((k) => from[k]).bind(null, key),
|
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
-
value: mod,
|
|
21
|
-
enumerable: true
|
|
22
|
-
}) : target, mod));
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
const __vercube_core = __toESM(require("@vercube/core"));
|
|
26
|
-
|
|
27
|
-
//#region packages/h3/src/index.ts
|
|
28
|
-
/**
|
|
29
|
-
* Converts a Vercube application to an H3 event handler
|
|
30
|
-
*
|
|
31
|
-
* This adapter allows Vercube applications to be integrated with H3 servers by converting
|
|
32
|
-
* the Vercube request handling pipeline into an H3-compatible event handler.
|
|
33
|
-
*
|
|
34
|
-
* @param {App} app - The Vercube application instance to adapt
|
|
35
|
-
* @returns {EventHandler} An H3 event handler that processes requests through the Vercube app
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```ts
|
|
39
|
-
* import { createApp } from '@vercube/core'
|
|
40
|
-
* import { toH3 } from '@vercube/h3'
|
|
41
|
-
* import { H3 } from 'h3'
|
|
42
|
-
*
|
|
43
|
-
* const h3app = new H3()
|
|
44
|
-
* const app = await createApp()
|
|
45
|
-
*
|
|
46
|
-
* // Mount Vercube app at /api path
|
|
47
|
-
* h3app.all('/api/**', toH3(app))
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
function toH3(app) {
|
|
51
|
-
return (event) => {
|
|
52
|
-
const server = app.container.get(__vercube_core.HttpServer);
|
|
53
|
-
return server.handleRequest(event.req);
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
//#endregion
|
|
58
|
-
exports.toH3 = toH3
|
package/dist/index.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type App } from "@vercube/core";
|
|
2
|
-
import { type EventHandler } from "h3";
|
|
3
|
-
/**
|
|
4
|
-
* Converts a Vercube application to an H3 event handler
|
|
5
|
-
*
|
|
6
|
-
* This adapter allows Vercube applications to be integrated with H3 servers by converting
|
|
7
|
-
* the Vercube request handling pipeline into an H3-compatible event handler.
|
|
8
|
-
*
|
|
9
|
-
* @param {App} app - The Vercube application instance to adapt
|
|
10
|
-
* @returns {EventHandler} An H3 event handler that processes requests through the Vercube app
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* import { createApp } from '@vercube/core'
|
|
15
|
-
* import { toH3 } from '@vercube/h3'
|
|
16
|
-
* import { H3 } from 'h3'
|
|
17
|
-
*
|
|
18
|
-
* const h3app = new H3()
|
|
19
|
-
* const app = await createApp()
|
|
20
|
-
*
|
|
21
|
-
* // Mount Vercube app at /api path
|
|
22
|
-
* h3app.all('/api/**', toH3(app))
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare function toH3(app: App): EventHandler;
|