Files
Webklar.com/node_modules/next/dist/esm/server/web/spec-extension/revalidate-path.js
Basilosaurusrex f027651f9b main repo
2025-11-24 18:09:40 +01:00

18 lines
1.1 KiB
JavaScript

import { revalidateTag } from "./revalidate-tag";
import { isDynamicRoute } from "../../../shared/lib/router/utils";
import { NEXT_CACHE_IMPLICIT_TAG_ID, NEXT_CACHE_SOFT_TAG_MAX_LENGTH } from "../../../lib/constants";
export function revalidatePath(originalPath, type) {
if (originalPath.length > NEXT_CACHE_SOFT_TAG_MAX_LENGTH) {
console.warn(`Warning: revalidatePath received "${originalPath}" which exceeded max length of ${NEXT_CACHE_SOFT_TAG_MAX_LENGTH}. See more info here https://nextjs.org/docs/app/api-reference/functions/revalidatePath`);
return;
}
let normalizedPath = `${NEXT_CACHE_IMPLICIT_TAG_ID}${originalPath}`;
if (type) {
normalizedPath += `${normalizedPath.endsWith("/") ? "" : "/"}${type}`;
} else if (isDynamicRoute(originalPath)) {
console.warn(`Warning: a dynamic page path "${originalPath}" was passed to "revalidatePath" without the "page" argument. This has no affect by default, see more info here https://nextjs.org/docs/app/api-reference/functions/revalidatePath`);
}
return revalidateTag(normalizedPath);
}
//# sourceMappingURL=revalidate-path.js.map