@nuxt/kit-nightly 4.2.2-29421555.42ff3dfb → 4.2.2-29421604.b8b53eda

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 +28 -8
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -569,7 +569,7 @@ async function installModules(modulesToInstall, resolvedModulePaths, nuxt = useN
569
569
  localLayerModuleDirs.push(resolve(srcDir, l.config?.dir?.modules || "modules").replace(/\/?$/, "/"));
570
570
  }
571
571
  }
572
- const optionsFunctions = /* @__PURE__ */ new Map();
572
+ nuxt._moduleOptionsFunctions ||= /* @__PURE__ */ new Map();
573
573
  const resolvedModules = [];
574
574
  const inlineConfigKeys = new Set(
575
575
  await Promise.all([...modulesToInstall].map(([mod]) => typeof mod !== "string" && Promise.resolve(mod.getMeta?.())?.then((r) => r?.configKey)))
@@ -604,8 +604,8 @@ async function installModules(modulesToInstall, resolvedModulePaths, nuxt = useN
604
604
  }
605
605
  }
606
606
  if (value.overrides || value.defaults) {
607
- const currentFns = optionsFunctions.get(resolvedModule.module) || [];
608
- optionsFunctions.set(resolvedModule.module, [
607
+ const currentFns = nuxt._moduleOptionsFunctions.get(resolvedModule.module) || [];
608
+ nuxt._moduleOptionsFunctions.set(resolvedModule.module, [
609
609
  ...currentFns,
610
610
  () => ({ defaults: value.defaults, overrides: value.overrides })
611
611
  ]);
@@ -641,10 +641,10 @@ async function installModules(modulesToInstall, resolvedModulePaths, nuxt = useN
641
641
  for (const { nuxtModule, meta, moduleToInstall, buildTimeModuleMeta, resolvedModulePath, inlineOptions } of resolvedModules) {
642
642
  const configKey = meta?.configKey;
643
643
  const optionsFns = [
644
- ...optionsFunctions.get(moduleToInstall) || [],
645
- ...meta?.name ? optionsFunctions.get(meta.name) || [] : [],
644
+ ...nuxt._moduleOptionsFunctions.get(moduleToInstall) || [],
645
+ ...meta?.name ? nuxt._moduleOptionsFunctions.get(meta.name) || [] : [],
646
646
  // TODO: consider dropping options functions keyed by config key
647
- ...configKey ? optionsFunctions.get(configKey) || [] : []
647
+ ...configKey ? nuxt._moduleOptionsFunctions.get(configKey) || [] : []
648
648
  ];
649
649
  if (optionsFns.length > 0) {
650
650
  const overrides = [];
@@ -661,6 +661,7 @@ async function installModules(modulesToInstall, resolvedModulePaths, nuxt = useN
661
661
  await callLifecycleHooks(nuxtModule, meta, inlineOptions, nuxt);
662
662
  await callModule(nuxtModule, meta, inlineOptions, resolvedModulePath, moduleToInstall, localLayerModuleDirs, buildTimeModuleMeta, nuxt);
663
663
  }
664
+ delete nuxt._moduleOptionsFunctions;
664
665
  }
665
666
  async function installModule(moduleToInstall, inlineOptions, nuxt = useNuxt()) {
666
667
  const { nuxtModule, buildTimeModuleMeta, resolvedModulePath } = await loadNuxtModuleInstance(moduleToInstall, nuxt);
@@ -671,8 +672,27 @@ async function installModule(moduleToInstall, inlineOptions, nuxt = useNuxt()) {
671
672
  }
672
673
  }
673
674
  const meta = await nuxtModule.getMeta?.();
674
- await callLifecycleHooks(nuxtModule, meta, inlineOptions, nuxt);
675
- await callModule(nuxtModule, meta, inlineOptions, resolvedModulePath, moduleToInstall, localLayerModuleDirs, buildTimeModuleMeta, nuxt);
675
+ let mergedOptions = inlineOptions;
676
+ const configKey = meta?.configKey;
677
+ if (configKey && nuxt._moduleOptionsFunctions) {
678
+ const optionsFns = [
679
+ ...nuxt._moduleOptionsFunctions.get(moduleToInstall) || [],
680
+ ...nuxt._moduleOptionsFunctions.get(configKey) || []
681
+ ];
682
+ if (optionsFns.length > 0) {
683
+ const overrides = [];
684
+ const defaults = [];
685
+ for (const fn of optionsFns) {
686
+ const options = fn();
687
+ overrides.push(options.overrides);
688
+ defaults.push(options.defaults);
689
+ }
690
+ mergedOptions = defu(inlineOptions, ...overrides, nuxt.options[configKey], ...defaults);
691
+ nuxt.options[configKey] = mergedOptions;
692
+ }
693
+ }
694
+ await callLifecycleHooks(nuxtModule, meta, mergedOptions, nuxt);
695
+ await callModule(nuxtModule, meta, mergedOptions, resolvedModulePath, moduleToInstall, localLayerModuleDirs, buildTimeModuleMeta, nuxt);
676
696
  }
677
697
  function resolveModuleWithOptions(definition, nuxt) {
678
698
  const [module, options = {}] = Array.isArray(definition) ? definition : [definition, {}];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/kit-nightly",
3
- "version": "4.2.2-29421555.42ff3dfb",
3
+ "version": "4.2.2-29421604.b8b53eda",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -45,14 +45,14 @@
45
45
  "untyped": "^2.0.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.2.2-29421555.42ff3dfb",
49
- "@rspack/core": "1.6.5",
48
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.2.2-29421604.b8b53eda",
49
+ "@rspack/core": "1.6.7",
50
50
  "@types/semver": "7.7.1",
51
51
  "hookable": "5.5.3",
52
52
  "nitropack": "2.12.9",
53
53
  "unbuild": "3.6.1",
54
54
  "unimport": "5.5.0",
55
- "vite": "7.2.4",
55
+ "vite": "7.2.7",
56
56
  "vitest": "3.2.4",
57
57
  "webpack": "5.103.0"
58
58
  },