@hostlink/nuxt-light 1.49.2 → 1.49.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "1.49.2",
4
+ "version": "1.49.4",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { defineNuxtModule, createResolver, extendPages, addComponentsDir, addImportsDir, resolveFiles, addPlugin } from '@nuxt/kit';
1
+ import { defineNuxtModule, createResolver, extendPages, addComponentsDir, addImportsDir, resolveFiles, addPluginTemplate, addPlugin } from '@nuxt/kit';
2
2
 
3
3
  const routes = [
4
4
  {
@@ -349,17 +349,23 @@ const module = defineNuxtModule({
349
349
  addImportsDir(resolver.resolve("./runtime/composables"));
350
350
  const files = await resolveFiles(process.cwd() + "/models", ["*"]);
351
351
  const files2 = await resolveFiles(process.cwd() + "/app/models", ["*"]);
352
- nuxt.options.runtimeConfig.public.light = {
353
- model: []
354
- };
352
+ let content = "";
355
353
  for (const file of [...files, ...files2]) {
356
- const n1 = "Model_" + file.match(/([a-zA-Z0-9]+)\.ts$/)?.[1];
357
- addPlugin({
358
- src: file,
359
- mode: "client",
360
- name: n1
361
- });
354
+ content += `(await import('${file}')).default();
355
+ `;
362
356
  }
357
+ addPluginTemplate({
358
+ filename: `light.module.options.mjs`,
359
+ mode: "client",
360
+ getContents: () => `import { defineNuxtPlugin } from '#app/nuxt'
361
+
362
+ export default defineNuxtPlugin({
363
+ name: 'light-model-plugin',
364
+ async setup (nuxtApp) {
365
+ ${content}
366
+ }
367
+ })`
368
+ });
363
369
  addPlugin({
364
370
  src: resolver.resolve("./runtime/plugin"),
365
371
  mode: "client"
@@ -8,5 +8,5 @@ export interface LightModel {
8
8
  name: string;
9
9
  fields: Record<string, LightModelField>;
10
10
  }
11
- declare const _default: (model: LightModel) => import("#app").Plugin<Record<string, unknown>> & import("#app").ObjectPlugin<Record<string, unknown>>;
11
+ declare const _default: (model: LightModel) => () => void;
12
12
  export default _default;
@@ -1,7 +1,6 @@
1
- import { defineNuxtPlugin } from "#app";
2
1
  import { default as api } from "./api.js";
3
2
  export default (model) => {
4
- return defineNuxtPlugin(() => {
3
+ return () => {
5
4
  api.models.create(model.name, model.fields);
6
- });
5
+ };
7
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.49.2",
3
+ "version": "1.49.4",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",