@sentry/core
Version:
Base implementation for all Sentry JavaScript SDKs
29 lines (28 loc) • 1.35 kB
JavaScript
import { consoleSandbox } from "../utils/debug-logger.js";
// src/build-time-plugins/warnOnRemovedBuildOptions.ts
/**
* Warns when a build option that was removed in v11 is still present in a user's build config.
*
* TypeScript already rejects these keys, but meta-framework build configs are frequently plain
* JavaScript (`next.config.js`, `next.config.mjs`), where a removed option would otherwise be a
* silent no-op.
*
* @param options The user's build options, if any.
* @param removedKeys The removed option names to check for.
* @param logWarning Called at most once, with the full warning message. Defaults to `console.warn`,
* which suits every SDK whose build step has no logger of its own. Pass this only to route the
* warning through a framework logger (e.g. Astro's).
*
* @internal Only meant for Sentry-internal SDK usage.
* @hidden
*/
function warnOnRemovedBuildOptions(options, removedKeys, logWarning = (message) => consoleSandbox(() => {
console.warn(message);
})) {
if (!options) return;
const presentKeys = removedKeys.filter((key) => key in options);
if (!presentKeys.length) return;
logWarning(`[Sentry] Removed in v11 and ignored: ${presentKeys.join(", ")}. Set bundler plugin options directly on the Sentry build options.`);
}
export { warnOnRemovedBuildOptions };
//# sourceMappingURL=warnOnRemovedBuildOptions.js.map