@nuxt/kit 3.14.0 → 3.14.1592

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 +19 -12
  2. package/package.json +8 -8
package/dist/index.mjs CHANGED
@@ -8,10 +8,11 @@ import { getContext } from 'unctx';
8
8
  import satisfies from 'semver/functions/satisfies.js';
9
9
  import { readPackageJSON, resolvePackageJSON } from 'pkg-types';
10
10
  import { genSafeVariableName, genDynamicImport, genImport } from 'knitwork';
11
- import { createJiti } from 'jiti';
12
11
  import { fileURLToPath, pathToFileURL } from 'node:url';
12
+ import { createJiti } from 'jiti';
13
+ import { resolvePath as resolvePath$1, resolve as resolve$1, resolvePathSync, interopDefault } from 'mlly';
14
+ import { isRelative, withTrailingSlash } from 'ufo';
13
15
  import { globby } from 'globby';
14
- import { resolvePath as resolvePath$1, resolvePathSync, interopDefault } from 'mlly';
15
16
  import { resolveAlias as resolveAlias$1 } from 'pathe/utils';
16
17
  import ignore from 'ignore';
17
18
  import { loadConfig } from 'c12';
@@ -21,7 +22,6 @@ import destr from 'destr';
21
22
  import { snakeCase, kebabCase, pascalCase } from 'scule';
22
23
  import { klona } from 'klona';
23
24
  import hash from 'hash-sum';
24
- import { withTrailingSlash } from 'ufo';
25
25
  import { gte } from 'semver';
26
26
 
27
27
  const logger = consola;
@@ -2430,20 +2430,27 @@ async function loadNuxtModuleInstance(nuxtModule, nuxt = useNuxt()) {
2430
2430
  let buildTimeModuleMeta = {};
2431
2431
  const jiti = createJiti(nuxt.options.rootDir, { alias: nuxt.options.alias });
2432
2432
  if (typeof nuxtModule === "string") {
2433
- const paths = [join(nuxtModule, "nuxt"), join(nuxtModule, "module"), nuxtModule, join(nuxt.options.rootDir, nuxtModule)];
2434
- for (const parentURL of nuxt.options.modulesDir) {
2435
- for (const path of paths) {
2433
+ const paths = /* @__PURE__ */ new Set();
2434
+ nuxtModule = resolveAlias(nuxtModule, nuxt.options.alias);
2435
+ if (isRelative(nuxtModule)) {
2436
+ nuxtModule = resolve(nuxt.options.rootDir, nuxtModule);
2437
+ }
2438
+ paths.add(join(nuxtModule, "nuxt"));
2439
+ paths.add(join(nuxtModule, "module"));
2440
+ paths.add(nuxtModule);
2441
+ for (const path of paths) {
2442
+ for (const parentURL of nuxt.options.modulesDir) {
2436
2443
  try {
2437
- const src = jiti.esmResolve(path, { parentURL: parentURL.replace(/\/node_modules\/?$/, "") });
2444
+ const src = isAbsolute(path) ? pathToFileURL(await resolvePath(path, { cwd: parentURL, fallbackToOriginal: false, extensions: nuxt.options.extensions })).href : await resolve$1(path, { url: pathToFileURL(parentURL.replace(/\/node_modules\/?$/, "")), extensions: nuxt.options.extensions });
2438
2445
  nuxtModule = await jiti.import(src, { default: true });
2439
- const moduleMetadataPath = join(dirname(src), "module.json");
2446
+ const moduleMetadataPath = new URL("module.json", src);
2440
2447
  if (existsSync(moduleMetadataPath)) {
2441
2448
  buildTimeModuleMeta = JSON.parse(await promises.readFile(moduleMetadataPath, "utf-8"));
2442
2449
  }
2443
2450
  break;
2444
2451
  } catch (error) {
2445
2452
  const code = error.code;
2446
- if (code === "MODULE_NOT_FOUND" || code === "ERR_PACKAGE_PATH_NOT_EXPORTED" || code === "ERR_MODULE_NOT_FOUND" || code === "ERR_UNSUPPORTED_DIR_IMPORT") {
2453
+ if (code === "MODULE_NOT_FOUND" || code === "ERR_PACKAGE_PATH_NOT_EXPORTED" || code === "ERR_MODULE_NOT_FOUND" || code === "ERR_UNSUPPORTED_DIR_IMPORT" || code === "ENOTDIR") {
2447
2454
  continue;
2448
2455
  }
2449
2456
  logger.error(`Error while importing module \`${nuxtModule}\`: ${error}`);
@@ -2497,8 +2504,8 @@ async function getNuxtModuleVersion(module, nuxt = useNuxt()) {
2497
2504
  }
2498
2505
  }
2499
2506
  if (hasNuxtModule(moduleMeta.name)) {
2500
- const { buildTimeModuleMeta } = await loadNuxtModuleInstance(moduleMeta.name, nuxt);
2501
- return buildTimeModuleMeta.version || false;
2507
+ const { nuxtModule, buildTimeModuleMeta } = await loadNuxtModuleInstance(moduleMeta.name, nuxt);
2508
+ return buildTimeModuleMeta.version || await nuxtModule.getMeta?.().then((r) => r.version) || false;
2502
2509
  }
2503
2510
  return false;
2504
2511
  }
@@ -2935,7 +2942,7 @@ async function addComponent(opts) {
2935
2942
  function addTemplate(_template) {
2936
2943
  const nuxt = useNuxt();
2937
2944
  const template = normalizeTemplate(_template);
2938
- nuxt.options.build.templates = nuxt.options.build.templates.filter((p) => normalizeTemplate(p).filename !== template.filename);
2945
+ nuxt.options.build.templates = nuxt.options.build.templates.filter((p) => normalizeTemplate(p).dst !== template.dst);
2939
2946
  nuxt.options.build.templates.push(template);
2940
2947
  return template;
2941
2948
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/kit",
3
- "version": "3.14.0",
3
+ "version": "3.14.1592",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -33,27 +33,27 @@
33
33
  "jiti": "^2.4.0",
34
34
  "klona": "^2.0.6",
35
35
  "knitwork": "^1.1.0",
36
- "mlly": "^1.7.2",
36
+ "mlly": "^1.7.3",
37
37
  "pathe": "^1.1.2",
38
38
  "pkg-types": "^1.2.1",
39
39
  "scule": "^1.3.0",
40
40
  "semver": "^7.6.3",
41
41
  "ufo": "^1.5.4",
42
42
  "unctx": "^2.3.1",
43
- "unimport": "^3.13.1",
43
+ "unimport": "^3.13.2",
44
44
  "untyped": "^1.5.1",
45
- "@nuxt/schema": "3.14.0"
45
+ "@nuxt/schema": "3.14.1592"
46
46
  },
47
47
  "devDependencies": {
48
- "@rspack/core": "1.0.14",
48
+ "@rspack/core": "1.1.2",
49
49
  "@types/hash-sum": "1.0.2",
50
50
  "@types/lodash-es": "4.17.12",
51
51
  "@types/semver": "7.5.8",
52
52
  "lodash-es": "4.17.21",
53
- "nitropack": "2.10.2",
53
+ "nitropack": "2.10.4",
54
54
  "unbuild": "latest",
55
- "vite": "5.4.10",
56
- "vitest": "2.1.4",
55
+ "vite": "5.4.11",
56
+ "vitest": "2.1.5",
57
57
  "webpack": "5.96.1"
58
58
  },
59
59
  "engines": {