@nuxt/kit-nightly 4.2.3-29430446.f36dac0d → 4.3.0-29430576.f48ea4c8

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.d.mts CHANGED
@@ -130,6 +130,8 @@ declare function useRuntimeConfig(): Record<string, any>;
130
130
  */
131
131
  declare function updateRuntimeConfig(runtimeConfig: Record<string, unknown>): void | Promise<void>;
132
132
 
133
+ type Arrayable<T> = T | T[];
134
+ type Thenable<T> = T | Promise<T>;
133
135
  interface ExtendConfigOptions {
134
136
  /**
135
137
  * Install plugin on dev
@@ -194,23 +196,23 @@ declare const extendRspackConfig: ExtendWebpacklikeConfig;
194
196
  /**
195
197
  * Extend Vite config
196
198
  */
197
- declare function extendViteConfig(fn: ((config: UserConfig) => void), options?: ExtendViteConfigOptions): (() => void) | undefined;
199
+ declare function extendViteConfig(fn: ((config: UserConfig) => Thenable<void>), options?: ExtendViteConfigOptions): (() => void) | undefined;
198
200
  /**
199
201
  * Append webpack plugin to the config.
200
202
  */
201
- declare function addWebpackPlugin(pluginOrGetter: WebpackPluginInstance | WebpackPluginInstance[] | (() => WebpackPluginInstance | WebpackPluginInstance[]), options?: ExtendWebpackConfigOptions): void;
203
+ declare function addWebpackPlugin(pluginOrGetter: Arrayable<WebpackPluginInstance> | (() => Thenable<Arrayable<WebpackPluginInstance>>), options?: ExtendWebpackConfigOptions): void;
202
204
  /**
203
205
  * Append rspack plugin to the config.
204
206
  */
205
- declare function addRspackPlugin(pluginOrGetter: RspackPluginInstance | RspackPluginInstance[] | (() => RspackPluginInstance | RspackPluginInstance[]), options?: ExtendWebpackConfigOptions): void;
207
+ declare function addRspackPlugin(pluginOrGetter: Arrayable<RspackPluginInstance> | (() => Thenable<Arrayable<RspackPluginInstance>>), options?: ExtendWebpackConfigOptions): void;
206
208
  /**
207
209
  * Append Vite plugin to the config.
208
210
  */
209
- declare function addVitePlugin(pluginOrGetter: Plugin | Plugin[] | (() => Plugin | Plugin[]), options?: ExtendConfigOptions): void;
211
+ declare function addVitePlugin(pluginOrGetter: Arrayable<Plugin> | (() => Thenable<Arrayable<Plugin>>), options?: ExtendConfigOptions): void;
210
212
  interface AddBuildPluginFactory {
211
- vite?: () => Plugin | Plugin[];
212
- webpack?: () => WebpackPluginInstance | WebpackPluginInstance[];
213
- rspack?: () => RspackPluginInstance | RspackPluginInstance[];
213
+ vite?: () => Thenable<Arrayable<Plugin>>;
214
+ webpack?: () => Thenable<Arrayable<WebpackPluginInstance>>;
215
+ rspack?: () => Thenable<Arrayable<RspackPluginInstance>>;
214
216
  }
215
217
  declare function addBuildPlugin(pluginFactory: AddBuildPluginFactory, options?: ExtendConfigOptions): void;
216
218
 
package/dist/index.d.ts CHANGED
@@ -130,6 +130,8 @@ declare function useRuntimeConfig(): Record<string, any>;
130
130
  */
131
131
  declare function updateRuntimeConfig(runtimeConfig: Record<string, unknown>): void | Promise<void>;
132
132
 
133
+ type Arrayable<T> = T | T[];
134
+ type Thenable<T> = T | Promise<T>;
133
135
  interface ExtendConfigOptions {
134
136
  /**
135
137
  * Install plugin on dev
@@ -194,23 +196,23 @@ declare const extendRspackConfig: ExtendWebpacklikeConfig;
194
196
  /**
195
197
  * Extend Vite config
196
198
  */
197
- declare function extendViteConfig(fn: ((config: UserConfig) => void), options?: ExtendViteConfigOptions): (() => void) | undefined;
199
+ declare function extendViteConfig(fn: ((config: UserConfig) => Thenable<void>), options?: ExtendViteConfigOptions): (() => void) | undefined;
198
200
  /**
199
201
  * Append webpack plugin to the config.
200
202
  */
201
- declare function addWebpackPlugin(pluginOrGetter: WebpackPluginInstance | WebpackPluginInstance[] | (() => WebpackPluginInstance | WebpackPluginInstance[]), options?: ExtendWebpackConfigOptions): void;
203
+ declare function addWebpackPlugin(pluginOrGetter: Arrayable<WebpackPluginInstance> | (() => Thenable<Arrayable<WebpackPluginInstance>>), options?: ExtendWebpackConfigOptions): void;
202
204
  /**
203
205
  * Append rspack plugin to the config.
204
206
  */
205
- declare function addRspackPlugin(pluginOrGetter: RspackPluginInstance | RspackPluginInstance[] | (() => RspackPluginInstance | RspackPluginInstance[]), options?: ExtendWebpackConfigOptions): void;
207
+ declare function addRspackPlugin(pluginOrGetter: Arrayable<RspackPluginInstance> | (() => Thenable<Arrayable<RspackPluginInstance>>), options?: ExtendWebpackConfigOptions): void;
206
208
  /**
207
209
  * Append Vite plugin to the config.
208
210
  */
209
- declare function addVitePlugin(pluginOrGetter: Plugin | Plugin[] | (() => Plugin | Plugin[]), options?: ExtendConfigOptions): void;
211
+ declare function addVitePlugin(pluginOrGetter: Arrayable<Plugin> | (() => Thenable<Arrayable<Plugin>>), options?: ExtendConfigOptions): void;
210
212
  interface AddBuildPluginFactory {
211
- vite?: () => Plugin | Plugin[];
212
- webpack?: () => WebpackPluginInstance | WebpackPluginInstance[];
213
- rspack?: () => RspackPluginInstance | RspackPluginInstance[];
213
+ vite?: () => Thenable<Arrayable<Plugin>>;
214
+ webpack?: () => Thenable<Arrayable<WebpackPluginInstance>>;
215
+ rspack?: () => Thenable<Arrayable<RspackPluginInstance>>;
214
216
  }
215
217
  declare function addBuildPlugin(pluginFactory: AddBuildPluginFactory, options?: ExtendConfigOptions): void;
216
218
 
package/dist/index.mjs CHANGED
@@ -1172,17 +1172,17 @@ const extendWebpackCompatibleConfig = (builder) => (fn, options = {}) => {
1172
1172
  if (options.build === false && nuxt.options.build) {
1173
1173
  return;
1174
1174
  }
1175
- nuxt.hook(`${builder}:config`, (configs) => {
1175
+ nuxt.hook(`${builder}:config`, async (configs) => {
1176
1176
  if (options.server !== false) {
1177
1177
  const config = configs.find((i) => i.name === "server");
1178
1178
  if (config) {
1179
- fn(config);
1179
+ await fn(config);
1180
1180
  }
1181
1181
  }
1182
1182
  if (options.client !== false) {
1183
1183
  const config = configs.find((i) => i.name === "client");
1184
1184
  if (config) {
1185
- fn(config);
1185
+ await fn(config);
1186
1186
  }
1187
1187
  }
1188
1188
  });
@@ -1206,17 +1206,17 @@ function extendViteConfig(fn, options = {}) {
1206
1206
  return nuxt.hook("vite:extend", ({ config }) => fn(config));
1207
1207
  }
1208
1208
  function addWebpackPlugin(pluginOrGetter, options) {
1209
- extendWebpackConfig((config) => {
1209
+ extendWebpackConfig(async (config) => {
1210
1210
  const method = options?.prepend ? "unshift" : "push";
1211
- const plugin = typeof pluginOrGetter === "function" ? pluginOrGetter() : pluginOrGetter;
1211
+ const plugin = typeof pluginOrGetter === "function" ? await pluginOrGetter() : pluginOrGetter;
1212
1212
  config.plugins ||= [];
1213
1213
  config.plugins[method](...toArray(plugin));
1214
1214
  }, options);
1215
1215
  }
1216
1216
  function addRspackPlugin(pluginOrGetter, options) {
1217
- extendRspackConfig((config) => {
1217
+ extendRspackConfig(async (config) => {
1218
1218
  const method = options?.prepend ? "unshift" : "push";
1219
- const plugin = typeof pluginOrGetter === "function" ? pluginOrGetter() : pluginOrGetter;
1219
+ const plugin = typeof pluginOrGetter === "function" ? await pluginOrGetter() : pluginOrGetter;
1220
1220
  config.plugins ||= [];
1221
1221
  config.plugins[method](...toArray(plugin));
1222
1222
  }, options);
@@ -1230,9 +1230,9 @@ function addVitePlugin(pluginOrGetter, options = {}) {
1230
1230
  return;
1231
1231
  }
1232
1232
  let needsEnvInjection = false;
1233
- nuxt.hook("vite:extend", ({ config }) => {
1233
+ nuxt.hook("vite:extend", async ({ config }) => {
1234
1234
  config.plugins ||= [];
1235
- const plugin = toArray(typeof pluginOrGetter === "function" ? pluginOrGetter() : pluginOrGetter);
1235
+ const plugin = toArray(typeof pluginOrGetter === "function" ? await pluginOrGetter() : pluginOrGetter);
1236
1236
  if (options.server !== false && options.client !== false) {
1237
1237
  const method = options?.prepend ? "unshift" : "push";
1238
1238
  config.plugins[method](...plugin);
@@ -1254,11 +1254,11 @@ function addVitePlugin(pluginOrGetter, options = {}) {
1254
1254
  }
1255
1255
  });
1256
1256
  });
1257
- nuxt.hook("vite:extendConfig", (config, env) => {
1257
+ nuxt.hook("vite:extendConfig", async (config, env) => {
1258
1258
  if (!needsEnvInjection) {
1259
1259
  return;
1260
1260
  }
1261
- const plugin = toArray(typeof pluginOrGetter === "function" ? pluginOrGetter() : pluginOrGetter);
1261
+ const plugin = toArray(typeof pluginOrGetter === "function" ? await pluginOrGetter() : pluginOrGetter);
1262
1262
  const method = options?.prepend ? "unshift" : "push";
1263
1263
  if (env.isClient && options.server === false) {
1264
1264
  config.plugins[method](...plugin);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/kit-nightly",
3
- "version": "4.2.3-29430446.f36dac0d",
3
+ "version": "4.3.0-29430576.f48ea4c8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -45,7 +45,7 @@
45
45
  "untyped": "^2.0.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.2.3-29430446.f36dac0d",
48
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.3.0-29430576.f48ea4c8",
49
49
  "@rspack/core": "1.6.7",
50
50
  "@types/semver": "7.7.1",
51
51
  "hookable": "5.5.3",