This commit is contained in:
2026-08-14 16:03:47 +01:00
parent fd53e3f4fb
commit dfdc3b2840
2463 changed files with 186456 additions and 111315 deletions
+9 -1
View File
@@ -1,4 +1,3 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -19,6 +18,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
var utils_exports = {};
__export(utils_exports, {
dirname: () => dirname,
ensureWithinOutDir: () => ensureWithinOutDir,
filterStaticGenerateRoutes: () => filterStaticGenerateRoutes,
isDynamicRoute: () => isDynamicRoute,
joinPaths: () => joinPaths
@@ -76,9 +76,17 @@ const filterStaticGenerateRoutes = (hono) => {
const isDynamicRoute = (path) => {
return path.split("/").some((segment) => segment.startsWith(":") || segment.includes("*"));
};
const ensureWithinOutDir = (outDir, filePath) => {
const normalizedOutDir = joinPaths("/", outDir);
const normalizedFilePath = joinPaths("/", filePath);
if (normalizedFilePath !== normalizedOutDir && !normalizedFilePath.startsWith(`${normalizedOutDir}/`)) {
throw new Error(`Path traversal detected: "${filePath}" is outside the output directory`);
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
dirname,
ensureWithinOutDir,
filterStaticGenerateRoutes,
isDynamicRoute,
joinPaths