@nuxt/kit 3.10.2 β†’ 3.11.0

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
@@ -13,16 +13,32 @@
13
13
  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.
14
14
 
15
15
  It provides a number of features that make it easy to build fast, SEO-friendly, and scalable web applications, including:
16
- - Server-side rendering, Static Site Generation or Hybrid Rendering
17
- - Automatic routing with code-splitting
18
- - State management
19
- - SEO Optimization
20
- - Auto imports
21
- - Extensible with [180+ modules](https://nuxt.com/modules)
16
+ - Server-side rendering, Static Site Generation, Hybrid Rendering and Edge-Side Rendering
17
+ - Automatic routing with code-splitting and pre-fetching
18
+ - Data fetching and state management
19
+ - SEO Optimization and Meta tags definition
20
+ - Auto imports of components, composables and utils
21
+ - TypeScript with zero configuration
22
+ - Go fullstack with our server/ directory
23
+ - Extensible with [200+ modules](https://nuxt.com/modules)
22
24
  - Deployment to a variety of [hosting platforms](https://nuxt.com/deploy)
23
25
  - ...[and much more](https://nuxt.com) πŸš€
24
26
 
25
- ## Getting Started
27
+ ### Table of Contents
28
+
29
+ - πŸš€ [Getting Started](#getting-started)
30
+ - πŸ’» [ Vue Development](#vue-development)
31
+ - πŸ“– [Documentation](#documentation)
32
+ - 🧩 [Modules](#modules)
33
+ - ❀️ [Contribute](#contribute)
34
+ - 🏠 [Local Development](#local-development)
35
+ - ⛰️ [Nuxt 2](#nuxt-2)
36
+ - πŸ”— [Follow us](#follow-us)
37
+ - βš–οΈ [License](#license)
38
+
39
+ ---
40
+
41
+ ## <a name="getting-started">πŸš€ Getting Started</a>
26
42
 
27
43
  Use the following command to create a new starter project. This will create a starter project with all the necessary files and dependencies:
28
44
 
@@ -30,9 +46,10 @@ Use the following command to create a new starter project. This will create a st
30
46
  npx nuxi@latest init <my-project>
31
47
  ```
32
48
 
33
- Discover also [nuxt.new](https://nuxt.new): Open a Nuxt starter on CodeSandbox, StackBlitz or locally to get up and running in a few seconds.
49
+ > [!TIP]
50
+ > Discover also [nuxt.new](https://nuxt.new): Open a Nuxt starter on CodeSandbox, StackBlitz or locally to get up and running in a few seconds.
34
51
 
35
- ## Vue Development
52
+ ## <a name="vue-development">πŸ’» Vue Development</a>
36
53
 
37
54
  Simple, intuitive and powerful, Nuxt lets you write Vue components in a way that makes sense. Every repetitive task is automated, so you can focus on writing your full-stack Vue application with confidence.
38
55
 
@@ -54,7 +71,7 @@ useSeoMeta({
54
71
  </div>
55
72
  </template>
56
73
 
57
- <style>
74
+ <style scoped>
58
75
  #app {
59
76
  background-color: #020420;
60
77
  color: #00DC82;
@@ -62,15 +79,15 @@ useSeoMeta({
62
79
  </style>
63
80
  ```
64
81
 
65
- ## Documentation
82
+ ## <a name="documentation">πŸ“– Documentation</a>
66
83
 
67
84
  We highly recommend you take a look at the [Nuxt documentation](https://nuxt.com/docs) to level up. It’s a great resource for learning more about the framework. It covers everything from getting started to advanced topics.
68
85
 
69
- ## Modules
86
+ ## <a name="modules">🧩 Modules</a>
70
87
 
71
88
  Discover our [list of modules](https://nuxt.com/modules) to supercharge your Nuxt project, created by the Nuxt team and community.
72
89
 
73
- ## Contribute
90
+ ## <a name="contribute">❀️ Contribute</a>
74
91
 
75
92
  We invite you to contribute and help improve Nuxt πŸ’š
76
93
 
@@ -79,21 +96,20 @@ Here are a few ways you can get involved:
79
96
  - **Suggestions:** Have ideas to enhance Nuxt? We'd love to hear them! Check out the [contribution guide](https://nuxt.com/docs/community/contribution#creating-an-issue) to share your suggestions.
80
97
  - **Questions:** If you have questions or need assistance, the [getting help guide](https://nuxt.com/docs/community/getting-help) provides resources to help you out.
81
98
 
82
- ## Local Development
99
+ ## <a name="local-development">🏠 Local Development</a>
83
100
 
84
101
  Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/docs/community/framework-contribution#setup) to contribute to the framework and documentation.
85
102
 
86
- ## Nuxt 2
103
+ ## <a name="nuxt-2">⛰️ Nuxt 2</a>
87
104
 
88
105
  You can find the code for Nuxt 2 on the [`2.x` branch](https://github.com/nuxt/nuxt/tree/2.x) and the documentation at [v2.nuxt.com](https://v2.nuxt.com).
89
106
 
90
- ## Follow us
107
+ ## <a name="follow-us">πŸ”— Follow us</a>
91
108
 
92
109
  <p valign="center">
93
110
  <a href="https://chat.nuxt.dev"><img width="20px" src="./.github/assets/discord.svg" alt="Discord"></a>&nbsp;&nbsp;<a href="https://twitter.nuxt.dev"><img width="20px" src="./.github/assets/twitter.svg" alt="Twitter"></a>&nbsp;&nbsp;<a href="https://github.nuxt.dev"><img width="20px" src="./.github/assets/github.svg" alt="GitHub"></a>
94
111
  </p>
95
112
 
96
- ## License
113
+ ## <a name="license">βš–οΈ License</a>
97
114
 
98
115
  [MIT](./LICENSE)
99
-
package/dist/index.d.mts CHANGED
@@ -5,7 +5,7 @@ import { Configuration, WebpackPluginInstance } from 'webpack';
5
5
  import { UserConfig, Plugin } from 'vite';
6
6
  import * as unctx_index from 'unctx/index';
7
7
  import { NitroRouteConfig, NitroEventHandler, NitroDevEventHandler, Nitro } from 'nitropack';
8
- import * as consola_dist_core from 'consola/dist/core';
8
+ import * as consola from 'consola';
9
9
  import { ConsolaOptions } from 'consola';
10
10
  import { genSafeVariableName } from 'knitwork';
11
11
 
@@ -356,8 +356,8 @@ declare function updateTemplates(options?: {
356
356
  }): Promise<any>;
357
357
  declare function writeTypes(nuxt: Nuxt): Promise<void>;
358
358
 
359
- declare const logger: consola_dist_core.ConsolaInstance;
360
- declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>): consola_dist_core.ConsolaInstance;
359
+ declare const logger: consola.ConsolaInstance;
360
+ declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>): consola.ConsolaInstance;
361
361
 
362
362
  /** @deprecated Do not use CJS utils */
363
363
  interface ResolveModuleOptions {
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import { Configuration, WebpackPluginInstance } from 'webpack';
5
5
  import { UserConfig, Plugin } from 'vite';
6
6
  import * as unctx_index from 'unctx/index';
7
7
  import { NitroRouteConfig, NitroEventHandler, NitroDevEventHandler, Nitro } from 'nitropack';
8
- import * as consola_dist_core from 'consola/dist/core';
8
+ import * as consola from 'consola';
9
9
  import { ConsolaOptions } from 'consola';
10
10
  import { genSafeVariableName } from 'knitwork';
11
11
 
@@ -356,8 +356,8 @@ declare function updateTemplates(options?: {
356
356
  }): Promise<any>;
357
357
  declare function writeTypes(nuxt: Nuxt): Promise<void>;
358
358
 
359
- declare const logger: consola_dist_core.ConsolaInstance;
360
- declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>): consola_dist_core.ConsolaInstance;
359
+ declare const logger: consola.ConsolaInstance;
360
+ declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>): consola.ConsolaInstance;
361
361
 
362
362
  /** @deprecated Do not use CJS utils */
363
363
  interface ResolveModuleOptions {
package/dist/index.mjs CHANGED
@@ -90,11 +90,11 @@ function isNuxt3(nuxt = useNuxt()) {
90
90
  return version[0] === "3" && version[1] === ".";
91
91
  }
92
92
  function getNuxtVersion(nuxt = useNuxt()) {
93
- const version = (nuxt?._version || nuxt?.version || nuxt?.constructor?.version || "").replace(/^v/g, "");
94
- if (!version) {
93
+ const rawVersion = nuxt?._version || nuxt?.version || nuxt?.constructor?.version;
94
+ if (!rawVersion) {
95
95
  throw new Error("Cannot determine nuxt version! Is current instance passed?");
96
96
  }
97
- return version;
97
+ return rawVersion.replace(/^v/g, "");
98
98
  }
99
99
 
100
100
  /** Detect free variable `global` from Node.js. */
@@ -2420,7 +2420,7 @@ async function installModule(moduleToInstall, inlineOptions, nuxt = useNuxt()) {
2420
2420
  nuxt.options.build.transpile.push(normalizeModuleTranspilePath(moduleToInstall));
2421
2421
  const directory = getDirectory(moduleToInstall);
2422
2422
  if (directory !== moduleToInstall && !localLayerModuleDirs.has(directory)) {
2423
- nuxt.options.modulesDir.push(directory);
2423
+ nuxt.options.modulesDir.push(resolve(directory, "node_modules"));
2424
2424
  }
2425
2425
  }
2426
2426
  nuxt.options._installedModules = nuxt.options._installedModules || [];
@@ -2446,8 +2446,8 @@ async function loadNuxtModuleInstance(nuxtModule, nuxt = useNuxt()) {
2446
2446
  const paths = [join(nuxtModule, "nuxt"), join(nuxtModule, "module"), nuxtModule];
2447
2447
  let error;
2448
2448
  for (const path of paths) {
2449
- const src = await resolvePath(path);
2450
2449
  try {
2450
+ const src = await resolvePath(path);
2451
2451
  nuxtModule = await importModule(src, nuxt.options.modulesDir).catch(() => null) ?? requireModule(src, { paths: nuxt.options.modulesDir });
2452
2452
  const moduleMetadataPath = join(dirname(src), "module.json");
2453
2453
  if (existsSync(moduleMetadataPath)) {
@@ -2563,7 +2563,7 @@ async function loadNuxt(opts) {
2563
2563
  throw new Error(`Cannot find any nuxt version from ${opts.cwd}`);
2564
2564
  }
2565
2565
  const pkg = await readPackageJSON(nearestNuxtPkg);
2566
- const majorVersion = parseInt((pkg.version || "").split(".")[0]);
2566
+ const majorVersion = pkg.version ? parseInt(pkg.version.split(".")[0]) : "";
2567
2567
  const rootDir = pathToFileURL(opts.cwd || process.cwd()).href;
2568
2568
  if (majorVersion === 3) {
2569
2569
  const { loadNuxt: loadNuxt3 } = await importModule(pkg._name || pkg.name, rootDir);
@@ -2720,6 +2720,7 @@ async function addComponent(opts) {
2720
2720
  mode: "all",
2721
2721
  shortPath: opts.filePath,
2722
2722
  priority: 0,
2723
+ meta: {},
2723
2724
  ...opts
2724
2725
  };
2725
2726
  nuxt.hook("components:extend", (components) => {
@@ -2796,7 +2797,7 @@ function normalizeTemplate(template) {
2796
2797
  async function updateTemplates(options) {
2797
2798
  return await tryUseNuxt()?.hooks.callHook("builder:generateApp", options);
2798
2799
  }
2799
- async function writeTypes(nuxt) {
2800
+ async function _generateTypes(nuxt) {
2800
2801
  const nodeModulePaths = getModulePaths(nuxt.options.modulesDir);
2801
2802
  const rootDirWithSlash = withTrailingSlash(nuxt.options.rootDir);
2802
2803
  const modulePaths = await resolveNuxtModule(
@@ -2827,6 +2828,7 @@ async function writeTypes(nuxt) {
2827
2828
  },
2828
2829
  include: [
2829
2830
  "./nuxt.d.ts",
2831
+ join(relativeWithDot(nuxt.options.buildDir, nuxt.options.rootDir), ".config/nuxt.*"),
2830
2832
  join(relativeWithDot(nuxt.options.buildDir, nuxt.options.rootDir), "**/*"),
2831
2833
  ...nuxt.options.srcDir !== nuxt.options.rootDir ? [join(relative(nuxt.options.buildDir, nuxt.options.srcDir), "**/*")] : [],
2832
2834
  ...nuxt.options._layers.map((layer) => layer.config.srcDir ?? layer.cwd).filter((srcOrCwd) => !srcOrCwd.startsWith(rootDirWithSlash) || srcOrCwd.includes("node_modules")).map((srcOrCwd) => join(relative(nuxt.options.buildDir, srcOrCwd), "**/*")),
@@ -2912,6 +2914,13 @@ async function writeTypes(nuxt) {
2912
2914
  "export {}",
2913
2915
  ""
2914
2916
  ].join("\n");
2917
+ return {
2918
+ declaration,
2919
+ tsConfig
2920
+ };
2921
+ }
2922
+ async function writeTypes(nuxt) {
2923
+ const { tsConfig, declaration } = await _generateTypes(nuxt);
2915
2924
  async function writeFile() {
2916
2925
  const GeneratedBy = "// Generated by nuxi";
2917
2926
  const tsConfigPath = resolve(nuxt.options.buildDir, "tsconfig.json");
@@ -2988,13 +2997,16 @@ function addRouteMiddleware(input, options = {}) {
2988
2997
  for (const middleware of middlewares) {
2989
2998
  const find = app.middleware.findIndex((item) => item.name === middleware.name);
2990
2999
  if (find >= 0) {
3000
+ if (app.middleware[find].path === middleware.path) {
3001
+ continue;
3002
+ }
2991
3003
  if (options.override === true) {
2992
- app.middleware[find] = middleware;
3004
+ app.middleware[find] = { ...middleware };
2993
3005
  } else {
2994
3006
  logger.warn(`'${middleware.name}' middleware already exists at '${app.middleware[find].path}'. You can set \`override: true\` to replace it.`);
2995
3007
  }
2996
3008
  } else {
2997
- app.middleware.push(middleware);
3009
+ app.middleware.push({ ...middleware });
2998
3010
  }
2999
3011
  }
3000
3012
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/kit",
3
- "version": "3.10.2",
3
+ "version": "3.11.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -23,7 +23,7 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "c12": "^1.7.0",
26
+ "c12": "^1.10.0",
27
27
  "consola": "^3.2.3",
28
28
  "defu": "^6.1.4",
29
29
  "globby": "^14.0.1",
@@ -31,27 +31,27 @@
31
31
  "ignore": "^5.3.1",
32
32
  "jiti": "^1.21.0",
33
33
  "knitwork": "^1.0.0",
34
- "mlly": "^1.5.0",
34
+ "mlly": "^1.6.1",
35
35
  "pathe": "^1.1.2",
36
36
  "pkg-types": "^1.0.3",
37
37
  "scule": "^1.3.0",
38
38
  "semver": "^7.6.0",
39
- "ufo": "^1.4.0",
39
+ "ufo": "^1.5.1",
40
40
  "unctx": "^2.3.1",
41
41
  "unimport": "^3.7.1",
42
42
  "untyped": "^1.4.2",
43
- "@nuxt/schema": "3.10.2"
43
+ "@nuxt/schema": "3.11.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/hash-sum": "1.0.2",
47
47
  "@types/lodash-es": "4.17.12",
48
- "@types/semver": "7.5.7",
48
+ "@types/semver": "7.5.8",
49
49
  "lodash-es": "4.17.21",
50
- "nitropack": "2.8.1",
50
+ "nitropack": "2.9.4",
51
51
  "unbuild": "latest",
52
- "vite": "5.1.1",
53
- "vitest": "1.2.2",
54
- "webpack": "5.90.1"
52
+ "vite": "5.1.6",
53
+ "vitest": "1.4.0",
54
+ "webpack": "5.90.3"
55
55
  },
56
56
  "engines": {
57
57
  "node": "^14.18.0 || >=16.10.0"