@nuxt/kit 3.14.159 → 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 +46 -27
- package/package.json +19 -18
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,8 @@ 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
|
+
import { isRelative, withTrailingSlash } from 'ufo';
|
|
14
15
|
import { globby } from 'globby';
|
|
15
16
|
import { resolveAlias as resolveAlias$1 } from 'pathe/utils';
|
|
16
17
|
import ignore from 'ignore';
|
|
@@ -20,8 +21,7 @@ import process$1 from 'node:process';
|
|
|
20
21
|
import destr from 'destr';
|
|
21
22
|
import { snakeCase, kebabCase, pascalCase } from 'scule';
|
|
22
23
|
import { klona } from 'klona';
|
|
23
|
-
import hash from '
|
|
24
|
-
import { withTrailingSlash } from 'ufo';
|
|
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,15 +2430,23 @@ 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
|
-
const paths =
|
|
2436
|
+
const paths = /* @__PURE__ */ new Set();
|
|
2437
|
+
nuxtModule = resolveAlias(nuxtModule, nuxt.options.alias);
|
|
2438
|
+
if (isRelative(nuxtModule)) {
|
|
2439
|
+
nuxtModule = resolve(nuxt.options.rootDir, nuxtModule);
|
|
2440
|
+
}
|
|
2441
|
+
paths.add(join(nuxtModule, "nuxt"));
|
|
2442
|
+
paths.add(join(nuxtModule, "module"));
|
|
2443
|
+
paths.add(nuxtModule);
|
|
2434
2444
|
for (const path of paths) {
|
|
2435
2445
|
for (const parentURL of nuxt.options.modulesDir) {
|
|
2436
2446
|
try {
|
|
2437
|
-
const
|
|
2438
|
-
const src = isAbsolute(resolved) ? pathToFileURL(await resolvePath(resolved, { cwd: parentURL, fallbackToOriginal: false, extensions: nuxt.options.extensions })).href : await resolve$1(resolved, { url: pathToFileURL(parentURL.replace(/\/node_modules\/?$/, "")), extensions: nuxt.options.extensions });
|
|
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 });
|
|
2439
2448
|
nuxtModule = await jiti.import(src, { default: true });
|
|
2449
|
+
resolvedModulePath = fileURLToPath(new URL(src));
|
|
2440
2450
|
const moduleMetadataPath = new URL("module.json", src);
|
|
2441
2451
|
if (existsSync(moduleMetadataPath)) {
|
|
2442
2452
|
buildTimeModuleMeta = JSON.parse(await promises.readFile(moduleMetadataPath, "utf-8"));
|
|
@@ -2456,10 +2466,13 @@ async function loadNuxtModuleInstance(nuxtModule, nuxt = useNuxt()) {
|
|
|
2456
2466
|
}
|
|
2457
2467
|
}
|
|
2458
2468
|
}
|
|
2469
|
+
if (typeof nuxtModule === "string") {
|
|
2470
|
+
throw new TypeError(`Could not load \`${nuxtModule}\`. Is it installed?`);
|
|
2471
|
+
}
|
|
2459
2472
|
if (typeof nuxtModule !== "function") {
|
|
2460
2473
|
throw new TypeError("Nuxt module should be a function: " + nuxtModule);
|
|
2461
2474
|
}
|
|
2462
|
-
return { nuxtModule, buildTimeModuleMeta };
|
|
2475
|
+
return { nuxtModule, buildTimeModuleMeta, resolvedModulePath };
|
|
2463
2476
|
}
|
|
2464
2477
|
|
|
2465
2478
|
function resolveNuxtModuleEntryName(m) {
|
|
@@ -2636,16 +2649,16 @@ async function loadNuxt(opts) {
|
|
|
2636
2649
|
envConfig: opts.dotenv
|
|
2637
2650
|
// TODO: Backward format conversion
|
|
2638
2651
|
});
|
|
2639
|
-
nuxt.removeHook
|
|
2640
|
-
nuxt.removeAllHooks
|
|
2641
|
-
nuxt.hookOnce
|
|
2652
|
+
nuxt.removeHook ||= nuxt.clearHook.bind(nuxt);
|
|
2653
|
+
nuxt.removeAllHooks ||= nuxt.clearHooks.bind(nuxt);
|
|
2654
|
+
nuxt.hookOnce ||= (name, fn, ...hookArgs) => {
|
|
2642
2655
|
const unsub = nuxt.hook(name, (...args) => {
|
|
2643
2656
|
unsub();
|
|
2644
2657
|
return fn(...args);
|
|
2645
2658
|
}, ...hookArgs);
|
|
2646
2659
|
return unsub;
|
|
2647
|
-
}
|
|
2648
|
-
nuxt.hooks
|
|
2660
|
+
};
|
|
2661
|
+
nuxt.hooks ||= nuxt;
|
|
2649
2662
|
return nuxt;
|
|
2650
2663
|
}
|
|
2651
2664
|
async function buildNuxt(nuxt) {
|
|
@@ -2886,7 +2899,7 @@ async function addComponentsDir(dir, opts = {}) {
|
|
|
2886
2899
|
const nuxt = useNuxt();
|
|
2887
2900
|
await assertNuxtCompatibility({ nuxt: ">=2.13" }, nuxt);
|
|
2888
2901
|
nuxt.options.components = nuxt.options.components || [];
|
|
2889
|
-
dir.priority
|
|
2902
|
+
dir.priority ||= 0;
|
|
2890
2903
|
nuxt.hook("components:dirs", (dirs) => {
|
|
2891
2904
|
dirs[opts.prepend ? "unshift" : "push"](dir);
|
|
2892
2905
|
});
|
|
@@ -2936,10 +2949,16 @@ async function addComponent(opts) {
|
|
|
2936
2949
|
function addTemplate(_template) {
|
|
2937
2950
|
const nuxt = useNuxt();
|
|
2938
2951
|
const template = normalizeTemplate(_template);
|
|
2939
|
-
nuxt.options.build.templates = nuxt.options.build.templates.filter((p) => normalizeTemplate(p).
|
|
2952
|
+
nuxt.options.build.templates = nuxt.options.build.templates.filter((p) => normalizeTemplate(p).dst !== template.dst);
|
|
2940
2953
|
nuxt.options.build.templates.push(template);
|
|
2941
2954
|
return template;
|
|
2942
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
|
+
}
|
|
2943
2962
|
function addTypeTemplate(_template) {
|
|
2944
2963
|
const nuxt = useNuxt();
|
|
2945
2964
|
const template = addTemplate(_template);
|
|
@@ -2951,7 +2970,7 @@ function addTypeTemplate(_template) {
|
|
|
2951
2970
|
});
|
|
2952
2971
|
return template;
|
|
2953
2972
|
}
|
|
2954
|
-
function normalizeTemplate(template) {
|
|
2973
|
+
function normalizeTemplate(template, buildDir) {
|
|
2955
2974
|
if (!template) {
|
|
2956
2975
|
throw new Error("Invalid template: " + JSON.stringify(template));
|
|
2957
2976
|
}
|
|
@@ -2970,17 +2989,16 @@ function normalizeTemplate(template) {
|
|
|
2970
2989
|
}
|
|
2971
2990
|
}
|
|
2972
2991
|
if (!template.src && !template.getContents) {
|
|
2973
|
-
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));
|
|
2974
2993
|
}
|
|
2975
2994
|
if (!template.filename) {
|
|
2976
|
-
throw new Error("Invalid template.
|
|
2995
|
+
throw new Error("Invalid template. `filename` must be provided: " + JSON.stringify(template));
|
|
2977
2996
|
}
|
|
2978
2997
|
if (template.filename.endsWith(".d.ts")) {
|
|
2979
2998
|
template.write = true;
|
|
2980
2999
|
}
|
|
2981
3000
|
if (!template.dst) {
|
|
2982
|
-
|
|
2983
|
-
template.dst = resolve(nuxt.options.buildDir, template.filename);
|
|
3001
|
+
template.dst = resolve(buildDir ?? useNuxt().options.buildDir, template.filename);
|
|
2984
3002
|
}
|
|
2985
3003
|
return template;
|
|
2986
3004
|
}
|
|
@@ -3080,6 +3098,7 @@ async function _generateTypes(nuxt) {
|
|
|
3080
3098
|
const aliases = nuxt.options.alias;
|
|
3081
3099
|
const basePath = tsConfig.compilerOptions.baseUrl ? resolve(nuxt.options.buildDir, tsConfig.compilerOptions.baseUrl) : nuxt.options.buildDir;
|
|
3082
3100
|
tsConfig.compilerOptions = tsConfig.compilerOptions || {};
|
|
3101
|
+
tsConfig.compilerOptions.paths = tsConfig.compilerOptions.paths || {};
|
|
3083
3102
|
tsConfig.include = tsConfig.include || [];
|
|
3084
3103
|
for (const alias in aliases) {
|
|
3085
3104
|
if (excludedAlias.some((re) => re.test(alias))) {
|
|
@@ -3287,4 +3306,4 @@ function addPluginTemplate(plugin, opts = {}) {
|
|
|
3287
3306
|
return addPlugin(normalizedPlugin, opts);
|
|
3288
3307
|
}
|
|
3289
3308
|
|
|
3290
|
-
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.
|
|
36
|
-
"mlly": "^1.7.
|
|
34
|
+
"knitwork": "^1.2.0",
|
|
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.
|
|
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
|
-
"nitropack": "2.10.
|
|
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
|
}
|