33 lines
1.2 KiB
Plaintext
33 lines
1.2 KiB
Plaintext
"use strict";
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
Object.defineProperty(exports, "revalidateTag", {
|
|
enumerable: true,
|
|
get: function() {
|
|
return revalidateTag;
|
|
}
|
|
});
|
|
function revalidateTag(tag) {
|
|
const staticGenerationAsyncStorage = fetch.__nextGetStaticStore == null ? void 0 : fetch.__nextGetStaticStore.call(fetch);
|
|
const store = staticGenerationAsyncStorage == null ? void 0 : staticGenerationAsyncStorage.getStore();
|
|
if (!store || !store.incrementalCache) {
|
|
throw new Error(`Invariant: static generation store missing in revalidateTag ${tag}`);
|
|
}
|
|
if (!store.revalidatedTags) {
|
|
store.revalidatedTags = [];
|
|
}
|
|
if (!store.revalidatedTags.includes(tag)) {
|
|
store.revalidatedTags.push(tag);
|
|
}
|
|
if (!store.pendingRevalidates) {
|
|
store.pendingRevalidates = [];
|
|
}
|
|
store.pendingRevalidates.push(store.incrementalCache.revalidateTag == null ? void 0 : store.incrementalCache.revalidateTag.call(store.incrementalCache, tag).catch((err)=>{
|
|
console.error(`revalidateTag failed for ${tag}`, err);
|
|
}));
|
|
// TODO: only revalidate if the path matches
|
|
store.pathWasRevalidated = true;
|
|
}
|
|
|
|
//# sourceMappingURL=revalidate-tag.js.map |