@nuxt/kit 3.0.0-rc.11 → 3.0.0-rc.12

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 - Nuxt Project
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.d.ts CHANGED
@@ -3,8 +3,8 @@ import { LoadConfigOptions } from 'c12';
3
3
  import { Import } from 'unimport';
4
4
  import { Configuration, WebpackPluginInstance } from 'webpack';
5
5
  import { UserConfig, Plugin } from 'vite';
6
- import * as unctx from 'unctx';
7
- import { Middleware } from 'h3';
6
+ import * as unctx_index from 'unctx/index';
7
+ import { NodeMiddleware } from 'h3';
8
8
  import { NitroEventHandler, NitroDevEventHandler, Nitro } from 'nitropack';
9
9
  import * as consola from 'consola';
10
10
  import { genSafeVariableName } from 'knitwork';
@@ -100,11 +100,11 @@ declare function extendViteConfig(fn: ((config: UserConfig) => void), options?:
100
100
  /**
101
101
  * Append Webpack plugin to the config.
102
102
  */
103
- declare function addWebpackPlugin(plugin: WebpackPluginInstance, options?: ExtendWebpackConfigOptions): void;
103
+ declare function addWebpackPlugin(plugin: WebpackPluginInstance | WebpackPluginInstance[], options?: ExtendWebpackConfigOptions): void;
104
104
  /**
105
105
  * Append Vite plugin to the config.
106
106
  */
107
- declare function addVitePlugin(plugin: Plugin, options?: ExtendViteConfigOptions): void;
107
+ declare function addVitePlugin(plugin: Plugin | Plugin[], options?: ExtendViteConfigOptions): void;
108
108
 
109
109
  /**
110
110
  * Check version constraints and return incompatibility issues as an array
@@ -149,7 +149,7 @@ declare type AddComponentOptions = {
149
149
  declare function addComponent(opts: AddComponentOptions): Promise<void>;
150
150
 
151
151
  /** Direct access to the Nuxt context - see https://github.com/unjs/unctx. */
152
- declare const nuxtCtx: unctx.UseContext<Nuxt>;
152
+ declare const nuxtCtx: unctx_index.UseContext<Nuxt>;
153
153
  /**
154
154
  * Get access to Nuxt instance.
155
155
  *
@@ -251,8 +251,8 @@ declare function resolveFiles(path: string, pattern: string | string[], opts?: {
251
251
  interface LegacyServerMiddleware {
252
252
  route?: string;
253
253
  path?: string;
254
- handle?: Middleware | string;
255
- handler: Middleware | string;
254
+ handle?: NodeMiddleware | string;
255
+ handler: NodeMiddleware | string;
256
256
  }
257
257
  /**
258
258
  * Adds a new server middleware to the end of the server middleware array.
package/dist/index.mjs CHANGED
@@ -473,7 +473,12 @@ async function normalizeModule(nuxtModule, inlineOptions) {
473
473
  if (typeof nuxtModule === "string") {
474
474
  const _src = resolveModule(resolveAlias(nuxtModule), { paths: nuxt.options.modulesDir });
475
475
  const isESM = _src.endsWith(".mjs");
476
- nuxtModule = isESM ? await importModule(_src) : requireModule(_src);
476
+ try {
477
+ nuxtModule = isESM ? await importModule(_src) : requireModule(_src);
478
+ } catch (error) {
479
+ console.error(`Error while requiring module \`${nuxtModule}\`: ${error}`);
480
+ throw error;
481
+ }
477
482
  }
478
483
  if (typeof nuxtModule !== "function") {
479
484
  throw new TypeError("Nuxt module should be a function: " + nuxtModule);
@@ -829,13 +834,21 @@ function extendViteConfig(fn, options = {}) {
829
834
  function addWebpackPlugin(plugin, options) {
830
835
  extendWebpackConfig((config) => {
831
836
  config.plugins = config.plugins || [];
832
- config.plugins.push(plugin);
837
+ if (Array.isArray(plugin)) {
838
+ config.plugins.push(...plugin);
839
+ } else {
840
+ config.plugins.push(plugin);
841
+ }
833
842
  }, options);
834
843
  }
835
844
  function addVitePlugin(plugin, options) {
836
845
  extendViteConfig((config) => {
837
846
  config.plugins = config.plugins || [];
838
- config.plugins.push(plugin);
847
+ if (Array.isArray(plugin)) {
848
+ config.plugins.push(...plugin);
849
+ } else {
850
+ config.plugins.push(plugin);
851
+ }
839
852
  }, options);
840
853
  }
841
854
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/kit",
3
- "version": "3.0.0-rc.11",
3
+ "version": "3.0.0-rc.12",
4
4
  "repository": "nuxt/framework",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -9,11 +9,8 @@
9
9
  "files": [
10
10
  "dist"
11
11
  ],
12
- "scripts": {
13
- "prepack": "unbuild"
14
- },
15
12
  "dependencies": {
16
- "@nuxt/schema": "3.0.0-rc.11",
13
+ "@nuxt/schema": "3.0.0-rc.12",
17
14
  "c12": "^0.2.13",
18
15
  "consola": "^2.15.3",
19
16
  "defu": "^6.1.0",
@@ -24,12 +21,12 @@
24
21
  "knitwork": "^0.1.2",
25
22
  "lodash.template": "^4.5.0",
26
23
  "mlly": "^0.5.16",
27
- "pathe": "^0.3.8",
24
+ "pathe": "^0.3.9",
28
25
  "pkg-types": "^0.3.5",
29
26
  "scule": "^0.3.2",
30
- "semver": "^7.3.7",
27
+ "semver": "^7.3.8",
31
28
  "unctx": "^2.0.2",
32
- "unimport": "^0.6.7",
29
+ "unimport": "^0.6.8",
33
30
  "untyped": "^0.5.0"
34
31
  },
35
32
  "devDependencies": {
@@ -38,6 +35,7 @@
38
35
  "unbuild": "latest"
39
36
  },
40
37
  "engines": {
41
- "node": "^14.16.0 || ^16.11.0 || ^17.0.0 || ^18.0.0"
42
- }
43
- }
38
+ "node": "^14.16.0 || ^16.10.0 || ^17.0.0 || ^18.0.0"
39
+ },
40
+ "scripts": {}
41
+ }