@vercel/hono 0.0.17 → 0.0.18
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.js +43 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
@@ -31,6 +41,8 @@ module.exports = __toCommonJS(src_exports);
|
|
|
31
41
|
// src/build.ts
|
|
32
42
|
var import_node = require("@vercel/node");
|
|
33
43
|
var import_path = require("path");
|
|
44
|
+
var import_fs = __toESM(require("fs"));
|
|
45
|
+
var REGEX = /(?:from|require|import)\s*(?:\(\s*)?["']hono["']\s*(?:\))?/g;
|
|
34
46
|
var build = async (args) => {
|
|
35
47
|
const entrypoint = findEntrypoint(args.files);
|
|
36
48
|
process.env.EXPERIMENTAL_NODE_TYPESCRIPT_ERRORS = "1";
|
|
@@ -44,14 +56,41 @@ var build = async (args) => {
|
|
|
44
56
|
});
|
|
45
57
|
};
|
|
46
58
|
var findEntrypoint = (files) => {
|
|
47
|
-
const validFilenames = [
|
|
48
|
-
|
|
59
|
+
const validFilenames = [
|
|
60
|
+
["app"],
|
|
61
|
+
["index"],
|
|
62
|
+
["server"],
|
|
63
|
+
["src", "app"],
|
|
64
|
+
["src", "index"],
|
|
65
|
+
["src", "server"]
|
|
66
|
+
];
|
|
67
|
+
const validExtensions = ["js", "cjs", "mjs", "ts", "cts", "mts"];
|
|
49
68
|
const validEntrypoints = validFilenames.flatMap(
|
|
50
69
|
(filename) => validExtensions.map((extension) => `${filename.join(import_path.sep)}.${extension}`)
|
|
51
70
|
);
|
|
52
|
-
const
|
|
53
|
-
|
|
71
|
+
const entrypoints = validEntrypoints.filter((entrypoint2) => {
|
|
72
|
+
const matches = files[entrypoint2] !== void 0;
|
|
73
|
+
if (matches) {
|
|
74
|
+
const file = files[entrypoint2];
|
|
75
|
+
if (file.type === "FileBlob") {
|
|
76
|
+
const content = file.data.toString();
|
|
77
|
+
const matchesContent = content.match(REGEX);
|
|
78
|
+
return matchesContent !== null;
|
|
79
|
+
}
|
|
80
|
+
if (file.type === "FileFsRef") {
|
|
81
|
+
const content = import_fs.default.readFileSync(file.fsPath, "utf-8");
|
|
82
|
+
const matchesContent = content.match(REGEX);
|
|
83
|
+
return matchesContent !== null;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
54
87
|
});
|
|
88
|
+
const entrypoint = entrypoints[0];
|
|
89
|
+
if (entrypoints.length > 1) {
|
|
90
|
+
console.warn(
|
|
91
|
+
`Multiple entrypoints found: ${entrypoints.join(", ")}. Using ${entrypoint}.`
|
|
92
|
+
);
|
|
93
|
+
}
|
|
55
94
|
if (!entrypoint) {
|
|
56
95
|
const entrypointsForMessage = validFilenames.map((filename) => `- ${filename.join(import_path.sep)}.{${validExtensions.join(",")}}`).join("\n");
|
|
57
96
|
throw new Error(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/hono",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"homepage": "https://vercel.com/docs",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@vercel/static-config": "3.1.2",
|
|
21
|
-
"@vercel/node": "5.3.
|
|
21
|
+
"@vercel/node": "5.3.17",
|
|
22
22
|
"ts-morph": "12.0.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|