@nuxt/kit-nightly 4.2.0-29344661.0b65203b → 4.2.0-29344710.84b82c47
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 +2 -18
- package/dist/index.d.ts +2 -18
- package/dist/index.mjs +16 -51
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -158,23 +158,7 @@ interface ExtendConfigOptions {
|
|
|
158
158
|
}
|
|
159
159
|
interface ExtendWebpackConfigOptions extends ExtendConfigOptions {
|
|
160
160
|
}
|
|
161
|
-
interface ExtendViteConfigOptions extends
|
|
162
|
-
/**
|
|
163
|
-
* Extend server Vite configuration
|
|
164
|
-
* @default true
|
|
165
|
-
* @deprecated calling \`extendViteConfig\` with only server/client environment is deprecated.
|
|
166
|
-
* Nuxt 5+ uses the Vite Environment API which shares a configuration between environments.
|
|
167
|
-
* You can likely use a Vite plugin to achieve the same result.
|
|
168
|
-
*/
|
|
169
|
-
server?: boolean;
|
|
170
|
-
/**
|
|
171
|
-
* Extend client Vite configuration
|
|
172
|
-
* @default true
|
|
173
|
-
* @deprecated calling \`extendViteConfig\` with only server/client environment is deprecated.
|
|
174
|
-
* Nuxt 5+ uses the Vite Environment API which shares a configuration between environments.
|
|
175
|
-
* You can likely use a Vite plugin to achieve the same result.
|
|
176
|
-
*/
|
|
177
|
-
client?: boolean;
|
|
161
|
+
interface ExtendViteConfigOptions extends ExtendConfigOptions {
|
|
178
162
|
}
|
|
179
163
|
/**
|
|
180
164
|
* Extend webpack config
|
|
@@ -205,7 +189,7 @@ declare function addRspackPlugin(pluginOrGetter: RspackPluginInstance | RspackPl
|
|
|
205
189
|
/**
|
|
206
190
|
* Append Vite plugin to the config.
|
|
207
191
|
*/
|
|
208
|
-
declare function addVitePlugin(pluginOrGetter: Plugin | Plugin[] | (() => Plugin | Plugin[]), options?:
|
|
192
|
+
declare function addVitePlugin(pluginOrGetter: Plugin | Plugin[] | (() => Plugin | Plugin[]), options?: ExtendViteConfigOptions): void;
|
|
209
193
|
interface AddBuildPluginFactory {
|
|
210
194
|
vite?: () => Plugin | Plugin[];
|
|
211
195
|
webpack?: () => WebpackPluginInstance | WebpackPluginInstance[];
|
package/dist/index.d.ts
CHANGED
|
@@ -158,23 +158,7 @@ interface ExtendConfigOptions {
|
|
|
158
158
|
}
|
|
159
159
|
interface ExtendWebpackConfigOptions extends ExtendConfigOptions {
|
|
160
160
|
}
|
|
161
|
-
interface ExtendViteConfigOptions extends
|
|
162
|
-
/**
|
|
163
|
-
* Extend server Vite configuration
|
|
164
|
-
* @default true
|
|
165
|
-
* @deprecated calling \`extendViteConfig\` with only server/client environment is deprecated.
|
|
166
|
-
* Nuxt 5+ uses the Vite Environment API which shares a configuration between environments.
|
|
167
|
-
* You can likely use a Vite plugin to achieve the same result.
|
|
168
|
-
*/
|
|
169
|
-
server?: boolean;
|
|
170
|
-
/**
|
|
171
|
-
* Extend client Vite configuration
|
|
172
|
-
* @default true
|
|
173
|
-
* @deprecated calling \`extendViteConfig\` with only server/client environment is deprecated.
|
|
174
|
-
* Nuxt 5+ uses the Vite Environment API which shares a configuration between environments.
|
|
175
|
-
* You can likely use a Vite plugin to achieve the same result.
|
|
176
|
-
*/
|
|
177
|
-
client?: boolean;
|
|
161
|
+
interface ExtendViteConfigOptions extends ExtendConfigOptions {
|
|
178
162
|
}
|
|
179
163
|
/**
|
|
180
164
|
* Extend webpack config
|
|
@@ -205,7 +189,7 @@ declare function addRspackPlugin(pluginOrGetter: RspackPluginInstance | RspackPl
|
|
|
205
189
|
/**
|
|
206
190
|
* Append Vite plugin to the config.
|
|
207
191
|
*/
|
|
208
|
-
declare function addVitePlugin(pluginOrGetter: Plugin | Plugin[] | (() => Plugin | Plugin[]), options?:
|
|
192
|
+
declare function addVitePlugin(pluginOrGetter: Plugin | Plugin[] | (() => Plugin | Plugin[]), options?: ExtendViteConfigOptions): void;
|
|
209
193
|
interface AddBuildPluginFactory {
|
|
210
194
|
vite?: () => Plugin | Plugin[];
|
|
211
195
|
webpack?: () => WebpackPluginInstance | WebpackPluginInstance[];
|
package/dist/index.mjs
CHANGED
|
@@ -1162,13 +1162,17 @@ function extendViteConfig(fn, options = {}) {
|
|
|
1162
1162
|
if (options.build === false && nuxt.options.build) {
|
|
1163
1163
|
return;
|
|
1164
1164
|
}
|
|
1165
|
-
if (options.server
|
|
1166
|
-
|
|
1167
|
-
const explanation = caller ? ` (used at \`${resolveAlias(caller.source)}:${caller.line}:${caller.column}\`)` : "";
|
|
1168
|
-
const warning = `[@nuxt/kit] calling \`extendViteConfig\` with only server/client environment is deprecated${explanation}. Nuxt 5+ will use the Vite Environment API which shares a configuration between environments. You can likely use a Vite plugin to achieve the same result.`;
|
|
1169
|
-
warn(warning);
|
|
1165
|
+
if (options.server !== false && options.client !== false) {
|
|
1166
|
+
return nuxt.hook("vite:extend", ({ config }) => fn(config));
|
|
1170
1167
|
}
|
|
1171
|
-
|
|
1168
|
+
nuxt.hook("vite:extendConfig", (config, { isClient, isServer }) => {
|
|
1169
|
+
if (options.server !== false && isServer) {
|
|
1170
|
+
return fn(config);
|
|
1171
|
+
}
|
|
1172
|
+
if (options.client !== false && isClient) {
|
|
1173
|
+
return fn(config);
|
|
1174
|
+
}
|
|
1175
|
+
});
|
|
1172
1176
|
}
|
|
1173
1177
|
function addWebpackPlugin(pluginOrGetter, options) {
|
|
1174
1178
|
extendWebpackConfig((config) => {
|
|
@@ -1186,52 +1190,13 @@ function addRspackPlugin(pluginOrGetter, options) {
|
|
|
1186
1190
|
config.plugins[method](...toArray(plugin));
|
|
1187
1191
|
}, options);
|
|
1188
1192
|
}
|
|
1189
|
-
function addVitePlugin(pluginOrGetter, options
|
|
1190
|
-
|
|
1191
|
-
if (options.dev === false && nuxt.options.dev) {
|
|
1192
|
-
return;
|
|
1193
|
-
}
|
|
1194
|
-
if (options.build === false && nuxt.options.build) {
|
|
1195
|
-
return;
|
|
1196
|
-
}
|
|
1197
|
-
let needsEnvInjection = false;
|
|
1198
|
-
nuxt.hook("vite:extend", ({ config }) => {
|
|
1199
|
-
config.plugins ||= [];
|
|
1200
|
-
const plugin = toArray(typeof pluginOrGetter === "function" ? pluginOrGetter() : pluginOrGetter);
|
|
1201
|
-
if (options.server !== false && options.client !== false) {
|
|
1202
|
-
const method = options?.prepend ? "unshift" : "push";
|
|
1203
|
-
config.plugins[method](...plugin);
|
|
1204
|
-
return;
|
|
1205
|
-
}
|
|
1206
|
-
if (!config.environments?.ssr || !config.environments.client) {
|
|
1207
|
-
needsEnvInjection = true;
|
|
1208
|
-
return;
|
|
1209
|
-
}
|
|
1210
|
-
const environmentName = options.server === false ? "client" : "ssr";
|
|
1211
|
-
const pluginName = plugin.map((p) => p.name).join("|");
|
|
1212
|
-
config.plugins.push({
|
|
1213
|
-
name: `${pluginName}:wrapper`,
|
|
1214
|
-
enforce: options?.prepend ? "pre" : "post",
|
|
1215
|
-
applyToEnvironment(environment) {
|
|
1216
|
-
if (environment.name === environmentName) {
|
|
1217
|
-
return plugin;
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
});
|
|
1221
|
-
});
|
|
1222
|
-
nuxt.hook("vite:extendConfig", (config, env) => {
|
|
1223
|
-
if (!needsEnvInjection) {
|
|
1224
|
-
return;
|
|
1225
|
-
}
|
|
1226
|
-
const plugin = toArray(typeof pluginOrGetter === "function" ? pluginOrGetter() : pluginOrGetter);
|
|
1193
|
+
function addVitePlugin(pluginOrGetter, options) {
|
|
1194
|
+
extendViteConfig((config) => {
|
|
1227
1195
|
const method = options?.prepend ? "unshift" : "push";
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
config.plugins[method](...plugin);
|
|
1233
|
-
}
|
|
1234
|
-
});
|
|
1196
|
+
const plugin = typeof pluginOrGetter === "function" ? pluginOrGetter() : pluginOrGetter;
|
|
1197
|
+
config.plugins ||= [];
|
|
1198
|
+
config.plugins[method](...toArray(plugin));
|
|
1199
|
+
}, options);
|
|
1235
1200
|
}
|
|
1236
1201
|
function addBuildPlugin(pluginFactory, options) {
|
|
1237
1202
|
if (pluginFactory.vite) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/kit-nightly",
|
|
3
|
-
"version": "4.2.0-
|
|
3
|
+
"version": "4.2.0-29344710.84b82c47",
|
|
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.0-
|
|
48
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.2.0-29344710.84b82c47",
|
|
49
49
|
"@rspack/core": "1.5.8",
|
|
50
50
|
"@types/semver": "7.7.1",
|
|
51
51
|
"hookable": "5.5.3",
|