@nuxt/kit 3.14.1592 → 3.15.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 +1 -1
- package/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.mjs +35 -22
- package/package.json +17 -16
package/README.md
CHANGED
|
@@ -109,7 +109,7 @@ Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/
|
|
|
109
109
|
## <a name="follow-us">🔗 Follow Us</a>
|
|
110
110
|
|
|
111
111
|
<p valign="center">
|
|
112
|
-
<a href="https://go.nuxt.com/discord"><img width="20px" src="https://github.com/nuxt/nuxt/tree/main/.github/assets/discord.svg" alt="Discord"></a> <a href="https://go.nuxt.com/x"><img width="20px" src="https://github.com/nuxt/nuxt/tree/main/.github/assets/twitter.svg" alt="Twitter"></a> <a href="https://go.nuxt.com/github"><img width="20px" src="https://github.com/nuxt/nuxt/tree/main/.github/assets/github.svg" alt="GitHub"></a>
|
|
112
|
+
<a href="https://go.nuxt.com/discord"><img width="20px" src="https://github.com/nuxt/nuxt/tree/main/.github/assets/discord.svg" alt="Discord"></a> <a href="https://go.nuxt.com/x"><img width="20px" src="https://github.com/nuxt/nuxt/tree/main/.github/assets/twitter.svg" alt="Twitter"></a> <a href="https://go.nuxt.com/github"><img width="20px" src="https://github.com/nuxt/nuxt/tree/main/.github/assets/github.svg" alt="GitHub"></a> <a href="https://go.nuxt.com/bluesky"><img width="20px" src="https://github.com/nuxt/nuxt/tree/main/.github/assets/bluesky.svg" alt="Bluesky"></a>
|
|
113
113
|
</p>
|
|
114
114
|
|
|
115
115
|
## <a name="license">⚖️ License</a>
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModuleOptions, ModuleDefinition, NuxtModule, NuxtConfig, Nuxt, ModuleMeta, NuxtOptions, SchemaDefinition, ImportPresetWithDeprecation, NuxtCompatibility, NuxtCompatibilityIssues, ComponentsDir, Component, NuxtTemplate, NuxtHooks, NuxtMiddleware, NuxtPlugin, NuxtPluginTemplate, ResolvedNuxtTemplate, NuxtTypeTemplate } from '@nuxt/schema';
|
|
1
|
+
import { ModuleOptions, ModuleDefinition, NuxtModule, NuxtConfig, Nuxt, ModuleMeta, NuxtOptions, SchemaDefinition, ImportPresetWithDeprecation, NuxtCompatibility, NuxtCompatibilityIssues, ComponentsDir, Component, NuxtTemplate, NuxtHooks, NuxtMiddleware, NuxtPlugin, NuxtPluginTemplate, ResolvedNuxtTemplate, NuxtServerTemplate, NuxtTypeTemplate } from '@nuxt/schema';
|
|
2
2
|
import { LoadConfigOptions } from 'c12';
|
|
3
3
|
import { Import } from 'unimport';
|
|
4
4
|
import { Configuration, WebpackPluginInstance } from 'webpack';
|
|
@@ -26,6 +26,7 @@ declare const normalizeModuleTranspilePath: (p: string) => string;
|
|
|
26
26
|
declare function loadNuxtModuleInstance(nuxtModule: string | NuxtModule, nuxt?: Nuxt): Promise<{
|
|
27
27
|
nuxtModule: NuxtModule<any>;
|
|
28
28
|
buildTimeModuleMeta: ModuleMeta;
|
|
29
|
+
resolvedModulePath?: string;
|
|
29
30
|
}>;
|
|
30
31
|
|
|
31
32
|
/**
|
|
@@ -388,6 +389,10 @@ declare function addServerScanDir(dirs: string | string[], opts?: {
|
|
|
388
389
|
* Renders given template using lodash template during build into the project buildDir
|
|
389
390
|
*/
|
|
390
391
|
declare function addTemplate<T>(_template: NuxtTemplate<T> | string): ResolvedNuxtTemplate<T>;
|
|
392
|
+
/**
|
|
393
|
+
* Adds a virtual file that can be used within the Nuxt Nitro server build.
|
|
394
|
+
*/
|
|
395
|
+
declare function addServerTemplate(template: NuxtServerTemplate): NuxtServerTemplate;
|
|
391
396
|
/**
|
|
392
397
|
* Renders given types using lodash template during build into the project buildDir
|
|
393
398
|
* and register them as types.
|
|
@@ -396,7 +401,7 @@ declare function addTypeTemplate<T>(_template: NuxtTypeTemplate<T>): ResolvedNux
|
|
|
396
401
|
/**
|
|
397
402
|
* Normalize a nuxt template object
|
|
398
403
|
*/
|
|
399
|
-
declare function normalizeTemplate<T>(template: NuxtTemplate<T> | string): ResolvedNuxtTemplate<T>;
|
|
404
|
+
declare function normalizeTemplate<T>(template: NuxtTemplate<T> | string, buildDir?: string): ResolvedNuxtTemplate<T>;
|
|
400
405
|
/**
|
|
401
406
|
* Trigger rebuilding Nuxt templates
|
|
402
407
|
*
|
|
@@ -447,4 +452,4 @@ declare const templateUtils: {
|
|
|
447
452
|
}) => string;
|
|
448
453
|
};
|
|
449
454
|
|
|
450
|
-
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type ImportModuleOptions, type LoadNuxtConfigOptions, type LoadNuxtOptions, type ResolveModuleOptions, type ResolvePathOptions, type Resolver, addBuildPlugin, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createResolver, defineNuxtModule, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
|
455
|
+
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type ImportModuleOptions, type LoadNuxtConfigOptions, type LoadNuxtOptions, type ResolveModuleOptions, type ResolvePathOptions, type Resolver, addBuildPlugin, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createResolver, defineNuxtModule, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModuleOptions, ModuleDefinition, NuxtModule, NuxtConfig, Nuxt, ModuleMeta, NuxtOptions, SchemaDefinition, ImportPresetWithDeprecation, NuxtCompatibility, NuxtCompatibilityIssues, ComponentsDir, Component, NuxtTemplate, NuxtHooks, NuxtMiddleware, NuxtPlugin, NuxtPluginTemplate, ResolvedNuxtTemplate, NuxtTypeTemplate } from '@nuxt/schema';
|
|
1
|
+
import { ModuleOptions, ModuleDefinition, NuxtModule, NuxtConfig, Nuxt, ModuleMeta, NuxtOptions, SchemaDefinition, ImportPresetWithDeprecation, NuxtCompatibility, NuxtCompatibilityIssues, ComponentsDir, Component, NuxtTemplate, NuxtHooks, NuxtMiddleware, NuxtPlugin, NuxtPluginTemplate, ResolvedNuxtTemplate, NuxtServerTemplate, NuxtTypeTemplate } from '@nuxt/schema';
|
|
2
2
|
import { LoadConfigOptions } from 'c12';
|
|
3
3
|
import { Import } from 'unimport';
|
|
4
4
|
import { Configuration, WebpackPluginInstance } from 'webpack';
|
|
@@ -26,6 +26,7 @@ declare const normalizeModuleTranspilePath: (p: string) => string;
|
|
|
26
26
|
declare function loadNuxtModuleInstance(nuxtModule: string | NuxtModule, nuxt?: Nuxt): Promise<{
|
|
27
27
|
nuxtModule: NuxtModule<any>;
|
|
28
28
|
buildTimeModuleMeta: ModuleMeta;
|
|
29
|
+
resolvedModulePath?: string;
|
|
29
30
|
}>;
|
|
30
31
|
|
|
31
32
|
/**
|
|
@@ -388,6 +389,10 @@ declare function addServerScanDir(dirs: string | string[], opts?: {
|
|
|
388
389
|
* Renders given template using lodash template during build into the project buildDir
|
|
389
390
|
*/
|
|
390
391
|
declare function addTemplate<T>(_template: NuxtTemplate<T> | string): ResolvedNuxtTemplate<T>;
|
|
392
|
+
/**
|
|
393
|
+
* Adds a virtual file that can be used within the Nuxt Nitro server build.
|
|
394
|
+
*/
|
|
395
|
+
declare function addServerTemplate(template: NuxtServerTemplate): NuxtServerTemplate;
|
|
391
396
|
/**
|
|
392
397
|
* Renders given types using lodash template during build into the project buildDir
|
|
393
398
|
* and register them as types.
|
|
@@ -396,7 +401,7 @@ declare function addTypeTemplate<T>(_template: NuxtTypeTemplate<T>): ResolvedNux
|
|
|
396
401
|
/**
|
|
397
402
|
* Normalize a nuxt template object
|
|
398
403
|
*/
|
|
399
|
-
declare function normalizeTemplate<T>(template: NuxtTemplate<T> | string): ResolvedNuxtTemplate<T>;
|
|
404
|
+
declare function normalizeTemplate<T>(template: NuxtTemplate<T> | string, buildDir?: string): ResolvedNuxtTemplate<T>;
|
|
400
405
|
/**
|
|
401
406
|
* Trigger rebuilding Nuxt templates
|
|
402
407
|
*
|
|
@@ -447,4 +452,4 @@ declare const templateUtils: {
|
|
|
447
452
|
}) => string;
|
|
448
453
|
};
|
|
449
454
|
|
|
450
|
-
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type ImportModuleOptions, type LoadNuxtConfigOptions, type LoadNuxtOptions, type ResolveModuleOptions, type ResolvePathOptions, type Resolver, addBuildPlugin, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createResolver, defineNuxtModule, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
|
455
|
+
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type ImportModuleOptions, type LoadNuxtConfigOptions, type LoadNuxtOptions, type ResolveModuleOptions, type ResolvePathOptions, type Resolver, addBuildPlugin, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createResolver, defineNuxtModule, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { readPackageJSON, resolvePackageJSON } from 'pkg-types';
|
|
|
10
10
|
import { genSafeVariableName, genDynamicImport, genImport } from 'knitwork';
|
|
11
11
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
12
12
|
import { createJiti } from 'jiti';
|
|
13
|
-
import { resolvePath as resolvePath$1, resolve as resolve$1, resolvePathSync, interopDefault } from 'mlly';
|
|
13
|
+
import { resolvePath as resolvePath$1, parseNodeModulePath, resolve as resolve$1, resolvePathSync, interopDefault } from 'mlly';
|
|
14
14
|
import { isRelative, withTrailingSlash } from 'ufo';
|
|
15
15
|
import { globby } from 'globby';
|
|
16
16
|
import { resolveAlias as resolveAlias$1 } from 'pathe/utils';
|
|
@@ -21,7 +21,7 @@ import process$1 from 'node:process';
|
|
|
21
21
|
import destr from 'destr';
|
|
22
22
|
import { snakeCase, kebabCase, pascalCase } from 'scule';
|
|
23
23
|
import { klona } from 'klona';
|
|
24
|
-
import hash from '
|
|
24
|
+
import { hash } from 'ohash';
|
|
25
25
|
import { gte } from 'semver';
|
|
26
26
|
|
|
27
27
|
const logger = consola;
|
|
@@ -2095,16 +2095,15 @@ function defineNuxtModule(definition) {
|
|
|
2095
2095
|
};
|
|
2096
2096
|
}
|
|
2097
2097
|
function _defineNuxtModule(definition) {
|
|
2098
|
-
var _a;
|
|
2099
2098
|
if (typeof definition === "function") {
|
|
2100
2099
|
return _defineNuxtModule({ setup: definition });
|
|
2101
2100
|
}
|
|
2102
2101
|
const module = defu(definition, { meta: {} });
|
|
2103
|
-
|
|
2102
|
+
module.meta.configKey ||= module.meta.name;
|
|
2104
2103
|
async function getOptions(inlineOptions, nuxt = useNuxt()) {
|
|
2105
2104
|
const nuxtConfigOptionsKey = module.meta.configKey || module.meta.name;
|
|
2106
2105
|
const nuxtConfigOptions = nuxtConfigOptionsKey && nuxtConfigOptionsKey in nuxt.options ? nuxt.options[nuxtConfigOptionsKey] : {};
|
|
2107
|
-
const optionsDefaults = module.defaults instanceof Function ? module.defaults(nuxt) : module.defaults ?? {};
|
|
2106
|
+
const optionsDefaults = module.defaults instanceof Function ? await module.defaults(nuxt) : module.defaults ?? {};
|
|
2108
2107
|
let options = defu(inlineOptions, nuxtConfigOptions, optionsDefaults);
|
|
2109
2108
|
if (module.schema) {
|
|
2110
2109
|
options = await applyDefaults(module.schema, options);
|
|
@@ -2386,7 +2385,7 @@ async function resolveFiles(path, pattern, opts = {}) {
|
|
|
2386
2385
|
|
|
2387
2386
|
const NODE_MODULES_RE = /[/\\]node_modules[/\\]/;
|
|
2388
2387
|
async function installModule(moduleToInstall, inlineOptions, nuxt = useNuxt()) {
|
|
2389
|
-
const { nuxtModule, buildTimeModuleMeta } = await loadNuxtModuleInstance(moduleToInstall, nuxt);
|
|
2388
|
+
const { nuxtModule, buildTimeModuleMeta, resolvedModulePath } = await loadNuxtModuleInstance(moduleToInstall, nuxt);
|
|
2390
2389
|
const localLayerModuleDirs = /* @__PURE__ */ new Set();
|
|
2391
2390
|
for (const l of nuxt.options._layers) {
|
|
2392
2391
|
const srcDir = l.config.srcDir || l.cwd;
|
|
@@ -2398,9 +2397,12 @@ async function installModule(moduleToInstall, inlineOptions, nuxt = useNuxt()) {
|
|
|
2398
2397
|
if (res === false) {
|
|
2399
2398
|
return;
|
|
2400
2399
|
}
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
const
|
|
2400
|
+
const modulePath = resolvedModulePath || moduleToInstall;
|
|
2401
|
+
if (typeof modulePath === "string") {
|
|
2402
|
+
const parsed = parseNodeModulePath(modulePath);
|
|
2403
|
+
const moduleRoot = parsed.dir ? parsed.dir + parsed.name : modulePath;
|
|
2404
|
+
nuxt.options.build.transpile.push(normalizeModuleTranspilePath(moduleRoot));
|
|
2405
|
+
const directory = parsed.dir ? moduleRoot : getDirectory(modulePath);
|
|
2404
2406
|
if (directory !== moduleToInstall && !localLayerModuleDirs.has(directory)) {
|
|
2405
2407
|
nuxt.options.modulesDir.push(resolve(directory, "node_modules"));
|
|
2406
2408
|
}
|
|
@@ -2428,6 +2430,7 @@ const normalizeModuleTranspilePath = (p) => {
|
|
|
2428
2430
|
};
|
|
2429
2431
|
async function loadNuxtModuleInstance(nuxtModule, nuxt = useNuxt()) {
|
|
2430
2432
|
let buildTimeModuleMeta = {};
|
|
2433
|
+
let resolvedModulePath;
|
|
2431
2434
|
const jiti = createJiti(nuxt.options.rootDir, { alias: nuxt.options.alias });
|
|
2432
2435
|
if (typeof nuxtModule === "string") {
|
|
2433
2436
|
const paths = /* @__PURE__ */ new Set();
|
|
@@ -2443,6 +2446,7 @@ async function loadNuxtModuleInstance(nuxtModule, nuxt = useNuxt()) {
|
|
|
2443
2446
|
try {
|
|
2444
2447
|
const src = isAbsolute(path) ? pathToFileURL(await resolvePath(path, { cwd: parentURL, fallbackToOriginal: false, extensions: nuxt.options.extensions })).href : await resolve$1(path, { url: pathToFileURL(parentURL.replace(/\/node_modules\/?$/, "")), extensions: nuxt.options.extensions });
|
|
2445
2448
|
nuxtModule = await jiti.import(src, { default: true });
|
|
2449
|
+
resolvedModulePath = fileURLToPath(new URL(src));
|
|
2446
2450
|
const moduleMetadataPath = new URL("module.json", src);
|
|
2447
2451
|
if (existsSync(moduleMetadataPath)) {
|
|
2448
2452
|
buildTimeModuleMeta = JSON.parse(await promises.readFile(moduleMetadataPath, "utf-8"));
|
|
@@ -2462,10 +2466,13 @@ async function loadNuxtModuleInstance(nuxtModule, nuxt = useNuxt()) {
|
|
|
2462
2466
|
}
|
|
2463
2467
|
}
|
|
2464
2468
|
}
|
|
2469
|
+
if (typeof nuxtModule === "string") {
|
|
2470
|
+
throw new TypeError(`Could not load \`${nuxtModule}\`. Is it installed?`);
|
|
2471
|
+
}
|
|
2465
2472
|
if (typeof nuxtModule !== "function") {
|
|
2466
2473
|
throw new TypeError("Nuxt module should be a function: " + nuxtModule);
|
|
2467
2474
|
}
|
|
2468
|
-
return { nuxtModule, buildTimeModuleMeta };
|
|
2475
|
+
return { nuxtModule, buildTimeModuleMeta, resolvedModulePath };
|
|
2469
2476
|
}
|
|
2470
2477
|
|
|
2471
2478
|
function resolveNuxtModuleEntryName(m) {
|
|
@@ -2642,16 +2649,16 @@ async function loadNuxt(opts) {
|
|
|
2642
2649
|
envConfig: opts.dotenv
|
|
2643
2650
|
// TODO: Backward format conversion
|
|
2644
2651
|
});
|
|
2645
|
-
nuxt.removeHook
|
|
2646
|
-
nuxt.removeAllHooks
|
|
2647
|
-
nuxt.hookOnce
|
|
2652
|
+
nuxt.removeHook ||= nuxt.clearHook.bind(nuxt);
|
|
2653
|
+
nuxt.removeAllHooks ||= nuxt.clearHooks.bind(nuxt);
|
|
2654
|
+
nuxt.hookOnce ||= (name, fn, ...hookArgs) => {
|
|
2648
2655
|
const unsub = nuxt.hook(name, (...args) => {
|
|
2649
2656
|
unsub();
|
|
2650
2657
|
return fn(...args);
|
|
2651
2658
|
}, ...hookArgs);
|
|
2652
2659
|
return unsub;
|
|
2653
|
-
}
|
|
2654
|
-
nuxt.hooks
|
|
2660
|
+
};
|
|
2661
|
+
nuxt.hooks ||= nuxt;
|
|
2655
2662
|
return nuxt;
|
|
2656
2663
|
}
|
|
2657
2664
|
async function buildNuxt(nuxt) {
|
|
@@ -2892,7 +2899,7 @@ async function addComponentsDir(dir, opts = {}) {
|
|
|
2892
2899
|
const nuxt = useNuxt();
|
|
2893
2900
|
await assertNuxtCompatibility({ nuxt: ">=2.13" }, nuxt);
|
|
2894
2901
|
nuxt.options.components = nuxt.options.components || [];
|
|
2895
|
-
dir.priority
|
|
2902
|
+
dir.priority ||= 0;
|
|
2896
2903
|
nuxt.hook("components:dirs", (dirs) => {
|
|
2897
2904
|
dirs[opts.prepend ? "unshift" : "push"](dir);
|
|
2898
2905
|
});
|
|
@@ -2946,6 +2953,12 @@ function addTemplate(_template) {
|
|
|
2946
2953
|
nuxt.options.build.templates.push(template);
|
|
2947
2954
|
return template;
|
|
2948
2955
|
}
|
|
2956
|
+
function addServerTemplate(template) {
|
|
2957
|
+
const nuxt = useNuxt();
|
|
2958
|
+
nuxt.options.nitro.virtual ||= {};
|
|
2959
|
+
nuxt.options.nitro.virtual[template.filename] = template.getContents;
|
|
2960
|
+
return template;
|
|
2961
|
+
}
|
|
2949
2962
|
function addTypeTemplate(_template) {
|
|
2950
2963
|
const nuxt = useNuxt();
|
|
2951
2964
|
const template = addTemplate(_template);
|
|
@@ -2957,7 +2970,7 @@ function addTypeTemplate(_template) {
|
|
|
2957
2970
|
});
|
|
2958
2971
|
return template;
|
|
2959
2972
|
}
|
|
2960
|
-
function normalizeTemplate(template) {
|
|
2973
|
+
function normalizeTemplate(template, buildDir) {
|
|
2961
2974
|
if (!template) {
|
|
2962
2975
|
throw new Error("Invalid template: " + JSON.stringify(template));
|
|
2963
2976
|
}
|
|
@@ -2976,17 +2989,16 @@ function normalizeTemplate(template) {
|
|
|
2976
2989
|
}
|
|
2977
2990
|
}
|
|
2978
2991
|
if (!template.src && !template.getContents) {
|
|
2979
|
-
throw new Error("Invalid template. Either getContents or src
|
|
2992
|
+
throw new Error("Invalid template. Either `getContents` or `src` should be provided: " + JSON.stringify(template));
|
|
2980
2993
|
}
|
|
2981
2994
|
if (!template.filename) {
|
|
2982
|
-
throw new Error("Invalid template.
|
|
2995
|
+
throw new Error("Invalid template. `filename` must be provided: " + JSON.stringify(template));
|
|
2983
2996
|
}
|
|
2984
2997
|
if (template.filename.endsWith(".d.ts")) {
|
|
2985
2998
|
template.write = true;
|
|
2986
2999
|
}
|
|
2987
3000
|
if (!template.dst) {
|
|
2988
|
-
|
|
2989
|
-
template.dst = resolve(nuxt.options.buildDir, template.filename);
|
|
3001
|
+
template.dst = resolve(buildDir ?? useNuxt().options.buildDir, template.filename);
|
|
2990
3002
|
}
|
|
2991
3003
|
return template;
|
|
2992
3004
|
}
|
|
@@ -3086,6 +3098,7 @@ async function _generateTypes(nuxt) {
|
|
|
3086
3098
|
const aliases = nuxt.options.alias;
|
|
3087
3099
|
const basePath = tsConfig.compilerOptions.baseUrl ? resolve(nuxt.options.buildDir, tsConfig.compilerOptions.baseUrl) : nuxt.options.buildDir;
|
|
3088
3100
|
tsConfig.compilerOptions = tsConfig.compilerOptions || {};
|
|
3101
|
+
tsConfig.compilerOptions.paths = tsConfig.compilerOptions.paths || {};
|
|
3089
3102
|
tsConfig.include = tsConfig.include || [];
|
|
3090
3103
|
for (const alias in aliases) {
|
|
3091
3104
|
if (excludedAlias.some((re) => re.test(alias))) {
|
|
@@ -3293,4 +3306,4 @@ function addPluginTemplate(plugin, opts = {}) {
|
|
|
3293
3306
|
return addPlugin(normalizedPlugin, opts);
|
|
3294
3307
|
}
|
|
3295
3308
|
|
|
3296
|
-
export { addBuildPlugin, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createResolver, defineNuxtModule, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
|
3309
|
+
export { addBuildPlugin, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createResolver, defineNuxtModule, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/kit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -24,40 +24,41 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"c12": "^2.0.1",
|
|
27
|
-
"consola": "^3.
|
|
27
|
+
"consola": "^3.3.1",
|
|
28
28
|
"defu": "^6.1.4",
|
|
29
29
|
"destr": "^2.0.3",
|
|
30
30
|
"globby": "^14.0.2",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"jiti": "^2.4.0",
|
|
31
|
+
"ignore": "^7.0.0",
|
|
32
|
+
"jiti": "^2.4.2",
|
|
34
33
|
"klona": "^2.0.6",
|
|
35
|
-
"knitwork": "^1.
|
|
34
|
+
"knitwork": "^1.2.0",
|
|
36
35
|
"mlly": "^1.7.3",
|
|
36
|
+
"ohash": "^1.1.4",
|
|
37
37
|
"pathe": "^1.1.2",
|
|
38
38
|
"pkg-types": "^1.2.1",
|
|
39
39
|
"scule": "^1.3.0",
|
|
40
40
|
"semver": "^7.6.3",
|
|
41
41
|
"ufo": "^1.5.4",
|
|
42
|
-
"unctx": "^2.
|
|
43
|
-
"unimport": "^3.
|
|
44
|
-
"untyped": "^1.5.
|
|
45
|
-
"@nuxt/schema": "3.
|
|
42
|
+
"unctx": "^2.4.1",
|
|
43
|
+
"unimport": "^3.14.5",
|
|
44
|
+
"untyped": "^1.5.2",
|
|
45
|
+
"@nuxt/schema": "3.15.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@rspack/core": "1.1.
|
|
49
|
-
"@types/hash-sum": "1.0.2",
|
|
48
|
+
"@rspack/core": "1.1.8",
|
|
50
49
|
"@types/lodash-es": "4.17.12",
|
|
51
50
|
"@types/semver": "7.5.8",
|
|
52
51
|
"lodash-es": "4.17.21",
|
|
53
52
|
"nitropack": "2.10.4",
|
|
54
53
|
"unbuild": "latest",
|
|
55
|
-
"vite": "
|
|
56
|
-
"vitest": "2.1.
|
|
54
|
+
"vite": "6.0.5",
|
|
55
|
+
"vitest": "2.1.8",
|
|
57
56
|
"webpack": "5.96.1"
|
|
58
57
|
},
|
|
59
58
|
"engines": {
|
|
60
|
-
"node": "
|
|
59
|
+
"node": ">=18.20.5"
|
|
61
60
|
},
|
|
62
|
-
"scripts": {
|
|
61
|
+
"scripts": {
|
|
62
|
+
"test:attw": "attw --pack"
|
|
63
|
+
}
|
|
63
64
|
}
|