Refactor dev mocks to use no-op functions with debug logs

Replaced undefined exports with no-op functions that log debug messages when invoked, making it clear which mocked functionality was called during development. This improves traceability and maintains clarity while keeping the development environment lightweight.
This commit is contained in:
gbuomprisco
2025-04-23 07:21:37 +08:00
parent db9ddab6ad
commit 34b703f7ee

View File

@@ -1,20 +1,35 @@
/* /*
Mock modules for development. * Mock modules for development.
This file is used to mock the modules that are not needed during development (unless they are used). This file is used to mock the modules that are not needed during development (unless they are used).
It allows the development server to load faster by not loading the modules that are not needed. It allows the development server to load faster by not loading the modules that are not needed.
*/ */
const noop = (name: string) => {
return () => {
console.debug(
`The function "${name}" is mocked for development because your environment variables indicate that it is not needed.
If you think this is a mistake, please open a support ticket.`,
);
};
};
// Turnstile // Turnstile
export const Turnstile = undefined; export const Turnstile = undefined;
export const TurnstileProps = {}; export const TurnstileProps = {};
// Baselime // Baselime
export const useBaselimeRum = undefined; export const useBaselimeRum = noop('useBaselimeRum');
export const BaselimeRum = undefined; export const BaselimeRum = undefined;
// Sentry // Sentry
export const captureException = () => ({}); export const captureException = noop('Sentry.captureException');
export const captureEvent = () => ({}); export const captureEvent = noop('Sentry.captureEvent');
export const setUser = () => ({}); export const init = noop('Sentry.init');
export const init = () => ({}); export const setUser = noop('Sentry.setUser');
// Stripe
export const loadStripe = noop('Stripe.loadStripe');
// Nodemailer
export const createTransport = noop('Nodemailer.createTransport');