@nuxt/kit 4.2.1 → 4.2.2
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 +4 -4
- package/dist/index.mjs +56 -24
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
Nuxt is a free and open-source framework with an intuitive and extendable way to create type-safe, performant and production-grade full-stack web applications and websites with Vue.js.
|
|
15
15
|
|
|
16
16
|
It provides a number of features that make it easy to build fast, SEO-friendly, and scalable web applications, including:
|
|
17
|
-
- Server-side rendering,
|
|
17
|
+
- Server-side rendering, static site generation, hybrid rendering and edge-side rendering
|
|
18
18
|
- Automatic routing with code-splitting and pre-fetching
|
|
19
19
|
- Data fetching and state management
|
|
20
|
-
-
|
|
20
|
+
- Search engine optimization and defining meta tags
|
|
21
21
|
- Auto imports of components, composables and utils
|
|
22
22
|
- TypeScript with zero configuration
|
|
23
|
-
- Go
|
|
23
|
+
- Go full-stack with our server/ directory
|
|
24
24
|
- Extensible with [200+ modules](https://nuxt.com/modules)
|
|
25
25
|
- Deployment to a variety of [hosting platforms](https://nuxt.com/deploy)
|
|
26
26
|
- ...[and much more](https://nuxt.com) 🚀
|
|
@@ -31,7 +31,7 @@ It provides a number of features that make it easy to build fast, SEO-friendly,
|
|
|
31
31
|
- 💻 [ Vue Development](#vue-development)
|
|
32
32
|
- 📖 [Documentation](#documentation)
|
|
33
33
|
- 🧩 [Modules](#modules)
|
|
34
|
-
- ❤️
|
|
34
|
+
- ❤️ [Contribute](#contribute)
|
|
35
35
|
- 🏠 [Local Development](#local-development)
|
|
36
36
|
- 🛟 [Professional Support](#professional-support)
|
|
37
37
|
- 🔗 [Follow Us](#follow-us)
|
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { existsSync, readFileSync, promises, lstatSync } from 'node:fs';
|
|
|
10
10
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
11
11
|
import { resolve, relative, join, dirname, normalize, isAbsolute, basename, parse } from 'pathe';
|
|
12
12
|
import { createJiti } from 'jiti';
|
|
13
|
-
import { parseNodeModulePath, interopDefault, resolveModuleExportNames } from 'mlly';
|
|
13
|
+
import { parseNodeModulePath, interopDefault, lookupNodeModuleSubpath, resolveModuleExportNames } from 'mlly';
|
|
14
14
|
import { resolveModulePath, resolveModuleURL } from 'exsolve';
|
|
15
15
|
import { isRelative, withTrailingSlash as withTrailingSlash$2 } from 'ufo';
|
|
16
16
|
import { read, update } from 'rc9';
|
|
@@ -569,7 +569,7 @@ async function installModules(modulesToInstall, resolvedModulePaths, nuxt = useN
|
|
|
569
569
|
localLayerModuleDirs.push(resolve(srcDir, l.config?.dir?.modules || "modules").replace(/\/?$/, "/"));
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
|
-
|
|
572
|
+
nuxt._moduleOptionsFunctions ||= /* @__PURE__ */ new Map();
|
|
573
573
|
const resolvedModules = [];
|
|
574
574
|
const inlineConfigKeys = new Set(
|
|
575
575
|
await Promise.all([...modulesToInstall].map(([mod]) => typeof mod !== "string" && Promise.resolve(mod.getMeta?.())?.then((r) => r?.configKey)))
|
|
@@ -604,8 +604,8 @@ async function installModules(modulesToInstall, resolvedModulePaths, nuxt = useN
|
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
if (value.overrides || value.defaults) {
|
|
607
|
-
const currentFns =
|
|
608
|
-
|
|
607
|
+
const currentFns = nuxt._moduleOptionsFunctions.get(resolvedModule.module) || [];
|
|
608
|
+
nuxt._moduleOptionsFunctions.set(resolvedModule.module, [
|
|
609
609
|
...currentFns,
|
|
610
610
|
() => ({ defaults: value.defaults, overrides: value.overrides })
|
|
611
611
|
]);
|
|
@@ -640,25 +640,28 @@ async function installModules(modulesToInstall, resolvedModulePaths, nuxt = useN
|
|
|
640
640
|
}
|
|
641
641
|
for (const { nuxtModule, meta, moduleToInstall, buildTimeModuleMeta, resolvedModulePath, inlineOptions } of resolvedModules) {
|
|
642
642
|
const configKey = meta?.configKey;
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
]
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
643
|
+
const optionsFns = [
|
|
644
|
+
...nuxt._moduleOptionsFunctions.get(moduleToInstall) || [],
|
|
645
|
+
...meta?.name ? nuxt._moduleOptionsFunctions.get(meta.name) || [] : [],
|
|
646
|
+
// TODO: consider dropping options functions keyed by config key
|
|
647
|
+
...configKey ? nuxt._moduleOptionsFunctions.get(configKey) || [] : []
|
|
648
|
+
];
|
|
649
|
+
if (optionsFns.length > 0) {
|
|
650
|
+
const overrides = [];
|
|
651
|
+
const defaults = [];
|
|
652
|
+
for (const fn of optionsFns) {
|
|
653
|
+
const options = fn();
|
|
654
|
+
overrides.push(options.overrides);
|
|
655
|
+
defaults.push(options.defaults);
|
|
656
|
+
}
|
|
657
|
+
if (configKey) {
|
|
656
658
|
nuxt.options[configKey] = defu(...overrides, nuxt.options[configKey], ...defaults);
|
|
657
659
|
}
|
|
658
660
|
}
|
|
659
661
|
await callLifecycleHooks(nuxtModule, meta, inlineOptions, nuxt);
|
|
660
662
|
await callModule(nuxtModule, meta, inlineOptions, resolvedModulePath, moduleToInstall, localLayerModuleDirs, buildTimeModuleMeta, nuxt);
|
|
661
663
|
}
|
|
664
|
+
delete nuxt._moduleOptionsFunctions;
|
|
662
665
|
}
|
|
663
666
|
async function installModule(moduleToInstall, inlineOptions, nuxt = useNuxt()) {
|
|
664
667
|
const { nuxtModule, buildTimeModuleMeta, resolvedModulePath } = await loadNuxtModuleInstance(moduleToInstall, nuxt);
|
|
@@ -669,8 +672,27 @@ async function installModule(moduleToInstall, inlineOptions, nuxt = useNuxt()) {
|
|
|
669
672
|
}
|
|
670
673
|
}
|
|
671
674
|
const meta = await nuxtModule.getMeta?.();
|
|
672
|
-
|
|
673
|
-
|
|
675
|
+
let mergedOptions = inlineOptions;
|
|
676
|
+
const configKey = meta?.configKey;
|
|
677
|
+
if (configKey && nuxt._moduleOptionsFunctions) {
|
|
678
|
+
const optionsFns = [
|
|
679
|
+
...nuxt._moduleOptionsFunctions.get(moduleToInstall) || [],
|
|
680
|
+
...nuxt._moduleOptionsFunctions.get(configKey) || []
|
|
681
|
+
];
|
|
682
|
+
if (optionsFns.length > 0) {
|
|
683
|
+
const overrides = [];
|
|
684
|
+
const defaults = [];
|
|
685
|
+
for (const fn of optionsFns) {
|
|
686
|
+
const options = fn();
|
|
687
|
+
overrides.push(options.overrides);
|
|
688
|
+
defaults.push(options.defaults);
|
|
689
|
+
}
|
|
690
|
+
mergedOptions = defu(inlineOptions, ...overrides, nuxt.options[configKey], ...defaults);
|
|
691
|
+
nuxt.options[configKey] = mergedOptions;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
await callLifecycleHooks(nuxtModule, meta, mergedOptions, nuxt);
|
|
695
|
+
await callModule(nuxtModule, meta, mergedOptions, resolvedModulePath, moduleToInstall, localLayerModuleDirs, buildTimeModuleMeta, nuxt);
|
|
674
696
|
}
|
|
675
697
|
function resolveModuleWithOptions(definition, nuxt) {
|
|
676
698
|
const [module, options = {}] = Array.isArray(definition) ? definition : [definition, {}];
|
|
@@ -786,8 +808,13 @@ async function callModule(nuxtModule, meta = {}, inlineOptions, resolvedModulePa
|
|
|
786
808
|
return;
|
|
787
809
|
}
|
|
788
810
|
const modulePath = resolvedModulePath || moduleToInstall;
|
|
811
|
+
let entryPath;
|
|
789
812
|
if (typeof modulePath === "string") {
|
|
790
813
|
const parsed = parseNodeModulePath(modulePath);
|
|
814
|
+
if (parsed.name) {
|
|
815
|
+
const subpath = await lookupNodeModuleSubpath(modulePath) || ".";
|
|
816
|
+
entryPath = join(parsed.name, subpath === "./" ? "." : subpath);
|
|
817
|
+
}
|
|
791
818
|
const moduleRoot = parsed.dir ? parsed.dir + parsed.name : await resolvePackageJSON(modulePath, { try: true }).then((r) => r ? dirname(r) : modulePath);
|
|
792
819
|
nuxt.options.build.transpile.push(normalizeModuleTranspilePath(moduleRoot));
|
|
793
820
|
const directory = moduleRoot.replace(/\/?$/, "/");
|
|
@@ -796,7 +823,7 @@ async function callModule(nuxtModule, meta = {}, inlineOptions, resolvedModulePa
|
|
|
796
823
|
}
|
|
797
824
|
}
|
|
798
825
|
nuxt.options._installedModules ||= [];
|
|
799
|
-
|
|
826
|
+
entryPath ||= typeof moduleToInstall === "string" ? resolveAlias(moduleToInstall, nuxt.options.alias) : void 0;
|
|
800
827
|
if (typeof moduleToInstall === "string" && entryPath !== moduleToInstall) {
|
|
801
828
|
buildTimeModuleMeta.rawPath = moduleToInstall;
|
|
802
829
|
}
|
|
@@ -900,12 +927,15 @@ async function loadNuxtConfig(opts) {
|
|
|
900
927
|
const processedLayers = /* @__PURE__ */ new Set();
|
|
901
928
|
const localRelativePaths = new Set(localLayers);
|
|
902
929
|
for (const layer of layers) {
|
|
903
|
-
layer.config
|
|
904
|
-
layer.config
|
|
905
|
-
|
|
930
|
+
const resolvedRootDir = layer.config?.rootDir ?? layer.cwd;
|
|
931
|
+
layer.config = {
|
|
932
|
+
...layer.config || {},
|
|
933
|
+
rootDir: resolvedRootDir
|
|
934
|
+
};
|
|
935
|
+
if (processedLayers.has(resolvedRootDir)) {
|
|
906
936
|
continue;
|
|
907
937
|
}
|
|
908
|
-
processedLayers.add(
|
|
938
|
+
processedLayers.add(resolvedRootDir);
|
|
909
939
|
layer.config = await applyDefaults(layerSchema, layer.config);
|
|
910
940
|
if (!layer.configFile || layer.configFile.endsWith(".nuxtrc")) {
|
|
911
941
|
continue;
|
|
@@ -1426,6 +1456,8 @@ function resolveLayerPaths(dirs, projectBuildDir) {
|
|
|
1426
1456
|
nuxt: [
|
|
1427
1457
|
join(relativeSrcDir, "**/*"),
|
|
1428
1458
|
join(relativeModulesDir, `*/runtime/**/*`),
|
|
1459
|
+
join(relativeRootDir, `test/nuxt/**/*`),
|
|
1460
|
+
join(relativeRootDir, `tests/nuxt/**/*`),
|
|
1429
1461
|
join(relativeRootDir, `layers/*/app/**/*`),
|
|
1430
1462
|
join(relativeRootDir, `layers/*/modules/*/runtime/**/*`)
|
|
1431
1463
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/kit",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"c12": "^3.3.
|
|
26
|
+
"c12": "^3.3.2",
|
|
27
27
|
"consola": "^3.4.2",
|
|
28
28
|
"defu": "^6.1.4",
|
|
29
29
|
"destr": "^2.0.5",
|
|
30
30
|
"errx": "^0.1.0",
|
|
31
|
-
"exsolve": "^1.0.
|
|
31
|
+
"exsolve": "^1.0.8",
|
|
32
32
|
"ignore": "^7.0.5",
|
|
33
33
|
"jiti": "^2.6.1",
|
|
34
34
|
"klona": "^2.0.6",
|
|
@@ -45,16 +45,16 @@
|
|
|
45
45
|
"untyped": "^2.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@rspack/core": "1.6.
|
|
48
|
+
"@rspack/core": "1.6.7",
|
|
49
49
|
"@types/semver": "7.7.1",
|
|
50
50
|
"hookable": "5.5.3",
|
|
51
51
|
"nitropack": "2.12.9",
|
|
52
52
|
"unbuild": "3.6.1",
|
|
53
53
|
"unimport": "5.5.0",
|
|
54
|
-
"vite": "7.2.
|
|
54
|
+
"vite": "7.2.7",
|
|
55
55
|
"vitest": "3.2.4",
|
|
56
|
-
"webpack": "5.
|
|
57
|
-
"@nuxt/schema": "4.2.
|
|
56
|
+
"webpack": "5.103.0",
|
|
57
|
+
"@nuxt/schema": "4.2.2"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=18.12.0"
|