@nuxt/kit 3.20.1 → 3.20.2

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/README.md CHANGED
@@ -14,13 +14,13 @@
14
14
  Nuxt is a free and open-source framework with an intuitive and extendable way to create type-safe, performant and production-grade full-stack web applications and websites with Vue.js.
15
15
 
16
16
  It provides a number of features that make it easy to build fast, SEO-friendly, and scalable web applications, including:
17
- - Server-side rendering, Static Site Generation, Hybrid Rendering and Edge-Side Rendering
17
+ - Server-side rendering, static site generation, hybrid rendering and edge-side rendering
18
18
  - Automatic routing with code-splitting and pre-fetching
19
19
  - Data fetching and state management
20
- - SEO Optimization and Meta tags definition
20
+ - Search engine optimization and defining meta tags
21
21
  - Auto imports of components, composables and utils
22
22
  - TypeScript with zero configuration
23
- - Go fullstack with our server/ directory
23
+ - Go full-stack with our server/ directory
24
24
  - Extensible with [200+ modules](https://nuxt.com/modules)
25
25
  - Deployment to a variety of [hosting platforms](https://nuxt.com/deploy)
26
26
  - ...[and much more](https://nuxt.com) 🚀
@@ -31,7 +31,7 @@ It provides a number of features that make it easy to build fast, SEO-friendly,
31
31
  - 💻 [ Vue Development](#vue-development)
32
32
  - 📖 [Documentation](#documentation)
33
33
  - 🧩 [Modules](#modules)
34
- - ❤️ [Contribute](#contribute)
34
+ - ❤️ [Contribute](#contribute)
35
35
  - 🏠 [Local Development](#local-development)
36
36
  - 🛟 [Professional Support](#professional-support)
37
37
  - 🔗 [Follow Us](#follow-us)
package/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import { readPackageJSON, resolvePackageJSON } from 'pkg-types';
11
11
  import { genSafeVariableName, genDynamicImport, genImport } from 'knitwork';
12
12
  import { fileURLToPath, pathToFileURL } from 'node:url';
13
13
  import { createJiti } from 'jiti';
14
- import { parseNodeModulePath, interopDefault, resolveModuleExportNames } from 'mlly';
14
+ import { parseNodeModulePath, interopDefault, lookupNodeModuleSubpath, resolveModuleExportNames } from 'mlly';
15
15
  import { resolveModulePath, resolveModuleURL } from 'exsolve';
16
16
  import { isRelative, withTrailingSlash as withTrailingSlash$2 } from 'ufo';
17
17
  import { read, update } from 'rc9';
@@ -2573,7 +2573,7 @@ async function installModules(modulesToInstall, resolvedModulePaths, nuxt = useN
2573
2573
  localLayerModuleDirs.push(resolve(srcDir, l.config?.dir?.modules || "modules").replace(/\/?$/, "/"));
2574
2574
  }
2575
2575
  }
2576
- const optionsFunctions = /* @__PURE__ */ new Map();
2576
+ nuxt._moduleOptionsFunctions ||= /* @__PURE__ */ new Map();
2577
2577
  const resolvedModules = [];
2578
2578
  const inlineConfigKeys = new Set(
2579
2579
  await Promise.all([...modulesToInstall].map(([mod]) => typeof mod !== "string" && Promise.resolve(mod.getMeta?.())?.then((r) => r?.configKey)))
@@ -2608,8 +2608,8 @@ async function installModules(modulesToInstall, resolvedModulePaths, nuxt = useN
2608
2608
  }
2609
2609
  }
2610
2610
  if (value.overrides || value.defaults) {
2611
- const currentFns = optionsFunctions.get(resolvedModule.module) || [];
2612
- optionsFunctions.set(resolvedModule.module, [
2611
+ const currentFns = nuxt._moduleOptionsFunctions.get(resolvedModule.module) || [];
2612
+ nuxt._moduleOptionsFunctions.set(resolvedModule.module, [
2613
2613
  ...currentFns,
2614
2614
  () => ({ defaults: value.defaults, overrides: value.overrides })
2615
2615
  ]);
@@ -2644,25 +2644,28 @@ async function installModules(modulesToInstall, resolvedModulePaths, nuxt = useN
2644
2644
  }
2645
2645
  for (const { nuxtModule, meta, moduleToInstall, buildTimeModuleMeta, resolvedModulePath, inlineOptions } of resolvedModules) {
2646
2646
  const configKey = meta?.configKey;
2647
- if (configKey) {
2648
- const optionsFns = [
2649
- ...optionsFunctions.get(moduleToInstall) || [],
2650
- ...optionsFunctions.get(configKey) || []
2651
- ];
2652
- if (optionsFns.length > 0) {
2653
- const overrides = [];
2654
- const defaults = [];
2655
- for (const fn of optionsFns) {
2656
- const options = fn();
2657
- overrides.push(options.overrides);
2658
- defaults.push(options.defaults);
2659
- }
2647
+ const optionsFns = [
2648
+ ...nuxt._moduleOptionsFunctions.get(moduleToInstall) || [],
2649
+ ...meta?.name ? nuxt._moduleOptionsFunctions.get(meta.name) || [] : [],
2650
+ // TODO: consider dropping options functions keyed by config key
2651
+ ...configKey ? nuxt._moduleOptionsFunctions.get(configKey) || [] : []
2652
+ ];
2653
+ if (optionsFns.length > 0) {
2654
+ const overrides = [];
2655
+ const defaults = [];
2656
+ for (const fn of optionsFns) {
2657
+ const options = fn();
2658
+ overrides.push(options.overrides);
2659
+ defaults.push(options.defaults);
2660
+ }
2661
+ if (configKey) {
2660
2662
  nuxt.options[configKey] = defu(...overrides, nuxt.options[configKey], ...defaults);
2661
2663
  }
2662
2664
  }
2663
2665
  await callLifecycleHooks(nuxtModule, meta, inlineOptions, nuxt);
2664
2666
  await callModule(nuxtModule, meta, inlineOptions, resolvedModulePath, moduleToInstall, localLayerModuleDirs, buildTimeModuleMeta, nuxt);
2665
2667
  }
2668
+ delete nuxt._moduleOptionsFunctions;
2666
2669
  }
2667
2670
  async function installModule(moduleToInstall, inlineOptions, nuxt = useNuxt()) {
2668
2671
  const { nuxtModule, buildTimeModuleMeta, resolvedModulePath } = await loadNuxtModuleInstance(moduleToInstall, nuxt);
@@ -2673,8 +2676,27 @@ async function installModule(moduleToInstall, inlineOptions, nuxt = useNuxt()) {
2673
2676
  }
2674
2677
  }
2675
2678
  const meta = await nuxtModule.getMeta?.();
2676
- await callLifecycleHooks(nuxtModule, meta, inlineOptions, nuxt);
2677
- await callModule(nuxtModule, meta, inlineOptions, resolvedModulePath, moduleToInstall, localLayerModuleDirs, buildTimeModuleMeta, nuxt);
2679
+ let mergedOptions = inlineOptions;
2680
+ const configKey = meta?.configKey;
2681
+ if (configKey && nuxt._moduleOptionsFunctions) {
2682
+ const optionsFns = [
2683
+ ...nuxt._moduleOptionsFunctions.get(moduleToInstall) || [],
2684
+ ...nuxt._moduleOptionsFunctions.get(configKey) || []
2685
+ ];
2686
+ if (optionsFns.length > 0) {
2687
+ const overrides = [];
2688
+ const defaults = [];
2689
+ for (const fn of optionsFns) {
2690
+ const options = fn();
2691
+ overrides.push(options.overrides);
2692
+ defaults.push(options.defaults);
2693
+ }
2694
+ mergedOptions = defu(inlineOptions, ...overrides, nuxt.options[configKey], ...defaults);
2695
+ nuxt.options[configKey] = mergedOptions;
2696
+ }
2697
+ }
2698
+ await callLifecycleHooks(nuxtModule, meta, mergedOptions, nuxt);
2699
+ await callModule(nuxtModule, meta, mergedOptions, resolvedModulePath, moduleToInstall, localLayerModuleDirs, buildTimeModuleMeta, nuxt);
2678
2700
  }
2679
2701
  function resolveModuleWithOptions(definition, nuxt) {
2680
2702
  const [module, options = {}] = Array.isArray(definition) ? definition : [definition, {}];
@@ -2790,8 +2812,13 @@ async function callModule(nuxtModule, meta = {}, inlineOptions, resolvedModulePa
2790
2812
  return;
2791
2813
  }
2792
2814
  const modulePath = resolvedModulePath || moduleToInstall;
2815
+ let entryPath;
2793
2816
  if (typeof modulePath === "string") {
2794
2817
  const parsed = parseNodeModulePath(modulePath);
2818
+ if (parsed.name) {
2819
+ const subpath = await lookupNodeModuleSubpath(modulePath) || ".";
2820
+ entryPath = join(parsed.name, subpath === "./" ? "." : subpath);
2821
+ }
2795
2822
  const moduleRoot = parsed.dir ? parsed.dir + parsed.name : await resolvePackageJSON(modulePath, { try: true }).then((r) => r ? dirname(r) : modulePath);
2796
2823
  nuxt.options.build.transpile.push(normalizeModuleTranspilePath(moduleRoot));
2797
2824
  const directory = moduleRoot.replace(/\/?$/, "/");
@@ -2800,7 +2827,7 @@ async function callModule(nuxtModule, meta = {}, inlineOptions, resolvedModulePa
2800
2827
  }
2801
2828
  }
2802
2829
  nuxt.options._installedModules ||= [];
2803
- const entryPath = typeof moduleToInstall === "string" ? resolveAlias(moduleToInstall, nuxt.options.alias) : void 0;
2830
+ entryPath ||= typeof moduleToInstall === "string" ? resolveAlias(moduleToInstall, nuxt.options.alias) : void 0;
2804
2831
  if (typeof moduleToInstall === "string" && entryPath !== moduleToInstall) {
2805
2832
  buildTimeModuleMeta.rawPath = moduleToInstall;
2806
2833
  }
@@ -2896,12 +2923,15 @@ async function loadNuxtConfig(opts) {
2896
2923
  const processedLayers = /* @__PURE__ */ new Set();
2897
2924
  const localRelativePaths = new Set(localLayers);
2898
2925
  for (const layer of layers) {
2899
- layer.config ||= {};
2900
- layer.config.rootDir ??= layer.cwd;
2901
- if (processedLayers.has(layer.config.rootDir)) {
2926
+ const resolvedRootDir = layer.config?.rootDir ?? layer.cwd;
2927
+ layer.config = {
2928
+ ...layer.config || {},
2929
+ rootDir: resolvedRootDir
2930
+ };
2931
+ if (processedLayers.has(resolvedRootDir)) {
2902
2932
  continue;
2903
2933
  }
2904
- processedLayers.add(layer.config.rootDir);
2934
+ processedLayers.add(resolvedRootDir);
2905
2935
  layer.config = await applyDefaults(layerSchema, layer.config);
2906
2936
  if (!layer.configFile || layer.configFile.endsWith(".nuxtrc")) {
2907
2937
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/kit",
3
- "version": "3.20.1",
3
+ "version": "3.20.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -23,16 +23,16 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "c12": "^3.3.1",
26
+ "c12": "^3.3.2",
27
27
  "consola": "^3.4.2",
28
28
  "defu": "^6.1.4",
29
29
  "destr": "^2.0.5",
30
30
  "errx": "^0.1.0",
31
- "exsolve": "^1.0.7",
31
+ "exsolve": "^1.0.8",
32
32
  "ignore": "^7.0.5",
33
33
  "jiti": "^2.6.1",
34
34
  "klona": "^2.0.6",
35
- "knitwork": "^1.2.0",
35
+ "knitwork": "^1.3.0",
36
36
  "mlly": "^1.8.0",
37
37
  "ohash": "^2.0.11",
38
38
  "pathe": "^2.0.3",
@@ -46,7 +46,7 @@
46
46
  "untyped": "^2.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@rspack/core": "1.6.1",
49
+ "@rspack/core": "1.6.7",
50
50
  "@types/lodash-es": "4.17.12",
51
51
  "@types/semver": "7.7.1",
52
52
  "hookable": "5.5.3",
@@ -54,10 +54,10 @@
54
54
  "nitropack": "2.12.9",
55
55
  "unbuild": "3.6.1",
56
56
  "unimport": "5.5.0",
57
- "vite": "7.2.1",
57
+ "vite": "7.2.7",
58
58
  "vitest": "3.2.4",
59
- "webpack": "5.102.1",
60
- "@nuxt/schema": "3.20.1"
59
+ "webpack": "5.103.0",
60
+ "@nuxt/schema": "3.20.2"
61
61
  },
62
62
  "engines": {
63
63
  "node": ">=18.12.0"