@vizejs/nuxt 0.606.0 → 0.607.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.
Files changed (2) hide show
  1. package/dist/index.mjs +31 -0
  2. package/package.json +7 -7
package/dist/index.mjs CHANGED
@@ -1246,6 +1246,36 @@ async function setupVizeLibraries(options, rootDir, loadKit, loaders) {
1246
1246
  if (plan.imports.length > 0) kit.addImports(plan.imports);
1247
1247
  return plan;
1248
1248
  }
1249
+ //#endregion
1250
+ //#region src/content-mapper.ts
1251
+ const VIZE_CONTENT_MAPPER = {
1252
+ package: "vize",
1253
+ extensions: [".vue"]
1254
+ };
1255
+ function isRecord(value) {
1256
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1257
+ }
1258
+ function mapsVueFiles(value) {
1259
+ return isRecord(value) && Array.isArray(value.extensions) && value.extensions.some((extension) => extension === ".vue");
1260
+ }
1261
+ function injectVizeContentMapper(tsConfig) {
1262
+ if (!isRecord(tsConfig)) return false;
1263
+ const configured = tsConfig.contentMappers;
1264
+ if (configured !== void 0 && !Array.isArray(configured)) return false;
1265
+ const contentMappers = configured ?? [];
1266
+ if (contentMappers.some(mapsVueFiles)) return false;
1267
+ tsConfig.contentMappers = [...contentMappers, {
1268
+ package: VIZE_CONTENT_MAPPER.package,
1269
+ extensions: [...VIZE_CONTENT_MAPPER.extensions]
1270
+ }];
1271
+ return true;
1272
+ }
1273
+ function registerNuxtContentMapper(nuxt, nuxtMajor) {
1274
+ if (nuxtMajor === 2) return;
1275
+ nuxt.hook("prepare:types", (payload) => {
1276
+ if (isRecord(payload)) injectVizeContentMapper(payload.tsConfig);
1277
+ });
1278
+ }
1249
1279
  function readTextFile(filePath) {
1250
1280
  return fs.readFileSync(filePath, "utf-8");
1251
1281
  }
@@ -1387,6 +1417,7 @@ async function setupVizeNuxtModule(raw, nuxt) {
1387
1417
  const lintGeneration = await setupNuxtLint(options, nuxt, raw);
1388
1418
  const resolver = createNuxtModuleResolver(nuxt.options.rootDir);
1389
1419
  const detectedNuxtMajor = options.compatibility?.nuxtVersion ?? getDetectedNuxtMajor(nuxt) ?? 3;
1420
+ registerNuxtContentMapper(nuxt, detectedNuxtMajor);
1390
1421
  const vueVersion = options.compatibility?.vueVersion ?? (detectedNuxtMajor === 2 ? 2 : 3);
1391
1422
  const nuxtWithBuilderOptions = nuxt;
1392
1423
  const supportsViteCompiler = hasNuxtViteCompilerSupport(nuxtWithBuilderOptions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/nuxt",
3
- "version": "0.606.0",
3
+ "version": "0.607.0",
4
4
  "description": "Nuxt module for Vize - compiler, musea gallery, linter, and type checker",
5
5
  "keywords": [
6
6
  "compiler",
@@ -49,15 +49,15 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@nuxt/kit": "3.21.8",
52
- "@vizejs/native": "0.606.0",
53
- "@vizejs/nuxt-lint-config": "0.606.0",
54
- "@vizejs/vite-plugin": "0.606.0",
55
- "@vizejs/vite-plugin-musea": "0.606.0",
56
- "vize": "0.606.0"
52
+ "@vizejs/native": "0.607.0",
53
+ "@vizejs/nuxt-lint-config": "0.607.0",
54
+ "@vizejs/vite-plugin": "0.607.0",
55
+ "@vizejs/vite-plugin-musea": "0.607.0",
56
+ "vize": "0.607.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "jiti-nuxt2": "npm:jiti@1.21.7",
60
- "oxlint-plugin-vize": "0.606.0",
60
+ "oxlint-plugin-vize": "0.607.0",
61
61
  "typescript": "6.0.3",
62
62
  "vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
63
63
  "vite-plus": "1.3.0",