@vizejs/nuxt 0.813.0 → 0.815.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.mjs +25 -6
- package/package.json +9 -8
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as setupLintInspector, m as hasNuxtViteCompilerSupport, o as setupNuxtLintConfigGeneration, p as getDetectedNuxtMajor, t as setupNuxtLintChecker } from "./setup-DQEDWmhI.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
-
import fs, { readFileSync, realpathSync } from "node:fs";
|
|
3
|
+
import fs, { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
4
4
|
import path, { dirname, join, resolve } from "node:path";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
@@ -1785,22 +1785,41 @@ function isRecord(value) {
|
|
|
1785
1785
|
function mapsVueFiles(value) {
|
|
1786
1786
|
return isRecord(value) && Array.isArray(value.extensions) && value.extensions.some((extension) => extension === ".vue");
|
|
1787
1787
|
}
|
|
1788
|
-
function
|
|
1788
|
+
function findInstalledVize(fromDir) {
|
|
1789
|
+
for (let dir = fromDir;; dir = dirname(dir)) {
|
|
1790
|
+
const candidate = join(dir, "node_modules", VIZE_CONTENT_MAPPER.package);
|
|
1791
|
+
if (existsSync(join(candidate, "package.json"))) return candidate;
|
|
1792
|
+
if (dirname(dir) === dir) return void 0;
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
/**
|
|
1796
|
+
* TypeScript resolves a mapper `package` from the tsconfig's directory. pnpm
|
|
1797
|
+
* links only direct dependencies there, so a `vize` installed through this
|
|
1798
|
+
* module is named by the directory this module itself resolves.
|
|
1799
|
+
*/
|
|
1800
|
+
function resolveVizeMapperPackage(tsconfigDir, moduleDir) {
|
|
1801
|
+
if (findInstalledVize(tsconfigDir) !== void 0) return VIZE_CONTENT_MAPPER.package;
|
|
1802
|
+
return findInstalledVize(moduleDir) ?? VIZE_CONTENT_MAPPER.package;
|
|
1803
|
+
}
|
|
1804
|
+
function injectVizeContentMapper(tsConfig, mapperPackage = VIZE_CONTENT_MAPPER.package) {
|
|
1789
1805
|
if (!isRecord(tsConfig)) return false;
|
|
1790
1806
|
const configured = tsConfig.contentMappers;
|
|
1791
1807
|
if (configured !== void 0 && !Array.isArray(configured)) return false;
|
|
1792
1808
|
const contentMappers = configured ?? [];
|
|
1793
1809
|
if (contentMappers.some(mapsVueFiles)) return false;
|
|
1794
1810
|
tsConfig.contentMappers = [...contentMappers, {
|
|
1795
|
-
package:
|
|
1811
|
+
package: mapperPackage,
|
|
1796
1812
|
extensions: [...VIZE_CONTENT_MAPPER.extensions]
|
|
1797
1813
|
}];
|
|
1798
1814
|
return true;
|
|
1799
1815
|
}
|
|
1800
|
-
function registerNuxtContentMapper(nuxt, nuxtMajor) {
|
|
1816
|
+
function registerNuxtContentMapper(nuxt, nuxtMajor, moduleDir) {
|
|
1801
1817
|
if (nuxtMajor === 2) return;
|
|
1802
1818
|
nuxt.hook("prepare:types", (payload) => {
|
|
1803
|
-
if (isRecord(payload))
|
|
1819
|
+
if (!isRecord(payload)) return;
|
|
1820
|
+
const tsconfigDir = nuxt.options?.typesDir || nuxt.options?.buildDir;
|
|
1821
|
+
const mapperPackage = tsconfigDir && moduleDir ? resolveVizeMapperPackage(tsconfigDir, moduleDir) : VIZE_CONTENT_MAPPER.package;
|
|
1822
|
+
injectVizeContentMapper(payload.tsConfig, mapperPackage);
|
|
1804
1823
|
});
|
|
1805
1824
|
}
|
|
1806
1825
|
function readTextFile(filePath) {
|
|
@@ -2002,7 +2021,7 @@ async function setupVizeNuxtModule(raw, nuxt) {
|
|
|
2002
2021
|
const lintGeneration = await setupNuxtLint(options, nuxt, raw);
|
|
2003
2022
|
const resolver = createNuxtModuleResolver(nuxt.options.rootDir);
|
|
2004
2023
|
const detectedNuxtMajor = options.compatibility?.nuxtVersion ?? getDetectedNuxtMajor(nuxt) ?? 3;
|
|
2005
|
-
registerNuxtContentMapper(nuxt, detectedNuxtMajor);
|
|
2024
|
+
registerNuxtContentMapper(nuxt, detectedNuxtMajor, resolver.resolve());
|
|
2006
2025
|
const vueVersion = options.compatibility?.vueVersion ?? (detectedNuxtMajor === 2 ? 2 : 3);
|
|
2007
2026
|
const nuxtWithBuilderOptions = nuxt;
|
|
2008
2027
|
const supportsViteCompiler = hasNuxtViteCompilerSupport(nuxtWithBuilderOptions);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.815.0",
|
|
4
4
|
"description": "Nuxt module for Vize - compiler, musea gallery, linter, and type checker",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compiler",
|
|
@@ -50,16 +50,16 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@nuxt/kit": "3.21.8",
|
|
53
|
-
"@vizejs/native": "0.
|
|
54
|
-
"@vizejs/nuxt-lint-config": "0.
|
|
55
|
-
"@vizejs/vite-plugin": "0.
|
|
56
|
-
"@vizejs/vite-plugin-musea": "0.
|
|
57
|
-
"vize": "0.
|
|
53
|
+
"@vizejs/native": "0.815.0",
|
|
54
|
+
"@vizejs/nuxt-lint-config": "0.815.0",
|
|
55
|
+
"@vizejs/vite-plugin": "0.815.0",
|
|
56
|
+
"@vizejs/vite-plugin-musea": "0.815.0",
|
|
57
|
+
"vize": "0.815.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"jiti-nuxt2": "npm:jiti@1.21.7",
|
|
61
61
|
"oxlint": "1.78.0",
|
|
62
|
-
"oxlint-plugin-vize": "0.
|
|
62
|
+
"oxlint-plugin-vize": "0.815.0",
|
|
63
63
|
"typescript": "6.0.3",
|
|
64
64
|
"vite": "npm:@voidzero-dev/vite-plus-core@1.5.0",
|
|
65
65
|
"vite-plus": "1.5.0",
|
|
@@ -86,7 +86,8 @@
|
|
|
86
86
|
"metadata": {
|
|
87
87
|
"vize": {
|
|
88
88
|
"stability": "compatibility-preview",
|
|
89
|
-
"stabilityDocs": "https://github.com/ubugeeei-prod/vize/blob/main/docs/content/stability.md#package-support-tiers"
|
|
89
|
+
"stabilityDocs": "https://github.com/ubugeeei-prod/vize/blob/main/docs/content/stability.md#package-support-tiers",
|
|
90
|
+
"channel": "v1-alpha"
|
|
90
91
|
}
|
|
91
92
|
},
|
|
92
93
|
"scripts": {
|