nuxt-nightly 4.1.0-29278578.7c5efacf → 4.1.0-29278670.a74035ee

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 +22 -38
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import { AsyncLocalStorage } from 'node:async_hooks';
5
5
  import { dirname, resolve, normalize, basename, extname, relative, isAbsolute, join } from 'pathe';
6
6
  import { createHooks, createDebugger } from 'hookable';
7
7
  import ignore from 'ignore';
8
- import { useLogger, tryUseNuxt, useNuxt, directoryToURL, resolveFiles, resolvePath, defineNuxtModule, findPath, addPlugin, addTemplate, addTypeTemplate, addComponent, useNitro, addBuildPlugin, isIgnored, resolveAlias as resolveAlias$1, addPluginTemplate, addImportsSources, addVitePlugin, createIsIgnored, updateTemplates, tryResolveModule, normalizeModuleTranspilePath, resolveNuxtModule, resolveIgnorePatterns, logger as logger$1, createResolver, importModule, tryImportModule, runWithNuxtContext, nuxtCtx, loadNuxtConfig, addWebpackPlugin, addServerPlugin, installModule, addServerTemplate, addServerHandler, addRouteMiddleware, normalizeTemplate, normalizePlugin } from '@nuxt/kit';
8
+ import { useLogger, tryUseNuxt, useNuxt, directoryToURL, resolveFiles, resolvePath, defineNuxtModule, findPath, addPlugin, addTemplate, addTypeTemplate, addComponent, useNitro, addBuildPlugin, isIgnored, resolveAlias as resolveAlias$1, addPluginTemplate, addImportsSources, addVitePlugin, createIsIgnored, updateTemplates, tryResolveModule, normalizeModuleTranspilePath, resolveNuxtModule, resolveIgnorePatterns, logger as logger$1, createResolver, importModule, tryImportModule, runWithNuxtContext, nuxtCtx, loadNuxtConfig, addWebpackPlugin, addServerPlugin, installModules, addServerTemplate, addServerHandler, addRouteMiddleware, resolveModuleWithOptions, normalizeTemplate, normalizePlugin } from '@nuxt/kit';
9
9
  import { resolvePackageJSON, readPackageJSON } from 'pkg-types';
10
10
  import { hash, isEqual, serialize } from 'ohash';
11
11
  import consola, { consola as consola$1 } from 'consola';
@@ -19,13 +19,13 @@ import defu$1, { defu } from 'defu';
19
19
  import { satisfies, coerce } from 'semver';
20
20
  import { isCI, provider, isWindows, hasTTY } from 'std-env';
21
21
  import { genArrayFromRaw, genSafeVariableName, genImport, genDynamicImport, genObjectFromRawEntries, genString, genExport } from 'knitwork';
22
- import { resolveModulePath } from 'exsolve';
23
22
  import { addDependency } from 'nypm';
24
23
  import { reverseResolveAlias, filename, resolveAlias } from 'pathe/utils';
25
24
  import { createRoutesContext } from 'unplugin-vue-router';
26
25
  import { resolveOptions } from 'unplugin-vue-router/options';
27
26
  import { toRouteMatcher, createRouter, exportMatcher } from 'radix3';
28
27
  import { fileURLToPath, pathToFileURL } from 'node:url';
28
+ import { resolveModulePath } from 'exsolve';
29
29
  import { runInNewContext } from 'node:vm';
30
30
  import { klona } from 'klona';
31
31
  import { parseAndWalk, ScopeTracker, walk, isBindingIdentifier, getUndeclaredIdentifiersInFunction } from 'oxc-walker';
@@ -3765,7 +3765,7 @@ function addDeclarationTemplates(ctx, options) {
3765
3765
  });
3766
3766
  }
3767
3767
 
3768
- const version = "4.1.0-29278578.7c5efacf";
3768
+ const version = "4.1.0-29278670.a74035ee";
3769
3769
 
3770
3770
  const createImportProtectionPatterns = (nuxt, options) => {
3771
3771
  const patterns = [];
@@ -5626,8 +5626,8 @@ Using \`${fallbackCompatibilityDate}\` as fallback. More info at: ${colors.under
5626
5626
  const locallyScannedLayersDirs = nuxt.options._layers.map((l) => resolve(l.cwd, "layers").replace(/\/?$/, "/"));
5627
5627
  nuxt.options.modulesDir.push(...nuxt.options._layers.filter((l) => l.cwd !== nuxt.options.rootDir && locallyScannedLayersDirs.every((dir) => !l.cwd.startsWith(dir))).map((l) => resolve(l.cwd, "node_modules")));
5628
5628
  await nuxt.callHook("modules:before");
5629
- const { paths: modulePaths, modules } = await resolveModules(nuxt);
5630
- nuxt.options.watch.push(...modulePaths);
5629
+ const { paths: watchedModulePaths, resolvedModulePaths, modules } = await resolveModules(nuxt);
5630
+ nuxt.options.watch.push(...watchedModulePaths);
5631
5631
  const islandsConfig = nuxt.options.experimental.componentIslands;
5632
5632
  if (nuxt.options.dev || !(typeof islandsConfig === "object" && islandsConfig.selectiveClient === "deep")) {
5633
5633
  addComponent({
@@ -5729,9 +5729,7 @@ Using \`${fallbackCompatibilityDate}\` as fallback. More info at: ${colors.under
5729
5729
  if (nuxt.options.experimental.browserDevtoolsTiming) {
5730
5730
  addPlugin(resolve(nuxt.options.appDir, "plugins/browser-devtools-timing.client"));
5731
5731
  }
5732
- for (const [key, options] of modules) {
5733
- await installModule(key, options);
5734
- }
5732
+ await installModules(modules, resolvedModulePaths, nuxt);
5735
5733
  nuxt._ignore = ignore(nuxt.options.ignoreOptions);
5736
5734
  nuxt._ignore.add(resolveIgnorePatterns());
5737
5735
  await nuxt.callHook("modules:done");
@@ -5815,7 +5813,7 @@ export default defineNuxtPlugin({
5815
5813
  }
5816
5814
  nuxt.hooks.hook("builder:watch", (event, relativePath) => {
5817
5815
  const path = resolve(nuxt.options.srcDir, relativePath);
5818
- if (modulePaths.has(path)) {
5816
+ if (watchedModulePaths.has(path)) {
5819
5817
  return nuxt.callHook("restart", { hard: true });
5820
5818
  }
5821
5819
  const layerRelativePaths = new Set(nuxt.options._layers.map((l) => relative(l.config.srcDir || l.cwd, path)));
@@ -5980,30 +5978,6 @@ function createPortalProperties(sourceValue, options, paths) {
5980
5978
  });
5981
5979
  }
5982
5980
  }
5983
- function resolveModule(definition, nuxt) {
5984
- const [module, options = {}] = Array.isArray(definition) ? definition : [definition, {}];
5985
- if (!module) {
5986
- return;
5987
- }
5988
- if (typeof module !== "string") {
5989
- return {
5990
- module,
5991
- options
5992
- };
5993
- }
5994
- const modAlias = resolveAlias$1(module);
5995
- const modPath = resolveModulePath(modAlias, {
5996
- try: true,
5997
- from: nuxt.options.modulesDir.map((m) => directoryToURL(m.replace(/\/node_modules\/?$/, "/"))),
5998
- suffixes: ["nuxt", "nuxt/index", "module", "module/index", "", "index"],
5999
- extensions: [".js", ".mjs", ".cjs", ".ts", ".mts", ".cts"]
6000
- });
6001
- return {
6002
- module,
6003
- resolvedPath: modPath || modAlias,
6004
- options
6005
- };
6006
- }
6007
5981
  async function resolveModules(nuxt) {
6008
5982
  const modules = /* @__PURE__ */ new Map();
6009
5983
  const paths = /* @__PURE__ */ new Set();
@@ -6012,10 +5986,10 @@ async function resolveModules(nuxt) {
6012
5986
  for (const config of configs) {
6013
5987
  const definedModules = config.modules ?? [];
6014
5988
  for (const module of definedModules) {
6015
- const resolvedModule = resolveModule(module, nuxt);
5989
+ const resolvedModule = resolveModuleWithOptions(module, nuxt);
6016
5990
  if (resolvedModule && (!resolvedModule.resolvedPath || !resolvedModulePaths.has(resolvedModule.resolvedPath))) {
6017
5991
  modules.set(resolvedModule.module, resolvedModule.options);
6018
- const path = resolvedModule.resolvedPath || typeof resolvedModule.module;
5992
+ const path = resolvedModule.resolvedPath || resolvedModule.module;
6019
5993
  if (typeof path === "string") {
6020
5994
  resolvedModulePaths.add(path);
6021
5995
  }
@@ -6035,10 +6009,10 @@ async function resolveModules(nuxt) {
6035
6009
  }
6036
6010
  for (const key of ["modules", "_modules"]) {
6037
6011
  for (const module of nuxt.options[key]) {
6038
- const resolvedModule = resolveModule(module, nuxt);
6012
+ const resolvedModule = resolveModuleWithOptions(module, nuxt);
6039
6013
  if (resolvedModule && !modules.has(resolvedModule.module) && (!resolvedModule.resolvedPath || !resolvedModulePaths.has(resolvedModule.resolvedPath))) {
6040
6014
  modules.set(resolvedModule.module, resolvedModule.options);
6041
- const path = resolvedModule.resolvedPath || typeof resolvedModule.module;
6015
+ const path = resolvedModule.resolvedPath || resolvedModule.module;
6042
6016
  if (typeof path === "string") {
6043
6017
  resolvedModulePaths.add(path);
6044
6018
  }
@@ -6047,6 +6021,7 @@ async function resolveModules(nuxt) {
6047
6021
  }
6048
6022
  return {
6049
6023
  paths,
6024
+ resolvedModulePaths,
6050
6025
  modules
6051
6026
  };
6052
6027
  }
@@ -6312,9 +6287,15 @@ const schemaNodeTemplate = {
6312
6287
  }),
6313
6288
  modules.length > 0 && options.unresolved ? ` modules?: (undefined | null | false | NuxtModule<any> | string | [NuxtModule | string, Record<string, any>] | ${modules.map(([configKey, importName, mod]) => `[${genString(mod.meta?.rawPath || importName)}, Exclude<NuxtConfig[${configKey}], boolean>]`).join(" | ")})[],` : ""
6314
6289
  ].filter(Boolean);
6290
+ const moduleDependencies = modules.flatMap(([_configKey, importName]) => [
6291
+ ` [${genString(importName)}]?: ModuleDependencyMeta<typeof ${genDynamicImport(importName, { wrapper: false })}.default extends NuxtModule<infer O> ? O : Record<string, unknown>>`
6292
+ ]).join("\n");
6315
6293
  return [
6316
- "import { NuxtModule } from '@nuxt/schema'",
6294
+ "import { NuxtModule, ModuleDependencyMeta } from '@nuxt/schema'",
6317
6295
  "declare module '@nuxt/schema' {",
6296
+ " interface ModuleDependencies {",
6297
+ moduleDependencies,
6298
+ " }",
6318
6299
  " interface NuxtOptions {",
6319
6300
  ...moduleOptionsInterface({ addJSDocTags: false, unresolved: false }),
6320
6301
  " }",
@@ -6325,6 +6306,9 @@ const schemaNodeTemplate = {
6325
6306
  " }",
6326
6307
  "}",
6327
6308
  "declare module 'nuxt/schema' {",
6309
+ " interface ModuleDependencies {",
6310
+ moduleDependencies,
6311
+ " }",
6328
6312
  " interface NuxtOptions {",
6329
6313
  ...moduleOptionsInterface({ addJSDocTags: true, unresolved: false }),
6330
6314
  " }",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-nightly",
3
- "version": "4.1.0-29278578.7c5efacf",
3
+ "version": "4.1.0-29278670.a74035ee",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -67,10 +67,10 @@
67
67
  "@nuxt/cli": "npm:@nuxt/cli-nightly@latest",
68
68
  "@nuxt/devalue": "^2.0.2",
69
69
  "@nuxt/devtools": "^2.6.3",
70
- "@nuxt/kit": "npm:@nuxt/kit-nightly@4.1.0-29278578.7c5efacf",
71
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.0-29278578.7c5efacf",
70
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.1.0-29278670.a74035ee",
71
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.0-29278670.a74035ee",
72
72
  "@nuxt/telemetry": "^2.6.6",
73
- "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.1.0-29278578.7c5efacf",
73
+ "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.1.0-29278670.a74035ee",
74
74
  "@unhead/vue": "^2.0.14",
75
75
  "@vue/shared": "^3.5.20",
76
76
  "c12": "^3.2.0",