@nuxt/kit 3.7.4 → 3.8.1
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 +2 -2
- package/dist/index.d.mts +13 -12
- package/dist/index.d.ts +13 -12
- package/dist/index.mjs +42 -13
- package/package.json +14 -13
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ It provides a number of features that make it easy to build fast, SEO-friendly,
|
|
|
17
17
|
- Automatic routing with code-splitting
|
|
18
18
|
- State management
|
|
19
19
|
- SEO Optimization
|
|
20
|
-
-
|
|
20
|
+
- Extensible with [100+ modules](https://nuxt.com/modules)
|
|
21
21
|
- Deployment to a variety of hosting platforms
|
|
22
22
|
- ...[and much more](https://nuxt.com) 🚀
|
|
23
23
|
|
|
@@ -50,7 +50,7 @@ Here are a few ways you can get involved:
|
|
|
50
50
|
|
|
51
51
|
## Local Development
|
|
52
52
|
|
|
53
|
-
Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/docs/community/framework-contribution#
|
|
53
|
+
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.
|
|
54
54
|
|
|
55
55
|
## Nuxt 2
|
|
56
56
|
|
package/dist/index.d.mts
CHANGED
|
@@ -16,6 +16,7 @@ declare function defineNuxtModule<OptionsT extends ModuleOptions>(definition: Mo
|
|
|
16
16
|
|
|
17
17
|
/** Installs a module on a Nuxt instance. */
|
|
18
18
|
declare function installModule(moduleToInstall: string | NuxtModule, inlineOptions?: any, nuxt?: Nuxt): Promise<void>;
|
|
19
|
+
declare function getDirectory(p: string): string;
|
|
19
20
|
declare const normalizeModuleTranspilePath: (p: string) => string;
|
|
20
21
|
declare function loadNuxtModuleInstance(nuxtModule: string | NuxtModule, nuxt?: Nuxt): Promise<{
|
|
21
22
|
nuxtModule: NuxtModule<any>;
|
|
@@ -68,30 +69,26 @@ declare function addImportsSources(presets: ImportPresetWithDeprecation | Import
|
|
|
68
69
|
interface ExtendConfigOptions {
|
|
69
70
|
/**
|
|
70
71
|
* Install plugin on dev
|
|
71
|
-
*
|
|
72
72
|
* @default true
|
|
73
73
|
*/
|
|
74
74
|
dev?: boolean;
|
|
75
75
|
/**
|
|
76
76
|
* Install plugin on build
|
|
77
|
-
*
|
|
78
77
|
* @default true
|
|
79
78
|
*/
|
|
80
79
|
build?: boolean;
|
|
81
80
|
/**
|
|
82
81
|
* Install plugin on server side
|
|
83
|
-
*
|
|
84
82
|
* @default true
|
|
85
83
|
*/
|
|
86
84
|
server?: boolean;
|
|
87
85
|
/**
|
|
88
86
|
* Install plugin on client side
|
|
89
|
-
*
|
|
90
87
|
* @default true
|
|
91
88
|
*/
|
|
92
89
|
client?: boolean;
|
|
93
90
|
/**
|
|
94
|
-
* Prepends the plugin to the array with `
|
|
91
|
+
* Prepends the plugin to the array with `unshift()` instead of `push()`.
|
|
95
92
|
*/
|
|
96
93
|
prepend?: boolean;
|
|
97
94
|
}
|
|
@@ -173,7 +170,6 @@ declare const nuxtCtx: unctx_index.UseContext<Nuxt>;
|
|
|
173
170
|
* Get access to Nuxt instance.
|
|
174
171
|
*
|
|
175
172
|
* Throws an error if Nuxt instance is unavailable.
|
|
176
|
-
*
|
|
177
173
|
* @example
|
|
178
174
|
* ```js
|
|
179
175
|
* const nuxt = useNuxt()
|
|
@@ -184,7 +180,6 @@ declare function useNuxt(): Nuxt;
|
|
|
184
180
|
* Get access to Nuxt instance.
|
|
185
181
|
*
|
|
186
182
|
* Returns null if Nuxt instance is unavailable.
|
|
187
|
-
*
|
|
188
183
|
* @example
|
|
189
184
|
* ```js
|
|
190
185
|
* const nuxt = tryUseNuxt()
|
|
@@ -207,7 +202,6 @@ declare function extendPages(cb: NuxtHooks['pages:extend']): void;
|
|
|
207
202
|
interface ExtendRouteRulesOptions {
|
|
208
203
|
/**
|
|
209
204
|
* Override route rule config
|
|
210
|
-
*
|
|
211
205
|
* @default false
|
|
212
206
|
*/
|
|
213
207
|
override?: boolean;
|
|
@@ -216,7 +210,6 @@ declare function extendRouteRules(route: string, rule: NitroRouteConfig, options
|
|
|
216
210
|
interface AddRouteMiddlewareOptions {
|
|
217
211
|
/**
|
|
218
212
|
* Override existing middleware with the same name, if it exists
|
|
219
|
-
*
|
|
220
213
|
* @default false
|
|
221
214
|
*/
|
|
222
215
|
override?: boolean;
|
|
@@ -234,7 +227,6 @@ declare function normalizePlugin(plugin: NuxtPlugin | string): NuxtPlugin;
|
|
|
234
227
|
* to use plugin only in client or server side.
|
|
235
228
|
*
|
|
236
229
|
* Note: By default plugin is prepended to the plugins array. You can use second argument to append (push) instead.
|
|
237
|
-
*
|
|
238
230
|
* @example
|
|
239
231
|
* ```js
|
|
240
232
|
* addPlugin({
|
|
@@ -311,7 +303,6 @@ declare function addPrerenderRoutes(routes: string | string[]): void;
|
|
|
311
303
|
* **Note:** You can call `useNitro()` only after `ready` hook.
|
|
312
304
|
*
|
|
313
305
|
* **Note:** Changes to the Nitro instance configuration are not applied.
|
|
314
|
-
*
|
|
315
306
|
* @example
|
|
316
307
|
*
|
|
317
308
|
* ```ts
|
|
@@ -321,6 +312,16 @@ declare function addPrerenderRoutes(routes: string | string[]): void;
|
|
|
321
312
|
* ```
|
|
322
313
|
*/
|
|
323
314
|
declare function useNitro(): Nitro;
|
|
315
|
+
/**
|
|
316
|
+
* Add server imports to be auto-imported by Nitro
|
|
317
|
+
*/
|
|
318
|
+
declare function addServerImports(imports: Import[]): void;
|
|
319
|
+
/**
|
|
320
|
+
* Add directories to be scanned for auto-imports by Nitro
|
|
321
|
+
*/
|
|
322
|
+
declare function addServerImportsDir(dirs: string | string[], opts?: {
|
|
323
|
+
prepend?: boolean;
|
|
324
|
+
}): void;
|
|
324
325
|
|
|
325
326
|
/**
|
|
326
327
|
* Renders given template using lodash template during build into the project buildDir
|
|
@@ -389,4 +390,4 @@ declare const templateUtils: {
|
|
|
389
390
|
}) => string;
|
|
390
391
|
};
|
|
391
392
|
|
|
392
|
-
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type LoadNuxtConfigOptions, type LoadNuxtOptions, type RequireModuleOptions, type ResolveModuleOptions, type ResolvePathOptions, type Resolver, addBuildPlugin, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addServerHandler, addServerPlugin, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createResolver, defineNuxtModule, extendNuxtSchema, extendPages, extendRouteRules, extendViteConfig, extendWebpackConfig, findPath, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateTemplates, useLogger, useNitro, useNuxt, writeTypes };
|
|
393
|
+
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type LoadNuxtConfigOptions, type LoadNuxtOptions, type RequireModuleOptions, type ResolveModuleOptions, type ResolvePathOptions, type Resolver, addBuildPlugin, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createResolver, defineNuxtModule, extendNuxtSchema, extendPages, extendRouteRules, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateTemplates, useLogger, useNitro, useNuxt, writeTypes };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ declare function defineNuxtModule<OptionsT extends ModuleOptions>(definition: Mo
|
|
|
16
16
|
|
|
17
17
|
/** Installs a module on a Nuxt instance. */
|
|
18
18
|
declare function installModule(moduleToInstall: string | NuxtModule, inlineOptions?: any, nuxt?: Nuxt): Promise<void>;
|
|
19
|
+
declare function getDirectory(p: string): string;
|
|
19
20
|
declare const normalizeModuleTranspilePath: (p: string) => string;
|
|
20
21
|
declare function loadNuxtModuleInstance(nuxtModule: string | NuxtModule, nuxt?: Nuxt): Promise<{
|
|
21
22
|
nuxtModule: NuxtModule<any>;
|
|
@@ -68,30 +69,26 @@ declare function addImportsSources(presets: ImportPresetWithDeprecation | Import
|
|
|
68
69
|
interface ExtendConfigOptions {
|
|
69
70
|
/**
|
|
70
71
|
* Install plugin on dev
|
|
71
|
-
*
|
|
72
72
|
* @default true
|
|
73
73
|
*/
|
|
74
74
|
dev?: boolean;
|
|
75
75
|
/**
|
|
76
76
|
* Install plugin on build
|
|
77
|
-
*
|
|
78
77
|
* @default true
|
|
79
78
|
*/
|
|
80
79
|
build?: boolean;
|
|
81
80
|
/**
|
|
82
81
|
* Install plugin on server side
|
|
83
|
-
*
|
|
84
82
|
* @default true
|
|
85
83
|
*/
|
|
86
84
|
server?: boolean;
|
|
87
85
|
/**
|
|
88
86
|
* Install plugin on client side
|
|
89
|
-
*
|
|
90
87
|
* @default true
|
|
91
88
|
*/
|
|
92
89
|
client?: boolean;
|
|
93
90
|
/**
|
|
94
|
-
* Prepends the plugin to the array with `
|
|
91
|
+
* Prepends the plugin to the array with `unshift()` instead of `push()`.
|
|
95
92
|
*/
|
|
96
93
|
prepend?: boolean;
|
|
97
94
|
}
|
|
@@ -173,7 +170,6 @@ declare const nuxtCtx: unctx_index.UseContext<Nuxt>;
|
|
|
173
170
|
* Get access to Nuxt instance.
|
|
174
171
|
*
|
|
175
172
|
* Throws an error if Nuxt instance is unavailable.
|
|
176
|
-
*
|
|
177
173
|
* @example
|
|
178
174
|
* ```js
|
|
179
175
|
* const nuxt = useNuxt()
|
|
@@ -184,7 +180,6 @@ declare function useNuxt(): Nuxt;
|
|
|
184
180
|
* Get access to Nuxt instance.
|
|
185
181
|
*
|
|
186
182
|
* Returns null if Nuxt instance is unavailable.
|
|
187
|
-
*
|
|
188
183
|
* @example
|
|
189
184
|
* ```js
|
|
190
185
|
* const nuxt = tryUseNuxt()
|
|
@@ -207,7 +202,6 @@ declare function extendPages(cb: NuxtHooks['pages:extend']): void;
|
|
|
207
202
|
interface ExtendRouteRulesOptions {
|
|
208
203
|
/**
|
|
209
204
|
* Override route rule config
|
|
210
|
-
*
|
|
211
205
|
* @default false
|
|
212
206
|
*/
|
|
213
207
|
override?: boolean;
|
|
@@ -216,7 +210,6 @@ declare function extendRouteRules(route: string, rule: NitroRouteConfig, options
|
|
|
216
210
|
interface AddRouteMiddlewareOptions {
|
|
217
211
|
/**
|
|
218
212
|
* Override existing middleware with the same name, if it exists
|
|
219
|
-
*
|
|
220
213
|
* @default false
|
|
221
214
|
*/
|
|
222
215
|
override?: boolean;
|
|
@@ -234,7 +227,6 @@ declare function normalizePlugin(plugin: NuxtPlugin | string): NuxtPlugin;
|
|
|
234
227
|
* to use plugin only in client or server side.
|
|
235
228
|
*
|
|
236
229
|
* Note: By default plugin is prepended to the plugins array. You can use second argument to append (push) instead.
|
|
237
|
-
*
|
|
238
230
|
* @example
|
|
239
231
|
* ```js
|
|
240
232
|
* addPlugin({
|
|
@@ -311,7 +303,6 @@ declare function addPrerenderRoutes(routes: string | string[]): void;
|
|
|
311
303
|
* **Note:** You can call `useNitro()` only after `ready` hook.
|
|
312
304
|
*
|
|
313
305
|
* **Note:** Changes to the Nitro instance configuration are not applied.
|
|
314
|
-
*
|
|
315
306
|
* @example
|
|
316
307
|
*
|
|
317
308
|
* ```ts
|
|
@@ -321,6 +312,16 @@ declare function addPrerenderRoutes(routes: string | string[]): void;
|
|
|
321
312
|
* ```
|
|
322
313
|
*/
|
|
323
314
|
declare function useNitro(): Nitro;
|
|
315
|
+
/**
|
|
316
|
+
* Add server imports to be auto-imported by Nitro
|
|
317
|
+
*/
|
|
318
|
+
declare function addServerImports(imports: Import[]): void;
|
|
319
|
+
/**
|
|
320
|
+
* Add directories to be scanned for auto-imports by Nitro
|
|
321
|
+
*/
|
|
322
|
+
declare function addServerImportsDir(dirs: string | string[], opts?: {
|
|
323
|
+
prepend?: boolean;
|
|
324
|
+
}): void;
|
|
324
325
|
|
|
325
326
|
/**
|
|
326
327
|
* Renders given template using lodash template during build into the project buildDir
|
|
@@ -389,4 +390,4 @@ declare const templateUtils: {
|
|
|
389
390
|
}) => string;
|
|
390
391
|
};
|
|
391
392
|
|
|
392
|
-
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type LoadNuxtConfigOptions, type LoadNuxtOptions, type RequireModuleOptions, type ResolveModuleOptions, type ResolvePathOptions, type Resolver, addBuildPlugin, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addServerHandler, addServerPlugin, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createResolver, defineNuxtModule, extendNuxtSchema, extendPages, extendRouteRules, extendViteConfig, extendWebpackConfig, findPath, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateTemplates, useLogger, useNitro, useNuxt, writeTypes };
|
|
393
|
+
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type LoadNuxtConfigOptions, type LoadNuxtOptions, type RequireModuleOptions, type ResolveModuleOptions, type ResolvePathOptions, type Resolver, addBuildPlugin, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createResolver, defineNuxtModule, extendNuxtSchema, extendPages, extendRouteRules, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateTemplates, useLogger, useNitro, useNuxt, writeTypes };
|
package/dist/index.mjs
CHANGED
|
@@ -2572,7 +2572,7 @@ async function loadNuxt(opts) {
|
|
|
2572
2572
|
opts.cwd = opts.cwd || opts.rootDir;
|
|
2573
2573
|
opts.overrides = opts.overrides || opts.config || {};
|
|
2574
2574
|
opts.overrides.dev = !!opts.dev;
|
|
2575
|
-
const nearestNuxtPkg = await Promise.all(["nuxt3", "nuxt", "nuxt-edge"].map((pkg2) => resolvePackageJSON(pkg2, { url: opts.cwd }).catch(() => null))).then((r) => r.filter(Boolean).sort((a, b) => b.length - a.length)[0]);
|
|
2575
|
+
const nearestNuxtPkg = await Promise.all(["nuxt-nightly", "nuxt3", "nuxt", "nuxt-edge"].map((pkg2) => resolvePackageJSON(pkg2, { url: opts.cwd }).catch(() => null))).then((r) => r.filter(Boolean).sort((a, b) => b.length - a.length)[0]);
|
|
2576
2576
|
if (!nearestNuxtPkg) {
|
|
2577
2577
|
throw new Error(`Cannot find any nuxt version from ${opts.cwd}`);
|
|
2578
2578
|
}
|
|
@@ -2593,12 +2593,22 @@ async function loadNuxt(opts) {
|
|
|
2593
2593
|
envConfig: opts.dotenv
|
|
2594
2594
|
// TODO: Backward format conversion
|
|
2595
2595
|
});
|
|
2596
|
+
nuxt.removeHook || (nuxt.removeHook = nuxt.clearHook.bind(nuxt));
|
|
2597
|
+
nuxt.removeAllHooks || (nuxt.removeAllHooks = nuxt.clearHooks.bind(nuxt));
|
|
2598
|
+
nuxt.hookOnce || (nuxt.hookOnce = (name, fn, ...hookArgs) => {
|
|
2599
|
+
const unsub = nuxt.hook(name, (...args) => {
|
|
2600
|
+
unsub();
|
|
2601
|
+
return fn(...args);
|
|
2602
|
+
}, ...hookArgs);
|
|
2603
|
+
return unsub;
|
|
2604
|
+
});
|
|
2605
|
+
nuxt.hooks || (nuxt.hooks = nuxt);
|
|
2596
2606
|
return nuxt;
|
|
2597
2607
|
}
|
|
2598
2608
|
async function buildNuxt(nuxt) {
|
|
2599
2609
|
const rootDir = pathToFileURL(nuxt.options.rootDir).href;
|
|
2600
2610
|
if (nuxt.options._majorVersion === 3) {
|
|
2601
|
-
const { build: build2 } = await tryImportModule("nuxt3", rootDir) || await importModule("nuxt", rootDir);
|
|
2611
|
+
const { build: build2 } = await tryImportModule("nuxt-nightly", rootDir) || await tryImportModule("nuxt3", rootDir) || await importModule("nuxt", rootDir);
|
|
2602
2612
|
return build2(nuxt);
|
|
2603
2613
|
}
|
|
2604
2614
|
const { build } = await tryImportModule("nuxt-edge", rootDir) || await importModule("nuxt", rootDir);
|
|
@@ -2804,11 +2814,11 @@ async function updateTemplates(options) {
|
|
|
2804
2814
|
return await tryUseNuxt()?.hooks.callHook("builder:generateApp", options);
|
|
2805
2815
|
}
|
|
2806
2816
|
async function writeTypes(nuxt) {
|
|
2807
|
-
const
|
|
2817
|
+
const nodeModulePaths = getModulePaths(nuxt.options.modulesDir);
|
|
2808
2818
|
const rootDirWithSlash = withTrailingSlash(nuxt.options.rootDir);
|
|
2809
|
-
const
|
|
2819
|
+
const modulePaths = await resolveNuxtModule(
|
|
2810
2820
|
rootDirWithSlash,
|
|
2811
|
-
nuxt.options._installedModules.filter((m) => m.entryPath).map((m) => m.entryPath)
|
|
2821
|
+
nuxt.options._installedModules.filter((m) => m.entryPath).map((m) => getDirectory(m.entryPath))
|
|
2812
2822
|
);
|
|
2813
2823
|
const tsConfig = defu(nuxt.options.typescript?.tsConfig, {
|
|
2814
2824
|
compilerOptions: {
|
|
@@ -2824,9 +2834,8 @@ async function writeTypes(nuxt) {
|
|
|
2824
2834
|
strict: nuxt.options.typescript?.strict ?? true,
|
|
2825
2835
|
noImplicitThis: true,
|
|
2826
2836
|
esModuleInterop: true,
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
// verbatimModuleSyntax: true,
|
|
2837
|
+
types: [],
|
|
2838
|
+
verbatimModuleSyntax: true,
|
|
2830
2839
|
allowJs: true,
|
|
2831
2840
|
noEmit: true,
|
|
2832
2841
|
resolveJsonModule: true,
|
|
@@ -2839,11 +2848,11 @@ async function writeTypes(nuxt) {
|
|
|
2839
2848
|
...nuxt.options.srcDir !== nuxt.options.rootDir ? [join(relative(nuxt.options.buildDir, nuxt.options.srcDir), "**/*")] : [],
|
|
2840
2849
|
...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), "**/*")),
|
|
2841
2850
|
...nuxt.options.typescript.includeWorkspace && nuxt.options.workspaceDir !== nuxt.options.rootDir ? [join(relative(nuxt.options.buildDir, nuxt.options.workspaceDir), "**/*")] : [],
|
|
2842
|
-
...
|
|
2851
|
+
...modulePaths.map((m) => join(relativeWithDot(nuxt.options.buildDir, m), "runtime"))
|
|
2843
2852
|
],
|
|
2844
2853
|
exclude: [
|
|
2845
2854
|
...nuxt.options.modulesDir.map((m) => relativeWithDot(nuxt.options.buildDir, m)),
|
|
2846
|
-
...
|
|
2855
|
+
...modulePaths.map((m) => join(relativeWithDot(nuxt.options.buildDir, m), "runtime/server")),
|
|
2847
2856
|
// nitro generate output: https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/core/nitro.ts#L186
|
|
2848
2857
|
relativeWithDot(nuxt.options.buildDir, resolve(nuxt.options.rootDir, "dist"))
|
|
2849
2858
|
]
|
|
@@ -2890,7 +2899,7 @@ async function writeTypes(nuxt) {
|
|
|
2890
2899
|
const references = await Promise.all([
|
|
2891
2900
|
...nuxt.options.modules,
|
|
2892
2901
|
...nuxt.options._modules
|
|
2893
|
-
].filter((f) => typeof f === "string").map(async (id) => ({ types: (await readPackageJSON(id, { url:
|
|
2902
|
+
].filter((f) => typeof f === "string").map(async (id) => ({ types: (await readPackageJSON(id, { url: nodeModulePaths }).catch(() => null))?.name || id })));
|
|
2894
2903
|
if (nuxt.options.experimental?.reactivityTransform) {
|
|
2895
2904
|
references.push({ types: "vue/macros-global" });
|
|
2896
2905
|
}
|
|
@@ -3022,7 +3031,7 @@ function normalizePlugin(plugin) {
|
|
|
3022
3031
|
}
|
|
3023
3032
|
const nonTopLevelPlugin = plugin.src.match(/\/plugins\/[^/]+\/index\.[^/]+$/i);
|
|
3024
3033
|
if (nonTopLevelPlugin && nonTopLevelPlugin.length > 0 && !useNuxt().options.plugins.find((i) => (typeof i === "string" ? i : i.src).endsWith(nonTopLevelPlugin[0]))) {
|
|
3025
|
-
logger.warn(`[deprecation] You are using a plugin that is within a subfolder of your plugins directory without adding it to your config explicitly. You can move it to the top-level plugins directory, or include the file '~${nonTopLevelPlugin[0]}' in your plugins config (https://nuxt.com/docs/api/
|
|
3034
|
+
logger.warn(`[deprecation] You are using a plugin that is within a subfolder of your plugins directory without adding it to your config explicitly. You can move it to the top-level plugins directory, or include the file '~${nonTopLevelPlugin[0]}' in your plugins config (https://nuxt.com/docs/api/nuxt-config#plugins-1) to remove this warning.`);
|
|
3026
3035
|
}
|
|
3027
3036
|
plugin.src = normalize(resolveAlias(plugin.src));
|
|
3028
3037
|
if (plugin.ssr) {
|
|
@@ -3087,5 +3096,25 @@ function useNitro() {
|
|
|
3087
3096
|
}
|
|
3088
3097
|
return nuxt._nitro;
|
|
3089
3098
|
}
|
|
3099
|
+
function addServerImports(imports) {
|
|
3100
|
+
const nuxt = useNuxt();
|
|
3101
|
+
nuxt.hook("nitro:config", (config) => {
|
|
3102
|
+
config.imports = config.imports || {};
|
|
3103
|
+
if (Array.isArray(config.imports.imports)) {
|
|
3104
|
+
config.imports.imports.push(...imports);
|
|
3105
|
+
} else {
|
|
3106
|
+
config.imports.imports = [config.imports.imports, ...imports];
|
|
3107
|
+
}
|
|
3108
|
+
});
|
|
3109
|
+
}
|
|
3110
|
+
function addServerImportsDir(dirs, opts = {}) {
|
|
3111
|
+
const nuxt = useNuxt();
|
|
3112
|
+
const _dirs = Array.isArray(dirs) ? dirs : [dirs];
|
|
3113
|
+
nuxt.hook("nitro:config", (config) => {
|
|
3114
|
+
config.imports = config.imports || {};
|
|
3115
|
+
config.imports.dirs = config.imports.dirs || [];
|
|
3116
|
+
config.imports.dirs[opts.prepend ? "unshift" : "push"](..._dirs);
|
|
3117
|
+
});
|
|
3118
|
+
}
|
|
3090
3119
|
|
|
3091
|
-
export { addBuildPlugin, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addServerHandler, addServerPlugin, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createResolver, defineNuxtModule, extendNuxtSchema, extendPages, extendRouteRules, extendViteConfig, extendWebpackConfig, findPath, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule$1 as importModule, installModule, isIgnored, isNuxt2, isNuxt3, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, templateUtils, tryImportModule$1 as tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateTemplates, useLogger, useNitro, useNuxt, writeTypes };
|
|
3120
|
+
export { addBuildPlugin, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createResolver, defineNuxtModule, extendNuxtSchema, extendPages, extendRouteRules, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule$1 as importModule, installModule, isIgnored, isNuxt2, isNuxt3, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, templateUtils, tryImportModule$1 as tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateTemplates, useLogger, useNitro, useNuxt, writeTypes };
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/kit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.1",
|
|
4
4
|
"repository": "nuxt/nuxt",
|
|
5
|
+
"description": "Toolkit for authoring modules and interacting with Nuxt",
|
|
5
6
|
"license": "MIT",
|
|
6
7
|
"type": "module",
|
|
7
8
|
"types": "./dist/index.d.ts",
|
|
@@ -17,35 +18,35 @@
|
|
|
17
18
|
"dist"
|
|
18
19
|
],
|
|
19
20
|
"dependencies": {
|
|
20
|
-
"c12": "^1.
|
|
21
|
+
"c12": "^1.5.1",
|
|
21
22
|
"consola": "^3.2.3",
|
|
22
|
-
"defu": "^6.1.
|
|
23
|
+
"defu": "^6.1.3",
|
|
23
24
|
"globby": "^13.2.2",
|
|
24
25
|
"hash-sum": "^2.0.0",
|
|
25
26
|
"ignore": "^5.2.4",
|
|
26
|
-
"jiti": "^1.
|
|
27
|
+
"jiti": "^1.21.0",
|
|
27
28
|
"knitwork": "^1.0.0",
|
|
28
29
|
"mlly": "^1.4.2",
|
|
29
30
|
"pathe": "^1.1.1",
|
|
30
31
|
"pkg-types": "^1.0.3",
|
|
31
32
|
"scule": "^1.0.0",
|
|
32
33
|
"semver": "^7.5.4",
|
|
33
|
-
"ufo": "^1.3.
|
|
34
|
+
"ufo": "^1.3.1",
|
|
34
35
|
"unctx": "^2.3.1",
|
|
35
|
-
"unimport": "^3.
|
|
36
|
+
"unimport": "^3.4.0",
|
|
36
37
|
"untyped": "^1.4.0",
|
|
37
|
-
"@nuxt/schema": "3.
|
|
38
|
+
"@nuxt/schema": "3.8.1"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
|
-
"@types/hash-sum": "1.0.
|
|
41
|
-
"@types/lodash-es": "4.17.
|
|
42
|
-
"@types/semver": "7.5.
|
|
41
|
+
"@types/hash-sum": "1.0.1",
|
|
42
|
+
"@types/lodash-es": "4.17.10",
|
|
43
|
+
"@types/semver": "7.5.4",
|
|
43
44
|
"lodash-es": "4.17.21",
|
|
44
|
-
"nitropack": "2.
|
|
45
|
+
"nitropack": "2.7.2",
|
|
45
46
|
"unbuild": "latest",
|
|
46
|
-
"vite": "4.
|
|
47
|
+
"vite": "4.5.0",
|
|
47
48
|
"vitest": "0.33.0",
|
|
48
|
-
"webpack": "5.
|
|
49
|
+
"webpack": "5.89.0"
|
|
49
50
|
},
|
|
50
51
|
"engines": {
|
|
51
52
|
"node": "^14.18.0 || >=16.10.0"
|