mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
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
19 lines
608 B
TypeScript
19 lines
608 B
TypeScript
// @ts-nocheck
|
|
/* eslint-disable */
|
|
const cache = require('next/cache')
|
|
const dynamicCache = await import('next/cache')
|
|
|
|
// Bracket notation property access with string literals
|
|
const tag = cache['unstable_cacheTag']('my-tag')
|
|
const life = dynamicCache['unstable_cacheLife']('2 hours')
|
|
|
|
// Direct bracket notation access on require
|
|
const directTag = require('next/cache')['unstable_cacheTag']
|
|
|
|
// Bracket notation property access inside a function
|
|
function testCache() {
|
|
const tag2 = cache['unstable_cacheTag']('tag2')
|
|
const life2 = dynamicCache['unstable_cacheLife']('life2')
|
|
|
|
return { tag2, life2 }
|
|
} |