@nuxt/kit-nightly 5.0.0-29807919.2cbde35e → 5.0.0-29809859.f0ca99e9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +41 -11
- package/dist/index.mjs +79 -5
- package/dist/internal/index.d.mts +7 -0
- package/dist/internal/index.mjs +5 -0
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -177,7 +177,7 @@ declare function buildNuxt(nuxt: Nuxt): Promise<any>;
|
|
|
177
177
|
interface LayerDirectories {
|
|
178
178
|
/** Nuxt rootDir (`/` by default) */
|
|
179
179
|
readonly root: string;
|
|
180
|
-
/**
|
|
180
|
+
/** Server source directory (`/server` by default) */
|
|
181
181
|
readonly server: string;
|
|
182
182
|
/** Local modules directory (`/modules` by default) */
|
|
183
183
|
readonly modules: string;
|
|
@@ -460,26 +460,56 @@ interface NitroDevEventHandlerV3 {
|
|
|
460
460
|
} | Record<string, any>;
|
|
461
461
|
}
|
|
462
462
|
type NitroDevEventHandler = NitroDevEventHandlerV2 | NitroDevEventHandlerV3;
|
|
463
|
-
|
|
463
|
+
/**
|
|
464
|
+
* Route rules common to both nitro majors.
|
|
465
|
+
*
|
|
466
|
+
* Route rules are augmentable upstream and these types are inlined, so the index signature is
|
|
467
|
+
* what lets a module set a rule neither nitro declares (`ssr`, `appMiddleware`, its own).
|
|
468
|
+
*/
|
|
469
|
+
interface NitroRouteConfigBase {
|
|
464
470
|
cache?: Record<string, any> | false;
|
|
465
471
|
headers?: Record<string, string>;
|
|
472
|
+
prerender?: boolean;
|
|
473
|
+
isr?: number | boolean | Record<string, any>;
|
|
474
|
+
swr?: boolean | number;
|
|
475
|
+
static?: boolean | number;
|
|
476
|
+
/** Additional route options, including framework-specific route rules. */
|
|
477
|
+
[key: string]: any;
|
|
478
|
+
}
|
|
479
|
+
/** Route rule shape accepted by nitro v2 (`nitropack`). */
|
|
480
|
+
interface NitroRouteConfigV2 extends NitroRouteConfigBase {
|
|
481
|
+
/** A plain string defaults to status `302`. */
|
|
466
482
|
redirect?: string | {
|
|
467
483
|
to: string;
|
|
468
|
-
status?: number;
|
|
469
484
|
statusCode?: number;
|
|
470
485
|
};
|
|
471
|
-
prerender?: boolean;
|
|
472
486
|
proxy?: string | ({
|
|
473
487
|
to: string;
|
|
474
488
|
} & Record<string, any>);
|
|
475
|
-
isr?: number | boolean | Record<string, any>;
|
|
476
489
|
cors?: boolean;
|
|
477
|
-
swr?: boolean | number;
|
|
478
|
-
static?: boolean | number;
|
|
479
|
-
basicAuth?: Record<string, any> | false;
|
|
480
|
-
/** Additional route options, including framework-specific route rules. */
|
|
481
|
-
[key: string]: any;
|
|
482
490
|
}
|
|
491
|
+
/** Route rule shape accepted by nitro v3 (`nitro`). */
|
|
492
|
+
interface NitroRouteConfigV3 extends NitroRouteConfigBase {
|
|
493
|
+
/** A plain string defaults to status `307`. */
|
|
494
|
+
redirect?: string | {
|
|
495
|
+
to: string;
|
|
496
|
+
status?: number;
|
|
497
|
+
} | false;
|
|
498
|
+
/** `false` resets a rule inherited from a less specific pattern. */
|
|
499
|
+
proxy?: string | ({
|
|
500
|
+
to: string;
|
|
501
|
+
} & Record<string, any>) | false;
|
|
502
|
+
cors?: Record<string, any> | boolean;
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* A route rule accepted by either supported nitro major.
|
|
506
|
+
*
|
|
507
|
+
* A union rather than one merged shape, so that a rule written as an object literal has to match
|
|
508
|
+
* one major as a whole and excess property checking rejects a literal mixing the two. Anything
|
|
509
|
+
* valid in either is accepted, since the host's nitro major is not visible here; name
|
|
510
|
+
* {@link NitroRouteConfigV2} or {@link NitroRouteConfigV3} to be held to one.
|
|
511
|
+
*/
|
|
512
|
+
type NitroRouteConfig = NitroRouteConfigV2 | NitroRouteConfigV3;
|
|
483
513
|
//#endregion
|
|
484
514
|
//#region src/compatibility.d.ts
|
|
485
515
|
declare function normalizeSemanticVersion(version: string): string;
|
|
@@ -1235,4 +1265,4 @@ declare const DEFAULT_JS_FILE_EXTENSIONS: string[];
|
|
|
1235
1265
|
/** @deprecated Internal. Import from `@nuxt/kit/internal` instead. */
|
|
1236
1266
|
declare const DEFAULT_JSX_FILE_EXTENSIONS: string[];
|
|
1237
1267
|
//#endregion
|
|
1238
|
-
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, DEFAULT_JSX_FILE_EXTENSIONS, DEFAULT_JS_FILE_EXTENSIONS, type EnsureDependencyInstalledOptions, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type ImportModuleOptions, type LayerDirectories, type LoadNuxtConfigOptions, type LoadNuxtOptions, type NitroCompatibilityVersion, type NitroDevEventHandler, type NitroDevEventHandlerV2, type NitroDevEventHandlerV3, type NitroEventHandler, type NitroEventHandlerV2, type NitroEventHandlerV3, type NitroHandlerMethod, type NitroHelpers, type NitroInstance, type NitroInstanceOptions, type NitroRouteConfig, type NitroVersionOptions, type NitroVersionedInput, type NuxtConfigDiffEntry, type NuxtContext, type NuxtLogFn, type NuxtLogInput, type NuxtLogLevel, type NuxtLogObject, type NuxtLogReporter, type NuxtLogType, type NuxtLogger, type NuxtLoggerOptions, type NuxtMajorVersion, type NuxtPromptOptions, type NuxtTerminal, type NuxtTerminalNotice, type NuxtTerminalNotification, type NuxtTerminalTask, type RecoverableWatcher, type ResolveModuleOptions, type ResolvePathOptions, type ResolveTypePathsOptions, type ResolvedNuxtConfigContext, type Resolver, addBuildPlugin, addComponent, addComponentExports, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, createIsIgnored, createNitroHelpers, createResolver, defineNuxtModule, diffNuxtConfig, directoryToURL, ensureDependencyInstalled, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getAddDependencyCommand, getDirectory, getLayerDirectories, getNitroVersion, getNuxtCtx, getNuxtModuleVersion, getNuxtVersion, hasNitroVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, packageName, recoverThrottledChanges, requireModule, resolveAlias, resolveDeclarationPath, resolveFiles, resolveIgnorePatterns, resolveModule, resolveModuleWithOptions, resolveNuxtModule, resolvePath, resolveTypePaths, runWithNuxtContext, setBuildOutput, setGlobalHead, tryImportModule, tryRequireModule, tryResolveModule, tryUseNitro, tryUseNuxt, updateAppConfig, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, useTerminal, writeTypes };
|
|
1268
|
+
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, DEFAULT_JSX_FILE_EXTENSIONS, DEFAULT_JS_FILE_EXTENSIONS, type EnsureDependencyInstalledOptions, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type ImportModuleOptions, type LayerDirectories, type LoadNuxtConfigOptions, type LoadNuxtOptions, type NitroCompatibilityVersion, type NitroDevEventHandler, type NitroDevEventHandlerV2, type NitroDevEventHandlerV3, type NitroEventHandler, type NitroEventHandlerV2, type NitroEventHandlerV3, type NitroHandlerMethod, type NitroHelpers, type NitroInstance, type NitroInstanceOptions, type NitroRouteConfig, type NitroRouteConfigV2, type NitroRouteConfigV3, type NitroVersionOptions, type NitroVersionedInput, type NuxtConfigDiffEntry, type NuxtContext, type NuxtLogFn, type NuxtLogInput, type NuxtLogLevel, type NuxtLogObject, type NuxtLogReporter, type NuxtLogType, type NuxtLogger, type NuxtLoggerOptions, type NuxtMajorVersion, type NuxtPromptOptions, type NuxtTerminal, type NuxtTerminalNotice, type NuxtTerminalNotification, type NuxtTerminalTask, type RecoverableWatcher, type ResolveModuleOptions, type ResolvePathOptions, type ResolveTypePathsOptions, type ResolvedNuxtConfigContext, type Resolver, addBuildPlugin, addComponent, addComponentExports, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, createIsIgnored, createNitroHelpers, createResolver, defineNuxtModule, diffNuxtConfig, directoryToURL, ensureDependencyInstalled, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getAddDependencyCommand, getDirectory, getLayerDirectories, getNitroVersion, getNuxtCtx, getNuxtModuleVersion, getNuxtVersion, hasNitroVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, packageName, recoverThrottledChanges, requireModule, resolveAlias, resolveDeclarationPath, resolveFiles, resolveIgnorePatterns, resolveModule, resolveModuleWithOptions, resolveNuxtModule, resolvePath, resolveTypePaths, runWithNuxtContext, setBuildOutput, setGlobalHead, tryImportModule, tryRequireModule, tryResolveModule, tryUseNitro, tryUseNuxt, updateAppConfig, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, useTerminal, writeTypes };
|
package/dist/index.mjs
CHANGED
|
@@ -1887,6 +1887,7 @@ function resolveLayerPaths(dirs, projectBuildDir) {
|
|
|
1887
1887
|
const relativeSrcDir = relativeWithDot(projectBuildDir, dirs.app);
|
|
1888
1888
|
const relativeModulesDir = relativeWithDot(projectBuildDir, dirs.modules);
|
|
1889
1889
|
const relativeSharedDir = relativeWithDot(projectBuildDir, dirs.shared);
|
|
1890
|
+
const relativeServerDir = relativeWithDot(projectBuildDir, dirs.server);
|
|
1890
1891
|
return {
|
|
1891
1892
|
nuxt: [
|
|
1892
1893
|
join(relativeSrcDir, "**/*"),
|
|
@@ -1896,7 +1897,8 @@ function resolveLayerPaths(dirs, projectBuildDir) {
|
|
|
1896
1897
|
join(relativeRootDir, `layers/*/app/**/*`),
|
|
1897
1898
|
join(relativeRootDir, `layers/*/modules/*/runtime/**/*`)
|
|
1898
1899
|
],
|
|
1899
|
-
|
|
1900
|
+
server: [
|
|
1901
|
+
join(relativeServerDir, `**/*`),
|
|
1900
1902
|
join(relativeModulesDir, `*/runtime/server/**/*`),
|
|
1901
1903
|
join(relativeRootDir, `layers/*/server/**/*`),
|
|
1902
1904
|
join(relativeRootDir, `layers/*/modules/*/runtime/server/**/*`)
|
|
@@ -1973,15 +1975,30 @@ async function resolveExtensionlessTarget(absolutePath) {
|
|
|
1973
1975
|
}
|
|
1974
1976
|
}
|
|
1975
1977
|
const excludedAlias = [/^@vue\/.*$/, /^#internal\/nuxt/];
|
|
1978
|
+
const appOnlyAlias = [
|
|
1979
|
+
/^@vue\/.*$/,
|
|
1980
|
+
"vue",
|
|
1981
|
+
/vue-router/,
|
|
1982
|
+
"vite/client",
|
|
1983
|
+
"vue-demi",
|
|
1984
|
+
/^#app/,
|
|
1985
|
+
/^#imports/,
|
|
1986
|
+
"~",
|
|
1987
|
+
"@",
|
|
1988
|
+
"~~",
|
|
1989
|
+
"@@"
|
|
1990
|
+
];
|
|
1976
1991
|
async function _generateTypes(nuxt) {
|
|
1977
1992
|
const typesDir = nuxt.options.typesDir || nuxt.options.buildDir;
|
|
1978
1993
|
const include = /* @__PURE__ */ new Set(["./nuxt.d.ts"]);
|
|
1979
1994
|
const nodeInclude = /* @__PURE__ */ new Set(["./nuxt.node.d.ts"]);
|
|
1980
1995
|
const sharedInclude = /* @__PURE__ */ new Set(["./nuxt.shared.d.ts"]);
|
|
1996
|
+
const serverInclude = /* @__PURE__ */ new Set(["./nuxt.server.d.ts"]);
|
|
1981
1997
|
const legacyInclude = /* @__PURE__ */ new Set([...include, ...nodeInclude]);
|
|
1982
1998
|
const exclude = /* @__PURE__ */ new Set();
|
|
1983
1999
|
const nodeExclude = /* @__PURE__ */ new Set();
|
|
1984
2000
|
const sharedExclude = /* @__PURE__ */ new Set();
|
|
2001
|
+
const serverExclude = /* @__PURE__ */ new Set();
|
|
1985
2002
|
const legacyExclude = /* @__PURE__ */ new Set();
|
|
1986
2003
|
if (nuxt.options.typescript.includeWorkspace && nuxt.options.workspaceDir !== nuxt.options.srcDir) {
|
|
1987
2004
|
include.add(join(relative(typesDir, nuxt.options.workspaceDir), "**/*"));
|
|
@@ -1992,11 +2009,13 @@ async function _generateTypes(nuxt) {
|
|
|
1992
2009
|
for (const dir of nuxt.options.modulesDir) {
|
|
1993
2010
|
if (!sourceDirs.some((srcDir) => dir.startsWith(srcDir))) exclude.add(relativeWithDot(typesDir, dir));
|
|
1994
2011
|
nodeExclude.add(relativeWithDot(typesDir, dir));
|
|
2012
|
+
serverExclude.add(relativeWithDot(typesDir, dir));
|
|
1995
2013
|
legacyExclude.add(relativeWithDot(typesDir, dir));
|
|
1996
2014
|
}
|
|
1997
2015
|
for (const dir of ["dist", ".data"]) {
|
|
1998
2016
|
exclude.add(relativeWithDot(typesDir, resolve(nuxt.options.rootDir, dir)));
|
|
1999
2017
|
nodeExclude.add(relativeWithDot(typesDir, resolve(nuxt.options.rootDir, dir)));
|
|
2018
|
+
serverExclude.add(relativeWithDot(typesDir, resolve(nuxt.options.rootDir, dir)));
|
|
2000
2019
|
legacyExclude.add(relativeWithDot(typesDir, resolve(nuxt.options.rootDir, dir)));
|
|
2001
2020
|
}
|
|
2002
2021
|
const rootDirWithSlash = withTrailingSlash(nuxt.options.rootDir);
|
|
@@ -2008,7 +2027,8 @@ async function _generateTypes(nuxt) {
|
|
|
2008
2027
|
legacyInclude.add(path);
|
|
2009
2028
|
if (path !== rootGlob) nodeExclude.add(path);
|
|
2010
2029
|
}
|
|
2011
|
-
for (const path of paths.
|
|
2030
|
+
for (const path of paths.server) {
|
|
2031
|
+
serverInclude.add(path);
|
|
2012
2032
|
exclude.add(path);
|
|
2013
2033
|
nodeExclude.add(path);
|
|
2014
2034
|
legacyExclude.add(path);
|
|
@@ -2021,14 +2041,24 @@ async function _generateTypes(nuxt) {
|
|
|
2021
2041
|
for (const path of paths.shared) {
|
|
2022
2042
|
legacyInclude.add(path);
|
|
2023
2043
|
sharedInclude.add(path);
|
|
2044
|
+
serverInclude.add(path);
|
|
2024
2045
|
}
|
|
2025
2046
|
for (const path of paths.sharedDeclarations) include.add(path);
|
|
2026
2047
|
for (const path of paths.globalDeclarations) {
|
|
2027
2048
|
include.add(path);
|
|
2028
2049
|
legacyInclude.add(path);
|
|
2029
2050
|
sharedInclude.add(path);
|
|
2051
|
+
serverInclude.add(path);
|
|
2030
2052
|
}
|
|
2031
2053
|
}
|
|
2054
|
+
for (const dirs of layerDirs) {
|
|
2055
|
+
const serverGlob = join(relativeWithDot(typesDir, dirs.server), "**/*");
|
|
2056
|
+
serverInclude.add(serverGlob);
|
|
2057
|
+
serverInclude.add(join(relativeWithDot(typesDir, dirs.shared), "**/*.d.ts"));
|
|
2058
|
+
exclude.add(serverGlob);
|
|
2059
|
+
nodeExclude.add(serverGlob);
|
|
2060
|
+
legacyExclude.add(serverGlob);
|
|
2061
|
+
}
|
|
2032
2062
|
const moduleEntryPaths = [];
|
|
2033
2063
|
for (const m of nuxt.options._installedModules) {
|
|
2034
2064
|
const path = m.meta?.rawPath || m.entryPath;
|
|
@@ -2046,6 +2076,10 @@ async function _generateTypes(nuxt) {
|
|
|
2046
2076
|
legacyInclude.add(join(relative, "dist/runtime"));
|
|
2047
2077
|
nodeExclude.add(join(relative, "runtime"));
|
|
2048
2078
|
nodeExclude.add(join(relative, "dist/runtime"));
|
|
2079
|
+
serverInclude.add(join(relative, "runtime/server"));
|
|
2080
|
+
serverInclude.add(join(relative, "dist/runtime/server"));
|
|
2081
|
+
serverExclude.add(join(relative, "*.*"));
|
|
2082
|
+
serverExclude.add(join(relative, "dist/*.*"));
|
|
2049
2083
|
exclude.add(join(relative, "runtime/server"));
|
|
2050
2084
|
exclude.add(join(relative, "dist/runtime/server"));
|
|
2051
2085
|
exclude.add(join(relative, "*.*"));
|
|
@@ -2145,6 +2179,19 @@ async function _generateTypes(nuxt) {
|
|
|
2145
2179
|
include: [...sharedInclude],
|
|
2146
2180
|
exclude: [...sharedExclude]
|
|
2147
2181
|
});
|
|
2182
|
+
const serverTsConfig = defu(nuxt.options.typescript?.serverTsConfig, {
|
|
2183
|
+
compilerOptions: {
|
|
2184
|
+
...nonAppCompilerOptions(),
|
|
2185
|
+
lib: [
|
|
2186
|
+
"ESNext",
|
|
2187
|
+
"webworker",
|
|
2188
|
+
"dom.iterable"
|
|
2189
|
+
],
|
|
2190
|
+
moduleResolution: "Bundler"
|
|
2191
|
+
},
|
|
2192
|
+
include: [...serverInclude],
|
|
2193
|
+
exclude: [...serverExclude]
|
|
2194
|
+
});
|
|
2148
2195
|
const aliases = nuxt.options.alias;
|
|
2149
2196
|
const baseUrl = isV5OrHigher ? void 0 : tsConfig.compilerOptions.baseUrl;
|
|
2150
2197
|
const basePath = baseUrl ? resolve(typesDir, baseUrl) : typesDir;
|
|
@@ -2152,9 +2199,14 @@ async function _generateTypes(nuxt) {
|
|
|
2152
2199
|
tsConfig.compilerOptions.paths ||= {};
|
|
2153
2200
|
tsConfig.include ||= [];
|
|
2154
2201
|
tsConfig.exclude ||= [];
|
|
2202
|
+
serverTsConfig.compilerOptions ||= {};
|
|
2203
|
+
serverTsConfig.compilerOptions.paths ||= {};
|
|
2204
|
+
const serverBaseUrl = isV5OrHigher ? void 0 : serverTsConfig.compilerOptions.baseUrl ?? baseUrl;
|
|
2205
|
+
const serverBasePath = serverBaseUrl ? resolve(typesDir, serverBaseUrl) : typesDir;
|
|
2155
2206
|
const importPaths = nuxt.options.modulesDir.map((d) => directoryToURL(d));
|
|
2156
2207
|
for (const alias in aliases) {
|
|
2157
2208
|
if (excludedAlias.some((re) => re.test(alias))) continue;
|
|
2209
|
+
const inServer = !appOnlyAlias.some((pattern) => typeof pattern === "string" ? alias === pattern : pattern.test(alias));
|
|
2158
2210
|
let absolutePath = resolve(basePath, aliases[alias]);
|
|
2159
2211
|
let stats = await promises.stat(absolutePath).catch(() => null);
|
|
2160
2212
|
if (!stats) {
|
|
@@ -2173,18 +2225,26 @@ async function _generateTypes(nuxt) {
|
|
|
2173
2225
|
stats = await promises.stat(resolvedModule).catch(() => null);
|
|
2174
2226
|
}
|
|
2175
2227
|
}
|
|
2228
|
+
const serverAbsolutePath = serverBasePath === basePath ? absolutePath : resolve(serverBasePath, aliases[alias]);
|
|
2176
2229
|
const relativePath = relativeWithDot(typesDir, absolutePath);
|
|
2230
|
+
const serverRelativePath = relativeWithDot(typesDir, serverAbsolutePath);
|
|
2177
2231
|
if (stats?.isDirectory() || aliases[alias].endsWith("/")) {
|
|
2178
2232
|
tsConfig.compilerOptions.paths[alias] = [relativePath];
|
|
2179
2233
|
tsConfig.compilerOptions.paths[`${alias}/*`] = [`${relativePath}/*`];
|
|
2234
|
+
if (inServer) {
|
|
2235
|
+
serverTsConfig.compilerOptions.paths[alias] = [serverRelativePath];
|
|
2236
|
+
serverTsConfig.compilerOptions.paths[`${alias}/*`] = [`${serverRelativePath}/*`];
|
|
2237
|
+
}
|
|
2180
2238
|
} else {
|
|
2181
2239
|
const path = stats?.isFile() ? await getPathSubstitution(absolutePath, typesDir) : aliases[alias];
|
|
2182
2240
|
tsConfig.compilerOptions.paths[alias] = [path];
|
|
2241
|
+
if (inServer) serverTsConfig.compilerOptions.paths[alias] = [serverBasePath === basePath ? path : stats?.isFile() ? await getPathSubstitution(serverAbsolutePath, typesDir) : aliases[alias]];
|
|
2183
2242
|
}
|
|
2184
2243
|
}
|
|
2185
2244
|
const references = [];
|
|
2186
2245
|
const nodeReferences = [];
|
|
2187
2246
|
const sharedReferences = [];
|
|
2247
|
+
const serverReferences = [];
|
|
2188
2248
|
await Promise.all([...nuxt.options.modules, ...nuxt.options._modules].map(async (id) => {
|
|
2189
2249
|
if (typeof id !== "string") return;
|
|
2190
2250
|
for (const parent of nestedModulesDirs) {
|
|
@@ -2206,7 +2266,9 @@ async function _generateTypes(nuxt) {
|
|
|
2206
2266
|
nodeTsConfig,
|
|
2207
2267
|
nodeReferences,
|
|
2208
2268
|
sharedTsConfig,
|
|
2209
|
-
sharedReferences
|
|
2269
|
+
sharedReferences,
|
|
2270
|
+
serverTsConfig,
|
|
2271
|
+
serverReferences
|
|
2210
2272
|
});
|
|
2211
2273
|
const legacyTsConfig = defu({}, {
|
|
2212
2274
|
...tsConfig,
|
|
@@ -2234,6 +2296,7 @@ async function _generateTypes(nuxt) {
|
|
|
2234
2296
|
resolveConfig(tsConfig),
|
|
2235
2297
|
resolveConfig(nodeTsConfig),
|
|
2236
2298
|
resolveConfig(sharedTsConfig),
|
|
2299
|
+
resolveConfig(serverTsConfig),
|
|
2237
2300
|
resolveConfig(legacyTsConfig)
|
|
2238
2301
|
]);
|
|
2239
2302
|
const declaration = [
|
|
@@ -2258,6 +2321,13 @@ async function _generateTypes(nuxt) {
|
|
|
2258
2321
|
"export {}",
|
|
2259
2322
|
""
|
|
2260
2323
|
].join("\n"),
|
|
2324
|
+
serverTsConfig,
|
|
2325
|
+
serverDeclaration: [
|
|
2326
|
+
...serverReferences.map((ref) => renderReference(ref, typesDir)),
|
|
2327
|
+
"",
|
|
2328
|
+
"export {}",
|
|
2329
|
+
""
|
|
2330
|
+
].join("\n"),
|
|
2261
2331
|
nodeTsConfig,
|
|
2262
2332
|
nodeDeclaration,
|
|
2263
2333
|
tsConfig,
|
|
@@ -2265,24 +2335,28 @@ async function _generateTypes(nuxt) {
|
|
|
2265
2335
|
};
|
|
2266
2336
|
}
|
|
2267
2337
|
async function writeTypes(nuxt) {
|
|
2268
|
-
const { tsConfig, nodeTsConfig, nodeDeclaration, declaration, legacyTsConfig, sharedDeclaration, sharedTsConfig } = await _generateTypes(nuxt);
|
|
2338
|
+
const { tsConfig, nodeTsConfig, nodeDeclaration, declaration, legacyTsConfig, sharedDeclaration, sharedTsConfig, serverDeclaration, serverTsConfig } = await _generateTypes(nuxt);
|
|
2269
2339
|
const typesDir = nuxt.options.typesDir || nuxt.options.buildDir;
|
|
2270
2340
|
const appTsConfigPath = resolve(typesDir, "tsconfig.app.json");
|
|
2271
2341
|
const legacyTsConfigPath = resolve(typesDir, "tsconfig.json");
|
|
2272
2342
|
const nodeTsConfigPath = resolve(typesDir, "tsconfig.node.json");
|
|
2273
2343
|
const sharedTsConfigPath = resolve(typesDir, "tsconfig.shared.json");
|
|
2344
|
+
const serverTsConfigPath = resolve(typesDir, "tsconfig.server.json");
|
|
2274
2345
|
const declarationPath = resolve(typesDir, "nuxt.d.ts");
|
|
2275
2346
|
const nodeDeclarationPath = resolve(typesDir, "nuxt.node.d.ts");
|
|
2276
2347
|
const sharedDeclarationPath = resolve(typesDir, "nuxt.shared.d.ts");
|
|
2348
|
+
const serverDeclarationPath = resolve(typesDir, "nuxt.server.d.ts");
|
|
2277
2349
|
await promises.mkdir(typesDir, { recursive: true });
|
|
2278
2350
|
await Promise.all([
|
|
2279
2351
|
writeIfChanged(appTsConfigPath, JSON.stringify(tsConfig, null, 2)),
|
|
2280
2352
|
writeIfChanged(legacyTsConfigPath, JSON.stringify(legacyTsConfig, null, 2)),
|
|
2281
2353
|
writeIfChanged(nodeTsConfigPath, JSON.stringify(nodeTsConfig, null, 2)),
|
|
2282
2354
|
writeIfChanged(sharedTsConfigPath, JSON.stringify(sharedTsConfig, null, 2)),
|
|
2355
|
+
writeIfChanged(serverTsConfigPath, JSON.stringify(serverTsConfig, null, 2)),
|
|
2283
2356
|
writeIfChanged(declarationPath, declaration),
|
|
2284
2357
|
writeIfChanged(nodeDeclarationPath, nodeDeclaration),
|
|
2285
|
-
writeIfChanged(sharedDeclarationPath, sharedDeclaration)
|
|
2358
|
+
writeIfChanged(sharedDeclarationPath, sharedDeclaration),
|
|
2359
|
+
writeIfChanged(serverDeclarationPath, serverDeclaration)
|
|
2286
2360
|
]);
|
|
2287
2361
|
}
|
|
2288
2362
|
/**
|
|
@@ -934,6 +934,13 @@ declare const bundlerDiagnostics: import("nostics").Diagnostics<{
|
|
|
934
934
|
readonly fix: "Pass an object to `vite.$client.build.rolldownOptions.input` if you need additional inputs, or add an `index.html` at the root of your app directory to take over the document itself.";
|
|
935
935
|
readonly docs: false;
|
|
936
936
|
};
|
|
937
|
+
readonly NUXT_B7026: {
|
|
938
|
+
readonly why: (p: {
|
|
939
|
+
route: string;
|
|
940
|
+
}) => string;
|
|
941
|
+
readonly fix: "Rename it to `redirect.status`. Nuxt has applied it as `status` for now.";
|
|
942
|
+
readonly docs: false;
|
|
943
|
+
};
|
|
937
944
|
}, readonly [import("nostics").DiagnosticReporter<{
|
|
938
945
|
method?: import("nostics").ConsoleMethod;
|
|
939
946
|
}>]>;
|
package/dist/internal/index.mjs
CHANGED
|
@@ -170,6 +170,11 @@ const bundlerDiagnostics = /* #__PURE__ */ defineDiagnostics({
|
|
|
170
170
|
why: (p) => `The client build input is set to \`${p.input}\`, which cannot carry the document the server builder emits, so the override is ignored.`,
|
|
171
171
|
fix: "Pass an object to `vite.$client.build.rolldownOptions.input` if you need additional inputs, or add an `index.html` at the root of your app directory to take over the document itself.",
|
|
172
172
|
docs: false
|
|
173
|
+
},
|
|
174
|
+
NUXT_B7026: {
|
|
175
|
+
why: (p) => `The route rule for \`${p.route}\` sets \`redirect.statusCode\`, which the server builder no longer reads.`,
|
|
176
|
+
fix: "Rename it to `redirect.status`. Nuxt has applied it as `status` for now.",
|
|
177
|
+
docs: false
|
|
173
178
|
}
|
|
174
179
|
}
|
|
175
180
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/kit-nightly",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-29809859.f0ca99e9",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"verkit": "^0.4.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-
|
|
49
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29809859.f0ca99e9",
|
|
50
50
|
"confbox": "^0.2.4",
|
|
51
51
|
"dotenv": "^17.4.2",
|
|
52
52
|
"giget": "^3.3.1",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-
|
|
85
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29809859.f0ca99e9",
|
|
86
86
|
"c12": "4.0.0-beta.5",
|
|
87
87
|
"chokidar": "^5.0.0",
|
|
88
88
|
"confbox": "^0.2.4",
|