From 499b94264a84e15d1910c29d68e06af328216673 Mon Sep 17 00:00:00 2001 From: Romuald Brillout Date: Mon, 12 Feb 2024 12:59:58 +0100 Subject: [PATCH] add deprecation warning --- vike/node/cli/index.ts | 17 ++++++++--------- vike/node/prerender/index.ts | 10 ++++++++++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/vike/node/cli/index.ts b/vike/node/cli/index.ts index c504d0ff8e1..9a8c881addd 100644 --- a/vike/node/cli/index.ts +++ b/vike/node/cli/index.ts @@ -1,12 +1,11 @@ // TODO/v1-release: remove this file -import { prerender as prerenderOriginal } from '../prerender/index.js' +export { runPrerenderFromAPI as prerender } from '../prerender/runPrerender.js' + import { assertWarning } from '../../utils/assert.js' -export const prerender: typeof prerenderOriginal = (options) => { - assertWarning( - false, - "`import { prerender } from 'vike/cli'` is deprecated in favor of `import { prerender } from 'vike/prerender'``", - { onlyOnce: true, showStackTrace: true } - ) - return prerenderOriginal(options) -} +import pc from '@brillout/picocolors' +assertWarning( + false, + `${pc.cyan("import { prerender } from 'vike/cli'")} is deprecated in favor of ${pc.cyan("import { prerender } from 'vike/api'")}`, + { onlyOnce: true } +) diff --git a/vike/node/prerender/index.ts b/vike/node/prerender/index.ts index c6d487dd5fe..ef7650ec687 100644 --- a/vike/node/prerender/index.ts +++ b/vike/node/prerender/index.ts @@ -1 +1,11 @@ +// TODO/v1-release: remove this file + export { runPrerenderFromAPI as prerender } from './runPrerender.js' + +import { assertWarning } from './utils.js' +import pc from '@brillout/picocolors' +assertWarning( + false, + `${pc.cyan("import { prerender } from 'vike/prerender'")} is deprecated in favor of ${pc.cyan("import { prerender } from 'vike/api'")}`, + { onlyOnce: true } +)