nuxt-nightly 5.0.0-29741459.ba273796 → 5.0.0-29741513.94de156f
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/app/composables/announcer.d.ts +1 -1
- package/dist/app/composables/announcer.js +1 -1
- package/dist/app/composables/asyncData.d.ts +2 -7
- package/dist/app/composables/asyncData.js +2 -5
- package/dist/app/nuxt.d.ts +2 -2
- package/dist/app/utils/debounce-tick.d.ts +19 -0
- package/dist/app/utils/debounce-tick.js +57 -0
- package/dist/index.js +125 -39
- package/dist/index.mjs +125 -39
- package/package.json +5 -5
|
@@ -141,19 +141,14 @@ declare function useNuxtData<DataT = any>(key: string): {
|
|
|
141
141
|
declare function refreshNuxtData(keys?: string | string[]): Promise<void>;
|
|
142
142
|
/** @since 3.0.0 */
|
|
143
143
|
declare function clearNuxtData(keys?: string | string[] | ((key: string) => boolean)): void;
|
|
144
|
-
type DebouncedReturn<ArgumentsT extends unknown[], ReturnT> = ((...args: ArgumentsT) => Promise<ReturnT>) & {
|
|
145
|
-
cancel: () => void;
|
|
146
|
-
flush: () => Promise<ReturnT> | undefined;
|
|
147
|
-
isPending: () => boolean;
|
|
148
|
-
};
|
|
149
144
|
type CreatedAsyncData<ResT, NuxtErrorDataT = unknown, DataT = ResT, DefaultT = undefined> = Omit<_AsyncData<DataT | DefaultT, (NuxtErrorDataT extends Error | NuxtError ? NuxtErrorDataT : NuxtError<NuxtErrorDataT>)>, 'clear' | 'refresh'> & {
|
|
150
145
|
_off: () => void;
|
|
151
146
|
_hash?: Record<string, string | undefined>;
|
|
152
147
|
_default: () => unknown;
|
|
153
148
|
_init: boolean;
|
|
154
149
|
_deps: number;
|
|
155
|
-
_execute:
|
|
150
|
+
_execute: (opts?: AsyncDataExecuteOptions) => Promise<void>;
|
|
156
151
|
_abortController?: AbortController;
|
|
157
152
|
};
|
|
158
153
|
//#endregion
|
|
159
|
-
export { AsyncData, AsyncDataExecuteOptions, AsyncDataHandler, AsyncDataOptions, AsyncDataOptionsWithTransform, AsyncDataRefreshCause, AsyncDataRequestStatus, CreateUseAsyncData, CreatedAsyncData,
|
|
154
|
+
export { AsyncData, AsyncDataExecuteOptions, AsyncDataHandler, AsyncDataOptions, AsyncDataOptionsWithTransform, AsyncDataRefreshCause, AsyncDataRequestStatus, CreateUseAsyncData, CreatedAsyncData, KeyOfRes, KeysOf, type MultiWatchSources, NoInfer, PickFrom, UseAsyncData, _AsyncData, _Transform, clearNuxtData, createUseAsyncData, refreshNuxtData, useAsyncData, useLazyAsyncData, useNuxtData };
|
|
@@ -3,13 +3,13 @@ import { useNuxtApp } from "../nuxt.js";
|
|
|
3
3
|
import { getUserCaller, toArray } from "../utils.js";
|
|
4
4
|
import { createError } from "./error.js";
|
|
5
5
|
import { hashFunction, hashKey } from "../utils/hash.js";
|
|
6
|
+
import { debounceTick } from "../utils/debounce-tick.js";
|
|
6
7
|
import { clientOnlySymbol } from "../components/client-only.js";
|
|
7
8
|
import { onNuxtReady } from "./ready.js";
|
|
8
9
|
import { defineKeyedFunctionFactory } from "../../compiler/runtime/index.js";
|
|
9
10
|
import { dataDiagnostics } from "../diagnostics/data.js";
|
|
10
11
|
import { computed, getCurrentInstance, getCurrentScope, inject, isRef, isShallow, nextTick, onBeforeMount, onScopeDispose, onServerPrefetch, onUnmounted, queuePostFlushCb, ref, shallowRef, toRef, toValue, unref, watch } from "vue";
|
|
11
12
|
import { asyncDataDefaults, granularCachedData, pendingWhenIdle, purgeCachedData, tracingChannelNuxt } from "#build/nuxt.config.mjs";
|
|
12
|
-
import { debounce } from "perfect-debounce";
|
|
13
13
|
//#region src/app/composables/asyncData.ts
|
|
14
14
|
const createUseAsyncData = defineKeyedFunctionFactory({
|
|
15
15
|
name: "createUseAsyncData",
|
|
@@ -145,9 +145,6 @@ const createUseAsyncData = defineKeyedFunctionFactory({
|
|
|
145
145
|
}, { flush: "sync" }) : noop;
|
|
146
146
|
const unsubParamsWatcher = opts.watch ? watch(opts.watch, () => {
|
|
147
147
|
if (keyChanging) return;
|
|
148
|
-
if (nuxtApp._asyncData[key.value]?._execute.isPending()) queuePostFlushCb(() => {
|
|
149
|
-
nuxtApp._asyncData[key.value]?._execute.flush();
|
|
150
|
-
});
|
|
151
148
|
nuxtApp._asyncData[key.value]?._execute({
|
|
152
149
|
cause: "watch",
|
|
153
150
|
dedupe: opts.dedupe
|
|
@@ -388,7 +385,7 @@ function buildAsyncData(nuxtApp, key, _handler, options, initialCachedData) {
|
|
|
388
385
|
nuxtApp._asyncDataPromises[key] = promise;
|
|
389
386
|
return nuxtApp._asyncDataPromises[key];
|
|
390
387
|
},
|
|
391
|
-
_execute:
|
|
388
|
+
_execute: debounceTick((...args) => asyncData.execute(...args)),
|
|
392
389
|
_default: options.default,
|
|
393
390
|
_deps: 0,
|
|
394
391
|
_init: true,
|
package/dist/app/nuxt.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NuxtPayload, NuxtSSRContext, NuxtServerRuntimeHooks, PluginMeta } from "./types.js";
|
|
2
2
|
import { RouteMiddleware } from "./composables/router.js";
|
|
3
|
-
import { AsyncDataExecuteOptions, AsyncDataRequestStatus
|
|
3
|
+
import { AsyncDataExecuteOptions, AsyncDataRequestStatus } from "./composables/asyncData.js";
|
|
4
4
|
import { NuxtAppManifestMeta } from "./composables/manifest.js";
|
|
5
5
|
import { LoadingIndicator } from "./composables/loading-indicator.js";
|
|
6
6
|
import { RouteAnnouncer } from "./composables/route-announcer.js";
|
|
@@ -75,7 +75,7 @@ interface _NuxtApp {
|
|
|
75
75
|
/** @internal */
|
|
76
76
|
_init: boolean;
|
|
77
77
|
/** @internal */
|
|
78
|
-
_execute:
|
|
78
|
+
_execute: (opts?: AsyncDataExecuteOptions) => Promise<void>;
|
|
79
79
|
/** @internal */
|
|
80
80
|
_hash?: Record<string, string | undefined>;
|
|
81
81
|
/** @internal */
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/app/utils/debounce-tick.d.ts
|
|
2
|
+
interface DebounceTickOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Call `fn` immediately on the leading edge, instead of waiting for the next flush.
|
|
5
|
+
* @default false
|
|
6
|
+
*/
|
|
7
|
+
readonly leading?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Debounce an async function so that repeated calls within the same tick are
|
|
11
|
+
* collapsed into a single call (plus a trailing call if arguments arrived
|
|
12
|
+
* while the debounced call was still pending).
|
|
13
|
+
*
|
|
14
|
+
* Adapted from https://github.com/unjs/perfect-debounce with the timeout
|
|
15
|
+
* replaced by Vue's post-flush callback queue.
|
|
16
|
+
*/
|
|
17
|
+
declare function debounceTick<ArgumentsT extends unknown[], ReturnT>(fn: (...args: ArgumentsT) => PromiseLike<ReturnT> | ReturnT, options?: DebounceTickOptions): (...args: ArgumentsT) => Promise<ReturnT>;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { DebounceTickOptions, debounceTick };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { queuePostFlushCb } from "vue";
|
|
2
|
+
//#region src/app/utils/debounce-tick.ts
|
|
3
|
+
/**
|
|
4
|
+
* Debounce an async function so that repeated calls within the same tick are
|
|
5
|
+
* collapsed into a single call (plus a trailing call if arguments arrived
|
|
6
|
+
* while the debounced call was still pending).
|
|
7
|
+
*
|
|
8
|
+
* Adapted from https://github.com/unjs/perfect-debounce with the timeout
|
|
9
|
+
* replaced by Vue's post-flush callback queue.
|
|
10
|
+
*/
|
|
11
|
+
function debounceTick(fn, options = {}) {
|
|
12
|
+
let leadingValue;
|
|
13
|
+
let active = false;
|
|
14
|
+
let resolveList = [];
|
|
15
|
+
let currentPromise;
|
|
16
|
+
let trailingArgs;
|
|
17
|
+
const applyFn = (_this, args) => {
|
|
18
|
+
const promise = _applyPromised(fn, _this, args);
|
|
19
|
+
currentPromise = promise;
|
|
20
|
+
promise.finally(() => {
|
|
21
|
+
currentPromise = void 0;
|
|
22
|
+
if (trailingArgs && !active) {
|
|
23
|
+
const args = trailingArgs;
|
|
24
|
+
trailingArgs = void 0;
|
|
25
|
+
applyFn(_this, args);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return promise;
|
|
29
|
+
};
|
|
30
|
+
return function(...args) {
|
|
31
|
+
trailingArgs = args;
|
|
32
|
+
if (currentPromise) return currentPromise;
|
|
33
|
+
return new Promise((resolve) => {
|
|
34
|
+
const shouldCallNow = options.leading && !active;
|
|
35
|
+
if (!active) {
|
|
36
|
+
active = true;
|
|
37
|
+
queuePostFlushCb(() => {
|
|
38
|
+
active = false;
|
|
39
|
+
const flushArgs = trailingArgs ?? args;
|
|
40
|
+
trailingArgs = void 0;
|
|
41
|
+
const promise = options.leading ? leadingValue : applyFn(this, flushArgs);
|
|
42
|
+
for (const _resolve of resolveList) _resolve(promise);
|
|
43
|
+
resolveList = [];
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (shouldCallNow) {
|
|
47
|
+
leadingValue = applyFn(this, args);
|
|
48
|
+
resolve(leadingValue);
|
|
49
|
+
} else resolveList.push(resolve);
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
async function _applyPromised(fn, _this, args) {
|
|
54
|
+
return await fn.apply(_this, args);
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { debounceTick };
|
package/dist/index.js
CHANGED
|
@@ -1087,6 +1087,34 @@ function escapeDirectory(path) {
|
|
|
1087
1087
|
return escapeStringRegexp(path).replace(/\//g, "[\\\\/]");
|
|
1088
1088
|
}
|
|
1089
1089
|
//#endregion
|
|
1090
|
+
//#region src/components/builtin-metadata.ts
|
|
1091
|
+
function defineBuiltinMeta(slug, description) {
|
|
1092
|
+
return {
|
|
1093
|
+
description,
|
|
1094
|
+
docsUrl: `https://nuxt.com/docs/4.x/api/components/${slug}`
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
const BUILTIN_COMPONENT_META = {
|
|
1098
|
+
ClientOnly: defineBuiltinMeta("client-only", "Renders its default slot only on the client, with an optional server fallback."),
|
|
1099
|
+
DevOnly: defineBuiltinMeta("dev-only", "Renders its content only during development."),
|
|
1100
|
+
NuxtClientFallback: defineBuiltinMeta("nuxt-client-fallback", "Renders its content on the client when a child fails during server-side rendering."),
|
|
1101
|
+
NuxtPage: defineBuiltinMeta("nuxt-page", "Renders the current page from the `pages/` directory."),
|
|
1102
|
+
NuxtLayout: defineBuiltinMeta("nuxt-layout", "Renders the selected layout around pages or error content."),
|
|
1103
|
+
NuxtLink: defineBuiltinMeta("nuxt-link", "A drop-in replacement for Vue Router's `<RouterLink>` and the HTML `<a>` element."),
|
|
1104
|
+
NuxtLoadingIndicator: defineBuiltinMeta("nuxt-loading-indicator", "Displays a progress bar during page navigation."),
|
|
1105
|
+
NuxtErrorBoundary: defineBuiltinMeta("nuxt-error-boundary", "Catches client-side errors from its default slot and renders an error slot."),
|
|
1106
|
+
NuxtWelcome: defineBuiltinMeta("nuxt-welcome", "Displays the welcome screen used by new Nuxt projects."),
|
|
1107
|
+
NuxtIsland: defineBuiltinMeta("nuxt-island", "Renders a non-interactive server component without shipping client-side JavaScript."),
|
|
1108
|
+
NuxtImg: defineBuiltinMeta("nuxt-img", "Renders an optimized image through the Nuxt Image module."),
|
|
1109
|
+
NuxtPicture: defineBuiltinMeta("nuxt-picture", "Renders responsive optimized images through the Nuxt Image module."),
|
|
1110
|
+
NuxtRouteAnnouncer: defineBuiltinMeta("nuxt-route-announcer", "Announces route changes to assistive technologies using the current page title."),
|
|
1111
|
+
NuxtTime: defineBuiltinMeta("nuxt-time", "Formats dates and times consistently across server and client using the user's locale."),
|
|
1112
|
+
NuxtAnnouncer: defineBuiltinMeta("nuxt-announcer", "Announces dynamic content changes to assistive technologies.")
|
|
1113
|
+
};
|
|
1114
|
+
function getBuiltinComponentMeta(name) {
|
|
1115
|
+
return { ...BUILTIN_COMPONENT_META[name] };
|
|
1116
|
+
}
|
|
1117
|
+
//#endregion
|
|
1090
1118
|
//#region src/pages/plugins/route-injection.ts
|
|
1091
1119
|
const INJECTION_SINGLE_RE = /\bthis\.\$route\b|\b_ctx\.\$route\b/;
|
|
1092
1120
|
const RouteInjectionPlugin = (_nuxt) => createUnplugin(() => {
|
|
@@ -1284,7 +1312,8 @@ var module_default$4 = defineNuxtModule({
|
|
|
1284
1312
|
addComponent({
|
|
1285
1313
|
name: "NuxtPage",
|
|
1286
1314
|
priority: 10,
|
|
1287
|
-
filePath: resolve(distDir, "pages/runtime/page-placeholder")
|
|
1315
|
+
filePath: resolve(distDir, "pages/runtime/page-placeholder"),
|
|
1316
|
+
meta: getBuiltinComponentMeta("NuxtPage")
|
|
1288
1317
|
});
|
|
1289
1318
|
nuxt.hook("nitro:init", (nitro) => {
|
|
1290
1319
|
if (nuxt.options.dev || !nuxt.options.ssr || !nitro.options.static || !nitro.options.prerender.crawlLinks) return;
|
|
@@ -1630,7 +1659,8 @@ var module_default$4 = defineNuxtModule({
|
|
|
1630
1659
|
addComponent({
|
|
1631
1660
|
name: "NuxtPage",
|
|
1632
1661
|
priority: 10,
|
|
1633
|
-
filePath: resolve(distDir, "pages/runtime/page")
|
|
1662
|
+
filePath: resolve(distDir, "pages/runtime/page"),
|
|
1663
|
+
meta: getBuiltinComponentMeta("NuxtPage")
|
|
1634
1664
|
});
|
|
1635
1665
|
}
|
|
1636
1666
|
});
|
|
@@ -2319,6 +2349,18 @@ const componentsIslandsTemplate = {
|
|
|
2319
2349
|
}
|
|
2320
2350
|
};
|
|
2321
2351
|
const NON_VUE_RE = /\b\.(?!vue)\w+$/g;
|
|
2352
|
+
function escapeJsDocText(value) {
|
|
2353
|
+
return value.replace(/\*\//g, "* /");
|
|
2354
|
+
}
|
|
2355
|
+
function renderComponentJsDoc(meta, options = {}) {
|
|
2356
|
+
if (!meta?.description && !meta?.docsUrl) return "";
|
|
2357
|
+
const indent = options.indent || "";
|
|
2358
|
+
const sections = [];
|
|
2359
|
+
if (options.lazyName) sections.push(`Lazy-loaded version of \`<${options.lazyName}>\`.`);
|
|
2360
|
+
if (meta?.description) sections.push(escapeJsDocText(meta.description));
|
|
2361
|
+
if (meta?.docsUrl) sections.push(`@see ${escapeJsDocText(meta.docsUrl)}`);
|
|
2362
|
+
return `${indent}/**\n${indent} * ${sections.join(`\n${indent} *\n${indent} * `)}\n${indent} */\n`;
|
|
2363
|
+
}
|
|
2322
2364
|
function resolveComponentTypes(app, baseDir, dynamic) {
|
|
2323
2365
|
const serverPlaceholderPath = resolve(distDir, "app/components/server-placeholder");
|
|
2324
2366
|
const componentTypes = [];
|
|
@@ -2329,7 +2371,11 @@ function resolveComponentTypes(app, baseDir, dynamic) {
|
|
|
2329
2371
|
if (c.mode === "server") if (app.components.some((other) => other.pascalName === c.pascalName && other.mode === "client")) {
|
|
2330
2372
|
if (c.filePath.startsWith(serverPlaceholderPath)) continue;
|
|
2331
2373
|
} else type = `IslandComponent<${type}>`;
|
|
2332
|
-
componentTypes.push(
|
|
2374
|
+
componentTypes.push({
|
|
2375
|
+
pascalName: c.pascalName,
|
|
2376
|
+
type,
|
|
2377
|
+
meta: c.meta
|
|
2378
|
+
});
|
|
2333
2379
|
}
|
|
2334
2380
|
return componentTypes;
|
|
2335
2381
|
}
|
|
@@ -2362,8 +2408,8 @@ import type { DefineComponent, SlotsType } from 'vue'
|
|
|
2362
2408
|
${nuxt.options.experimental.componentIslands ? islandType : ""}
|
|
2363
2409
|
${hydrationTypes}
|
|
2364
2410
|
|
|
2365
|
-
${componentTypes.map((
|
|
2366
|
-
${componentTypes.map((
|
|
2411
|
+
${componentTypes.map(({ pascalName, type, meta }) => `${renderComponentJsDoc(meta)}export const ${pascalName}: ${type}`).join("\n")}
|
|
2412
|
+
${componentTypes.map(({ pascalName, type, meta }) => `${renderComponentJsDoc(meta, { lazyName: pascalName })}export const Lazy${pascalName}: LazyComponent<${type}>`).join("\n")}
|
|
2367
2413
|
|
|
2368
2414
|
export const componentNames: string[]
|
|
2369
2415
|
`;
|
|
@@ -2378,8 +2424,11 @@ import type { DefineComponent, SlotsType } from 'vue'
|
|
|
2378
2424
|
${nuxt.options.experimental.componentIslands ? islandType : ""}
|
|
2379
2425
|
${hydrationTypes}
|
|
2380
2426
|
interface _GlobalComponents {
|
|
2381
|
-
${componentTypes.map((
|
|
2382
|
-
${componentTypes.map((
|
|
2427
|
+
${componentTypes.map(({ pascalName, type, meta }) => `${renderComponentJsDoc(meta, { indent: " " })} ${genObjectKey(pascalName)}: ${type}`).join("\n")}
|
|
2428
|
+
${componentTypes.map(({ pascalName, type, meta }) => `${renderComponentJsDoc(meta, {
|
|
2429
|
+
indent: " ",
|
|
2430
|
+
lazyName: pascalName
|
|
2431
|
+
})} ${genObjectKey(`Lazy${pascalName}`)}: LazyComponent<${type}>`).join("\n")}
|
|
2383
2432
|
}
|
|
2384
2433
|
|
|
2385
2434
|
declare module 'vue' {
|
|
@@ -4956,7 +5005,7 @@ const runtimeDependencies = [
|
|
|
4956
5005
|
];
|
|
4957
5006
|
//#endregion
|
|
4958
5007
|
//#region package.json
|
|
4959
|
-
var version = "5.0.0-
|
|
5008
|
+
var version = "5.0.0-29741513.94de156f";
|
|
4960
5009
|
//#endregion
|
|
4961
5010
|
//#region src/core/utils/proxy.ts
|
|
4962
5011
|
async function installProxyDispatcher() {
|
|
@@ -5826,6 +5875,9 @@ var schema_default = defineNuxtModule({
|
|
|
5826
5875
|
ctx.nodeTsConfig.include.push(relative(nuxt.options.buildDir, join(nuxt.options.rootDir, "nuxt.schema.*")), relative(nuxt.options.buildDir, join(nuxt.options.rootDir, "layers/*/nuxt.schema.*")));
|
|
5827
5876
|
if (nuxt.options._prepare) await writeSchema(schema);
|
|
5828
5877
|
});
|
|
5878
|
+
nuxt.hook("nitro:prepare:types", (ctx) => {
|
|
5879
|
+
ctx.references.push({ path: resolve(nuxt.options.buildDir, "schema/nuxt.schema.d.ts") });
|
|
5880
|
+
});
|
|
5829
5881
|
let schema;
|
|
5830
5882
|
nuxt.hook("modules:done", async () => {
|
|
5831
5883
|
schema = await resolveSchema$1();
|
|
@@ -6448,7 +6500,7 @@ async function initNuxt(nuxt) {
|
|
|
6448
6500
|
opts.references.push({ types: "nuxt/app" });
|
|
6449
6501
|
opts.nodeReferences.push({ path: resolve(nuxt.options.buildDir, "types/modules.d.ts") });
|
|
6450
6502
|
opts.nodeReferences.push({ path: resolve(nuxt.options.buildDir, "types/runtime-config.d.ts") });
|
|
6451
|
-
opts.nodeReferences.push({ path: resolve(nuxt.options.buildDir, "types/app.config.d.ts") });
|
|
6503
|
+
opts.nodeReferences.push({ path: resolve(nuxt.options.buildDir, "types/shared-app.config.d.ts") });
|
|
6452
6504
|
opts.nodeReferences.push({ types: "nuxt" });
|
|
6453
6505
|
opts.nodeReferences.push({ path: resolveModulePath("@nuxt/vite-builder", { from: import.meta.url }).replace(".mjs", ".d.mts") });
|
|
6454
6506
|
if (typeof nuxt.options.builder === "string" && nuxt.options.builder !== "@nuxt/vite-builder") opts.nodeReferences.push({ types: nuxt.options.builder });
|
|
@@ -6459,7 +6511,7 @@ async function initNuxt(nuxt) {
|
|
|
6459
6511
|
if (nuxt.options.server.builder === "@nuxt/nitro-server") opts.sharedReferences.push(serverBuilderReference);
|
|
6460
6512
|
}
|
|
6461
6513
|
opts.sharedReferences.push({ path: resolve(nuxt.options.buildDir, "types/runtime-config.d.ts") });
|
|
6462
|
-
opts.sharedReferences.push({ path: resolve(nuxt.options.buildDir, "types/app.config.d.ts") });
|
|
6514
|
+
opts.sharedReferences.push({ path: resolve(nuxt.options.buildDir, "types/shared-app.config.d.ts") });
|
|
6463
6515
|
opts.sharedReferences.push({ path: resolve(nuxt.options.buildDir, "types/shared-imports.d.ts") });
|
|
6464
6516
|
paths ||= await resolveTypescriptPaths(nuxt);
|
|
6465
6517
|
opts.tsConfig.compilerOptions = defu(opts.tsConfig.compilerOptions, { paths: { ...paths } });
|
|
@@ -6476,7 +6528,7 @@ async function initNuxt(nuxt) {
|
|
|
6476
6528
|
}
|
|
6477
6529
|
});
|
|
6478
6530
|
nuxt.hook("nitro:prepare:types", (opts) => {
|
|
6479
|
-
opts.references.push({ path: resolve(nuxt.options.buildDir, "types/app.config.d.ts") });
|
|
6531
|
+
opts.references.push({ path: resolve(nuxt.options.buildDir, "types/shared-app.config.d.ts") });
|
|
6480
6532
|
opts.references.push({ path: resolve(nuxt.options.buildDir, "types/runtime-config.d.ts") });
|
|
6481
6533
|
const serverBuilderReference = getServerBuilderReference();
|
|
6482
6534
|
if (serverBuilderReference) opts.references.push(serverBuilderReference);
|
|
@@ -6599,27 +6651,32 @@ async function initNuxt(nuxt) {
|
|
|
6599
6651
|
if (nuxt.options.dev || !(typeof islandsConfig === "object" && islandsConfig.selectiveClient === "deep")) addComponent({
|
|
6600
6652
|
name: "NuxtWelcome",
|
|
6601
6653
|
priority: 10,
|
|
6602
|
-
filePath: resolve(nuxt.options.appDir, "components/welcome")
|
|
6654
|
+
filePath: resolve(nuxt.options.appDir, "components/welcome"),
|
|
6655
|
+
meta: getBuiltinComponentMeta("NuxtWelcome")
|
|
6603
6656
|
});
|
|
6604
6657
|
addComponent({
|
|
6605
6658
|
name: "NuxtLayout",
|
|
6606
6659
|
priority: 10,
|
|
6607
|
-
filePath: resolve(nuxt.options.appDir, "components/nuxt-layout")
|
|
6660
|
+
filePath: resolve(nuxt.options.appDir, "components/nuxt-layout"),
|
|
6661
|
+
meta: getBuiltinComponentMeta("NuxtLayout")
|
|
6608
6662
|
});
|
|
6609
6663
|
addComponent({
|
|
6610
6664
|
name: "NuxtErrorBoundary",
|
|
6611
6665
|
priority: 10,
|
|
6612
|
-
filePath: resolve(nuxt.options.appDir, "components/nuxt-error-boundary")
|
|
6666
|
+
filePath: resolve(nuxt.options.appDir, "components/nuxt-error-boundary"),
|
|
6667
|
+
meta: getBuiltinComponentMeta("NuxtErrorBoundary")
|
|
6613
6668
|
});
|
|
6614
6669
|
addComponent({
|
|
6615
6670
|
name: "ClientOnly",
|
|
6616
6671
|
priority: 10,
|
|
6617
|
-
filePath: resolve(nuxt.options.appDir, "components/client-only")
|
|
6672
|
+
filePath: resolve(nuxt.options.appDir, "components/client-only"),
|
|
6673
|
+
meta: getBuiltinComponentMeta("ClientOnly")
|
|
6618
6674
|
});
|
|
6619
6675
|
addComponent({
|
|
6620
6676
|
name: "DevOnly",
|
|
6621
6677
|
priority: 10,
|
|
6622
|
-
filePath: resolve(nuxt.options.appDir, "components/dev-only")
|
|
6678
|
+
filePath: resolve(nuxt.options.appDir, "components/dev-only"),
|
|
6679
|
+
meta: getBuiltinComponentMeta("DevOnly")
|
|
6623
6680
|
});
|
|
6624
6681
|
addComponent({
|
|
6625
6682
|
name: "ServerPlaceholder",
|
|
@@ -6629,29 +6686,34 @@ async function initNuxt(nuxt) {
|
|
|
6629
6686
|
addComponent({
|
|
6630
6687
|
name: "NuxtLink",
|
|
6631
6688
|
priority: 10,
|
|
6632
|
-
filePath: resolve(nuxt.options.appDir, "components/nuxt-link")
|
|
6689
|
+
filePath: resolve(nuxt.options.appDir, "components/nuxt-link"),
|
|
6690
|
+
meta: getBuiltinComponentMeta("NuxtLink")
|
|
6633
6691
|
});
|
|
6634
6692
|
addComponent({
|
|
6635
6693
|
name: "NuxtLoadingIndicator",
|
|
6636
6694
|
priority: 10,
|
|
6637
|
-
filePath: resolve(nuxt.options.appDir, "components/nuxt-loading-indicator")
|
|
6695
|
+
filePath: resolve(nuxt.options.appDir, "components/nuxt-loading-indicator"),
|
|
6696
|
+
meta: getBuiltinComponentMeta("NuxtLoadingIndicator")
|
|
6638
6697
|
});
|
|
6639
6698
|
addComponent({
|
|
6640
6699
|
name: "NuxtTime",
|
|
6641
6700
|
priority: 10,
|
|
6642
|
-
filePath: resolve(nuxt.options.appDir, "components/nuxt-time.vue")
|
|
6701
|
+
filePath: resolve(nuxt.options.appDir, "components/nuxt-time.vue"),
|
|
6702
|
+
meta: getBuiltinComponentMeta("NuxtTime")
|
|
6643
6703
|
});
|
|
6644
6704
|
addComponent({
|
|
6645
6705
|
name: "NuxtRouteAnnouncer",
|
|
6646
6706
|
priority: 10,
|
|
6647
6707
|
filePath: resolve(nuxt.options.appDir, "components/nuxt-route-announcer"),
|
|
6648
|
-
mode: "client"
|
|
6708
|
+
mode: "client",
|
|
6709
|
+
meta: getBuiltinComponentMeta("NuxtRouteAnnouncer")
|
|
6649
6710
|
});
|
|
6650
6711
|
addComponent({
|
|
6651
6712
|
name: "NuxtAnnouncer",
|
|
6652
6713
|
priority: 10,
|
|
6653
6714
|
filePath: resolve(nuxt.options.appDir, "components/nuxt-announcer"),
|
|
6654
|
-
mode: "client"
|
|
6715
|
+
mode: "client",
|
|
6716
|
+
meta: getBuiltinComponentMeta("NuxtAnnouncer")
|
|
6655
6717
|
});
|
|
6656
6718
|
if (nuxt.options.experimental.clientFallback) {
|
|
6657
6719
|
addComponent({
|
|
@@ -6659,14 +6721,16 @@ async function initNuxt(nuxt) {
|
|
|
6659
6721
|
_raw: true,
|
|
6660
6722
|
priority: 10,
|
|
6661
6723
|
filePath: resolve(nuxt.options.appDir, "components/client-fallback.client"),
|
|
6662
|
-
mode: "client"
|
|
6724
|
+
mode: "client",
|
|
6725
|
+
meta: getBuiltinComponentMeta("NuxtClientFallback")
|
|
6663
6726
|
});
|
|
6664
6727
|
addComponent({
|
|
6665
6728
|
name: "NuxtClientFallback",
|
|
6666
6729
|
_raw: true,
|
|
6667
6730
|
priority: 10,
|
|
6668
6731
|
filePath: resolve(nuxt.options.appDir, "components/client-fallback.server"),
|
|
6669
|
-
mode: "server"
|
|
6732
|
+
mode: "server",
|
|
6733
|
+
meta: getBuiltinComponentMeta("NuxtClientFallback")
|
|
6670
6734
|
});
|
|
6671
6735
|
}
|
|
6672
6736
|
for (const name of ["NuxtImg", "NuxtPicture"]) addComponent({
|
|
@@ -6674,6 +6738,7 @@ async function initNuxt(nuxt) {
|
|
|
6674
6738
|
export: name,
|
|
6675
6739
|
priority: -1,
|
|
6676
6740
|
filePath: resolve(nuxt.options.appDir, "components/nuxt-stubs"),
|
|
6741
|
+
meta: getBuiltinComponentMeta(name),
|
|
6677
6742
|
_internal_install: "@nuxt/image"
|
|
6678
6743
|
});
|
|
6679
6744
|
if (nuxt.options.builder === "@nuxt/webpack-builder" || nuxt.options.builder === "@nuxt/rspack-builder") addPlugin(resolve(nuxt.options.appDir, "plugins/preload.server"));
|
|
@@ -6690,7 +6755,8 @@ async function initNuxt(nuxt) {
|
|
|
6690
6755
|
if (nuxt.options.experimental.componentIslands) addComponent({
|
|
6691
6756
|
name: "NuxtIsland",
|
|
6692
6757
|
priority: 10,
|
|
6693
|
-
filePath: resolve(nuxt.options.appDir, "components/nuxt-island")
|
|
6758
|
+
filePath: resolve(nuxt.options.appDir, "components/nuxt-island"),
|
|
6759
|
+
meta: getBuiltinComponentMeta("NuxtIsland")
|
|
6694
6760
|
});
|
|
6695
6761
|
if (nuxt.options.experimental.crossOriginPrefetch) addPlugin(resolve(nuxt.options.appDir, "plugins/cross-origin-prefetch.client"));
|
|
6696
6762
|
if (nuxt.options.experimental.emitRouteChunkError === "automatic") addPlugin(resolve(nuxt.options.appDir, "plugins/chunk-reload.client"));
|
|
@@ -6974,6 +7040,7 @@ var templates_exports = /* @__PURE__ */ __exportAll({
|
|
|
6974
7040
|
schemaNodeTemplate: () => schemaNodeTemplate,
|
|
6975
7041
|
schemaTemplate: () => schemaTemplate,
|
|
6976
7042
|
serverPluginTemplate: () => serverPluginTemplate,
|
|
7043
|
+
sharedAppConfigDeclarationTemplate: () => sharedAppConfigDeclarationTemplate,
|
|
6977
7044
|
testComponentWrapperTemplate: () => testComponentWrapperTemplate,
|
|
6978
7045
|
vueShim: () => vueShim
|
|
6979
7046
|
});
|
|
@@ -7284,6 +7351,21 @@ const clientConfigTemplate = {
|
|
|
7284
7351
|
return ["export const useRuntimeConfig = () => ", (!nuxt.options.future.multiApp ? "window?.__NUXT__?.config || window?.useNuxtApp?.().payload?.config" : `window?.__NUXT__?.[${appId}]?.config || window?.useNuxtApp?.(${appId}).payload?.config`) || {}].join("\n");
|
|
7285
7352
|
}
|
|
7286
7353
|
};
|
|
7354
|
+
const APP_CONFIG_MERGE_TYPES = `type IsAny<T> = 0 extends 1 & T ? true : false
|
|
7355
|
+
|
|
7356
|
+
type MergedAppConfig<Resolved extends Record<string, unknown>, Custom extends Record<string, unknown>> = {
|
|
7357
|
+
[K in keyof (Resolved & Custom)]: K extends keyof Custom
|
|
7358
|
+
? unknown extends Custom[K]
|
|
7359
|
+
? Resolved[K]
|
|
7360
|
+
: IsAny<Custom[K]> extends true
|
|
7361
|
+
? Resolved[K]
|
|
7362
|
+
: Custom[K] extends Record<string, any>
|
|
7363
|
+
? Resolved[K] extends Record<string, any>
|
|
7364
|
+
? MergedAppConfig<Resolved[K], Custom[K]>
|
|
7365
|
+
: Exclude<Custom[K], undefined>
|
|
7366
|
+
: Exclude<Custom[K], undefined>
|
|
7367
|
+
: Resolved[K]
|
|
7368
|
+
}`;
|
|
7287
7369
|
const appConfigDeclarationTemplate = {
|
|
7288
7370
|
filename: "types/app.config.d.ts",
|
|
7289
7371
|
getContents({ app, nuxt }) {
|
|
@@ -7299,21 +7381,7 @@ declare global {
|
|
|
7299
7381
|
|
|
7300
7382
|
declare const inlineConfig = ${JSON.stringify(nuxt.options.appConfig, null, 2)}
|
|
7301
7383
|
type ResolvedAppConfig = Defu<typeof inlineConfig, [${app.configs.map((_id, index) => `typeof cfg${index}`).join(", ")}]>
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
type MergedAppConfig<Resolved extends Record<string, unknown>, Custom extends Record<string, unknown>> = {
|
|
7305
|
-
[K in keyof (Resolved & Custom)]: K extends keyof Custom
|
|
7306
|
-
? unknown extends Custom[K]
|
|
7307
|
-
? Resolved[K]
|
|
7308
|
-
: IsAny<Custom[K]> extends true
|
|
7309
|
-
? Resolved[K]
|
|
7310
|
-
: Custom[K] extends Record<string, any>
|
|
7311
|
-
? Resolved[K] extends Record<string, any>
|
|
7312
|
-
? MergedAppConfig<Resolved[K], Custom[K]>
|
|
7313
|
-
: Exclude<Custom[K], undefined>
|
|
7314
|
-
: Exclude<Custom[K], undefined>
|
|
7315
|
-
: Resolved[K]
|
|
7316
|
-
}
|
|
7384
|
+
${APP_CONFIG_MERGE_TYPES}
|
|
7317
7385
|
|
|
7318
7386
|
declare module 'nuxt/schema' {
|
|
7319
7387
|
interface AppConfig extends MergedAppConfig<ResolvedAppConfig, CustomAppConfig> { }
|
|
@@ -7324,6 +7392,24 @@ declare module '@nuxt/schema' {
|
|
|
7324
7392
|
`;
|
|
7325
7393
|
}
|
|
7326
7394
|
};
|
|
7395
|
+
const sharedAppConfigDeclarationTemplate = {
|
|
7396
|
+
filename: "types/shared-app.config.d.ts",
|
|
7397
|
+
getContents({ nuxt }) {
|
|
7398
|
+
return `
|
|
7399
|
+
import type { CustomAppConfig } from 'nuxt/schema'
|
|
7400
|
+
|
|
7401
|
+
declare const inlineConfig = ${JSON.stringify(nuxt.options.appConfig, null, 2)}
|
|
7402
|
+
${APP_CONFIG_MERGE_TYPES}
|
|
7403
|
+
|
|
7404
|
+
declare module 'nuxt/schema' {
|
|
7405
|
+
interface AppConfig extends MergedAppConfig<typeof inlineConfig, CustomAppConfig> { }
|
|
7406
|
+
}
|
|
7407
|
+
declare module '@nuxt/schema' {
|
|
7408
|
+
interface AppConfig extends MergedAppConfig<typeof inlineConfig, CustomAppConfig> { }
|
|
7409
|
+
}
|
|
7410
|
+
`;
|
|
7411
|
+
}
|
|
7412
|
+
};
|
|
7327
7413
|
const appConfigTemplate = {
|
|
7328
7414
|
filename: "app.config.mjs",
|
|
7329
7415
|
write: true,
|
package/dist/index.mjs
CHANGED
|
@@ -1087,6 +1087,34 @@ function escapeDirectory(path) {
|
|
|
1087
1087
|
return escapeStringRegexp(path).replace(/\//g, "[\\\\/]");
|
|
1088
1088
|
}
|
|
1089
1089
|
//#endregion
|
|
1090
|
+
//#region src/components/builtin-metadata.ts
|
|
1091
|
+
function defineBuiltinMeta(slug, description) {
|
|
1092
|
+
return {
|
|
1093
|
+
description,
|
|
1094
|
+
docsUrl: `https://nuxt.com/docs/4.x/api/components/${slug}`
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
const BUILTIN_COMPONENT_META = {
|
|
1098
|
+
ClientOnly: defineBuiltinMeta("client-only", "Renders its default slot only on the client, with an optional server fallback."),
|
|
1099
|
+
DevOnly: defineBuiltinMeta("dev-only", "Renders its content only during development."),
|
|
1100
|
+
NuxtClientFallback: defineBuiltinMeta("nuxt-client-fallback", "Renders its content on the client when a child fails during server-side rendering."),
|
|
1101
|
+
NuxtPage: defineBuiltinMeta("nuxt-page", "Renders the current page from the `pages/` directory."),
|
|
1102
|
+
NuxtLayout: defineBuiltinMeta("nuxt-layout", "Renders the selected layout around pages or error content."),
|
|
1103
|
+
NuxtLink: defineBuiltinMeta("nuxt-link", "A drop-in replacement for Vue Router's `<RouterLink>` and the HTML `<a>` element."),
|
|
1104
|
+
NuxtLoadingIndicator: defineBuiltinMeta("nuxt-loading-indicator", "Displays a progress bar during page navigation."),
|
|
1105
|
+
NuxtErrorBoundary: defineBuiltinMeta("nuxt-error-boundary", "Catches client-side errors from its default slot and renders an error slot."),
|
|
1106
|
+
NuxtWelcome: defineBuiltinMeta("nuxt-welcome", "Displays the welcome screen used by new Nuxt projects."),
|
|
1107
|
+
NuxtIsland: defineBuiltinMeta("nuxt-island", "Renders a non-interactive server component without shipping client-side JavaScript."),
|
|
1108
|
+
NuxtImg: defineBuiltinMeta("nuxt-img", "Renders an optimized image through the Nuxt Image module."),
|
|
1109
|
+
NuxtPicture: defineBuiltinMeta("nuxt-picture", "Renders responsive optimized images through the Nuxt Image module."),
|
|
1110
|
+
NuxtRouteAnnouncer: defineBuiltinMeta("nuxt-route-announcer", "Announces route changes to assistive technologies using the current page title."),
|
|
1111
|
+
NuxtTime: defineBuiltinMeta("nuxt-time", "Formats dates and times consistently across server and client using the user's locale."),
|
|
1112
|
+
NuxtAnnouncer: defineBuiltinMeta("nuxt-announcer", "Announces dynamic content changes to assistive technologies.")
|
|
1113
|
+
};
|
|
1114
|
+
function getBuiltinComponentMeta(name) {
|
|
1115
|
+
return { ...BUILTIN_COMPONENT_META[name] };
|
|
1116
|
+
}
|
|
1117
|
+
//#endregion
|
|
1090
1118
|
//#region src/pages/plugins/route-injection.ts
|
|
1091
1119
|
const INJECTION_SINGLE_RE = /\bthis\.\$route\b|\b_ctx\.\$route\b/;
|
|
1092
1120
|
const RouteInjectionPlugin = (_nuxt) => createUnplugin(() => {
|
|
@@ -1284,7 +1312,8 @@ var module_default$4 = defineNuxtModule({
|
|
|
1284
1312
|
addComponent({
|
|
1285
1313
|
name: "NuxtPage",
|
|
1286
1314
|
priority: 10,
|
|
1287
|
-
filePath: resolve(distDir, "pages/runtime/page-placeholder")
|
|
1315
|
+
filePath: resolve(distDir, "pages/runtime/page-placeholder"),
|
|
1316
|
+
meta: getBuiltinComponentMeta("NuxtPage")
|
|
1288
1317
|
});
|
|
1289
1318
|
nuxt.hook("nitro:init", (nitro) => {
|
|
1290
1319
|
if (nuxt.options.dev || !nuxt.options.ssr || !nitro.options.static || !nitro.options.prerender.crawlLinks) return;
|
|
@@ -1630,7 +1659,8 @@ var module_default$4 = defineNuxtModule({
|
|
|
1630
1659
|
addComponent({
|
|
1631
1660
|
name: "NuxtPage",
|
|
1632
1661
|
priority: 10,
|
|
1633
|
-
filePath: resolve(distDir, "pages/runtime/page")
|
|
1662
|
+
filePath: resolve(distDir, "pages/runtime/page"),
|
|
1663
|
+
meta: getBuiltinComponentMeta("NuxtPage")
|
|
1634
1664
|
});
|
|
1635
1665
|
}
|
|
1636
1666
|
});
|
|
@@ -2319,6 +2349,18 @@ const componentsIslandsTemplate = {
|
|
|
2319
2349
|
}
|
|
2320
2350
|
};
|
|
2321
2351
|
const NON_VUE_RE = /\b\.(?!vue)\w+$/g;
|
|
2352
|
+
function escapeJsDocText(value) {
|
|
2353
|
+
return value.replace(/\*\//g, "* /");
|
|
2354
|
+
}
|
|
2355
|
+
function renderComponentJsDoc(meta, options = {}) {
|
|
2356
|
+
if (!meta?.description && !meta?.docsUrl) return "";
|
|
2357
|
+
const indent = options.indent || "";
|
|
2358
|
+
const sections = [];
|
|
2359
|
+
if (options.lazyName) sections.push(`Lazy-loaded version of \`<${options.lazyName}>\`.`);
|
|
2360
|
+
if (meta?.description) sections.push(escapeJsDocText(meta.description));
|
|
2361
|
+
if (meta?.docsUrl) sections.push(`@see ${escapeJsDocText(meta.docsUrl)}`);
|
|
2362
|
+
return `${indent}/**\n${indent} * ${sections.join(`\n${indent} *\n${indent} * `)}\n${indent} */\n`;
|
|
2363
|
+
}
|
|
2322
2364
|
function resolveComponentTypes(app, baseDir, dynamic) {
|
|
2323
2365
|
const serverPlaceholderPath = resolve(distDir, "app/components/server-placeholder");
|
|
2324
2366
|
const componentTypes = [];
|
|
@@ -2329,7 +2371,11 @@ function resolveComponentTypes(app, baseDir, dynamic) {
|
|
|
2329
2371
|
if (c.mode === "server") if (app.components.some((other) => other.pascalName === c.pascalName && other.mode === "client")) {
|
|
2330
2372
|
if (c.filePath.startsWith(serverPlaceholderPath)) continue;
|
|
2331
2373
|
} else type = `IslandComponent<${type}>`;
|
|
2332
|
-
componentTypes.push(
|
|
2374
|
+
componentTypes.push({
|
|
2375
|
+
pascalName: c.pascalName,
|
|
2376
|
+
type,
|
|
2377
|
+
meta: c.meta
|
|
2378
|
+
});
|
|
2333
2379
|
}
|
|
2334
2380
|
return componentTypes;
|
|
2335
2381
|
}
|
|
@@ -2362,8 +2408,8 @@ import type { DefineComponent, SlotsType } from 'vue'
|
|
|
2362
2408
|
${nuxt.options.experimental.componentIslands ? islandType : ""}
|
|
2363
2409
|
${hydrationTypes}
|
|
2364
2410
|
|
|
2365
|
-
${componentTypes.map((
|
|
2366
|
-
${componentTypes.map((
|
|
2411
|
+
${componentTypes.map(({ pascalName, type, meta }) => `${renderComponentJsDoc(meta)}export const ${pascalName}: ${type}`).join("\n")}
|
|
2412
|
+
${componentTypes.map(({ pascalName, type, meta }) => `${renderComponentJsDoc(meta, { lazyName: pascalName })}export const Lazy${pascalName}: LazyComponent<${type}>`).join("\n")}
|
|
2367
2413
|
|
|
2368
2414
|
export const componentNames: string[]
|
|
2369
2415
|
`;
|
|
@@ -2378,8 +2424,11 @@ import type { DefineComponent, SlotsType } from 'vue'
|
|
|
2378
2424
|
${nuxt.options.experimental.componentIslands ? islandType : ""}
|
|
2379
2425
|
${hydrationTypes}
|
|
2380
2426
|
interface _GlobalComponents {
|
|
2381
|
-
${componentTypes.map((
|
|
2382
|
-
${componentTypes.map((
|
|
2427
|
+
${componentTypes.map(({ pascalName, type, meta }) => `${renderComponentJsDoc(meta, { indent: " " })} ${genObjectKey(pascalName)}: ${type}`).join("\n")}
|
|
2428
|
+
${componentTypes.map(({ pascalName, type, meta }) => `${renderComponentJsDoc(meta, {
|
|
2429
|
+
indent: " ",
|
|
2430
|
+
lazyName: pascalName
|
|
2431
|
+
})} ${genObjectKey(`Lazy${pascalName}`)}: LazyComponent<${type}>`).join("\n")}
|
|
2383
2432
|
}
|
|
2384
2433
|
|
|
2385
2434
|
declare module 'vue' {
|
|
@@ -4956,7 +5005,7 @@ const runtimeDependencies = [
|
|
|
4956
5005
|
];
|
|
4957
5006
|
//#endregion
|
|
4958
5007
|
//#region package.json
|
|
4959
|
-
var version = "5.0.0-
|
|
5008
|
+
var version = "5.0.0-29741513.94de156f";
|
|
4960
5009
|
//#endregion
|
|
4961
5010
|
//#region src/core/utils/proxy.ts
|
|
4962
5011
|
async function installProxyDispatcher() {
|
|
@@ -5826,6 +5875,9 @@ var schema_default = defineNuxtModule({
|
|
|
5826
5875
|
ctx.nodeTsConfig.include.push(relative(nuxt.options.buildDir, join(nuxt.options.rootDir, "nuxt.schema.*")), relative(nuxt.options.buildDir, join(nuxt.options.rootDir, "layers/*/nuxt.schema.*")));
|
|
5827
5876
|
if (nuxt.options._prepare) await writeSchema(schema);
|
|
5828
5877
|
});
|
|
5878
|
+
nuxt.hook("nitro:prepare:types", (ctx) => {
|
|
5879
|
+
ctx.references.push({ path: resolve(nuxt.options.buildDir, "schema/nuxt.schema.d.ts") });
|
|
5880
|
+
});
|
|
5829
5881
|
let schema;
|
|
5830
5882
|
nuxt.hook("modules:done", async () => {
|
|
5831
5883
|
schema = await resolveSchema$1();
|
|
@@ -6448,7 +6500,7 @@ async function initNuxt(nuxt) {
|
|
|
6448
6500
|
opts.references.push({ types: "nuxt/app" });
|
|
6449
6501
|
opts.nodeReferences.push({ path: resolve(nuxt.options.buildDir, "types/modules.d.ts") });
|
|
6450
6502
|
opts.nodeReferences.push({ path: resolve(nuxt.options.buildDir, "types/runtime-config.d.ts") });
|
|
6451
|
-
opts.nodeReferences.push({ path: resolve(nuxt.options.buildDir, "types/app.config.d.ts") });
|
|
6503
|
+
opts.nodeReferences.push({ path: resolve(nuxt.options.buildDir, "types/shared-app.config.d.ts") });
|
|
6452
6504
|
opts.nodeReferences.push({ types: "nuxt" });
|
|
6453
6505
|
opts.nodeReferences.push({ path: resolveModulePath("@nuxt/vite-builder", { from: import.meta.url }).replace(".mjs", ".d.mts") });
|
|
6454
6506
|
if (typeof nuxt.options.builder === "string" && nuxt.options.builder !== "@nuxt/vite-builder") opts.nodeReferences.push({ types: nuxt.options.builder });
|
|
@@ -6459,7 +6511,7 @@ async function initNuxt(nuxt) {
|
|
|
6459
6511
|
if (nuxt.options.server.builder === "@nuxt/nitro-server") opts.sharedReferences.push(serverBuilderReference);
|
|
6460
6512
|
}
|
|
6461
6513
|
opts.sharedReferences.push({ path: resolve(nuxt.options.buildDir, "types/runtime-config.d.ts") });
|
|
6462
|
-
opts.sharedReferences.push({ path: resolve(nuxt.options.buildDir, "types/app.config.d.ts") });
|
|
6514
|
+
opts.sharedReferences.push({ path: resolve(nuxt.options.buildDir, "types/shared-app.config.d.ts") });
|
|
6463
6515
|
opts.sharedReferences.push({ path: resolve(nuxt.options.buildDir, "types/shared-imports.d.ts") });
|
|
6464
6516
|
paths ||= await resolveTypescriptPaths(nuxt);
|
|
6465
6517
|
opts.tsConfig.compilerOptions = defu(opts.tsConfig.compilerOptions, { paths: { ...paths } });
|
|
@@ -6476,7 +6528,7 @@ async function initNuxt(nuxt) {
|
|
|
6476
6528
|
}
|
|
6477
6529
|
});
|
|
6478
6530
|
nuxt.hook("nitro:prepare:types", (opts) => {
|
|
6479
|
-
opts.references.push({ path: resolve(nuxt.options.buildDir, "types/app.config.d.ts") });
|
|
6531
|
+
opts.references.push({ path: resolve(nuxt.options.buildDir, "types/shared-app.config.d.ts") });
|
|
6480
6532
|
opts.references.push({ path: resolve(nuxt.options.buildDir, "types/runtime-config.d.ts") });
|
|
6481
6533
|
const serverBuilderReference = getServerBuilderReference();
|
|
6482
6534
|
if (serverBuilderReference) opts.references.push(serverBuilderReference);
|
|
@@ -6599,27 +6651,32 @@ async function initNuxt(nuxt) {
|
|
|
6599
6651
|
if (nuxt.options.dev || !(typeof islandsConfig === "object" && islandsConfig.selectiveClient === "deep")) addComponent({
|
|
6600
6652
|
name: "NuxtWelcome",
|
|
6601
6653
|
priority: 10,
|
|
6602
|
-
filePath: resolve(nuxt.options.appDir, "components/welcome")
|
|
6654
|
+
filePath: resolve(nuxt.options.appDir, "components/welcome"),
|
|
6655
|
+
meta: getBuiltinComponentMeta("NuxtWelcome")
|
|
6603
6656
|
});
|
|
6604
6657
|
addComponent({
|
|
6605
6658
|
name: "NuxtLayout",
|
|
6606
6659
|
priority: 10,
|
|
6607
|
-
filePath: resolve(nuxt.options.appDir, "components/nuxt-layout")
|
|
6660
|
+
filePath: resolve(nuxt.options.appDir, "components/nuxt-layout"),
|
|
6661
|
+
meta: getBuiltinComponentMeta("NuxtLayout")
|
|
6608
6662
|
});
|
|
6609
6663
|
addComponent({
|
|
6610
6664
|
name: "NuxtErrorBoundary",
|
|
6611
6665
|
priority: 10,
|
|
6612
|
-
filePath: resolve(nuxt.options.appDir, "components/nuxt-error-boundary")
|
|
6666
|
+
filePath: resolve(nuxt.options.appDir, "components/nuxt-error-boundary"),
|
|
6667
|
+
meta: getBuiltinComponentMeta("NuxtErrorBoundary")
|
|
6613
6668
|
});
|
|
6614
6669
|
addComponent({
|
|
6615
6670
|
name: "ClientOnly",
|
|
6616
6671
|
priority: 10,
|
|
6617
|
-
filePath: resolve(nuxt.options.appDir, "components/client-only")
|
|
6672
|
+
filePath: resolve(nuxt.options.appDir, "components/client-only"),
|
|
6673
|
+
meta: getBuiltinComponentMeta("ClientOnly")
|
|
6618
6674
|
});
|
|
6619
6675
|
addComponent({
|
|
6620
6676
|
name: "DevOnly",
|
|
6621
6677
|
priority: 10,
|
|
6622
|
-
filePath: resolve(nuxt.options.appDir, "components/dev-only")
|
|
6678
|
+
filePath: resolve(nuxt.options.appDir, "components/dev-only"),
|
|
6679
|
+
meta: getBuiltinComponentMeta("DevOnly")
|
|
6623
6680
|
});
|
|
6624
6681
|
addComponent({
|
|
6625
6682
|
name: "ServerPlaceholder",
|
|
@@ -6629,29 +6686,34 @@ async function initNuxt(nuxt) {
|
|
|
6629
6686
|
addComponent({
|
|
6630
6687
|
name: "NuxtLink",
|
|
6631
6688
|
priority: 10,
|
|
6632
|
-
filePath: resolve(nuxt.options.appDir, "components/nuxt-link")
|
|
6689
|
+
filePath: resolve(nuxt.options.appDir, "components/nuxt-link"),
|
|
6690
|
+
meta: getBuiltinComponentMeta("NuxtLink")
|
|
6633
6691
|
});
|
|
6634
6692
|
addComponent({
|
|
6635
6693
|
name: "NuxtLoadingIndicator",
|
|
6636
6694
|
priority: 10,
|
|
6637
|
-
filePath: resolve(nuxt.options.appDir, "components/nuxt-loading-indicator")
|
|
6695
|
+
filePath: resolve(nuxt.options.appDir, "components/nuxt-loading-indicator"),
|
|
6696
|
+
meta: getBuiltinComponentMeta("NuxtLoadingIndicator")
|
|
6638
6697
|
});
|
|
6639
6698
|
addComponent({
|
|
6640
6699
|
name: "NuxtTime",
|
|
6641
6700
|
priority: 10,
|
|
6642
|
-
filePath: resolve(nuxt.options.appDir, "components/nuxt-time.vue")
|
|
6701
|
+
filePath: resolve(nuxt.options.appDir, "components/nuxt-time.vue"),
|
|
6702
|
+
meta: getBuiltinComponentMeta("NuxtTime")
|
|
6643
6703
|
});
|
|
6644
6704
|
addComponent({
|
|
6645
6705
|
name: "NuxtRouteAnnouncer",
|
|
6646
6706
|
priority: 10,
|
|
6647
6707
|
filePath: resolve(nuxt.options.appDir, "components/nuxt-route-announcer"),
|
|
6648
|
-
mode: "client"
|
|
6708
|
+
mode: "client",
|
|
6709
|
+
meta: getBuiltinComponentMeta("NuxtRouteAnnouncer")
|
|
6649
6710
|
});
|
|
6650
6711
|
addComponent({
|
|
6651
6712
|
name: "NuxtAnnouncer",
|
|
6652
6713
|
priority: 10,
|
|
6653
6714
|
filePath: resolve(nuxt.options.appDir, "components/nuxt-announcer"),
|
|
6654
|
-
mode: "client"
|
|
6715
|
+
mode: "client",
|
|
6716
|
+
meta: getBuiltinComponentMeta("NuxtAnnouncer")
|
|
6655
6717
|
});
|
|
6656
6718
|
if (nuxt.options.experimental.clientFallback) {
|
|
6657
6719
|
addComponent({
|
|
@@ -6659,14 +6721,16 @@ async function initNuxt(nuxt) {
|
|
|
6659
6721
|
_raw: true,
|
|
6660
6722
|
priority: 10,
|
|
6661
6723
|
filePath: resolve(nuxt.options.appDir, "components/client-fallback.client"),
|
|
6662
|
-
mode: "client"
|
|
6724
|
+
mode: "client",
|
|
6725
|
+
meta: getBuiltinComponentMeta("NuxtClientFallback")
|
|
6663
6726
|
});
|
|
6664
6727
|
addComponent({
|
|
6665
6728
|
name: "NuxtClientFallback",
|
|
6666
6729
|
_raw: true,
|
|
6667
6730
|
priority: 10,
|
|
6668
6731
|
filePath: resolve(nuxt.options.appDir, "components/client-fallback.server"),
|
|
6669
|
-
mode: "server"
|
|
6732
|
+
mode: "server",
|
|
6733
|
+
meta: getBuiltinComponentMeta("NuxtClientFallback")
|
|
6670
6734
|
});
|
|
6671
6735
|
}
|
|
6672
6736
|
for (const name of ["NuxtImg", "NuxtPicture"]) addComponent({
|
|
@@ -6674,6 +6738,7 @@ async function initNuxt(nuxt) {
|
|
|
6674
6738
|
export: name,
|
|
6675
6739
|
priority: -1,
|
|
6676
6740
|
filePath: resolve(nuxt.options.appDir, "components/nuxt-stubs"),
|
|
6741
|
+
meta: getBuiltinComponentMeta(name),
|
|
6677
6742
|
_internal_install: "@nuxt/image"
|
|
6678
6743
|
});
|
|
6679
6744
|
if (nuxt.options.builder === "@nuxt/webpack-builder" || nuxt.options.builder === "@nuxt/rspack-builder") addPlugin(resolve(nuxt.options.appDir, "plugins/preload.server"));
|
|
@@ -6690,7 +6755,8 @@ async function initNuxt(nuxt) {
|
|
|
6690
6755
|
if (nuxt.options.experimental.componentIslands) addComponent({
|
|
6691
6756
|
name: "NuxtIsland",
|
|
6692
6757
|
priority: 10,
|
|
6693
|
-
filePath: resolve(nuxt.options.appDir, "components/nuxt-island")
|
|
6758
|
+
filePath: resolve(nuxt.options.appDir, "components/nuxt-island"),
|
|
6759
|
+
meta: getBuiltinComponentMeta("NuxtIsland")
|
|
6694
6760
|
});
|
|
6695
6761
|
if (nuxt.options.experimental.crossOriginPrefetch) addPlugin(resolve(nuxt.options.appDir, "plugins/cross-origin-prefetch.client"));
|
|
6696
6762
|
if (nuxt.options.experimental.emitRouteChunkError === "automatic") addPlugin(resolve(nuxt.options.appDir, "plugins/chunk-reload.client"));
|
|
@@ -6974,6 +7040,7 @@ var templates_exports = /* @__PURE__ */ __exportAll({
|
|
|
6974
7040
|
schemaNodeTemplate: () => schemaNodeTemplate,
|
|
6975
7041
|
schemaTemplate: () => schemaTemplate,
|
|
6976
7042
|
serverPluginTemplate: () => serverPluginTemplate,
|
|
7043
|
+
sharedAppConfigDeclarationTemplate: () => sharedAppConfigDeclarationTemplate,
|
|
6977
7044
|
testComponentWrapperTemplate: () => testComponentWrapperTemplate,
|
|
6978
7045
|
vueShim: () => vueShim
|
|
6979
7046
|
});
|
|
@@ -7284,6 +7351,21 @@ const clientConfigTemplate = {
|
|
|
7284
7351
|
return ["export const useRuntimeConfig = () => ", (!nuxt.options.future.multiApp ? "window?.__NUXT__?.config || window?.useNuxtApp?.().payload?.config" : `window?.__NUXT__?.[${appId}]?.config || window?.useNuxtApp?.(${appId}).payload?.config`) || {}].join("\n");
|
|
7285
7352
|
}
|
|
7286
7353
|
};
|
|
7354
|
+
const APP_CONFIG_MERGE_TYPES = `type IsAny<T> = 0 extends 1 & T ? true : false
|
|
7355
|
+
|
|
7356
|
+
type MergedAppConfig<Resolved extends Record<string, unknown>, Custom extends Record<string, unknown>> = {
|
|
7357
|
+
[K in keyof (Resolved & Custom)]: K extends keyof Custom
|
|
7358
|
+
? unknown extends Custom[K]
|
|
7359
|
+
? Resolved[K]
|
|
7360
|
+
: IsAny<Custom[K]> extends true
|
|
7361
|
+
? Resolved[K]
|
|
7362
|
+
: Custom[K] extends Record<string, any>
|
|
7363
|
+
? Resolved[K] extends Record<string, any>
|
|
7364
|
+
? MergedAppConfig<Resolved[K], Custom[K]>
|
|
7365
|
+
: Exclude<Custom[K], undefined>
|
|
7366
|
+
: Exclude<Custom[K], undefined>
|
|
7367
|
+
: Resolved[K]
|
|
7368
|
+
}`;
|
|
7287
7369
|
const appConfigDeclarationTemplate = {
|
|
7288
7370
|
filename: "types/app.config.d.ts",
|
|
7289
7371
|
getContents({ app, nuxt }) {
|
|
@@ -7299,21 +7381,7 @@ declare global {
|
|
|
7299
7381
|
|
|
7300
7382
|
declare const inlineConfig = ${JSON.stringify(nuxt.options.appConfig, null, 2)}
|
|
7301
7383
|
type ResolvedAppConfig = Defu<typeof inlineConfig, [${app.configs.map((_id, index) => `typeof cfg${index}`).join(", ")}]>
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
type MergedAppConfig<Resolved extends Record<string, unknown>, Custom extends Record<string, unknown>> = {
|
|
7305
|
-
[K in keyof (Resolved & Custom)]: K extends keyof Custom
|
|
7306
|
-
? unknown extends Custom[K]
|
|
7307
|
-
? Resolved[K]
|
|
7308
|
-
: IsAny<Custom[K]> extends true
|
|
7309
|
-
? Resolved[K]
|
|
7310
|
-
: Custom[K] extends Record<string, any>
|
|
7311
|
-
? Resolved[K] extends Record<string, any>
|
|
7312
|
-
? MergedAppConfig<Resolved[K], Custom[K]>
|
|
7313
|
-
: Exclude<Custom[K], undefined>
|
|
7314
|
-
: Exclude<Custom[K], undefined>
|
|
7315
|
-
: Resolved[K]
|
|
7316
|
-
}
|
|
7384
|
+
${APP_CONFIG_MERGE_TYPES}
|
|
7317
7385
|
|
|
7318
7386
|
declare module 'nuxt/schema' {
|
|
7319
7387
|
interface AppConfig extends MergedAppConfig<ResolvedAppConfig, CustomAppConfig> { }
|
|
@@ -7324,6 +7392,24 @@ declare module '@nuxt/schema' {
|
|
|
7324
7392
|
`;
|
|
7325
7393
|
}
|
|
7326
7394
|
};
|
|
7395
|
+
const sharedAppConfigDeclarationTemplate = {
|
|
7396
|
+
filename: "types/shared-app.config.d.ts",
|
|
7397
|
+
getContents({ nuxt }) {
|
|
7398
|
+
return `
|
|
7399
|
+
import type { CustomAppConfig } from 'nuxt/schema'
|
|
7400
|
+
|
|
7401
|
+
declare const inlineConfig = ${JSON.stringify(nuxt.options.appConfig, null, 2)}
|
|
7402
|
+
${APP_CONFIG_MERGE_TYPES}
|
|
7403
|
+
|
|
7404
|
+
declare module 'nuxt/schema' {
|
|
7405
|
+
interface AppConfig extends MergedAppConfig<typeof inlineConfig, CustomAppConfig> { }
|
|
7406
|
+
}
|
|
7407
|
+
declare module '@nuxt/schema' {
|
|
7408
|
+
interface AppConfig extends MergedAppConfig<typeof inlineConfig, CustomAppConfig> { }
|
|
7409
|
+
}
|
|
7410
|
+
`;
|
|
7411
|
+
}
|
|
7412
|
+
};
|
|
7327
7413
|
const appConfigTemplate = {
|
|
7328
7414
|
filename: "app.config.mjs",
|
|
7329
7415
|
write: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-nightly",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-29741513.94de156f",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -80,11 +80,11 @@
|
|
|
80
80
|
"@dxup/nuxt": "^0.5.3",
|
|
81
81
|
"@nuxt/cli": "npm:@nuxt/cli-nightly@latest",
|
|
82
82
|
"@nuxt/devtools": "^4.0.0-alpha.7",
|
|
83
|
-
"@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-
|
|
84
|
-
"@nuxt/nitro-server": "npm:@nuxt/nitro-server-nightly@5.0.0-
|
|
85
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-
|
|
83
|
+
"@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-29741513.94de156f",
|
|
84
|
+
"@nuxt/nitro-server": "npm:@nuxt/nitro-server-nightly@5.0.0-29741513.94de156f",
|
|
85
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29741513.94de156f",
|
|
86
86
|
"@nuxt/telemetry": "^2.8.0",
|
|
87
|
-
"@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@5.0.0-
|
|
87
|
+
"@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@5.0.0-29741513.94de156f",
|
|
88
88
|
"@unhead/vue": "^3.1.8",
|
|
89
89
|
"@vue/shared": "^3.5.40",
|
|
90
90
|
"chokidar": "^5.0.0",
|