@vercel/hono 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.
Files changed (2) hide show
  1. package/dist/index.js +81 -0
  2. package/package.json +37 -0
package/dist/index.js ADDED
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ build: () => build,
24
+ version: () => version
25
+ });
26
+ module.exports = __toCommonJS(src_exports);
27
+
28
+ // src/build.ts
29
+ var import_node = require("@vercel/node");
30
+ var build = async ({
31
+ files,
32
+ workPath,
33
+ config,
34
+ meta = {}
35
+ }) => {
36
+ const validEntrypoints = [
37
+ "index.ts",
38
+ "index.js",
39
+ "index.mjs",
40
+ "index.cjs",
41
+ "src/index.ts",
42
+ "src/index.js",
43
+ "src/index.mjs",
44
+ "src/index.cjs"
45
+ ];
46
+ const entrypoint = validEntrypoints.find((path) => files[path] !== void 0);
47
+ if (!entrypoint) {
48
+ throw new Error("No valid entrypoint found");
49
+ }
50
+ return (0, import_node.build)({
51
+ entrypoint,
52
+ files,
53
+ shim,
54
+ workPath,
55
+ useWebApi: true,
56
+ config,
57
+ meta
58
+ });
59
+ };
60
+ var shim = (handler) => `
61
+ import app from "./${handler}";
62
+
63
+ const handle = async (request) => {
64
+ return app.fetch(request);
65
+ };
66
+
67
+ export const GET = handle;
68
+ export const POST = handle;
69
+ export const PUT = handle;
70
+ export const DELETE = handle;
71
+ export const PATCH = handle;
72
+ export const OPTIONS = handle;
73
+ export const HEAD = handle;`;
74
+
75
+ // src/index.ts
76
+ var version = 3;
77
+ // Annotate the CommonJS export names for ESM import in node:
78
+ 0 && (module.exports = {
79
+ build,
80
+ version
81
+ });
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@vercel/hono",
3
+ "version": "0.0.2",
4
+ "license": "Apache-2.0",
5
+ "main": "./dist/index.js",
6
+ "homepage": "https://vercel.com/docs",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/vercel/vercel.git",
10
+ "directory": "packages/hono"
11
+ },
12
+ "scripts": {
13
+ "build": "node ../../utils/build-builder.mjs",
14
+ "test-e2e": "pnpm test test/test.js",
15
+ "test": "jest --reporters=default --reporters=jest-junit --env node --verbose --bail --runInBand",
16
+ "type-check": "tsc --noEmit"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "edge-entry.js"
21
+ ],
22
+ "dependencies": {
23
+ "@vercel/static-config": "3.1.1",
24
+ "@vercel/node": "workspace:*",
25
+ "ts-morph": "12.0.0"
26
+ },
27
+ "devDependencies": {
28
+ "@types/jest": "27.5.1",
29
+ "@types/node": "14.18.33",
30
+ "@vercel/build-utils": "11.0.0",
31
+ "execa": "3.2.0",
32
+ "fs-extra": "11.1.0",
33
+ "jest-junit": "16.0.0",
34
+ "vite": "^5.1.6",
35
+ "vitest": "^2.0.1"
36
+ }
37
+ }