@vizejs/nuxt 0.503.0 → 0.504.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.
@@ -980,21 +980,28 @@ async function importConfigModuleWithDependencies(configPath, registerModuleHook
980
980
  try {
981
981
  const configURL = pathToFileURL(configPath);
982
982
  const require = createRequire(configURL);
983
- const searchPaths = require.resolve.paths("vite") ?? [];
983
+ const engineNames = ["vite", "vite-plus"];
984
984
  let candidate;
985
- for (const directory of searchPaths.filter((path) => !globalPaths.includes(path))) {
986
- const requested = join(directory, "vite");
987
- watchInputs.add(requested);
988
- await beforeRead?.([requested]);
989
- if (lstatSync(requested, { throwIfNoEntry: false }) !== void 0) {
990
- candidate = requested;
991
- watchInputs.add(join(candidate, "package.json"));
992
- break;
985
+ for (const engineName of engineNames) {
986
+ const searchPaths = require.resolve.paths(engineName) ?? [];
987
+ for (const directory of searchPaths.filter((path) => !globalPaths.includes(path))) {
988
+ const requested = join(directory, engineName);
989
+ watchInputs.add(requested);
990
+ await beforeRead?.([requested]);
991
+ if (lstatSync(requested, { throwIfNoEntry: false }) !== void 0) {
992
+ candidate = {
993
+ engineName,
994
+ directory: requested
995
+ };
996
+ watchInputs.add(join(candidate.directory, "package.json"));
997
+ break;
998
+ }
993
999
  }
1000
+ if (candidate !== void 0) break;
994
1001
  }
995
1002
  if (typeof registerModuleHooks !== "function") {
996
- if (evaluate) throw new Error("Tracking imports while evaluating a Vite config requires Node.js 22.15 or newer. Upgrade Node.js; installed Vite alone cannot track runtime imports.");
997
- if (candidate === void 0 && !withoutVite) throw new Error("Loading a Vite config without project Vite requires Node.js 22.15 or newer to track imported configuration files. Upgrade Node.js or install Vite in the project.");
1003
+ if (evaluate) throw new Error("Tracking imports while evaluating a Vite config requires Node.js 22.15 or newer. Upgrade Node.js; an installed config bundler alone cannot track runtime imports.");
1004
+ if (candidate === void 0 && !withoutVite) throw new Error("Loading a Vite config without project Vite or Vite+ requires Node.js 22.15 or newer to track imported configuration files. Upgrade Node.js or install Vite or Vite+ in the project.");
998
1005
  }
999
1006
  if (candidate === void 0) {
1000
1007
  finishSelection();
@@ -1003,22 +1010,27 @@ async function importConfigModuleWithDependencies(configPath, registerModuleHook
1003
1010
  result = await captureConfigEvaluation(async () => ({ namespace: await (withoutVite ? withoutVite(configURL) : import(configURL.href)) }), configPath, registerModuleHooks, evaluate, void 0, observe, void 0, timings);
1004
1011
  return result;
1005
1012
  }
1006
- const viteDirectory = realpathSync(candidate);
1007
- watchInputs.add(join(viteDirectory, "package.json"));
1008
- await beforeRead?.([join(candidate, "package.json"), join(viteDirectory, "package.json")]);
1009
- const resolvedEntry = require.resolve("vite");
1013
+ const engineDirectory = realpathSync(candidate.directory);
1014
+ watchInputs.add(join(engineDirectory, "package.json"));
1015
+ await beforeRead?.([join(candidate.directory, "package.json"), join(engineDirectory, "package.json")]);
1016
+ const resolvedEntry = require.resolve(candidate.engineName);
1010
1017
  watchInputs.add(resolvedEntry);
1011
- const viteEntry = realpathSync(resolvedEntry);
1012
- watchInputs.add(viteEntry);
1013
- const entryPath = relative(viteDirectory, viteEntry);
1014
- if (entryPath === ".." || entryPath.startsWith(`..${sep}`) || isAbsolute(entryPath)) throw new Error(`Resolved loader escapes selected project Vite: ${candidate} -> ${viteEntry}`);
1015
- await beforeRead?.([resolvedEntry, viteEntry]);
1018
+ const engineEntry = realpathSync(resolvedEntry);
1019
+ watchInputs.add(engineEntry);
1020
+ const entryPath = relative(engineDirectory, engineEntry);
1021
+ if (entryPath === ".." || entryPath.startsWith(`..${sep}`) || isAbsolute(entryPath)) {
1022
+ const engineLabel = candidate.engineName === "vite" ? "Vite" : "Vite+";
1023
+ throw new Error(`Resolved loader escapes selected project ${engineLabel}: ${candidate.directory} -> ${engineEntry}`);
1024
+ }
1025
+ await beforeRead?.([resolvedEntry, engineEntry]);
1016
1026
  finishSelection();
1017
1027
  selectionFinished = true;
1018
1028
  const finishImport = beginConfigTiming(timings, "engine_import");
1019
1029
  let loadConfigFromFile;
1020
1030
  try {
1021
- ({loadConfigFromFile} = await import(pathToFileURL(viteEntry).href));
1031
+ const engine = await import(pathToFileURL(engineEntry).href);
1032
+ loadConfigFromFile = engine.loadConfigFromFile ?? engine.default?.loadConfigFromFile;
1033
+ if (typeof loadConfigFromFile !== "function") throw new Error(`${candidate.engineName} does not export loadConfigFromFile`);
1022
1034
  } finally {
1023
1035
  finishImport();
1024
1036
  }
@@ -1056,7 +1068,7 @@ async function importConfigModuleWithDependencies(configPath, registerModuleHook
1056
1068
  finishLoad();
1057
1069
  if (finishProfile) timings.find((row) => row.phase === "public_load").cpuProfile = await finishProfile();
1058
1070
  }
1059
- if (!loaded) throw new Error(`Vite did not load the selected config: ${configPath}`);
1071
+ if (!loaded) throw new Error(`${candidate.engineName} did not load the selected config: ${configPath}`);
1060
1072
  return {
1061
1073
  namespace: loaded.config.namespace,
1062
1074
  dependencies: loaded.dependencies
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { i as setupLintInspector, l as setupNuxtLintChecker, m as hasNuxtViteCompilerSupport, n as setupNuxtLintConfigGeneration, p as getDetectedNuxtMajor } from "./generation-Dk5P-qti.mjs";
1
+ import { i as setupLintInspector, l as setupNuxtLintChecker, m as hasNuxtViteCompilerSupport, n as setupNuxtLintConfigGeneration, p as getDetectedNuxtMajor } from "./generation-CQelZUTy.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import fs from "node:fs";
4
4
  import path, { dirname, join, resolve } from "node:path";
@@ -1,3 +1,3 @@
1
- import { a as toNuxtLintProjectState, c as setupNuxtLintConfigAddons, d as createNuxtLintCheckerVitePlugin, f as resolveNuxtLintCheckerOptions, l as setupNuxtLintChecker, n as setupNuxtLintConfigGeneration, o as renderNuxtOxlintConfig, r as writeFileIfChanged, s as VIZE_NUXT_LINT_CONFIG_ADDONS_HOOK, t as ROOT_OXLINT_CONFIG_NAMES, u as createNuxtLintCheckerWebpackPlugin } from "../generation-Dk5P-qti.mjs";
1
+ import { a as toNuxtLintProjectState, c as setupNuxtLintConfigAddons, d as createNuxtLintCheckerVitePlugin, f as resolveNuxtLintCheckerOptions, l as setupNuxtLintChecker, n as setupNuxtLintConfigGeneration, o as renderNuxtOxlintConfig, r as writeFileIfChanged, s as VIZE_NUXT_LINT_CONFIG_ADDONS_HOOK, t as ROOT_OXLINT_CONFIG_NAMES, u as createNuxtLintCheckerWebpackPlugin } from "../generation-CQelZUTy.mjs";
2
2
  export * from "@vizejs/nuxt-lint-config";
3
3
  export { ROOT_OXLINT_CONFIG_NAMES, VIZE_NUXT_LINT_CONFIG_ADDONS_HOOK, createNuxtLintCheckerVitePlugin, createNuxtLintCheckerWebpackPlugin, renderNuxtOxlintConfig, resolveNuxtLintCheckerOptions, setupNuxtLintChecker, setupNuxtLintConfigAddons, setupNuxtLintConfigGeneration, toNuxtLintProjectState, writeFileIfChanged };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/nuxt",
3
- "version": "0.503.0",
3
+ "version": "0.504.0",
4
4
  "description": "Nuxt module for Vize - compiler, musea gallery, linter, and type checker",
5
5
  "keywords": [
6
6
  "compiler",
@@ -49,12 +49,12 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@nuxt/kit": "3.11.2",
52
- "@vizejs/native": "0.503.0",
53
- "@vizejs/nuxt-lint-config": "0.503.0",
54
- "@vizejs/vite-plugin": "0.503.0",
55
- "@vizejs/vite-plugin-musea": "0.503.0",
56
- "oxlint-plugin-vize": "0.503.0",
57
- "vize": "0.503.0"
52
+ "@vizejs/native": "0.504.0",
53
+ "@vizejs/nuxt-lint-config": "0.504.0",
54
+ "@vizejs/vite-plugin": "0.504.0",
55
+ "@vizejs/vite-plugin-musea": "0.504.0",
56
+ "oxlint-plugin-vize": "0.504.0",
57
+ "vize": "0.504.0"
58
58
  },
59
59
  "devDependencies": {
60
60
  "jiti-nuxt2": "npm:jiti@1.21.7",