@vercube/h3 0.0.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/LICENSE +21 -0
- package/README.md +55 -0
- package/dist/index.cjs +58 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.mjs +34 -0
- package/package.json +34 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-present - Vercube
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://vercube.dev/"><img src="https://github.com/OskarLebuda/vue-lazy-hydration/raw/main/.github/assets/logo.png?raw=true" alt="Vite logo" width="200"></a>
|
|
3
|
+
<br>
|
|
4
|
+
<br>
|
|
5
|
+
|
|
6
|
+
# Vercube
|
|
7
|
+
|
|
8
|
+
Next generation HTTP framework
|
|
9
|
+
|
|
10
|
+
<a href="https://www.npmjs.com/package/@vercube/h3">
|
|
11
|
+
<img src="https://img.shields.io/npm/v/%40vercube%2Fh3?style=for-the-badge&logo=npm&color=%23767eff" alt="npm"/>
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@vercube/h3">
|
|
14
|
+
<img src="https://img.shields.io/npm/dm/%40vercube%2Fh3?style=for-the-badge&logo=npm&color=%23767eff" alt="npm"/>
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://github.com/vercube/vercube/blob/main/LICENSE" target="_blank">
|
|
17
|
+
<img src="https://img.shields.io/npm/l/%40vercube%2Fdi?style=for-the-badge&color=%23767eff" alt="License"/>
|
|
18
|
+
</a>
|
|
19
|
+
<br/>
|
|
20
|
+
<br/>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
An ultra-efficient JavaScript server framework that runs anywhere - Node.js, Bun, or Deno - with unmatched flexibility and complete configurability for developers who refuse to sacrifice speed or control.
|
|
24
|
+
|
|
25
|
+
## <a name="module">H3 Module</a>
|
|
26
|
+
The H3 module provides integration between Vercube applications and the H3 HTTP framework.
|
|
27
|
+
It allows you to:
|
|
28
|
+
|
|
29
|
+
- Mount Vercube applications on [H3](https://h3.dev) server
|
|
30
|
+
- Use H3's routing capabilities with Vercube's application logic
|
|
31
|
+
- Integrate Vercube with other H3-based frameworks
|
|
32
|
+
|
|
33
|
+
### Basic Usage
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { createApp } from '@vercube/core';
|
|
37
|
+
import { toH3 } from '@vercube/h3';
|
|
38
|
+
import { H3, serve } from 'h3';
|
|
39
|
+
|
|
40
|
+
// Create Vercube app
|
|
41
|
+
const app = await createApp();
|
|
42
|
+
|
|
43
|
+
// Create H3 server
|
|
44
|
+
const h3app = new H3();
|
|
45
|
+
|
|
46
|
+
// Mount Vercube app at /api path
|
|
47
|
+
h3app.all('/api/**', toH3(app));
|
|
48
|
+
|
|
49
|
+
// Start the server
|
|
50
|
+
await serve(h3app, { port: 3000 });
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## <a name="documentation">📖 Documentation</a>
|
|
55
|
+
Comprehensive documentation is available at [vercube.dev](https://vercube.dev). There you'll find detailed module descriptions, project information, guides, and everything else you need to know about Vercube.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { HttpServer } from "@vercube/core";
|
|
2
|
+
|
|
3
|
+
//#region packages/h3/src/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* Converts a Vercube application to an H3 event handler
|
|
6
|
+
*
|
|
7
|
+
* This adapter allows Vercube applications to be integrated with H3 servers by converting
|
|
8
|
+
* the Vercube request handling pipeline into an H3-compatible event handler.
|
|
9
|
+
*
|
|
10
|
+
* @param {App} app - The Vercube application instance to adapt
|
|
11
|
+
* @returns {EventHandler} An H3 event handler that processes requests through the Vercube app
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { createApp } from '@vercube/core'
|
|
16
|
+
* import { toH3 } from '@vercube/h3'
|
|
17
|
+
* import { H3 } from 'h3'
|
|
18
|
+
*
|
|
19
|
+
* const h3app = new H3()
|
|
20
|
+
* const app = await createApp()
|
|
21
|
+
*
|
|
22
|
+
* // Mount Vercube app at /api path
|
|
23
|
+
* h3app.all('/api/**', toH3(app))
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
function toH3(app) {
|
|
27
|
+
return (event) => {
|
|
28
|
+
const server = app.container.get(HttpServer);
|
|
29
|
+
return server.handleRequest(event.req);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { toH3 };
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vercube/h3",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "H3 module for Vercube framework",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/vercube/vercube.git",
|
|
8
|
+
"directory": "packages/h3"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"type": "module",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.mjs",
|
|
17
|
+
"require": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"main": "./dist/index.cjs",
|
|
21
|
+
"module": "./dist/index.mjs",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"h3": "npm:h3-nightly@2x",
|
|
29
|
+
"@vercube/core": "0.0.2"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
}
|
|
34
|
+
}
|