'use strict'; const kit = require('@nuxt/kit'); const piniaOrm = require('pinia-orm'); const module$1 = kit.defineNuxtModule({ meta: { name: "pinia-orm", configKey: "piniaOrm" }, defaults: { autoImports: [], ...piniaOrm.CONFIG_DEFAULTS }, setup(options, nuxt) { const resolver = kit.createResolver((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('module.cjs', document.baseURI).href))); nuxt.options.build.transpile.push(resolver.resolve("./runtime")); nuxt.hook("devtools:customTabs", (tabs) => { tabs.push({ name: "pinia-orm", title: "Pinia ORM", icon: "https://pinia-orm.codedredd.de/logo.svg", view: { type: "iframe", src: "https://pinia-orm.codedredd.de/api/composables/use-repo" } }); }); nuxt.hook("prepare:types", ({ references }) => { references.push({ types: "@pinia-orm/nuxt" }); }); kit.addTemplate({ filename: "orm-options.mjs", getContents() { return ` export const ormOptions = ${JSON.stringify(options, null, 2)} `; } }); kit.addPlugin(resolver.resolve("./runtime/plugin.vue" + (kit.isNuxt3() ? "3" : "2")), { append: true }); if (options.autoImports) { const generateImports = [ { from: "pinia-orm", name: "useRepo" }, ...options.autoImports.map( (imports) => typeof imports === "string" ? { from: "pinia-orm", name: imports } : { from: "pinia-orm", name: imports[0], as: imports[1] } ) ]; kit.addImports(generateImports); } } }); module.exports = module$1;