nuxt-nightly 5.0.0-29741502.a0eea766 → 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 +42 -19
- package/dist/index.mjs +42 -19
- 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
|
@@ -5005,7 +5005,7 @@ const runtimeDependencies = [
|
|
|
5005
5005
|
];
|
|
5006
5006
|
//#endregion
|
|
5007
5007
|
//#region package.json
|
|
5008
|
-
var version = "5.0.0-
|
|
5008
|
+
var version = "5.0.0-29741513.94de156f";
|
|
5009
5009
|
//#endregion
|
|
5010
5010
|
//#region src/core/utils/proxy.ts
|
|
5011
5011
|
async function installProxyDispatcher() {
|
|
@@ -5875,6 +5875,9 @@ var schema_default = defineNuxtModule({
|
|
|
5875
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.*")));
|
|
5876
5876
|
if (nuxt.options._prepare) await writeSchema(schema);
|
|
5877
5877
|
});
|
|
5878
|
+
nuxt.hook("nitro:prepare:types", (ctx) => {
|
|
5879
|
+
ctx.references.push({ path: resolve(nuxt.options.buildDir, "schema/nuxt.schema.d.ts") });
|
|
5880
|
+
});
|
|
5878
5881
|
let schema;
|
|
5879
5882
|
nuxt.hook("modules:done", async () => {
|
|
5880
5883
|
schema = await resolveSchema$1();
|
|
@@ -6497,7 +6500,7 @@ async function initNuxt(nuxt) {
|
|
|
6497
6500
|
opts.references.push({ types: "nuxt/app" });
|
|
6498
6501
|
opts.nodeReferences.push({ path: resolve(nuxt.options.buildDir, "types/modules.d.ts") });
|
|
6499
6502
|
opts.nodeReferences.push({ path: resolve(nuxt.options.buildDir, "types/runtime-config.d.ts") });
|
|
6500
|
-
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") });
|
|
6501
6504
|
opts.nodeReferences.push({ types: "nuxt" });
|
|
6502
6505
|
opts.nodeReferences.push({ path: resolveModulePath("@nuxt/vite-builder", { from: import.meta.url }).replace(".mjs", ".d.mts") });
|
|
6503
6506
|
if (typeof nuxt.options.builder === "string" && nuxt.options.builder !== "@nuxt/vite-builder") opts.nodeReferences.push({ types: nuxt.options.builder });
|
|
@@ -6508,7 +6511,7 @@ async function initNuxt(nuxt) {
|
|
|
6508
6511
|
if (nuxt.options.server.builder === "@nuxt/nitro-server") opts.sharedReferences.push(serverBuilderReference);
|
|
6509
6512
|
}
|
|
6510
6513
|
opts.sharedReferences.push({ path: resolve(nuxt.options.buildDir, "types/runtime-config.d.ts") });
|
|
6511
|
-
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") });
|
|
6512
6515
|
opts.sharedReferences.push({ path: resolve(nuxt.options.buildDir, "types/shared-imports.d.ts") });
|
|
6513
6516
|
paths ||= await resolveTypescriptPaths(nuxt);
|
|
6514
6517
|
opts.tsConfig.compilerOptions = defu(opts.tsConfig.compilerOptions, { paths: { ...paths } });
|
|
@@ -6525,7 +6528,7 @@ async function initNuxt(nuxt) {
|
|
|
6525
6528
|
}
|
|
6526
6529
|
});
|
|
6527
6530
|
nuxt.hook("nitro:prepare:types", (opts) => {
|
|
6528
|
-
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") });
|
|
6529
6532
|
opts.references.push({ path: resolve(nuxt.options.buildDir, "types/runtime-config.d.ts") });
|
|
6530
6533
|
const serverBuilderReference = getServerBuilderReference();
|
|
6531
6534
|
if (serverBuilderReference) opts.references.push(serverBuilderReference);
|
|
@@ -7037,6 +7040,7 @@ var templates_exports = /* @__PURE__ */ __exportAll({
|
|
|
7037
7040
|
schemaNodeTemplate: () => schemaNodeTemplate,
|
|
7038
7041
|
schemaTemplate: () => schemaTemplate,
|
|
7039
7042
|
serverPluginTemplate: () => serverPluginTemplate,
|
|
7043
|
+
sharedAppConfigDeclarationTemplate: () => sharedAppConfigDeclarationTemplate,
|
|
7040
7044
|
testComponentWrapperTemplate: () => testComponentWrapperTemplate,
|
|
7041
7045
|
vueShim: () => vueShim
|
|
7042
7046
|
});
|
|
@@ -7347,6 +7351,21 @@ const clientConfigTemplate = {
|
|
|
7347
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");
|
|
7348
7352
|
}
|
|
7349
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
|
+
}`;
|
|
7350
7369
|
const appConfigDeclarationTemplate = {
|
|
7351
7370
|
filename: "types/app.config.d.ts",
|
|
7352
7371
|
getContents({ app, nuxt }) {
|
|
@@ -7362,21 +7381,7 @@ declare global {
|
|
|
7362
7381
|
|
|
7363
7382
|
declare const inlineConfig = ${JSON.stringify(nuxt.options.appConfig, null, 2)}
|
|
7364
7383
|
type ResolvedAppConfig = Defu<typeof inlineConfig, [${app.configs.map((_id, index) => `typeof cfg${index}`).join(", ")}]>
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
type MergedAppConfig<Resolved extends Record<string, unknown>, Custom extends Record<string, unknown>> = {
|
|
7368
|
-
[K in keyof (Resolved & Custom)]: K extends keyof Custom
|
|
7369
|
-
? unknown extends Custom[K]
|
|
7370
|
-
? Resolved[K]
|
|
7371
|
-
: IsAny<Custom[K]> extends true
|
|
7372
|
-
? Resolved[K]
|
|
7373
|
-
: Custom[K] extends Record<string, any>
|
|
7374
|
-
? Resolved[K] extends Record<string, any>
|
|
7375
|
-
? MergedAppConfig<Resolved[K], Custom[K]>
|
|
7376
|
-
: Exclude<Custom[K], undefined>
|
|
7377
|
-
: Exclude<Custom[K], undefined>
|
|
7378
|
-
: Resolved[K]
|
|
7379
|
-
}
|
|
7384
|
+
${APP_CONFIG_MERGE_TYPES}
|
|
7380
7385
|
|
|
7381
7386
|
declare module 'nuxt/schema' {
|
|
7382
7387
|
interface AppConfig extends MergedAppConfig<ResolvedAppConfig, CustomAppConfig> { }
|
|
@@ -7387,6 +7392,24 @@ declare module '@nuxt/schema' {
|
|
|
7387
7392
|
`;
|
|
7388
7393
|
}
|
|
7389
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
|
+
};
|
|
7390
7413
|
const appConfigTemplate = {
|
|
7391
7414
|
filename: "app.config.mjs",
|
|
7392
7415
|
write: true,
|
package/dist/index.mjs
CHANGED
|
@@ -5005,7 +5005,7 @@ const runtimeDependencies = [
|
|
|
5005
5005
|
];
|
|
5006
5006
|
//#endregion
|
|
5007
5007
|
//#region package.json
|
|
5008
|
-
var version = "5.0.0-
|
|
5008
|
+
var version = "5.0.0-29741513.94de156f";
|
|
5009
5009
|
//#endregion
|
|
5010
5010
|
//#region src/core/utils/proxy.ts
|
|
5011
5011
|
async function installProxyDispatcher() {
|
|
@@ -5875,6 +5875,9 @@ var schema_default = defineNuxtModule({
|
|
|
5875
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.*")));
|
|
5876
5876
|
if (nuxt.options._prepare) await writeSchema(schema);
|
|
5877
5877
|
});
|
|
5878
|
+
nuxt.hook("nitro:prepare:types", (ctx) => {
|
|
5879
|
+
ctx.references.push({ path: resolve(nuxt.options.buildDir, "schema/nuxt.schema.d.ts") });
|
|
5880
|
+
});
|
|
5878
5881
|
let schema;
|
|
5879
5882
|
nuxt.hook("modules:done", async () => {
|
|
5880
5883
|
schema = await resolveSchema$1();
|
|
@@ -6497,7 +6500,7 @@ async function initNuxt(nuxt) {
|
|
|
6497
6500
|
opts.references.push({ types: "nuxt/app" });
|
|
6498
6501
|
opts.nodeReferences.push({ path: resolve(nuxt.options.buildDir, "types/modules.d.ts") });
|
|
6499
6502
|
opts.nodeReferences.push({ path: resolve(nuxt.options.buildDir, "types/runtime-config.d.ts") });
|
|
6500
|
-
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") });
|
|
6501
6504
|
opts.nodeReferences.push({ types: "nuxt" });
|
|
6502
6505
|
opts.nodeReferences.push({ path: resolveModulePath("@nuxt/vite-builder", { from: import.meta.url }).replace(".mjs", ".d.mts") });
|
|
6503
6506
|
if (typeof nuxt.options.builder === "string" && nuxt.options.builder !== "@nuxt/vite-builder") opts.nodeReferences.push({ types: nuxt.options.builder });
|
|
@@ -6508,7 +6511,7 @@ async function initNuxt(nuxt) {
|
|
|
6508
6511
|
if (nuxt.options.server.builder === "@nuxt/nitro-server") opts.sharedReferences.push(serverBuilderReference);
|
|
6509
6512
|
}
|
|
6510
6513
|
opts.sharedReferences.push({ path: resolve(nuxt.options.buildDir, "types/runtime-config.d.ts") });
|
|
6511
|
-
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") });
|
|
6512
6515
|
opts.sharedReferences.push({ path: resolve(nuxt.options.buildDir, "types/shared-imports.d.ts") });
|
|
6513
6516
|
paths ||= await resolveTypescriptPaths(nuxt);
|
|
6514
6517
|
opts.tsConfig.compilerOptions = defu(opts.tsConfig.compilerOptions, { paths: { ...paths } });
|
|
@@ -6525,7 +6528,7 @@ async function initNuxt(nuxt) {
|
|
|
6525
6528
|
}
|
|
6526
6529
|
});
|
|
6527
6530
|
nuxt.hook("nitro:prepare:types", (opts) => {
|
|
6528
|
-
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") });
|
|
6529
6532
|
opts.references.push({ path: resolve(nuxt.options.buildDir, "types/runtime-config.d.ts") });
|
|
6530
6533
|
const serverBuilderReference = getServerBuilderReference();
|
|
6531
6534
|
if (serverBuilderReference) opts.references.push(serverBuilderReference);
|
|
@@ -7037,6 +7040,7 @@ var templates_exports = /* @__PURE__ */ __exportAll({
|
|
|
7037
7040
|
schemaNodeTemplate: () => schemaNodeTemplate,
|
|
7038
7041
|
schemaTemplate: () => schemaTemplate,
|
|
7039
7042
|
serverPluginTemplate: () => serverPluginTemplate,
|
|
7043
|
+
sharedAppConfigDeclarationTemplate: () => sharedAppConfigDeclarationTemplate,
|
|
7040
7044
|
testComponentWrapperTemplate: () => testComponentWrapperTemplate,
|
|
7041
7045
|
vueShim: () => vueShim
|
|
7042
7046
|
});
|
|
@@ -7347,6 +7351,21 @@ const clientConfigTemplate = {
|
|
|
7347
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");
|
|
7348
7352
|
}
|
|
7349
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
|
+
}`;
|
|
7350
7369
|
const appConfigDeclarationTemplate = {
|
|
7351
7370
|
filename: "types/app.config.d.ts",
|
|
7352
7371
|
getContents({ app, nuxt }) {
|
|
@@ -7362,21 +7381,7 @@ declare global {
|
|
|
7362
7381
|
|
|
7363
7382
|
declare const inlineConfig = ${JSON.stringify(nuxt.options.appConfig, null, 2)}
|
|
7364
7383
|
type ResolvedAppConfig = Defu<typeof inlineConfig, [${app.configs.map((_id, index) => `typeof cfg${index}`).join(", ")}]>
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
type MergedAppConfig<Resolved extends Record<string, unknown>, Custom extends Record<string, unknown>> = {
|
|
7368
|
-
[K in keyof (Resolved & Custom)]: K extends keyof Custom
|
|
7369
|
-
? unknown extends Custom[K]
|
|
7370
|
-
? Resolved[K]
|
|
7371
|
-
: IsAny<Custom[K]> extends true
|
|
7372
|
-
? Resolved[K]
|
|
7373
|
-
: Custom[K] extends Record<string, any>
|
|
7374
|
-
? Resolved[K] extends Record<string, any>
|
|
7375
|
-
? MergedAppConfig<Resolved[K], Custom[K]>
|
|
7376
|
-
: Exclude<Custom[K], undefined>
|
|
7377
|
-
: Exclude<Custom[K], undefined>
|
|
7378
|
-
: Resolved[K]
|
|
7379
|
-
}
|
|
7384
|
+
${APP_CONFIG_MERGE_TYPES}
|
|
7380
7385
|
|
|
7381
7386
|
declare module 'nuxt/schema' {
|
|
7382
7387
|
interface AppConfig extends MergedAppConfig<ResolvedAppConfig, CustomAppConfig> { }
|
|
@@ -7387,6 +7392,24 @@ declare module '@nuxt/schema' {
|
|
|
7387
7392
|
`;
|
|
7388
7393
|
}
|
|
7389
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
|
+
};
|
|
7390
7413
|
const appConfigTemplate = {
|
|
7391
7414
|
filename: "app.config.mjs",
|
|
7392
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",
|