import { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external';
import { validateTags } from '../lib/patch-fetch';
export function cacheTag(...tags) {
    if (!process.env.__NEXT_DYNAMIC_IO) {
        throw Object.defineProperty(new Error('cacheTag() is only available with the experimental.dynamicIO config.'), "__NEXT_ERROR_CODE", {
            value: "E514",
            enumerable: false
        });
    }
    const workUnitStore = workUnitAsyncStorage.getStore();
    if (!workUnitStore || workUnitStore.type !== 'cache') {
        throw Object.defineProperty(new Error('cacheTag() can only be called inside a "use cache" function.'), "__NEXT_ERROR_CODE", {
            value: "E177",
            enumerable: false
        });
    }
    const validTags = validateTags(tags, 'cacheTag()');
    if (!workUnitStore.tags) {
        workUnitStore.tags = validTags;
    } else {
        workUnitStore.tags.push(...validTags);
    }
}

//# sourceMappingURL=cache-tag.js.map