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
-1
View File
@@ -1,4 +1,3 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
-1
View File
@@ -1,4 +1,3 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
-1
View File
@@ -1,4 +1,3 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
+13 -10
View File
@@ -1,4 +1,3 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -39,16 +38,18 @@ const DEFAULT_CONTENT_TYPE = "text/plain";
const DEFAULT_OUTPUT_DIR = "./static";
const generateFilePath = (routePath, outDir, mimeType, extensionMap) => {
const extension = determineExtension(mimeType, extensionMap);
let filePath;
if (routePath.endsWith(`.${extension}`)) {
return (0, import_utils2.joinPaths)(outDir, routePath);
filePath = (0, import_utils2.joinPaths)(outDir, routePath);
} else if (routePath === "/") {
filePath = (0, import_utils2.joinPaths)(outDir, `index.${extension}`);
} else if (routePath.endsWith("/")) {
filePath = (0, import_utils2.joinPaths)(outDir, routePath, `index.${extension}`);
} else {
filePath = (0, import_utils2.joinPaths)(outDir, `${routePath}.${extension}`);
}
if (routePath === "/") {
return (0, import_utils2.joinPaths)(outDir, `index.${extension}`);
}
if (routePath.endsWith("/")) {
return (0, import_utils2.joinPaths)(outDir, routePath, `index.${extension}`);
}
return (0, import_utils2.joinPaths)(outDir, `${routePath}.${extension}`);
(0, import_utils2.ensureWithinOutDir)(outDir, filePath);
return filePath;
};
const parseResponseContent = async (response) => {
const contentType = response.headers.get("Content-Type");
@@ -68,6 +69,8 @@ const defaultExtensionMap = {
"text/html": "html",
"text/xml": "xml",
"application/xml": "xml",
"application/atom+xml": "xml",
"application/rss+xml": "xml",
"application/yaml": "yaml"
};
const determineExtension = (mimeType, userExtensionMap) => {
@@ -139,7 +142,7 @@ const fetchRoutesContent = function* (app, beforeRequestHook, afterResponseHook,
}
forGetInfoURLRequest = maybeRequest;
}
await pool.run(() => app.fetch(forGetInfoURLRequest));
await pool.run(() => app.fetch(forGetInfoURLRequest, { [import_middleware.SSG_CONTEXT]: true }));
if (!forGetInfoURLRequest.ssgParams) {
if ((0, import_utils2.isDynamicRoute)(route.path)) {
resolveGetInfo(void 0);
+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