UNPKG

nuxt

Version:

Nuxt is a free and open-source framework with an intuitive and extendable way to create type-safe, performant and production-grade full-stack web applications and websites with Vue.js.

16 lines (15 loc) 696 B
import { kebabCase } from "scule"; export function defineKeyedFunctionFactory(factory) { const placeholder = function() { if (import.meta.dev) { throw new Error( `[nuxt:compiler] \`${factory.name}\` is a compiler macro that is only usable inside the directories scanned by the Nuxt compiler as an exported function and imported statically. Learn more: \`https://nuxt.com/docs/4.x/api/composables/${kebabCase(factory.name)}\`` ); } throw new Error(`[nuxt] \`${factory.name}\` is a compiler macro and cannot be called at runtime.`); }; return Object.defineProperty(placeholder, "__nuxt_factory", { enumerable: false, get: () => factory.factory }); }