@nuxt/kit-nightly 5.0.0-29795707.ddefa441 → 5.0.0-29796419.a2fd06ab

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 CHANGED
@@ -1,5 +1,4 @@
1
- import { $ as useNuxt, A as resolveFiles, B as getLayerDirectories, C as resolveModule, D as createResolver, E as tryResolveModule, F as filterInPlace, G as findWorkspaceDir, H as getUserCaller, I as toArray, J as resolvePackageJSON, K as readPackageJSON, L as createIsIgnored, M as resolvePath, N as MODE_RE, O as findPath, P as distDirURL, Q as tryUseNuxt, R as isIgnored, S as requireModule, T as tryRequireModule, U as warn, W as interopDefault, X as nuxtCtx, Y as getNuxtCtx, Z as runWithNuxtContext, _ as configDiagnostics, a as getDirectory, at as DEFAULT_JSX_FILE_EXTENSIONS$1, b as directoryToURL, c as loadNuxtModuleInstance, d as getMissingCjsGlobal, et as kitDiagnostics, f as isLoaderError, g as getAddDependencyCommand, h as ensureDependencyInstalled, i as componentDiagnostics, it as useLogger, j as resolveNuxtModule, k as resolveAlias, l as normalizeModuleTranspilePath, m as shouldReportJitiFallbackOnce, n as pageDiagnostics, o as installModule, ot as DEFAULT_JS_FILE_EXTENSIONS$1, p as loadJiti, q as resolvePackageDir, r as resolveModuleExportNames, rt as logger, t as pluginDiagnostics, u as resolveModuleWithOptions, w as tryImportModule, x as importModule, y as useTerminal, z as resolveIgnorePatterns } from "./plugins-CS45NyhC.mjs";
2
- import { performance } from "node:perf_hooks";
1
+ import { $ as runWithNuxtContext, A as findPath, B as isIgnored, C as importModule, D as tryRequireModule, E as tryImportModule, F as MODE_RE, G as warn, H as getLayerDirectories, I as distDirURL, J as readPackageJSON, K as interopDefault, L as filterInPlace, M as resolveFiles, N as resolveNuxtModule, O as tryResolveModule, P as resolvePath, Q as nuxtCtx, R as toArray, S as directoryToURL, T as resolveModule, V as resolveIgnorePatterns, W as getUserCaller, X as resolvePackageJSON, Y as resolvePackageDir, Z as getNuxtCtx, _ as configDiagnostics, a as getDirectory, at as DEFAULT_JSX_FILE_EXTENSIONS$1, b as logger, c as loadNuxtModuleInstance, d as getMissingCjsGlobal, et as tryUseNuxt, f as isLoaderError, g as getAddDependencyCommand, h as ensureDependencyInstalled, i as componentDiagnostics, j as resolveAlias, k as createResolver, l as normalizeModuleTranspilePath, m as shouldReportJitiFallbackOnce, n as pageDiagnostics, nt as kitDiagnostics, o as installModule, ot as DEFAULT_JS_FILE_EXTENSIONS$1, p as loadJiti, q as findWorkspaceDir, r as resolveModuleExportNames, t as pluginDiagnostics, tt as useNuxt, u as resolveModuleWithOptions, w as requireModule, x as useLogger, y as useTerminal, z as createIsIgnored } from "./plugins-CvbMgKG4.mjs";
3
2
  import { createDefu, defu } from "defu";
4
3
  import { kebabCase, pascalCase, snakeCase } from "scule";
5
4
  import process$1 from "node:process";
@@ -349,22 +348,14 @@ function _defineNuxtModule(definition) {
349
348
  if (module.hooks) nuxt.hooks.addHooks(module.hooks);
350
349
  const moduleName = uniqueKey || module.meta.name || "<no name>";
351
350
  nuxt._perf?.startPhase(`module:${moduleName}`);
352
- const start = performance.now();
353
351
  let res;
354
352
  try {
355
353
  res = await module.setup?.call(null, _options, nuxt) ?? {};
356
354
  } finally {
357
355
  nuxt._perf?.endPhase(`module:${moduleName}`);
358
356
  }
359
- const perf = performance.now() - start;
360
- const setupTime = Math.round(perf * 100) / 100;
361
- if (setupTime > 5e3 && uniqueKey !== "@nuxt/telemetry") kitDiagnostics.NUXT_B8014({
362
- name: moduleName,
363
- time: setupTime
364
- });
365
- else if (nuxt.options.debug && nuxt.options.debug.modules) logger.info(`Module \`${moduleName}\` took \`${setupTime}ms\` to setup.`);
366
357
  if (res === false) return false;
367
- return defu(res, { timings: { setup: setupTime } });
358
+ return res;
368
359
  }
369
360
  normalizedModule.getMeta = () => Promise.resolve(module.meta);
370
361
  normalizedModule.getOptions = getOptions;
@@ -1,4 +1,4 @@
1
- import { V as parseNodeModulePath, _ as configDiagnostics, at as DEFAULT_JSX_FILE_EXTENSIONS, i as componentDiagnostics, n as pageDiagnostics, nt as reporters, ot as DEFAULT_JS_FILE_EXTENSIONS, p as loadJiti, r as resolveModuleExportNames, s as installModules, t as pluginDiagnostics, tt as docsBase, v as buildDiagnostics } from "../plugins-CS45NyhC.mjs";
1
+ import { U as parseNodeModulePath, _ as configDiagnostics, at as DEFAULT_JSX_FILE_EXTENSIONS, i as componentDiagnostics, it as reporters, n as pageDiagnostics, ot as DEFAULT_JS_FILE_EXTENSIONS, p as loadJiti, r as resolveModuleExportNames, rt as docsBase, s as installModules, t as pluginDiagnostics, v as buildDiagnostics } from "../plugins-CvbMgKG4.mjs";
2
2
  import { defineDiagnostics } from "nostics";
3
3
  //#region src/diagnostics/head.ts
4
4
  /**
@@ -1,6 +1,5 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { defu } from "defu";
3
- import { consola } from "consola";
4
3
  import { AsyncLocalStorage } from "node:async_hooks";
5
4
  import { getContext } from "unctx";
6
5
  import { createConsoleReporter, defineDiagnostics } from "nostics";
@@ -17,7 +16,9 @@ import { captureStackTrace } from "errx";
17
16
  import { glob } from "tinyglobby";
18
17
  import { resolveAlias } from "pathe/utils";
19
18
  import ignore from "ignore";
19
+ import { performance } from "node:perf_hooks";
20
20
  import { read, update } from "rc9";
21
+ import { consola } from "consola";
21
22
  import { addDependency, addDependencyCommand, detectPackageManager } from "nypm";
22
23
  import { hasTTY, isCI, provider } from "std-env";
23
24
  //#region src/constants.ts
@@ -40,12 +41,6 @@ const DEFAULT_JS_FILE_EXTENSIONS = [
40
41
  ...DEFAULT_JSX_FILE_EXTENSIONS
41
42
  ];
42
43
  //#endregion
43
- //#region src/logger.ts
44
- const logger = consola;
45
- function useLogger(tag, options = {}) {
46
- return tag ? logger.create(options).withTag(tag) : logger;
47
- }
48
- //#endregion
49
44
  //#region src/diagnostics/_shared.ts
50
45
  /**
51
46
  * Resolve the docs URL for a stable `NUXT_B<NNNN>` code.
@@ -769,6 +764,12 @@ function tryRequireModule(id, opts) {
769
764
  } catch {}
770
765
  }
771
766
  //#endregion
767
+ //#region src/logger.ts
768
+ const logger = consola;
769
+ function useLogger(tag, options = {}) {
770
+ return tag ? logger.create(options).withTag(tag) : logger;
771
+ }
772
+ //#endregion
772
773
  //#region src/internal/terminal-host.ts
773
774
  const TERMINAL_HOST_KEY = Symbol.for("nuxt:terminal-host");
774
775
  /**
@@ -1629,12 +1630,37 @@ async function callLifecycleHooks(nuxtModule, meta = {}, inlineOptions, nuxt = u
1629
1630
  });
1630
1631
  }
1631
1632
  }
1633
+ function getModuleName(nuxtModule, meta, nameOrPath, rootDir) {
1634
+ if (meta.name) return meta.name;
1635
+ if (nameOrPath) {
1636
+ const parsed = parseNodeModulePath(nameOrPath);
1637
+ if (parsed.name) return parsed.name;
1638
+ return isAbsolute(nameOrPath) ? relative(rootDir, nameOrPath) : nameOrPath;
1639
+ }
1640
+ return nuxtModule.name || "anonymous module";
1641
+ }
1632
1642
  async function callModule(nuxt, nuxtModule, moduleOptions = {}, options) {
1633
1643
  const modulePath = options.modulePath;
1634
1644
  const nameOrPath = options.nameOrPath;
1635
1645
  const localLayerModuleDirs = options.localLayerModuleDirs;
1636
1646
  const fn = () => nuxt.options.experimental?.debugModuleMutation && nuxt._asyncLocalStorageModule ? nuxt._asyncLocalStorageModule.run(nuxtModule, () => nuxtModule(moduleOptions, nuxt)) : nuxtModule(moduleOptions, nuxt);
1647
+ const moduleInfo = {
1648
+ name: getModuleName(nuxtModule, options.meta, nameOrPath, nuxt.options.rootDir),
1649
+ meta: options.meta,
1650
+ path: modulePath
1651
+ };
1652
+ await nuxt.callHook("module:before", moduleInfo);
1653
+ const start = performance.now();
1637
1654
  const res = options.meta.disabled ? false : await fn();
1655
+ const duration = Math.round((performance.now() - start) * 100) / 100;
1656
+ const timings = defu({ setup: duration }, (res || {}).timings);
1657
+ if (!options.meta.disabled) {
1658
+ if (duration > 5e3 && moduleInfo.name !== "@nuxt/telemetry") kitDiagnostics.NUXT_B8014({
1659
+ name: moduleInfo.name,
1660
+ time: duration
1661
+ });
1662
+ else if (nuxt.options.debug && nuxt.options.debug.modules) logger.info(`Module \`${moduleInfo.name}\` took \`${duration}ms\` to setup.`);
1663
+ }
1638
1664
  let entryPath;
1639
1665
  if (typeof modulePath === "string") {
1640
1666
  const parsed = parseNodeModulePath(modulePath);
@@ -1657,9 +1683,14 @@ async function callModule(nuxt, nuxtModule, moduleOptions = {}, options) {
1657
1683
  nuxt.options._installedModules.push({
1658
1684
  meta: options.meta,
1659
1685
  module: nuxtModule,
1660
- timings: (res || {}).timings,
1686
+ timings: options.meta.disabled ? void 0 : timings,
1661
1687
  entryPath
1662
1688
  });
1689
+ await nuxt.callHook("module:done", {
1690
+ ...moduleInfo,
1691
+ entryPath,
1692
+ timings
1693
+ });
1663
1694
  }
1664
1695
  //#endregion
1665
1696
  //#region src/diagnostics/components.ts
@@ -2013,4 +2044,4 @@ const pluginDiagnostics = /* #__PURE__ */ defineDiagnostics({
2013
2044
  }
2014
2045
  });
2015
2046
  //#endregion
2016
- export { useNuxt as $, resolveFiles as A, getLayerDirectories as B, resolveModule as C, createResolver as D, tryResolveModule as E, filterInPlace as F, findWorkspaceDir as G, getUserCaller as H, toArray as I, resolvePackageJSON as J, readPackageJSON as K, createIsIgnored as L, resolvePath as M, MODE_RE as N, findPath as O, distDirURL as P, tryUseNuxt as Q, isIgnored as R, requireModule as S, tryRequireModule as T, warn as U, parseNodeModulePath as V, interopDefault as W, nuxtCtx as X, getNuxtCtx as Y, runWithNuxtContext as Z, configDiagnostics as _, getDirectory as a, DEFAULT_JSX_FILE_EXTENSIONS as at, directoryToURL as b, loadNuxtModuleInstance as c, getMissingCjsGlobal as d, kitDiagnostics as et, isLoaderError as f, getAddDependencyCommand as g, ensureDependencyInstalled as h, componentDiagnostics as i, useLogger as it, resolveNuxtModule as j, resolveAlias$1 as k, normalizeModuleTranspilePath as l, shouldReportJitiFallbackOnce as m, pageDiagnostics as n, reporters as nt, installModule as o, DEFAULT_JS_FILE_EXTENSIONS as ot, loadJiti as p, resolvePackageDir as q, resolveModuleExportNames as r, logger as rt, installModules as s, pluginDiagnostics as t, docsBase as tt, resolveModuleWithOptions as u, buildDiagnostics as v, tryImportModule as w, importModule as x, useTerminal as y, resolveIgnorePatterns as z };
2047
+ export { runWithNuxtContext as $, findPath as A, isIgnored as B, importModule as C, tryRequireModule as D, tryImportModule as E, MODE_RE as F, warn as G, getLayerDirectories as H, distDirURL as I, readPackageJSON as J, interopDefault as K, filterInPlace as L, resolveFiles as M, resolveNuxtModule as N, tryResolveModule as O, resolvePath as P, nuxtCtx as Q, toArray as R, directoryToURL as S, resolveModule as T, parseNodeModulePath as U, resolveIgnorePatterns as V, getUserCaller as W, resolvePackageJSON as X, resolvePackageDir as Y, getNuxtCtx as Z, configDiagnostics as _, getDirectory as a, DEFAULT_JSX_FILE_EXTENSIONS as at, logger as b, loadNuxtModuleInstance as c, getMissingCjsGlobal as d, tryUseNuxt as et, isLoaderError as f, getAddDependencyCommand as g, ensureDependencyInstalled as h, componentDiagnostics as i, reporters as it, resolveAlias$1 as j, createResolver as k, normalizeModuleTranspilePath as l, shouldReportJitiFallbackOnce as m, pageDiagnostics as n, kitDiagnostics as nt, installModule as o, DEFAULT_JS_FILE_EXTENSIONS as ot, loadJiti as p, findWorkspaceDir as q, resolveModuleExportNames as r, docsBase as rt, installModules as s, pluginDiagnostics as t, useNuxt as tt, resolveModuleWithOptions as u, buildDiagnostics as v, requireModule as w, useLogger as x, useTerminal as y, createIsIgnored as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/kit-nightly",
3
- "version": "5.0.0-29795707.ddefa441",
3
+ "version": "5.0.0-29796419.a2fd06ab",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -78,7 +78,7 @@
78
78
  }
79
79
  },
80
80
  "devDependencies": {
81
- "@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29795707.ddefa441",
81
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29796419.a2fd06ab",
82
82
  "c12": "4.0.0-beta.5",
83
83
  "chokidar": "^5.0.0",
84
84
  "confbox": "^0.2.4",