Files
Jiwon ChoiandGitHub 6bd5c47b90 Add codemod for removing unstable_ prefix (#84974)
Stacked on https://github.com/vercel/next.js/pull/84877,
https://github.com/vercel/next.js/pull/84880

This PR adds a codemod for removing the `unstable_` prefix for
stabilized APIs. It is considered to scale by adding more APIs to the
`UNSTABLE_TO_STABLE_MAPPING` map in the future to this codemod.

Closes NEXT-4739
2025-10-17 00:55:30 +02:00

17 lines
563 B
TypeScript

// @ts-nocheck
/* eslint-disable */
function loadCache() {
// Dynamic require with destructuring
const { unstable_cacheTag, unstable_cacheLife } = require('next/cache')
// Dynamic require with property access
const cache = require('next/cache')
const directTag = cache.unstable_cacheTag
const directLife = cache.unstable_cacheLife
// Direct property access on require
const tag = require('next/cache').unstable_cacheTag('my-tag')
const life = require('next/cache').unstable_cacheLife('2 hours')
return { tag, life, directTag, directLife }
}