@vizejs/nuxt 0.235.0 → 0.237.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/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
- import { MuseaOptions, MuseaOptions as MuseaOptions$1 } from "@vizejs/vite-plugin-musea";
2
1
  import * as _$nuxt_schema0 from "nuxt/schema";
3
- import { NuxtMuseaOptions, NuxtMuseaOptions as NuxtMuseaOptions$1 } from "@vizejs/musea-nuxt";
2
+ import { MuseaOptions, MuseaOptions as MuseaOptions$1 } from "@vizejs/vite-plugin-musea";
4
3
 
5
4
  //#region src/compiler-options.d.ts
6
5
  type VizeNuxtPattern = string | RegExp;
@@ -174,6 +173,23 @@ interface VizeNuxtDevOptions {
174
173
  */
175
174
  stylesheetLinks?: boolean;
176
175
  }
176
+ interface NuxtMuseaOptions {
177
+ route?: {
178
+ path?: string;
179
+ name?: string;
180
+ params?: Record<string, string>;
181
+ query?: Record<string, string>;
182
+ hash?: string;
183
+ fullPath?: string;
184
+ meta?: Record<string, unknown>;
185
+ };
186
+ runtimeConfig?: {
187
+ public?: Record<string, unknown>;
188
+ [key: string]: unknown;
189
+ };
190
+ fetchMocks?: Record<string, unknown>;
191
+ stateMocks?: Record<string, unknown>;
192
+ }
177
193
  interface VizeNuxtOptions {
178
194
  /**
179
195
  * Host framework compatibility overrides.
@@ -219,7 +235,7 @@ interface VizeNuxtOptions {
219
235
  * because they would intercept `#imports` resolution and break Nuxt's internals.
220
236
  * Real Nuxt composables are available via Nuxt's own plugin pipeline.
221
237
  */
222
- nuxtMusea?: NuxtMuseaOptions$1;
238
+ nuxtMusea?: NuxtMuseaOptions;
223
239
  }
224
240
  //#endregion
225
241
  //#region src/index.d.ts
package/dist/index.mjs CHANGED
@@ -1,7 +1,5 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { addServerPlugin, addVitePlugin, createResolver, defineNuxtModule, getNuxtVersion, isNuxt2 } from "@nuxt/kit";
3
- import vize from "@vizejs/vite-plugin";
4
- import { musea } from "@vizejs/vite-plugin-musea";
5
3
  import fs from "node:fs";
6
4
  import path from "node:path";
7
5
  import { createHash } from "node:crypto";
@@ -392,6 +390,23 @@ function injectNuxtI18nHelpers(code) {
392
390
  return code.slice(0, setupBodyStart) + `\nconst { ${usedSpecifiers.join(", ")} } = useI18n();\n` + code.slice(setupBodyStart);
393
391
  }
394
392
  //#endregion
393
+ //#region src/musea-components.ts
394
+ const MUSEA_ART_COMPONENT_IGNORE = "**/*.art.vue";
395
+ function appendMuseaArtComponentIgnore(dirs) {
396
+ for (const [index, dir] of dirs.entries()) {
397
+ if (typeof dir === "string") {
398
+ dirs[index] = {
399
+ path: dir,
400
+ ignore: [MUSEA_ART_COMPONENT_IGNORE]
401
+ };
402
+ continue;
403
+ }
404
+ const ignore = Array.isArray(dir.ignore) ? dir.ignore : [];
405
+ if (ignore.includes("**/*.art.vue")) continue;
406
+ dir.ignore = [...ignore, MUSEA_ART_COMPONENT_IGNORE];
407
+ }
408
+ }
409
+ //#endregion
395
410
  //#region src/utils.ts
396
411
  const NUXT_OG_IMAGE_RENDERER_SFC_EXCLUDE = /\.takumi\.vue(?:\?|$)/;
397
412
  function normalizeUrlPrefix(value) {
@@ -713,15 +728,6 @@ function appendOriginalVueSourceForUnoCss(code, normalizedId, options = {}) {
713
728
  }
714
729
  //#endregion
715
730
  //#region src/index.ts
716
- /**
717
- * @vizejs/nuxt - Nuxt module for Vize
718
- *
719
- * Provides:
720
- * - Compiler: Vue SFC compilation via Vite plugin
721
- * - Musea: Component gallery with Nuxt mock support
722
- * - Linter: `vize lint` CLI command (via `vize` bin)
723
- * - Type Checker: `vize check` CLI command (via `vize` bin)
724
- */
725
731
  const VIZE_NUXT_AUTO_IMPORT_PATCHED = "__vizeNuxtAutoImportPatched";
726
732
  const VUE_RUNTIME_DEDUPE = [
727
733
  "vue",
@@ -843,7 +849,7 @@ var src_default = defineNuxtModule({
843
849
  musea: false,
844
850
  nuxtMusea: { route: { path: "/" } }
845
851
  },
846
- setup(options, nuxt) {
852
+ async setup(options, nuxt) {
847
853
  const resolver = createResolver(import.meta.url);
848
854
  const detectedNuxtMajor = options.compatibility?.nuxtVersion ?? getDetectedNuxtMajor(nuxt) ?? 3;
849
855
  const vueVersion = options.compatibility?.vueVersion ?? (detectedNuxtMajor === 2 ? 2 : 3);
@@ -855,12 +861,14 @@ var src_default = defineNuxtModule({
855
861
  const devOptions = resolveNuxtDevOptions(options.dev);
856
862
  const museaOptions = resolveNuxtMuseaOptions(options.musea);
857
863
  const unocssOptions = resolveNuxtUnoCssOptions(options.unocss);
864
+ if (museaOptions !== false) nuxt.hook("components:dirs", appendMuseaArtComponentIgnore);
858
865
  const compilerOptions = resolveNuxtCompilerOptions(nuxt.options.rootDir, appBaseURL, buildAssetsDir, options.compiler, {
859
866
  supportsViteCompiler,
860
867
  vueVersion
861
868
  });
862
869
  const usesVizeCompiler = shouldUseVizeCompiler(compilerOptions);
863
870
  if (compilerOptions !== false) {
871
+ const { default: vize } = await import("@vizejs/vite-plugin");
864
872
  nuxt.options.vite ||= {};
865
873
  nuxt.options.vite.plugins = nuxt.options.vite.plugins || [];
866
874
  nuxt.options.vite.plugins.push(vize(compilerOptions));
@@ -983,6 +991,7 @@ var src_default = defineNuxtModule({
983
991
  }
984
992
  });
985
993
  if (museaOptions !== false && supportsViteCompiler) {
994
+ const { musea } = await import("@vizejs/vite-plugin-musea");
986
995
  const museaBasePath = "basePath" in museaOptions ? museaOptions.basePath : "/__musea__";
987
996
  nuxt.options.vite ||= {};
988
997
  nuxt.options.vite.plugins = nuxt.options.vite.plugins || [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/nuxt",
3
- "version": "0.235.0",
3
+ "version": "0.237.0",
4
4
  "description": "Nuxt module for Vize - compiler, musea gallery, linter, and type checker",
5
5
  "keywords": [
6
6
  "compiler",
@@ -32,8 +32,9 @@
32
32
  "types": "./dist/index.d.mts",
33
33
  "exports": {
34
34
  ".": {
35
+ "types": "./dist/index.d.mts",
35
36
  "import": "./dist/index.mjs",
36
- "types": "./dist/index.d.mts"
37
+ "default": "./dist/index.mjs"
37
38
  }
38
39
  },
39
40
  "publishConfig": {
@@ -41,10 +42,9 @@
41
42
  },
42
43
  "dependencies": {
43
44
  "@nuxt/kit": "4.4.8",
44
- "@vizejs/musea-nuxt": "0.235.0",
45
- "@vizejs/vite-plugin": "0.235.0",
46
- "@vizejs/vite-plugin-musea": "0.235.0",
47
- "vize": "0.235.0"
45
+ "@vizejs/vite-plugin": "0.237.0",
46
+ "@vizejs/vite-plugin-musea": "0.237.0",
47
+ "vize": "0.237.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "typescript": "6.0.3",