@frigear-nu/menu 0.1.3 → 0.2.0

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": "@frigear-nu/menu",
3
3
  "configKey": "menus",
4
- "version": "0.1.3",
4
+ "version": "0.2.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.3",
7
7
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineNuxtModule, createResolver, addImports, hasNuxtModule, addTypeTemplate, addPlugin, addServerImports } from '@nuxt/kit';
2
- import { registerModule, defineVirtualRegistry } from '@frigear-nu/module-kit/utils';
2
+ import { registerModule, addOptionalImports, defineVirtualRegistry, inlineModuleRuntime } from '@frigear-nu/module-kit/utils';
3
3
 
4
4
  const DEFAULT_CONTENT_COLLECTION = "config";
5
5
  const DEFAULT_CONTENT_FIELD = "navigation";
@@ -16,6 +16,12 @@ const module$1 = defineNuxtModule({
16
16
  if (contentEntries.length > 0 && !hasNuxtModule("@nuxt/content")) {
17
17
  throw new Error("[@frigear-nu/menu] `content` is configured for one or more menus, but `@nuxt/content` module is not installed. Please install @nuxt/content or remove the `content` option.");
18
18
  }
19
+ addOptionalImports(nuxt, "#menu/optional", [{
20
+ name: "queryCollection",
21
+ available: () => hasNuxtModule("@nuxt/content", nuxt),
22
+ fallback: `() => { throw new Error('[@frigear-nu/menu] \`@nuxt/content\` is not installed') }`,
23
+ fallbackType: "(collection: string) => never"
24
+ }]);
19
25
  nuxt.options.runtimeConfig.public.menus = {
20
26
  content: Object.fromEntries(
21
27
  contentEntries.map(([menu, source]) => {
@@ -72,6 +78,7 @@ export const sources = [${sources.map((source, index) => `{ menu: ${JSON.stringi
72
78
  from: resolver.resolve("./runtime/server/utils"),
73
79
  as: "useMenu"
74
80
  });
81
+ inlineModuleRuntime(nuxt, resolver);
75
82
  }
76
83
  });
77
84
 
@@ -1,5 +1,6 @@
1
1
  import { computed, unref } from "vue";
2
2
  import { useAsyncData, useNuxtApp, useRuntimeConfig } from "#imports";
3
+ import { queryCollection } from "#menu/optional";
3
4
  import { collectMenuItems, matchesMenuGroup, parseMenuPath, sortByOrder, translateMenuItem } from "../../utils/menu.js";
4
5
  import { getAppMenuStore } from "../utils/state.js";
5
6
  function useMenuLocale() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frigear-nu/menu",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "description": "Named, shareable navigation menus - modules contribute items (extendMenu / a runtime/menus.ts source) and/or Nuxt Content, consumers read them via useMenu and render them however they like.",
5
5
  "homepage": "https://docs.frigear.dev/modules/menu",
6
6
  "repository": {
@@ -31,7 +31,7 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@nuxt/kit": "^4.6.1",
34
- "@frigear-nu/module-kit": "1.1.3",
34
+ "@frigear-nu/module-kit": "1.2.0",
35
35
  "zod": "^4.6.5"
36
36
  },
37
37
  "devDependencies": {