maquinaweb-ui 2.67.0 → 2.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.js +3 -5
- package/dist/actions.js.map +1 -1
- package/dist/container-animation/container-animation.d.ts +2 -2
- package/dist/container-animation/container-animation.d.ts.map +1 -1
- package/dist/date-field/DateField.d.ts +2 -2
- package/dist/date-hour-field/DateHourField.d.ts +2 -2
- package/dist/input-suggest/input-suggest.d.ts +2 -2
- package/dist/landing-text/client-landing-text.js +2 -3
- package/dist/landing-text/client-landing-text.js.map +1 -1
- package/dist/landing-text/landing-content.d.ts.map +1 -1
- package/dist/landing-text/landing-content.js +4 -1
- package/dist/landing-text/landing-content.js.map +1 -1
- package/dist/landing-text/landing-text.d.ts +2 -2
- package/dist/landing-text/server-landing-text.d.ts +2 -2
- package/dist/landing-text/server-landing-text.d.ts.map +1 -1
- package/dist/page-header/page-header.d.ts +2 -2
- package/dist/remote-selector/remote-selector.d.ts +3 -3
- package/dist/text-field/TextField.d.ts +5 -5
- package/dist/toggle-field/ToggleGroup.d.ts +2 -2
- package/package.json +1 -1
- package/dist/_virtual/rolldown_runtime.js +0 -31
- package/dist/node_modules/next/cache.js +0 -79
- package/dist/node_modules/next/cache.js.map +0 -1
- package/dist/node_modules/next/dist/build/output/log.js +0 -119
- package/dist/node_modules/next/dist/build/output/log.js.map +0 -1
- package/dist/node_modules/next/dist/client/components/app-router-headers.js +0 -119
- package/dist/node_modules/next/dist/client/components/app-router-headers.js.map +0 -1
- package/dist/node_modules/next/dist/client/components/hooks-server-context.js +0 -41
- package/dist/node_modules/next/dist/client/components/hooks-server-context.js.map +0 -1
- package/dist/node_modules/next/dist/client/components/static-generation-bailout.js +0 -41
- package/dist/node_modules/next/dist/client/components/static-generation-bailout.js.map +0 -1
- package/dist/node_modules/next/dist/compiled/@edge-runtime/cookies/index.js +0 -312
- package/dist/node_modules/next/dist/compiled/@edge-runtime/cookies/index.js.map +0 -1
- package/dist/node_modules/next/dist/compiled/@opentelemetry/api/index.js +0 -1286
- package/dist/node_modules/next/dist/compiled/@opentelemetry/api/index.js.map +0 -1
- package/dist/node_modules/next/dist/lib/batcher.js +0 -63
- package/dist/node_modules/next/dist/lib/batcher.js.map +0 -1
- package/dist/node_modules/next/dist/lib/constants.js +0 -325
- package/dist/node_modules/next/dist/lib/constants.js.map +0 -1
- package/dist/node_modules/next/dist/lib/detached-promise.js +0 -30
- package/dist/node_modules/next/dist/lib/detached-promise.js.map +0 -1
- package/dist/node_modules/next/dist/lib/framework/boundary-constants.js +0 -36
- package/dist/node_modules/next/dist/lib/framework/boundary-constants.js.map +0 -1
- package/dist/node_modules/next/dist/lib/picocolors.js +0 -141
- package/dist/node_modules/next/dist/lib/picocolors.js.map +0 -1
- package/dist/node_modules/next/dist/lib/scheduler.js +0 -49
- package/dist/node_modules/next/dist/lib/scheduler.js.map +0 -1
- package/dist/node_modules/next/dist/server/app-render/async-local-storage.js +0 -67
- package/dist/node_modules/next/dist/server/app-render/async-local-storage.js.map +0 -1
- package/dist/node_modules/next/dist/server/app-render/dynamic-rendering.js +0 -763
- package/dist/node_modules/next/dist/server/app-render/dynamic-rendering.js.map +0 -1
- package/dist/node_modules/next/dist/server/app-render/instant-validation/boundary-constants.js +0 -19
- package/dist/node_modules/next/dist/server/app-render/instant-validation/boundary-constants.js.map +0 -1
- package/dist/node_modules/next/dist/server/app-render/staged-rendering.js +0 -215
- package/dist/node_modules/next/dist/server/app-render/staged-rendering.js.map +0 -1
- package/dist/node_modules/next/dist/server/app-render/work-async-storage-instance.js +0 -20
- package/dist/node_modules/next/dist/server/app-render/work-async-storage-instance.js.map +0 -1
- package/dist/node_modules/next/dist/server/app-render/work-async-storage.external.js +0 -20
- package/dist/node_modules/next/dist/server/app-render/work-async-storage.external.js.map +0 -1
- package/dist/node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js +0 -20
- package/dist/node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js.map +0 -1
- package/dist/node_modules/next/dist/server/app-render/work-unit-async-storage.external.js +0 -214
- package/dist/node_modules/next/dist/server/app-render/work-unit-async-storage.external.js.map +0 -1
- package/dist/node_modules/next/dist/server/base-http/helpers.js +0 -36
- package/dist/node_modules/next/dist/server/base-http/helpers.js.map +0 -1
- package/dist/node_modules/next/dist/server/client-component-renderer-logger.js +0 -65
- package/dist/node_modules/next/dist/server/client-component-renderer-logger.js.map +0 -1
- package/dist/node_modules/next/dist/server/dynamic-rendering-utils.js +0 -85
- package/dist/node_modules/next/dist/server/dynamic-rendering-utils.js.map +0 -1
- package/dist/node_modules/next/dist/server/lib/clone-response.js +0 -55
- package/dist/node_modules/next/dist/server/lib/clone-response.js.map +0 -1
- package/dist/node_modules/next/dist/server/lib/dedupe-fetch.js +0 -106
- package/dist/node_modules/next/dist/server/lib/dedupe-fetch.js.map +0 -1
- package/dist/node_modules/next/dist/server/lib/lru-cache.js +0 -179
- package/dist/node_modules/next/dist/server/lib/lru-cache.js.map +0 -1
- package/dist/node_modules/next/dist/server/lib/patch-fetch.js +0 -703
- package/dist/node_modules/next/dist/server/lib/patch-fetch.js.map +0 -1
- package/dist/node_modules/next/dist/server/lib/trace/constants.js +0 -186
- package/dist/node_modules/next/dist/server/lib/trace/constants.js.map +0 -1
- package/dist/node_modules/next/dist/server/lib/trace/tracer.js +0 -229
- package/dist/node_modules/next/dist/server/lib/trace/tracer.js.map +0 -1
- package/dist/node_modules/next/dist/server/pipe-readable.js +0 -112
- package/dist/node_modules/next/dist/server/pipe-readable.js.map +0 -1
- package/dist/node_modules/next/dist/server/render-result.js +0 -156
- package/dist/node_modules/next/dist/server/render-result.js.map +0 -1
- package/dist/node_modules/next/dist/server/request-meta.js +0 -54
- package/dist/node_modules/next/dist/server/request-meta.js.map +0 -1
- package/dist/node_modules/next/dist/server/response-cache/index.js +0 -255
- package/dist/node_modules/next/dist/server/response-cache/index.js.map +0 -1
- package/dist/node_modules/next/dist/server/response-cache/types.js +0 -43
- package/dist/node_modules/next/dist/server/response-cache/types.js.map +0 -1
- package/dist/node_modules/next/dist/server/response-cache/utils.js +0 -100
- package/dist/node_modules/next/dist/server/response-cache/utils.js.map +0 -1
- package/dist/node_modules/next/dist/server/route-kind.js +0 -38
- package/dist/node_modules/next/dist/server/route-kind.js.map +0 -1
- package/dist/node_modules/next/dist/server/stream-utils/encoded-tags.js +0 -115
- package/dist/node_modules/next/dist/server/stream-utils/encoded-tags.js.map +0 -1
- package/dist/node_modules/next/dist/server/stream-utils/node-web-streams-helper.js +0 -635
- package/dist/node_modules/next/dist/server/stream-utils/node-web-streams-helper.js.map +0 -1
- package/dist/node_modules/next/dist/server/stream-utils/uint8array-helpers.js +0 -58
- package/dist/node_modules/next/dist/server/stream-utils/uint8array-helpers.js.map +0 -1
- package/dist/node_modules/next/dist/server/use-cache/cache-life.js +0 -140
- package/dist/node_modules/next/dist/server/use-cache/cache-life.js.map +0 -1
- package/dist/node_modules/next/dist/server/use-cache/cache-tag.js +0 -52
- package/dist/node_modules/next/dist/server/use-cache/cache-tag.js.map +0 -1
- package/dist/node_modules/next/dist/server/web/error.js +0 -55
- package/dist/node_modules/next/dist/server/web/error.js.map +0 -1
- package/dist/node_modules/next/dist/server/web/next-url.js +0 -203
- package/dist/node_modules/next/dist/server/web/next-url.js.map +0 -1
- package/dist/node_modules/next/dist/server/web/spec-extension/adapters/next-request.js +0 -103
- package/dist/node_modules/next/dist/server/web/spec-extension/adapters/next-request.js.map +0 -1
- package/dist/node_modules/next/dist/server/web/spec-extension/cookies.js +0 -31
- package/dist/node_modules/next/dist/server/web/spec-extension/cookies.js.map +0 -1
- package/dist/node_modules/next/dist/server/web/spec-extension/request.js +0 -98
- package/dist/node_modules/next/dist/server/web/spec-extension/request.js.map +0 -1
- package/dist/node_modules/next/dist/server/web/spec-extension/revalidate.js +0 -162
- package/dist/node_modules/next/dist/server/web/spec-extension/revalidate.js.map +0 -1
- package/dist/node_modules/next/dist/server/web/spec-extension/unstable-cache.js +0 -187
- package/dist/node_modules/next/dist/server/web/spec-extension/unstable-cache.js.map +0 -1
- package/dist/node_modules/next/dist/server/web/spec-extension/unstable-no-store.js +0 -49
- package/dist/node_modules/next/dist/server/web/spec-extension/unstable-no-store.js.map +0 -1
- package/dist/node_modules/next/dist/server/web/utils.js +0 -113
- package/dist/node_modules/next/dist/server/web/utils.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/action-revalidation-kind.js +0 -32
- package/dist/node_modules/next/dist/shared/lib/action-revalidation-kind.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/errors/constants.js +0 -24
- package/dist/node_modules/next/dist/shared/lib/errors/constants.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/get-hostname.js +0 -25
- package/dist/node_modules/next/dist/shared/lib/get-hostname.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/hash.js +0 -37
- package/dist/node_modules/next/dist/shared/lib/hash.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/i18n/detect-domain-locale.js +0 -23
- package/dist/node_modules/next/dist/shared/lib/i18n/detect-domain-locale.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/i18n/normalize-locale-path.js +0 -43
- package/dist/node_modules/next/dist/shared/lib/i18n/normalize-locale-path.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/invariant-error.js +0 -24
- package/dist/node_modules/next/dist/shared/lib/invariant-error.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/is-thenable.js +0 -21
- package/dist/node_modules/next/dist/shared/lib/is-thenable.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/lazy-dynamic/bailout-to-csr.js +0 -36
- package/dist/node_modules/next/dist/shared/lib/lazy-dynamic/bailout-to-csr.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/page-path/ensure-leading-slash.js +0 -21
- package/dist/node_modules/next/dist/shared/lib/page-path/ensure-leading-slash.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/promise-with-resolvers.js +0 -31
- package/dist/node_modules/next/dist/shared/lib/promise-with-resolvers.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/router/utils/add-locale.js +0 -31
- package/dist/node_modules/next/dist/shared/lib/router/utils/add-locale.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/router/utils/add-path-prefix.js +0 -25
- package/dist/node_modules/next/dist/shared/lib/router/utils/add-path-prefix.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/router/utils/add-path-suffix.js +0 -25
- package/dist/node_modules/next/dist/shared/lib/router/utils/add-path-suffix.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/router/utils/app-paths.js +0 -52
- package/dist/node_modules/next/dist/shared/lib/router/utils/app-paths.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/router/utils/cache-busting-search-param.js +0 -29
- package/dist/node_modules/next/dist/shared/lib/router/utils/cache-busting-search-param.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/router/utils/format-next-pathname-info.js +0 -33
- package/dist/node_modules/next/dist/shared/lib/router/utils/format-next-pathname-info.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/router/utils/get-next-pathname-info.js +0 -52
- package/dist/node_modules/next/dist/shared/lib/router/utils/get-next-pathname-info.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/router/utils/index.js +0 -33
- package/dist/node_modules/next/dist/shared/lib/router/utils/index.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/router/utils/interception-routes.js +0 -93
- package/dist/node_modules/next/dist/shared/lib/router/utils/interception-routes.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/router/utils/is-dynamic.js +0 -27
- package/dist/node_modules/next/dist/shared/lib/router/utils/is-dynamic.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/router/utils/parse-path.js +0 -33
- package/dist/node_modules/next/dist/shared/lib/router/utils/parse-path.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/router/utils/path-has-prefix.js +0 -25
- package/dist/node_modules/next/dist/shared/lib/router/utils/path-has-prefix.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/router/utils/remove-path-prefix.js +0 -26
- package/dist/node_modules/next/dist/shared/lib/router/utils/remove-path-prefix.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/router/utils/remove-trailing-slash.js +0 -21
- package/dist/node_modules/next/dist/shared/lib/router/utils/remove-trailing-slash.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/router/utils/sorted-routes.js +0 -168
- package/dist/node_modules/next/dist/shared/lib/router/utils/sorted-routes.js.map +0 -1
- package/dist/node_modules/next/dist/shared/lib/segment.js +0 -85
- package/dist/node_modules/next/dist/shared/lib/segment.js.map +0 -1
|
@@ -1,703 +0,0 @@
|
|
|
1
|
-
import { __commonJS } from "../../../../../_virtual/rolldown_runtime.js";
|
|
2
|
-
import { require_constants } from "../../lib/constants.js";
|
|
3
|
-
import { require_constants as require_constants$1 } from "./trace/constants.js";
|
|
4
|
-
import { require_tracer } from "./trace/tracer.js";
|
|
5
|
-
import { require_staged_rendering } from "../app-render/staged-rendering.js";
|
|
6
|
-
import { require_work_unit_async_storage_external } from "../app-render/work-unit-async-storage.external.js";
|
|
7
|
-
import { require_dynamic_rendering_utils } from "../dynamic-rendering-utils.js";
|
|
8
|
-
import { require_dynamic_rendering } from "../app-render/dynamic-rendering.js";
|
|
9
|
-
import { require_clone_response } from "./clone-response.js";
|
|
10
|
-
import { require_dedupe_fetch } from "./dedupe-fetch.js";
|
|
11
|
-
import { require_response_cache } from "../response-cache/index.js";
|
|
12
|
-
|
|
13
|
-
//#region node_modules/next/dist/server/lib/patch-fetch.js
|
|
14
|
-
var require_patch_fetch = /* @__PURE__ */ __commonJS({ "node_modules/next/dist/server/lib/patch-fetch.js": ((exports) => {
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
function _export(target, all) {
|
|
17
|
-
for (var name in all) Object.defineProperty(target, name, {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: all[name]
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
_export(exports, {
|
|
23
|
-
NEXT_PATCH_SYMBOL: function() {
|
|
24
|
-
return NEXT_PATCH_SYMBOL;
|
|
25
|
-
},
|
|
26
|
-
createPatchedFetcher: function() {
|
|
27
|
-
return createPatchedFetcher;
|
|
28
|
-
},
|
|
29
|
-
patchFetch: function() {
|
|
30
|
-
return patchFetch;
|
|
31
|
-
},
|
|
32
|
-
validateRevalidate: function() {
|
|
33
|
-
return validateRevalidate;
|
|
34
|
-
},
|
|
35
|
-
validateTags: function() {
|
|
36
|
-
return validateTags;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
const _constants = require_constants$1();
|
|
40
|
-
const _tracer = require_tracer();
|
|
41
|
-
const _constants1 = require_constants();
|
|
42
|
-
const _dynamicrendering = require_dynamic_rendering();
|
|
43
|
-
const _dynamicrenderingutils = require_dynamic_rendering_utils();
|
|
44
|
-
const _dedupefetch = require_dedupe_fetch();
|
|
45
|
-
const _workunitasyncstorageexternal = require_work_unit_async_storage_external();
|
|
46
|
-
const _responsecache = require_response_cache();
|
|
47
|
-
const _cloneresponse = require_clone_response();
|
|
48
|
-
const _stagedrendering = require_staged_rendering();
|
|
49
|
-
const isEdgeRuntime = process.env.NEXT_RUNTIME === "edge";
|
|
50
|
-
const NEXT_PATCH_SYMBOL = Symbol.for("next-patch");
|
|
51
|
-
function isFetchPatched() {
|
|
52
|
-
return globalThis[NEXT_PATCH_SYMBOL] === true;
|
|
53
|
-
}
|
|
54
|
-
function validateRevalidate(revalidateVal, route) {
|
|
55
|
-
try {
|
|
56
|
-
let normalizedRevalidate = void 0;
|
|
57
|
-
if (revalidateVal === false) normalizedRevalidate = _constants1.INFINITE_CACHE;
|
|
58
|
-
else if (typeof revalidateVal === "number" && !isNaN(revalidateVal) && revalidateVal > -1) normalizedRevalidate = revalidateVal;
|
|
59
|
-
else if (typeof revalidateVal !== "undefined") throw Object.defineProperty(/* @__PURE__ */ new Error(`Invalid revalidate value "${revalidateVal}" on "${route}", must be a non-negative number or false`), "__NEXT_ERROR_CODE", {
|
|
60
|
-
value: "E179",
|
|
61
|
-
enumerable: false,
|
|
62
|
-
configurable: true
|
|
63
|
-
});
|
|
64
|
-
return normalizedRevalidate;
|
|
65
|
-
} catch (err) {
|
|
66
|
-
if (err instanceof Error && err.message.includes("Invalid revalidate")) throw err;
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
function validateTags(tags, description) {
|
|
71
|
-
const validTags = [];
|
|
72
|
-
const invalidTags = [];
|
|
73
|
-
for (let i = 0; i < tags.length; i++) {
|
|
74
|
-
const tag = tags[i];
|
|
75
|
-
if (typeof tag !== "string") invalidTags.push({
|
|
76
|
-
tag,
|
|
77
|
-
reason: "invalid type, must be a string"
|
|
78
|
-
});
|
|
79
|
-
else if (tag.length > _constants1.NEXT_CACHE_TAG_MAX_LENGTH) invalidTags.push({
|
|
80
|
-
tag,
|
|
81
|
-
reason: `exceeded max length of ${_constants1.NEXT_CACHE_TAG_MAX_LENGTH}`
|
|
82
|
-
});
|
|
83
|
-
else validTags.push(tag);
|
|
84
|
-
if (validTags.length > _constants1.NEXT_CACHE_TAG_MAX_ITEMS) {
|
|
85
|
-
console.warn(`Warning: exceeded max tag count for ${description}, dropped tags:`, tags.slice(i).join(", "));
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
if (invalidTags.length > 0) {
|
|
90
|
-
console.warn(`Warning: invalid tags passed to ${description}: `);
|
|
91
|
-
for (const { tag, reason } of invalidTags) console.log(`tag: "${tag}" ${reason}`);
|
|
92
|
-
}
|
|
93
|
-
return validTags;
|
|
94
|
-
}
|
|
95
|
-
function trackFetchMetric(workStore, ctx) {
|
|
96
|
-
if (!workStore.shouldTrackFetchMetrics) return;
|
|
97
|
-
workStore.fetchMetrics ??= [];
|
|
98
|
-
workStore.fetchMetrics.push({
|
|
99
|
-
...ctx,
|
|
100
|
-
end: performance.timeOrigin + performance.now(),
|
|
101
|
-
idx: workStore.nextFetchId || 0
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
async function createCachedPrerenderResponse(res, cacheKey, incrementalCacheContext, incrementalCache, revalidate, handleUnlock) {
|
|
105
|
-
const bodyBuffer = await res.arrayBuffer();
|
|
106
|
-
const fetchedData = {
|
|
107
|
-
headers: Object.fromEntries(res.headers.entries()),
|
|
108
|
-
body: Buffer.from(bodyBuffer).toString("base64"),
|
|
109
|
-
status: res.status,
|
|
110
|
-
url: res.url
|
|
111
|
-
};
|
|
112
|
-
if (incrementalCacheContext) await incrementalCache.set(cacheKey, {
|
|
113
|
-
kind: _responsecache.CachedRouteKind.FETCH,
|
|
114
|
-
data: fetchedData,
|
|
115
|
-
revalidate
|
|
116
|
-
}, incrementalCacheContext);
|
|
117
|
-
await handleUnlock();
|
|
118
|
-
return new Response(bodyBuffer, {
|
|
119
|
-
headers: res.headers,
|
|
120
|
-
status: res.status,
|
|
121
|
-
statusText: res.statusText
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
async function createCachedDynamicResponse(workStore, res, cacheKey, incrementalCacheContext, incrementalCache, serverComponentsHmrCache, revalidate, input, handleUnlock, signal) {
|
|
125
|
-
const [cloned1, cloned2] = (0, _cloneresponse.cloneResponse)(res);
|
|
126
|
-
const cacheSetPromise = cloned1.arrayBuffer().then(async (arrayBuffer) => {
|
|
127
|
-
const bodyBuffer = Buffer.from(arrayBuffer);
|
|
128
|
-
const fetchedData = {
|
|
129
|
-
headers: Object.fromEntries(cloned1.headers.entries()),
|
|
130
|
-
body: bodyBuffer.toString("base64"),
|
|
131
|
-
status: cloned1.status,
|
|
132
|
-
url: cloned1.url
|
|
133
|
-
};
|
|
134
|
-
serverComponentsHmrCache?.set(cacheKey, fetchedData);
|
|
135
|
-
if (incrementalCacheContext) await incrementalCache.set(cacheKey, {
|
|
136
|
-
kind: _responsecache.CachedRouteKind.FETCH,
|
|
137
|
-
data: fetchedData,
|
|
138
|
-
revalidate
|
|
139
|
-
}, incrementalCacheContext);
|
|
140
|
-
}).catch((error) => {
|
|
141
|
-
if (!(signal == null ? void 0 : signal.aborted)) console.warn(`Failed to set fetch cache`, input, error);
|
|
142
|
-
}).finally(handleUnlock);
|
|
143
|
-
const pendingRevalidateKey = `cache-set-${cacheKey}`;
|
|
144
|
-
const pendingRevalidates = workStore.pendingRevalidates ??= {};
|
|
145
|
-
let pendingRevalidatePromise = Promise.resolve();
|
|
146
|
-
if (pendingRevalidateKey in pendingRevalidates) pendingRevalidatePromise = pendingRevalidates[pendingRevalidateKey];
|
|
147
|
-
pendingRevalidates[pendingRevalidateKey] = pendingRevalidatePromise.then(() => cacheSetPromise).finally(() => {
|
|
148
|
-
if (!(pendingRevalidates == null ? void 0 : pendingRevalidates[pendingRevalidateKey])) return;
|
|
149
|
-
delete pendingRevalidates[pendingRevalidateKey];
|
|
150
|
-
});
|
|
151
|
-
return cloned2;
|
|
152
|
-
}
|
|
153
|
-
function createPatchedFetcher(originFetch, { workAsyncStorage, workUnitAsyncStorage }) {
|
|
154
|
-
const patched = async function fetch(input, init) {
|
|
155
|
-
var _init_method, _init_next;
|
|
156
|
-
let url;
|
|
157
|
-
try {
|
|
158
|
-
url = new URL(input instanceof Request ? input.url : input);
|
|
159
|
-
url.username = "";
|
|
160
|
-
url.password = "";
|
|
161
|
-
} catch {
|
|
162
|
-
url = void 0;
|
|
163
|
-
}
|
|
164
|
-
const fetchUrl = (url == null ? void 0 : url.href) ?? "";
|
|
165
|
-
const method = (init == null ? void 0 : (_init_method = init.method) == null ? void 0 : _init_method.toUpperCase()) || "GET";
|
|
166
|
-
const isInternal = (init == null ? void 0 : (_init_next = init.next) == null ? void 0 : _init_next.internal) === true;
|
|
167
|
-
const hideSpan = process.env.NEXT_OTEL_FETCH_DISABLED === "1";
|
|
168
|
-
const fetchStart = isInternal ? void 0 : performance.timeOrigin + performance.now();
|
|
169
|
-
const workStore = workAsyncStorage.getStore();
|
|
170
|
-
const workUnitStore = workUnitAsyncStorage.getStore();
|
|
171
|
-
let cacheSignal = workUnitStore ? (0, _workunitasyncstorageexternal.getCacheSignal)(workUnitStore) : null;
|
|
172
|
-
if (cacheSignal) cacheSignal.beginRead();
|
|
173
|
-
const result = (0, _tracer.getTracer)().trace(isInternal ? _constants.NextNodeServerSpan.internalFetch : _constants.AppRenderSpan.fetch, {
|
|
174
|
-
hideSpan,
|
|
175
|
-
kind: _tracer.SpanKind.CLIENT,
|
|
176
|
-
spanName: [
|
|
177
|
-
"fetch",
|
|
178
|
-
method,
|
|
179
|
-
fetchUrl
|
|
180
|
-
].filter(Boolean).join(" "),
|
|
181
|
-
attributes: {
|
|
182
|
-
"http.url": fetchUrl,
|
|
183
|
-
"http.method": method,
|
|
184
|
-
"net.peer.name": url == null ? void 0 : url.hostname,
|
|
185
|
-
"net.peer.port": (url == null ? void 0 : url.port) || void 0
|
|
186
|
-
}
|
|
187
|
-
}, async () => {
|
|
188
|
-
var _getRequestMeta;
|
|
189
|
-
if (isInternal) return originFetch(input, init);
|
|
190
|
-
if (!workStore) return originFetch(input, init);
|
|
191
|
-
if (workStore.isDraftMode) return originFetch(input, init);
|
|
192
|
-
const isRequestInput = input && typeof input === "object" && typeof input.method === "string";
|
|
193
|
-
const getRequestMeta = (field) => {
|
|
194
|
-
return (init == null ? void 0 : init[field]) || (isRequestInput ? input[field] : null);
|
|
195
|
-
};
|
|
196
|
-
let finalRevalidate = void 0;
|
|
197
|
-
const getNextField = (field) => {
|
|
198
|
-
var _init_next$1, _init_next1, _input_next;
|
|
199
|
-
return typeof (init == null ? void 0 : (_init_next$1 = init.next) == null ? void 0 : _init_next$1[field]) !== "undefined" ? init == null ? void 0 : (_init_next1 = init.next) == null ? void 0 : _init_next1[field] : isRequestInput ? (_input_next = input.next) == null ? void 0 : _input_next[field] : void 0;
|
|
200
|
-
};
|
|
201
|
-
const originalFetchRevalidate = getNextField("revalidate");
|
|
202
|
-
let currentFetchRevalidate = originalFetchRevalidate;
|
|
203
|
-
const tags = validateTags(getNextField("tags") || [], `fetch ${input.toString()}`);
|
|
204
|
-
let revalidateStore;
|
|
205
|
-
if (workUnitStore) switch (workUnitStore.type) {
|
|
206
|
-
case "prerender":
|
|
207
|
-
case "prerender-runtime":
|
|
208
|
-
case "prerender-client":
|
|
209
|
-
case "validation-client":
|
|
210
|
-
case "prerender-ppr":
|
|
211
|
-
case "prerender-legacy":
|
|
212
|
-
case "cache":
|
|
213
|
-
case "private-cache":
|
|
214
|
-
revalidateStore = workUnitStore;
|
|
215
|
-
break;
|
|
216
|
-
case "request":
|
|
217
|
-
case "unstable-cache":
|
|
218
|
-
case "generate-static-params": break;
|
|
219
|
-
default:
|
|
220
|
-
}
|
|
221
|
-
if (revalidateStore) {
|
|
222
|
-
if (Array.isArray(tags)) {
|
|
223
|
-
const collectedTags = revalidateStore.tags ?? (revalidateStore.tags = []);
|
|
224
|
-
for (const tag of tags) if (!collectedTags.includes(tag)) collectedTags.push(tag);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
const implicitTags = workUnitStore == null ? void 0 : workUnitStore.implicitTags;
|
|
228
|
-
let pageFetchCacheMode = workStore.fetchCache;
|
|
229
|
-
if (workUnitStore) switch (workUnitStore.type) {
|
|
230
|
-
case "unstable-cache":
|
|
231
|
-
pageFetchCacheMode = "force-no-store";
|
|
232
|
-
break;
|
|
233
|
-
case "prerender":
|
|
234
|
-
case "prerender-client":
|
|
235
|
-
case "validation-client":
|
|
236
|
-
case "prerender-runtime":
|
|
237
|
-
case "prerender-ppr":
|
|
238
|
-
case "prerender-legacy":
|
|
239
|
-
case "request":
|
|
240
|
-
case "cache":
|
|
241
|
-
case "private-cache":
|
|
242
|
-
case "generate-static-params": break;
|
|
243
|
-
default:
|
|
244
|
-
}
|
|
245
|
-
const isUsingNoStore = !!workStore.isUnstableNoStore;
|
|
246
|
-
let currentFetchCacheConfig = getRequestMeta("cache");
|
|
247
|
-
let cacheReason = "";
|
|
248
|
-
let cacheWarning;
|
|
249
|
-
if (typeof currentFetchCacheConfig === "string" && typeof currentFetchRevalidate !== "undefined") {
|
|
250
|
-
if (currentFetchCacheConfig === "force-cache" && currentFetchRevalidate === 0 || currentFetchCacheConfig === "no-store" && (currentFetchRevalidate > 0 || currentFetchRevalidate === false)) {
|
|
251
|
-
cacheWarning = `Specified "cache: ${currentFetchCacheConfig}" and "revalidate: ${currentFetchRevalidate}", only one should be specified.`;
|
|
252
|
-
currentFetchCacheConfig = void 0;
|
|
253
|
-
currentFetchRevalidate = void 0;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
const hasExplicitFetchCacheOptOut = currentFetchCacheConfig === "no-cache" || currentFetchCacheConfig === "no-store" || pageFetchCacheMode === "force-no-store" || pageFetchCacheMode === "only-no-store";
|
|
257
|
-
const noFetchConfigAndForceDynamic = !pageFetchCacheMode && !currentFetchCacheConfig && !currentFetchRevalidate && workStore.forceDynamic;
|
|
258
|
-
if (currentFetchCacheConfig === "force-cache" && typeof currentFetchRevalidate === "undefined") currentFetchRevalidate = false;
|
|
259
|
-
else if (hasExplicitFetchCacheOptOut || noFetchConfigAndForceDynamic) currentFetchRevalidate = 0;
|
|
260
|
-
if (currentFetchCacheConfig === "no-cache" || currentFetchCacheConfig === "no-store") cacheReason = `cache: ${currentFetchCacheConfig}`;
|
|
261
|
-
finalRevalidate = validateRevalidate(currentFetchRevalidate, workStore.route);
|
|
262
|
-
const _headers = getRequestMeta("headers");
|
|
263
|
-
const initHeaders = typeof (_headers == null ? void 0 : _headers.get) === "function" ? _headers : new Headers(_headers || {});
|
|
264
|
-
const hasUnCacheableHeader = initHeaders.get("authorization") || initHeaders.get("cookie");
|
|
265
|
-
const isUnCacheableMethod = !["get", "head"].includes(((_getRequestMeta = getRequestMeta("method")) == null ? void 0 : _getRequestMeta.toLowerCase()) || "get");
|
|
266
|
-
/**
|
|
267
|
-
* We automatically disable fetch caching under the following conditions:
|
|
268
|
-
* - Fetch cache configs are not set. Specifically:
|
|
269
|
-
* - A page fetch cache mode is not set (export const fetchCache=...)
|
|
270
|
-
* - A fetch cache mode is not set in the fetch call (fetch(url, { cache: ... }))
|
|
271
|
-
* or the fetch cache mode is set to 'default'
|
|
272
|
-
* - A fetch revalidate value is not set in the fetch call (fetch(url, { revalidate: ... }))
|
|
273
|
-
* - OR the fetch comes after a configuration that triggered dynamic rendering (e.g., reading cookies())
|
|
274
|
-
* and the fetch was considered uncacheable (e.g., POST method or has authorization headers)
|
|
275
|
-
*/ const hasNoExplicitCacheConfig = pageFetchCacheMode == void 0 && (currentFetchCacheConfig == void 0 || currentFetchCacheConfig === "default") && currentFetchRevalidate == void 0;
|
|
276
|
-
let autoNoCache = Boolean((hasUnCacheableHeader || isUnCacheableMethod) && (revalidateStore == null ? void 0 : revalidateStore.revalidate) === 0);
|
|
277
|
-
let isImplicitBuildTimeCache = false;
|
|
278
|
-
if (!autoNoCache && hasNoExplicitCacheConfig) if (workStore.isBuildTimePrerendering) isImplicitBuildTimeCache = true;
|
|
279
|
-
else autoNoCache = true;
|
|
280
|
-
if (hasNoExplicitCacheConfig && workUnitStore !== void 0) switch (workUnitStore.type) {
|
|
281
|
-
case "prerender":
|
|
282
|
-
case "prerender-runtime":
|
|
283
|
-
case "prerender-client":
|
|
284
|
-
if (cacheSignal) {
|
|
285
|
-
cacheSignal.endRead();
|
|
286
|
-
cacheSignal = null;
|
|
287
|
-
}
|
|
288
|
-
return (0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, workStore.route, "fetch()");
|
|
289
|
-
case "validation-client": break;
|
|
290
|
-
case "request":
|
|
291
|
-
if (process.env.NODE_ENV === "development" && workUnitStore.stagedRendering) {
|
|
292
|
-
if (cacheSignal) {
|
|
293
|
-
cacheSignal.endRead();
|
|
294
|
-
cacheSignal = null;
|
|
295
|
-
}
|
|
296
|
-
await workUnitStore.stagedRendering.waitForStage(_stagedrendering.RenderStage.Dynamic);
|
|
297
|
-
}
|
|
298
|
-
break;
|
|
299
|
-
case "prerender-ppr":
|
|
300
|
-
case "prerender-legacy":
|
|
301
|
-
case "cache":
|
|
302
|
-
case "private-cache":
|
|
303
|
-
case "unstable-cache":
|
|
304
|
-
case "generate-static-params": break;
|
|
305
|
-
default:
|
|
306
|
-
}
|
|
307
|
-
switch (pageFetchCacheMode) {
|
|
308
|
-
case "force-no-store":
|
|
309
|
-
cacheReason = "fetchCache = force-no-store";
|
|
310
|
-
break;
|
|
311
|
-
case "only-no-store":
|
|
312
|
-
if (currentFetchCacheConfig === "force-cache" || typeof finalRevalidate !== "undefined" && finalRevalidate > 0) throw Object.defineProperty(/* @__PURE__ */ new Error(`cache: 'force-cache' used on fetch for ${fetchUrl} with 'export const fetchCache = 'only-no-store'`), "__NEXT_ERROR_CODE", {
|
|
313
|
-
value: "E448",
|
|
314
|
-
enumerable: false,
|
|
315
|
-
configurable: true
|
|
316
|
-
});
|
|
317
|
-
cacheReason = "fetchCache = only-no-store";
|
|
318
|
-
break;
|
|
319
|
-
case "only-cache":
|
|
320
|
-
if (currentFetchCacheConfig === "no-store") throw Object.defineProperty(/* @__PURE__ */ new Error(`cache: 'no-store' used on fetch for ${fetchUrl} with 'export const fetchCache = 'only-cache'`), "__NEXT_ERROR_CODE", {
|
|
321
|
-
value: "E521",
|
|
322
|
-
enumerable: false,
|
|
323
|
-
configurable: true
|
|
324
|
-
});
|
|
325
|
-
break;
|
|
326
|
-
case "force-cache":
|
|
327
|
-
if (typeof currentFetchRevalidate === "undefined" || currentFetchRevalidate === 0) {
|
|
328
|
-
cacheReason = "fetchCache = force-cache";
|
|
329
|
-
finalRevalidate = _constants1.INFINITE_CACHE;
|
|
330
|
-
}
|
|
331
|
-
break;
|
|
332
|
-
case "default-cache":
|
|
333
|
-
case "default-no-store":
|
|
334
|
-
case "auto":
|
|
335
|
-
case void 0: break;
|
|
336
|
-
default:
|
|
337
|
-
}
|
|
338
|
-
if (typeof finalRevalidate === "undefined") if (pageFetchCacheMode === "default-cache" && !isUsingNoStore) {
|
|
339
|
-
finalRevalidate = _constants1.INFINITE_CACHE;
|
|
340
|
-
cacheReason = "fetchCache = default-cache";
|
|
341
|
-
} else if (pageFetchCacheMode === "default-no-store") {
|
|
342
|
-
finalRevalidate = 0;
|
|
343
|
-
cacheReason = "fetchCache = default-no-store";
|
|
344
|
-
} else if (isUsingNoStore) {
|
|
345
|
-
finalRevalidate = 0;
|
|
346
|
-
cacheReason = "noStore call";
|
|
347
|
-
} else if (autoNoCache) {
|
|
348
|
-
finalRevalidate = 0;
|
|
349
|
-
cacheReason = "auto no cache";
|
|
350
|
-
} else {
|
|
351
|
-
cacheReason = "auto cache";
|
|
352
|
-
finalRevalidate = revalidateStore ? revalidateStore.revalidate : _constants1.INFINITE_CACHE;
|
|
353
|
-
}
|
|
354
|
-
else if (!cacheReason) cacheReason = `revalidate: ${finalRevalidate}`;
|
|
355
|
-
if (!(workStore.forceStatic && finalRevalidate === 0) && !autoNoCache && revalidateStore && finalRevalidate < revalidateStore.revalidate) {
|
|
356
|
-
if (finalRevalidate === 0) {
|
|
357
|
-
if (workUnitStore) switch (workUnitStore.type) {
|
|
358
|
-
case "prerender":
|
|
359
|
-
case "prerender-client":
|
|
360
|
-
case "prerender-runtime":
|
|
361
|
-
case "validation-client":
|
|
362
|
-
if (cacheSignal) {
|
|
363
|
-
cacheSignal.endRead();
|
|
364
|
-
cacheSignal = null;
|
|
365
|
-
}
|
|
366
|
-
return (0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, workStore.route, "fetch()");
|
|
367
|
-
case "request":
|
|
368
|
-
if (process.env.NODE_ENV === "development" && workUnitStore.stagedRendering) {
|
|
369
|
-
if (cacheSignal) {
|
|
370
|
-
cacheSignal.endRead();
|
|
371
|
-
cacheSignal = null;
|
|
372
|
-
}
|
|
373
|
-
await workUnitStore.stagedRendering.waitForStage(_stagedrendering.RenderStage.Dynamic);
|
|
374
|
-
}
|
|
375
|
-
break;
|
|
376
|
-
case "prerender-ppr":
|
|
377
|
-
case "prerender-legacy":
|
|
378
|
-
case "cache":
|
|
379
|
-
case "private-cache":
|
|
380
|
-
case "unstable-cache":
|
|
381
|
-
case "generate-static-params": break;
|
|
382
|
-
default:
|
|
383
|
-
}
|
|
384
|
-
(0, _dynamicrendering.markCurrentScopeAsDynamic)(workStore, workUnitStore, `revalidate: 0 fetch ${input} ${workStore.route}`);
|
|
385
|
-
}
|
|
386
|
-
if (revalidateStore && originalFetchRevalidate === finalRevalidate) revalidateStore.revalidate = finalRevalidate;
|
|
387
|
-
}
|
|
388
|
-
const isCacheableRevalidate = typeof finalRevalidate === "number" && finalRevalidate > 0;
|
|
389
|
-
let cacheKey;
|
|
390
|
-
const { incrementalCache } = workStore;
|
|
391
|
-
let isHmrRefresh = false;
|
|
392
|
-
let serverComponentsHmrCache;
|
|
393
|
-
if (workUnitStore) switch (workUnitStore.type) {
|
|
394
|
-
case "request":
|
|
395
|
-
case "cache":
|
|
396
|
-
case "private-cache":
|
|
397
|
-
isHmrRefresh = workUnitStore.isHmrRefresh ?? false;
|
|
398
|
-
serverComponentsHmrCache = workUnitStore.serverComponentsHmrCache;
|
|
399
|
-
break;
|
|
400
|
-
case "prerender":
|
|
401
|
-
case "prerender-client":
|
|
402
|
-
case "validation-client":
|
|
403
|
-
case "prerender-runtime":
|
|
404
|
-
case "prerender-ppr":
|
|
405
|
-
case "prerender-legacy":
|
|
406
|
-
case "unstable-cache":
|
|
407
|
-
case "generate-static-params": break;
|
|
408
|
-
default:
|
|
409
|
-
}
|
|
410
|
-
if (incrementalCache && (isCacheableRevalidate || serverComponentsHmrCache)) try {
|
|
411
|
-
cacheKey = await incrementalCache.generateCacheKey(fetchUrl, isRequestInput ? input : init);
|
|
412
|
-
} catch (err) {
|
|
413
|
-
console.error(`Failed to generate cache key for`, input);
|
|
414
|
-
}
|
|
415
|
-
const fetchIdx = workStore.nextFetchId ?? 1;
|
|
416
|
-
workStore.nextFetchId = fetchIdx + 1;
|
|
417
|
-
let handleUnlock = () => {};
|
|
418
|
-
const doOriginalFetch = async (isStale, cacheReasonOverride$1) => {
|
|
419
|
-
const requestInputFields = [
|
|
420
|
-
"cache",
|
|
421
|
-
"credentials",
|
|
422
|
-
"headers",
|
|
423
|
-
"integrity",
|
|
424
|
-
"keepalive",
|
|
425
|
-
"method",
|
|
426
|
-
"mode",
|
|
427
|
-
"redirect",
|
|
428
|
-
"referrer",
|
|
429
|
-
"referrerPolicy",
|
|
430
|
-
"window",
|
|
431
|
-
"duplex",
|
|
432
|
-
...isStale ? [] : ["signal"]
|
|
433
|
-
];
|
|
434
|
-
if (isRequestInput) {
|
|
435
|
-
const reqInput = input;
|
|
436
|
-
const reqOptions = { body: reqInput._ogBody || reqInput.body };
|
|
437
|
-
for (const field of requestInputFields) reqOptions[field] = reqInput[field];
|
|
438
|
-
input = new Request(reqInput.url, reqOptions);
|
|
439
|
-
} else if (init) {
|
|
440
|
-
const { _ogBody, body, signal,...otherInput } = init;
|
|
441
|
-
init = {
|
|
442
|
-
...otherInput,
|
|
443
|
-
body: _ogBody || body,
|
|
444
|
-
signal: isStale ? void 0 : signal
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
const clonedInit = {
|
|
448
|
-
...init,
|
|
449
|
-
next: {
|
|
450
|
-
...init == null ? void 0 : init.next,
|
|
451
|
-
fetchType: "origin",
|
|
452
|
-
fetchIdx
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
return originFetch(input, clonedInit).then(async (res) => {
|
|
456
|
-
if (!isStale && fetchStart) trackFetchMetric(workStore, {
|
|
457
|
-
start: fetchStart,
|
|
458
|
-
url: fetchUrl,
|
|
459
|
-
cacheReason: cacheReasonOverride$1 || cacheReason,
|
|
460
|
-
cacheStatus: finalRevalidate === 0 || cacheReasonOverride$1 ? "skip" : "miss",
|
|
461
|
-
cacheWarning,
|
|
462
|
-
status: res.status,
|
|
463
|
-
method: clonedInit.method || "GET"
|
|
464
|
-
});
|
|
465
|
-
if (res.status === 200 && incrementalCache && cacheKey && (isCacheableRevalidate || serverComponentsHmrCache)) {
|
|
466
|
-
const normalizedRevalidate = finalRevalidate >= _constants1.INFINITE_CACHE ? _constants1.CACHE_ONE_YEAR_SECONDS : finalRevalidate;
|
|
467
|
-
const incrementalCacheConfig = isCacheableRevalidate ? {
|
|
468
|
-
fetchCache: true,
|
|
469
|
-
fetchUrl,
|
|
470
|
-
fetchIdx,
|
|
471
|
-
tags,
|
|
472
|
-
isImplicitBuildTimeCache
|
|
473
|
-
} : void 0;
|
|
474
|
-
switch (workUnitStore == null ? void 0 : workUnitStore.type) {
|
|
475
|
-
case "prerender":
|
|
476
|
-
case "prerender-client":
|
|
477
|
-
case "validation-client":
|
|
478
|
-
case "prerender-runtime": return createCachedPrerenderResponse(res, cacheKey, incrementalCacheConfig, incrementalCache, normalizedRevalidate, handleUnlock);
|
|
479
|
-
case "request": if (process.env.NODE_ENV === "development" && workUnitStore.stagedRendering && workUnitStore.cacheSignal && isCacheableRevalidate) return createCachedPrerenderResponse(res, cacheKey, incrementalCacheConfig, incrementalCache, normalizedRevalidate, handleUnlock);
|
|
480
|
-
case "prerender-ppr":
|
|
481
|
-
case "prerender-legacy":
|
|
482
|
-
case "cache":
|
|
483
|
-
case "private-cache":
|
|
484
|
-
case "unstable-cache":
|
|
485
|
-
case "generate-static-params":
|
|
486
|
-
case void 0: return createCachedDynamicResponse(workStore, res, cacheKey, incrementalCacheConfig, incrementalCache, serverComponentsHmrCache, normalizedRevalidate, input, handleUnlock, getRequestMeta("signal"));
|
|
487
|
-
default:
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
await handleUnlock();
|
|
491
|
-
return res;
|
|
492
|
-
}).catch((error) => {
|
|
493
|
-
handleUnlock();
|
|
494
|
-
throw error;
|
|
495
|
-
});
|
|
496
|
-
};
|
|
497
|
-
let cacheReasonOverride;
|
|
498
|
-
let isForegroundRevalidate = false;
|
|
499
|
-
let isHmrRefreshCache = false;
|
|
500
|
-
if (cacheKey && incrementalCache) {
|
|
501
|
-
let cachedFetchData;
|
|
502
|
-
if (isHmrRefresh && serverComponentsHmrCache) {
|
|
503
|
-
cachedFetchData = serverComponentsHmrCache.get(cacheKey);
|
|
504
|
-
isHmrRefreshCache = true;
|
|
505
|
-
}
|
|
506
|
-
if (isCacheableRevalidate && !cachedFetchData) {
|
|
507
|
-
handleUnlock = await incrementalCache.lock(cacheKey);
|
|
508
|
-
const entry = workStore.isOnDemandRevalidate ? null : await incrementalCache.get(cacheKey, {
|
|
509
|
-
kind: _responsecache.IncrementalCacheKind.FETCH,
|
|
510
|
-
revalidate: finalRevalidate,
|
|
511
|
-
fetchUrl,
|
|
512
|
-
fetchIdx,
|
|
513
|
-
tags,
|
|
514
|
-
softTags: implicitTags == null ? void 0 : implicitTags.tags
|
|
515
|
-
});
|
|
516
|
-
if (hasNoExplicitCacheConfig && workUnitStore) switch (workUnitStore.type) {
|
|
517
|
-
case "prerender":
|
|
518
|
-
case "prerender-client":
|
|
519
|
-
case "validation-client":
|
|
520
|
-
case "prerender-runtime":
|
|
521
|
-
await getTimeoutBoundary();
|
|
522
|
-
break;
|
|
523
|
-
case "request":
|
|
524
|
-
if (process.env.NODE_ENV === "development" && workUnitStore.stagedRendering) await workUnitStore.stagedRendering.waitForStage(_stagedrendering.RenderStage.Dynamic);
|
|
525
|
-
break;
|
|
526
|
-
case "prerender-ppr":
|
|
527
|
-
case "prerender-legacy":
|
|
528
|
-
case "cache":
|
|
529
|
-
case "private-cache":
|
|
530
|
-
case "unstable-cache":
|
|
531
|
-
case "generate-static-params": break;
|
|
532
|
-
default:
|
|
533
|
-
}
|
|
534
|
-
if (entry) await handleUnlock();
|
|
535
|
-
else cacheReasonOverride = "cache-control: no-cache (hard refresh)";
|
|
536
|
-
if ((entry == null ? void 0 : entry.value) && entry.value.kind === _responsecache.CachedRouteKind.FETCH) if (workStore.isStaticGeneration && entry.isStale) isForegroundRevalidate = true;
|
|
537
|
-
else {
|
|
538
|
-
if (entry.isStale) {
|
|
539
|
-
workStore.pendingRevalidates ??= {};
|
|
540
|
-
if (!workStore.pendingRevalidates[cacheKey]) {
|
|
541
|
-
const pendingRevalidate = doOriginalFetch(true).then(async (response) => ({
|
|
542
|
-
body: await response.arrayBuffer(),
|
|
543
|
-
headers: response.headers,
|
|
544
|
-
status: response.status,
|
|
545
|
-
statusText: response.statusText
|
|
546
|
-
})).finally(() => {
|
|
547
|
-
workStore.pendingRevalidates ??= {};
|
|
548
|
-
delete workStore.pendingRevalidates[cacheKey || ""];
|
|
549
|
-
});
|
|
550
|
-
pendingRevalidate.catch(console.error);
|
|
551
|
-
workStore.pendingRevalidates[cacheKey] = pendingRevalidate;
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
cachedFetchData = entry.value.data;
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
if (cachedFetchData) {
|
|
558
|
-
if (fetchStart) trackFetchMetric(workStore, {
|
|
559
|
-
start: fetchStart,
|
|
560
|
-
url: fetchUrl,
|
|
561
|
-
cacheReason,
|
|
562
|
-
cacheStatus: isHmrRefreshCache ? "hmr" : "hit",
|
|
563
|
-
cacheWarning,
|
|
564
|
-
status: cachedFetchData.status || 200,
|
|
565
|
-
method: (init == null ? void 0 : init.method) || "GET"
|
|
566
|
-
});
|
|
567
|
-
const response = new Response(Buffer.from(cachedFetchData.body, "base64"), {
|
|
568
|
-
headers: cachedFetchData.headers,
|
|
569
|
-
status: cachedFetchData.status
|
|
570
|
-
});
|
|
571
|
-
Object.defineProperty(response, "url", { value: cachedFetchData.url });
|
|
572
|
-
return response;
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
if ((workStore.isStaticGeneration || process.env.NODE_ENV === "development" && process.env.__NEXT_CACHE_COMPONENTS && workUnitStore && workUnitStore.type === "request" && workUnitStore.stagedRendering) && init && typeof init === "object") {
|
|
576
|
-
const { cache } = init;
|
|
577
|
-
if (isEdgeRuntime) delete init.cache;
|
|
578
|
-
if (cache === "no-store") {
|
|
579
|
-
if (workUnitStore) switch (workUnitStore.type) {
|
|
580
|
-
case "prerender":
|
|
581
|
-
case "prerender-client":
|
|
582
|
-
case "prerender-runtime":
|
|
583
|
-
case "validation-client":
|
|
584
|
-
if (cacheSignal) {
|
|
585
|
-
cacheSignal.endRead();
|
|
586
|
-
cacheSignal = null;
|
|
587
|
-
}
|
|
588
|
-
return (0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, workStore.route, "fetch()");
|
|
589
|
-
case "request":
|
|
590
|
-
if (process.env.NODE_ENV === "development" && workUnitStore.stagedRendering) {
|
|
591
|
-
if (cacheSignal) {
|
|
592
|
-
cacheSignal.endRead();
|
|
593
|
-
cacheSignal = null;
|
|
594
|
-
}
|
|
595
|
-
await workUnitStore.stagedRendering.waitForStage(_stagedrendering.RenderStage.Dynamic);
|
|
596
|
-
}
|
|
597
|
-
break;
|
|
598
|
-
case "prerender-ppr":
|
|
599
|
-
case "prerender-legacy":
|
|
600
|
-
case "cache":
|
|
601
|
-
case "private-cache":
|
|
602
|
-
case "unstable-cache":
|
|
603
|
-
case "generate-static-params": break;
|
|
604
|
-
default:
|
|
605
|
-
}
|
|
606
|
-
(0, _dynamicrendering.markCurrentScopeAsDynamic)(workStore, workUnitStore, `no-store fetch ${input} ${workStore.route}`);
|
|
607
|
-
}
|
|
608
|
-
const hasNextConfig = "next" in init;
|
|
609
|
-
const { next = {} } = init;
|
|
610
|
-
if (typeof next.revalidate === "number" && revalidateStore && next.revalidate < revalidateStore.revalidate) {
|
|
611
|
-
if (next.revalidate === 0) {
|
|
612
|
-
if (workUnitStore) switch (workUnitStore.type) {
|
|
613
|
-
case "prerender":
|
|
614
|
-
case "prerender-client":
|
|
615
|
-
case "prerender-runtime":
|
|
616
|
-
case "validation-client": return (0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, workStore.route, "fetch()");
|
|
617
|
-
case "request":
|
|
618
|
-
if (process.env.NODE_ENV === "development" && workUnitStore.stagedRendering) await workUnitStore.stagedRendering.waitForStage(_stagedrendering.RenderStage.Dynamic);
|
|
619
|
-
break;
|
|
620
|
-
case "cache":
|
|
621
|
-
case "private-cache":
|
|
622
|
-
case "unstable-cache":
|
|
623
|
-
case "prerender-legacy":
|
|
624
|
-
case "prerender-ppr":
|
|
625
|
-
case "generate-static-params": break;
|
|
626
|
-
default:
|
|
627
|
-
}
|
|
628
|
-
(0, _dynamicrendering.markCurrentScopeAsDynamic)(workStore, workUnitStore, `revalidate: 0 fetch ${input} ${workStore.route}`);
|
|
629
|
-
}
|
|
630
|
-
if (!workStore.forceStatic || next.revalidate !== 0) revalidateStore.revalidate = next.revalidate;
|
|
631
|
-
}
|
|
632
|
-
if (hasNextConfig) delete init.next;
|
|
633
|
-
}
|
|
634
|
-
if (cacheKey && isForegroundRevalidate) {
|
|
635
|
-
const pendingRevalidateKey = cacheKey;
|
|
636
|
-
workStore.pendingRevalidates ??= {};
|
|
637
|
-
let pendingRevalidate = workStore.pendingRevalidates[pendingRevalidateKey];
|
|
638
|
-
if (pendingRevalidate) {
|
|
639
|
-
const revalidatedResult = await pendingRevalidate;
|
|
640
|
-
return new Response(revalidatedResult.body, {
|
|
641
|
-
headers: revalidatedResult.headers,
|
|
642
|
-
status: revalidatedResult.status,
|
|
643
|
-
statusText: revalidatedResult.statusText
|
|
644
|
-
});
|
|
645
|
-
}
|
|
646
|
-
const pendingResponse = doOriginalFetch(true, cacheReasonOverride).then(_cloneresponse.cloneResponse);
|
|
647
|
-
pendingRevalidate = pendingResponse.then(async (responses) => {
|
|
648
|
-
const response = responses[0];
|
|
649
|
-
return {
|
|
650
|
-
body: await response.arrayBuffer(),
|
|
651
|
-
headers: response.headers,
|
|
652
|
-
status: response.status,
|
|
653
|
-
statusText: response.statusText
|
|
654
|
-
};
|
|
655
|
-
}).finally(() => {
|
|
656
|
-
var _workStore_pendingRevalidates;
|
|
657
|
-
if (!((_workStore_pendingRevalidates = workStore.pendingRevalidates) == null ? void 0 : _workStore_pendingRevalidates[pendingRevalidateKey])) return;
|
|
658
|
-
delete workStore.pendingRevalidates[pendingRevalidateKey];
|
|
659
|
-
});
|
|
660
|
-
pendingRevalidate.catch(() => {});
|
|
661
|
-
workStore.pendingRevalidates[pendingRevalidateKey] = pendingRevalidate;
|
|
662
|
-
return pendingResponse.then((responses) => responses[1]);
|
|
663
|
-
} else return doOriginalFetch(false, cacheReasonOverride);
|
|
664
|
-
});
|
|
665
|
-
if (cacheSignal) try {
|
|
666
|
-
return await result;
|
|
667
|
-
} finally {
|
|
668
|
-
if (cacheSignal) cacheSignal.endRead();
|
|
669
|
-
}
|
|
670
|
-
return result;
|
|
671
|
-
};
|
|
672
|
-
patched.__nextPatched = true;
|
|
673
|
-
patched.__nextGetStaticStore = () => workAsyncStorage;
|
|
674
|
-
patched._nextOriginalFetch = originFetch;
|
|
675
|
-
globalThis[NEXT_PATCH_SYMBOL] = true;
|
|
676
|
-
Object.defineProperty(patched, "name", {
|
|
677
|
-
value: "fetch",
|
|
678
|
-
writable: false
|
|
679
|
-
});
|
|
680
|
-
return patched;
|
|
681
|
-
}
|
|
682
|
-
function patchFetch(options) {
|
|
683
|
-
if (isFetchPatched()) return;
|
|
684
|
-
const original = (0, _dedupefetch.createDedupeFetch)(globalThis.fetch);
|
|
685
|
-
globalThis.fetch = createPatchedFetcher(original, options);
|
|
686
|
-
}
|
|
687
|
-
let currentTimeoutBoundary = null;
|
|
688
|
-
function getTimeoutBoundary() {
|
|
689
|
-
if (!currentTimeoutBoundary) currentTimeoutBoundary = new Promise((r) => {
|
|
690
|
-
setTimeout(() => {
|
|
691
|
-
currentTimeoutBoundary = null;
|
|
692
|
-
r();
|
|
693
|
-
}, 0);
|
|
694
|
-
});
|
|
695
|
-
return currentTimeoutBoundary;
|
|
696
|
-
}
|
|
697
|
-
}) });
|
|
698
|
-
|
|
699
|
-
//#endregion
|
|
700
|
-
export default require_patch_fetch();
|
|
701
|
-
|
|
702
|
-
export { require_patch_fetch };
|
|
703
|
-
//# sourceMappingURL=patch-fetch.js.map
|