fix update build
This commit is contained in:
14
build/node_modules/next/dist/server/app-render/action-async-storage-instance.js
generated
vendored
Normal file
14
build/node_modules/next/dist/server/app-render/action-async-storage-instance.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "actionAsyncStorageInstance", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return actionAsyncStorageInstance;
|
||||
}
|
||||
});
|
||||
const _asynclocalstorage = require("./async-local-storage");
|
||||
const actionAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)();
|
||||
|
||||
//# sourceMappingURL=action-async-storage-instance.js.map
|
||||
13
build/node_modules/next/dist/server/app-render/action-async-storage.external.js
generated
vendored
Normal file
13
build/node_modules/next/dist/server/app-render/action-async-storage.external.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "actionAsyncStorage", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _actionasyncstorageinstance.actionAsyncStorageInstance;
|
||||
}
|
||||
});
|
||||
const _actionasyncstorageinstance = require("./action-async-storage-instance");
|
||||
|
||||
//# sourceMappingURL=action-async-storage.external.js.map
|
||||
1017
build/node_modules/next/dist/server/app-render/action-handler.js
generated
vendored
Normal file
1017
build/node_modules/next/dist/server/app-render/action-handler.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
14
build/node_modules/next/dist/server/app-render/after-task-async-storage-instance.js
generated
vendored
Normal file
14
build/node_modules/next/dist/server/app-render/after-task-async-storage-instance.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "afterTaskAsyncStorageInstance", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return afterTaskAsyncStorageInstance;
|
||||
}
|
||||
});
|
||||
const _asynclocalstorage = require("./async-local-storage");
|
||||
const afterTaskAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)();
|
||||
|
||||
//# sourceMappingURL=after-task-async-storage-instance.js.map
|
||||
13
build/node_modules/next/dist/server/app-render/after-task-async-storage.external.js
generated
vendored
Normal file
13
build/node_modules/next/dist/server/app-render/after-task-async-storage.external.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "afterTaskAsyncStorage", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _aftertaskasyncstorageinstance.afterTaskAsyncStorageInstance;
|
||||
}
|
||||
});
|
||||
const _aftertaskasyncstorageinstance = require("./after-task-async-storage-instance");
|
||||
|
||||
//# sourceMappingURL=after-task-async-storage.external.js.map
|
||||
167
build/node_modules/next/dist/server/app-render/app-render-prerender-utils.js
generated
vendored
Normal file
167
build/node_modules/next/dist/server/app-render/app-render-prerender-utils.js
generated
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
ReactServerPrerenderResult: null,
|
||||
ReactServerResult: null,
|
||||
createReactServerPrerenderResult: null,
|
||||
createReactServerPrerenderResultFromRender: null,
|
||||
processPrelude: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
ReactServerPrerenderResult: function() {
|
||||
return ReactServerPrerenderResult;
|
||||
},
|
||||
ReactServerResult: function() {
|
||||
return ReactServerResult;
|
||||
},
|
||||
createReactServerPrerenderResult: function() {
|
||||
return createReactServerPrerenderResult;
|
||||
},
|
||||
createReactServerPrerenderResultFromRender: function() {
|
||||
return createReactServerPrerenderResultFromRender;
|
||||
},
|
||||
processPrelude: function() {
|
||||
return processPrelude;
|
||||
}
|
||||
});
|
||||
const _invarianterror = require("../../shared/lib/invariant-error");
|
||||
class ReactServerResult {
|
||||
constructor(stream){
|
||||
this._stream = stream;
|
||||
}
|
||||
tee() {
|
||||
if (this._stream === null) {
|
||||
throw Object.defineProperty(new Error('Cannot tee a ReactServerResult that has already been consumed'), "__NEXT_ERROR_CODE", {
|
||||
value: "E106",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
const tee = this._stream.tee();
|
||||
this._stream = tee[0];
|
||||
return tee[1];
|
||||
}
|
||||
consume() {
|
||||
if (this._stream === null) {
|
||||
throw Object.defineProperty(new Error('Cannot consume a ReactServerResult that has already been consumed'), "__NEXT_ERROR_CODE", {
|
||||
value: "E470",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
const stream = this._stream;
|
||||
this._stream = null;
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
async function createReactServerPrerenderResult(underlying) {
|
||||
const chunks = [];
|
||||
const { prelude } = await underlying;
|
||||
const reader = prelude.getReader();
|
||||
while(true){
|
||||
const { done, value } = await reader.read();
|
||||
if (done) {
|
||||
return new ReactServerPrerenderResult(chunks);
|
||||
} else {
|
||||
chunks.push(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
async function createReactServerPrerenderResultFromRender(underlying) {
|
||||
const chunks = [];
|
||||
const reader = underlying.getReader();
|
||||
while(true){
|
||||
const { done, value } = await reader.read();
|
||||
if (done) {
|
||||
break;
|
||||
} else {
|
||||
chunks.push(value);
|
||||
}
|
||||
}
|
||||
return new ReactServerPrerenderResult(chunks);
|
||||
}
|
||||
class ReactServerPrerenderResult {
|
||||
assertChunks(expression) {
|
||||
if (this._chunks === null) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError(`Cannot \`${expression}\` on a ReactServerPrerenderResult that has already been consumed.`), "__NEXT_ERROR_CODE", {
|
||||
value: "E593",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
return this._chunks;
|
||||
}
|
||||
consumeChunks(expression) {
|
||||
const chunks = this.assertChunks(expression);
|
||||
this.consume();
|
||||
return chunks;
|
||||
}
|
||||
consume() {
|
||||
this._chunks = null;
|
||||
}
|
||||
constructor(chunks){
|
||||
this._chunks = chunks;
|
||||
}
|
||||
asUnclosingStream() {
|
||||
const chunks = this.assertChunks('asUnclosingStream()');
|
||||
return createUnclosingStream(chunks);
|
||||
}
|
||||
consumeAsUnclosingStream() {
|
||||
const chunks = this.consumeChunks('consumeAsUnclosingStream()');
|
||||
return createUnclosingStream(chunks);
|
||||
}
|
||||
asStream() {
|
||||
const chunks = this.assertChunks('asStream()');
|
||||
return createClosingStream(chunks);
|
||||
}
|
||||
consumeAsStream() {
|
||||
const chunks = this.consumeChunks('consumeAsStream()');
|
||||
return createClosingStream(chunks);
|
||||
}
|
||||
}
|
||||
function createUnclosingStream(chunks) {
|
||||
let i = 0;
|
||||
return new ReadableStream({
|
||||
async pull (controller) {
|
||||
if (i < chunks.length) {
|
||||
controller.enqueue(chunks[i++]);
|
||||
}
|
||||
// we intentionally keep the stream open. The consumer will clear
|
||||
// out chunks once finished and the remaining memory will be GC'd
|
||||
// when this object goes out of scope
|
||||
}
|
||||
});
|
||||
}
|
||||
function createClosingStream(chunks) {
|
||||
let i = 0;
|
||||
return new ReadableStream({
|
||||
async pull (controller) {
|
||||
if (i < chunks.length) {
|
||||
controller.enqueue(chunks[i++]);
|
||||
} else {
|
||||
controller.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async function processPrelude(unprocessedPrelude) {
|
||||
const [prelude, peek] = unprocessedPrelude.tee();
|
||||
const reader = peek.getReader();
|
||||
const firstResult = await reader.read();
|
||||
reader.cancel();
|
||||
const preludeIsEmpty = firstResult.done === true;
|
||||
return {
|
||||
prelude,
|
||||
preludeIsEmpty
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-render-prerender-utils.js.map
|
||||
76
build/node_modules/next/dist/server/app-render/app-render-render-utils.js
generated
vendored
Normal file
76
build/node_modules/next/dist/server/app-render/app-render-render-utils.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "runInSequentialTasks", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return runInSequentialTasks;
|
||||
}
|
||||
});
|
||||
const _invarianterror = require("../../shared/lib/invariant-error");
|
||||
const _apprenderscheduling = require("./app-render-scheduling");
|
||||
const _fastsetimmediateexternal = require("../node-environment-extensions/fast-set-immediate.external");
|
||||
const _isthenable = require("../../shared/lib/is-thenable");
|
||||
function noop() {}
|
||||
function runInSequentialTasks(first, ...rest) {
|
||||
if (process.env.NEXT_RUNTIME === 'edge') {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('`runInSequentialTasks` should not be called in edge runtime.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E1054",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
} else {
|
||||
return new Promise((resolve, reject)=>{
|
||||
const scheduleTimeout = (0, _apprenderscheduling.createAtomicTimerGroup)();
|
||||
const ids = [];
|
||||
let result;
|
||||
ids.push(scheduleTimeout(()=>{
|
||||
try {
|
||||
(0, _fastsetimmediateexternal.DANGEROUSLY_runPendingImmediatesAfterCurrentTask)();
|
||||
result = first();
|
||||
// If the first function returns a thenable, suppress unhandled
|
||||
// rejections. A later task in the sequence (e.g. an abort) may
|
||||
// cause the promise to reject, and we don't want that to surface
|
||||
// as an unhandled rejection — the caller will observe the
|
||||
// rejection when they await the returned promise.
|
||||
if ((0, _isthenable.isThenable)(result)) {
|
||||
result.then(noop, noop);
|
||||
}
|
||||
} catch (err) {
|
||||
for(let i = 1; i < ids.length; i++){
|
||||
clearTimeout(ids[i]);
|
||||
}
|
||||
reject(err);
|
||||
}
|
||||
}));
|
||||
for(let i = 0; i < rest.length; i++){
|
||||
const fn = rest[i];
|
||||
let index = ids.length;
|
||||
ids.push(scheduleTimeout(()=>{
|
||||
try {
|
||||
(0, _fastsetimmediateexternal.DANGEROUSLY_runPendingImmediatesAfterCurrentTask)();
|
||||
fn();
|
||||
} catch (err) {
|
||||
// clear remaining timeouts
|
||||
while(++index < ids.length){
|
||||
clearTimeout(ids[index]);
|
||||
}
|
||||
reject(err);
|
||||
}
|
||||
}));
|
||||
}
|
||||
// We wait a task before resolving
|
||||
ids.push(scheduleTimeout(()=>{
|
||||
try {
|
||||
(0, _fastsetimmediateexternal.expectNoPendingImmediates)();
|
||||
resolve(result);
|
||||
} catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-render-render-utils.js.map
|
||||
188
build/node_modules/next/dist/server/app-render/app-render-scheduling.js
generated
vendored
Normal file
188
build/node_modules/next/dist/server/app-render/app-render-scheduling.js
generated
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "createAtomicTimerGroup", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return createAtomicTimerGroup;
|
||||
}
|
||||
});
|
||||
const _invarianterror = require("../../shared/lib/invariant-error");
|
||||
const _fastsetimmediateexternal = require("../node-environment-extensions/fast-set-immediate.external");
|
||||
/*
|
||||
==========================
|
||||
| Background |
|
||||
==========================
|
||||
|
||||
Node.js does not guarantee that two timers scheduled back to back will run
|
||||
on the same iteration of the event loop:
|
||||
|
||||
```ts
|
||||
setTimeout(one, 0)
|
||||
setTimeout(two, 0)
|
||||
```
|
||||
|
||||
Internally, each timer is assigned a `_idleStart` property that holds
|
||||
an internal libuv timestamp in millisecond resolution.
|
||||
This will be used to determine if the timer is already "expired" and should be executed.
|
||||
However, even in sync code, it's possible for two timers to get different `_idleStart` values.
|
||||
This can cause one of the timers to be executed, and the other to be delayed until the next timer phase.
|
||||
|
||||
The delaying happens [here](https://github.com/nodejs/node/blob/c208ffc66bb9418ff026c4e3fa82e5b4387bd147/lib/internal/timers.js#L556-L564).
|
||||
and can be debugged by running node with `NODE_DEBUG=timer`.
|
||||
|
||||
The easiest way to observe it is to run this program in a loop until it exits with status 1:
|
||||
|
||||
```
|
||||
// test.js
|
||||
|
||||
let immediateRan = false
|
||||
const t1 = setTimeout(() => {
|
||||
console.log('timeout 1')
|
||||
setImmediate(() => {
|
||||
console.log('immediate 1')
|
||||
immediateRan = true
|
||||
})
|
||||
})
|
||||
|
||||
const t2 = setTimeout(() => {
|
||||
console.log('timeout 2')
|
||||
if (immediateRan) {
|
||||
console.log('immediate ran before the second timeout!')
|
||||
console.log(
|
||||
`t1._idleStart: ${t1._idleStart}, t2_idleStart: ${t2._idleStart}`
|
||||
);
|
||||
process.exit(1)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
i=1;
|
||||
while true; do
|
||||
output="$(NODE_DEBUG=timer node test.js 2>&1)";
|
||||
if [ "$?" -eq 1 ]; then
|
||||
echo "failed after $i iterations";
|
||||
echo "$output";
|
||||
break;
|
||||
fi;
|
||||
i=$((i+1));
|
||||
done
|
||||
```
|
||||
|
||||
If `t2` is deferred to the next iteration of the event loop,
|
||||
then the immediate scheduled from inside `t1` will run first.
|
||||
When this occurs, `_idleStart` is reliably different between `t1` and `t2`.
|
||||
|
||||
==========================
|
||||
| Solution |
|
||||
==========================
|
||||
|
||||
We can guarantee that multiple timers (with the same delay, usually `0`)
|
||||
run together without any delays by making sure that their `_idleStart`s are the same,
|
||||
because that's what's used to determine if a timer should be deferred or not.
|
||||
Luckily, this property is currently exposed to userland and mutable,
|
||||
so we can patch it.
|
||||
|
||||
Another related trick we could potentially apply is making
|
||||
a timer immediately be considered expired by doing `timer._idleStart -= 2`.
|
||||
(the value must be more than `1`, the delay that actually gets set for `setTimeout(cb, 0)`).
|
||||
This makes node view this timer as "a 1ms timer scheduled 2ms ago",
|
||||
meaning that it should definitely run in the next timer phase.
|
||||
However, I'm not confident we know all the side effects of doing this,
|
||||
so for now, simply ensuring coordination is enough.
|
||||
*/ let shouldAttemptPatching = true;
|
||||
function warnAboutTimers() {
|
||||
console.warn("Next.js cannot guarantee that Cache Components will run as expected due to the current runtime's implementation of `setTimeout()`.\nPlease report a github issue here: https://github.com/vercel/next.js/issues/new/");
|
||||
}
|
||||
function createAtomicTimerGroup(delayMs = 0) {
|
||||
if (process.env.NEXT_RUNTIME === 'edge') {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('createAtomicTimerGroup cannot be called in the edge runtime'), "__NEXT_ERROR_CODE", {
|
||||
value: "E934",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
} else {
|
||||
let isFirstCallback = true;
|
||||
let firstTimerIdleStart = null;
|
||||
let didFirstTimerRun = false;
|
||||
// As a sanity check, we schedule an immediate from the first timeout
|
||||
// to check if the execution was interrupted (i.e. if it ran between the timeouts).
|
||||
// Note that we're deliberately bypassing the "fast setImmediate" patch here --
|
||||
// otherwise, this check would always fail, because the immediate
|
||||
// would always run before the second timeout.
|
||||
let didImmediateRun = false;
|
||||
function runFirstCallback(callback) {
|
||||
didFirstTimerRun = true;
|
||||
if (shouldAttemptPatching) {
|
||||
(0, _fastsetimmediateexternal.unpatchedSetImmediate)(()=>{
|
||||
didImmediateRun = true;
|
||||
});
|
||||
}
|
||||
return callback();
|
||||
}
|
||||
function runSubsequentCallback(callback) {
|
||||
if (shouldAttemptPatching) {
|
||||
if (didImmediateRun) {
|
||||
// If the immediate managed to run between the timers, then we're not
|
||||
// able to provide the guarantees that we're supposed to
|
||||
shouldAttemptPatching = false;
|
||||
warnAboutTimers();
|
||||
}
|
||||
}
|
||||
return callback();
|
||||
}
|
||||
return function scheduleTimeout(callback) {
|
||||
if (didFirstTimerRun) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('Cannot schedule more timers into a group that already executed'), "__NEXT_ERROR_CODE", {
|
||||
value: "E935",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
const timer = setTimeout(isFirstCallback ? runFirstCallback : runSubsequentCallback, delayMs, callback);
|
||||
isFirstCallback = false;
|
||||
if (!shouldAttemptPatching) {
|
||||
// We already tried patching some timers, and it didn't work.
|
||||
// No point trying again.
|
||||
return timer;
|
||||
}
|
||||
// NodeJS timers have a `_idleStart` property, but it doesn't exist e.g. in Bun.
|
||||
// If it's not present, we'll warn and try to continue.
|
||||
try {
|
||||
if ('_idleStart' in timer && typeof timer._idleStart === 'number') {
|
||||
// If this is the first timer that was scheduled, save its `_idleStart`.
|
||||
// We'll copy it onto subsequent timers to guarantee that they'll all be
|
||||
// considered expired in the same iteration of the event loop
|
||||
// and thus will all be executed in the same timer phase.
|
||||
if (firstTimerIdleStart === null) {
|
||||
firstTimerIdleStart = timer._idleStart;
|
||||
} else {
|
||||
timer._idleStart = firstTimerIdleStart;
|
||||
}
|
||||
} else {
|
||||
shouldAttemptPatching = false;
|
||||
warnAboutTimers();
|
||||
}
|
||||
} catch (err) {
|
||||
// This should never fail in current Node, but it might start failing in the future.
|
||||
// We might be okay even without tweaking the timers, so warn and try to continue.
|
||||
console.error(Object.defineProperty(new _invarianterror.InvariantError('An unexpected error occurred while adjusting `_idleStart` on an atomic timer', {
|
||||
cause: err
|
||||
}), "__NEXT_ERROR_CODE", {
|
||||
value: "E933",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
}));
|
||||
shouldAttemptPatching = false;
|
||||
warnAboutTimers();
|
||||
}
|
||||
return timer;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=app-render-scheduling.js.map
|
||||
4522
build/node_modules/next/dist/server/app-render/app-render.js
generated
vendored
Normal file
4522
build/node_modules/next/dist/server/app-render/app-render.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
76
build/node_modules/next/dist/server/app-render/async-local-storage.js
generated
vendored
Normal file
76
build/node_modules/next/dist/server/app-render/async-local-storage.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
bindSnapshot: null,
|
||||
createAsyncLocalStorage: null,
|
||||
createSnapshot: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
bindSnapshot: function() {
|
||||
return bindSnapshot;
|
||||
},
|
||||
createAsyncLocalStorage: function() {
|
||||
return createAsyncLocalStorage;
|
||||
},
|
||||
createSnapshot: function() {
|
||||
return createSnapshot;
|
||||
}
|
||||
});
|
||||
const sharedAsyncLocalStorageNotAvailableError = Object.defineProperty(new Error('Invariant: AsyncLocalStorage accessed in runtime where it is not available'), "__NEXT_ERROR_CODE", {
|
||||
value: "E504",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
class FakeAsyncLocalStorage {
|
||||
disable() {
|
||||
throw sharedAsyncLocalStorageNotAvailableError;
|
||||
}
|
||||
getStore() {
|
||||
// This fake implementation of AsyncLocalStorage always returns `undefined`.
|
||||
return undefined;
|
||||
}
|
||||
run() {
|
||||
throw sharedAsyncLocalStorageNotAvailableError;
|
||||
}
|
||||
exit() {
|
||||
throw sharedAsyncLocalStorageNotAvailableError;
|
||||
}
|
||||
enterWith() {
|
||||
throw sharedAsyncLocalStorageNotAvailableError;
|
||||
}
|
||||
static bind(fn) {
|
||||
return fn;
|
||||
}
|
||||
}
|
||||
const maybeGlobalAsyncLocalStorage = typeof globalThis !== 'undefined' && globalThis.AsyncLocalStorage;
|
||||
function createAsyncLocalStorage() {
|
||||
if (maybeGlobalAsyncLocalStorage) {
|
||||
return new maybeGlobalAsyncLocalStorage();
|
||||
}
|
||||
return new FakeAsyncLocalStorage();
|
||||
}
|
||||
function bindSnapshot(// WARNING: Don't pass a named function to this argument! See: https://github.com/facebook/react/pull/34911
|
||||
fn) {
|
||||
if (maybeGlobalAsyncLocalStorage) {
|
||||
return maybeGlobalAsyncLocalStorage.bind(fn);
|
||||
}
|
||||
return FakeAsyncLocalStorage.bind(fn);
|
||||
}
|
||||
function createSnapshot() {
|
||||
if (maybeGlobalAsyncLocalStorage) {
|
||||
return maybeGlobalAsyncLocalStorage.snapshot();
|
||||
}
|
||||
return function(fn, ...args) {
|
||||
return fn(...args);
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=async-local-storage.js.map
|
||||
181
build/node_modules/next/dist/server/app-render/cache-signal.js
generated
vendored
Normal file
181
build/node_modules/next/dist/server/app-render/cache-signal.js
generated
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
/**
|
||||
* This class is used to detect when all cache reads for a given render are settled.
|
||||
* We do this to allow for cache warming the prerender without having to continue rendering
|
||||
* the remainder of the page. This feature is really only useful when the cacheComponents flag is on
|
||||
* and should only be used in codepaths gated with this feature.
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "CacheSignal", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return CacheSignal;
|
||||
}
|
||||
});
|
||||
const _invarianterror = require("../../shared/lib/invariant-error");
|
||||
class CacheSignal {
|
||||
constructor(){
|
||||
this.count = 0;
|
||||
this.earlyListeners = [];
|
||||
this.listeners = [];
|
||||
this.tickPending = false;
|
||||
this.pendingTimeoutCleanup = null;
|
||||
this.subscribedSignals = null;
|
||||
this.invokeListenersIfNoPendingReads = ()=>{
|
||||
this.pendingTimeoutCleanup = null;
|
||||
if (this.count === 0) {
|
||||
for(let i = 0; i < this.listeners.length; i++){
|
||||
this.listeners[i]();
|
||||
}
|
||||
this.listeners.length = 0;
|
||||
}
|
||||
};
|
||||
if (process.env.NEXT_RUNTIME === 'edge') {
|
||||
// we rely on `process.nextTick`, which is not supported in edge
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('CacheSignal cannot be used in the edge runtime, because `cacheComponents` does not support it.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E728",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
noMorePendingCaches() {
|
||||
if (!this.tickPending) {
|
||||
this.tickPending = true;
|
||||
queueMicrotask(()=>process.nextTick(()=>{
|
||||
this.tickPending = false;
|
||||
if (this.count === 0) {
|
||||
for(let i = 0; i < this.earlyListeners.length; i++){
|
||||
this.earlyListeners[i]();
|
||||
}
|
||||
this.earlyListeners.length = 0;
|
||||
}
|
||||
}));
|
||||
}
|
||||
// After a cache resolves, React will schedule new rendering work:
|
||||
// - in a microtask (when prerendering)
|
||||
// - in setImmediate (when rendering)
|
||||
// To cover both of these, we have to make sure that we let immediates execute at least once after each cache resolved.
|
||||
// We don't know when the pending timeout was scheduled (and if it's about to resolve),
|
||||
// so by scheduling a new one, we can be sure that we'll go around the event loop at least once.
|
||||
if (this.pendingTimeoutCleanup) {
|
||||
// We cancel the timeout in beginRead, so this shouldn't ever be active here,
|
||||
// but we still cancel it defensively.
|
||||
this.pendingTimeoutCleanup();
|
||||
}
|
||||
this.pendingTimeoutCleanup = scheduleImmediateAndTimeoutWithCleanup(this.invokeListenersIfNoPendingReads);
|
||||
}
|
||||
/**
|
||||
* This promise waits until there are no more in progress cache reads but no later.
|
||||
* This allows for adding more cache reads after to delay cacheReady.
|
||||
*/ inputReady() {
|
||||
return new Promise((resolve)=>{
|
||||
this.earlyListeners.push(resolve);
|
||||
if (this.count === 0) {
|
||||
this.noMorePendingCaches();
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* If there are inflight cache reads this Promise can resolve in a microtask however
|
||||
* if there are no inflight cache reads then we wait at least one task to allow initial
|
||||
* cache reads to be initiated.
|
||||
*/ cacheReady() {
|
||||
return new Promise((resolve)=>{
|
||||
this.listeners.push(resolve);
|
||||
if (this.count === 0) {
|
||||
this.noMorePendingCaches();
|
||||
}
|
||||
});
|
||||
}
|
||||
beginRead() {
|
||||
this.count++;
|
||||
// There's a new pending cache, so if there's a `noMorePendingCaches` timeout running,
|
||||
// we should cancel it.
|
||||
if (this.pendingTimeoutCleanup) {
|
||||
this.pendingTimeoutCleanup();
|
||||
this.pendingTimeoutCleanup = null;
|
||||
}
|
||||
if (this.subscribedSignals !== null) {
|
||||
for (const subscriber of this.subscribedSignals){
|
||||
subscriber.beginRead();
|
||||
}
|
||||
}
|
||||
}
|
||||
endRead() {
|
||||
if (this.count === 0) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('CacheSignal got more endRead() calls than beginRead() calls'), "__NEXT_ERROR_CODE", {
|
||||
value: "E678",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
// If this is the last read we need to wait a task before we can claim the cache is settled.
|
||||
// The cache read will likely ping a Server Component which can read from the cache again and this
|
||||
// will play out in a microtask so we need to only resolve pending listeners if we're still at 0
|
||||
// after at least one task.
|
||||
// We only want one task scheduled at a time so when we hit count 1 we don't decrement the counter immediately.
|
||||
// If intervening reads happen before the scheduled task runs they will never observe count 1 preventing reentrency
|
||||
this.count--;
|
||||
if (this.count === 0) {
|
||||
this.noMorePendingCaches();
|
||||
}
|
||||
if (this.subscribedSignals !== null) {
|
||||
for (const subscriber of this.subscribedSignals){
|
||||
subscriber.endRead();
|
||||
}
|
||||
}
|
||||
}
|
||||
hasPendingReads() {
|
||||
return this.count > 0;
|
||||
}
|
||||
trackRead(promise) {
|
||||
this.beginRead();
|
||||
// `promise.finally()` still rejects, so don't use it here to avoid unhandled rejections
|
||||
const onFinally = this.endRead.bind(this);
|
||||
promise.then(onFinally, onFinally);
|
||||
return promise;
|
||||
}
|
||||
subscribeToReads(subscriber) {
|
||||
if (subscriber === this) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('A CacheSignal cannot subscribe to itself'), "__NEXT_ERROR_CODE", {
|
||||
value: "E679",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
if (this.subscribedSignals === null) {
|
||||
this.subscribedSignals = new Set();
|
||||
}
|
||||
this.subscribedSignals.add(subscriber);
|
||||
// we'll notify the subscriber of each endRead() on this signal,
|
||||
// so we need to give it a corresponding beginRead() for each read we have in flight now.
|
||||
for(let i = 0; i < this.count; i++){
|
||||
subscriber.beginRead();
|
||||
}
|
||||
return this.unsubscribeFromReads.bind(this, subscriber);
|
||||
}
|
||||
unsubscribeFromReads(subscriber) {
|
||||
if (!this.subscribedSignals) {
|
||||
return;
|
||||
}
|
||||
this.subscribedSignals.delete(subscriber);
|
||||
// we don't need to set the set back to `null` if it's empty --
|
||||
// if other signals are subscribing to this one, it'll likely get more subscriptions later,
|
||||
// so we'd have to allocate a fresh set again when that happens.
|
||||
}
|
||||
}
|
||||
function scheduleImmediateAndTimeoutWithCleanup(cb) {
|
||||
// If we decide to clean up the timeout, we want to remove
|
||||
// either the immediate or the timeout, whichever is still pending.
|
||||
let clearPending;
|
||||
const immediate = setImmediate(()=>{
|
||||
const timeout = setTimeout(cb, 0);
|
||||
clearPending = clearTimeout.bind(null, timeout);
|
||||
});
|
||||
clearPending = clearImmediate.bind(null, immediate);
|
||||
return ()=>clearPending();
|
||||
}
|
||||
|
||||
//# sourceMappingURL=cache-signal.js.map
|
||||
616
build/node_modules/next/dist/server/app-render/collect-segment-data.js
generated
vendored
Normal file
616
build/node_modules/next/dist/server/app-render/collect-segment-data.js
generated
vendored
Normal file
@@ -0,0 +1,616 @@
|
||||
/* eslint-disable @next/internal/no-ambiguous-jsx -- Bundled in entry-base so it gets the right JSX runtime. */ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
collectPrefetchHints: null,
|
||||
collectSegmentData: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
collectPrefetchHints: function() {
|
||||
return collectPrefetchHints;
|
||||
},
|
||||
collectSegmentData: function() {
|
||||
return collectSegmentData;
|
||||
}
|
||||
});
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _approutertypes = require("../../shared/lib/app-router-types");
|
||||
const _varyparamsdecoding = require("../../shared/lib/segment-cache/vary-params-decoding");
|
||||
const _segment = require("../../shared/lib/segment");
|
||||
const _client = require("react-server-dom-webpack/client");
|
||||
const _static = require("react-server-dom-webpack/static");
|
||||
const _nodewebstreamshelper = require("../stream-utils/node-web-streams-helper");
|
||||
const _scheduler = require("../../lib/scheduler");
|
||||
const _segmentvalueencoding = require("../../shared/lib/segment-cache/segment-value-encoding");
|
||||
const _createerrorhandler = require("./create-error-handler");
|
||||
const _prospectiverenderutils = require("./prospective-render-utils");
|
||||
const _workasyncstorageexternal = require("./work-async-storage.external");
|
||||
const filterStackFrame = process.env.NODE_ENV !== 'production' ? require('../lib/source-maps').filterStackFrameDEV : undefined;
|
||||
const findSourceMapURL = process.env.NODE_ENV !== 'production' ? require('../lib/source-maps').findSourceMapURLDEV : undefined;
|
||||
function onSegmentPrerenderError(error) {
|
||||
const digest = (0, _createerrorhandler.getDigestForWellKnownError)(error);
|
||||
if (digest) {
|
||||
return digest;
|
||||
}
|
||||
// We don't need to log the errors because we would have already done that
|
||||
// when generating the original Flight stream for the whole page.
|
||||
if (process.env.NEXT_DEBUG_BUILD || process.env.__NEXT_VERBOSE_LOGGING) {
|
||||
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
||||
(0, _prospectiverenderutils.printDebugThrownValueForProspectiveRender)(error, (workStore == null ? void 0 : workStore.route) ?? 'unknown route', _prospectiverenderutils.Phase.SegmentCollection);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Extract the FlightRouterState, seed data, and head from a prerendered
|
||||
* InitialRSCPayload. Returns null if the payload doesn't match the expected
|
||||
* shape (single path with 3 elements).
|
||||
*/ function extractFlightData(initialRSCPayload) {
|
||||
const flightDataPaths = initialRSCPayload.f;
|
||||
// FlightDataPath is an unsound type, hence the additional checks.
|
||||
if (flightDataPaths.length !== 1 && flightDataPaths[0].length !== 3) {
|
||||
console.error('Internal Next.js error: InitialRSCPayload does not match the expected ' + 'shape for a prerendered page during segment prefetch generation.');
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
buildId: initialRSCPayload.b,
|
||||
flightRouterState: flightDataPaths[0][0],
|
||||
seedData: flightDataPaths[0][1],
|
||||
head: flightDataPaths[0][2]
|
||||
};
|
||||
}
|
||||
async function collectSegmentData(isCacheComponentsEnabled, fullPageDataBuffer, staleTime, clientModules, serverConsumerManifest, prefetchInlining, hints) {
|
||||
// Traverse the router tree and generate a prefetch response for each segment.
|
||||
// A mutable map to collect the results as we traverse the route tree.
|
||||
const resultMap = new Map();
|
||||
// Before we start, warm up the module cache by decoding the page data once.
|
||||
// Then we can assume that any remaining async tasks that occur the next time
|
||||
// are due to hanging promises caused by dynamic data access. Note we only
|
||||
// have to do this once per page, not per individual segment.
|
||||
//
|
||||
try {
|
||||
await (0, _client.createFromReadableStream)((0, _nodewebstreamshelper.streamFromBuffer)(fullPageDataBuffer), {
|
||||
findSourceMapURL,
|
||||
serverConsumerManifest
|
||||
});
|
||||
await (0, _scheduler.waitAtLeastOneReactRenderTask)();
|
||||
} catch {}
|
||||
// Create an abort controller that we'll use to stop the stream.
|
||||
const abortController = new AbortController();
|
||||
const onCompletedProcessingRouteTree = async ()=>{
|
||||
// Since all we're doing is decoding and re-encoding a cached prerender, if
|
||||
// serializing the stream takes longer than a microtask, it must because of
|
||||
// hanging promises caused by dynamic data.
|
||||
await (0, _scheduler.waitAtLeastOneReactRenderTask)();
|
||||
abortController.abort();
|
||||
};
|
||||
// Generate a stream for the route tree prefetch. While we're walking the
|
||||
// tree, we'll also spawn additional tasks to generate the segment prefetches.
|
||||
// The promises for these tasks are pushed to a mutable array that we will
|
||||
// await once the route tree is fully rendered.
|
||||
const segmentTasks = [];
|
||||
const { prelude: treeStream } = await (0, _static.prerender)(// RootTreePrefetch is not a valid return type for a React component, but
|
||||
// we need to use a component so that when we decode the original stream
|
||||
// inside of it, the side effects are transferred to the new stream.
|
||||
// @ts-expect-error
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)(PrefetchTreeData, {
|
||||
isClientParamParsingEnabled: isCacheComponentsEnabled,
|
||||
fullPageDataBuffer: fullPageDataBuffer,
|
||||
serverConsumerManifest: serverConsumerManifest,
|
||||
clientModules: clientModules,
|
||||
staleTime: staleTime,
|
||||
segmentTasks: segmentTasks,
|
||||
onCompletedProcessingRouteTree: onCompletedProcessingRouteTree,
|
||||
prefetchInlining: prefetchInlining,
|
||||
hints: hints
|
||||
}), clientModules, {
|
||||
filterStackFrame,
|
||||
signal: abortController.signal,
|
||||
onError: onSegmentPrerenderError
|
||||
});
|
||||
// Write the route tree to a special `/_tree` segment.
|
||||
const treeBuffer = await (0, _nodewebstreamshelper.streamToBuffer)(treeStream);
|
||||
resultMap.set('/_tree', treeBuffer);
|
||||
// Also output the entire full page data response
|
||||
resultMap.set('/_full', fullPageDataBuffer);
|
||||
// Now that we've finished rendering the route tree, all the segment tasks
|
||||
// should have been spawned. Await them in parallel and write the segment
|
||||
// prefetches to the result map.
|
||||
let hasPageSegment = false;
|
||||
for (const [segmentPath, buffer] of (await Promise.all(segmentTasks))){
|
||||
resultMap.set(segmentPath, buffer);
|
||||
if (segmentPath.endsWith('__PAGE__')) {
|
||||
hasPageSegment = true;
|
||||
}
|
||||
}
|
||||
if (!hasPageSegment) {
|
||||
// The build requires at least one segment path ending with __PAGE__ to
|
||||
// register the catch-all segment data route. When all page segments are
|
||||
// disabled (e.g. every leaf has runtime prefetching), no __PAGE__ entry
|
||||
// is emitted. Write a dummy entry with a path that doesn't match any
|
||||
// real route segment so the client will never request it.
|
||||
//
|
||||
// TODO: Remove the __PAGE__ requirement from the build instead of
|
||||
// working around it here. The invariant is outdated now that segments
|
||||
// can be disabled.
|
||||
resultMap.set('/todo-remove-fake-segment/__PAGE__', Buffer.alloc(0));
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
async function collectPrefetchHints(fullPageDataBuffer, staleTime, clientModules, serverConsumerManifest, maxSize, maxBundleSize) {
|
||||
// Warm up the module cache, same as collectSegmentData.
|
||||
try {
|
||||
await (0, _client.createFromReadableStream)((0, _nodewebstreamshelper.streamFromBuffer)(fullPageDataBuffer), {
|
||||
findSourceMapURL,
|
||||
serverConsumerManifest
|
||||
});
|
||||
await (0, _scheduler.waitAtLeastOneReactRenderTask)();
|
||||
} catch {}
|
||||
// Decode the Flight data to walk the route tree.
|
||||
const initialRSCPayload = await (0, _client.createFromReadableStream)(createUnclosingPrefetchStream((0, _nodewebstreamshelper.streamFromBuffer)(fullPageDataBuffer)), {
|
||||
findSourceMapURL,
|
||||
serverConsumerManifest
|
||||
});
|
||||
const flightData = extractFlightData(initialRSCPayload);
|
||||
if (flightData === null) {
|
||||
return {
|
||||
hints: 0,
|
||||
slots: null
|
||||
};
|
||||
}
|
||||
const { buildId, flightRouterState, seedData, head } = flightData;
|
||||
// Measure the head (metadata/viewport) gzip size so the main traversal
|
||||
// can decide whether to inline it into a page's bundle.
|
||||
const headVaryParamsThenable = initialRSCPayload.h;
|
||||
const headVaryParams = headVaryParamsThenable !== null ? (0, _varyparamsdecoding.readVaryParams)(headVaryParamsThenable) : null;
|
||||
const [, headBuffer] = await renderSegmentPrefetch(buildId, staleTime, head, _segmentvalueencoding.HEAD_REQUEST_KEY, headVaryParams, clientModules);
|
||||
const headGzipSize = await getGzipSize(headBuffer);
|
||||
// Mutable accumulator: the first page leaf that can fit the head sets
|
||||
// this to true. Once set, subsequent leaves skip the check.
|
||||
const headInlineState = {
|
||||
inlined: false
|
||||
};
|
||||
// Walk the tree with the parent-first, child-decides algorithm.
|
||||
const { node } = await collectPrefetchHintsImpl(flightRouterState, buildId, staleTime, seedData, clientModules, _segmentvalueencoding.ROOT_SEGMENT_REQUEST_KEY, null, maxSize, maxBundleSize, headGzipSize, headInlineState);
|
||||
if (!headInlineState.inlined) {
|
||||
// No page could accept the head. Set HeadOutlined on the root so the
|
||||
// client knows to fetch the head separately.
|
||||
node.hints |= _approutertypes.PrefetchHint.HeadOutlined;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
// Measure a segment's gzip size and decide whether it should be inlined.
|
||||
//
|
||||
// These hints are computed once during build and never change for the
|
||||
// lifetime of that deployment. The client can assume that hints delivered as
|
||||
// part of one request will be the same during a subsequent request, given
|
||||
// the same build ID. There's no skew to worry about as long as the build
|
||||
// itself is consistent.
|
||||
//
|
||||
// In the Segment Cache, we split page prefetches into multiple requests so
|
||||
// that each one can be cached and deduped independently. However, some
|
||||
// segments are small enough that the potential caching benefits are not worth
|
||||
// the additional network overhead. For these, we inline a parent's data into
|
||||
// one of its children's responses, avoiding a separate request. The parent
|
||||
// is inlined into the child (not the other way around) because the parent's
|
||||
// response is more likely to be shared across multiple pages. The child's
|
||||
// response is already page-specific, so adding the parent's data there
|
||||
// doesn't meaningfully reduce deduplication. It's similar to how JS bundlers
|
||||
// decide whether to inline a module into a chunk.
|
||||
//
|
||||
// The algorithm is parent-first, child-decides: the parent measures itself
|
||||
// and passes its gzip size down. Each child decides whether to accept. A
|
||||
// child rejects if the parent exceeds maxSize or if accepting would push
|
||||
// the cumulative inlined bytes past maxBundleSize. This produces
|
||||
// both ParentInlinedIntoSelf (on the child) and InlinedIntoChild (on the
|
||||
// parent) in a single pass.
|
||||
async function collectPrefetchHintsImpl(route, buildId, staleTime, seedData, clientModules, // TODO: Consider persisting the computed requestKey into the hints output
|
||||
// so it doesn't need to be recomputed during the build. This might also
|
||||
// suggest renaming prefetch-hints.json to something like
|
||||
// segment-manifest.json, since it would contain more than just hints.
|
||||
requestKey, parentGzipSize, maxSize, maxBundleSize, headGzipSize, headInlineState) {
|
||||
// Render current segment and measure its gzip size.
|
||||
let currentGzipSize = null;
|
||||
if (seedData !== null) {
|
||||
const varyParamsThenable = seedData[4];
|
||||
const varyParams = varyParamsThenable !== null ? (0, _varyparamsdecoding.readVaryParams)(varyParamsThenable) : null;
|
||||
const [, buffer] = await renderSegmentPrefetch(buildId, staleTime, seedData[0], requestKey, varyParams, clientModules);
|
||||
currentGzipSize = await getGzipSize(buffer);
|
||||
}
|
||||
// Only offer this segment to its children for inlining if its gzip size
|
||||
// is below maxSize. Segments above this get their own response.
|
||||
const sizeToInline = currentGzipSize !== null && currentGzipSize < maxSize ? currentGzipSize : null;
|
||||
// Process children serially (not in parallel) to ensure deterministic
|
||||
// results. Since this only runs at build time and the rendering is just
|
||||
// re-encoding cached prerenders, this won't impact build times. Each child
|
||||
// receives our gzip size and decides whether to inline us. Once a child
|
||||
// accepts, we stop offering to remaining siblings — the parent is only
|
||||
// inlined into one child. In parallel routes, this avoids duplicating the
|
||||
// parent's data across multiple sibling responses.
|
||||
const children = route[1];
|
||||
const seedDataChildren = seedData !== null ? seedData[1] : null;
|
||||
let slots = null;
|
||||
let didInlineIntoChild = false;
|
||||
let acceptingChildInlinedBytes = 0;
|
||||
// Track the smallest inlinedBytes across all children so we know how much
|
||||
// budget remains along the best path. When our own parent asks whether we
|
||||
// can accept its data, the parent's bytes would flow through to the child
|
||||
// with the most remaining headroom.
|
||||
let smallestChildInlinedBytes = Infinity;
|
||||
let hasChildren = false;
|
||||
for(const parallelRouteKey in children){
|
||||
hasChildren = true;
|
||||
const childRoute = children[parallelRouteKey];
|
||||
const childSegment = childRoute[0];
|
||||
const childSeedData = seedDataChildren !== null ? seedDataChildren[parallelRouteKey] : null;
|
||||
const childRequestKey = (0, _segmentvalueencoding.appendSegmentRequestKeyPart)(requestKey, parallelRouteKey, (0, _segmentvalueencoding.createSegmentRequestKeyPart)(childSegment));
|
||||
const childResult = await collectPrefetchHintsImpl(childRoute, buildId, staleTime, childSeedData, clientModules, childRequestKey, // Once a child has accepted us, stop offering to remaining siblings.
|
||||
didInlineIntoChild ? null : sizeToInline, maxSize, maxBundleSize, headGzipSize, headInlineState);
|
||||
if (slots === null) {
|
||||
slots = {};
|
||||
}
|
||||
slots[parallelRouteKey] = childResult.node;
|
||||
if (childResult.node.hints & _approutertypes.PrefetchHint.ParentInlinedIntoSelf) {
|
||||
// This child accepted our data — it will include our segment's
|
||||
// response in its own. No need to track headroom anymore since
|
||||
// we already know which child we're inlined into.
|
||||
didInlineIntoChild = true;
|
||||
acceptingChildInlinedBytes = childResult.inlinedBytes;
|
||||
} else if (!didInlineIntoChild) {
|
||||
// Track the child with the most remaining headroom. Used below
|
||||
// when deciding whether to accept our own parent's data.
|
||||
if (childResult.inlinedBytes < smallestChildInlinedBytes) {
|
||||
smallestChildInlinedBytes = childResult.inlinedBytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Leaf segment: no children have consumed any budget yet.
|
||||
if (!hasChildren) {
|
||||
smallestChildInlinedBytes = 0;
|
||||
}
|
||||
// Mark this segment as InlinedIntoChild if one of its children accepted.
|
||||
// This means this segment doesn't need its own prefetch response — its
|
||||
// data is included in the accepting child's response instead.
|
||||
let hints = 0;
|
||||
if (didInlineIntoChild) {
|
||||
hints |= _approutertypes.PrefetchHint.InlinedIntoChild;
|
||||
}
|
||||
// inlinedBytes represents the total gzipped bytes of parent data inlined
|
||||
// into the deepest "inlining target" along this branch. It starts at 0 at
|
||||
// the leaves and grows as parents are inlined going back up the tree. If a
|
||||
// child accepted us, our size is already counted in that child's value.
|
||||
let inlinedBytes = didInlineIntoChild ? acceptingChildInlinedBytes : smallestChildInlinedBytes;
|
||||
// At leaf nodes (pages), try to inline the head (metadata/viewport) into
|
||||
// this page's response. The head is treated like an additional inlined
|
||||
// entry — it counts against the same total budget. Only the first page
|
||||
// that has room gets the head; subsequent pages skip via the shared
|
||||
// headInlineState accumulator.
|
||||
if (!hasChildren && !headInlineState.inlined) {
|
||||
if (inlinedBytes + headGzipSize < maxBundleSize) {
|
||||
hints |= _approutertypes.PrefetchHint.HeadInlinedIntoSelf;
|
||||
inlinedBytes += headGzipSize;
|
||||
headInlineState.inlined = true;
|
||||
}
|
||||
}
|
||||
// Decide whether to accept our own parent's data. Two conditions:
|
||||
//
|
||||
// 1. The parent offered us a size (parentGzipSize is not null). It's null
|
||||
// when the parent is too large to inline or when this is the root.
|
||||
//
|
||||
// 2. The total inlined bytes along this branch wouldn't exceed the budget.
|
||||
// Even if each segment is individually small, at some point it no
|
||||
// longer makes sense to keep adding bytes because the combined response
|
||||
// is unique per URL and can't be deduped.
|
||||
//
|
||||
// A node can be both InlinedIntoChild and ParentInlinedIntoSelf. This
|
||||
// happens in multi-level chains: GP → P → C where all are small. C
|
||||
// accepts P (P is InlinedIntoChild), then P also accepts GP (P is
|
||||
// ParentInlinedIntoSelf). The result: C's response includes both P's
|
||||
// and GP's data. The parent's data flows through to the deepest
|
||||
// accepting descendant.
|
||||
if (parentGzipSize !== null) {
|
||||
if (inlinedBytes + parentGzipSize < maxBundleSize) {
|
||||
hints |= _approutertypes.PrefetchHint.ParentInlinedIntoSelf;
|
||||
inlinedBytes += parentGzipSize;
|
||||
}
|
||||
}
|
||||
return {
|
||||
node: {
|
||||
hints,
|
||||
slots
|
||||
},
|
||||
inlinedBytes
|
||||
};
|
||||
}
|
||||
// We use gzip size rather than raw size because it better reflects the actual
|
||||
// transfer cost. The inlining trade-off is about whether the overhead of an
|
||||
// additional HTTP request (connection setup, headers, round trip) is worth
|
||||
// the deduplication benefit of keeping a segment separate. Below some
|
||||
// compressed size, the request overhead dominates and inlining is better.
|
||||
// Above it, the deduplication benefit of a cacheable standalone response
|
||||
// wins out.
|
||||
async function getGzipSize(buffer) {
|
||||
const stream = new Blob([
|
||||
new Uint8Array(buffer)
|
||||
]).stream().pipeThrough(new CompressionStream('gzip'));
|
||||
const compressedBlob = await new Response(stream).blob();
|
||||
return compressedBlob.size;
|
||||
}
|
||||
async function PrefetchTreeData({ isClientParamParsingEnabled, fullPageDataBuffer, serverConsumerManifest, clientModules, staleTime, segmentTasks, onCompletedProcessingRouteTree, prefetchInlining, hints }) {
|
||||
// We're currently rendering a Flight response for the route tree prefetch.
|
||||
// Inside this component, decode the Flight stream for the whole page. This is
|
||||
// a hack to transfer the side effects from the original Flight stream (e.g.
|
||||
// Float preloads) onto the Flight stream for the tree prefetch.
|
||||
// TODO: React needs a better way to do this. Needed for Server Actions, too.
|
||||
const initialRSCPayload = await (0, _client.createFromReadableStream)(createUnclosingPrefetchStream((0, _nodewebstreamshelper.streamFromBuffer)(fullPageDataBuffer)), {
|
||||
findSourceMapURL,
|
||||
serverConsumerManifest
|
||||
});
|
||||
const flightData = extractFlightData(initialRSCPayload);
|
||||
if (flightData === null) {
|
||||
return null;
|
||||
}
|
||||
const { buildId, flightRouterState, seedData, head } = flightData;
|
||||
// Extract the head vary params from the decoded response.
|
||||
// The head vary params thenable should be fulfilled by now; if not, treat
|
||||
// as unknown (null).
|
||||
const headVaryParamsThenable = initialRSCPayload.h;
|
||||
const headVaryParams = headVaryParamsThenable !== null ? (0, _varyparamsdecoding.readVaryParams)(headVaryParamsThenable) : null;
|
||||
// Compute the route metadata tree by traversing the FlightRouterState. As we
|
||||
// walk the tree, we will also spawn a task to produce a prefetch response for
|
||||
// each segment (unless prefetch inlining is enabled, in which case all
|
||||
// segments are bundled into a single /_inlined response).
|
||||
const tree = collectSegmentDataImpl(isClientParamParsingEnabled, flightRouterState, buildId, staleTime, seedData, clientModules, _segmentvalueencoding.ROOT_SEGMENT_REQUEST_KEY, segmentTasks, prefetchInlining, hints);
|
||||
if (prefetchInlining) {
|
||||
// When prefetch inlining is enabled, bundle all segment data into a single
|
||||
// /_inlined response instead of individual per-segment responses. The head
|
||||
// is also included in the inlined response.
|
||||
segmentTasks.push((0, _scheduler.waitAtLeastOneReactRenderTask)().then(()=>renderInlinedPrefetchResponse(flightRouterState, buildId, staleTime, seedData, head, headVaryParams, clientModules)));
|
||||
} else {
|
||||
// Also spawn a task to produce a prefetch response for the "head" segment.
|
||||
// The head contains metadata, like the title; it's not really a route
|
||||
// segment, but it contains RSC data, so it's treated like a segment by
|
||||
// the client cache.
|
||||
segmentTasks.push((0, _scheduler.waitAtLeastOneReactRenderTask)().then(()=>renderSegmentPrefetch(buildId, staleTime, head, _segmentvalueencoding.HEAD_REQUEST_KEY, headVaryParams, clientModules)));
|
||||
}
|
||||
// Notify the abort controller that we're done processing the route tree.
|
||||
// Anything async that happens after this point must be due to hanging
|
||||
// promises in the original stream.
|
||||
onCompletedProcessingRouteTree();
|
||||
// Render the route tree to a special `/_tree` segment.
|
||||
const treePrefetch = {
|
||||
tree,
|
||||
staleTime
|
||||
};
|
||||
if (buildId) {
|
||||
treePrefetch.buildId = buildId;
|
||||
}
|
||||
return treePrefetch;
|
||||
}
|
||||
function collectSegmentDataImpl(isClientParamParsingEnabled, route, buildId, staleTime, seedData, clientModules, requestKey, segmentTasks, prefetchInlining, hintTree) {
|
||||
// Metadata about the segment. Sent as part of the tree prefetch. Null if
|
||||
// there are no children.
|
||||
let slotMetadata = null;
|
||||
const children = route[1];
|
||||
const seedDataChildren = seedData !== null ? seedData[1] : null;
|
||||
for(const parallelRouteKey in children){
|
||||
const childRoute = children[parallelRouteKey];
|
||||
const childSegment = childRoute[0];
|
||||
const childSeedData = seedDataChildren !== null ? seedDataChildren[parallelRouteKey] : null;
|
||||
const childRequestKey = (0, _segmentvalueencoding.appendSegmentRequestKeyPart)(requestKey, parallelRouteKey, (0, _segmentvalueencoding.createSegmentRequestKeyPart)(childSegment));
|
||||
const childHintTree = hintTree !== null && hintTree.slots !== null ? hintTree.slots[parallelRouteKey] ?? null : null;
|
||||
const childTree = collectSegmentDataImpl(isClientParamParsingEnabled, childRoute, buildId, staleTime, childSeedData, clientModules, childRequestKey, segmentTasks, prefetchInlining, childHintTree);
|
||||
if (slotMetadata === null) {
|
||||
slotMetadata = {};
|
||||
}
|
||||
slotMetadata[parallelRouteKey] = childTree;
|
||||
}
|
||||
// Union the hints already embedded in the FlightRouterState with the
|
||||
// separately-computed build-time hints. During the initial build, the
|
||||
// FlightRouterState was produced before collectPrefetchHints ran, so
|
||||
// inlining hints (ParentInlinedIntoSelf, InlinedIntoChild) won't be in
|
||||
// route[4] yet. On subsequent renders the hints are already in the
|
||||
// FlightRouterState, so the union is idempotent.
|
||||
const prefetchHints = (route[4] ?? 0) | (hintTree !== null ? hintTree.hints : 0);
|
||||
// Determine which params this segment varies on.
|
||||
// Read the vary params thenable directly from the seed data. By the time
|
||||
// collectSegmentData runs, the thenable should be fulfilled. If it's not
|
||||
// fulfilled or null, treat as unknown (null means we can't share cache
|
||||
// entries across param values).
|
||||
const varyParamsThenable = seedData !== null ? seedData[4] : null;
|
||||
const varyParams = varyParamsThenable !== null ? (0, _varyparamsdecoding.readVaryParams)(varyParamsThenable) : null;
|
||||
if (!prefetchInlining) {
|
||||
// When prefetch inlining is disabled, spawn individual segment tasks.
|
||||
// When enabled, segment data is bundled into the /_inlined response
|
||||
// instead, so we skip per-segment tasks here.
|
||||
if (seedData !== null) {
|
||||
// Spawn a task to write the segment data to a new Flight stream.
|
||||
segmentTasks.push(// Since we're already in the middle of a render, wait until after the
|
||||
// current task to escape the current rendering context.
|
||||
(0, _scheduler.waitAtLeastOneReactRenderTask)().then(()=>renderSegmentPrefetch(buildId, staleTime, seedData[0], requestKey, varyParams, clientModules)));
|
||||
} else {
|
||||
// This segment does not have any seed data. Skip generating a prefetch
|
||||
// response for it. We'll still include it in the route tree, though.
|
||||
// TODO: We should encode in the route tree whether a segment is missing
|
||||
// so we don't attempt to fetch it for no reason. As of now this shouldn't
|
||||
// ever happen in practice, though.
|
||||
}
|
||||
}
|
||||
const segment = route[0];
|
||||
let name;
|
||||
let param;
|
||||
if (typeof segment === 'string') {
|
||||
name = segment;
|
||||
param = null;
|
||||
} else {
|
||||
name = segment[0];
|
||||
param = {
|
||||
type: segment[2],
|
||||
// This value is omitted from the prefetch response when cacheComponents
|
||||
// is enabled.
|
||||
key: isClientParamParsingEnabled ? null : segment[1],
|
||||
siblings: segment[3]
|
||||
};
|
||||
}
|
||||
// Metadata about the segment. Sent to the client as part of the
|
||||
// tree prefetch.
|
||||
return {
|
||||
name,
|
||||
param,
|
||||
prefetchHints,
|
||||
slots: slotMetadata
|
||||
};
|
||||
}
|
||||
async function renderSegmentPrefetch(buildId, staleTime, rsc, requestKey, varyParams, clientModules) {
|
||||
// Render the segment data to a stream.
|
||||
const segmentPrefetch = {
|
||||
rsc,
|
||||
isPartial: await isPartialRSCData(rsc, clientModules),
|
||||
staleTime,
|
||||
varyParams
|
||||
};
|
||||
if (buildId) {
|
||||
segmentPrefetch.buildId = buildId;
|
||||
}
|
||||
// Since all we're doing is decoding and re-encoding a cached prerender, if
|
||||
// it takes longer than a microtask, it must because of hanging promises
|
||||
// caused by dynamic data. Abort the stream at the end of the current task.
|
||||
const abortController = new AbortController();
|
||||
(0, _scheduler.waitAtLeastOneReactRenderTask)().then(()=>abortController.abort());
|
||||
const { prelude: segmentStream } = await (0, _static.prerender)(segmentPrefetch, clientModules, {
|
||||
filterStackFrame,
|
||||
signal: abortController.signal,
|
||||
onError: onSegmentPrerenderError
|
||||
});
|
||||
const segmentBuffer = await (0, _nodewebstreamshelper.streamToBuffer)(segmentStream);
|
||||
if (requestKey === _segmentvalueencoding.ROOT_SEGMENT_REQUEST_KEY) {
|
||||
return [
|
||||
'/_index',
|
||||
segmentBuffer
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
requestKey,
|
||||
segmentBuffer
|
||||
];
|
||||
}
|
||||
}
|
||||
async function renderInlinedPrefetchResponse(route, buildId, staleTime, seedData, head, headVaryParams, clientModules) {
|
||||
// Build the inlined tree by walking the route and collecting all segments.
|
||||
const inlinedTree = await buildInlinedSegmentPrefetch(route, buildId, staleTime, seedData, clientModules);
|
||||
// Build the head segment.
|
||||
const headPrefetch = {
|
||||
rsc: head,
|
||||
isPartial: await isPartialRSCData(head, clientModules),
|
||||
staleTime,
|
||||
varyParams: headVaryParams
|
||||
};
|
||||
if (buildId) {
|
||||
headPrefetch.buildId = buildId;
|
||||
}
|
||||
const response = {
|
||||
tree: inlinedTree,
|
||||
head: headPrefetch
|
||||
};
|
||||
// Render as a single Flight response.
|
||||
const abortController = new AbortController();
|
||||
(0, _scheduler.waitAtLeastOneReactRenderTask)().then(()=>abortController.abort());
|
||||
const { prelude } = await (0, _static.prerender)(response, clientModules, {
|
||||
filterStackFrame,
|
||||
signal: abortController.signal,
|
||||
onError: onSegmentPrerenderError
|
||||
});
|
||||
const buffer = await (0, _nodewebstreamshelper.streamToBuffer)(prelude);
|
||||
return [
|
||||
'/' + _segment.PAGE_SEGMENT_KEY,
|
||||
buffer
|
||||
];
|
||||
}
|
||||
async function buildInlinedSegmentPrefetch(route, buildId, staleTime, seedData, clientModules) {
|
||||
let slots = null;
|
||||
const children = route[1];
|
||||
const seedDataChildren = seedData !== null ? seedData[1] : null;
|
||||
for(const parallelRouteKey in children){
|
||||
const childRoute = children[parallelRouteKey];
|
||||
const childSeedData = seedDataChildren !== null ? seedDataChildren[parallelRouteKey] : null;
|
||||
const childPrefetch = await buildInlinedSegmentPrefetch(childRoute, buildId, staleTime, childSeedData, clientModules);
|
||||
if (slots === null) {
|
||||
slots = {};
|
||||
}
|
||||
slots[parallelRouteKey] = childPrefetch;
|
||||
}
|
||||
const rsc = seedData !== null ? seedData[0] : null;
|
||||
const varyParamsThenable = seedData !== null ? seedData[4] : null;
|
||||
const varyParams = varyParamsThenable !== null ? (0, _varyparamsdecoding.readVaryParams)(varyParamsThenable) : null;
|
||||
const segment = {
|
||||
rsc,
|
||||
isPartial: rsc !== null ? await isPartialRSCData(rsc, clientModules) : true,
|
||||
staleTime,
|
||||
varyParams
|
||||
};
|
||||
if (buildId) {
|
||||
segment.buildId = buildId;
|
||||
}
|
||||
return {
|
||||
segment,
|
||||
slots
|
||||
};
|
||||
}
|
||||
async function isPartialRSCData(rsc, clientModules) {
|
||||
// We can determine if a segment contains only partial data if it takes longer
|
||||
// than a task to encode, because dynamic data is encoded as an infinite
|
||||
// promise. We must do this in a separate Flight prerender from the one that
|
||||
// actually generates the prefetch stream because we need to include
|
||||
// `isPartial` in the stream itself.
|
||||
let isPartial = false;
|
||||
const abortController = new AbortController();
|
||||
(0, _scheduler.waitAtLeastOneReactRenderTask)().then(()=>{
|
||||
// If we haven't yet finished the outer task, then it must be because we
|
||||
// accessed dynamic data.
|
||||
isPartial = true;
|
||||
abortController.abort();
|
||||
});
|
||||
await (0, _static.prerender)(rsc, clientModules, {
|
||||
filterStackFrame,
|
||||
signal: abortController.signal,
|
||||
onError () {}
|
||||
});
|
||||
return isPartial;
|
||||
}
|
||||
function createUnclosingPrefetchStream(originalFlightStream) {
|
||||
// When PPR is enabled, prefetch streams may contain references that never
|
||||
// resolve, because that's how we encode dynamic data access. In the decoded
|
||||
// object returned by the Flight client, these are reified into hanging
|
||||
// promises that suspend during render, which is effectively what we want.
|
||||
// The UI resolves when it switches to the dynamic data stream
|
||||
// (via useDeferredValue(dynamic, static)).
|
||||
//
|
||||
// However, the Flight implementation currently errors if the server closes
|
||||
// the response before all the references are resolved. As a cheat to work
|
||||
// around this, we wrap the original stream in a new stream that never closes,
|
||||
// and therefore doesn't error.
|
||||
const reader = originalFlightStream.getReader();
|
||||
return new ReadableStream({
|
||||
async pull (controller) {
|
||||
while(true){
|
||||
const { done, value } = await reader.read();
|
||||
if (!done) {
|
||||
// Pass to the target stream and keep consuming the Flight response
|
||||
// from the server.
|
||||
controller.enqueue(value);
|
||||
continue;
|
||||
}
|
||||
// The server stream has closed. Exit, but intentionally do not close
|
||||
// the target stream.
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=collect-segment-data.js.map
|
||||
14
build/node_modules/next/dist/server/app-render/console-async-storage-instance.js
generated
vendored
Normal file
14
build/node_modules/next/dist/server/app-render/console-async-storage-instance.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "consoleAsyncStorageInstance", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return consoleAsyncStorageInstance;
|
||||
}
|
||||
});
|
||||
const _asynclocalstorage = require("./async-local-storage");
|
||||
const consoleAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)();
|
||||
|
||||
//# sourceMappingURL=console-async-storage-instance.js.map
|
||||
13
build/node_modules/next/dist/server/app-render/console-async-storage.external.js
generated
vendored
Normal file
13
build/node_modules/next/dist/server/app-render/console-async-storage.external.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "consoleAsyncStorage", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _consoleasyncstorageinstance.consoleAsyncStorageInstance;
|
||||
}
|
||||
});
|
||||
const _consoleasyncstorageinstance = require("./console-async-storage-instance");
|
||||
|
||||
//# sourceMappingURL=console-async-storage.external.js.map
|
||||
33
build/node_modules/next/dist/server/app-render/create-component-styles-and-scripts.js
generated
vendored
Normal file
33
build/node_modules/next/dist/server/app-render/create-component-styles-and-scripts.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "createComponentStylesAndScripts", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return createComponentStylesAndScripts;
|
||||
}
|
||||
});
|
||||
const _interopdefault = require("./interop-default");
|
||||
const _getcssinlinedlinktags = require("./get-css-inlined-link-tags");
|
||||
const _getassetquerystring = require("./get-asset-query-string");
|
||||
const _encodeuripath = require("../../shared/lib/encode-uri-path");
|
||||
const _rendercssresource = require("./render-css-resource");
|
||||
async function createComponentStylesAndScripts({ filePath, getComponent, injectedCSS, injectedJS, ctx }) {
|
||||
const { componentMod: { createElement } } = ctx;
|
||||
const { styles: entryCssFiles, scripts: jsHrefs } = (0, _getcssinlinedlinktags.getLinkAndScriptTags)(filePath, injectedCSS, injectedJS);
|
||||
const styles = (0, _rendercssresource.renderCssResource)(entryCssFiles, ctx);
|
||||
const scripts = jsHrefs ? jsHrefs.map((href, index)=>createElement('script', {
|
||||
src: `${ctx.assetPrefix}/_next/${(0, _encodeuripath.encodeURIPath)(href)}${(0, _getassetquerystring.getAssetQueryString)(ctx, true)}`,
|
||||
async: true,
|
||||
key: `script-${index}`
|
||||
})) : null;
|
||||
const Comp = (0, _interopdefault.interopDefault)(await getComponent());
|
||||
return [
|
||||
Comp,
|
||||
styles,
|
||||
scripts
|
||||
];
|
||||
}
|
||||
|
||||
//# sourceMappingURL=create-component-styles-and-scripts.js.map
|
||||
870
build/node_modules/next/dist/server/app-render/create-component-tree.js
generated
vendored
Normal file
870
build/node_modules/next/dist/server/app-render/create-component-tree.js
generated
vendored
Normal file
@@ -0,0 +1,870 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
createComponentTree: null,
|
||||
getRootParams: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
createComponentTree: function() {
|
||||
return createComponentTree;
|
||||
},
|
||||
getRootParams: function() {
|
||||
return getRootParams;
|
||||
}
|
||||
});
|
||||
const _clientandserverreferences = require("../../lib/client-and-server-references");
|
||||
const _appdirmodule = require("../lib/app-dir-module");
|
||||
const _interopdefault = require("./interop-default");
|
||||
const _parseloadertree = require("../../shared/lib/router/utils/parse-loader-tree");
|
||||
const _createcomponentstylesandscripts = require("./create-component-styles-and-scripts");
|
||||
const _getlayerassets = require("./get-layer-assets");
|
||||
const _hasloadingcomponentintree = require("./has-loading-component-in-tree");
|
||||
const _patchfetch = require("../lib/patch-fetch");
|
||||
const _default = require("../../client/components/builtin/default");
|
||||
const _tracer = require("../lib/trace/tracer");
|
||||
const _constants = require("../lib/trace/constants");
|
||||
const _staticgenerationbailout = require("../../client/components/static-generation-bailout");
|
||||
const _workunitasyncstorageexternal = require("./work-unit-async-storage.external");
|
||||
const _varyparams = require("./vary-params");
|
||||
const _segment = require("../../shared/lib/segment");
|
||||
const _segmentexplorerpath = require("./segment-explorer-path");
|
||||
const _stagedrendering = require("./staged-rendering");
|
||||
function createComponentTree(props) {
|
||||
return (0, _tracer.getTracer)().trace(_constants.NextNodeServerSpan.createComponentTree, {
|
||||
spanName: 'build component tree'
|
||||
}, ()=>createComponentTreeInternal(props, true));
|
||||
}
|
||||
function errorMissingDefaultExport(pagePath, convention) {
|
||||
const normalizedPagePath = pagePath === '/' ? '' : pagePath;
|
||||
throw Object.defineProperty(new Error(`The default export is not a React Component in "${normalizedPagePath}/${convention}"`), "__NEXT_ERROR_CODE", {
|
||||
value: "E45",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
const cacheNodeKey = 'c';
|
||||
async function createComponentTreeInternal({ loaderTree: tree, parentParams, parentOptionalCatchAllParamName, parentRuntimePrefetchable, rootLayoutIncluded, injectedCSS, injectedJS, injectedFontPreloadTags, ctx, missingSlots, preloadCallbacks, authInterrupts, MetadataOutlet, prerenderHTTPError }, isRoot) {
|
||||
const { renderOpts: { nextConfigOutput, experimental, cacheComponents }, workStore, componentMod: { createElement, Fragment, SegmentViewNode, HTTPAccessFallbackBoundary, LayoutRouter, RenderFromTemplateContext, ClientPageRoot, ClientSegmentRoot, createServerSearchParamsForServerPage, createPrerenderSearchParamsForClientPage, createServerParamsForServerSegment, createPrerenderParamsForClientSegment, serverHooks: { DynamicServerError }, Postpone }, pagePath, getDynamicParamFromSegment, isPrefetch, query } = ctx;
|
||||
const { page, conventionPath, segment, modules, parallelRoutes } = (0, _parseloadertree.parseLoaderTree)(tree);
|
||||
const { layout, template, error, loading, 'not-found': notFound, forbidden, unauthorized } = modules;
|
||||
const injectedCSSWithCurrentLayout = new Set(injectedCSS);
|
||||
const injectedJSWithCurrentLayout = new Set(injectedJS);
|
||||
const injectedFontPreloadTagsWithCurrentLayout = new Set(injectedFontPreloadTags);
|
||||
const layerAssets = (0, _getlayerassets.getLayerAssets)({
|
||||
preloadCallbacks,
|
||||
ctx,
|
||||
layoutOrPagePath: conventionPath,
|
||||
injectedCSS: injectedCSSWithCurrentLayout,
|
||||
injectedJS: injectedJSWithCurrentLayout,
|
||||
injectedFontPreloadTags: injectedFontPreloadTagsWithCurrentLayout
|
||||
});
|
||||
const [Template, templateStyles, templateScripts] = template ? await (0, _createcomponentstylesandscripts.createComponentStylesAndScripts)({
|
||||
ctx,
|
||||
filePath: template[1],
|
||||
getComponent: template[0],
|
||||
injectedCSS: injectedCSSWithCurrentLayout,
|
||||
injectedJS: injectedJSWithCurrentLayout
|
||||
}) : [
|
||||
Fragment
|
||||
];
|
||||
const [ErrorComponent, errorStyles, errorScripts] = error ? await (0, _createcomponentstylesandscripts.createComponentStylesAndScripts)({
|
||||
ctx,
|
||||
filePath: error[1],
|
||||
getComponent: error[0],
|
||||
injectedCSS: injectedCSSWithCurrentLayout,
|
||||
injectedJS: injectedJSWithCurrentLayout
|
||||
}) : [];
|
||||
const [Loading, loadingStyles, loadingScripts] = loading ? await (0, _createcomponentstylesandscripts.createComponentStylesAndScripts)({
|
||||
ctx,
|
||||
filePath: loading[1],
|
||||
getComponent: loading[0],
|
||||
injectedCSS: injectedCSSWithCurrentLayout,
|
||||
injectedJS: injectedJSWithCurrentLayout
|
||||
}) : [];
|
||||
const isLayout = typeof layout !== 'undefined';
|
||||
const isPage = typeof page !== 'undefined';
|
||||
const { mod: layoutOrPageMod, modType } = await (0, _tracer.getTracer)().trace(_constants.NextNodeServerSpan.getLayoutOrPageModule, {
|
||||
hideSpan: !(isLayout || isPage),
|
||||
spanName: 'resolve segment modules',
|
||||
attributes: {
|
||||
'next.segment': segment
|
||||
}
|
||||
}, ()=>(0, _appdirmodule.getLayoutOrPageModule)(tree));
|
||||
/**
|
||||
* Checks if the current segment is a root layout.
|
||||
*/ const rootLayoutAtThisLevel = isLayout && !rootLayoutIncluded;
|
||||
/**
|
||||
* Checks if the current segment or any level above it has a root layout.
|
||||
*/ const rootLayoutIncludedAtThisLevelOrAbove = rootLayoutIncluded || rootLayoutAtThisLevel;
|
||||
const [NotFound, notFoundStyles] = notFound ? await (0, _createcomponentstylesandscripts.createComponentStylesAndScripts)({
|
||||
ctx,
|
||||
filePath: notFound[1],
|
||||
getComponent: notFound[0],
|
||||
injectedCSS: injectedCSSWithCurrentLayout,
|
||||
injectedJS: injectedJSWithCurrentLayout
|
||||
}) : [];
|
||||
const instantConfig = layoutOrPageMod ? layoutOrPageMod.unstable_instant : undefined;
|
||||
const hasRuntimePrefetch = instantConfig && typeof instantConfig === 'object' ? instantConfig.prefetch === 'runtime' : false;
|
||||
const isRuntimePrefetchable = hasRuntimePrefetch || parentRuntimePrefetchable;
|
||||
const [Forbidden, forbiddenStyles] = authInterrupts && forbidden ? await (0, _createcomponentstylesandscripts.createComponentStylesAndScripts)({
|
||||
ctx,
|
||||
filePath: forbidden[1],
|
||||
getComponent: forbidden[0],
|
||||
injectedCSS: injectedCSSWithCurrentLayout,
|
||||
injectedJS: injectedJSWithCurrentLayout
|
||||
}) : [];
|
||||
const [Unauthorized, unauthorizedStyles] = authInterrupts && unauthorized ? await (0, _createcomponentstylesandscripts.createComponentStylesAndScripts)({
|
||||
ctx,
|
||||
filePath: unauthorized[1],
|
||||
getComponent: unauthorized[0],
|
||||
injectedCSS: injectedCSSWithCurrentLayout,
|
||||
injectedJS: injectedJSWithCurrentLayout
|
||||
}) : [];
|
||||
let dynamic = layoutOrPageMod == null ? void 0 : layoutOrPageMod.dynamic;
|
||||
if (nextConfigOutput === 'export') {
|
||||
if (!dynamic || dynamic === 'auto') {
|
||||
dynamic = 'error';
|
||||
} else if (dynamic === 'force-dynamic') {
|
||||
// force-dynamic is always incompatible with 'export'. We must interrupt the build
|
||||
throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Page with \`dynamic = "force-dynamic"\` couldn't be exported. \`output: "export"\` requires all pages be renderable statically because there is no runtime server to dynamically render routes in this output format. Learn more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports`), "__NEXT_ERROR_CODE", {
|
||||
value: "E527",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
if (typeof dynamic === 'string') {
|
||||
// the nested most config wins so we only force-static
|
||||
// if it's configured above any parent that configured
|
||||
// otherwise
|
||||
if (dynamic === 'error') {
|
||||
workStore.dynamicShouldError = true;
|
||||
} else if (dynamic === 'force-dynamic') {
|
||||
workStore.forceDynamic = true;
|
||||
// TODO: (PPR) remove this bailout once PPR is the default
|
||||
if (workStore.isStaticGeneration && !experimental.isRoutePPREnabled) {
|
||||
// If the postpone API isn't available, we can't postpone the render and
|
||||
// therefore we can't use the dynamic API.
|
||||
const err = Object.defineProperty(new DynamicServerError(`Page with \`dynamic = "force-dynamic"\` won't be rendered statically.`), "__NEXT_ERROR_CODE", {
|
||||
value: "E585",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
workStore.dynamicUsageDescription = err.message;
|
||||
workStore.dynamicUsageStack = err.stack;
|
||||
throw err;
|
||||
}
|
||||
} else {
|
||||
workStore.dynamicShouldError = false;
|
||||
workStore.forceStatic = dynamic === 'force-static';
|
||||
}
|
||||
}
|
||||
if (typeof (layoutOrPageMod == null ? void 0 : layoutOrPageMod.fetchCache) === 'string') {
|
||||
workStore.fetchCache = layoutOrPageMod == null ? void 0 : layoutOrPageMod.fetchCache;
|
||||
}
|
||||
if (typeof (layoutOrPageMod == null ? void 0 : layoutOrPageMod.revalidate) !== 'undefined') {
|
||||
(0, _patchfetch.validateRevalidate)(layoutOrPageMod == null ? void 0 : layoutOrPageMod.revalidate, workStore.route);
|
||||
}
|
||||
if (typeof (layoutOrPageMod == null ? void 0 : layoutOrPageMod.revalidate) === 'number') {
|
||||
const defaultRevalidate = layoutOrPageMod.revalidate;
|
||||
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
||||
if (workUnitStore) {
|
||||
switch(workUnitStore.type){
|
||||
case 'prerender':
|
||||
case 'prerender-runtime':
|
||||
case 'prerender-legacy':
|
||||
case 'prerender-ppr':
|
||||
if (workUnitStore.revalidate > defaultRevalidate) {
|
||||
workUnitStore.revalidate = defaultRevalidate;
|
||||
}
|
||||
break;
|
||||
case 'request':
|
||||
break;
|
||||
// createComponentTree is not called for these stores:
|
||||
case 'cache':
|
||||
case 'private-cache':
|
||||
case 'prerender-client':
|
||||
case 'validation-client':
|
||||
case 'unstable-cache':
|
||||
case 'generate-static-params':
|
||||
break;
|
||||
default:
|
||||
workUnitStore;
|
||||
}
|
||||
}
|
||||
if (!workStore.forceStatic && workStore.isStaticGeneration && defaultRevalidate === 0 && // If the postpone API isn't available, we can't postpone the render and
|
||||
// therefore we can't use the dynamic API.
|
||||
!experimental.isRoutePPREnabled) {
|
||||
const dynamicUsageDescription = `revalidate: 0 configured ${segment}`;
|
||||
workStore.dynamicUsageDescription = dynamicUsageDescription;
|
||||
throw Object.defineProperty(new DynamicServerError(dynamicUsageDescription), "__NEXT_ERROR_CODE", {
|
||||
value: "E1005",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
// Read unstable_dynamicStaleTime from page modules (not layouts) and track it on
|
||||
// the store's stale field. This affects the segment cache stale time via
|
||||
// the StaleTimeIterable.
|
||||
if (isPage && typeof (layoutOrPageMod == null ? void 0 : layoutOrPageMod.unstable_dynamicStaleTime) === 'number') {
|
||||
const pageStaleTime = layoutOrPageMod.unstable_dynamicStaleTime;
|
||||
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
||||
if (workUnitStore) {
|
||||
switch(workUnitStore.type){
|
||||
case 'prerender':
|
||||
case 'prerender-runtime':
|
||||
case 'prerender-legacy':
|
||||
case 'prerender-ppr':
|
||||
if (workUnitStore.stale > pageStaleTime) {
|
||||
workUnitStore.stale = pageStaleTime;
|
||||
}
|
||||
break;
|
||||
case 'request':
|
||||
if (workUnitStore.stale === undefined || workUnitStore.stale > pageStaleTime) {
|
||||
workUnitStore.stale = pageStaleTime;
|
||||
}
|
||||
break;
|
||||
// createComponentTree is not called for these stores:
|
||||
case 'cache':
|
||||
case 'private-cache':
|
||||
case 'prerender-client':
|
||||
case 'validation-client':
|
||||
case 'unstable-cache':
|
||||
case 'generate-static-params':
|
||||
break;
|
||||
default:
|
||||
workUnitStore;
|
||||
}
|
||||
}
|
||||
}
|
||||
const isStaticGeneration = workStore.isStaticGeneration;
|
||||
// Assume the segment we're rendering contains only partial data if PPR is
|
||||
// enabled and this is a statically generated response. This is used by the
|
||||
// client Segment Cache after a prefetch to determine if it can skip the
|
||||
// second request to fill in the dynamic data.
|
||||
//
|
||||
// It's OK for this to be `true` when the data is actually fully static, but
|
||||
// it's not OK for this to be `false` when the data possibly contains holes.
|
||||
// Although the value here is overly pessimistic, for prefetches, it will be
|
||||
// replaced by a more specific value when the data is later processed into
|
||||
// per-segment responses (see collect-segment-data.tsx)
|
||||
//
|
||||
// For dynamic requests, this must always be `false` because dynamic responses
|
||||
// are never partial.
|
||||
const isPossiblyPartialResponse = isStaticGeneration && experimental.isRoutePPREnabled === true;
|
||||
const LayoutOrPage = layoutOrPageMod ? (0, _interopdefault.interopDefault)(layoutOrPageMod) : undefined;
|
||||
/**
|
||||
* The React Component to render.
|
||||
*/ let MaybeComponent = LayoutOrPage;
|
||||
if (process.env.NODE_ENV === 'development' || isStaticGeneration) {
|
||||
const { isValidElementType } = require('next/dist/compiled/react-is');
|
||||
if (typeof MaybeComponent !== 'undefined' && !isValidElementType(MaybeComponent)) {
|
||||
errorMissingDefaultExport(pagePath, modType ?? 'page');
|
||||
}
|
||||
if (typeof ErrorComponent !== 'undefined' && !isValidElementType(ErrorComponent)) {
|
||||
errorMissingDefaultExport(pagePath, 'error');
|
||||
}
|
||||
if (typeof Loading !== 'undefined' && !isValidElementType(Loading)) {
|
||||
errorMissingDefaultExport(pagePath, 'loading');
|
||||
}
|
||||
if (typeof NotFound !== 'undefined' && !isValidElementType(NotFound)) {
|
||||
errorMissingDefaultExport(pagePath, 'not-found');
|
||||
}
|
||||
if (typeof Forbidden !== 'undefined' && !isValidElementType(Forbidden)) {
|
||||
errorMissingDefaultExport(pagePath, 'forbidden');
|
||||
}
|
||||
if (typeof Unauthorized !== 'undefined' && !isValidElementType(Unauthorized)) {
|
||||
errorMissingDefaultExport(pagePath, 'unauthorized');
|
||||
}
|
||||
}
|
||||
// Handle dynamic segment params.
|
||||
const segmentParam = getDynamicParamFromSegment(tree);
|
||||
// Create object holding the parent params and current params
|
||||
let currentParams = parentParams;
|
||||
if (segmentParam && segmentParam.value !== null) {
|
||||
currentParams = {
|
||||
...parentParams,
|
||||
[segmentParam.param]: segmentParam.value
|
||||
};
|
||||
}
|
||||
// Track optional catch-all params with no value (e.g., [[...slug]] at /).
|
||||
// These params won't exist as properties on the params object, so vary
|
||||
// params tracking needs to use a Proxy to detect access. We propagate this
|
||||
// through the tree so that child segments (like __PAGE__) also know about
|
||||
// the missing param. In practice, this only gets passed down one level —
|
||||
// from the optional catch-all layout segment to the page segment — so it's
|
||||
// always very close to the leaf of the tree.
|
||||
const optionalCatchAllParamName = (segmentParam == null ? void 0 : segmentParam.type) === 'oc' && segmentParam.value === null ? segmentParam.param : parentOptionalCatchAllParamName;
|
||||
// Resolve the segment param
|
||||
const isSegmentViewEnabled = !!process.env.__NEXT_DEV_SERVER;
|
||||
const dir = (process.env.NEXT_RUNTIME === 'edge' ? process.env.__NEXT_EDGE_PROJECT_DIR : ctx.renderOpts.dir) || '';
|
||||
const [notFoundElement, notFoundFilePath] = await createBoundaryConventionElement({
|
||||
ctx,
|
||||
conventionName: 'not-found',
|
||||
Component: NotFound,
|
||||
styles: notFoundStyles,
|
||||
tree
|
||||
});
|
||||
const [forbiddenElement] = await createBoundaryConventionElement({
|
||||
ctx,
|
||||
conventionName: 'forbidden',
|
||||
Component: Forbidden,
|
||||
styles: forbiddenStyles,
|
||||
tree
|
||||
});
|
||||
const [unauthorizedElement] = await createBoundaryConventionElement({
|
||||
ctx,
|
||||
conventionName: 'unauthorized',
|
||||
Component: Unauthorized,
|
||||
styles: unauthorizedStyles,
|
||||
tree
|
||||
});
|
||||
// TODO: Combine this `map` traversal with the loop below that turns the array
|
||||
// into an object.
|
||||
const parallelRouteMap = await Promise.all(Object.keys(parallelRoutes).map(async (parallelRouteKey)=>{
|
||||
const isChildrenRouteKey = parallelRouteKey === 'children';
|
||||
const parallelRoute = parallelRoutes[parallelRouteKey];
|
||||
const notFoundComponent = isChildrenRouteKey ? notFoundElement : undefined;
|
||||
const forbiddenComponent = isChildrenRouteKey ? forbiddenElement : undefined;
|
||||
const unauthorizedComponent = isChildrenRouteKey ? unauthorizedElement : undefined;
|
||||
// if we're prefetching and that there's a Loading component, we bail out
|
||||
// otherwise we keep rendering for the prefetch.
|
||||
// We also want to bail out if there's no Loading component in the tree.
|
||||
let childCacheNodeSeedData = null;
|
||||
if (// Before PPR, the way instant navigations work in Next.js is we
|
||||
// prefetch everything up to the first route segment that defines a
|
||||
// loading.tsx boundary. (We do the same if there's no loading
|
||||
// boundary in the entire tree, because we don't want to prefetch too
|
||||
// much) The rest of the tree is deferred until the actual navigation.
|
||||
// It does not take into account whether the data is dynamic — even if
|
||||
// the tree is completely static, it will still defer everything
|
||||
// inside the loading boundary.
|
||||
//
|
||||
// This behavior predates PPR and is only relevant if the
|
||||
// PPR flag is not enabled.
|
||||
isPrefetch && (Loading || !(0, _hasloadingcomponentintree.hasLoadingComponentInTree)(parallelRoute)) && // The approach with PPR is different — loading.tsx behaves like a
|
||||
// regular Suspense boundary and has no special behavior.
|
||||
//
|
||||
// With PPR, we prefetch as deeply as possible, and only defer when
|
||||
// dynamic data is accessed. If so, we only defer the nearest parent
|
||||
// Suspense boundary of the dynamic data access, regardless of whether
|
||||
// the boundary is defined by loading.tsx or a normal <Suspense>
|
||||
// component in userspace.
|
||||
//
|
||||
// NOTE: In practice this usually means we'll end up prefetching more
|
||||
// than we were before PPR, which may or may not be considered a
|
||||
// performance regression by some apps. The plan is to address this
|
||||
// before General Availability of PPR by introducing granular
|
||||
// per-segment fetching, so we can reuse as much of the tree as
|
||||
// possible during both prefetches and dynamic navigations. But during
|
||||
// the beta period, we should be clear about this trade off in our
|
||||
// communications.
|
||||
!experimental.isRoutePPREnabled) {
|
||||
// Don't prefetch this child. This will trigger a lazy fetch by the
|
||||
// client router.
|
||||
} else {
|
||||
// Create the child component
|
||||
if (process.env.NODE_ENV === 'development' && missingSlots) {
|
||||
var _parsedTree_conventionPath;
|
||||
// When we detect the default fallback (which triggers a 404), we collect the missing slots
|
||||
// to provide more helpful debug information during development mode.
|
||||
const parsedTree = (0, _parseloadertree.parseLoaderTree)(parallelRoute);
|
||||
if ((_parsedTree_conventionPath = parsedTree.conventionPath) == null ? void 0 : _parsedTree_conventionPath.endsWith(_default.PARALLEL_ROUTE_DEFAULT_PATH)) {
|
||||
missingSlots.add(parallelRouteKey);
|
||||
}
|
||||
}
|
||||
// The outer prerender catch already found the deepest segment whose
|
||||
// HTTP fallback should replace the throwing page. When we reach that
|
||||
// segment's `children` slot, render the fallback directly instead of
|
||||
// descending back into the subtree that threw during deserialization.
|
||||
// Like the other segment-level boundary props below, HTTP access
|
||||
// fallbacks are attached to the default `children` slot, not to named
|
||||
// parallel routes.
|
||||
const shouldRenderPrerenderHTTPFallback = (prerenderHTTPError == null ? void 0 : prerenderHTTPError.boundaryTree) === tree && isChildrenRouteKey;
|
||||
if (shouldRenderPrerenderHTTPFallback) {
|
||||
let fallbackElement;
|
||||
switch(prerenderHTTPError.triggeredStatus){
|
||||
case 404:
|
||||
fallbackElement = notFoundElement;
|
||||
break;
|
||||
case 403:
|
||||
fallbackElement = forbiddenElement;
|
||||
break;
|
||||
case 401:
|
||||
fallbackElement = unauthorizedElement;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (fallbackElement) {
|
||||
childCacheNodeSeedData = createSeedData(ctx, fallbackElement, {}, null, isPossiblyPartialResponse, false, _varyparams.emptyVaryParamsAccumulator);
|
||||
}
|
||||
}
|
||||
if (childCacheNodeSeedData === null) {
|
||||
const seedData = await createComponentTreeInternal({
|
||||
loaderTree: parallelRoute,
|
||||
parentParams: currentParams,
|
||||
parentOptionalCatchAllParamName: optionalCatchAllParamName,
|
||||
parentRuntimePrefetchable: isRuntimePrefetchable,
|
||||
rootLayoutIncluded: rootLayoutIncludedAtThisLevelOrAbove,
|
||||
injectedCSS: injectedCSSWithCurrentLayout,
|
||||
injectedJS: injectedJSWithCurrentLayout,
|
||||
injectedFontPreloadTags: injectedFontPreloadTagsWithCurrentLayout,
|
||||
ctx,
|
||||
missingSlots,
|
||||
preloadCallbacks,
|
||||
authInterrupts,
|
||||
// `StreamingMetadataOutlet` is used to conditionally throw. In the case of parallel routes we will have more than one page
|
||||
// but we only want to throw on the first one.
|
||||
MetadataOutlet: isChildrenRouteKey ? MetadataOutlet : null,
|
||||
prerenderHTTPError
|
||||
}, false);
|
||||
childCacheNodeSeedData = seedData;
|
||||
}
|
||||
}
|
||||
const templateNode = createElement(Template, null, createElement(RenderFromTemplateContext, null));
|
||||
const templateFilePath = (0, _segmentexplorerpath.getConventionPathByType)(tree, dir, 'template');
|
||||
const errorFilePath = (0, _segmentexplorerpath.getConventionPathByType)(tree, dir, 'error');
|
||||
const loadingFilePath = (0, _segmentexplorerpath.getConventionPathByType)(tree, dir, 'loading');
|
||||
const globalErrorFilePath = isRoot ? (0, _segmentexplorerpath.getConventionPathByType)(tree, dir, 'global-error') : undefined;
|
||||
const wrappedErrorStyles = isSegmentViewEnabled && errorFilePath ? createElement(SegmentViewNode, {
|
||||
type: 'error',
|
||||
pagePath: errorFilePath
|
||||
}, errorStyles) : errorStyles;
|
||||
// Add a suffix to avoid conflict with the segment view node representing rendered file.
|
||||
// existence: not-found.tsx@boundary
|
||||
// rendered: not-found.tsx
|
||||
const fileNameSuffix = _segmentexplorerpath.BOUNDARY_SUFFIX;
|
||||
const segmentViewBoundaries = isSegmentViewEnabled ? createElement(Fragment, null, notFoundFilePath && createElement(SegmentViewNode, {
|
||||
type: `${_segmentexplorerpath.BOUNDARY_PREFIX}not-found`,
|
||||
pagePath: notFoundFilePath + fileNameSuffix
|
||||
}), loadingFilePath && createElement(SegmentViewNode, {
|
||||
type: `${_segmentexplorerpath.BOUNDARY_PREFIX}loading`,
|
||||
pagePath: loadingFilePath + fileNameSuffix
|
||||
}), errorFilePath && createElement(SegmentViewNode, {
|
||||
type: `${_segmentexplorerpath.BOUNDARY_PREFIX}error`,
|
||||
pagePath: errorFilePath + fileNameSuffix
|
||||
}), globalErrorFilePath && createElement(SegmentViewNode, {
|
||||
type: `${_segmentexplorerpath.BOUNDARY_PREFIX}global-error`,
|
||||
pagePath: (0, _segmentexplorerpath.isNextjsBuiltinFilePath)(globalErrorFilePath) ? `${_segmentexplorerpath.BUILTIN_PREFIX}global-error.js${fileNameSuffix}` : globalErrorFilePath
|
||||
})) : null;
|
||||
return [
|
||||
parallelRouteKey,
|
||||
createElement(LayoutRouter, {
|
||||
parallelRouterKey: parallelRouteKey,
|
||||
error: ErrorComponent,
|
||||
errorStyles: wrappedErrorStyles,
|
||||
errorScripts: errorScripts,
|
||||
template: isSegmentViewEnabled && templateFilePath ? createElement(SegmentViewNode, {
|
||||
type: 'template',
|
||||
pagePath: templateFilePath
|
||||
}, templateNode) : templateNode,
|
||||
templateStyles: templateStyles,
|
||||
templateScripts: templateScripts,
|
||||
notFound: notFoundComponent,
|
||||
forbidden: forbiddenComponent,
|
||||
unauthorized: unauthorizedComponent,
|
||||
...isSegmentViewEnabled && {
|
||||
segmentViewBoundaries
|
||||
}
|
||||
}),
|
||||
childCacheNodeSeedData
|
||||
];
|
||||
}));
|
||||
// Convert the parallel route map into an object after all promises have been resolved.
|
||||
let parallelRouteProps = {};
|
||||
let parallelRouteCacheNodeSeedData = {};
|
||||
for (const parallelRoute of parallelRouteMap){
|
||||
const [parallelRouteKey, parallelRouteProp, flightData] = parallelRoute;
|
||||
parallelRouteProps[parallelRouteKey] = parallelRouteProp;
|
||||
parallelRouteCacheNodeSeedData[parallelRouteKey] = flightData;
|
||||
}
|
||||
let loadingElement = Loading ? createElement(Loading, {
|
||||
key: 'l'
|
||||
}) : null;
|
||||
const loadingFilePath = (0, _segmentexplorerpath.getConventionPathByType)(tree, dir, 'loading');
|
||||
if (isSegmentViewEnabled && loadingElement) {
|
||||
if (loadingFilePath) {
|
||||
loadingElement = createElement(SegmentViewNode, {
|
||||
key: cacheNodeKey + '-loading',
|
||||
type: 'loading',
|
||||
pagePath: loadingFilePath
|
||||
}, loadingElement);
|
||||
}
|
||||
}
|
||||
const loadingData = loadingElement ? [
|
||||
loadingElement,
|
||||
loadingStyles,
|
||||
loadingScripts
|
||||
] : null;
|
||||
// When the segment does not have a layout or page we still have to add the layout router to ensure the path holds the loading component
|
||||
if (!MaybeComponent) {
|
||||
return createSeedData(ctx, createElement(Fragment, {
|
||||
key: cacheNodeKey
|
||||
}, layerAssets, parallelRouteProps.children), parallelRouteCacheNodeSeedData, loadingData, isPossiblyPartialResponse, isRuntimePrefetchable, // No user-provided component, so no params will be accessed. Use the
|
||||
// pre-resolved empty tracker.
|
||||
_varyparams.emptyVaryParamsAccumulator);
|
||||
}
|
||||
const Component = MaybeComponent;
|
||||
// If force-dynamic is used and the current render supports postponing, we
|
||||
// replace it with a node that will postpone the render. This ensures that the
|
||||
// postpone is invoked during the react render phase and not during the next
|
||||
// render phase.
|
||||
// @TODO this does not actually do what it seems like it would or should do. The idea is that
|
||||
// if we are rendering in a force-dynamic mode and we can postpone we should only make the segments
|
||||
// that ask for force-dynamic to be dynamic, allowing other segments to still prerender. However
|
||||
// because this comes after the children traversal and the static generation store is mutated every segment
|
||||
// along the parent path of a force-dynamic segment will hit this condition effectively making the entire
|
||||
// render force-dynamic. We should refactor this function so that we can correctly track which segments
|
||||
// need to be dynamic
|
||||
if (workStore.isStaticGeneration && workStore.forceDynamic && experimental.isRoutePPREnabled) {
|
||||
return createSeedData(ctx, createElement(Fragment, {
|
||||
key: cacheNodeKey
|
||||
}, createElement(Postpone, {
|
||||
reason: 'dynamic = "force-dynamic" was used',
|
||||
route: workStore.route
|
||||
}), layerAssets), parallelRouteCacheNodeSeedData, loadingData, true, isRuntimePrefetchable, // force-dynamic postpones without rendering the component, so no params
|
||||
// are accessed. The vary params are empty.
|
||||
_varyparams.emptyVaryParamsAccumulator);
|
||||
}
|
||||
const isClientComponent = (0, _clientandserverreferences.isClientReference)(layoutOrPageMod);
|
||||
const varyParamsAccumulator = isClientComponent && cacheComponents ? // from the server, so they have an empty vary params set.
|
||||
_varyparams.emptyVaryParamsAccumulator : (0, _varyparams.createVaryParamsAccumulator)();
|
||||
if (process.env.NODE_ENV === 'development' && 'params' in parallelRouteProps) {
|
||||
// @TODO consider making this an error and running the check in build as well
|
||||
console.error(`"params" is a reserved prop in Layouts and Pages and cannot be used as the name of a parallel route in ${segment}`);
|
||||
}
|
||||
if (isPage) {
|
||||
const PageComponent = Component;
|
||||
// Assign searchParams to props if this is a page
|
||||
let pageElement;
|
||||
if (isClientComponent) {
|
||||
if (cacheComponents) {
|
||||
// Params are omitted when Cache Components is enabled
|
||||
pageElement = createElement(ClientPageRoot, {
|
||||
Component: PageComponent,
|
||||
serverProvidedParams: null
|
||||
});
|
||||
} else if (isStaticGeneration) {
|
||||
const promiseOfParams = createPrerenderParamsForClientSegment(currentParams);
|
||||
const promiseOfSearchParams = createPrerenderSearchParamsForClientPage();
|
||||
pageElement = createElement(ClientPageRoot, {
|
||||
Component: PageComponent,
|
||||
serverProvidedParams: {
|
||||
searchParams: query,
|
||||
params: currentParams,
|
||||
promises: [
|
||||
promiseOfSearchParams,
|
||||
promiseOfParams
|
||||
]
|
||||
}
|
||||
});
|
||||
} else {
|
||||
pageElement = createElement(ClientPageRoot, {
|
||||
Component: PageComponent,
|
||||
serverProvidedParams: {
|
||||
searchParams: query,
|
||||
params: currentParams,
|
||||
promises: null
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// If we are passing params to a server component Page we need to track
|
||||
// their usage in case the current render mode tracks dynamic API usage.
|
||||
const params = createServerParamsForServerSegment(currentParams, optionalCatchAllParamName, varyParamsAccumulator, isRuntimePrefetchable);
|
||||
// If we are passing searchParams to a server component Page we need to
|
||||
// track their usage in case the current render mode tracks dynamic API
|
||||
// usage.
|
||||
let searchParams = createServerSearchParamsForServerPage(query, varyParamsAccumulator, isRuntimePrefetchable);
|
||||
if ((0, _clientandserverreferences.isUseCacheFunction)(PageComponent)) {
|
||||
const UseCachePageComponent = PageComponent;
|
||||
pageElement = createElement(UseCachePageComponent, {
|
||||
params: params,
|
||||
searchParams: searchParams,
|
||||
$$isPage: true
|
||||
});
|
||||
} else {
|
||||
pageElement = createElement(PageComponent, {
|
||||
params: params,
|
||||
searchParams: searchParams
|
||||
});
|
||||
}
|
||||
}
|
||||
const isDefaultSegment = segment === _segment.DEFAULT_SEGMENT_KEY;
|
||||
const pageFilePath = (0, _segmentexplorerpath.getConventionPathByType)(tree, dir, 'page') ?? (0, _segmentexplorerpath.getConventionPathByType)(tree, dir, 'defaultPage');
|
||||
const segmentType = isDefaultSegment ? 'default' : 'page';
|
||||
const wrappedPageElement = isSegmentViewEnabled && pageFilePath ? createElement(SegmentViewNode, {
|
||||
key: cacheNodeKey + '-' + segmentType,
|
||||
type: segmentType,
|
||||
pagePath: pageFilePath
|
||||
}, pageElement) : pageElement;
|
||||
return createSeedData(ctx, createElement(Fragment, {
|
||||
key: cacheNodeKey
|
||||
}, wrappedPageElement, layerAssets, MetadataOutlet ? createElement(MetadataOutlet, null) : null), parallelRouteCacheNodeSeedData, loadingData, isPossiblyPartialResponse, isRuntimePrefetchable, varyParamsAccumulator);
|
||||
} else {
|
||||
const SegmentComponent = Component;
|
||||
const isRootLayoutWithChildrenSlotAndAtLeastOneMoreSlot = rootLayoutAtThisLevel && 'children' in parallelRoutes && Object.keys(parallelRoutes).length > 1;
|
||||
let segmentNode;
|
||||
if (isClientComponent) {
|
||||
let clientSegment;
|
||||
if (cacheComponents) {
|
||||
// Params are omitted when Cache Components is enabled
|
||||
clientSegment = createElement(ClientSegmentRoot, {
|
||||
Component: SegmentComponent,
|
||||
slots: parallelRouteProps,
|
||||
serverProvidedParams: null
|
||||
});
|
||||
} else if (isStaticGeneration) {
|
||||
const promiseOfParams = createPrerenderParamsForClientSegment(currentParams);
|
||||
clientSegment = createElement(ClientSegmentRoot, {
|
||||
Component: SegmentComponent,
|
||||
slots: parallelRouteProps,
|
||||
serverProvidedParams: {
|
||||
params: currentParams,
|
||||
promises: [
|
||||
promiseOfParams
|
||||
]
|
||||
}
|
||||
});
|
||||
} else {
|
||||
clientSegment = createElement(ClientSegmentRoot, {
|
||||
Component: SegmentComponent,
|
||||
slots: parallelRouteProps,
|
||||
serverProvidedParams: {
|
||||
params: currentParams,
|
||||
promises: null
|
||||
}
|
||||
});
|
||||
}
|
||||
if (isRootLayoutWithChildrenSlotAndAtLeastOneMoreSlot) {
|
||||
let notfoundClientSegment;
|
||||
let forbiddenClientSegment;
|
||||
let unauthorizedClientSegment;
|
||||
// TODO-APP: This is a hack to support unmatched parallel routes, which will throw `notFound()`.
|
||||
// This ensures that a `HTTPAccessFallbackBoundary` is available for when that happens,
|
||||
// but it's not ideal, as it needlessly invokes the `NotFound` component and renders the `RootLayout` twice.
|
||||
// We should instead look into handling the fallback behavior differently in development mode so that it doesn't
|
||||
// rely on the `NotFound` behavior.
|
||||
notfoundClientSegment = createErrorBoundaryClientSegmentRoot({
|
||||
ctx,
|
||||
ErrorBoundaryComponent: NotFound,
|
||||
errorElement: notFoundElement,
|
||||
ClientSegmentRoot,
|
||||
layerAssets,
|
||||
SegmentComponent,
|
||||
currentParams
|
||||
});
|
||||
forbiddenClientSegment = createErrorBoundaryClientSegmentRoot({
|
||||
ctx,
|
||||
ErrorBoundaryComponent: Forbidden,
|
||||
errorElement: forbiddenElement,
|
||||
ClientSegmentRoot,
|
||||
layerAssets,
|
||||
SegmentComponent,
|
||||
currentParams
|
||||
});
|
||||
unauthorizedClientSegment = createErrorBoundaryClientSegmentRoot({
|
||||
ctx,
|
||||
ErrorBoundaryComponent: Unauthorized,
|
||||
errorElement: unauthorizedElement,
|
||||
ClientSegmentRoot,
|
||||
layerAssets,
|
||||
SegmentComponent,
|
||||
currentParams
|
||||
});
|
||||
if (notfoundClientSegment || forbiddenClientSegment || unauthorizedClientSegment) {
|
||||
segmentNode = createElement(HTTPAccessFallbackBoundary, {
|
||||
key: cacheNodeKey,
|
||||
notFound: notfoundClientSegment,
|
||||
forbidden: forbiddenClientSegment,
|
||||
unauthorized: unauthorizedClientSegment
|
||||
}, layerAssets, clientSegment);
|
||||
} else {
|
||||
segmentNode = createElement(Fragment, {
|
||||
key: cacheNodeKey
|
||||
}, layerAssets, clientSegment);
|
||||
}
|
||||
} else {
|
||||
segmentNode = createElement(Fragment, {
|
||||
key: cacheNodeKey
|
||||
}, layerAssets, clientSegment);
|
||||
}
|
||||
} else {
|
||||
const params = createServerParamsForServerSegment(currentParams, optionalCatchAllParamName, varyParamsAccumulator, isRuntimePrefetchable);
|
||||
let serverSegment;
|
||||
if ((0, _clientandserverreferences.isUseCacheFunction)(SegmentComponent)) {
|
||||
const UseCacheLayoutComponent = SegmentComponent;
|
||||
serverSegment = createElement(UseCacheLayoutComponent, {
|
||||
...parallelRouteProps,
|
||||
params: params,
|
||||
$$isLayout: true
|
||||
}, // Force static children here so that they're validated.
|
||||
// See https://github.com/facebook/react/pull/34846
|
||||
parallelRouteProps.children);
|
||||
} else {
|
||||
serverSegment = createElement(SegmentComponent, {
|
||||
...parallelRouteProps,
|
||||
params: params
|
||||
}, // Force static children here so that they're validated.
|
||||
// See https://github.com/facebook/react/pull/34846
|
||||
parallelRouteProps.children);
|
||||
}
|
||||
if (isRootLayoutWithChildrenSlotAndAtLeastOneMoreSlot) {
|
||||
// TODO-APP: This is a hack to support unmatched parallel routes, which will throw `notFound()`.
|
||||
// This ensures that a `HTTPAccessFallbackBoundary` is available for when that happens,
|
||||
// but it's not ideal, as it needlessly invokes the `NotFound` component and renders the `RootLayout` twice.
|
||||
// We should instead look into handling the fallback behavior differently in development mode so that it doesn't
|
||||
// rely on the `NotFound` behavior.
|
||||
segmentNode = createElement(HTTPAccessFallbackBoundary, {
|
||||
key: cacheNodeKey,
|
||||
notFound: notFoundElement ? createElement(Fragment, null, layerAssets, createElement(SegmentComponent, {
|
||||
params: params
|
||||
}, notFoundStyles, notFoundElement)) : undefined
|
||||
}, layerAssets, serverSegment);
|
||||
} else {
|
||||
segmentNode = createElement(Fragment, {
|
||||
key: cacheNodeKey
|
||||
}, layerAssets, serverSegment);
|
||||
}
|
||||
}
|
||||
const layoutFilePath = (0, _segmentexplorerpath.getConventionPathByType)(tree, dir, 'layout');
|
||||
const wrappedSegmentNode = isSegmentViewEnabled && layoutFilePath ? createElement(SegmentViewNode, {
|
||||
key: 'layout',
|
||||
type: 'layout',
|
||||
pagePath: layoutFilePath
|
||||
}, segmentNode) : segmentNode;
|
||||
// For layouts we just render the component
|
||||
return createSeedData(ctx, wrappedSegmentNode, parallelRouteCacheNodeSeedData, loadingData, isPossiblyPartialResponse, isRuntimePrefetchable, varyParamsAccumulator);
|
||||
}
|
||||
}
|
||||
function createErrorBoundaryClientSegmentRoot({ ctx, ErrorBoundaryComponent, errorElement, ClientSegmentRoot, layerAssets, SegmentComponent, currentParams }) {
|
||||
const { componentMod: { createElement, Fragment } } = ctx;
|
||||
if (ErrorBoundaryComponent) {
|
||||
const notFoundParallelRouteProps = {
|
||||
children: errorElement
|
||||
};
|
||||
return createElement(Fragment, null, layerAssets, createElement(ClientSegmentRoot, {
|
||||
Component: SegmentComponent,
|
||||
slots: notFoundParallelRouteProps,
|
||||
params: currentParams
|
||||
}));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function getRootParams(loaderTree, getDynamicParamFromSegment) {
|
||||
return getRootParamsImpl({}, loaderTree, getDynamicParamFromSegment);
|
||||
}
|
||||
function getRootParamsImpl(parentParams, loaderTree, getDynamicParamFromSegment) {
|
||||
const { modules: { layout }, parallelRoutes } = (0, _parseloadertree.parseLoaderTree)(loaderTree);
|
||||
const segmentParam = getDynamicParamFromSegment(loaderTree);
|
||||
let currentParams = parentParams;
|
||||
if (segmentParam && segmentParam.value !== null) {
|
||||
currentParams = {
|
||||
...parentParams,
|
||||
[segmentParam.param]: segmentParam.value
|
||||
};
|
||||
}
|
||||
const isRootLayout = typeof layout !== 'undefined';
|
||||
if (isRootLayout) {
|
||||
return currentParams;
|
||||
} else if (!parallelRoutes.children) {
|
||||
// This should really be an error but there are bugs in Turbopack that cause
|
||||
// the _not-found LoaderTree to not have any layouts. For rootParams sake
|
||||
// this is somewhat irrelevant when you are not customizing the 404 page.
|
||||
// If you are customizing 404
|
||||
// TODO update rootParams to make all params optional if `/app/not-found.tsx` is defined
|
||||
return currentParams;
|
||||
} else {
|
||||
return getRootParamsImpl(currentParams, // We stop looking for root params as soon as we hit the first layout
|
||||
// and it is not possible to use parallel route children above the root layout
|
||||
// so every parallelRoutes object that this function can visit will necessarily
|
||||
// have a single `children` prop and no others.
|
||||
parallelRoutes.children, getDynamicParamFromSegment);
|
||||
}
|
||||
}
|
||||
async function createBoundaryConventionElement({ ctx, conventionName, Component, styles, tree }) {
|
||||
const { componentMod: { createElement, Fragment } } = ctx;
|
||||
const isSegmentViewEnabled = !!process.env.__NEXT_DEV_SERVER;
|
||||
const dir = (process.env.NEXT_RUNTIME === 'edge' ? process.env.__NEXT_EDGE_PROJECT_DIR : ctx.renderOpts.dir) || '';
|
||||
const { SegmentViewNode } = ctx.componentMod;
|
||||
const element = Component ? createElement(Fragment, null, createElement(Component, null), styles) : undefined;
|
||||
const pagePath = (0, _segmentexplorerpath.getConventionPathByType)(tree, dir, conventionName);
|
||||
const wrappedElement = isSegmentViewEnabled && element ? createElement(SegmentViewNode, {
|
||||
key: cacheNodeKey + '-' + conventionName,
|
||||
type: conventionName,
|
||||
// TODO: Discovered when moving to `createElement`.
|
||||
// `SegmentViewNode` doesn't support undefined `pagePath`
|
||||
pagePath: pagePath
|
||||
}, element) : element;
|
||||
return [
|
||||
wrappedElement,
|
||||
pagePath
|
||||
];
|
||||
}
|
||||
function createSeedData(ctx, rsc, parallelRoutes, loading, isPossiblyPartialResponse, isRuntimePrefetchable, varyParamsAccumulator) {
|
||||
const createElement = ctx.componentMod.createElement;
|
||||
// When this segment is NOT runtime-prefetchable, delay it until the Static
|
||||
// stage by wrapping the node in a promise. This allows runtime-prefetchable
|
||||
// segments (the lower tree) to render first during EarlyStatic, so their
|
||||
// runtime data resolves in EarlyRuntime where sync IO can be checked.
|
||||
// React will suspend on the thenable and resume when the stage advances.
|
||||
if (!isRuntimePrefetchable) {
|
||||
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
||||
if (workUnitStore) {
|
||||
let stagedRendering;
|
||||
switch(workUnitStore.type){
|
||||
case 'request':
|
||||
case 'prerender-runtime':
|
||||
stagedRendering = workUnitStore.stagedRendering;
|
||||
if (stagedRendering) {
|
||||
const deferredRsc = rsc;
|
||||
rsc = stagedRendering.waitForStage(_stagedrendering.RenderStage.Static).then(()=>deferredRsc);
|
||||
}
|
||||
break;
|
||||
case 'prerender':
|
||||
case 'prerender-client':
|
||||
case 'validation-client':
|
||||
case 'prerender-ppr':
|
||||
case 'prerender-legacy':
|
||||
case 'cache':
|
||||
case 'private-cache':
|
||||
case 'unstable-cache':
|
||||
case 'generate-static-params':
|
||||
break;
|
||||
default:
|
||||
workUnitStore;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (loading !== null) {
|
||||
// If a loading.tsx boundary is present, wrap the component data in an
|
||||
// additional context provider to pass the loading data to the next
|
||||
// set of children.
|
||||
// NOTE: The reason this is a separate wrapper from LayoutRouter is because
|
||||
// not all segments render a LayoutRouter component, e.g. the root segment.
|
||||
const LoadingBoundaryProvider = ctx.componentMod.LoadingBoundaryProvider;
|
||||
rsc = createElement(LoadingBoundaryProvider, {
|
||||
loading: loading,
|
||||
children: rsc
|
||||
});
|
||||
}
|
||||
return [
|
||||
rsc,
|
||||
parallelRoutes,
|
||||
null,
|
||||
isPossiblyPartialResponse,
|
||||
varyParamsAccumulator ? (0, _varyparams.getVaryParamsThenable)(varyParamsAccumulator) : null
|
||||
];
|
||||
}
|
||||
|
||||
//# sourceMappingURL=create-component-tree.js.map
|
||||
189
build/node_modules/next/dist/server/app-render/create-error-handler.js
generated
vendored
Normal file
189
build/node_modules/next/dist/server/app-render/create-error-handler.js
generated
vendored
Normal file
@@ -0,0 +1,189 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
createHTMLErrorHandler: null,
|
||||
createReactServerErrorHandler: null,
|
||||
getDigestForWellKnownError: null,
|
||||
isUserLandError: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
createHTMLErrorHandler: function() {
|
||||
return createHTMLErrorHandler;
|
||||
},
|
||||
createReactServerErrorHandler: function() {
|
||||
return createReactServerErrorHandler;
|
||||
},
|
||||
getDigestForWellKnownError: function() {
|
||||
return getDigestForWellKnownError;
|
||||
},
|
||||
isUserLandError: function() {
|
||||
return isUserLandError;
|
||||
}
|
||||
});
|
||||
const _stringhash = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/string-hash"));
|
||||
const _formatservererror = require("../../lib/format-server-error");
|
||||
const _tracer = require("../lib/trace/tracer");
|
||||
const _pipereadable = require("../pipe-readable");
|
||||
const _bailouttocsr = require("../../shared/lib/lazy-dynamic/bailout-to-csr");
|
||||
const _hooksservercontext = require("../../client/components/hooks-server-context");
|
||||
const _isnextroutererror = require("../../client/components/is-next-router-error");
|
||||
const _dynamicrendering = require("./dynamic-rendering");
|
||||
const _iserror = require("../../lib/is-error");
|
||||
const _errortelemetryutils = require("../../lib/error-telemetry-utils");
|
||||
const _reactlargeshellerror = require("./react-large-shell-error");
|
||||
const _instantvalidationerror = require("./instant-validation/instant-validation-error");
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function getDigestForWellKnownError(error) {
|
||||
// If we're bailing out to CSR, we don't need to log the error.
|
||||
if ((0, _bailouttocsr.isBailoutToCSRError)(error)) return error.digest;
|
||||
// If this is a navigation error, we don't need to log the error.
|
||||
if ((0, _isnextroutererror.isNextRouterError)(error)) return error.digest;
|
||||
// If this error occurs, we know that we should be stopping the static
|
||||
// render. This is only thrown in static generation when PPR is not enabled,
|
||||
// which causes the whole page to be marked as dynamic. We don't need to
|
||||
// tell the user about this error, as it's not actionable.
|
||||
if ((0, _hooksservercontext.isDynamicServerError)(error)) return error.digest;
|
||||
// If this is a prerender interrupted error, we don't need to log the error.
|
||||
if ((0, _dynamicrendering.isPrerenderInterruptedError)(error)) return error.digest;
|
||||
if ((0, _instantvalidationerror.isInstantValidationError)(error)) return error.digest;
|
||||
return undefined;
|
||||
}
|
||||
function createReactServerErrorHandler(shouldFormatError, isBuildTimePrerendering, reactServerErrors, onReactServerRenderError, spanToRecordOn) {
|
||||
return (thrownValue)=>{
|
||||
var _err_message;
|
||||
if (typeof thrownValue === 'string') {
|
||||
// TODO-APP: look at using webcrypto instead. Requires a promise to be awaited.
|
||||
return (0, _stringhash.default)(thrownValue).toString();
|
||||
}
|
||||
// If the response was closed, we don't need to log the error.
|
||||
if ((0, _pipereadable.isAbortError)(thrownValue)) return;
|
||||
const digest = getDigestForWellKnownError(thrownValue);
|
||||
if (digest) {
|
||||
return digest;
|
||||
}
|
||||
if ((0, _reactlargeshellerror.isReactLargeShellError)(thrownValue)) {
|
||||
// TODO: Aggregate
|
||||
console.error(thrownValue);
|
||||
return undefined;
|
||||
}
|
||||
let err = (0, _iserror.getProperError)(thrownValue);
|
||||
let silenceLog = false;
|
||||
// If the error already has a digest, respect the original digest,
|
||||
// so it won't get re-generated into another new error.
|
||||
if (err.digest) {
|
||||
if (process.env.NODE_ENV === 'production' && reactServerErrors.has(err.digest)) {
|
||||
// This error is likely an obfuscated error from another react-server
|
||||
// environment (e.g. 'use cache'). We recover the original error here
|
||||
// for reporting purposes.
|
||||
err = reactServerErrors.get(err.digest);
|
||||
// We don't log it again though, as it was already logged in the
|
||||
// original environment.
|
||||
silenceLog = true;
|
||||
} else {
|
||||
// Either we're in development (where we want to keep the transported
|
||||
// error with environmentName), or the error is not in reactServerErrors
|
||||
// but has a digest from other means. Keep the error as-is.
|
||||
}
|
||||
} else {
|
||||
err.digest = (0, _errortelemetryutils.createDigestWithErrorCode)(err, // TODO-APP: look at using webcrypto instead. Requires a promise to be awaited.
|
||||
(0, _stringhash.default)(err.message + (err.stack || '')).toString());
|
||||
}
|
||||
// @TODO by putting this here and not at the top it is possible that
|
||||
// we don't error the build in places we actually expect to
|
||||
if (!reactServerErrors.has(err.digest)) {
|
||||
reactServerErrors.set(err.digest, err);
|
||||
}
|
||||
// Format server errors in development to add more helpful error messages
|
||||
if (shouldFormatError) {
|
||||
(0, _formatservererror.formatServerError)(err);
|
||||
}
|
||||
// Don't log the suppressed error during export
|
||||
if (!(isBuildTimePrerendering && (err == null ? void 0 : (_err_message = err.message) == null ? void 0 : _err_message.includes('The specific message is omitted in production builds to avoid leaking sensitive details.')))) {
|
||||
// Record exception on the provided span if available, otherwise try active span.
|
||||
const span = spanToRecordOn ?? (0, _tracer.getTracer)().getActiveScopeSpan();
|
||||
if (span) {
|
||||
span.recordException(err);
|
||||
span.setAttribute('error.type', err.name);
|
||||
span.setStatus({
|
||||
code: _tracer.SpanStatusCode.ERROR,
|
||||
message: err.message
|
||||
});
|
||||
}
|
||||
onReactServerRenderError(err, silenceLog);
|
||||
}
|
||||
return err.digest;
|
||||
};
|
||||
}
|
||||
function createHTMLErrorHandler(shouldFormatError, isBuildTimePrerendering, reactServerErrors, allCapturedErrors, onHTMLRenderSSRError, spanToRecordOn) {
|
||||
return (thrownValue, errorInfo)=>{
|
||||
var _err_message;
|
||||
if ((0, _reactlargeshellerror.isReactLargeShellError)(thrownValue)) {
|
||||
// TODO: Aggregate
|
||||
console.error(thrownValue);
|
||||
return undefined;
|
||||
}
|
||||
let isSSRError = true;
|
||||
allCapturedErrors.push(thrownValue);
|
||||
// If the response was closed, we don't need to log the error.
|
||||
if ((0, _pipereadable.isAbortError)(thrownValue)) return;
|
||||
const digest = getDigestForWellKnownError(thrownValue);
|
||||
if (digest) {
|
||||
return digest;
|
||||
}
|
||||
const err = (0, _iserror.getProperError)(thrownValue);
|
||||
// If the error already has a digest, respect the original digest,
|
||||
// so it won't get re-generated into another new error.
|
||||
if (err.digest) {
|
||||
if (reactServerErrors.has(err.digest)) {
|
||||
// This error is likely an obfuscated error from react-server.
|
||||
// We recover the original error here.
|
||||
thrownValue = reactServerErrors.get(err.digest);
|
||||
isSSRError = false;
|
||||
} else {
|
||||
// The error is not from react-server but has a digest
|
||||
// from other means so we don't need to produce a new one
|
||||
}
|
||||
} else {
|
||||
err.digest = (0, _errortelemetryutils.createDigestWithErrorCode)(err, (0, _stringhash.default)(err.message + ((errorInfo == null ? void 0 : errorInfo.componentStack) || err.stack || '')).toString());
|
||||
}
|
||||
// Format server errors in development to add more helpful error messages
|
||||
if (shouldFormatError) {
|
||||
(0, _formatservererror.formatServerError)(err);
|
||||
}
|
||||
// Don't log the suppressed error during export
|
||||
if (!(isBuildTimePrerendering && (err == null ? void 0 : (_err_message = err.message) == null ? void 0 : _err_message.includes('The specific message is omitted in production builds to avoid leaking sensitive details.')))) {
|
||||
// HTML errors contain RSC errors as well, filter them out before reporting
|
||||
if (isSSRError) {
|
||||
// Record exception on the provided span if available, otherwise try active span.
|
||||
const span = spanToRecordOn ?? (0, _tracer.getTracer)().getActiveScopeSpan();
|
||||
if (span) {
|
||||
span.recordException(err);
|
||||
span.setAttribute('error.type', err.name);
|
||||
span.setStatus({
|
||||
code: _tracer.SpanStatusCode.ERROR,
|
||||
message: err.message
|
||||
});
|
||||
}
|
||||
onHTMLRenderSSRError(err, errorInfo);
|
||||
}
|
||||
}
|
||||
return err.digest;
|
||||
};
|
||||
}
|
||||
function isUserLandError(err) {
|
||||
return !(0, _pipereadable.isAbortError)(err) && !(0, _bailouttocsr.isBailoutToCSRError)(err) && !(0, _isnextroutererror.isNextRouterError)(err);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=create-error-handler.js.map
|
||||
102
build/node_modules/next/dist/server/app-render/create-flight-router-state-from-loader-tree.js
generated
vendored
Normal file
102
build/node_modules/next/dist/server/app-render/create-flight-router-state-from-loader-tree.js
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
createFlightRouterStateFromLoaderTree: null,
|
||||
createRouteTreePrefetch: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
createFlightRouterStateFromLoaderTree: function() {
|
||||
return createFlightRouterStateFromLoaderTree;
|
||||
},
|
||||
createRouteTreePrefetch: function() {
|
||||
return createRouteTreePrefetch;
|
||||
}
|
||||
});
|
||||
const _approutertypes = require("../../shared/lib/app-router-types");
|
||||
const _segment = require("../../shared/lib/segment");
|
||||
async function createFlightRouterStateFromLoaderTreeImpl(loaderTree, hintTree, getDynamicParamFromSegment, searchParams, didFindRootLayout) {
|
||||
const [segment, parallelRoutes, { layout, loading, page }] = loaderTree;
|
||||
const dynamicParam = getDynamicParamFromSegment(loaderTree);
|
||||
const treeSegment = dynamicParam ? dynamicParam.treeSegment : segment;
|
||||
const segmentTree = [
|
||||
(0, _segment.addSearchParamsIfPageSegment)(treeSegment, searchParams),
|
||||
{}
|
||||
];
|
||||
// Load the layout or page module to check for unstable_instant config
|
||||
const mod = layout ? await layout[0]() : page ? await page[0]() : undefined;
|
||||
const instantConfig = mod ? mod.unstable_instant : undefined;
|
||||
let prefetchHints = 0;
|
||||
// Union in the precomputed build-time hints (e.g. segment inlining
|
||||
// decisions) if available. When hints are not available (e.g. dev mode or
|
||||
// if prefetch-hints.json was not generated), we fall through and still
|
||||
// compute the other hints below. In the future this should be a build
|
||||
// error, but for now we gracefully degrade.
|
||||
//
|
||||
// TODO: Move more of the hints computation (IsRootLayout, instant config,
|
||||
// loading boundary detection) into the build-time measurement step in
|
||||
// collectPrefetchHints, so this function only needs to union the
|
||||
// precomputed bitmask rather than re-derive hints on every render.
|
||||
if (hintTree !== null) {
|
||||
prefetchHints |= hintTree.hints;
|
||||
}
|
||||
// Mark the first segment that has a layout as the "root" layout
|
||||
if (!didFindRootLayout && typeof layout !== 'undefined') {
|
||||
didFindRootLayout = true;
|
||||
prefetchHints |= _approutertypes.PrefetchHint.IsRootLayout;
|
||||
}
|
||||
if (instantConfig && typeof instantConfig === 'object') {
|
||||
prefetchHints |= _approutertypes.PrefetchHint.SubtreeHasInstant;
|
||||
if (instantConfig.prefetch === 'runtime') {
|
||||
prefetchHints |= _approutertypes.PrefetchHint.HasRuntimePrefetch;
|
||||
}
|
||||
}
|
||||
// Check if this segment has a loading boundary
|
||||
if (loading) {
|
||||
prefetchHints |= _approutertypes.PrefetchHint.SegmentHasLoadingBoundary;
|
||||
}
|
||||
const children = {};
|
||||
for(const parallelRouteKey in parallelRoutes){
|
||||
var _hintTree_slots;
|
||||
// Look up the child hint node by parallel route key, traversing the
|
||||
// hint tree in parallel with the loader tree.
|
||||
const childHintNode = (hintTree == null ? void 0 : (_hintTree_slots = hintTree.slots) == null ? void 0 : _hintTree_slots[parallelRouteKey]) ?? null;
|
||||
const child = await createFlightRouterStateFromLoaderTreeImpl(parallelRoutes[parallelRouteKey], childHintNode, getDynamicParamFromSegment, searchParams, didFindRootLayout);
|
||||
// Propagate subtree flags from children
|
||||
if (child[4] !== undefined) {
|
||||
prefetchHints |= child[4] & (_approutertypes.PrefetchHint.SubtreeHasInstant | _approutertypes.PrefetchHint.SubtreeHasLoadingBoundary);
|
||||
// If a child has a loading boundary (either directly or in its subtree),
|
||||
// propagate that as SubtreeHasLoadingBoundary to this segment.
|
||||
if (child[4] & (_approutertypes.PrefetchHint.SegmentHasLoadingBoundary | _approutertypes.PrefetchHint.SubtreeHasLoadingBoundary)) {
|
||||
prefetchHints |= _approutertypes.PrefetchHint.SubtreeHasLoadingBoundary;
|
||||
}
|
||||
}
|
||||
children[parallelRouteKey] = child;
|
||||
}
|
||||
segmentTree[1] = children;
|
||||
if (prefetchHints !== 0) {
|
||||
segmentTree[4] = prefetchHints;
|
||||
}
|
||||
return segmentTree;
|
||||
}
|
||||
async function createFlightRouterStateFromLoaderTree(loaderTree, hintTree, getDynamicParamFromSegment, searchParams) {
|
||||
const didFindRootLayout = false;
|
||||
return createFlightRouterStateFromLoaderTreeImpl(loaderTree, hintTree, getDynamicParamFromSegment, searchParams, didFindRootLayout);
|
||||
}
|
||||
async function createRouteTreePrefetch(loaderTree, hintTree, getDynamicParamFromSegment) {
|
||||
// Search params should not be added to page segment's cache key during a
|
||||
// route tree prefetch request, because they do not affect the structure of
|
||||
// the route. The client cache has its own logic to handle search params.
|
||||
const searchParams = {};
|
||||
const didFindRootLayout = false;
|
||||
return createFlightRouterStateFromLoaderTreeImpl(loaderTree, hintTree, getDynamicParamFromSegment, searchParams, didFindRootLayout);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=create-flight-router-state-from-loader-tree.js.map
|
||||
86
build/node_modules/next/dist/server/app-render/csrf-protection.js
generated
vendored
Normal file
86
build/node_modules/next/dist/server/app-render/csrf-protection.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
// micromatch is only available at node runtime, so it cannot be used here since the code path that calls this function
|
||||
// can be run from edge. This is a simple implementation that safely achieves the required functionality.
|
||||
// the goal is to match the functionality for remotePatterns as defined here -
|
||||
// https://nextjs.org/docs/app/api-reference/components/image#remotepatterns
|
||||
// TODO - retrofit micromatch to work in edge and use that instead
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "isCsrfOriginAllowed", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return isCsrfOriginAllowed;
|
||||
}
|
||||
});
|
||||
function matchWildcardDomain(domain, pattern) {
|
||||
// DNS names are case-insensitive per RFC 1035
|
||||
// Use ASCII-only toLowerCase to avoid unicode issues
|
||||
const normalizedDomain = domain.replace(/[A-Z]/g, (c)=>c.toLowerCase());
|
||||
const normalizedPattern = pattern.replace(/[A-Z]/g, (c)=>c.toLowerCase());
|
||||
const domainParts = normalizedDomain.split('.');
|
||||
const patternParts = normalizedPattern.split('.');
|
||||
if (patternParts.length < 1) {
|
||||
// pattern is empty and therefore invalid to match against
|
||||
return false;
|
||||
}
|
||||
if (domainParts.length < patternParts.length) {
|
||||
// domain has too few segments and thus cannot match
|
||||
return false;
|
||||
}
|
||||
// Prevent wildcards from matching entire domains (e.g. '**' or '*.com')
|
||||
// This ensures wildcards can only match subdomains, not the main domain
|
||||
if (patternParts.length === 1 && (patternParts[0] === '*' || patternParts[0] === '**')) {
|
||||
return false;
|
||||
}
|
||||
while(patternParts.length){
|
||||
const patternPart = patternParts.pop();
|
||||
const domainPart = domainParts.pop();
|
||||
switch(patternPart){
|
||||
case '':
|
||||
{
|
||||
// invalid pattern. pattern segments must be non empty
|
||||
return false;
|
||||
}
|
||||
case '*':
|
||||
{
|
||||
// wildcard matches anything so we continue if the domain part is non-empty
|
||||
if (domainPart) {
|
||||
continue;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
case '**':
|
||||
{
|
||||
// if this is not the last item in the pattern the pattern is invalid
|
||||
if (patternParts.length > 0) {
|
||||
return false;
|
||||
}
|
||||
// recursive wildcard matches anything so we terminate here if the domain part is non empty
|
||||
return domainPart !== undefined;
|
||||
}
|
||||
case undefined:
|
||||
default:
|
||||
{
|
||||
if (domainPart !== patternPart) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// We exhausted the pattern. If we also exhausted the domain we have a match
|
||||
return domainParts.length === 0;
|
||||
}
|
||||
const isCsrfOriginAllowed = (originDomain, allowedOrigins = [])=>{
|
||||
// DNS names are case-insensitive per RFC 1035
|
||||
// Use ASCII-only toLowerCase to avoid unicode issues
|
||||
const normalizedOrigin = originDomain.replace(/[A-Z]/g, (c)=>c.toLowerCase());
|
||||
return allowedOrigins.some((allowedOrigin)=>{
|
||||
if (!allowedOrigin) return false;
|
||||
const normalizedAllowed = allowedOrigin.replace(/[A-Z]/g, (c)=>c.toLowerCase());
|
||||
return normalizedAllowed === normalizedOrigin || matchWildcardDomain(originDomain, allowedOrigin);
|
||||
});
|
||||
};
|
||||
|
||||
//# sourceMappingURL=csrf-protection.js.map
|
||||
30
build/node_modules/next/dist/server/app-render/debug-channel-server.js
generated
vendored
Normal file
30
build/node_modules/next/dist/server/app-render/debug-channel-server.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Compile-time switcher for debug channel operations.
|
||||
*
|
||||
* Simple re-export from the web implementation.
|
||||
* A future change will add a conditional branch for node streams.
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
createDebugChannel: null,
|
||||
toNodeDebugChannel: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
createDebugChannel: function() {
|
||||
return _debugchannelserverweb.createDebugChannel;
|
||||
},
|
||||
toNodeDebugChannel: function() {
|
||||
return _debugchannelserverweb.toNodeDebugChannel;
|
||||
}
|
||||
});
|
||||
const _debugchannelserverweb = require("./debug-channel-server.web");
|
||||
|
||||
//# sourceMappingURL=debug-channel-server.js.map
|
||||
71
build/node_modules/next/dist/server/app-render/debug-channel-server.web.js
generated
vendored
Normal file
71
build/node_modules/next/dist/server/app-render/debug-channel-server.web.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* Web debug channel implementation.
|
||||
* Loaded by debug-channel-server.ts.
|
||||
*/ // Types defined inline for now; will move to debug-channel-server.node.ts later.
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
createDebugChannel: null,
|
||||
createWebDebugChannel: null,
|
||||
toNodeDebugChannel: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
createDebugChannel: function() {
|
||||
return createDebugChannel;
|
||||
},
|
||||
createWebDebugChannel: function() {
|
||||
return createWebDebugChannel;
|
||||
},
|
||||
toNodeDebugChannel: function() {
|
||||
return toNodeDebugChannel;
|
||||
}
|
||||
});
|
||||
function createDebugChannel() {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
return undefined;
|
||||
}
|
||||
return createWebDebugChannel();
|
||||
}
|
||||
function createWebDebugChannel() {
|
||||
let readableController;
|
||||
const clientSideReadable = new ReadableStream({
|
||||
start (controller) {
|
||||
readableController = controller;
|
||||
}
|
||||
});
|
||||
return {
|
||||
serverSide: {
|
||||
writable: new WritableStream({
|
||||
write (chunk) {
|
||||
readableController == null ? void 0 : readableController.enqueue(chunk);
|
||||
},
|
||||
close () {
|
||||
readableController == null ? void 0 : readableController.close();
|
||||
},
|
||||
abort (err) {
|
||||
readableController == null ? void 0 : readableController.error(err);
|
||||
}
|
||||
})
|
||||
},
|
||||
clientSide: {
|
||||
readable: clientSideReadable
|
||||
}
|
||||
};
|
||||
}
|
||||
function toNodeDebugChannel(_webDebugChannel) {
|
||||
throw Object.defineProperty(new Error('toNodeDebugChannel cannot be used in edge/web runtime, this is a bug in the Next.js codebase'), "__NEXT_ERROR_CODE", {
|
||||
value: "E1071",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=debug-channel-server.web.js.map
|
||||
14
build/node_modules/next/dist/server/app-render/dynamic-access-async-storage-instance.js
generated
vendored
Normal file
14
build/node_modules/next/dist/server/app-render/dynamic-access-async-storage-instance.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "dynamicAccessAsyncStorageInstance", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return dynamicAccessAsyncStorageInstance;
|
||||
}
|
||||
});
|
||||
const _asynclocalstorage = require("./async-local-storage");
|
||||
const dynamicAccessAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)();
|
||||
|
||||
//# sourceMappingURL=dynamic-access-async-storage-instance.js.map
|
||||
13
build/node_modules/next/dist/server/app-render/dynamic-access-async-storage.external.js
generated
vendored
Normal file
13
build/node_modules/next/dist/server/app-render/dynamic-access-async-storage.external.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "dynamicAccessAsyncStorage", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _dynamicaccessasyncstorageinstance.dynamicAccessAsyncStorageInstance;
|
||||
}
|
||||
});
|
||||
const _dynamicaccessasyncstorageinstance = require("./dynamic-access-async-storage-instance");
|
||||
|
||||
//# sourceMappingURL=dynamic-access-async-storage.external.js.map
|
||||
1144
build/node_modules/next/dist/server/app-render/dynamic-rendering.js
generated
vendored
Normal file
1144
build/node_modules/next/dist/server/app-render/dynamic-rendering.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
114
build/node_modules/next/dist/server/app-render/encryption-utils-server.js
generated
vendored
Normal file
114
build/node_modules/next/dist/server/app-render/encryption-utils-server.js
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
// This file should never be bundled into application's runtime code and should
|
||||
// stay in the Next.js server.
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "generateEncryptionKeyBase64", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return generateEncryptionKeyBase64;
|
||||
}
|
||||
});
|
||||
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
||||
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
||||
const _cachedir = require("../cache-dir");
|
||||
const _encryptionutils = require("./encryption-utils");
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
// Keep the key in memory as it should never change during the lifetime of the server in
|
||||
// both development and production.
|
||||
let __next_encryption_key_generation_promise = null;
|
||||
const CONFIG_FILE = '.rscinfo';
|
||||
const ENCRYPTION_KEY = 'encryption.key';
|
||||
const ENCRYPTION_EXPIRE_AT = 'encryption.expire_at';
|
||||
const EXPIRATION = 1000 * 60 * 60 * 24 * 14 // 14 days
|
||||
;
|
||||
async function writeCache(distDir, configValue) {
|
||||
const cacheBaseDir = (0, _cachedir.getStorageDirectory)(distDir);
|
||||
if (!cacheBaseDir) return;
|
||||
const configPath = _path.default.join(cacheBaseDir, CONFIG_FILE);
|
||||
if (!_fs.default.existsSync(cacheBaseDir)) {
|
||||
await _fs.default.promises.mkdir(cacheBaseDir, {
|
||||
recursive: true
|
||||
});
|
||||
}
|
||||
await _fs.default.promises.writeFile(configPath, JSON.stringify({
|
||||
[ENCRYPTION_KEY]: configValue,
|
||||
[ENCRYPTION_EXPIRE_AT]: Date.now() + EXPIRATION
|
||||
}));
|
||||
}
|
||||
// This utility is used to get a key for the cache directory. If the
|
||||
// key is not present, it will generate a new one and store it in the
|
||||
// cache directory inside dist.
|
||||
// The key will also expire after a certain amount of time. Once it
|
||||
// expires, a new one will be generated.
|
||||
// During the lifetime of the server, it will be reused and never refreshed.
|
||||
async function loadOrGenerateKey(distDir, isBuild, generateKey) {
|
||||
const cacheBaseDir = (0, _cachedir.getStorageDirectory)(distDir);
|
||||
if (!cacheBaseDir) {
|
||||
// There's no persistent storage available. We generate a new key.
|
||||
// This also covers development time.
|
||||
return await generateKey();
|
||||
}
|
||||
const configPath = _path.default.join(cacheBaseDir, CONFIG_FILE);
|
||||
async function hasCachedKey() {
|
||||
if (!_fs.default.existsSync(configPath)) return false;
|
||||
try {
|
||||
const config = JSON.parse(await _fs.default.promises.readFile(configPath, 'utf8'));
|
||||
if (!config) return false;
|
||||
if (typeof config[ENCRYPTION_KEY] !== 'string' || typeof config[ENCRYPTION_EXPIRE_AT] !== 'number') {
|
||||
return false;
|
||||
}
|
||||
// For build time, we need to rotate the key if it's expired. Otherwise
|
||||
// (next start) we have to keep the key as it is so the runtime key matches
|
||||
// the build time key.
|
||||
if (isBuild && config[ENCRYPTION_EXPIRE_AT] < Date.now()) {
|
||||
return false;
|
||||
}
|
||||
const cachedKey = config[ENCRYPTION_KEY];
|
||||
// If encryption key is provided via env, and it's not same as valid cache,
|
||||
// we should not use the cached key and respect the env key.
|
||||
if (cachedKey && process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY && cachedKey !== process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY) {
|
||||
return false;
|
||||
}
|
||||
return cachedKey;
|
||||
} catch {
|
||||
// Broken config file. We should generate a new key and overwrite it.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
const maybeValidKey = await hasCachedKey();
|
||||
if (typeof maybeValidKey === 'string') {
|
||||
return maybeValidKey;
|
||||
}
|
||||
const key = await generateKey();
|
||||
await writeCache(distDir, key);
|
||||
return key;
|
||||
}
|
||||
async function generateEncryptionKeyBase64({ isBuild, distDir }) {
|
||||
// This avoids it being generated multiple times in parallel.
|
||||
if (!__next_encryption_key_generation_promise) {
|
||||
__next_encryption_key_generation_promise = loadOrGenerateKey(distDir, isBuild, async ()=>{
|
||||
const providedKey = process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY;
|
||||
if (providedKey) {
|
||||
return providedKey;
|
||||
}
|
||||
const key = await crypto.subtle.generateKey({
|
||||
name: 'AES-GCM',
|
||||
length: 256
|
||||
}, true, [
|
||||
'encrypt',
|
||||
'decrypt'
|
||||
]);
|
||||
const exported = await crypto.subtle.exportKey('raw', key);
|
||||
return btoa((0, _encryptionutils.arrayBufferToString)(exported));
|
||||
});
|
||||
}
|
||||
return __next_encryption_key_generation_promise;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=encryption-utils-server.js.map
|
||||
93
build/node_modules/next/dist/server/app-render/encryption-utils.js
generated
vendored
Normal file
93
build/node_modules/next/dist/server/app-render/encryption-utils.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
arrayBufferToString: null,
|
||||
decrypt: null,
|
||||
encrypt: null,
|
||||
getActionEncryptionKey: null,
|
||||
stringToUint8Array: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
arrayBufferToString: function() {
|
||||
return arrayBufferToString;
|
||||
},
|
||||
decrypt: function() {
|
||||
return decrypt;
|
||||
},
|
||||
encrypt: function() {
|
||||
return encrypt;
|
||||
},
|
||||
getActionEncryptionKey: function() {
|
||||
return getActionEncryptionKey;
|
||||
},
|
||||
stringToUint8Array: function() {
|
||||
return stringToUint8Array;
|
||||
}
|
||||
});
|
||||
const _invarianterror = require("../../shared/lib/invariant-error");
|
||||
const _manifestssingleton = require("./manifests-singleton");
|
||||
let __next_loaded_action_key;
|
||||
function arrayBufferToString(buffer) {
|
||||
const bytes = new Uint8Array(buffer);
|
||||
const len = bytes.byteLength;
|
||||
// @anonrig: V8 has a limit of 65535 arguments in a function.
|
||||
// For len < 65535, this is faster.
|
||||
// https://github.com/vercel/next.js/pull/56377#pullrequestreview-1656181623
|
||||
if (len < 65535) {
|
||||
return String.fromCharCode.apply(null, bytes);
|
||||
}
|
||||
let binary = '';
|
||||
for(let i = 0; i < len; i++){
|
||||
binary += String.fromCharCode(bytes[i]);
|
||||
}
|
||||
return binary;
|
||||
}
|
||||
function stringToUint8Array(binary) {
|
||||
const len = binary.length;
|
||||
const arr = new Uint8Array(len);
|
||||
for(let i = 0; i < len; i++){
|
||||
arr[i] = binary.charCodeAt(i);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
function encrypt(key, iv, data) {
|
||||
return crypto.subtle.encrypt({
|
||||
name: 'AES-GCM',
|
||||
iv
|
||||
}, key, data);
|
||||
}
|
||||
function decrypt(key, iv, data) {
|
||||
return crypto.subtle.decrypt({
|
||||
name: 'AES-GCM',
|
||||
iv
|
||||
}, key, data);
|
||||
}
|
||||
async function getActionEncryptionKey() {
|
||||
if (__next_loaded_action_key) {
|
||||
return __next_loaded_action_key;
|
||||
}
|
||||
const serverActionsManifest = (0, _manifestssingleton.getServerActionsManifest)();
|
||||
const rawKey = process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY || serverActionsManifest.encryptionKey;
|
||||
if (rawKey === undefined) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('Missing encryption key for Server Actions'), "__NEXT_ERROR_CODE", {
|
||||
value: "E571",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
__next_loaded_action_key = await crypto.subtle.importKey('raw', stringToUint8Array(atob(rawKey)), 'AES-GCM', true, [
|
||||
'encrypt',
|
||||
'decrypt'
|
||||
]);
|
||||
return __next_loaded_action_key;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=encryption-utils.js.map
|
||||
259
build/node_modules/next/dist/server/app-render/encryption.js
generated
vendored
Normal file
259
build/node_modules/next/dist/server/app-render/encryption.js
generated
vendored
Normal file
@@ -0,0 +1,259 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies */ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
decryptActionBoundArgs: null,
|
||||
encryptActionBoundArgs: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
decryptActionBoundArgs: function() {
|
||||
return decryptActionBoundArgs;
|
||||
},
|
||||
encryptActionBoundArgs: function() {
|
||||
return encryptActionBoundArgs;
|
||||
}
|
||||
});
|
||||
require("server-only");
|
||||
const _server = require("react-server-dom-webpack/server");
|
||||
const _client = require("react-server-dom-webpack/client");
|
||||
const _nodewebstreamshelper = require("../stream-utils/node-web-streams-helper");
|
||||
const _encryptionutils = require("./encryption-utils");
|
||||
const _manifestssingleton = require("./manifests-singleton");
|
||||
const _workunitasyncstorageexternal = require("./work-unit-async-storage.external");
|
||||
const _dynamicrendering = require("./dynamic-rendering");
|
||||
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
const isEdgeRuntime = process.env.NEXT_RUNTIME === 'edge';
|
||||
const textEncoder = new TextEncoder();
|
||||
const textDecoder = new TextDecoder();
|
||||
const filterStackFrame = process.env.NODE_ENV !== 'production' ? require('../lib/source-maps').filterStackFrameDEV : undefined;
|
||||
const findSourceMapURL = process.env.NODE_ENV !== 'production' ? require('../lib/source-maps').findSourceMapURLDEV : undefined;
|
||||
/**
|
||||
* Decrypt the serialized string with the action id as the salt.
|
||||
*/ async function decodeActionBoundArg(actionId, arg) {
|
||||
const key = await (0, _encryptionutils.getActionEncryptionKey)();
|
||||
if (typeof key === 'undefined') {
|
||||
throw Object.defineProperty(new Error(`Missing encryption key for Server Action. This is a bug in Next.js`), "__NEXT_ERROR_CODE", {
|
||||
value: "E65",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
// Get the iv (16 bytes) and the payload from the arg.
|
||||
const originalPayload = atob(arg);
|
||||
const ivValue = originalPayload.slice(0, 16);
|
||||
const payload = originalPayload.slice(16);
|
||||
const decrypted = textDecoder.decode(await (0, _encryptionutils.decrypt)(key, (0, _encryptionutils.stringToUint8Array)(ivValue), (0, _encryptionutils.stringToUint8Array)(payload)));
|
||||
if (!decrypted.startsWith(actionId)) {
|
||||
throw Object.defineProperty(new Error('Invalid Server Action payload: failed to decrypt.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E191",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
return decrypted.slice(actionId.length);
|
||||
}
|
||||
/**
|
||||
* Encrypt the serialized string with the action id as the salt. Add a prefix to
|
||||
* later ensure that the payload is correctly decrypted, similar to a checksum.
|
||||
*/ async function encodeActionBoundArg(actionId, arg) {
|
||||
const key = await (0, _encryptionutils.getActionEncryptionKey)();
|
||||
if (key === undefined) {
|
||||
throw Object.defineProperty(new Error(`Missing encryption key for Server Action. This is a bug in Next.js`), "__NEXT_ERROR_CODE", {
|
||||
value: "E65",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
// Get 16 random bytes as iv.
|
||||
const randomBytes = new Uint8Array(16);
|
||||
_workunitasyncstorageexternal.workUnitAsyncStorage.exit(()=>crypto.getRandomValues(randomBytes));
|
||||
const ivValue = (0, _encryptionutils.arrayBufferToString)(randomBytes.buffer);
|
||||
const encrypted = await (0, _encryptionutils.encrypt)(key, randomBytes, textEncoder.encode(actionId + arg));
|
||||
return btoa(ivValue + (0, _encryptionutils.arrayBufferToString)(encrypted));
|
||||
}
|
||||
var ReadStatus = /*#__PURE__*/ function(ReadStatus) {
|
||||
ReadStatus[ReadStatus["Ready"] = 0] = "Ready";
|
||||
ReadStatus[ReadStatus["Pending"] = 1] = "Pending";
|
||||
ReadStatus[ReadStatus["Complete"] = 2] = "Complete";
|
||||
return ReadStatus;
|
||||
}(ReadStatus || {});
|
||||
const encryptActionBoundArgs = _react.default.cache(async function encryptActionBoundArgs(actionId, ...args) {
|
||||
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
||||
const cacheSignal = workUnitStore ? (0, _workunitasyncstorageexternal.getCacheSignal)(workUnitStore) : undefined;
|
||||
const { clientModules } = (0, _manifestssingleton.getClientReferenceManifest)();
|
||||
// Create an error before any asynchronous calls, to capture the original
|
||||
// call stack in case we need it when the serialization errors.
|
||||
const error = new Error();
|
||||
Error.captureStackTrace(error, encryptActionBoundArgs);
|
||||
let didCatchError = false;
|
||||
const hangingInputAbortSignal = workUnitStore ? (0, _dynamicrendering.createHangingInputAbortSignal)(workUnitStore) : undefined;
|
||||
let readStatus = 0;
|
||||
function startReadOnce() {
|
||||
if (readStatus === 0) {
|
||||
readStatus = 1;
|
||||
cacheSignal == null ? void 0 : cacheSignal.beginRead();
|
||||
}
|
||||
}
|
||||
function endReadIfStarted() {
|
||||
if (readStatus === 1) {
|
||||
cacheSignal == null ? void 0 : cacheSignal.endRead();
|
||||
}
|
||||
readStatus = 2;
|
||||
}
|
||||
// streamToString might take longer than a microtask to resolve and then other things
|
||||
// waiting on the cache signal might not realize there is another cache to fill so if
|
||||
// we are no longer waiting on the bound args serialization via the hangingInputAbortSignal
|
||||
// we should eagerly start the cache read to prevent other readers of the cache signal from
|
||||
// missing this cache fill. We use a idempotent function to only start reading once because
|
||||
// it's also possible that streamToString finishes before the hangingInputAbortSignal aborts.
|
||||
if (hangingInputAbortSignal && cacheSignal) {
|
||||
hangingInputAbortSignal.addEventListener('abort', startReadOnce, {
|
||||
once: true
|
||||
});
|
||||
}
|
||||
const prerenderResumeDataCache = workUnitStore ? (0, _workunitasyncstorageexternal.getPrerenderResumeDataCache)(workUnitStore) : null;
|
||||
const renderResumeDataCache = workUnitStore ? (0, _workunitasyncstorageexternal.getRenderResumeDataCache)(workUnitStore) : null;
|
||||
// Using Flight to serialize the args into a string.
|
||||
const serialized = await (0, _nodewebstreamshelper.streamToString)((0, _server.renderToReadableStream)(args, clientModules, {
|
||||
filterStackFrame,
|
||||
signal: hangingInputAbortSignal,
|
||||
debugChannel: // In Cache Components, we want to cache the encrypted result,
|
||||
// and we use the unencrypted bound args as a cache key.
|
||||
// In order to do that we need to strip debug info, because it
|
||||
// contains timing information and thus changes each time we serialize the args.
|
||||
// We can do this by piping debug info into a debug channel that throws it away.
|
||||
//
|
||||
// Note that this can result in dangling debug info references when we decode the bound args,
|
||||
// but React ignores those as long as no debug channel is passed on the decode side, so it's fine:
|
||||
// https://github.com/facebook/react/blob/bb8a76c6cc77ea2976d690ea09f5a1b3d9b1792a/packages/react-client/src/ReactFlightClient.js#L1711-L1729
|
||||
// https://github.com/facebook/react/blob/bb8a76c6cc77ea2976d690ea09f5a1b3d9b1792a/packages/react-client/src/ReactFlightClient.js#L4005-L4025
|
||||
process.env.NODE_ENV === 'development' && (prerenderResumeDataCache || renderResumeDataCache) ? {
|
||||
writable: new WritableStream()
|
||||
} : undefined,
|
||||
onError (err) {
|
||||
if (hangingInputAbortSignal == null ? void 0 : hangingInputAbortSignal.aborted) {
|
||||
return;
|
||||
}
|
||||
// We're only reporting one error at a time, starting with the first.
|
||||
if (didCatchError) {
|
||||
return;
|
||||
}
|
||||
didCatchError = true;
|
||||
// Use the original error message together with the previously created
|
||||
// stack, because err.stack is a useless Flight Server call stack.
|
||||
error.message = err instanceof Error ? err.message : String(err);
|
||||
}
|
||||
}), // We pass the abort signal to `streamToString` so that no chunks are
|
||||
// included that are emitted after the signal was already aborted. This
|
||||
// ensures that we can encode hanging promises.
|
||||
hangingInputAbortSignal);
|
||||
if (didCatchError) {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// Logging the error is needed for server functions that are passed to the
|
||||
// client where the decryption is not done during rendering. Console
|
||||
// replaying allows us to still show the error dev overlay in this case.
|
||||
console.error(error);
|
||||
}
|
||||
endReadIfStarted();
|
||||
throw error;
|
||||
}
|
||||
if (!workUnitStore) {
|
||||
// We don't need to call cacheSignal.endRead here because we can't have a cacheSignal
|
||||
// if we do not have a workUnitStore.
|
||||
return encodeActionBoundArg(actionId, serialized);
|
||||
}
|
||||
startReadOnce();
|
||||
const cacheKey = actionId + serialized;
|
||||
const cachedEncrypted = (prerenderResumeDataCache == null ? void 0 : prerenderResumeDataCache.encryptedBoundArgs.get(cacheKey)) ?? (renderResumeDataCache == null ? void 0 : renderResumeDataCache.encryptedBoundArgs.get(cacheKey));
|
||||
if (cachedEncrypted) {
|
||||
return cachedEncrypted;
|
||||
}
|
||||
const encrypted = await encodeActionBoundArg(actionId, serialized);
|
||||
endReadIfStarted();
|
||||
prerenderResumeDataCache == null ? void 0 : prerenderResumeDataCache.encryptedBoundArgs.set(cacheKey, encrypted);
|
||||
return encrypted;
|
||||
});
|
||||
async function decryptActionBoundArgs(actionId, encryptedPromise) {
|
||||
const encrypted = await encryptedPromise;
|
||||
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
||||
let decrypted;
|
||||
if (workUnitStore) {
|
||||
const cacheSignal = (0, _workunitasyncstorageexternal.getCacheSignal)(workUnitStore);
|
||||
const prerenderResumeDataCache = (0, _workunitasyncstorageexternal.getPrerenderResumeDataCache)(workUnitStore);
|
||||
const renderResumeDataCache = (0, _workunitasyncstorageexternal.getRenderResumeDataCache)(workUnitStore);
|
||||
decrypted = (prerenderResumeDataCache == null ? void 0 : prerenderResumeDataCache.decryptedBoundArgs.get(encrypted)) ?? (renderResumeDataCache == null ? void 0 : renderResumeDataCache.decryptedBoundArgs.get(encrypted));
|
||||
if (!decrypted) {
|
||||
cacheSignal == null ? void 0 : cacheSignal.beginRead();
|
||||
decrypted = await decodeActionBoundArg(actionId, encrypted);
|
||||
cacheSignal == null ? void 0 : cacheSignal.endRead();
|
||||
prerenderResumeDataCache == null ? void 0 : prerenderResumeDataCache.decryptedBoundArgs.set(encrypted, decrypted);
|
||||
}
|
||||
} else {
|
||||
decrypted = await decodeActionBoundArg(actionId, encrypted);
|
||||
}
|
||||
const { edgeRscModuleMapping, rscModuleMapping } = (0, _manifestssingleton.getClientReferenceManifest)();
|
||||
// Using Flight to deserialize the args from the string.
|
||||
const deserialized = await (0, _client.createFromReadableStream)(new ReadableStream({
|
||||
start (controller) {
|
||||
controller.enqueue(textEncoder.encode(decrypted));
|
||||
switch(workUnitStore == null ? void 0 : workUnitStore.type){
|
||||
case 'prerender':
|
||||
case 'prerender-runtime':
|
||||
// Explicitly don't close the stream here (until prerendering is
|
||||
// complete) so that hanging promises are not rejected.
|
||||
if (workUnitStore.renderSignal.aborted) {
|
||||
controller.close();
|
||||
} else {
|
||||
workUnitStore.renderSignal.addEventListener('abort', ()=>controller.close(), {
|
||||
once: true
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'prerender-client':
|
||||
case 'validation-client':
|
||||
case 'prerender-ppr':
|
||||
case 'prerender-legacy':
|
||||
case 'request':
|
||||
case 'cache':
|
||||
case 'private-cache':
|
||||
case 'unstable-cache':
|
||||
case 'generate-static-params':
|
||||
case undefined:
|
||||
return controller.close();
|
||||
default:
|
||||
workUnitStore;
|
||||
}
|
||||
}
|
||||
}), {
|
||||
findSourceMapURL,
|
||||
// NOTE: When we serialized the bound args, we may have used a dummy debug channel to strip debug info.
|
||||
// In that case, it's important that we also *don't* pass a debug channel here, because that will make
|
||||
// the Flight Client ignore the dangling references:
|
||||
// https://github.com/facebook/react/blob/bb8a76c6cc77ea2976d690ea09f5a1b3d9b1792a/packages/react-client/src/ReactFlightClient.js#L1711-L1729
|
||||
// https://github.com/facebook/react/blob/bb8a76c6cc77ea2976d690ea09f5a1b3d9b1792a/packages/react-client/src/ReactFlightClient.js#L4005-L4025
|
||||
debugChannel: undefined,
|
||||
serverConsumerManifest: {
|
||||
// moduleLoading must be null because we don't want to trigger preloads of ClientReferences
|
||||
// to be added to the current execution. Instead, we'll wait for any ClientReference
|
||||
// to be emitted which themselves will handle the preloading.
|
||||
moduleLoading: null,
|
||||
moduleMap: isEdgeRuntime ? edgeRscModuleMapping : rscModuleMapping,
|
||||
serverModuleMap: (0, _manifestssingleton.getServerModuleMap)()
|
||||
}
|
||||
});
|
||||
return deserialized;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=encryption.js.map
|
||||
256
build/node_modules/next/dist/server/app-render/entry-base.js
generated
vendored
Normal file
256
build/node_modules/next/dist/server/app-render/entry-base.js
generated
vendored
Normal file
@@ -0,0 +1,256 @@
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
ClientPageRoot: null,
|
||||
ClientSegmentRoot: null,
|
||||
Fragment: null,
|
||||
HTTPAccessFallbackBoundary: null,
|
||||
InstantValidation: null,
|
||||
LayoutRouter: null,
|
||||
LoadingBoundaryProvider: null,
|
||||
Postpone: null,
|
||||
RenderFromTemplateContext: null,
|
||||
RootLayoutBoundary: null,
|
||||
SegmentViewNode: null,
|
||||
SegmentViewStateNode: null,
|
||||
actionAsyncStorage: null,
|
||||
captureOwnerStack: null,
|
||||
collectPrefetchHints: null,
|
||||
collectSegmentData: null,
|
||||
createElement: null,
|
||||
createMetadataComponents: null,
|
||||
createPrerenderParamsForClientSegment: null,
|
||||
createPrerenderSearchParamsForClientPage: null,
|
||||
createServerParamsForServerSegment: null,
|
||||
createServerSearchParamsForServerPage: null,
|
||||
createTemporaryReferenceSet: null,
|
||||
decodeAction: null,
|
||||
decodeFormState: null,
|
||||
decodeReply: null,
|
||||
patchFetch: null,
|
||||
preconnect: null,
|
||||
preloadFont: null,
|
||||
preloadStyle: null,
|
||||
prerender: null,
|
||||
renderToReadableStream: null,
|
||||
serverHooks: null,
|
||||
taintObjectReference: null,
|
||||
workAsyncStorage: null,
|
||||
workUnitAsyncStorage: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
ClientPageRoot: function() {
|
||||
return _clientpage.ClientPageRoot;
|
||||
},
|
||||
ClientSegmentRoot: function() {
|
||||
return _clientsegment.ClientSegmentRoot;
|
||||
},
|
||||
Fragment: function() {
|
||||
return _react.Fragment;
|
||||
},
|
||||
HTTPAccessFallbackBoundary: function() {
|
||||
return _errorboundary.HTTPAccessFallbackBoundary;
|
||||
},
|
||||
InstantValidation: function() {
|
||||
return InstantValidation;
|
||||
},
|
||||
LayoutRouter: function() {
|
||||
return _layoutrouter.default;
|
||||
},
|
||||
LoadingBoundaryProvider: function() {
|
||||
return _layoutrouter.LoadingBoundaryProvider;
|
||||
},
|
||||
Postpone: function() {
|
||||
return _postpone.Postpone;
|
||||
},
|
||||
RenderFromTemplateContext: function() {
|
||||
return _renderfromtemplatecontext.default;
|
||||
},
|
||||
RootLayoutBoundary: function() {
|
||||
return _boundarycomponents.RootLayoutBoundary;
|
||||
},
|
||||
SegmentViewNode: function() {
|
||||
return SegmentViewNode;
|
||||
},
|
||||
SegmentViewStateNode: function() {
|
||||
return SegmentViewStateNode;
|
||||
},
|
||||
actionAsyncStorage: function() {
|
||||
return _actionasyncstorageexternal.actionAsyncStorage;
|
||||
},
|
||||
captureOwnerStack: function() {
|
||||
return _react.captureOwnerStack;
|
||||
},
|
||||
collectPrefetchHints: function() {
|
||||
return _collectsegmentdata.collectPrefetchHints;
|
||||
},
|
||||
collectSegmentData: function() {
|
||||
return _collectsegmentdata.collectSegmentData;
|
||||
},
|
||||
createElement: function() {
|
||||
return _react.createElement;
|
||||
},
|
||||
createMetadataComponents: function() {
|
||||
return _metadata.createMetadataComponents;
|
||||
},
|
||||
createPrerenderParamsForClientSegment: function() {
|
||||
return _params.createPrerenderParamsForClientSegment;
|
||||
},
|
||||
createPrerenderSearchParamsForClientPage: function() {
|
||||
return _searchparams.createPrerenderSearchParamsForClientPage;
|
||||
},
|
||||
createServerParamsForServerSegment: function() {
|
||||
return _params.createServerParamsForServerSegment;
|
||||
},
|
||||
createServerSearchParamsForServerPage: function() {
|
||||
return _searchparams.createServerSearchParamsForServerPage;
|
||||
},
|
||||
createTemporaryReferenceSet: function() {
|
||||
return _server.createTemporaryReferenceSet;
|
||||
},
|
||||
decodeAction: function() {
|
||||
return _server.decodeAction;
|
||||
},
|
||||
decodeFormState: function() {
|
||||
return _server.decodeFormState;
|
||||
},
|
||||
decodeReply: function() {
|
||||
return _server.decodeReply;
|
||||
},
|
||||
patchFetch: function() {
|
||||
return patchFetch;
|
||||
},
|
||||
preconnect: function() {
|
||||
return _preloads.preconnect;
|
||||
},
|
||||
preloadFont: function() {
|
||||
return _preloads.preloadFont;
|
||||
},
|
||||
preloadStyle: function() {
|
||||
return _preloads.preloadStyle;
|
||||
},
|
||||
prerender: function() {
|
||||
return _static.prerender;
|
||||
},
|
||||
renderToReadableStream: function() {
|
||||
return _server.renderToReadableStream;
|
||||
},
|
||||
serverHooks: function() {
|
||||
return _hooksservercontext;
|
||||
},
|
||||
taintObjectReference: function() {
|
||||
return _taint.taintObjectReference;
|
||||
},
|
||||
workAsyncStorage: function() {
|
||||
return _workasyncstorageexternal.workAsyncStorage;
|
||||
},
|
||||
workUnitAsyncStorage: function() {
|
||||
return _workunitasyncstorageexternal.workUnitAsyncStorage;
|
||||
}
|
||||
});
|
||||
const _server = require("react-server-dom-webpack/server");
|
||||
const _static = require("react-server-dom-webpack/static");
|
||||
const _react = require("react");
|
||||
const _layoutrouter = /*#__PURE__*/ _interop_require_wildcard(require("../../client/components/layout-router"));
|
||||
const _renderfromtemplatecontext = /*#__PURE__*/ _interop_require_default(require("../../client/components/render-from-template-context"));
|
||||
const _workasyncstorageexternal = require("../app-render/work-async-storage.external");
|
||||
const _workunitasyncstorageexternal = require("./work-unit-async-storage.external");
|
||||
const _actionasyncstorageexternal = require("../app-render/action-async-storage.external");
|
||||
const _clientpage = require("../../client/components/client-page");
|
||||
const _clientsegment = require("../../client/components/client-segment");
|
||||
const _searchparams = require("../request/search-params");
|
||||
const _params = require("../request/params");
|
||||
const _hooksservercontext = /*#__PURE__*/ _interop_require_wildcard(require("../../client/components/hooks-server-context"));
|
||||
const _errorboundary = require("../../client/components/http-access-fallback/error-boundary");
|
||||
const _metadata = require("../../lib/metadata/metadata");
|
||||
const _boundarycomponents = require("../../lib/framework/boundary-components");
|
||||
const _preloads = require("./rsc/preloads");
|
||||
const _postpone = require("./rsc/postpone");
|
||||
const _taint = require("./rsc/taint");
|
||||
const _collectsegmentdata = require("./collect-segment-data");
|
||||
const _patchfetch = require("../lib/patch-fetch");
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== "function") return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function(nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interop_require_wildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
||||
return {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {
|
||||
__proto__: null
|
||||
};
|
||||
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for(var key in obj){
|
||||
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
const InstantValidation = ()=>{
|
||||
if (process.env.NEXT_RUNTIME !== 'edge' && process.env.__NEXT_CACHE_COMPONENTS) {
|
||||
return require('./instant-validation/instant-validation');
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
let SegmentViewNode = ()=>null;
|
||||
let SegmentViewStateNode = ()=>null;
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
const mod = require('../../next-devtools/userspace/app/segment-explorer-node');
|
||||
SegmentViewNode = mod.SegmentViewNode;
|
||||
SegmentViewStateNode = mod.SegmentViewStateNode;
|
||||
}
|
||||
// hot-reloader modules are not bundled so we need to inject `__next__clear_chunk_cache__`
|
||||
// into globalThis from this file which is bundled.
|
||||
if (process.env.TURBOPACK) {
|
||||
globalThis.__next__clear_chunk_cache__ = __turbopack_clear_chunk_cache__;
|
||||
} else {
|
||||
// Webpack does not have chunks on the server
|
||||
globalThis.__next__clear_chunk_cache__ = null;
|
||||
}
|
||||
function patchFetch() {
|
||||
return (0, _patchfetch.patchFetch)({
|
||||
workAsyncStorage: _workasyncstorageexternal.workAsyncStorage,
|
||||
workUnitAsyncStorage: _workunitasyncstorageexternal.workUnitAsyncStorage
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=entry-base.js.map
|
||||
28
build/node_modules/next/dist/server/app-render/flight-render-result.js
generated
vendored
Normal file
28
build/node_modules/next/dist/server/app-render/flight-render-result.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "FlightRenderResult", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return FlightRenderResult;
|
||||
}
|
||||
});
|
||||
const _approuterheaders = require("../../client/components/app-router-headers");
|
||||
const _renderresult = /*#__PURE__*/ _interop_require_default(require("../render-result"));
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
class FlightRenderResult extends _renderresult.default {
|
||||
constructor(response, metadata = {}, waitUntil){
|
||||
super(response, {
|
||||
contentType: _approuterheaders.RSC_CONTENT_TYPE_HEADER,
|
||||
metadata,
|
||||
waitUntil
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=flight-render-result.js.map
|
||||
29
build/node_modules/next/dist/server/app-render/get-asset-query-string.js
generated
vendored
Normal file
29
build/node_modules/next/dist/server/app-render/get-asset-query-string.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "getAssetQueryString", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return getAssetQueryString;
|
||||
}
|
||||
});
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTurbopack = !!process.env.TURBOPACK;
|
||||
function getAssetQueryString(ctx, addTimestamp) {
|
||||
let qs = '';
|
||||
// In development we add the request timestamp to allow react to
|
||||
// reload assets when a new RSC response is received.
|
||||
// Turbopack handles HMR of assets itself and react doesn't need to reload them
|
||||
// so this approach is not needed for Turbopack.
|
||||
const shouldAddVersion = isDev && !isTurbopack && addTimestamp;
|
||||
if (shouldAddVersion) {
|
||||
qs += `?v=${ctx.requestTimestamp}`;
|
||||
}
|
||||
if (ctx.sharedContext.clientAssetToken) {
|
||||
qs += `${shouldAddVersion ? '&' : '?'}dpl=${ctx.sharedContext.clientAssetToken}`;
|
||||
}
|
||||
return qs;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-asset-query-string.js.map
|
||||
49
build/node_modules/next/dist/server/app-render/get-css-inlined-link-tags.js
generated
vendored
Normal file
49
build/node_modules/next/dist/server/app-render/get-css-inlined-link-tags.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "getLinkAndScriptTags", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return getLinkAndScriptTags;
|
||||
}
|
||||
});
|
||||
const _manifestssingleton = require("./manifests-singleton");
|
||||
function getLinkAndScriptTags(filePath, injectedCSS, injectedScripts, collectNewImports) {
|
||||
const filePathWithoutExt = filePath.replace(/\.[^.]+$/, '');
|
||||
const cssChunks = new Set();
|
||||
const jsChunks = new Set();
|
||||
const { entryCSSFiles, entryJSFiles } = (0, _manifestssingleton.getClientReferenceManifest)();
|
||||
const cssFiles = entryCSSFiles[filePathWithoutExt];
|
||||
const jsFiles = entryJSFiles == null ? void 0 : entryJSFiles[filePathWithoutExt];
|
||||
if (cssFiles) {
|
||||
for (const css of cssFiles){
|
||||
if (!injectedCSS.has(css.path)) {
|
||||
if (collectNewImports) {
|
||||
injectedCSS.add(css.path);
|
||||
}
|
||||
cssChunks.add(css);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (jsFiles) {
|
||||
for (const file of jsFiles){
|
||||
if (!injectedScripts.has(file)) {
|
||||
if (collectNewImports) {
|
||||
injectedScripts.add(file);
|
||||
}
|
||||
jsChunks.add(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
styles: [
|
||||
...cssChunks
|
||||
],
|
||||
scripts: [
|
||||
...jsChunks
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-css-inlined-link-tags.js.map
|
||||
65
build/node_modules/next/dist/server/app-render/get-layer-assets.js
generated
vendored
Normal file
65
build/node_modules/next/dist/server/app-render/get-layer-assets.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "getLayerAssets", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return getLayerAssets;
|
||||
}
|
||||
});
|
||||
const _getcssinlinedlinktags = require("./get-css-inlined-link-tags");
|
||||
const _getpreloadablefonts = require("./get-preloadable-fonts");
|
||||
const _getassetquerystring = require("./get-asset-query-string");
|
||||
const _encodeuripath = require("../../shared/lib/encode-uri-path");
|
||||
const _rendercssresource = require("./render-css-resource");
|
||||
function getLayerAssets({ ctx, layoutOrPagePath, injectedCSS: injectedCSSWithCurrentLayout, injectedJS: injectedJSWithCurrentLayout, injectedFontPreloadTags: injectedFontPreloadTagsWithCurrentLayout, preloadCallbacks }) {
|
||||
const { componentMod: { createElement } } = ctx;
|
||||
const { styles: styleTags, scripts: scriptTags } = layoutOrPagePath ? (0, _getcssinlinedlinktags.getLinkAndScriptTags)(layoutOrPagePath, injectedCSSWithCurrentLayout, injectedJSWithCurrentLayout, true) : {
|
||||
styles: [],
|
||||
scripts: []
|
||||
};
|
||||
const preloadedFontFiles = layoutOrPagePath ? (0, _getpreloadablefonts.getPreloadableFonts)(ctx.renderOpts.nextFontManifest, layoutOrPagePath, injectedFontPreloadTagsWithCurrentLayout) : null;
|
||||
if (preloadedFontFiles) {
|
||||
if (preloadedFontFiles.length) {
|
||||
for(let i = 0; i < preloadedFontFiles.length; i++){
|
||||
const fontFilename = preloadedFontFiles[i];
|
||||
const ext = /\.(woff|woff2|eot|ttf|otf)$/.exec(fontFilename)[1];
|
||||
const type = `font/${ext}`;
|
||||
const href = `${ctx.assetPrefix}/_next/${(0, _encodeuripath.encodeURIPath)(fontFilename)}${(0, _getassetquerystring.getAssetQueryString)(ctx, true)}`;
|
||||
preloadCallbacks.push(()=>{
|
||||
ctx.componentMod.preloadFont(href, type, ctx.renderOpts.crossOrigin, ctx.nonce);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
let url = new URL(ctx.assetPrefix);
|
||||
preloadCallbacks.push(()=>{
|
||||
ctx.componentMod.preconnect(url.origin, 'anonymous', ctx.nonce);
|
||||
});
|
||||
} catch (error) {
|
||||
// assetPrefix must not be a fully qualified domain name. We assume
|
||||
// we should preconnect to same origin instead
|
||||
preloadCallbacks.push(()=>{
|
||||
ctx.componentMod.preconnect('/', 'anonymous', ctx.nonce);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
const styles = (0, _rendercssresource.renderCssResource)(styleTags, ctx, preloadCallbacks);
|
||||
const scripts = scriptTags ? scriptTags.map((href, index)=>{
|
||||
const fullSrc = `${ctx.assetPrefix}/_next/${(0, _encodeuripath.encodeURIPath)(href)}${(0, _getassetquerystring.getAssetQueryString)(ctx, true)}`;
|
||||
return createElement('script', {
|
||||
src: fullSrc,
|
||||
async: true,
|
||||
key: `script-${index}`,
|
||||
nonce: ctx.nonce
|
||||
});
|
||||
}) : [];
|
||||
return styles.length || scripts.length ? [
|
||||
...styles,
|
||||
...scripts
|
||||
] : null;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-layer-assets.js.map
|
||||
39
build/node_modules/next/dist/server/app-render/get-preloadable-fonts.js
generated
vendored
Normal file
39
build/node_modules/next/dist/server/app-render/get-preloadable-fonts.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "getPreloadableFonts", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return getPreloadableFonts;
|
||||
}
|
||||
});
|
||||
function getPreloadableFonts(nextFontManifest, filePath, injectedFontPreloadTags) {
|
||||
if (!nextFontManifest || !filePath) {
|
||||
return null;
|
||||
}
|
||||
const filepathWithoutExtension = filePath.replace(/\.[^.]+$/, '');
|
||||
const fontFiles = new Set();
|
||||
let foundFontUsage = false;
|
||||
const preloadedFontFiles = nextFontManifest.app[filepathWithoutExtension];
|
||||
if (preloadedFontFiles) {
|
||||
foundFontUsage = true;
|
||||
for (const fontFile of preloadedFontFiles){
|
||||
if (!injectedFontPreloadTags.has(fontFile)) {
|
||||
fontFiles.add(fontFile);
|
||||
injectedFontPreloadTags.add(fontFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fontFiles.size) {
|
||||
return [
|
||||
...fontFiles
|
||||
].sort();
|
||||
} else if (foundFontUsage && injectedFontPreloadTags.size === 0) {
|
||||
return [];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-preloadable-fonts.js.map
|
||||
32
build/node_modules/next/dist/server/app-render/get-script-nonce-from-header.js
generated
vendored
Normal file
32
build/node_modules/next/dist/server/app-render/get-script-nonce-from-header.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "getScriptNonceFromHeader", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return getScriptNonceFromHeader;
|
||||
}
|
||||
});
|
||||
const CSP_NONCE_SOURCE_REGEX = /^'nonce-([A-Za-z0-9+/_-]+={0,2})'$/;
|
||||
function getScriptNonceFromHeader(cspHeaderValue) {
|
||||
const directives = cspHeaderValue// Directives are split by ';'.
|
||||
.split(';').map((directive)=>directive.trim());
|
||||
// First try to find the directive for the 'script-src', otherwise try to
|
||||
// fallback to the 'default-src'.
|
||||
const directive = directives.find((dir)=>dir.startsWith('script-src')) || directives.find((dir)=>dir.startsWith('default-src'));
|
||||
// If no directive could be found, then we're done.
|
||||
if (!directive) {
|
||||
return;
|
||||
}
|
||||
// Extract the first valid nonce from the directive. Malformed nonces are
|
||||
// ignored so the request can continue without a nonce instead of failing.
|
||||
for (const source of directive.split(/\s+/).slice(1)){
|
||||
const match = source.trim().match(CSP_NONCE_SOURCE_REGEX);
|
||||
if (match) {
|
||||
return match[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-script-nonce-from-header.js.map
|
||||
25
build/node_modules/next/dist/server/app-render/get-short-dynamic-param-type.js
generated
vendored
Normal file
25
build/node_modules/next/dist/server/app-render/get-short-dynamic-param-type.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "dynamicParamTypes", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return dynamicParamTypes;
|
||||
}
|
||||
});
|
||||
const dynamicParamTypes = {
|
||||
catchall: 'c',
|
||||
'catchall-intercepted-(..)(..)': 'ci(..)(..)',
|
||||
'catchall-intercepted-(.)': 'ci(.)',
|
||||
'catchall-intercepted-(..)': 'ci(..)',
|
||||
'catchall-intercepted-(...)': 'ci(...)',
|
||||
'optional-catchall': 'oc',
|
||||
dynamic: 'd',
|
||||
'dynamic-intercepted-(..)(..)': 'di(..)(..)',
|
||||
'dynamic-intercepted-(.)': 'di(.)',
|
||||
'dynamic-intercepted-(..)': 'di(..)',
|
||||
'dynamic-intercepted-(...)': 'di(...)'
|
||||
};
|
||||
|
||||
//# sourceMappingURL=get-short-dynamic-param-type.js.map
|
||||
19
build/node_modules/next/dist/server/app-render/has-loading-component-in-tree.js
generated
vendored
Normal file
19
build/node_modules/next/dist/server/app-render/has-loading-component-in-tree.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "hasLoadingComponentInTree", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return hasLoadingComponentInTree;
|
||||
}
|
||||
});
|
||||
function hasLoadingComponentInTree(tree) {
|
||||
const [, parallelRoutes, { loading }] = tree;
|
||||
if (loading) {
|
||||
return true;
|
||||
}
|
||||
return Object.values(parallelRoutes).some((parallelRoute)=>hasLoadingComponentInTree(parallelRoute));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=has-loading-component-in-tree.js.map
|
||||
13
build/node_modules/next/dist/server/app-render/instant-validation/boundary-constants.js
generated
vendored
Normal file
13
build/node_modules/next/dist/server/app-render/instant-validation/boundary-constants.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "INSTANT_VALIDATION_BOUNDARY_NAME", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return INSTANT_VALIDATION_BOUNDARY_NAME;
|
||||
}
|
||||
});
|
||||
const INSTANT_VALIDATION_BOUNDARY_NAME = '__next_instant_validation_boundary__';
|
||||
|
||||
//# sourceMappingURL=boundary-constants.js.map
|
||||
103
build/node_modules/next/dist/server/app-render/instant-validation/boundary-impl.js
generated
vendored
Normal file
103
build/node_modules/next/dist/server/app-render/instant-validation/boundary-impl.js
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
/* eslint-disable @next/internal/no-ambiguous-jsx -- React Client */ // Do not put a "use client" directive here. Import this module via the shim in
|
||||
// `packages/next/src/client/components/instant-validation/boundary.tsx` instead.
|
||||
// 'use client'
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
InstantValidationBoundaryContext: null,
|
||||
PlaceValidationBoundaryBelowThisLevel: null,
|
||||
RenderValidationBoundaryAtThisLevel: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
InstantValidationBoundaryContext: function() {
|
||||
return InstantValidationBoundaryContext;
|
||||
},
|
||||
PlaceValidationBoundaryBelowThisLevel: function() {
|
||||
return PlaceValidationBoundaryBelowThisLevel;
|
||||
},
|
||||
RenderValidationBoundaryAtThisLevel: function() {
|
||||
return RenderValidationBoundaryAtThisLevel;
|
||||
}
|
||||
});
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _react = require("react");
|
||||
const _boundaryconstants = require("./boundary-constants");
|
||||
const _invarianterror = require("../../../shared/lib/invariant-error");
|
||||
const _workunitasyncstorageexternal = require("../work-unit-async-storage.external");
|
||||
if (typeof window !== 'undefined') {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('Instant validation boundaries should never appear in browser bundles.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E1117",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
function getValidationBoundaryTracking() {
|
||||
const store = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
||||
if (!store) return null;
|
||||
switch(store.type){
|
||||
case 'validation-client':
|
||||
return store.boundaryState;
|
||||
case 'prerender':
|
||||
case 'prerender-client':
|
||||
case 'prerender-ppr':
|
||||
case 'prerender-legacy':
|
||||
case 'prerender-runtime':
|
||||
case 'request':
|
||||
case 'cache':
|
||||
case 'private-cache':
|
||||
case 'unstable-cache':
|
||||
case 'generate-static-params':
|
||||
break;
|
||||
default:
|
||||
store;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// We use a namespace object to allow us to recover the name of the function
|
||||
// at runtime even when production bundling/minification is used.
|
||||
const NameSpace = {
|
||||
[_boundaryconstants.INSTANT_VALIDATION_BOUNDARY_NAME]: function({ id, children }) {
|
||||
// Track which boundaries we actually managed to render.
|
||||
const state = getValidationBoundaryTracking();
|
||||
if (state === null) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('Missing boundary tracking state'), "__NEXT_ERROR_CODE", {
|
||||
value: "E1060",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
state.renderedIds.add(id);
|
||||
return children;
|
||||
}
|
||||
};
|
||||
const InstantValidationBoundaryContext = /*#__PURE__*/ (0, _react.createContext)(null);
|
||||
function PlaceValidationBoundaryBelowThisLevel({ id, children }) {
|
||||
return(// OuterLayoutRouter will see this and render a `RenderValidationBoundaryAtThisLevel`.
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)(InstantValidationBoundaryContext, {
|
||||
value: id,
|
||||
children: children
|
||||
}));
|
||||
}
|
||||
function RenderValidationBoundaryAtThisLevel({ id, children }) {
|
||||
// We got a boundaryId from the context. Clear the context so that the children don't render another boundary.
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsx)(InstantValidationBoundary, {
|
||||
id: id,
|
||||
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(InstantValidationBoundaryContext, {
|
||||
value: null,
|
||||
children: children
|
||||
})
|
||||
});
|
||||
}
|
||||
const InstantValidationBoundary = // We use slice(0) to trick the bundler into not inlining/minifying the function
|
||||
// so it retains the name inferred from the namespace object
|
||||
NameSpace[_boundaryconstants.INSTANT_VALIDATION_BOUNDARY_NAME.slice(0)];
|
||||
|
||||
//# sourceMappingURL=boundary-impl.js.map
|
||||
18
build/node_modules/next/dist/server/app-render/instant-validation/boundary-tracking.js
generated
vendored
Normal file
18
build/node_modules/next/dist/server/app-render/instant-validation/boundary-tracking.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "createValidationBoundaryTracking", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return createValidationBoundaryTracking;
|
||||
}
|
||||
});
|
||||
function createValidationBoundaryTracking() {
|
||||
return {
|
||||
expectedIds: new Set(),
|
||||
renderedIds: new Set()
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=boundary-tracking.js.map
|
||||
181
build/node_modules/next/dist/server/app-render/instant-validation/instant-config.js
generated
vendored
Normal file
181
build/node_modules/next/dist/server/app-render/instant-validation/instant-config.js
generated
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
anySegmentHasRuntimePrefetchEnabled: null,
|
||||
anySegmentNeedsInstantValidationInBuild: null,
|
||||
anySegmentNeedsInstantValidationInDev: null,
|
||||
findSegmentsWithInstantConfig: null,
|
||||
isPageAllowedToBlock: null,
|
||||
resolveInstantConfigSamplesForPage: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
anySegmentHasRuntimePrefetchEnabled: function() {
|
||||
return anySegmentHasRuntimePrefetchEnabled;
|
||||
},
|
||||
anySegmentNeedsInstantValidationInBuild: function() {
|
||||
return anySegmentNeedsInstantValidationInBuild;
|
||||
},
|
||||
anySegmentNeedsInstantValidationInDev: function() {
|
||||
return anySegmentNeedsInstantValidationInDev;
|
||||
},
|
||||
findSegmentsWithInstantConfig: function() {
|
||||
return findSegmentsWithInstantConfig;
|
||||
},
|
||||
isPageAllowedToBlock: function() {
|
||||
return isPageAllowedToBlock;
|
||||
},
|
||||
resolveInstantConfigSamplesForPage: function() {
|
||||
return resolveInstantConfigSamplesForPage;
|
||||
}
|
||||
});
|
||||
const _appdirmodule = require("../../lib/app-dir-module");
|
||||
const _parseloadertree = require("../../../shared/lib/router/utils/parse-loader-tree");
|
||||
const _workasyncstorageexternal = require("../work-async-storage.external");
|
||||
async function anySegmentHasRuntimePrefetchEnabled(tree) {
|
||||
const { mod: layoutOrPageMod } = await (0, _appdirmodule.getLayoutOrPageModule)(tree);
|
||||
// TODO(restart-on-cache-miss): Does this work correctly for client page/layout modules?
|
||||
const instantConfig = layoutOrPageMod ? layoutOrPageMod.unstable_instant : undefined;
|
||||
const hasRuntimePrefetch = instantConfig && typeof instantConfig === 'object' ? instantConfig.prefetch === 'runtime' : false;
|
||||
if (hasRuntimePrefetch) {
|
||||
return true;
|
||||
}
|
||||
const { parallelRoutes } = (0, _parseloadertree.parseLoaderTree)(tree);
|
||||
for(const parallelRouteKey in parallelRoutes){
|
||||
const parallelRoute = parallelRoutes[parallelRouteKey];
|
||||
const hasChildRuntimePrefetch = await anySegmentHasRuntimePrefetchEnabled(parallelRoute);
|
||||
if (hasChildRuntimePrefetch) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
async function isPageAllowedToBlock(tree) {
|
||||
const { mod: layoutOrPageMod } = await (0, _appdirmodule.getLayoutOrPageModule)(tree);
|
||||
// TODO(restart-on-cache-miss): Does this work correctly for client page/layout modules?
|
||||
const instantConfig = layoutOrPageMod ? layoutOrPageMod.unstable_instant : undefined;
|
||||
// If we encounter a non-false instant config before a instant=false,
|
||||
// the page isn't allowed to block. The config expresses a requirement for
|
||||
// instant UI, so we should make sure that a static shell exists.
|
||||
// (even if it'd use runtime prefetching for client navs)
|
||||
if (instantConfig !== undefined) {
|
||||
if (typeof instantConfig === 'object') {
|
||||
return false;
|
||||
} else if (instantConfig === false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
const { parallelRoutes } = (0, _parseloadertree.parseLoaderTree)(tree);
|
||||
for(const parallelRouteKey in parallelRoutes){
|
||||
const parallelRoute = parallelRoutes[parallelRouteKey];
|
||||
const subtreeIsBlocking = await isPageAllowedToBlock(parallelRoute);
|
||||
if (subtreeIsBlocking) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Checks if any segments in the loader tree have `instant` configs that need validating.
|
||||
* NOTE: Client navigations call this multiple times, so we cache it.
|
||||
* */ // Shared helper (not exported, not cached — called by the cached wrappers)
|
||||
async function anySegmentNeedsInstantValidation(rootTree, mode) {
|
||||
const segments = await findSegmentsWithInstantConfig(rootTree);
|
||||
// Check if there's any configs with `prefetch: 'static'` or `mode: 'instant'`.
|
||||
// (If there's only `false`, there's no need to run validation).
|
||||
// If any segment has `unstable_disableValidation`, we skip validation for the whole tree.
|
||||
let needsValidation = false;
|
||||
for (const { config } of segments){
|
||||
if (typeof config === 'object') {
|
||||
if (config.unstable_disableValidation === true || mode === 'dev' && config.unstable_disableDevValidation === true || mode === 'build' && config.unstable_disableBuildValidation === true) {
|
||||
return false;
|
||||
}
|
||||
// do not short-circuit, some other segment might still have `unstable_disableValidation`
|
||||
needsValidation = true;
|
||||
}
|
||||
}
|
||||
return needsValidation;
|
||||
}
|
||||
const anySegmentNeedsInstantValidationInDev = cacheScopedToWorkStore(async (rootTree)=>anySegmentNeedsInstantValidation(rootTree, 'dev'));
|
||||
const anySegmentNeedsInstantValidationInBuild = cacheScopedToWorkStore(async (rootTree)=>anySegmentNeedsInstantValidation(rootTree, 'build'));
|
||||
const findSegmentsWithInstantConfig = cacheScopedToWorkStore(async (rootTree)=>{
|
||||
const results = [];
|
||||
async function visit(tree, path) {
|
||||
const { mod: layoutOrPageMod } = await (0, _appdirmodule.getLayoutOrPageModule)(tree);
|
||||
// TODO(restart-on-cache-miss): Does this work correctly for client page/layout modules?
|
||||
const instantConfig = layoutOrPageMod ? layoutOrPageMod.unstable_instant : undefined;
|
||||
if (instantConfig !== undefined) {
|
||||
results.push({
|
||||
path,
|
||||
config: instantConfig
|
||||
});
|
||||
}
|
||||
const { parallelRoutes } = (0, _parseloadertree.parseLoaderTree)(tree);
|
||||
for(const parallelRouteKey in parallelRoutes){
|
||||
const childTree = parallelRoutes[parallelRouteKey];
|
||||
await visit(childTree, [
|
||||
...path,
|
||||
parallelRouteKey
|
||||
]);
|
||||
}
|
||||
}
|
||||
await visit(rootTree, []);
|
||||
return results;
|
||||
});
|
||||
const resolveInstantConfigSamplesForPage = async (tree)=>{
|
||||
const { mod: layoutOrPageMod } = await (0, _appdirmodule.getLayoutOrPageModule)(tree);
|
||||
const instantConfig = layoutOrPageMod ? layoutOrPageMod.unstable_instant : undefined;
|
||||
let samples = null;
|
||||
if (instantConfig !== undefined && typeof instantConfig === 'object' && instantConfig.samples) {
|
||||
samples = instantConfig.samples;
|
||||
}
|
||||
// The samples from inner segments override samples from outer segments,
|
||||
// i.e. a page overrides the samples from a layout.
|
||||
// We do not perform any merging logic.
|
||||
const { parallelRoutes } = (0, _parseloadertree.parseLoaderTree)(tree);
|
||||
for(const parallelRouteKey in parallelRoutes){
|
||||
if (parallelRouteKey !== 'children') {
|
||||
continue;
|
||||
}
|
||||
const childTree = parallelRoutes[parallelRouteKey];
|
||||
const childSamples = await resolveInstantConfigSamplesForPage(childTree);
|
||||
if (childSamples !== null) {
|
||||
samples = childSamples;
|
||||
}
|
||||
}
|
||||
return samples;
|
||||
};
|
||||
/**
|
||||
* A simple cache wrapper for 1-argument functions.
|
||||
* The cache will live as long as the current WorkStore,
|
||||
* i.e. it's scoped to a single request.
|
||||
*/ function cacheScopedToWorkStore(func) {
|
||||
const resultsPerWorkStore = new WeakMap();
|
||||
return (arg)=>{
|
||||
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
||||
if (!workStore) {
|
||||
// No caching.
|
||||
return func(arg);
|
||||
}
|
||||
let results = resultsPerWorkStore.get(workStore);
|
||||
if (results && results.has(arg)) {
|
||||
return results.get(arg);
|
||||
}
|
||||
const result = func(arg);
|
||||
if (!results) {
|
||||
results = new WeakMap();
|
||||
resultsPerWorkStore.set(workStore, results);
|
||||
}
|
||||
results.set(arg, result);
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=instant-config.js.map
|
||||
128
build/node_modules/next/dist/server/app-render/instant-validation/instant-samples-client.js
generated
vendored
Normal file
128
build/node_modules/next/dist/server/app-render/instant-validation/instant-samples-client.js
generated
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
expectCompleteParamsInClientValidation: null,
|
||||
instrumentParamsForClientValidation: null,
|
||||
instrumentSearchParamsForClientValidation: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
expectCompleteParamsInClientValidation: function() {
|
||||
return expectCompleteParamsInClientValidation;
|
||||
},
|
||||
instrumentParamsForClientValidation: function() {
|
||||
return instrumentParamsForClientValidation;
|
||||
},
|
||||
instrumentSearchParamsForClientValidation: function() {
|
||||
return instrumentSearchParamsForClientValidation;
|
||||
}
|
||||
});
|
||||
const _workunitasyncstorageexternal = require("../work-unit-async-storage.external");
|
||||
const _workasyncstorageexternal = require("../work-async-storage.external");
|
||||
const _instantsamples = require("./instant-samples");
|
||||
const _instantvalidationerror = require("./instant-validation-error");
|
||||
function instrumentParamsForClientValidation(underlyingParams) {
|
||||
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
||||
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
||||
if (workStore && workUnitStore) {
|
||||
switch(workUnitStore.type){
|
||||
case 'validation-client':
|
||||
{
|
||||
if (workUnitStore.validationSamples) {
|
||||
const declaredKeys = new Set(Object.keys(workUnitStore.validationSamples.params ?? {}));
|
||||
return (0, _instantsamples.createExhaustiveParamsProxy)(underlyingParams, declaredKeys, workStore.route);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'prerender-runtime':
|
||||
case 'prerender-client':
|
||||
case 'prerender-legacy':
|
||||
case 'prerender-ppr':
|
||||
case 'prerender':
|
||||
case 'cache':
|
||||
case 'request':
|
||||
case 'private-cache':
|
||||
case 'unstable-cache':
|
||||
case 'generate-static-params':
|
||||
break;
|
||||
default:
|
||||
workUnitStore;
|
||||
}
|
||||
}
|
||||
return underlyingParams;
|
||||
}
|
||||
function expectCompleteParamsInClientValidation(expression) {
|
||||
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
||||
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
||||
if (workStore && workUnitStore) {
|
||||
switch(workUnitStore.type){
|
||||
case 'validation-client':
|
||||
{
|
||||
if (workUnitStore.validationSamples) {
|
||||
const fallbackParams = workUnitStore.fallbackRouteParams;
|
||||
if (fallbackParams && fallbackParams.size > 0) {
|
||||
const missingParams = Array.from(fallbackParams.keys());
|
||||
(0, _instantsamples.trackMissingSampleErrorAndThrow)(Object.defineProperty(new _instantvalidationerror.InstantValidationError(`Route "${workStore.route}" called ${expression} but param${missingParams.length > 1 ? 's' : ''} ${missingParams.map((p)=>`"${p}"`).join(', ')} ${missingParams.length > 1 ? 'are' : 'is'} not defined in the \`samples\` of \`unstable_instant\`. ` + `${expression} requires all route params to be provided.`), "__NEXT_ERROR_CODE", {
|
||||
value: "E1109",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
}));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'prerender-runtime':
|
||||
case 'prerender-client':
|
||||
case 'prerender-legacy':
|
||||
case 'prerender-ppr':
|
||||
case 'prerender':
|
||||
case 'cache':
|
||||
case 'request':
|
||||
case 'private-cache':
|
||||
case 'unstable-cache':
|
||||
case 'generate-static-params':
|
||||
break;
|
||||
default:
|
||||
workUnitStore;
|
||||
}
|
||||
}
|
||||
}
|
||||
function instrumentSearchParamsForClientValidation(underlyingSearchParams) {
|
||||
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
||||
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
||||
if (workStore && workUnitStore) {
|
||||
switch(workUnitStore.type){
|
||||
case 'validation-client':
|
||||
{
|
||||
if (workUnitStore.validationSamples) {
|
||||
const declaredKeys = new Set(Object.keys(workUnitStore.validationSamples.searchParams ?? {}));
|
||||
return (0, _instantsamples.createExhaustiveURLSearchParamsProxy)(underlyingSearchParams, declaredKeys, workStore.route);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'prerender-runtime':
|
||||
case 'prerender-client':
|
||||
case 'prerender-legacy':
|
||||
case 'prerender-ppr':
|
||||
case 'prerender':
|
||||
case 'cache':
|
||||
case 'request':
|
||||
case 'private-cache':
|
||||
case 'unstable-cache':
|
||||
case 'generate-static-params':
|
||||
break;
|
||||
default:
|
||||
workUnitStore;
|
||||
}
|
||||
}
|
||||
return underlyingSearchParams;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=instant-samples-client.js.map
|
||||
432
build/node_modules/next/dist/server/app-render/instant-validation/instant-samples.js
generated
vendored
Normal file
432
build/node_modules/next/dist/server/app-render/instant-validation/instant-samples.js
generated
vendored
Normal file
@@ -0,0 +1,432 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
assertRootParamInSamples: null,
|
||||
createCookiesFromSample: null,
|
||||
createDraftModeForValidation: null,
|
||||
createExhaustiveParamsProxy: null,
|
||||
createExhaustiveSearchParamsProxy: null,
|
||||
createExhaustiveURLSearchParamsProxy: null,
|
||||
createHeadersFromSample: null,
|
||||
createRelativeURLFromSamples: null,
|
||||
createValidationSampleTracking: null,
|
||||
trackMissingSampleError: null,
|
||||
trackMissingSampleErrorAndThrow: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
assertRootParamInSamples: function() {
|
||||
return assertRootParamInSamples;
|
||||
},
|
||||
createCookiesFromSample: function() {
|
||||
return createCookiesFromSample;
|
||||
},
|
||||
createDraftModeForValidation: function() {
|
||||
return createDraftModeForValidation;
|
||||
},
|
||||
createExhaustiveParamsProxy: function() {
|
||||
return createExhaustiveParamsProxy;
|
||||
},
|
||||
createExhaustiveSearchParamsProxy: function() {
|
||||
return createExhaustiveSearchParamsProxy;
|
||||
},
|
||||
createExhaustiveURLSearchParamsProxy: function() {
|
||||
return createExhaustiveURLSearchParamsProxy;
|
||||
},
|
||||
createHeadersFromSample: function() {
|
||||
return createHeadersFromSample;
|
||||
},
|
||||
createRelativeURLFromSamples: function() {
|
||||
return createRelativeURLFromSamples;
|
||||
},
|
||||
createValidationSampleTracking: function() {
|
||||
return createValidationSampleTracking;
|
||||
},
|
||||
trackMissingSampleError: function() {
|
||||
return trackMissingSampleError;
|
||||
},
|
||||
trackMissingSampleErrorAndThrow: function() {
|
||||
return trackMissingSampleErrorAndThrow;
|
||||
}
|
||||
});
|
||||
const _cookies = require("../../web/spec-extension/cookies");
|
||||
const _requestcookies = require("../../web/spec-extension/adapters/request-cookies");
|
||||
const _headers = require("../../web/spec-extension/adapters/headers");
|
||||
const _getsegmentparam = require("../../../shared/lib/router/utils/get-segment-param");
|
||||
const _parserelativeurl = require("../../../shared/lib/router/utils/parse-relative-url");
|
||||
const _invarianterror = require("../../../shared/lib/invariant-error");
|
||||
const _instantvalidationerror = require("./instant-validation-error");
|
||||
const _workunitasyncstorageexternal = require("../work-unit-async-storage.external");
|
||||
const _reflectutils = require("../../../shared/lib/utils/reflect-utils");
|
||||
function createValidationSampleTracking() {
|
||||
return {
|
||||
missingSampleErrors: []
|
||||
};
|
||||
}
|
||||
function getExpectedSampleTracking() {
|
||||
let validationSampleTracking = null;
|
||||
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
||||
if (workUnitStore) {
|
||||
switch(workUnitStore.type){
|
||||
case 'request':
|
||||
case 'validation-client':
|
||||
// TODO(instant-validation-build): do we need any special handling for caches?
|
||||
validationSampleTracking = workUnitStore.validationSampleTracking ?? null;
|
||||
break;
|
||||
case 'cache':
|
||||
case 'private-cache':
|
||||
case 'unstable-cache':
|
||||
case 'prerender-legacy':
|
||||
case 'prerender-ppr':
|
||||
case 'prerender-client':
|
||||
case 'prerender':
|
||||
case 'prerender-runtime':
|
||||
case 'generate-static-params':
|
||||
break;
|
||||
default:
|
||||
workUnitStore;
|
||||
}
|
||||
}
|
||||
if (!validationSampleTracking) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('Expected to have a workUnitStore that provides validationSampleTracking'), "__NEXT_ERROR_CODE", {
|
||||
value: "E1110",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
return validationSampleTracking;
|
||||
}
|
||||
function trackMissingSampleError(error) {
|
||||
const validationSampleTracking = getExpectedSampleTracking();
|
||||
validationSampleTracking.missingSampleErrors.push(error);
|
||||
}
|
||||
function trackMissingSampleErrorAndThrow(error) {
|
||||
// TODO(instant-validation-build): this should abort the render
|
||||
trackMissingSampleError(error);
|
||||
throw error;
|
||||
}
|
||||
function createCookiesFromSample(sampleCookies, route) {
|
||||
const declaredNames = new Set();
|
||||
const cookies = new _cookies.RequestCookies(new Headers());
|
||||
if (sampleCookies) {
|
||||
for (const cookie of sampleCookies){
|
||||
declaredNames.add(cookie.name);
|
||||
if (cookie.value !== null) {
|
||||
cookies.set(cookie.name, cookie.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
const sealed = _requestcookies.RequestCookiesAdapter.seal(cookies);
|
||||
return new Proxy(sealed, {
|
||||
get (target, prop, receiver) {
|
||||
if (prop === 'has') {
|
||||
const originalMethod = Reflect.get(target, prop, receiver);
|
||||
const wrappedMethod = function(name) {
|
||||
if (!declaredNames.has(name)) {
|
||||
trackMissingSampleErrorAndThrow(createMissingCookieSampleError(route, name));
|
||||
}
|
||||
return originalMethod.call(target, name);
|
||||
};
|
||||
return wrappedMethod;
|
||||
}
|
||||
if (prop === 'get') {
|
||||
const originalMethod = Reflect.get(target, prop, receiver);
|
||||
const wrappedMethod = function(nameOrCookie) {
|
||||
let name;
|
||||
if (typeof nameOrCookie === 'string') {
|
||||
name = nameOrCookie;
|
||||
} else if (nameOrCookie && typeof nameOrCookie === 'object' && typeof nameOrCookie.name === 'string') {
|
||||
name = nameOrCookie.name;
|
||||
} else {
|
||||
// This is an invalid input. Pass it through to the original method so it can error.
|
||||
return originalMethod.call(target, nameOrCookie);
|
||||
}
|
||||
if (!declaredNames.has(name)) {
|
||||
trackMissingSampleErrorAndThrow(createMissingCookieSampleError(route, name));
|
||||
}
|
||||
return originalMethod.call(target, name);
|
||||
};
|
||||
return wrappedMethod;
|
||||
}
|
||||
// TODO(instant-validation-build): what should getAll do?
|
||||
// Maybe we should only allow it if there's an array (possibly empty?)
|
||||
return Reflect.get(target, prop, receiver);
|
||||
}
|
||||
});
|
||||
}
|
||||
function createMissingCookieSampleError(route, name) {
|
||||
return Object.defineProperty(new _instantvalidationerror.InstantValidationError(`Route "${route}" accessed cookie "${name}" which is not defined in the \`samples\` ` + `of \`unstable_instant\`. Add it to the sample's \`cookies\` array, ` + `or \`{ name: "${name}", value: null }\` if it should be absent.`), "__NEXT_ERROR_CODE", {
|
||||
value: "E1115",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
function createHeadersFromSample(rawSampleHeaders, sampleCookies, route) {
|
||||
// If we have cookie samples, add a `cookie` header to match.
|
||||
// Accessing it will be implicitly allowed by the proxy --
|
||||
// if the user defined some cookies, accessing the "cookie" header is also fine.
|
||||
const sampleHeaders = rawSampleHeaders ? [
|
||||
...rawSampleHeaders
|
||||
] : [];
|
||||
if (sampleHeaders.find(([name])=>name.toLowerCase() === 'cookie')) {
|
||||
throw Object.defineProperty(new _instantvalidationerror.InstantValidationError('Invalid sample: Defining cookies via a "cookie" header is not supported. Use `cookies: [{ name: ..., value: ... }]` instead.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E1111",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
if (sampleCookies) {
|
||||
const cookieHeaderValue = sampleCookies.toString();
|
||||
sampleHeaders.push([
|
||||
'cookie',
|
||||
// if the `cookies` samples were empty, or they were all `null`, then we have no cookies,
|
||||
// and the header isn't present, but should remains readable, so we set it to null.
|
||||
cookieHeaderValue !== '' ? cookieHeaderValue : null
|
||||
]);
|
||||
}
|
||||
const declaredNames = new Set();
|
||||
const headersInit = {};
|
||||
for (const [name, value] of sampleHeaders){
|
||||
declaredNames.add(name.toLowerCase());
|
||||
if (value !== null) {
|
||||
headersInit[name.toLowerCase()] = value;
|
||||
}
|
||||
}
|
||||
const sealed = _headers.HeadersAdapter.seal(_headers.HeadersAdapter.from(headersInit));
|
||||
return new Proxy(sealed, {
|
||||
get (target, prop, receiver) {
|
||||
if (prop === 'get' || prop === 'has') {
|
||||
const originalMethod = Reflect.get(target, prop, receiver);
|
||||
const patchedMethod = function(rawName) {
|
||||
const name = rawName.toLowerCase();
|
||||
if (!declaredNames.has(name)) {
|
||||
trackMissingSampleErrorAndThrow(Object.defineProperty(new _instantvalidationerror.InstantValidationError(`Route "${route}" accessed header "${name}" which is not defined in the \`samples\` ` + `of \`unstable_instant\`. Add it to the sample's \`headers\` array, ` + `or \`["${name}", null]\` if it should be absent.`), "__NEXT_ERROR_CODE", {
|
||||
value: "E1116",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
}));
|
||||
}
|
||||
// typescript can't reconcile a union of functions with a union of return types,
|
||||
// so we have to cast the original return type away
|
||||
return originalMethod.call(target, name);
|
||||
};
|
||||
return patchedMethod;
|
||||
}
|
||||
return Reflect.get(target, prop, receiver);
|
||||
}
|
||||
});
|
||||
}
|
||||
function createDraftModeForValidation() {
|
||||
// Create a minimal DraftModeProvider-compatible object
|
||||
// that always reports draft mode as disabled.
|
||||
//
|
||||
// private properties that can't be set from outside the class.
|
||||
return {
|
||||
get isEnabled () {
|
||||
return false;
|
||||
},
|
||||
enable () {
|
||||
throw Object.defineProperty(new Error('Draft mode cannot be enabled during build-time instant validation.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E1092",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
},
|
||||
disable () {
|
||||
throw Object.defineProperty(new Error('Draft mode cannot be disabled during build-time instant validation.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E1094",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
function createExhaustiveParamsProxy(underlyingParams, declaredParamNames, route) {
|
||||
return new Proxy(underlyingParams, {
|
||||
get (target, prop, receiver) {
|
||||
if (typeof prop === 'string' && !_reflectutils.wellKnownProperties.has(prop) && // Only error when accessing a param that is part of the route but wasn't provided.
|
||||
// accessing properties that aren't expected to be a valid param value is fine.
|
||||
prop in underlyingParams && !declaredParamNames.has(prop)) {
|
||||
trackMissingSampleErrorAndThrow(Object.defineProperty(new _instantvalidationerror.InstantValidationError(`Route "${route}" accessed param "${prop}" which is not defined in the \`samples\` ` + `of \`unstable_instant\`. Add it to the sample's \`params\` object.`), "__NEXT_ERROR_CODE", {
|
||||
value: "E1095",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
}));
|
||||
}
|
||||
return Reflect.get(target, prop, receiver);
|
||||
}
|
||||
});
|
||||
}
|
||||
function createExhaustiveSearchParamsProxy(searchParams, declaredSearchParamNames, route) {
|
||||
return new Proxy(searchParams, {
|
||||
get (target, prop, receiver) {
|
||||
if (typeof prop === 'string' && !_reflectutils.wellKnownProperties.has(prop) && !declaredSearchParamNames.has(prop)) {
|
||||
trackMissingSampleErrorAndThrow(createMissingSearchParamSampleError(route, prop));
|
||||
}
|
||||
return Reflect.get(target, prop, receiver);
|
||||
},
|
||||
has (target, prop) {
|
||||
if (typeof prop === 'string' && !_reflectutils.wellKnownProperties.has(prop) && !declaredSearchParamNames.has(prop)) {
|
||||
trackMissingSampleErrorAndThrow(createMissingSearchParamSampleError(route, prop));
|
||||
}
|
||||
return Reflect.has(target, prop);
|
||||
}
|
||||
});
|
||||
}
|
||||
function createExhaustiveURLSearchParamsProxy(searchParams, declaredSearchParamNames, route) {
|
||||
return new Proxy(searchParams, {
|
||||
get (target, prop, receiver) {
|
||||
// Intercept method calls that access specific param names
|
||||
if (prop === 'get' || prop === 'getAll' || prop === 'has') {
|
||||
const originalMathod = Reflect.get(target, prop, receiver);
|
||||
return (name)=>{
|
||||
if (typeof name === 'string' && !declaredSearchParamNames.has(name)) {
|
||||
trackMissingSampleErrorAndThrow(createMissingSearchParamSampleError(route, name));
|
||||
}
|
||||
return originalMathod.call(target, name);
|
||||
};
|
||||
}
|
||||
const value = Reflect.get(target, prop, receiver);
|
||||
// Prevent `TypeError: Value of "this" must be of type URLSearchParams` for methods
|
||||
if (typeof value === 'function' && !Object.hasOwn(target, prop)) {
|
||||
return value.bind(target);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
});
|
||||
}
|
||||
function createMissingSearchParamSampleError(route, name) {
|
||||
return Object.defineProperty(new _instantvalidationerror.InstantValidationError(`Route "${route}" accessed searchParam "${name}" which is not defined in the \`samples\` ` + `of \`unstable_instant\`. Add it to the sample's \`searchParams\` object, ` + `or \`{ "${name}": null }\` if it should be absent.`), "__NEXT_ERROR_CODE", {
|
||||
value: "E1098",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
function createRelativeURLFromSamples(route, sampleParams, sampleSearchParams) {
|
||||
// Build searchParams query object and URL search string from sample
|
||||
const pathname = createPathnameFromRouteAndSampleParams(route, sampleParams ?? {});
|
||||
let search = '';
|
||||
if (sampleSearchParams) {
|
||||
const qs = createURLSearchParamsFromSample(sampleSearchParams).toString();
|
||||
if (qs) {
|
||||
search = '?' + qs;
|
||||
}
|
||||
}
|
||||
return (0, _parserelativeurl.parseRelativeUrl)(pathname + search, undefined, true);
|
||||
}
|
||||
function createURLSearchParamsFromSample(sampleSearchParams) {
|
||||
const result = new URLSearchParams();
|
||||
if (sampleSearchParams) {
|
||||
for (const [key, value] of Object.entries(sampleSearchParams)){
|
||||
if (value === null || value === undefined) continue;
|
||||
if (Array.isArray(value)) {
|
||||
for (const v of value){
|
||||
result.append(key, v);
|
||||
}
|
||||
} else {
|
||||
result.set(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Substitute sample params into `workStore.route` to create a plausible pathname.
|
||||
* TODO(instant-validation-build): this logic is somewhat hacky and likely incomplete,
|
||||
* but it should be good enough for some initial testing.
|
||||
*/ function createPathnameFromRouteAndSampleParams(route, params) {
|
||||
let interpolatedSegments = [];
|
||||
const rawSegments = route.split('/');
|
||||
for (const rawSegment of rawSegments){
|
||||
const param = (0, _getsegmentparam.getSegmentParam)(rawSegment);
|
||||
if (param) {
|
||||
switch(param.paramType){
|
||||
case 'catchall':
|
||||
case 'optional-catchall':
|
||||
{
|
||||
let paramValue = params[param.paramName];
|
||||
if (paramValue === undefined) {
|
||||
// The value for the param was not provided. `usePathname` will detect this and throw
|
||||
// before this can surface to userspace. Use `[...NAME]` as a placeholder for the param value
|
||||
// in case it pops up somewhere unexpectedly.
|
||||
paramValue = [
|
||||
rawSegment
|
||||
];
|
||||
} else if (!Array.isArray(paramValue)) {
|
||||
// NOTE: this happens outside of render, so we don't need `trackMissingSampleErrorAndThrow`
|
||||
throw Object.defineProperty(new _instantvalidationerror.InstantValidationError(`Expected sample param value for segment '${rawSegment}' to be an array of strings, got ${typeof paramValue}`), "__NEXT_ERROR_CODE", {
|
||||
value: "E1104",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
interpolatedSegments.push(...paramValue.map((v)=>encodeURIComponent(v)));
|
||||
break;
|
||||
}
|
||||
case 'dynamic':
|
||||
{
|
||||
let paramValue = params[param.paramName];
|
||||
if (paramValue === undefined) {
|
||||
// The value for the param was not provided. `usePathname` will detect this and throw
|
||||
// before this can surface to userspace. Use `[NAME]` as a placeholder for the param value
|
||||
// in case it pops up somewhere unexpectedly.
|
||||
paramValue = rawSegment;
|
||||
} else if (typeof paramValue !== 'string') {
|
||||
// NOTE: this happens outside of render, so we don't need `trackMissingSampleErrorAndThrow`
|
||||
throw Object.defineProperty(new _instantvalidationerror.InstantValidationError(`Expected sample param value for segment '${rawSegment}' to be a string, got ${typeof paramValue}`), "__NEXT_ERROR_CODE", {
|
||||
value: "E1108",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
interpolatedSegments.push(encodeURIComponent(paramValue));
|
||||
break;
|
||||
}
|
||||
case 'catchall-intercepted-(..)(..)':
|
||||
case 'catchall-intercepted-(.)':
|
||||
case 'catchall-intercepted-(..)':
|
||||
case 'catchall-intercepted-(...)':
|
||||
case 'dynamic-intercepted-(..)(..)':
|
||||
case 'dynamic-intercepted-(.)':
|
||||
case 'dynamic-intercepted-(..)':
|
||||
case 'dynamic-intercepted-(...)':
|
||||
{
|
||||
// TODO(instant-validation-build): i don't know how these are supposed to work, or if we can even get them here
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('Not implemented: Validation of interception routes'), "__NEXT_ERROR_CODE", {
|
||||
value: "E1106",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
default:
|
||||
{
|
||||
param.paramType;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
interpolatedSegments.push(rawSegment);
|
||||
}
|
||||
}
|
||||
return interpolatedSegments.join('/');
|
||||
}
|
||||
function assertRootParamInSamples(workStore, sampleParams, paramName) {
|
||||
if (sampleParams && paramName in sampleParams) {
|
||||
// The param is defined in the samples.
|
||||
} else {
|
||||
const route = workStore.route;
|
||||
trackMissingSampleErrorAndThrow(Object.defineProperty(new _instantvalidationerror.InstantValidationError(`Route "${route}" accessed root param "${paramName}" which is not defined in the \`samples\` ` + `of \`unstable_instant\`. Add it to the sample's \`params\` object.`), "__NEXT_ERROR_CODE", {
|
||||
value: "E1114",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=instant-samples.js.map
|
||||
33
build/node_modules/next/dist/server/app-render/instant-validation/instant-validation-error.js
generated
vendored
Normal file
33
build/node_modules/next/dist/server/app-render/instant-validation/instant-validation-error.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
InstantValidationError: null,
|
||||
isInstantValidationError: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
InstantValidationError: function() {
|
||||
return InstantValidationError;
|
||||
},
|
||||
isInstantValidationError: function() {
|
||||
return isInstantValidationError;
|
||||
}
|
||||
});
|
||||
const INSTANT_VALIDATION_ERROR_DIGEST = 'INSTANT_VALIDATION_ERROR';
|
||||
function isInstantValidationError(err) {
|
||||
return !!(err && typeof err === 'object' && err instanceof Error && err.digest === INSTANT_VALIDATION_ERROR_DIGEST);
|
||||
}
|
||||
class InstantValidationError extends Error {
|
||||
constructor(...args){
|
||||
super(...args), this.digest = INSTANT_VALIDATION_ERROR_DIGEST;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=instant-validation-error.js.map
|
||||
713
build/node_modules/next/dist/server/app-render/instant-validation/instant-validation.js
generated
vendored
Normal file
713
build/node_modules/next/dist/server/app-render/instant-validation/instant-validation.js
generated
vendored
Normal file
@@ -0,0 +1,713 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
collectStagedSegmentData: null,
|
||||
createCombinedPayloadAtDepth: null,
|
||||
createCombinedPayloadStream: null,
|
||||
discoverValidationDepths: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
collectStagedSegmentData: function() {
|
||||
return collectStagedSegmentData;
|
||||
},
|
||||
createCombinedPayloadAtDepth: function() {
|
||||
return createCombinedPayloadAtDepth;
|
||||
},
|
||||
createCombinedPayloadStream: function() {
|
||||
return createCombinedPayloadStream;
|
||||
},
|
||||
discoverValidationDepths: function() {
|
||||
return discoverValidationDepths;
|
||||
}
|
||||
});
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _invarianterror = require("../../../shared/lib/invariant-error");
|
||||
const _stagedrendering = require("../staged-rendering");
|
||||
const _manifestssingleton = require("../manifests-singleton");
|
||||
const _apprenderrenderutils = require("../app-render-render-utils");
|
||||
const _workasyncstorageexternal = require("../work-async-storage.external");
|
||||
const _prospectiverenderutils = require("../prospective-render-utils");
|
||||
const _createerrorhandler = require("../create-error-handler");
|
||||
const _boundary = require("../../../client/components/instant-validation/boundary");
|
||||
const _appdirmodule = require("../../lib/app-dir-module");
|
||||
const _parseloadertree = require("../../../shared/lib/router/utils/parse-loader-tree");
|
||||
const _nodestream = require("node:stream");
|
||||
const _streamutils = require("./stream-utils");
|
||||
const _debugchannelserver = require("../debug-channel-server");
|
||||
const _client = require("react-server-dom-webpack/client");
|
||||
const _server = require("react-server-dom-webpack/server");
|
||||
const _segment = require("../../../shared/lib/segment");
|
||||
const filterStackFrame = process.env.NODE_ENV !== 'production' ? require('../../lib/source-maps').filterStackFrameDEV : undefined;
|
||||
const findSourceMapURL = process.env.NODE_ENV !== 'production' ? require('../../lib/source-maps').findSourceMapURLDEV : undefined;
|
||||
const debug = process.env.NEXT_PRIVATE_DEBUG_VALIDATION === '1' ? console.log : undefined;
|
||||
function traverseRootSeedDataSegments(initialRSCPayload, processSegment) {
|
||||
const { flightRouterState, seedData } = getRootDataFromPayload(initialRSCPayload);
|
||||
const [rootSegment] = flightRouterState;
|
||||
const rootPath = stringifySegment(rootSegment);
|
||||
return traverseCacheNodeSegments(rootPath, flightRouterState, seedData, processSegment);
|
||||
}
|
||||
function traverseCacheNodeSegments(path, route, seedData, processSegment) {
|
||||
processSegment(path, seedData);
|
||||
const [_segment, childRoutes] = route;
|
||||
const [_node, parallelRoutesData, _loading, _isPartial] = seedData;
|
||||
for(const parallelRouteKey in childRoutes){
|
||||
const childSeedData = parallelRoutesData[parallelRouteKey];
|
||||
if (!childSeedData) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError(`Got unexpected empty seed data during instant validation`), "__NEXT_ERROR_CODE", {
|
||||
value: "E992",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
const childRoute = childRoutes[parallelRouteKey];
|
||||
// NOTE: if this is a __PAGE__ segment, it might have search params appended.
|
||||
// Whoever reads from the cache needs to append them as well.
|
||||
const [childSegment] = childRoute;
|
||||
const childPath = createChildSegmentPath(path, parallelRouteKey, childSegment);
|
||||
traverseCacheNodeSegments(childPath, childRoute, childSeedData, processSegment);
|
||||
}
|
||||
}
|
||||
function createChildSegmentPath(parentPath, parallelRouteKey, segment) {
|
||||
const parallelRoutePrefix = parallelRouteKey === 'children' ? '' : `@${encodeURIComponent(parallelRouteKey)}/`;
|
||||
return `${parentPath}/${parallelRoutePrefix}${stringifySegment(segment)}`;
|
||||
}
|
||||
function stringifySegment(segment) {
|
||||
return typeof segment === 'string' ? encodeURIComponent(segment) : encodeURIComponent(segment[0]) + '|' + segment[1] + '|' + segment[2];
|
||||
}
|
||||
async function collectStagedSegmentData(fullPageChunks, fullPageDebugChunks, startTime, hasRuntimePrefetch, clientReferenceManifest) {
|
||||
const debugChannelAbortController = new AbortController();
|
||||
const debugStream = fullPageDebugChunks ? (0, _streamutils.createNodeStreamFromChunks)(fullPageDebugChunks, debugChannelAbortController.signal) : null;
|
||||
const { stream, controller } = createStagedStreamFromChunks(fullPageChunks);
|
||||
stream.on('end', ()=>{
|
||||
// When the stream finishes, we have to close the debug stream too,
|
||||
// but delay it to avoid "Connection closed." errors.
|
||||
setImmediate(()=>debugChannelAbortController.abort());
|
||||
});
|
||||
// Technically we're just re-encoding, so nothing new should be emitted,
|
||||
// but we add an environment name just in case.
|
||||
const environmentName = ()=>{
|
||||
const currentStage = controller.currentStage;
|
||||
switch(currentStage){
|
||||
case _stagedrendering.RenderStage.Static:
|
||||
return 'Prerender';
|
||||
case _stagedrendering.RenderStage.Runtime:
|
||||
return hasRuntimePrefetch ? 'Prefetch' : 'Prefetchable';
|
||||
case _stagedrendering.RenderStage.Dynamic:
|
||||
return 'Server';
|
||||
default:
|
||||
currentStage;
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError(`Invalid render stage: ${currentStage}`), "__NEXT_ERROR_CODE", {
|
||||
value: "E881",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
};
|
||||
// Deserialize the payload.
|
||||
// NOTE: the stream will initially be in the static stage, so that's as far as we get here.
|
||||
// We still expect the outer structure of the payload to be readable in this state.
|
||||
const serverConsumerManifest = {
|
||||
moduleLoading: null,
|
||||
moduleMap: clientReferenceManifest.rscModuleMapping,
|
||||
serverModuleMap: (0, _manifestssingleton.getServerModuleMap)()
|
||||
};
|
||||
const payload = await (0, _client.createFromNodeStream)(stream, serverConsumerManifest, {
|
||||
findSourceMapURL,
|
||||
debugChannel: debugStream ?? undefined,
|
||||
// Do not pass start/end timings - we do not want to omit any debug info.
|
||||
startTime: undefined,
|
||||
endTime: undefined
|
||||
});
|
||||
// Deconstruct the payload into separate streams per segment.
|
||||
// We have to preserve the stage information for each of them,
|
||||
// so that we can later render each segment in any stage we need.
|
||||
const { head } = getRootDataFromPayload(payload);
|
||||
const segments = new Map();
|
||||
traverseRootSeedDataSegments(payload, (segmentPath, seedData)=>{
|
||||
segments.set(segmentPath, createSegmentData(seedData));
|
||||
});
|
||||
const cache = createSegmentCache();
|
||||
const pendingTasks = [];
|
||||
/** Track when we advance stages so we can pass them as `endTime` later. */ const stageEndTimes = {
|
||||
[_stagedrendering.RenderStage.Static]: -1,
|
||||
[_stagedrendering.RenderStage.Runtime]: -1
|
||||
};
|
||||
const renderIntoCacheItem = async (data, cacheEntry)=>{
|
||||
const segmentDebugChannel = cacheEntry.debugChunks ? (0, _debugchannelserver.createDebugChannel)() : undefined;
|
||||
const itemStream = (0, _server.renderToReadableStream)(data, clientReferenceManifest.clientModules, {
|
||||
filterStackFrame,
|
||||
debugChannel: segmentDebugChannel == null ? void 0 : segmentDebugChannel.serverSide,
|
||||
environmentName,
|
||||
startTime,
|
||||
onError (error) {
|
||||
const digest = (0, _createerrorhandler.getDigestForWellKnownError)(error);
|
||||
if (digest) {
|
||||
return digest;
|
||||
}
|
||||
// Forward existing digests
|
||||
if (error && typeof error === 'object' && 'digest' in error && typeof error.digest === 'string') {
|
||||
return error.digest;
|
||||
}
|
||||
// We don't need to log the errors because we would have already done that
|
||||
// when generating the original Flight stream for the whole page.
|
||||
if (process.env.NEXT_DEBUG_BUILD || process.env.__NEXT_VERBOSE_LOGGING) {
|
||||
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
||||
(0, _prospectiverenderutils.printDebugThrownValueForProspectiveRender)(error, (workStore == null ? void 0 : workStore.route) ?? 'unknown route', _prospectiverenderutils.Phase.InstantValidation);
|
||||
}
|
||||
}
|
||||
});
|
||||
await Promise.all([
|
||||
// accumulate Flight chunks
|
||||
(async ()=>{
|
||||
for await (const chunk of itemStream.values()){
|
||||
writeChunk(cacheEntry.chunks, controller.currentStage, chunk);
|
||||
}
|
||||
})(),
|
||||
// accumulate Debug chunks
|
||||
segmentDebugChannel && (async ()=>{
|
||||
for await (const chunk of segmentDebugChannel.clientSide.readable.values()){
|
||||
cacheEntry.debugChunks.push(chunk);
|
||||
}
|
||||
})()
|
||||
]);
|
||||
};
|
||||
await (0, _apprenderrenderutils.runInSequentialTasks)(()=>{
|
||||
{
|
||||
const headCacheItem = createSegmentCacheItem(!!fullPageDebugChunks);
|
||||
cache.head = headCacheItem;
|
||||
pendingTasks.push(renderIntoCacheItem(head, headCacheItem));
|
||||
}
|
||||
for (const [segmentPath, segmentData] of segments){
|
||||
const segmentCacheItem = createSegmentCacheItem(!!fullPageDebugChunks);
|
||||
cache.segments.set(segmentPath, segmentCacheItem);
|
||||
pendingTasks.push(renderIntoCacheItem(segmentData, segmentCacheItem));
|
||||
}
|
||||
}, ()=>{
|
||||
stageEndTimes[_stagedrendering.RenderStage.Static] = performance.now() + performance.timeOrigin;
|
||||
controller.advanceStage(_stagedrendering.RenderStage.Runtime);
|
||||
}, ()=>{
|
||||
stageEndTimes[_stagedrendering.RenderStage.Runtime] = performance.now() + performance.timeOrigin;
|
||||
controller.advanceStage(_stagedrendering.RenderStage.Dynamic);
|
||||
});
|
||||
await Promise.all(pendingTasks);
|
||||
return {
|
||||
cache,
|
||||
payload,
|
||||
stageEndTimes
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Turns accumulated stage chunks into a stream.
|
||||
* The stream starts out in Static stage, and can be advanced further
|
||||
* using the returned controller object.
|
||||
* Conceptually, this is similar to how we unblock more content
|
||||
* by advancing stages in a regular staged render.
|
||||
* */ function createStagedStreamFromChunks(stageChunks) {
|
||||
// The successive stages are supersets of one another,
|
||||
// so we can index into the dynamic chunks everywhere
|
||||
// and just look at the lengths of the Static/Runtime arrays
|
||||
const allChunks = stageChunks[_stagedrendering.RenderStage.Dynamic];
|
||||
const numStaticChunks = stageChunks[_stagedrendering.RenderStage.Static].length;
|
||||
const numRuntimeChunks = stageChunks[_stagedrendering.RenderStage.Runtime].length;
|
||||
const numDynamicChunks = stageChunks[_stagedrendering.RenderStage.Dynamic].length;
|
||||
let chunkIx = 0;
|
||||
let currentStage = _stagedrendering.RenderStage.Static;
|
||||
let closed = false;
|
||||
function push(chunk) {
|
||||
stream.push(chunk);
|
||||
}
|
||||
function close() {
|
||||
closed = true;
|
||||
stream.push(null);
|
||||
}
|
||||
const stream = new _nodestream.Readable({
|
||||
read () {
|
||||
// Emit static chunks
|
||||
for(; chunkIx < numStaticChunks; chunkIx++){
|
||||
push(allChunks[chunkIx]);
|
||||
}
|
||||
// If there's no more chunks after this stage, finish the stream.
|
||||
if (chunkIx >= allChunks.length) {
|
||||
close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
function advanceStage(stage) {
|
||||
if (closed) return true;
|
||||
switch(stage){
|
||||
case _stagedrendering.RenderStage.Runtime:
|
||||
{
|
||||
currentStage = _stagedrendering.RenderStage.Runtime;
|
||||
for(; chunkIx < numRuntimeChunks; chunkIx++){
|
||||
push(allChunks[chunkIx]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case _stagedrendering.RenderStage.Dynamic:
|
||||
{
|
||||
currentStage = _stagedrendering.RenderStage.Dynamic;
|
||||
for(; chunkIx < numDynamicChunks; chunkIx++){
|
||||
push(allChunks[chunkIx]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
stage;
|
||||
}
|
||||
}
|
||||
// If there's no more chunks after this stage, finish the stream.
|
||||
if (chunkIx >= allChunks.length) {
|
||||
close();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return {
|
||||
stream,
|
||||
controller: {
|
||||
get currentStage () {
|
||||
return currentStage;
|
||||
},
|
||||
advanceStage
|
||||
}
|
||||
};
|
||||
}
|
||||
function writeChunk(stageChunks, stage, chunk) {
|
||||
switch(stage){
|
||||
case _stagedrendering.RenderStage.Static:
|
||||
{
|
||||
stageChunks[_stagedrendering.RenderStage.Static].push(chunk);
|
||||
// fallthrough
|
||||
}
|
||||
case _stagedrendering.RenderStage.Runtime:
|
||||
{
|
||||
stageChunks[_stagedrendering.RenderStage.Runtime].push(chunk);
|
||||
// fallthrough
|
||||
}
|
||||
case _stagedrendering.RenderStage.Dynamic:
|
||||
{
|
||||
stageChunks[_stagedrendering.RenderStage.Dynamic].push(chunk);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
stage;
|
||||
}
|
||||
}
|
||||
}
|
||||
async function createCombinedPayloadStream(payload, extraChunksAbortController, renderSignal, clientReferenceManifest, startTime, isDebugChannelEnabled) {
|
||||
// Collect all the chunks so that we're not dependent on timing of the render.
|
||||
let isRenderable = true;
|
||||
const renderableChunks = [];
|
||||
const allChunks = [];
|
||||
const debugChunks = isDebugChannelEnabled ? [] : null;
|
||||
const debugChannel = isDebugChannelEnabled ? (0, _debugchannelserver.createDebugChannel)() : null;
|
||||
let streamFinished;
|
||||
await (0, _apprenderrenderutils.runInSequentialTasks)(()=>{
|
||||
const stream = (0, _server.renderToReadableStream)(payload, clientReferenceManifest.clientModules, {
|
||||
filterStackFrame,
|
||||
debugChannel: debugChannel == null ? void 0 : debugChannel.serverSide,
|
||||
startTime,
|
||||
onError (error) {
|
||||
const digest = (0, _createerrorhandler.getDigestForWellKnownError)(error);
|
||||
if (digest) {
|
||||
return digest;
|
||||
}
|
||||
// Forward existing digests
|
||||
if (error && typeof error === 'object' && 'digest' in error && typeof error.digest === 'string') {
|
||||
return error.digest;
|
||||
}
|
||||
// We don't need to log the errors because we would have already done that
|
||||
// when generating the original Flight stream for the whole page.
|
||||
if (process.env.NEXT_DEBUG_BUILD || process.env.__NEXT_VERBOSE_LOGGING) {
|
||||
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
||||
(0, _prospectiverenderutils.printDebugThrownValueForProspectiveRender)(error, (workStore == null ? void 0 : workStore.route) ?? 'unknown route', _prospectiverenderutils.Phase.InstantValidation);
|
||||
}
|
||||
}
|
||||
});
|
||||
streamFinished = Promise.all([
|
||||
// Accumulate Flight chunks
|
||||
(async ()=>{
|
||||
for await (const chunk of stream.values()){
|
||||
allChunks.push(chunk);
|
||||
if (isRenderable) {
|
||||
renderableChunks.push(chunk);
|
||||
}
|
||||
}
|
||||
})(),
|
||||
// Accumulate debug chunks
|
||||
debugChannel && (async ()=>{
|
||||
for await (const chunk of debugChannel.clientSide.readable.values()){
|
||||
debugChunks.push(chunk);
|
||||
}
|
||||
})()
|
||||
]);
|
||||
}, ()=>{
|
||||
isRenderable = false;
|
||||
extraChunksAbortController.abort();
|
||||
});
|
||||
await streamFinished;
|
||||
return {
|
||||
stream: (0, _streamutils.createNodeStreamWithLateRelease)(renderableChunks, allChunks, renderSignal),
|
||||
debugStream: debugChunks ? (0, _streamutils.createNodeStreamFromChunks)(debugChunks, renderSignal) : null
|
||||
};
|
||||
}
|
||||
function getRootDataFromPayload(initialRSCPayload) {
|
||||
// FlightDataPath is an unsound type, hence the additional checks.
|
||||
const flightDataPaths = initialRSCPayload.f;
|
||||
if (flightDataPaths.length !== 1 && flightDataPaths[0].length !== 3) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('InitialRSCPayload does not match the expected shape during instant validation.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E994",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
const flightRouterState = flightDataPaths[0][0];
|
||||
const seedData = flightDataPaths[0][1];
|
||||
// TODO: handle head
|
||||
const head = flightDataPaths[0][2];
|
||||
return {
|
||||
flightRouterState,
|
||||
seedData,
|
||||
head
|
||||
};
|
||||
}
|
||||
async function createValidationHead(cache, releaseSignal, clientReferenceManifest, stageEndTimes, stage) {
|
||||
const segmentCacheItem = cache.head;
|
||||
if (!segmentCacheItem) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError(`Missing segment data: <head>`), "__NEXT_ERROR_CODE", {
|
||||
value: "E1072",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
return await deserializeFromChunks(segmentCacheItem.chunks[stage], segmentCacheItem.chunks[_stagedrendering.RenderStage.Dynamic], segmentCacheItem.debugChunks, releaseSignal, clientReferenceManifest, {
|
||||
startTime: undefined,
|
||||
endTime: stageEndTimes[stage]
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Deserializes a (partial possibly partial) RSC stream, given as a chunk-array.
|
||||
* If the stream is partial, we'll wait for `releaseSignal` to fire
|
||||
* and then complete the deserialization using `allChunks`.
|
||||
*
|
||||
* This is used to obtain a partially-complete model (that might contain unresolved holes)
|
||||
* and then release any late debug info from chunks that came later before we abort the render.
|
||||
* */ function deserializeFromChunks(partialChunks, allChunks, debugChunks, releaseSignal, clientReferenceManifest, timings) {
|
||||
const debugChannelAbortController = new AbortController();
|
||||
const debugStream = debugChunks ? (0, _streamutils.createNodeStreamFromChunks)(debugChunks, debugChannelAbortController.signal) : null;
|
||||
const serverConsumerManifest = {
|
||||
moduleLoading: null,
|
||||
moduleMap: clientReferenceManifest.rscModuleMapping,
|
||||
serverModuleMap: (0, _manifestssingleton.getServerModuleMap)()
|
||||
};
|
||||
const segmentStream = partialChunks.length < allChunks.length ? (0, _streamutils.createNodeStreamWithLateRelease)(partialChunks, allChunks, releaseSignal) : (0, _streamutils.createNodeStreamFromChunks)(partialChunks);
|
||||
segmentStream.on('end', ()=>{
|
||||
// When the stream finishes, we have to close the debug stream too,
|
||||
// but delay it to avoid "Connection closed." errors.
|
||||
setImmediate(()=>debugChannelAbortController.abort());
|
||||
});
|
||||
return (0, _client.createFromNodeStream)(segmentStream, serverConsumerManifest, {
|
||||
findSourceMapURL,
|
||||
debugChannel: debugStream ?? undefined,
|
||||
startTime: timings == null ? void 0 : timings.startTime,
|
||||
endTime: timings == null ? void 0 : timings.endTime
|
||||
});
|
||||
}
|
||||
function createSegmentData(seedData) {
|
||||
const [node, _parallelRoutesData, _unused, isPartial, varyParams] = seedData;
|
||||
return {
|
||||
node,
|
||||
isPartial,
|
||||
varyParams
|
||||
};
|
||||
}
|
||||
function getCacheNodeSeedDataFromSegment(data, slots) {
|
||||
return [
|
||||
data.node,
|
||||
slots,
|
||||
/* unused (previously `loading`) */ null,
|
||||
data.isPartial,
|
||||
data.varyParams
|
||||
];
|
||||
}
|
||||
function createSegmentCache() {
|
||||
return {
|
||||
head: null,
|
||||
segments: new Map()
|
||||
};
|
||||
}
|
||||
function createSegmentCacheItem(withDebugChunks) {
|
||||
return {
|
||||
chunks: {
|
||||
[_stagedrendering.RenderStage.Static]: [],
|
||||
[_stagedrendering.RenderStage.Runtime]: [],
|
||||
[_stagedrendering.RenderStage.Dynamic]: []
|
||||
},
|
||||
debugChunks: withDebugChunks ? [] : null
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Whether this segment consumes a URL depth level. Each URL depth
|
||||
* represents a potential navigation boundary.
|
||||
*
|
||||
* The root segment ('') consumes depth 0. Regular segments like
|
||||
* 'dashboard' consume the next depth — whether or not they have a
|
||||
* layout. Route groups, __PAGE__, __DEFAULT__, and /_not-found don't
|
||||
* consume a depth — they share the boundary of their parent.
|
||||
*/ function segmentConsumesURLDepth(segment) {
|
||||
// Dynamic segments (tuples) always consume a URL depth.
|
||||
if (typeof segment !== 'string') return true;
|
||||
// Route groups, pages, defaults, and not-found don't consume a depth.
|
||||
if (segment.startsWith(_segment.PAGE_SEGMENT_KEY) || (0, _segment.isGroupSegment)(segment) || segment === _segment.DEFAULT_SEGMENT_KEY || segment === _segment.NOT_FOUND_SEGMENT_KEY) {
|
||||
return false;
|
||||
}
|
||||
// Everything else consumes a depth, including the root segment ''.
|
||||
return true;
|
||||
}
|
||||
function discoverValidationDepths(loaderTree) {
|
||||
const groupDepthsByUrlDepth = [];
|
||||
function recordGroupDepth(urlDepth, groupDepth) {
|
||||
while(groupDepthsByUrlDepth.length <= urlDepth){
|
||||
groupDepthsByUrlDepth.push(0);
|
||||
}
|
||||
if (groupDepth > groupDepthsByUrlDepth[urlDepth]) {
|
||||
groupDepthsByUrlDepth[urlDepth] = groupDepth;
|
||||
}
|
||||
}
|
||||
// urlDepth tracks the index of the current URL-consuming segment.
|
||||
// Groups accumulate at the same index. When the next URL segment
|
||||
// is reached, it increments the index and resets the group counter.
|
||||
// We start at -1 so the root segment '' increments to 0.
|
||||
function walk(tree, urlDepth, groupDepth) {
|
||||
const segment = tree[0];
|
||||
const { parallelRoutes } = (0, _parseloadertree.parseLoaderTree)(tree);
|
||||
const consumesDepth = segmentConsumesURLDepth(segment);
|
||||
let nextUrlDepth = urlDepth;
|
||||
let nextGroupDepth = groupDepth;
|
||||
if (consumesDepth) {
|
||||
nextUrlDepth = urlDepth + 1;
|
||||
nextGroupDepth = 0;
|
||||
recordGroupDepth(nextUrlDepth, 0);
|
||||
} else if (typeof segment === 'string' && (0, _segment.isGroupSegment)(segment) && segment !== '(__SLOT__)') {
|
||||
// Count real route groups but not the synthetic '(__SLOT__)' segment
|
||||
// that Next.js inserts for parallel slots. The synthetic group
|
||||
// can't be a real navigation boundary.
|
||||
nextGroupDepth++;
|
||||
recordGroupDepth(urlDepth, nextGroupDepth);
|
||||
}
|
||||
for(const key in parallelRoutes){
|
||||
walk(parallelRoutes[key], nextUrlDepth, nextGroupDepth);
|
||||
}
|
||||
}
|
||||
walk(loaderTree, -1, 0);
|
||||
return groupDepthsByUrlDepth;
|
||||
}
|
||||
async function createCombinedPayloadAtDepth(initialRSCPayload, cache, initialLoaderTree, getDynamicParamFromSegment, query, depth, groupDepth, releaseSignal, boundaryState, clientReferenceManifest, stageEndTimes, useRuntimeStageForPartialSegments) {
|
||||
let hasStaticSegments = false;
|
||||
let hasRuntimeSegments = false;
|
||||
function getSegment(loaderTree) {
|
||||
const dynamicParam = getDynamicParamFromSegment(loaderTree);
|
||||
if (dynamicParam) {
|
||||
return dynamicParam.treeSegment;
|
||||
}
|
||||
const segment = loaderTree[0];
|
||||
return query ? (0, _segment.addSearchParamsIfPageSegment)(segment, query) : segment;
|
||||
}
|
||||
async function buildSharedTreeSeedData(loaderTree, parentPath, key, urlDepthConsumed, groupDepthConsumed) {
|
||||
const { parallelRoutes } = (0, _parseloadertree.parseLoaderTree)(loaderTree);
|
||||
const segment = getSegment(loaderTree);
|
||||
const path = parentPath === null ? stringifySegment(segment) : createChildSegmentPath(parentPath, key, segment);
|
||||
debug == null ? void 0 : debug(` ${path || '/'} - Dynamic`);
|
||||
const segmentCacheItem = cache.segments.get(path);
|
||||
if (!segmentCacheItem) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError(`Missing segment data: ${path}`), "__NEXT_ERROR_CODE", {
|
||||
value: "E995",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
const segmentData = await deserializeFromChunks(segmentCacheItem.chunks[_stagedrendering.RenderStage.Dynamic], segmentCacheItem.chunks[_stagedrendering.RenderStage.Dynamic], segmentCacheItem.debugChunks, releaseSignal, clientReferenceManifest, null);
|
||||
const consumesUrlDepth = segmentConsumesURLDepth(segment);
|
||||
const isGroup = typeof segment === 'string' && (0, _segment.isGroupSegment)(segment) && segment !== '(__SLOT__)';
|
||||
// Advance counters for this segment before the boundary check,
|
||||
// mirroring how discoverValidationDepths counts. URL segments
|
||||
// increment urlDepthConsumed, groups increment groupDepthConsumed.
|
||||
// The synthetic '(__SLOT__)' segment is excluded — it can't be a
|
||||
// real navigation boundary.
|
||||
let nextUrlDepth = urlDepthConsumed;
|
||||
let currentGroupDepth = groupDepthConsumed;
|
||||
if (consumesUrlDepth) {
|
||||
nextUrlDepth++;
|
||||
currentGroupDepth = 0;
|
||||
} else if (isGroup) {
|
||||
currentGroupDepth++;
|
||||
}
|
||||
const pastUrlBoundary = nextUrlDepth > depth;
|
||||
const isBoundary = pastUrlBoundary && currentGroupDepth >= groupDepth;
|
||||
if (isBoundary) {
|
||||
debug == null ? void 0 : debug(` ['${path}' is the boundary (url=${nextUrlDepth}, group=${currentGroupDepth})]`);
|
||||
boundaryState.expectedIds.add(path);
|
||||
const finalSegmentData = {
|
||||
...segmentData,
|
||||
node: // eslint-disable-next-line @next/internal/no-ambiguous-jsx -- bundled in the server layer
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)(_boundary.PlaceValidationBoundaryBelowThisLevel, {
|
||||
id: path,
|
||||
children: segmentData.node
|
||||
}, "c")
|
||||
};
|
||||
const slots = {};
|
||||
let requiresInstantUI = false;
|
||||
let createInstantStack = null;
|
||||
for(const parallelRouteKey in parallelRoutes){
|
||||
const result = await buildNewTreeSeedData(parallelRoutes[parallelRouteKey], path, parallelRouteKey, false);
|
||||
slots[parallelRouteKey] = result.seedData;
|
||||
if (result.requiresInstantUI) {
|
||||
requiresInstantUI = true;
|
||||
if (createInstantStack === null) {
|
||||
createInstantStack = result.createInstantStack;
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
seedData: getCacheNodeSeedDataFromSegment(finalSegmentData, slots),
|
||||
requiresInstantUI,
|
||||
createInstantStack
|
||||
};
|
||||
}
|
||||
// Not at the boundary yet — keep walking as shared.
|
||||
const slots = {};
|
||||
let requiresInstantUI = false;
|
||||
let createInstantStack = null;
|
||||
for(const parallelRouteKey in parallelRoutes){
|
||||
const result = await buildSharedTreeSeedData(parallelRoutes[parallelRouteKey], path, parallelRouteKey, nextUrlDepth, currentGroupDepth);
|
||||
slots[parallelRouteKey] = result.seedData;
|
||||
if (result.requiresInstantUI) {
|
||||
requiresInstantUI = true;
|
||||
if (createInstantStack === null) {
|
||||
createInstantStack = result.createInstantStack;
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
seedData: getCacheNodeSeedDataFromSegment(segmentData, slots),
|
||||
requiresInstantUI,
|
||||
createInstantStack
|
||||
};
|
||||
}
|
||||
async function buildNewTreeSeedData(lt, parentPath, key, isInsideRuntimePrefetch) {
|
||||
const { parallelRoutes } = (0, _parseloadertree.parseLoaderTree)(lt);
|
||||
const { mod: layoutOrPageMod } = await (0, _appdirmodule.getLayoutOrPageModule)(lt);
|
||||
const segment = getSegment(lt);
|
||||
const path = parentPath === null ? stringifySegment(segment) : createChildSegmentPath(parentPath, key, segment);
|
||||
let instantConfig = null;
|
||||
let localCreateInstantStack = null;
|
||||
if (layoutOrPageMod !== undefined) {
|
||||
instantConfig = layoutOrPageMod.unstable_instant ?? null;
|
||||
if (instantConfig && typeof instantConfig === 'object') {
|
||||
const rawFactory = layoutOrPageMod.__debugCreateInstantConfigStack;
|
||||
localCreateInstantStack = typeof rawFactory === 'function' ? rawFactory : null;
|
||||
}
|
||||
}
|
||||
let childIsInsideRuntimePrefetch = isInsideRuntimePrefetch;
|
||||
let stage;
|
||||
if (!isInsideRuntimePrefetch) {
|
||||
if (instantConfig && typeof instantConfig === 'object' && instantConfig.prefetch === 'runtime') {
|
||||
stage = _stagedrendering.RenderStage.Runtime;
|
||||
childIsInsideRuntimePrefetch = true;
|
||||
hasRuntimeSegments = true;
|
||||
} else {
|
||||
if (useRuntimeStageForPartialSegments) {
|
||||
stage = _stagedrendering.RenderStage.Runtime;
|
||||
hasRuntimeSegments = true;
|
||||
} else {
|
||||
stage = _stagedrendering.RenderStage.Static;
|
||||
hasStaticSegments = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
stage = _stagedrendering.RenderStage.Runtime;
|
||||
hasRuntimeSegments = true;
|
||||
}
|
||||
debug == null ? void 0 : debug(` ${path || '/'} - ${_stagedrendering.RenderStage[stage]}`);
|
||||
const segmentCacheItem = cache.segments.get(path);
|
||||
if (!segmentCacheItem) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError(`Missing segment data: ${path}`), "__NEXT_ERROR_CODE", {
|
||||
value: "E995",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
const segmentData = await deserializeFromChunks(segmentCacheItem.chunks[stage], segmentCacheItem.chunks[_stagedrendering.RenderStage.Dynamic], segmentCacheItem.debugChunks, releaseSignal, clientReferenceManifest, {
|
||||
startTime: undefined,
|
||||
endTime: stageEndTimes[stage]
|
||||
});
|
||||
// Build children first, then determine requiresInstantUI.
|
||||
const slots = {};
|
||||
let childrenRequireInstantUI = false;
|
||||
let childCreateInstantStack = null;
|
||||
for(const parallelRouteKey in parallelRoutes){
|
||||
const result = await buildNewTreeSeedData(parallelRoutes[parallelRouteKey], path, parallelRouteKey, childIsInsideRuntimePrefetch);
|
||||
slots[parallelRouteKey] = result.seedData;
|
||||
if (result.requiresInstantUI) {
|
||||
childrenRequireInstantUI = true;
|
||||
if (childCreateInstantStack === null) {
|
||||
childCreateInstantStack = result.createInstantStack;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Local config takes precedence over children.
|
||||
let requiresInstantUI;
|
||||
let createInstantStack;
|
||||
if (instantConfig === false) {
|
||||
requiresInstantUI = false;
|
||||
createInstantStack = null;
|
||||
} else if (instantConfig && typeof instantConfig === 'object') {
|
||||
requiresInstantUI = true;
|
||||
createInstantStack = localCreateInstantStack;
|
||||
} else {
|
||||
requiresInstantUI = childrenRequireInstantUI;
|
||||
createInstantStack = childCreateInstantStack;
|
||||
}
|
||||
return {
|
||||
seedData: getCacheNodeSeedDataFromSegment(segmentData, slots),
|
||||
requiresInstantUI,
|
||||
createInstantStack
|
||||
};
|
||||
}
|
||||
const { seedData, requiresInstantUI, createInstantStack } = await buildSharedTreeSeedData(initialLoaderTree, null, null, 0 /* urlDepthConsumed */ , 0 /* groupDepthConsumed */ );
|
||||
if (!requiresInstantUI) {
|
||||
return null;
|
||||
}
|
||||
const { flightRouterState } = getRootDataFromPayload(initialRSCPayload);
|
||||
const headStage = hasRuntimeSegments ? _stagedrendering.RenderStage.Runtime : _stagedrendering.RenderStage.Static;
|
||||
const head = await createValidationHead(cache, releaseSignal, clientReferenceManifest, stageEndTimes, headStage);
|
||||
const payload = {
|
||||
...initialRSCPayload,
|
||||
f: [
|
||||
[
|
||||
flightRouterState,
|
||||
seedData,
|
||||
head
|
||||
]
|
||||
]
|
||||
};
|
||||
return {
|
||||
payload,
|
||||
hasAmbiguousErrors: hasStaticSegments,
|
||||
createInstantStack
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=instant-validation.js.map
|
||||
96
build/node_modules/next/dist/server/app-render/instant-validation/stream-utils.js
generated
vendored
Normal file
96
build/node_modules/next/dist/server/app-render/instant-validation/stream-utils.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
createNodeStreamFromChunks: null,
|
||||
createNodeStreamWithLateRelease: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
createNodeStreamFromChunks: function() {
|
||||
return createNodeStreamFromChunks;
|
||||
},
|
||||
createNodeStreamWithLateRelease: function() {
|
||||
return createNodeStreamWithLateRelease;
|
||||
}
|
||||
});
|
||||
const _invarianterror = require("../../../shared/lib/invariant-error");
|
||||
function createNodeStreamWithLateRelease(partialChunks, allChunks, releaseSignal) {
|
||||
if (process.env.NEXT_RUNTIME === 'edge') {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('createNodeStreamWithLateRelease cannot be used in the edge runtime'), "__NEXT_ERROR_CODE", {
|
||||
value: "E993",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
} else {
|
||||
const { Readable } = require('node:stream');
|
||||
let nextIndex = 0;
|
||||
const readable = new Readable({
|
||||
read () {
|
||||
while(nextIndex < partialChunks.length){
|
||||
this.push(partialChunks[nextIndex]);
|
||||
nextIndex++;
|
||||
}
|
||||
}
|
||||
});
|
||||
releaseSignal.addEventListener('abort', ()=>{
|
||||
// Flush any remaining chunks from the original set
|
||||
while(nextIndex < partialChunks.length){
|
||||
readable.push(partialChunks[nextIndex]);
|
||||
nextIndex++;
|
||||
}
|
||||
// Flush all chunks since we're now aborted and can't schedule
|
||||
// any new work but these chunks might unblock debugInfo
|
||||
while(nextIndex < allChunks.length){
|
||||
readable.push(allChunks[nextIndex]);
|
||||
nextIndex++;
|
||||
}
|
||||
setImmediate(()=>{
|
||||
readable.push(null);
|
||||
});
|
||||
}, {
|
||||
once: true
|
||||
});
|
||||
return readable;
|
||||
}
|
||||
}
|
||||
function createNodeStreamFromChunks(chunks, signal) {
|
||||
if (process.env.NEXT_RUNTIME === 'edge') {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('createNodeStreamFromChunks cannot be used in the edge runtime'), "__NEXT_ERROR_CODE", {
|
||||
value: "E945",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
} else {
|
||||
const { Readable } = require('node:stream');
|
||||
// If there's a signal, delay closing until it fires
|
||||
if (signal) {
|
||||
signal.addEventListener('abort', ()=>{
|
||||
readable.push(null);
|
||||
}, {
|
||||
once: true
|
||||
});
|
||||
}
|
||||
let nextIndex = 0;
|
||||
const readable = new Readable({
|
||||
read () {
|
||||
while(nextIndex < chunks.length){
|
||||
this.push(chunks[nextIndex]);
|
||||
nextIndex++;
|
||||
}
|
||||
if (!signal) {
|
||||
this.push(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
return readable;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=stream-utils.js.map
|
||||
17
build/node_modules/next/dist/server/app-render/interop-default.js
generated
vendored
Normal file
17
build/node_modules/next/dist/server/app-render/interop-default.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Interop between "export default" and "module.exports".
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "interopDefault", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return interopDefault;
|
||||
}
|
||||
});
|
||||
function interopDefault(mod) {
|
||||
return mod.default || mod;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=interop-default.js.map
|
||||
92
build/node_modules/next/dist/server/app-render/make-get-server-inserted-html.js
generated
vendored
Normal file
92
build/node_modules/next/dist/server/app-render/make-get-server-inserted-html.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
/* eslint-disable @next/internal/no-ambiguous-jsx -- whole module is used in React Client */ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "makeGetServerInsertedHTML", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return makeGetServerInsertedHTML;
|
||||
}
|
||||
});
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
||||
const _httpaccessfallback = require("../../client/components/http-access-fallback/http-access-fallback");
|
||||
const _redirect = require("../../client/components/redirect");
|
||||
const _redirecterror = require("../../client/components/redirect-error");
|
||||
const _server = require("react-dom/server");
|
||||
const _nodewebstreamshelper = require("../stream-utils/node-web-streams-helper");
|
||||
const _redirectstatuscode = require("../../client/components/redirect-status-code");
|
||||
const _addpathprefix = require("../../shared/lib/router/utils/add-path-prefix");
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function makeGetServerInsertedHTML({ polyfills, renderServerInsertedHTML, serverCapturedErrors, tracingMetadata, basePath }) {
|
||||
let flushedErrorMetaTagsUntilIndex = 0;
|
||||
// These only need to be rendered once, they'll be set to empty arrays once flushed.
|
||||
let polyfillTags = polyfills.map((polyfill)=>{
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsx)("script", {
|
||||
...polyfill
|
||||
}, polyfill.src);
|
||||
});
|
||||
let traceMetaTags = (tracingMetadata || []).map(({ key, value }, index)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
|
||||
name: key,
|
||||
content: value
|
||||
}, `next-trace-data-${index}`));
|
||||
return async function getServerInsertedHTML() {
|
||||
// Loop through all the errors that have been captured but not yet
|
||||
// flushed.
|
||||
const errorMetaTags = [];
|
||||
while(flushedErrorMetaTagsUntilIndex < serverCapturedErrors.length){
|
||||
const error = serverCapturedErrors[flushedErrorMetaTagsUntilIndex];
|
||||
flushedErrorMetaTagsUntilIndex++;
|
||||
if ((0, _httpaccessfallback.isHTTPAccessFallbackError)(error)) {
|
||||
errorMetaTags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
|
||||
name: "robots",
|
||||
content: "noindex"
|
||||
}, error.digest), process.env.NODE_ENV === 'development' ? /*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
|
||||
name: "next-error",
|
||||
content: "not-found"
|
||||
}, "next-error") : null);
|
||||
} else if ((0, _redirecterror.isRedirectError)(error)) {
|
||||
const redirectUrl = (0, _addpathprefix.addPathPrefix)((0, _redirect.getURLFromRedirectError)(error), basePath);
|
||||
const statusCode = (0, _redirect.getRedirectStatusCodeFromError)(error);
|
||||
const isPermanent = statusCode === _redirectstatuscode.RedirectStatusCode.PermanentRedirect ? true : false;
|
||||
if (redirectUrl) {
|
||||
errorMetaTags.push(/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
|
||||
id: "__next-page-redirect",
|
||||
httpEquiv: "refresh",
|
||||
content: `${isPermanent ? 0 : 1};url=${redirectUrl}`
|
||||
}, error.digest));
|
||||
}
|
||||
}
|
||||
}
|
||||
const serverInsertedHTML = renderServerInsertedHTML();
|
||||
// Skip React rendering if we know the content is empty.
|
||||
if (polyfillTags.length === 0 && traceMetaTags.length === 0 && errorMetaTags.length === 0 && Array.isArray(serverInsertedHTML) && serverInsertedHTML.length === 0) {
|
||||
return '';
|
||||
}
|
||||
const stream = await (0, _server.renderToReadableStream)(/*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
||||
children: [
|
||||
polyfillTags,
|
||||
serverInsertedHTML,
|
||||
traceMetaTags,
|
||||
errorMetaTags
|
||||
]
|
||||
}), {
|
||||
// Larger chunk because this isn't sent over the network.
|
||||
// Let's set it to 1MB.
|
||||
progressiveChunkSize: 1024 * 1024
|
||||
});
|
||||
// The polyfills and trace metadata have been flushed, so they don't need to be rendered again
|
||||
polyfillTags = [];
|
||||
traceMetaTags = [];
|
||||
// There's no need to wait for the stream to be ready
|
||||
// e.g. calling `await stream.allReady` because `streamToString` will
|
||||
// wait and decode the stream progressively with better parallelism.
|
||||
return (0, _nodewebstreamshelper.streamToString)(stream);
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=make-get-server-inserted-html.js.map
|
||||
264
build/node_modules/next/dist/server/app-render/manifests-singleton.js
generated
vendored
Normal file
264
build/node_modules/next/dist/server/app-render/manifests-singleton.js
generated
vendored
Normal file
@@ -0,0 +1,264 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
getClientReferenceManifest: null,
|
||||
getServerActionsManifest: null,
|
||||
getServerModuleMap: null,
|
||||
selectWorkerForForwarding: null,
|
||||
setManifestsSingleton: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
getClientReferenceManifest: function() {
|
||||
return getClientReferenceManifest;
|
||||
},
|
||||
getServerActionsManifest: function() {
|
||||
return getServerActionsManifest;
|
||||
},
|
||||
getServerModuleMap: function() {
|
||||
return getServerModuleMap;
|
||||
},
|
||||
selectWorkerForForwarding: function() {
|
||||
return selectWorkerForForwarding;
|
||||
},
|
||||
setManifestsSingleton: function() {
|
||||
return setManifestsSingleton;
|
||||
}
|
||||
});
|
||||
const _invarianterror = require("../../shared/lib/invariant-error");
|
||||
const _apppaths = require("../../shared/lib/router/utils/app-paths");
|
||||
const _pathhasprefix = require("../../shared/lib/router/utils/path-has-prefix");
|
||||
const _removepathprefix = require("../../shared/lib/router/utils/remove-path-prefix");
|
||||
const _workasyncstorageexternal = require("./work-async-storage.external");
|
||||
// This is a global singleton that is, among other things, also used to
|
||||
// encode/decode bound args of server function closures. This can't be using a
|
||||
// AsyncLocalStorage as it might happen at the module level.
|
||||
const MANIFESTS_SINGLETON = Symbol.for('next.server.manifests');
|
||||
const globalThisWithManifests = globalThis;
|
||||
function createProxiedClientReferenceManifest(clientReferenceManifestsPerRoute) {
|
||||
const createMappingProxy = (prop)=>{
|
||||
return new Proxy({}, {
|
||||
get (_, id) {
|
||||
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
||||
if (workStore) {
|
||||
const currentManifest = clientReferenceManifestsPerRoute.get(workStore.route);
|
||||
if (currentManifest == null ? void 0 : currentManifest[prop][id]) {
|
||||
return currentManifest[prop][id];
|
||||
}
|
||||
// In development, we also check all other manifests to see if the
|
||||
// module exists there. This is to support a scenario where React's
|
||||
// I/O tracking (dev-only) creates a connection from one page to
|
||||
// another through an emitted async I/O node that references client
|
||||
// components from the other page, e.g. in owner props.
|
||||
// TODO: Maybe we need to add a `debugBundlerConfig` option to React
|
||||
// to avoid this workaround. The current workaround has the
|
||||
// disadvantage that one might accidentally or intentionally share
|
||||
// client references across pages (e.g. by storing them in a global
|
||||
// variable), which would then only be caught in production.
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
for (const [route, manifest] of clientReferenceManifestsPerRoute){
|
||||
if (route === workStore.route) {
|
||||
continue;
|
||||
}
|
||||
const entry = manifest[prop][id];
|
||||
if (entry !== undefined) {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If there's no work store defined, we can assume that a client
|
||||
// reference manifest is needed during module evaluation, e.g. to
|
||||
// create a server function using a higher-order function. This
|
||||
// might also use client components which need to be serialized by
|
||||
// Flight, and therefore client references need to be resolvable. In
|
||||
// that case we search all page manifests to find the module.
|
||||
for (const manifest of clientReferenceManifestsPerRoute.values()){
|
||||
const entry = manifest[prop][id];
|
||||
if (entry !== undefined) {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
};
|
||||
const mappingProxies = new Map();
|
||||
return new Proxy({}, {
|
||||
get (_, prop) {
|
||||
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
||||
switch(prop){
|
||||
case 'moduleLoading':
|
||||
case 'entryCSSFiles':
|
||||
case 'entryJSFiles':
|
||||
{
|
||||
if (!workStore) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError(`Cannot access "${prop}" without a work store.`), "__NEXT_ERROR_CODE", {
|
||||
value: "E952",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
const currentManifest = clientReferenceManifestsPerRoute.get(workStore.route);
|
||||
if (!currentManifest) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError(`The client reference manifest for route "${workStore.route}" does not exist.`), "__NEXT_ERROR_CODE", {
|
||||
value: "E951",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
return currentManifest[prop];
|
||||
}
|
||||
case 'clientModules':
|
||||
case 'rscModuleMapping':
|
||||
case 'edgeRscModuleMapping':
|
||||
case 'ssrModuleMapping':
|
||||
case 'edgeSSRModuleMapping':
|
||||
{
|
||||
let proxy = mappingProxies.get(prop);
|
||||
if (!proxy) {
|
||||
proxy = createMappingProxy(prop);
|
||||
mappingProxies.set(prop, proxy);
|
||||
}
|
||||
return proxy;
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError(`This is a proxied client reference manifest. The property "${String(prop)}" is not handled.`), "__NEXT_ERROR_CODE", {
|
||||
value: "E953",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* This function creates a Flight-acceptable server module map proxy from our
|
||||
* Server Reference Manifest similar to our client module map. This is because
|
||||
* our manifest contains a lot of internal Next.js data that are relevant to the
|
||||
* runtime, workers, etc. that React doesn't need to know.
|
||||
*/ function createServerModuleMap() {
|
||||
return new Proxy({}, {
|
||||
get: (_, id)=>{
|
||||
var _getServerActionsManifest__id, _getServerActionsManifest_;
|
||||
const workers = (_getServerActionsManifest_ = getServerActionsManifest()[process.env.NEXT_RUNTIME === 'edge' ? 'edge' : 'node']) == null ? void 0 : (_getServerActionsManifest__id = _getServerActionsManifest_[id]) == null ? void 0 : _getServerActionsManifest__id.workers;
|
||||
if (!workers) {
|
||||
return undefined;
|
||||
}
|
||||
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
||||
let workerEntry;
|
||||
if (workStore) {
|
||||
workerEntry = workers[normalizeWorkerPageName(workStore.page)];
|
||||
} else {
|
||||
// If there's no work store defined, we can assume that a server
|
||||
// module map is needed during module evaluation, e.g. to create a
|
||||
// server action using a higher-order function. Therefore it should be
|
||||
// safe to return any entry from the manifest that matches the action
|
||||
// ID. They all refer to the same module ID, which must also exist in
|
||||
// the current page bundle. TODO: This is currently not guaranteed in
|
||||
// Turbopack, and needs to be fixed.
|
||||
workerEntry = Object.values(workers).at(0);
|
||||
}
|
||||
if (!workerEntry) {
|
||||
return undefined;
|
||||
}
|
||||
const { moduleId, async } = workerEntry;
|
||||
return {
|
||||
id: moduleId,
|
||||
name: id,
|
||||
chunks: [],
|
||||
async
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* The flight entry loader keys actions by bundlePath. bundlePath corresponds
|
||||
* with the relative path (including 'app') to the page entrypoint.
|
||||
*/ function normalizeWorkerPageName(pageName) {
|
||||
if ((0, _pathhasprefix.pathHasPrefix)(pageName, 'app')) {
|
||||
return pageName;
|
||||
}
|
||||
return 'app' + pageName;
|
||||
}
|
||||
/**
|
||||
* Converts a bundlePath (relative path to the entrypoint) to a routable page
|
||||
* name.
|
||||
*/ function denormalizeWorkerPageName(bundlePath) {
|
||||
return (0, _apppaths.normalizeAppPath)((0, _removepathprefix.removePathPrefix)(bundlePath, 'app'));
|
||||
}
|
||||
function selectWorkerForForwarding(actionId, pageName) {
|
||||
var _serverActionsManifest__actionId;
|
||||
const serverActionsManifest = getServerActionsManifest();
|
||||
const workers = (_serverActionsManifest__actionId = serverActionsManifest[process.env.NEXT_RUNTIME === 'edge' ? 'edge' : 'node'][actionId]) == null ? void 0 : _serverActionsManifest__actionId.workers;
|
||||
// There are no workers to handle this action, nothing to forward to.
|
||||
if (!workers) {
|
||||
return;
|
||||
}
|
||||
// If there is an entry for the current page, we don't need to forward.
|
||||
if (workers[normalizeWorkerPageName(pageName)]) {
|
||||
return;
|
||||
}
|
||||
// Otherwise, grab the first worker that has a handler for this action id.
|
||||
return denormalizeWorkerPageName(Object.keys(workers)[0]);
|
||||
}
|
||||
function setManifestsSingleton({ page, clientReferenceManifest, serverActionsManifest: rawServerActionsManifest }) {
|
||||
const existingSingleton = globalThisWithManifests[MANIFESTS_SINGLETON];
|
||||
const serverActionsManifest = {
|
||||
encryptionKey: rawServerActionsManifest.encryptionKey,
|
||||
// Use null-prototypes for the action objects to prevent prototype pollution
|
||||
// from affecting action ID lookups.
|
||||
node: Object.assign(Object.create(null), rawServerActionsManifest.node),
|
||||
edge: Object.assign(Object.create(null), rawServerActionsManifest.edge)
|
||||
};
|
||||
if (existingSingleton) {
|
||||
existingSingleton.clientReferenceManifestsPerRoute.set((0, _apppaths.normalizeAppPath)(page), clientReferenceManifest);
|
||||
existingSingleton.serverActionsManifest = serverActionsManifest;
|
||||
} else {
|
||||
const clientReferenceManifestsPerRoute = new Map([
|
||||
[
|
||||
(0, _apppaths.normalizeAppPath)(page),
|
||||
clientReferenceManifest
|
||||
]
|
||||
]);
|
||||
const proxiedClientReferenceManifest = createProxiedClientReferenceManifest(clientReferenceManifestsPerRoute);
|
||||
globalThisWithManifests[MANIFESTS_SINGLETON] = {
|
||||
clientReferenceManifestsPerRoute,
|
||||
proxiedClientReferenceManifest,
|
||||
serverActionsManifest,
|
||||
serverModuleMap: createServerModuleMap()
|
||||
};
|
||||
}
|
||||
}
|
||||
function getManifestsSingleton() {
|
||||
const manifestSingleton = globalThisWithManifests[MANIFESTS_SINGLETON];
|
||||
if (!manifestSingleton) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('The manifests singleton was not initialized.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E950",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
return manifestSingleton;
|
||||
}
|
||||
function getClientReferenceManifest() {
|
||||
return getManifestsSingleton().proxiedClientReferenceManifest;
|
||||
}
|
||||
function getServerActionsManifest() {
|
||||
return getManifestsSingleton().serverActionsManifest;
|
||||
}
|
||||
function getServerModuleMap() {
|
||||
return getManifestsSingleton().serverModuleMap;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=manifests-singleton.js.map
|
||||
29
build/node_modules/next/dist/server/app-render/metadata-insertion/create-server-inserted-metadata.js
generated
vendored
Normal file
29
build/node_modules/next/dist/server/app-render/metadata-insertion/create-server-inserted-metadata.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "createServerInsertedMetadata", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return createServerInsertedMetadata;
|
||||
}
|
||||
});
|
||||
const _htmlescape = require("../../../shared/lib/htmlescape");
|
||||
/**
|
||||
* For chromium based browsers (Chrome, Edge, etc.) and Safari,
|
||||
* icons need to stay under <head> to be picked up by the browser.
|
||||
*
|
||||
*/ const REINSERT_ICON_SCRIPT = `\
|
||||
document.querySelectorAll('body link[rel="icon"], body link[rel="apple-touch-icon"]').forEach(el => document.head.appendChild(el))`;
|
||||
function createServerInsertedMetadata(nonce) {
|
||||
let inserted = false;
|
||||
return async function getServerInsertedMetadata() {
|
||||
if (inserted) {
|
||||
return '';
|
||||
}
|
||||
inserted = true;
|
||||
return `<script${nonce ? ` nonce="${(0, _htmlescape.htmlEscapeAttributeString)(nonce)}"` : ''}>${REINSERT_ICON_SCRIPT}</script>`;
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=create-server-inserted-metadata.js.map
|
||||
57
build/node_modules/next/dist/server/app-render/module-loading/track-dynamic-import.js
generated
vendored
Normal file
57
build/node_modules/next/dist/server/app-render/module-loading/track-dynamic-import.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "trackDynamicImport", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return trackDynamicImport;
|
||||
}
|
||||
});
|
||||
const _invarianterror = require("../../../shared/lib/invariant-error");
|
||||
const _isthenable = require("../../../shared/lib/is-thenable");
|
||||
const _trackmoduleloadingexternal = require("./track-module-loading.external");
|
||||
function trackDynamicImport(modulePromise) {
|
||||
if (process.env.NEXT_RUNTIME === 'edge') {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError("Dynamic imports should not be instrumented in the edge runtime, because `cacheComponents` doesn't support it"), "__NEXT_ERROR_CODE", {
|
||||
value: "E687",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
if (!(0, _isthenable.isThenable)(modulePromise)) {
|
||||
// We're expecting `import()` to always return a promise. If it's not, something's very wrong.
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('`trackDynamicImport` should always receive a promise. Something went wrong in the dynamic imports transform.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E677",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
// Even if we're inside a prerender and have `workUnitStore.cacheSignal`, we always track the promise globally.
|
||||
// (i.e. via the global `moduleLoadingSignal` that `trackPendingImport` uses internally).
|
||||
//
|
||||
// We do this because the `import()` promise might be cached in userspace:
|
||||
// (which is quite common for e.g. lazy initialization in libraries)
|
||||
//
|
||||
// let promise;
|
||||
// function doDynamicImportOnce() {
|
||||
// if (!promise) {
|
||||
// promise = import("...");
|
||||
// // transformed into:
|
||||
// // promise = trackDynamicImport(import("..."));
|
||||
// }
|
||||
// return promise;
|
||||
// }
|
||||
//
|
||||
// If multiple prerenders (e.g. multiple pages) depend on `doDynamicImportOnce`,
|
||||
// we have to wait for the import *in all of them*.
|
||||
// If we only tracked it using `workUnitStore.cacheSignal.trackRead()`,
|
||||
// then only the first prerender to call `doDynamicImportOnce` would wait --
|
||||
// Subsequent prerenders would re-use the existing `promise`,
|
||||
// and `trackDynamicImport` wouldn't be called again in their scope,
|
||||
// so their respective CacheSignals wouldn't wait for the promise.
|
||||
(0, _trackmoduleloadingexternal.trackPendingImport)(modulePromise);
|
||||
return modulePromise;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=track-dynamic-import.js.map
|
||||
32
build/node_modules/next/dist/server/app-render/module-loading/track-module-loading.external.js
generated
vendored
Normal file
32
build/node_modules/next/dist/server/app-render/module-loading/track-module-loading.external.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
// NOTE: this is marked as shared/external because it's stateful
|
||||
// and the state needs to be shared between app-render (which waits for pending imports)
|
||||
// and helpers used in transformed page code (which register pending imports)
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
trackPendingChunkLoad: null,
|
||||
trackPendingImport: null,
|
||||
trackPendingModules: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
trackPendingChunkLoad: function() {
|
||||
return _trackmoduleloadinginstance.trackPendingChunkLoad;
|
||||
},
|
||||
trackPendingImport: function() {
|
||||
return _trackmoduleloadinginstance.trackPendingImport;
|
||||
},
|
||||
trackPendingModules: function() {
|
||||
return _trackmoduleloadinginstance.trackPendingModules;
|
||||
}
|
||||
});
|
||||
const _trackmoduleloadinginstance = require("./track-module-loading.instance");
|
||||
|
||||
//# sourceMappingURL=track-module-loading.external.js.map
|
||||
66
build/node_modules/next/dist/server/app-render/module-loading/track-module-loading.instance.js
generated
vendored
Normal file
66
build/node_modules/next/dist/server/app-render/module-loading/track-module-loading.instance.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
trackPendingChunkLoad: null,
|
||||
trackPendingImport: null,
|
||||
trackPendingModules: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
trackPendingChunkLoad: function() {
|
||||
return trackPendingChunkLoad;
|
||||
},
|
||||
trackPendingImport: function() {
|
||||
return trackPendingImport;
|
||||
},
|
||||
trackPendingModules: function() {
|
||||
return trackPendingModules;
|
||||
}
|
||||
});
|
||||
const _cachesignal = require("../cache-signal");
|
||||
const _isthenable = require("../../../shared/lib/is-thenable");
|
||||
/**
|
||||
* Tracks all in-flight async imports and chunk loads.
|
||||
* Initialized lazily, because we don't want this to error in case it gets pulled into an edge runtime module.
|
||||
*/ let _moduleLoadingSignal;
|
||||
function getModuleLoadingSignal() {
|
||||
if (!_moduleLoadingSignal) {
|
||||
_moduleLoadingSignal = new _cachesignal.CacheSignal();
|
||||
}
|
||||
return _moduleLoadingSignal;
|
||||
}
|
||||
function trackPendingChunkLoad(promise) {
|
||||
const moduleLoadingSignal = getModuleLoadingSignal();
|
||||
moduleLoadingSignal.trackRead(promise);
|
||||
}
|
||||
function trackPendingImport(exportsOrPromise) {
|
||||
const moduleLoadingSignal = getModuleLoadingSignal();
|
||||
// requiring an async module returns a promise.
|
||||
// if it's sync, there's nothing to track.
|
||||
if ((0, _isthenable.isThenable)(exportsOrPromise)) {
|
||||
// A client reference proxy might look like a promise, but we can only call `.then()` on it, not e.g. `.finally()`.
|
||||
// Turn it into a real promise to avoid issues elsewhere.
|
||||
const promise = Promise.resolve(exportsOrPromise);
|
||||
moduleLoadingSignal.trackRead(promise);
|
||||
}
|
||||
}
|
||||
function trackPendingModules(cacheSignal) {
|
||||
const moduleLoadingSignal = getModuleLoadingSignal();
|
||||
// We can't just use `cacheSignal.trackRead(moduleLoadingSignal.cacheReady())`,
|
||||
// because we might start and finish multiple batches of module loads while waiting for caches,
|
||||
// and `moduleLoadingSignal.cacheReady()` would resolve after the first batch.
|
||||
// Instead, we'll keep notifying `cacheSignal` of each import/chunk-load.
|
||||
const unsubscribe = moduleLoadingSignal.subscribeToReads(cacheSignal);
|
||||
// Later, when `cacheSignal` is no longer waiting for any caches (or imports that we've notified it of),
|
||||
// we can unsubscribe it.
|
||||
cacheSignal.cacheReady().then(unsubscribe);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=track-module-loading.instance.js.map
|
||||
49
build/node_modules/next/dist/server/app-render/parse-and-validate-flight-router-state.js
generated
vendored
Normal file
49
build/node_modules/next/dist/server/app-render/parse-and-validate-flight-router-state.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "parseAndValidateFlightRouterState", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return parseAndValidateFlightRouterState;
|
||||
}
|
||||
});
|
||||
const _types = require("./types");
|
||||
const _superstruct = require("next/dist/compiled/superstruct");
|
||||
function parseAndValidateFlightRouterState(stateHeader) {
|
||||
if (typeof stateHeader === 'undefined') {
|
||||
return undefined;
|
||||
}
|
||||
if (Array.isArray(stateHeader)) {
|
||||
throw Object.defineProperty(new Error('Multiple router state headers were sent. This is not allowed.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E418",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
// We limit the size of the router state header to ~40kb. This is to prevent
|
||||
// a malicious user from sending a very large header and slowing down the
|
||||
// resolving of the router state.
|
||||
// This is around 2,000 nested or parallel route segment states:
|
||||
// '{"children":["",{}]}'.length === 20.
|
||||
if (stateHeader.length > 20 * 2000) {
|
||||
throw Object.defineProperty(new Error('The router state header was too large.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E142",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
try {
|
||||
const state = JSON.parse(decodeURIComponent(stateHeader));
|
||||
(0, _superstruct.assert)(state, _types.flightRouterStateSchema);
|
||||
return state;
|
||||
} catch {
|
||||
throw Object.defineProperty(new Error('The router state header was sent but could not be parsed.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E10",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=parse-and-validate-flight-router-state.js.map
|
||||
157
build/node_modules/next/dist/server/app-render/postponed-state.js
generated
vendored
Normal file
157
build/node_modules/next/dist/server/app-render/postponed-state.js
generated
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
DynamicHTMLPreludeState: null,
|
||||
DynamicState: null,
|
||||
getDynamicDataPostponedState: null,
|
||||
getDynamicHTMLPostponedState: null,
|
||||
getPostponedFromState: null,
|
||||
parsePostponedState: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
DynamicHTMLPreludeState: function() {
|
||||
return DynamicHTMLPreludeState;
|
||||
},
|
||||
DynamicState: function() {
|
||||
return DynamicState;
|
||||
},
|
||||
getDynamicDataPostponedState: function() {
|
||||
return getDynamicDataPostponedState;
|
||||
},
|
||||
getDynamicHTMLPostponedState: function() {
|
||||
return getDynamicHTMLPostponedState;
|
||||
},
|
||||
getPostponedFromState: function() {
|
||||
return getPostponedFromState;
|
||||
},
|
||||
parsePostponedState: function() {
|
||||
return parsePostponedState;
|
||||
}
|
||||
});
|
||||
const _getdynamicparam = require("../../shared/lib/router/utils/get-dynamic-param");
|
||||
const _resumedatacache = require("../resume-data-cache/resume-data-cache");
|
||||
var DynamicState = /*#__PURE__*/ function(DynamicState) {
|
||||
/**
|
||||
* The dynamic access occurred during the RSC render phase.
|
||||
*/ DynamicState[DynamicState["DATA"] = 1] = "DATA";
|
||||
/**
|
||||
* The dynamic access occurred during the HTML shell render phase.
|
||||
*/ DynamicState[DynamicState["HTML"] = 2] = "HTML";
|
||||
return DynamicState;
|
||||
}({});
|
||||
var DynamicHTMLPreludeState = /*#__PURE__*/ function(DynamicHTMLPreludeState) {
|
||||
DynamicHTMLPreludeState[DynamicHTMLPreludeState["Empty"] = 0] = "Empty";
|
||||
DynamicHTMLPreludeState[DynamicHTMLPreludeState["Full"] = 1] = "Full";
|
||||
return DynamicHTMLPreludeState;
|
||||
}({});
|
||||
async function getDynamicHTMLPostponedState(postponed, preludeState, fallbackRouteParams, resumeDataCache, isCacheComponentsEnabled) {
|
||||
const data = [
|
||||
preludeState,
|
||||
postponed
|
||||
];
|
||||
const dataString = JSON.stringify(data);
|
||||
// If there are no fallback route params, we can just serialize the postponed
|
||||
// state as is.
|
||||
if (!fallbackRouteParams || fallbackRouteParams.size === 0) {
|
||||
// Serialized as `<postponedString.length>:<postponedString><renderResumeDataCache>`
|
||||
return `${dataString.length}:${dataString}${await (0, _resumedatacache.stringifyResumeDataCache)((0, _resumedatacache.createRenderResumeDataCache)(resumeDataCache), isCacheComponentsEnabled)}`;
|
||||
}
|
||||
const replacements = Array.from(fallbackRouteParams.entries());
|
||||
const replacementsString = JSON.stringify(replacements);
|
||||
// Serialized as `<replacements.length><replacements><data>`
|
||||
const postponedString = `${replacementsString.length}${replacementsString}${dataString}`;
|
||||
// Serialized as `<postponedString.length>:<postponedString><renderResumeDataCache>`
|
||||
return `${postponedString.length}:${postponedString}${await (0, _resumedatacache.stringifyResumeDataCache)(resumeDataCache, isCacheComponentsEnabled)}`;
|
||||
}
|
||||
async function getDynamicDataPostponedState(resumeDataCache, isCacheComponentsEnabled) {
|
||||
return `4:null${await (0, _resumedatacache.stringifyResumeDataCache)((0, _resumedatacache.createRenderResumeDataCache)(resumeDataCache), isCacheComponentsEnabled)}`;
|
||||
}
|
||||
function parsePostponedState(state, interpolatedParams, maxPostponedStateSizeBytes) {
|
||||
try {
|
||||
var _state_match;
|
||||
const postponedStringLengthMatch = (_state_match = state.match(/^([0-9]*):/)) == null ? void 0 : _state_match[1];
|
||||
if (!postponedStringLengthMatch) {
|
||||
throw Object.defineProperty(new Error(`Invariant: invalid postponed state ${state}`), "__NEXT_ERROR_CODE", {
|
||||
value: "E314",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
const postponedStringLength = parseInt(postponedStringLengthMatch);
|
||||
// We add a `:` to the end of the length as the first character of the
|
||||
// postponed string is the length of the replacement entries.
|
||||
const postponedString = state.slice(postponedStringLengthMatch.length + 1, postponedStringLengthMatch.length + postponedStringLength + 1);
|
||||
const renderResumeDataCache = (0, _resumedatacache.createRenderResumeDataCache)(state.slice(postponedStringLengthMatch.length + postponedStringLength + 1), maxPostponedStateSizeBytes);
|
||||
try {
|
||||
if (postponedString === 'null') {
|
||||
return {
|
||||
type: 1,
|
||||
renderResumeDataCache
|
||||
};
|
||||
}
|
||||
if (/^[0-9]/.test(postponedString)) {
|
||||
var _postponedString_match;
|
||||
const match = (_postponedString_match = postponedString.match(/^([0-9]*)/)) == null ? void 0 : _postponedString_match[1];
|
||||
if (!match) {
|
||||
throw Object.defineProperty(new Error(`Invariant: invalid postponed state ${JSON.stringify(postponedString)}`), "__NEXT_ERROR_CODE", {
|
||||
value: "E314",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
// This is the length of the replacements entries.
|
||||
const length = parseInt(match);
|
||||
const replacements = JSON.parse(postponedString.slice(match.length, // We then go to the end of the string.
|
||||
match.length + length));
|
||||
let postponed = postponedString.slice(match.length + length);
|
||||
for (const [segmentKey, [searchValue, dynamicParamType]] of replacements){
|
||||
const { treeSegment: [, // This is the same value that'll be used in the postponed state
|
||||
// as it's part of the tree data. That's why we use it as the
|
||||
// replacement value.
|
||||
value] } = (0, _getdynamicparam.getDynamicParam)(interpolatedParams, segmentKey, dynamicParamType, null, null // staticSiblings not needed for postponed state
|
||||
);
|
||||
postponed = postponed.replaceAll(searchValue, value);
|
||||
}
|
||||
return {
|
||||
type: 2,
|
||||
data: JSON.parse(postponed),
|
||||
renderResumeDataCache
|
||||
};
|
||||
}
|
||||
return {
|
||||
type: 2,
|
||||
data: JSON.parse(postponedString),
|
||||
renderResumeDataCache
|
||||
};
|
||||
} catch (err) {
|
||||
console.error('Failed to parse postponed state', err);
|
||||
return {
|
||||
type: 1,
|
||||
renderResumeDataCache
|
||||
};
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Failed to parse postponed state', err);
|
||||
return {
|
||||
type: 1,
|
||||
renderResumeDataCache: (0, _resumedatacache.createPrerenderResumeDataCache)()
|
||||
};
|
||||
}
|
||||
}
|
||||
function getPostponedFromState(state) {
|
||||
const [preludeState, postponed] = state.data;
|
||||
return {
|
||||
preludeState,
|
||||
postponed
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=postponed-state.js.map
|
||||
74
build/node_modules/next/dist/server/app-render/prospective-render-utils.js
generated
vendored
Normal file
74
build/node_modules/next/dist/server/app-render/prospective-render-utils.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
Phase: null,
|
||||
printDebugThrownValueForProspectiveRender: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
Phase: function() {
|
||||
return Phase;
|
||||
},
|
||||
printDebugThrownValueForProspectiveRender: function() {
|
||||
return printDebugThrownValueForProspectiveRender;
|
||||
}
|
||||
});
|
||||
const _createerrorhandler = require("./create-error-handler");
|
||||
const _reactlargeshellerror = require("./react-large-shell-error");
|
||||
var Phase = /*#__PURE__*/ function(Phase) {
|
||||
Phase["ProspectiveRender"] = "the prospective render";
|
||||
Phase["SegmentCollection"] = "segment collection";
|
||||
Phase["InstantValidation"] = "instant validation";
|
||||
return Phase;
|
||||
}({});
|
||||
function printDebugThrownValueForProspectiveRender(thrownValue, route, phase) {
|
||||
// We don't need to print well-known Next.js errors.
|
||||
if ((0, _createerrorhandler.getDigestForWellKnownError)(thrownValue)) {
|
||||
return;
|
||||
}
|
||||
if ((0, _reactlargeshellerror.isReactLargeShellError)(thrownValue)) {
|
||||
// TODO: Aggregate
|
||||
console.error(thrownValue);
|
||||
return undefined;
|
||||
}
|
||||
let message;
|
||||
if (typeof thrownValue === 'object' && thrownValue !== null && typeof thrownValue.message === 'string') {
|
||||
message = thrownValue.message;
|
||||
if (typeof thrownValue.stack === 'string') {
|
||||
const originalErrorStack = thrownValue.stack;
|
||||
const stackStart = originalErrorStack.indexOf('\n');
|
||||
if (stackStart > -1) {
|
||||
const error = Object.defineProperty(new Error(`Route ${route} errored during ${phase}. These errors are normally ignored and may not prevent the route from prerendering but are logged here because build debugging is enabled.
|
||||
|
||||
Original Error: ${message}`), "__NEXT_ERROR_CODE", {
|
||||
value: "E949",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
error.stack = 'Error: ' + error.message + originalErrorStack.slice(stackStart);
|
||||
console.error(error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (typeof thrownValue === 'string') {
|
||||
message = thrownValue;
|
||||
}
|
||||
if (message) {
|
||||
console.error(`Route ${route} errored during ${phase}. These errors are normally ignored and may not prevent the route from prerendering but are logged here because build debugging is enabled. No stack was provided.
|
||||
|
||||
Original Message: ${message}`);
|
||||
return;
|
||||
}
|
||||
console.error(`Route ${route} errored during ${phase}. These errors are normally ignored and may not prevent the route from prerendering but are logged here because build debugging is enabled. The thrown value is logged just following this message`);
|
||||
console.error(thrownValue);
|
||||
return;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=prospective-render-utils.js.map
|
||||
17
build/node_modules/next/dist/server/app-render/react-large-shell-error.js
generated
vendored
Normal file
17
build/node_modules/next/dist/server/app-render/react-large-shell-error.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// TODO: isWellKnownError -> isNextInternalError
|
||||
// isReactLargeShellError -> isWarning
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "isReactLargeShellError", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return isReactLargeShellError;
|
||||
}
|
||||
});
|
||||
function isReactLargeShellError(error) {
|
||||
return typeof error === 'object' && error !== null && 'message' in error && typeof error.message === 'string' && error.message.startsWith('This rendered a large document (>');
|
||||
}
|
||||
|
||||
//# sourceMappingURL=react-large-shell-error.js.map
|
||||
39
build/node_modules/next/dist/server/app-render/react-server.node.js
generated
vendored
Normal file
39
build/node_modules/next/dist/server/app-render/react-server.node.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
// This file should be opted into the react-server layer
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
createTemporaryReferenceSet: null,
|
||||
decodeAction: null,
|
||||
decodeFormState: null,
|
||||
decodeReply: null,
|
||||
decodeReplyFromBusboy: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
createTemporaryReferenceSet: function() {
|
||||
return _servernode.createTemporaryReferenceSet;
|
||||
},
|
||||
decodeAction: function() {
|
||||
return _servernode.decodeAction;
|
||||
},
|
||||
decodeFormState: function() {
|
||||
return _servernode.decodeFormState;
|
||||
},
|
||||
decodeReply: function() {
|
||||
return _servernode.decodeReply;
|
||||
},
|
||||
decodeReplyFromBusboy: function() {
|
||||
return _servernode.decodeReplyFromBusboy;
|
||||
}
|
||||
});
|
||||
const _servernode = require("react-server-dom-webpack/server.node");
|
||||
|
||||
//# sourceMappingURL=react-server.node.js.map
|
||||
52
build/node_modules/next/dist/server/app-render/render-css-resource.js
generated
vendored
Normal file
52
build/node_modules/next/dist/server/app-render/render-css-resource.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "renderCssResource", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return renderCssResource;
|
||||
}
|
||||
});
|
||||
const _encodeuripath = require("../../shared/lib/encode-uri-path");
|
||||
const _getassetquerystring = require("./get-asset-query-string");
|
||||
function renderCssResource(entryCssFiles, ctx, preloadCallbacks) {
|
||||
const { componentMod: { createElement } } = ctx;
|
||||
return entryCssFiles.map((entryCssFile, index)=>{
|
||||
// `Precedence` is an opt-in signal for React to handle resource
|
||||
// loading and deduplication, etc. It's also used as the key to sort
|
||||
// resources so they will be injected in the correct order.
|
||||
// During HMR, it's critical to use different `precedence` values
|
||||
// for different stylesheets, so their order will be kept.
|
||||
// https://github.com/facebook/react/pull/25060
|
||||
const precedence = process.env.NODE_ENV === 'development' ? 'next_' + entryCssFile.path : 'next';
|
||||
// In dev, Safari and Firefox will cache the resource during HMR:
|
||||
// - https://github.com/vercel/next.js/issues/5860
|
||||
// - https://bugs.webkit.org/show_bug.cgi?id=187726
|
||||
// Because of this, we add a `?v=` query to bypass the cache during
|
||||
// development. We need to also make sure that the number is always
|
||||
// increasing.
|
||||
const fullHref = `${ctx.assetPrefix}/_next/${(0, _encodeuripath.encodeURIPath)(entryCssFile.path)}${(0, _getassetquerystring.getAssetQueryString)(ctx, true)}`;
|
||||
if (entryCssFile.inlined && !ctx.parsedRequestHeaders.isRSCRequest) {
|
||||
return createElement('style', {
|
||||
key: index,
|
||||
nonce: ctx.nonce,
|
||||
precedence: precedence,
|
||||
href: fullHref
|
||||
}, entryCssFile.content);
|
||||
}
|
||||
preloadCallbacks == null ? void 0 : preloadCallbacks.push(()=>{
|
||||
ctx.componentMod.preloadStyle(fullHref, ctx.renderOpts.crossOrigin, ctx.nonce);
|
||||
});
|
||||
return createElement('link', {
|
||||
key: index,
|
||||
rel: 'stylesheet',
|
||||
href: fullHref,
|
||||
precedence: precedence,
|
||||
crossOrigin: ctx.renderOpts.crossOrigin,
|
||||
nonce: ctx.nonce
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=render-css-resource.js.map
|
||||
76
build/node_modules/next/dist/server/app-render/required-scripts.js
generated
vendored
Normal file
76
build/node_modules/next/dist/server/app-render/required-scripts.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "getRequiredScripts", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return getRequiredScripts;
|
||||
}
|
||||
});
|
||||
const _encodeuripath = require("../../shared/lib/encode-uri-path");
|
||||
const _reactdom = /*#__PURE__*/ _interop_require_default(require("react-dom"));
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function getRequiredScripts(buildManifest, assetPrefix, crossOrigin, SRIManifest, qs, nonce, pagePath) {
|
||||
var _buildManifest_rootMainFilesTree;
|
||||
let preinitScripts;
|
||||
let preinitScriptCommands = [];
|
||||
const bootstrapScript = {
|
||||
src: '',
|
||||
crossOrigin
|
||||
};
|
||||
const files = (((_buildManifest_rootMainFilesTree = buildManifest.rootMainFilesTree) == null ? void 0 : _buildManifest_rootMainFilesTree[pagePath]) || buildManifest.rootMainFiles).map(_encodeuripath.encodeURIPath);
|
||||
if (files.length === 0) {
|
||||
throw Object.defineProperty(new Error('Invariant: missing bootstrap script. This is a bug in Next.js'), "__NEXT_ERROR_CODE", {
|
||||
value: "E459",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
if (SRIManifest) {
|
||||
bootstrapScript.src = `${assetPrefix}/_next/` + files[0] + qs;
|
||||
bootstrapScript.integrity = SRIManifest[files[0]];
|
||||
for(let i = 1; i < files.length; i++){
|
||||
const src = `${assetPrefix}/_next/` + files[i] + qs;
|
||||
const integrity = SRIManifest[files[i]];
|
||||
preinitScriptCommands.push(src, integrity);
|
||||
}
|
||||
preinitScripts = ()=>{
|
||||
// preinitScriptCommands is a double indexed array of src/integrity pairs
|
||||
for(let i = 0; i < preinitScriptCommands.length; i += 2){
|
||||
_reactdom.default.preinit(preinitScriptCommands[i], {
|
||||
as: 'script',
|
||||
integrity: preinitScriptCommands[i + 1],
|
||||
crossOrigin,
|
||||
nonce
|
||||
});
|
||||
}
|
||||
};
|
||||
} else {
|
||||
bootstrapScript.src = `${assetPrefix}/_next/` + files[0] + qs;
|
||||
for(let i = 1; i < files.length; i++){
|
||||
const src = `${assetPrefix}/_next/` + files[i] + qs;
|
||||
preinitScriptCommands.push(src);
|
||||
}
|
||||
preinitScripts = ()=>{
|
||||
// preinitScriptCommands is a singled indexed array of src values
|
||||
for(let i = 0; i < preinitScriptCommands.length; i++){
|
||||
_reactdom.default.preinit(preinitScriptCommands[i], {
|
||||
as: 'script',
|
||||
nonce,
|
||||
crossOrigin
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
return [
|
||||
preinitScripts,
|
||||
bootstrapScript
|
||||
];
|
||||
}
|
||||
|
||||
//# sourceMappingURL=required-scripts.js.map
|
||||
18
build/node_modules/next/dist/server/app-render/rsc/postpone.js
generated
vendored
Normal file
18
build/node_modules/next/dist/server/app-render/rsc/postpone.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
|
||||
Files in the rsc directory are meant to be packaged as part of the RSC graph using next-app-loader.
|
||||
|
||||
*/ // When postpone is available in canary React we can switch to importing it directly
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "Postpone", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _dynamicrendering.Postpone;
|
||||
}
|
||||
});
|
||||
const _dynamicrendering = require("../dynamic-rendering");
|
||||
|
||||
//# sourceMappingURL=postpone.js.map
|
||||
74
build/node_modules/next/dist/server/app-render/rsc/preloads.js
generated
vendored
Normal file
74
build/node_modules/next/dist/server/app-render/rsc/preloads.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
|
||||
Files in the rsc directory are meant to be packaged as part of the RSC graph using next-app-loader.
|
||||
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
preconnect: null,
|
||||
preloadFont: null,
|
||||
preloadStyle: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
preconnect: function() {
|
||||
return preconnect;
|
||||
},
|
||||
preloadFont: function() {
|
||||
return preloadFont;
|
||||
},
|
||||
preloadStyle: function() {
|
||||
return preloadStyle;
|
||||
}
|
||||
});
|
||||
const _reactdom = /*#__PURE__*/ _interop_require_default(require("react-dom"));
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function preloadStyle(href, crossOrigin, nonce) {
|
||||
const opts = {
|
||||
as: 'style'
|
||||
};
|
||||
if (typeof crossOrigin === 'string') {
|
||||
opts.crossOrigin = crossOrigin;
|
||||
}
|
||||
if (typeof nonce === 'string') {
|
||||
opts.nonce = nonce;
|
||||
}
|
||||
_reactdom.default.preload(href, opts);
|
||||
}
|
||||
function preloadFont(href, type, crossOrigin, nonce) {
|
||||
const opts = {
|
||||
as: 'font',
|
||||
type
|
||||
};
|
||||
if (typeof crossOrigin === 'string') {
|
||||
opts.crossOrigin = crossOrigin;
|
||||
}
|
||||
if (typeof nonce === 'string') {
|
||||
opts.nonce = nonce;
|
||||
}
|
||||
_reactdom.default.preload(href, opts);
|
||||
}
|
||||
function preconnect(href, crossOrigin, nonce) {
|
||||
const opts = {};
|
||||
if (typeof crossOrigin === 'string') {
|
||||
opts.crossOrigin = crossOrigin;
|
||||
}
|
||||
if (typeof nonce === 'string') {
|
||||
opts.nonce = nonce;
|
||||
}
|
||||
;
|
||||
_reactdom.default.preconnect(href, opts);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=preloads.js.map
|
||||
79
build/node_modules/next/dist/server/app-render/rsc/taint.js
generated
vendored
Normal file
79
build/node_modules/next/dist/server/app-render/rsc/taint.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
|
||||
Files in the rsc directory are meant to be packaged as part of the RSC graph using next-app-loader.
|
||||
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
taintObjectReference: null,
|
||||
taintUniqueValue: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
taintObjectReference: function() {
|
||||
return taintObjectReference;
|
||||
},
|
||||
taintUniqueValue: function() {
|
||||
return taintUniqueValue;
|
||||
}
|
||||
});
|
||||
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== "function") return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function(nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interop_require_wildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
||||
return {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {
|
||||
__proto__: null
|
||||
};
|
||||
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for(var key in obj){
|
||||
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
function notImplemented() {
|
||||
throw Object.defineProperty(new Error('Taint can only be used with the taint flag.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E354",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
const taintObjectReference = process.env.__NEXT_EXPERIMENTAL_REACT ? _react.experimental_taintObjectReference : notImplemented;
|
||||
const taintUniqueValue = process.env.__NEXT_EXPERIMENTAL_REACT ? _react.experimental_taintUniqueValue : notImplemented;
|
||||
|
||||
//# sourceMappingURL=taint.js.map
|
||||
128
build/node_modules/next/dist/server/app-render/segment-explorer-path.js
generated
vendored
Normal file
128
build/node_modules/next/dist/server/app-render/segment-explorer-path.js
generated
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
BOUNDARY_PREFIX: null,
|
||||
BOUNDARY_SUFFIX: null,
|
||||
BUILTIN_PREFIX: null,
|
||||
getBoundaryOriginFileType: null,
|
||||
getConventionPathByType: null,
|
||||
isBoundaryFile: null,
|
||||
isBuiltinBoundaryFile: null,
|
||||
isNextjsBuiltinFilePath: null,
|
||||
normalizeBoundaryFilename: null,
|
||||
normalizeConventionFilePath: null,
|
||||
normalizeFilePath: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
BOUNDARY_PREFIX: function() {
|
||||
return BOUNDARY_PREFIX;
|
||||
},
|
||||
BOUNDARY_SUFFIX: function() {
|
||||
return BOUNDARY_SUFFIX;
|
||||
},
|
||||
BUILTIN_PREFIX: function() {
|
||||
return BUILTIN_PREFIX;
|
||||
},
|
||||
getBoundaryOriginFileType: function() {
|
||||
return getBoundaryOriginFileType;
|
||||
},
|
||||
getConventionPathByType: function() {
|
||||
return getConventionPathByType;
|
||||
},
|
||||
isBoundaryFile: function() {
|
||||
return isBoundaryFile;
|
||||
},
|
||||
isBuiltinBoundaryFile: function() {
|
||||
return isBuiltinBoundaryFile;
|
||||
},
|
||||
isNextjsBuiltinFilePath: function() {
|
||||
return isNextjsBuiltinFilePath;
|
||||
},
|
||||
normalizeBoundaryFilename: function() {
|
||||
return normalizeBoundaryFilename;
|
||||
},
|
||||
normalizeConventionFilePath: function() {
|
||||
return normalizeConventionFilePath;
|
||||
},
|
||||
normalizeFilePath: function() {
|
||||
return normalizeFilePath;
|
||||
}
|
||||
});
|
||||
const BUILTIN_PREFIX = '__next_builtin__';
|
||||
const nextInternalPrefixRegex = /^(.*[\\/])?next[\\/]dist[\\/]client[\\/]components[\\/]builtin[\\/]/;
|
||||
function normalizeFilePath(projectDir, filePath) {
|
||||
// Turbopack project path is formed as: "<project root>/<cwd>".
|
||||
// When project root is not the working directory, we can extract the relative project root path.
|
||||
// This is mostly used for running Next.js inside a monorepo.
|
||||
const cwd = process.env.NEXT_RUNTIME === 'edge' ? '' : process.cwd();
|
||||
const relativeProjectRoot = projectDir.replace(cwd, '').replace(/^[\\/]/, '');
|
||||
let relativePath = (filePath || '')// remove turbopack [project] prefix
|
||||
.replace(/^\[project\][\\/]?/, '')// remove the project root from the path (absolute)
|
||||
.replace(projectDir, '')// remove cwd prefix (absolute)
|
||||
.replace(cwd, '')// normalize path separators and remove leading slash
|
||||
.replace(/\\/g, '/').replace(/^\//, '');
|
||||
// remove relative project path prefix (e.g., "test/e2e/app-dir/actions/")
|
||||
if (relativeProjectRoot && relativePath.startsWith(relativeProjectRoot)) {
|
||||
relativePath = relativePath.slice(relativeProjectRoot.length).replace(/^\//, '');
|
||||
}
|
||||
// Handle case where filename is relative to a parent of projectDir
|
||||
// (e.g., in tests where filename is "test/tmp/next-test-XXX/app/page.js"
|
||||
// but projectDir is the test temp directory)
|
||||
if (relativePath.includes('/')) {
|
||||
const projectDirName = projectDir.split(/[\\/]/).pop() || '';
|
||||
if (projectDirName) {
|
||||
const projectDirWithSlash = projectDirName + '/';
|
||||
const idx = relativePath.indexOf(projectDirWithSlash);
|
||||
if (idx >= 0) {
|
||||
relativePath = relativePath.slice(idx + projectDirWithSlash.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
return relativePath;
|
||||
}
|
||||
function normalizeConventionFilePath(projectDir, conventionPath) {
|
||||
let relativePath = normalizeFilePath(projectDir, conventionPath)// remove /(src/)?app/ dir prefix
|
||||
.replace(/^(src\/)?app\//, '');
|
||||
// If it's internal file only keep the filename, strip nextjs internal prefix
|
||||
if (nextInternalPrefixRegex.test(relativePath)) {
|
||||
relativePath = relativePath.replace(nextInternalPrefixRegex, '');
|
||||
// Add a special prefix to let segment explorer know it's a built-in component
|
||||
relativePath = `${BUILTIN_PREFIX}${relativePath}`;
|
||||
}
|
||||
return relativePath;
|
||||
}
|
||||
const isNextjsBuiltinFilePath = (filePath)=>{
|
||||
return nextInternalPrefixRegex.test(filePath);
|
||||
};
|
||||
const BOUNDARY_SUFFIX = '@boundary';
|
||||
function normalizeBoundaryFilename(filename) {
|
||||
return filename.replace(new RegExp(`^${BUILTIN_PREFIX}`), '').replace(new RegExp(`${BOUNDARY_SUFFIX}$`), '');
|
||||
}
|
||||
const BOUNDARY_PREFIX = 'boundary:';
|
||||
function isBoundaryFile(fileType) {
|
||||
return fileType.startsWith(BOUNDARY_PREFIX);
|
||||
}
|
||||
function isBuiltinBoundaryFile(fileType) {
|
||||
return fileType.startsWith(BUILTIN_PREFIX);
|
||||
}
|
||||
function getBoundaryOriginFileType(fileType) {
|
||||
return fileType.replace(BOUNDARY_PREFIX, '');
|
||||
}
|
||||
function getConventionPathByType(tree, dir, conventionType) {
|
||||
const modules = tree[2];
|
||||
const conventionPath = modules[conventionType] ? modules[conventionType][1] : undefined;
|
||||
if (conventionPath) {
|
||||
return normalizeConventionFilePath(dir, conventionPath);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=segment-explorer-path.js.map
|
||||
77
build/node_modules/next/dist/server/app-render/server-inserted-html.js
generated
vendored
Normal file
77
build/node_modules/next/dist/server/app-render/server-inserted-html.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/* eslint-disable @next/internal/no-ambiguous-jsx -- whole module is used in React Client */ // Provider for the `useServerInsertedHTML` API to register callbacks to insert
|
||||
// elements into the HTML stream.
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "createServerInsertedHTML", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return createServerInsertedHTML;
|
||||
}
|
||||
});
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
||||
const _serverinsertedhtmlsharedruntime = require("../../shared/lib/server-inserted-html.shared-runtime");
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== "function") return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function(nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interop_require_wildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
||||
return {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {
|
||||
__proto__: null
|
||||
};
|
||||
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for(var key in obj){
|
||||
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
function createServerInsertedHTML() {
|
||||
const serverInsertedHTMLCallbacks = [];
|
||||
const addInsertedHtml = (handler)=>{
|
||||
serverInsertedHTMLCallbacks.push(handler);
|
||||
};
|
||||
return {
|
||||
ServerInsertedHTMLProvider ({ children }) {
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_serverinsertedhtmlsharedruntime.ServerInsertedHTMLContext.Provider, {
|
||||
value: addInsertedHtml,
|
||||
children: children
|
||||
});
|
||||
},
|
||||
renderServerInsertedHTML () {
|
||||
return serverInsertedHTMLCallbacks.map((callback, index)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_react.Fragment, {
|
||||
children: callback()
|
||||
}, '__next_server_inserted__' + index));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=server-inserted-html.js.map
|
||||
343
build/node_modules/next/dist/server/app-render/staged-rendering.js
generated
vendored
Normal file
343
build/node_modules/next/dist/server/app-render/staged-rendering.js
generated
vendored
Normal file
@@ -0,0 +1,343 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
RenderStage: null,
|
||||
StagedRenderingController: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
RenderStage: function() {
|
||||
return RenderStage;
|
||||
},
|
||||
StagedRenderingController: function() {
|
||||
return StagedRenderingController;
|
||||
}
|
||||
});
|
||||
const _invarianterror = require("../../shared/lib/invariant-error");
|
||||
const _promisewithresolvers = require("../../shared/lib/promise-with-resolvers");
|
||||
var RenderStage = /*#__PURE__*/ function(RenderStage) {
|
||||
RenderStage[RenderStage["Before"] = 1] = "Before";
|
||||
RenderStage[RenderStage["EarlyStatic"] = 2] = "EarlyStatic";
|
||||
RenderStage[RenderStage["Static"] = 3] = "Static";
|
||||
RenderStage[RenderStage["EarlyRuntime"] = 4] = "EarlyRuntime";
|
||||
RenderStage[RenderStage["Runtime"] = 5] = "Runtime";
|
||||
RenderStage[RenderStage["Dynamic"] = 6] = "Dynamic";
|
||||
RenderStage[RenderStage["Abandoned"] = 7] = "Abandoned";
|
||||
return RenderStage;
|
||||
}({});
|
||||
class StagedRenderingController {
|
||||
constructor(abortSignal, abandonController, shouldTrackSyncIO){
|
||||
this.abortSignal = abortSignal;
|
||||
this.abandonController = abandonController;
|
||||
this.shouldTrackSyncIO = shouldTrackSyncIO;
|
||||
this.currentStage = 1;
|
||||
this.syncInterruptReason = null;
|
||||
this.staticStageEndTime = Infinity;
|
||||
this.runtimeStageEndTime = Infinity;
|
||||
this.staticStageListeners = [];
|
||||
this.earlyRuntimeStageListeners = [];
|
||||
this.runtimeStageListeners = [];
|
||||
this.dynamicStageListeners = [];
|
||||
this.staticStagePromise = (0, _promisewithresolvers.createPromiseWithResolvers)();
|
||||
this.earlyRuntimeStagePromise = (0, _promisewithresolvers.createPromiseWithResolvers)();
|
||||
this.runtimeStagePromise = (0, _promisewithresolvers.createPromiseWithResolvers)();
|
||||
this.dynamicStagePromise = (0, _promisewithresolvers.createPromiseWithResolvers)();
|
||||
if (abortSignal) {
|
||||
abortSignal.addEventListener('abort', ()=>{
|
||||
// Reject all stage promises that haven't already been resolved.
|
||||
// If a promise was already resolved via advanceStage, the reject
|
||||
// is a no-op. The ignoreReject handler suppresses unhandled
|
||||
// rejection warnings for promises that no one is awaiting.
|
||||
const { reason } = abortSignal;
|
||||
this.staticStagePromise.promise.catch(ignoreReject);
|
||||
this.staticStagePromise.reject(reason);
|
||||
this.earlyRuntimeStagePromise.promise.catch(ignoreReject);
|
||||
this.earlyRuntimeStagePromise.reject(reason);
|
||||
this.runtimeStagePromise.promise.catch(ignoreReject);
|
||||
this.runtimeStagePromise.reject(reason);
|
||||
this.dynamicStagePromise.promise.catch(ignoreReject);
|
||||
this.dynamicStagePromise.reject(reason);
|
||||
}, {
|
||||
once: true
|
||||
});
|
||||
}
|
||||
if (abandonController) {
|
||||
abandonController.signal.addEventListener('abort', ()=>{
|
||||
this.abandonRender();
|
||||
}, {
|
||||
once: true
|
||||
});
|
||||
}
|
||||
}
|
||||
onStage(stage, callback) {
|
||||
if (this.currentStage >= stage) {
|
||||
callback();
|
||||
} else if (stage === 3) {
|
||||
this.staticStageListeners.push(callback);
|
||||
} else if (stage === 4) {
|
||||
this.earlyRuntimeStageListeners.push(callback);
|
||||
} else if (stage === 5) {
|
||||
this.runtimeStageListeners.push(callback);
|
||||
} else if (stage === 6) {
|
||||
this.dynamicStageListeners.push(callback);
|
||||
} else {
|
||||
// This should never happen
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError(`Invalid render stage: ${stage}`), "__NEXT_ERROR_CODE", {
|
||||
value: "E881",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
shouldTrackSyncInterrupt() {
|
||||
if (!this.shouldTrackSyncIO) {
|
||||
return false;
|
||||
}
|
||||
switch(this.currentStage){
|
||||
case 1:
|
||||
// If we haven't started the render yet, it can't be interrupted.
|
||||
return false;
|
||||
case 2:
|
||||
case 3:
|
||||
return true;
|
||||
case 4:
|
||||
// EarlyRuntime is for runtime-prefetchable segments. Sync IO
|
||||
// should error because it would abort a runtime prefetch.
|
||||
return true;
|
||||
case 5:
|
||||
// Runtime is for non-prefetchable segments. Sync IO is fine there
|
||||
// because in practice this segment will never be runtime prefetched
|
||||
return false;
|
||||
case 6:
|
||||
case 7:
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
syncInterruptCurrentStageWithReason(reason) {
|
||||
if (this.currentStage === 1) {
|
||||
return;
|
||||
}
|
||||
// If the render has already been abandoned, there's nothing to interrupt.
|
||||
if (this.currentStage === 7) {
|
||||
return;
|
||||
}
|
||||
// If Sync IO occurs during an abandonable render, we trigger the abandon.
|
||||
// The abandon listener will call abandonRender which advances through
|
||||
// stages to let caches fill before marking as Abandoned.
|
||||
if (this.abandonController) {
|
||||
this.abandonController.abort();
|
||||
return;
|
||||
}
|
||||
if (this.abortSignal) {
|
||||
// If this is an abortable render, we capture the interruption reason and stop advancing.
|
||||
// We don't release any more promises.
|
||||
// The caller is expected to abort the signal.
|
||||
this.syncInterruptReason = reason;
|
||||
this.currentStage = 7;
|
||||
return;
|
||||
}
|
||||
// If we're in a non-abandonable & non-abortable render,
|
||||
// we need to advance to the Dynamic stage and capture the interruption reason.
|
||||
// (in dev, this will be the restarted render)
|
||||
switch(this.currentStage){
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
{
|
||||
// EarlyRuntime is for runtime-prefetchable segments. Sync IO here
|
||||
// means the prefetch would be aborted too early.
|
||||
this.syncInterruptReason = reason;
|
||||
this.advanceStage(6);
|
||||
return;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
// canSyncInterrupt returns false for Runtime, so we should
|
||||
// never get here. Defensive no-op.
|
||||
return;
|
||||
}
|
||||
case 6:
|
||||
default:
|
||||
}
|
||||
}
|
||||
getSyncInterruptReason() {
|
||||
return this.syncInterruptReason;
|
||||
}
|
||||
getStaticStageEndTime() {
|
||||
return this.staticStageEndTime;
|
||||
}
|
||||
getRuntimeStageEndTime() {
|
||||
return this.runtimeStageEndTime;
|
||||
}
|
||||
abandonRender() {
|
||||
// In staged rendering, only the initial render is abandonable.
|
||||
// We can abandon the initial render if
|
||||
// 1. We notice a cache miss, and need to wait for caches to fill
|
||||
// 2. A sync IO error occurs, and the render should be interrupted
|
||||
// (this might be a lazy intitialization of a module,
|
||||
// so we still want to restart in this case and see if it still occurs)
|
||||
// In either case, we'll be doing another render after this one,
|
||||
// so we only want to unblock the next stage, not Dynamic, because
|
||||
// unblocking the dynamic stage would likely lead to wasted (uncached) IO.
|
||||
const { currentStage } = this;
|
||||
switch(currentStage){
|
||||
case 2:
|
||||
{
|
||||
this.resolveStaticStage();
|
||||
}
|
||||
// intentional fallthrough
|
||||
case 3:
|
||||
{
|
||||
this.resolveEarlyRuntimeStage();
|
||||
}
|
||||
// intentional fallthrough
|
||||
case 4:
|
||||
{
|
||||
this.resolveRuntimeStage();
|
||||
}
|
||||
// intentional fallthrough
|
||||
case 5:
|
||||
{
|
||||
this.currentStage = 7;
|
||||
return;
|
||||
}
|
||||
case 6:
|
||||
case 1:
|
||||
case 7:
|
||||
break;
|
||||
default:
|
||||
{
|
||||
currentStage;
|
||||
}
|
||||
}
|
||||
}
|
||||
advanceStage(stage) {
|
||||
// If we're already at the target stage or beyond, do nothing.
|
||||
// (this can happen e.g. if sync IO advanced us to the dynamic stage)
|
||||
if (stage <= this.currentStage) {
|
||||
return;
|
||||
}
|
||||
let currentStage = this.currentStage;
|
||||
this.currentStage = stage;
|
||||
if (currentStage < 3 && stage >= 3) {
|
||||
this.resolveStaticStage();
|
||||
}
|
||||
if (currentStage < 4 && stage >= 4) {
|
||||
this.resolveEarlyRuntimeStage();
|
||||
}
|
||||
if (currentStage < 5 && stage >= 5) {
|
||||
this.staticStageEndTime = performance.now() + performance.timeOrigin;
|
||||
this.resolveRuntimeStage();
|
||||
}
|
||||
if (currentStage < 6 && stage >= 6) {
|
||||
this.runtimeStageEndTime = performance.now() + performance.timeOrigin;
|
||||
this.resolveDynamicStage();
|
||||
return;
|
||||
}
|
||||
}
|
||||
/** Fire the `onStage` listeners for the static stage and unblock any promises waiting for it. */ resolveStaticStage() {
|
||||
const staticListeners = this.staticStageListeners;
|
||||
for(let i = 0; i < staticListeners.length; i++){
|
||||
staticListeners[i]();
|
||||
}
|
||||
staticListeners.length = 0;
|
||||
this.staticStagePromise.resolve();
|
||||
}
|
||||
/** Fire the `onStage` listeners for the early runtime stage and unblock any promises waiting for it. */ resolveEarlyRuntimeStage() {
|
||||
const earlyRuntimeListeners = this.earlyRuntimeStageListeners;
|
||||
for(let i = 0; i < earlyRuntimeListeners.length; i++){
|
||||
earlyRuntimeListeners[i]();
|
||||
}
|
||||
earlyRuntimeListeners.length = 0;
|
||||
this.earlyRuntimeStagePromise.resolve();
|
||||
}
|
||||
/** Fire the `onStage` listeners for the runtime stage and unblock any promises waiting for it. */ resolveRuntimeStage() {
|
||||
const runtimeListeners = this.runtimeStageListeners;
|
||||
for(let i = 0; i < runtimeListeners.length; i++){
|
||||
runtimeListeners[i]();
|
||||
}
|
||||
runtimeListeners.length = 0;
|
||||
this.runtimeStagePromise.resolve();
|
||||
}
|
||||
/** Fire the `onStage` listeners for the dynamic stage and unblock any promises waiting for it. */ resolveDynamicStage() {
|
||||
const dynamicListeners = this.dynamicStageListeners;
|
||||
for(let i = 0; i < dynamicListeners.length; i++){
|
||||
dynamicListeners[i]();
|
||||
}
|
||||
dynamicListeners.length = 0;
|
||||
this.dynamicStagePromise.resolve();
|
||||
}
|
||||
getStagePromise(stage) {
|
||||
switch(stage){
|
||||
case 3:
|
||||
{
|
||||
return this.staticStagePromise.promise;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
return this.earlyRuntimeStagePromise.promise;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
return this.runtimeStagePromise.promise;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
return this.dynamicStagePromise.promise;
|
||||
}
|
||||
default:
|
||||
{
|
||||
stage;
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError(`Invalid render stage: ${stage}`), "__NEXT_ERROR_CODE", {
|
||||
value: "E881",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
waitForStage(stage) {
|
||||
return this.getStagePromise(stage);
|
||||
}
|
||||
delayUntilStage(stage, displayName, resolvedValue) {
|
||||
const ioTriggerPromise = this.getStagePromise(stage);
|
||||
const promise = makeDevtoolsIOPromiseFromIOTrigger(ioTriggerPromise, displayName, resolvedValue);
|
||||
// Analogously to `makeHangingPromise`, we might reject this promise if the signal is invoked.
|
||||
// (e.g. in the case where we don't want want the render to proceed to the dynamic stage and abort it).
|
||||
// We shouldn't consider this an unhandled rejection, so we attach a noop catch handler here to suppress this warning.
|
||||
if (this.abortSignal) {
|
||||
promise.catch(ignoreReject);
|
||||
}
|
||||
return promise;
|
||||
}
|
||||
}
|
||||
function ignoreReject() {}
|
||||
// TODO(restart-on-cache-miss): the layering of `delayUntilStage`,
|
||||
// `makeDevtoolsIOPromiseFromIOTrigger` and and `makeDevtoolsIOAwarePromise`
|
||||
// is confusing, we should clean it up.
|
||||
function makeDevtoolsIOPromiseFromIOTrigger(ioTrigger, displayName, resolvedValue) {
|
||||
// If we create a `new Promise` and give it a displayName
|
||||
// (with no userspace code above us in the stack)
|
||||
// React Devtools will use it as the IO cause when determining "suspended by".
|
||||
// In particular, it should shadow any inner IO that resolved/rejected the promise
|
||||
// (in case of staged rendering, this will be the `setTimeout` that triggers the relevant stage)
|
||||
const promise = new Promise((resolve, reject)=>{
|
||||
ioTrigger.then(resolve.bind(null, resolvedValue), reject);
|
||||
});
|
||||
if (displayName !== undefined) {
|
||||
// @ts-expect-error
|
||||
promise.displayName = displayName;
|
||||
}
|
||||
return promise;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=staged-rendering.js.map
|
||||
111
build/node_modules/next/dist/server/app-render/stale-time.js
generated
vendored
Normal file
111
build/node_modules/next/dist/server/app-render/stale-time.js
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
StaleTimeIterable: null,
|
||||
createSelectStaleTime: null,
|
||||
finishStaleTimeTracking: null,
|
||||
trackStaleTime: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
StaleTimeIterable: function() {
|
||||
return StaleTimeIterable;
|
||||
},
|
||||
createSelectStaleTime: function() {
|
||||
return createSelectStaleTime;
|
||||
},
|
||||
finishStaleTimeTracking: function() {
|
||||
return finishStaleTimeTracking;
|
||||
},
|
||||
trackStaleTime: function() {
|
||||
return trackStaleTime;
|
||||
}
|
||||
});
|
||||
const _constants = require("../../lib/constants");
|
||||
class StaleTimeIterable {
|
||||
update(value) {
|
||||
if (this._done) return;
|
||||
this.currentValue = value;
|
||||
if (this._resolve) {
|
||||
this._resolve({
|
||||
value,
|
||||
done: false
|
||||
});
|
||||
this._resolve = null;
|
||||
} else {
|
||||
this._buffer.push(value);
|
||||
}
|
||||
}
|
||||
close() {
|
||||
if (this._done) return;
|
||||
this._done = true;
|
||||
if (this._resolve) {
|
||||
this._resolve({
|
||||
value: undefined,
|
||||
done: true
|
||||
});
|
||||
this._resolve = null;
|
||||
}
|
||||
}
|
||||
[Symbol.asyncIterator]() {
|
||||
return {
|
||||
next: ()=>{
|
||||
if (this._buffer.length > 0) {
|
||||
return Promise.resolve({
|
||||
value: this._buffer.shift(),
|
||||
done: false
|
||||
});
|
||||
}
|
||||
if (this._done) {
|
||||
return Promise.resolve({
|
||||
value: undefined,
|
||||
done: true
|
||||
});
|
||||
}
|
||||
return new Promise((resolve)=>{
|
||||
this._resolve = resolve;
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
constructor(){
|
||||
this._resolve = null;
|
||||
this._done = false;
|
||||
this._buffer = [];
|
||||
/** The last value passed to `update()`. */ this.currentValue = 0;
|
||||
}
|
||||
}
|
||||
function createSelectStaleTime(experimental) {
|
||||
return (stale)=>{
|
||||
var _experimental_staleTimes;
|
||||
return stale === _constants.INFINITE_CACHE && typeof ((_experimental_staleTimes = experimental.staleTimes) == null ? void 0 : _experimental_staleTimes.static) === 'number' ? experimental.staleTimes.static : stale;
|
||||
};
|
||||
}
|
||||
function trackStaleTime(store, iterable, selectStaleTime) {
|
||||
let _stale = store.stale;
|
||||
iterable.update(selectStaleTime(_stale));
|
||||
Object.defineProperty(store, 'stale', {
|
||||
get: ()=>_stale,
|
||||
set: (value)=>{
|
||||
_stale = value;
|
||||
iterable.update(selectStaleTime(value));
|
||||
},
|
||||
configurable: true,
|
||||
enumerable: true
|
||||
});
|
||||
}
|
||||
async function finishStaleTimeTracking(iterable) {
|
||||
iterable.close();
|
||||
await Promise.resolve();
|
||||
await Promise.resolve();
|
||||
await Promise.resolve();
|
||||
}
|
||||
|
||||
//# sourceMappingURL=stale-time.js.map
|
||||
106
build/node_modules/next/dist/server/app-render/stream-ops.js
generated
vendored
Normal file
106
build/node_modules/next/dist/server/app-render/stream-ops.js
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
* Compile-time switcher for stream operations.
|
||||
*
|
||||
* PR2: Simple re-export from the web implementation.
|
||||
* A future change will add a conditional branch for node streams.
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
chainStreams: null,
|
||||
continueDynamicHTMLResume: null,
|
||||
continueDynamicPrerender: null,
|
||||
continueFizzStream: null,
|
||||
continueStaticFallbackPrerender: null,
|
||||
continueStaticPrerender: null,
|
||||
createDocumentClosingStream: null,
|
||||
createInlinedDataStream: null,
|
||||
createOnHeadersCallback: null,
|
||||
createPendingStream: null,
|
||||
getClientPrerender: null,
|
||||
getServerPrerender: null,
|
||||
nodeReadableToWeb: null,
|
||||
pipeRuntimePrefetchTransform: null,
|
||||
processPrelude: null,
|
||||
renderToFizzStream: null,
|
||||
renderToFlightStream: null,
|
||||
resumeAndAbort: null,
|
||||
resumeToFizzStream: null,
|
||||
streamToBuffer: null,
|
||||
streamToString: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
chainStreams: function() {
|
||||
return _streamopsweb.chainStreams;
|
||||
},
|
||||
continueDynamicHTMLResume: function() {
|
||||
return _streamopsweb.continueDynamicHTMLResume;
|
||||
},
|
||||
continueDynamicPrerender: function() {
|
||||
return _streamopsweb.continueDynamicPrerender;
|
||||
},
|
||||
continueFizzStream: function() {
|
||||
return _streamopsweb.continueFizzStream;
|
||||
},
|
||||
continueStaticFallbackPrerender: function() {
|
||||
return _streamopsweb.continueStaticFallbackPrerender;
|
||||
},
|
||||
continueStaticPrerender: function() {
|
||||
return _streamopsweb.continueStaticPrerender;
|
||||
},
|
||||
createDocumentClosingStream: function() {
|
||||
return _streamopsweb.createDocumentClosingStream;
|
||||
},
|
||||
createInlinedDataStream: function() {
|
||||
return _streamopsweb.createInlinedDataStream;
|
||||
},
|
||||
createOnHeadersCallback: function() {
|
||||
return _streamopsweb.createOnHeadersCallback;
|
||||
},
|
||||
createPendingStream: function() {
|
||||
return _streamopsweb.createPendingStream;
|
||||
},
|
||||
getClientPrerender: function() {
|
||||
return _streamopsweb.getClientPrerender;
|
||||
},
|
||||
getServerPrerender: function() {
|
||||
return _streamopsweb.getServerPrerender;
|
||||
},
|
||||
nodeReadableToWeb: function() {
|
||||
return _streamopsweb.nodeReadableToWeb;
|
||||
},
|
||||
pipeRuntimePrefetchTransform: function() {
|
||||
return _streamopsweb.pipeRuntimePrefetchTransform;
|
||||
},
|
||||
processPrelude: function() {
|
||||
return _streamopsweb.processPrelude;
|
||||
},
|
||||
renderToFizzStream: function() {
|
||||
return _streamopsweb.renderToFizzStream;
|
||||
},
|
||||
renderToFlightStream: function() {
|
||||
return _streamopsweb.renderToFlightStream;
|
||||
},
|
||||
resumeAndAbort: function() {
|
||||
return _streamopsweb.resumeAndAbort;
|
||||
},
|
||||
resumeToFizzStream: function() {
|
||||
return _streamopsweb.resumeToFizzStream;
|
||||
},
|
||||
streamToBuffer: function() {
|
||||
return _streamopsweb.streamToBuffer;
|
||||
},
|
||||
streamToString: function() {
|
||||
return _streamopsweb.streamToString;
|
||||
}
|
||||
});
|
||||
const _streamopsweb = require("./stream-ops.web");
|
||||
|
||||
//# sourceMappingURL=stream-ops.js.map
|
||||
163
build/node_modules/next/dist/server/app-render/stream-ops.web.js
generated
vendored
Normal file
163
build/node_modules/next/dist/server/app-render/stream-ops.web.js
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
/**
|
||||
* Web stream operations for the rendering pipeline.
|
||||
* Loaded by stream-ops.ts (re-export in this PR, conditional switcher later).
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
chainStreams: null,
|
||||
continueDynamicHTMLResume: null,
|
||||
continueDynamicPrerender: null,
|
||||
continueFizzStream: null,
|
||||
continueStaticFallbackPrerender: null,
|
||||
continueStaticPrerender: null,
|
||||
createDocumentClosingStream: null,
|
||||
createInlinedDataStream: null,
|
||||
createOnHeadersCallback: null,
|
||||
createPendingStream: null,
|
||||
getClientPrerender: null,
|
||||
getServerPrerender: null,
|
||||
nodeReadableToWeb: null,
|
||||
pipeRuntimePrefetchTransform: null,
|
||||
processPrelude: null,
|
||||
renderToFizzStream: null,
|
||||
renderToFlightStream: null,
|
||||
resumeAndAbort: null,
|
||||
resumeToFizzStream: null,
|
||||
streamToBuffer: null,
|
||||
streamToString: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
chainStreams: function() {
|
||||
return _nodewebstreamshelper.chainStreams;
|
||||
},
|
||||
continueDynamicHTMLResume: function() {
|
||||
return _nodewebstreamshelper.continueDynamicHTMLResume;
|
||||
},
|
||||
continueDynamicPrerender: function() {
|
||||
return _nodewebstreamshelper.continueDynamicPrerender;
|
||||
},
|
||||
continueFizzStream: function() {
|
||||
return continueFizzStream;
|
||||
},
|
||||
continueStaticFallbackPrerender: function() {
|
||||
return _nodewebstreamshelper.continueStaticFallbackPrerender;
|
||||
},
|
||||
continueStaticPrerender: function() {
|
||||
return _nodewebstreamshelper.continueStaticPrerender;
|
||||
},
|
||||
createDocumentClosingStream: function() {
|
||||
return _nodewebstreamshelper.createDocumentClosingStream;
|
||||
},
|
||||
createInlinedDataStream: function() {
|
||||
return createInlinedDataStream;
|
||||
},
|
||||
createOnHeadersCallback: function() {
|
||||
return createOnHeadersCallback;
|
||||
},
|
||||
createPendingStream: function() {
|
||||
return createPendingStream;
|
||||
},
|
||||
getClientPrerender: function() {
|
||||
return getClientPrerender;
|
||||
},
|
||||
getServerPrerender: function() {
|
||||
return getServerPrerender;
|
||||
},
|
||||
nodeReadableToWeb: function() {
|
||||
return nodeReadableToWeb;
|
||||
},
|
||||
pipeRuntimePrefetchTransform: function() {
|
||||
return pipeRuntimePrefetchTransform;
|
||||
},
|
||||
processPrelude: function() {
|
||||
return _apprenderprerenderutils.processPrelude;
|
||||
},
|
||||
renderToFizzStream: function() {
|
||||
return renderToFizzStream;
|
||||
},
|
||||
renderToFlightStream: function() {
|
||||
return renderToFlightStream;
|
||||
},
|
||||
resumeAndAbort: function() {
|
||||
return resumeAndAbort;
|
||||
},
|
||||
resumeToFizzStream: function() {
|
||||
return resumeToFizzStream;
|
||||
},
|
||||
streamToBuffer: function() {
|
||||
return _nodewebstreamshelper.streamToBuffer;
|
||||
},
|
||||
streamToString: function() {
|
||||
return streamToString;
|
||||
}
|
||||
});
|
||||
const _server = require("react-dom/server");
|
||||
const _static = require("react-dom/static");
|
||||
const _nodewebstreamshelper = require("../stream-utils/node-web-streams-helper");
|
||||
const _useflightresponse = require("./use-flight-response");
|
||||
const _apprenderprerenderutils = require("./app-render-prerender-utils");
|
||||
function continueFizzStream(renderStream, opts) {
|
||||
return (0, _nodewebstreamshelper.continueFizzStream)(renderStream, opts);
|
||||
}
|
||||
const nodeReadableToWeb = undefined;
|
||||
function createInlinedDataStream(source, nonce, formState) {
|
||||
return (0, _useflightresponse.createInlinedDataReadableStream)(source, nonce, formState);
|
||||
}
|
||||
function createPendingStream() {
|
||||
return new ReadableStream();
|
||||
}
|
||||
function createOnHeadersCallback(appendHeader) {
|
||||
return (headers)=>{
|
||||
headers.forEach((value, key)=>{
|
||||
appendHeader(key, value);
|
||||
});
|
||||
};
|
||||
}
|
||||
async function resumeAndAbort(element, postponed, opts) {
|
||||
return (0, _server.resume)(element, postponed, opts);
|
||||
}
|
||||
function renderToFlightStream(ComponentMod, payload, clientModules, opts) {
|
||||
return ComponentMod.renderToReadableStream(payload, clientModules, opts);
|
||||
}
|
||||
async function streamToString(stream) {
|
||||
return (0, _nodewebstreamshelper.streamToString)(stream);
|
||||
}
|
||||
async function renderToFizzStream(element, streamOptions) {
|
||||
const stream = await (0, _nodewebstreamshelper.renderToInitialFizzStream)({
|
||||
ReactDOMServer: {
|
||||
renderToReadableStream: _server.renderToReadableStream
|
||||
},
|
||||
element,
|
||||
streamOptions
|
||||
});
|
||||
return {
|
||||
stream,
|
||||
allReady: stream.allReady,
|
||||
abort: undefined
|
||||
};
|
||||
}
|
||||
async function resumeToFizzStream(element, postponedState, streamOptions) {
|
||||
const stream = await (0, _server.resume)(element, postponedState, streamOptions);
|
||||
return {
|
||||
stream,
|
||||
allReady: stream.allReady,
|
||||
abort: undefined
|
||||
};
|
||||
}
|
||||
function getServerPrerender(ComponentMod) {
|
||||
return ComponentMod.prerender;
|
||||
}
|
||||
const getClientPrerender = _static.prerender;
|
||||
function pipeRuntimePrefetchTransform(stream, sentinel, isPartial, staleTime) {
|
||||
return stream.pipeThrough((0, _nodewebstreamshelper.createRuntimePrefetchTransformStream)(sentinel, isPartial, staleTime));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=stream-ops.web.js.map
|
||||
18
build/node_modules/next/dist/server/app-render/strip-flight-headers.js
generated
vendored
Normal file
18
build/node_modules/next/dist/server/app-render/strip-flight-headers.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "stripFlightHeaders", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return stripFlightHeaders;
|
||||
}
|
||||
});
|
||||
const _approuterheaders = require("../../client/components/app-router-headers");
|
||||
function stripFlightHeaders(headers) {
|
||||
for (const header of _approuterheaders.FLIGHT_HEADERS){
|
||||
delete headers[header];
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=strip-flight-headers.js.map
|
||||
65
build/node_modules/next/dist/server/app-render/types.js
generated
vendored
Normal file
65
build/node_modules/next/dist/server/app-render/types.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "flightRouterStateSchema", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return flightRouterStateSchema;
|
||||
}
|
||||
});
|
||||
const _superstruct = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/superstruct"));
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
const dynamicParamTypesSchema = _superstruct.default.enums([
|
||||
'c',
|
||||
'ci(..)(..)',
|
||||
'ci(.)',
|
||||
'ci(..)',
|
||||
'ci(...)',
|
||||
'oc',
|
||||
'd',
|
||||
'di(..)(..)',
|
||||
'di(.)',
|
||||
'di(..)',
|
||||
'di(...)'
|
||||
]);
|
||||
const segmentSchema = _superstruct.default.union([
|
||||
_superstruct.default.string(),
|
||||
_superstruct.default.tuple([
|
||||
// Param name
|
||||
_superstruct.default.string(),
|
||||
// Param cache key (almost the same as the value, but arrays are
|
||||
// concatenated into strings)
|
||||
// TODO: We should change this to just be the value. Currently we convert
|
||||
// it back to a value when passing to useParams. It only needs to be
|
||||
// a string when converted to a a cache key, but that doesn't mean we
|
||||
// need to store it as that representation.
|
||||
_superstruct.default.string(),
|
||||
// Dynamic param type
|
||||
dynamicParamTypesSchema,
|
||||
// Static siblings at the same URL level. Used by the client router to
|
||||
// determine if a prefetch can be reused when navigating to a static
|
||||
// sibling of a dynamic route. null means siblings are unknown.
|
||||
_superstruct.default.nullable(_superstruct.default.array(_superstruct.default.string()))
|
||||
])
|
||||
]);
|
||||
const flightRouterStateSchema = _superstruct.default.tuple([
|
||||
segmentSchema,
|
||||
_superstruct.default.record(_superstruct.default.string(), _superstruct.default.lazy(()=>flightRouterStateSchema)),
|
||||
_superstruct.default.optional(_superstruct.default.nullable(_superstruct.default.tuple([
|
||||
_superstruct.default.string(),
|
||||
_superstruct.default.string()
|
||||
]))),
|
||||
_superstruct.default.optional(_superstruct.default.nullable(_superstruct.default.union([
|
||||
_superstruct.default.literal('refetch'),
|
||||
_superstruct.default.literal('inside-shared-layout'),
|
||||
_superstruct.default.literal('metadata-only')
|
||||
]))),
|
||||
_superstruct.default.optional(_superstruct.default.number())
|
||||
]);
|
||||
|
||||
//# sourceMappingURL=types.js.map
|
||||
214
build/node_modules/next/dist/server/app-render/use-flight-response.js
generated
vendored
Normal file
214
build/node_modules/next/dist/server/app-render/use-flight-response.js
generated
vendored
Normal file
@@ -0,0 +1,214 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
createInlinedDataReadableStream: null,
|
||||
getFlightStream: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
createInlinedDataReadableStream: function() {
|
||||
return createInlinedDataReadableStream;
|
||||
},
|
||||
getFlightStream: function() {
|
||||
return getFlightStream;
|
||||
}
|
||||
});
|
||||
const _htmlescape = require("../../shared/lib/htmlescape");
|
||||
const _workunitasyncstorageexternal = require("./work-unit-async-storage.external");
|
||||
const _invarianterror = require("../../shared/lib/invariant-error");
|
||||
const _manifestssingleton = require("./manifests-singleton");
|
||||
const isEdgeRuntime = process.env.NEXT_RUNTIME === 'edge';
|
||||
const INLINE_FLIGHT_PAYLOAD_BOOTSTRAP = 0;
|
||||
const INLINE_FLIGHT_PAYLOAD_DATA = 1;
|
||||
const INLINE_FLIGHT_PAYLOAD_FORM_STATE = 2;
|
||||
const INLINE_FLIGHT_PAYLOAD_BINARY = 3;
|
||||
const flightResponses = new WeakMap();
|
||||
const encoder = new TextEncoder();
|
||||
const findSourceMapURL = process.env.NODE_ENV !== 'production' ? require('../lib/source-maps').findSourceMapURLDEV : undefined;
|
||||
function getFlightStream(flightStream, debugStream, debugEndTime, nonce) {
|
||||
const response = flightResponses.get(flightStream);
|
||||
if (response) {
|
||||
return response;
|
||||
}
|
||||
const { moduleLoading, edgeSSRModuleMapping, ssrModuleMapping } = (0, _manifestssingleton.getClientReferenceManifest)();
|
||||
let newResponse;
|
||||
if (flightStream instanceof ReadableStream) {
|
||||
// The types of flightStream and debugStream should match.
|
||||
if (debugStream && !(debugStream instanceof ReadableStream)) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('Expected debug stream to be a ReadableStream'), "__NEXT_ERROR_CODE", {
|
||||
value: "E939",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
// react-server-dom-webpack/client.edge must not be hoisted for require cache clearing to work correctly
|
||||
const { createFromReadableStream } = // eslint-disable-next-line import/no-extraneous-dependencies
|
||||
require('react-server-dom-webpack/client');
|
||||
newResponse = createFromReadableStream(flightStream, {
|
||||
findSourceMapURL,
|
||||
serverConsumerManifest: {
|
||||
moduleLoading,
|
||||
moduleMap: isEdgeRuntime ? edgeSSRModuleMapping : ssrModuleMapping,
|
||||
serverModuleMap: null
|
||||
},
|
||||
nonce,
|
||||
debugChannel: debugStream ? {
|
||||
readable: debugStream
|
||||
} : undefined,
|
||||
endTime: debugEndTime
|
||||
});
|
||||
} else {
|
||||
if (process.env.NEXT_RUNTIME === 'edge') {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('getFlightStream should always receive a ReadableStream when using the edge runtime'), "__NEXT_ERROR_CODE", {
|
||||
value: "E943",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
} else {
|
||||
const { Readable } = require('node:stream');
|
||||
// The types of flightStream and debugStream should match.
|
||||
if (debugStream && !(debugStream instanceof Readable)) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('Expected debug stream to be a Readable'), "__NEXT_ERROR_CODE", {
|
||||
value: "E940",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
// react-server-dom-webpack/client.edge must not be hoisted for require cache clearing to work correctly
|
||||
const { createFromNodeStream } = // eslint-disable-next-line import/no-extraneous-dependencies
|
||||
require('react-server-dom-webpack/client');
|
||||
newResponse = createFromNodeStream(flightStream, {
|
||||
moduleLoading,
|
||||
moduleMap: isEdgeRuntime ? edgeSSRModuleMapping : ssrModuleMapping,
|
||||
serverModuleMap: null
|
||||
}, {
|
||||
findSourceMapURL,
|
||||
nonce,
|
||||
debugChannel: debugStream,
|
||||
endTime: debugEndTime
|
||||
});
|
||||
}
|
||||
}
|
||||
// Edge pages are never prerendered so they necessarily cannot have a workUnitStore type
|
||||
// that requires the nextTick behavior. This is why it is safe to access a node only API here
|
||||
if (process.env.NEXT_RUNTIME !== 'edge') {
|
||||
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
||||
if (!workUnitStore) {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('Expected workUnitAsyncStorage to have a store.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E696",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
switch(workUnitStore.type){
|
||||
case 'prerender-client':
|
||||
case 'validation-client':
|
||||
const responseOnNextTick = new Promise((resolve)=>{
|
||||
process.nextTick(()=>{
|
||||
resolve(newResponse);
|
||||
});
|
||||
});
|
||||
flightResponses.set(flightStream, responseOnNextTick);
|
||||
return responseOnNextTick;
|
||||
case 'prerender':
|
||||
case 'prerender-runtime':
|
||||
case 'prerender-ppr':
|
||||
case 'prerender-legacy':
|
||||
case 'request':
|
||||
case 'cache':
|
||||
case 'private-cache':
|
||||
case 'unstable-cache':
|
||||
case 'generate-static-params':
|
||||
break;
|
||||
default:
|
||||
workUnitStore;
|
||||
}
|
||||
}
|
||||
flightResponses.set(flightStream, newResponse);
|
||||
return newResponse;
|
||||
}
|
||||
function createInlinedDataReadableStream(flightStream, nonce, formState) {
|
||||
const startScriptTag = nonce ? `<script nonce="${(0, _htmlescape.htmlEscapeAttributeString)(nonce)}">` : '<script>';
|
||||
const flightReader = flightStream.getReader();
|
||||
const decoder = new TextDecoder('utf-8', {
|
||||
fatal: true
|
||||
});
|
||||
const readable = new ReadableStream({
|
||||
type: 'bytes',
|
||||
start (controller) {
|
||||
try {
|
||||
writeInitialInstructions(controller, startScriptTag, formState);
|
||||
} catch (error) {
|
||||
// during encoding or enqueueing forward the error downstream
|
||||
controller.error(error);
|
||||
}
|
||||
},
|
||||
async pull (controller) {
|
||||
try {
|
||||
const { done, value } = await flightReader.read();
|
||||
if (value) {
|
||||
try {
|
||||
const decodedString = decoder.decode(value, {
|
||||
stream: !done
|
||||
});
|
||||
// The chunk cannot be decoded as valid UTF-8 string as it might
|
||||
// have arbitrary binary data.
|
||||
writeFlightDataInstruction(controller, startScriptTag, decodedString);
|
||||
} catch {
|
||||
// The chunk cannot be decoded as valid UTF-8 string.
|
||||
writeFlightDataInstruction(controller, startScriptTag, value);
|
||||
}
|
||||
}
|
||||
if (done) {
|
||||
controller.close();
|
||||
}
|
||||
} catch (error) {
|
||||
// There was a problem in the upstream reader or during decoding or enqueuing
|
||||
// forward the error downstream
|
||||
controller.error(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
return readable;
|
||||
}
|
||||
function writeInitialInstructions(controller, scriptStart, formState) {
|
||||
let scriptContents = `(self.__next_f=self.__next_f||[]).push(${(0, _htmlescape.htmlEscapeJsonString)(JSON.stringify([
|
||||
INLINE_FLIGHT_PAYLOAD_BOOTSTRAP
|
||||
]))})`;
|
||||
if (formState != null) {
|
||||
scriptContents += `;self.__next_f.push(${(0, _htmlescape.htmlEscapeJsonString)(JSON.stringify([
|
||||
INLINE_FLIGHT_PAYLOAD_FORM_STATE,
|
||||
formState
|
||||
]))})`;
|
||||
}
|
||||
controller.enqueue(encoder.encode(`${scriptStart}${scriptContents}</script>`));
|
||||
}
|
||||
function writeFlightDataInstruction(controller, scriptStart, chunk) {
|
||||
let htmlInlinedData;
|
||||
if (typeof chunk === 'string') {
|
||||
htmlInlinedData = (0, _htmlescape.htmlEscapeJsonString)(JSON.stringify([
|
||||
INLINE_FLIGHT_PAYLOAD_DATA,
|
||||
chunk
|
||||
]));
|
||||
} else {
|
||||
// The chunk cannot be embedded as a UTF-8 string in the script tag.
|
||||
// Instead let's inline it in base64.
|
||||
// Credits to Devon Govett (devongovett) for the technique.
|
||||
// https://github.com/devongovett/rsc-html-stream
|
||||
const base64 = typeof Buffer !== 'undefined' ? Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength).toString('base64') : btoa(String.fromCodePoint(...chunk));
|
||||
htmlInlinedData = (0, _htmlescape.htmlEscapeJsonString)(JSON.stringify([
|
||||
INLINE_FLIGHT_PAYLOAD_BINARY,
|
||||
base64
|
||||
]));
|
||||
}
|
||||
controller.enqueue(encoder.encode(`${scriptStart}self.__next_f.push(${htmlInlinedData})</script>`));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=use-flight-response.js.map
|
||||
336
build/node_modules/next/dist/server/app-render/vary-params.js
generated
vendored
Normal file
336
build/node_modules/next/dist/server/app-render/vary-params.js
generated
vendored
Normal file
@@ -0,0 +1,336 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
accumulateRootVaryParam: null,
|
||||
accumulateVaryParam: null,
|
||||
createResponseVaryParamsAccumulator: null,
|
||||
createVaryParamsAccumulator: null,
|
||||
createVaryingParams: null,
|
||||
createVaryingSearchParams: null,
|
||||
emptyVaryParamsAccumulator: null,
|
||||
finishAccumulatingVaryParams: null,
|
||||
getMetadataVaryParamsAccumulator: null,
|
||||
getMetadataVaryParamsThenable: null,
|
||||
getRootParamsVaryParamsAccumulator: null,
|
||||
getVaryParamsThenable: null,
|
||||
getViewportVaryParamsAccumulator: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
accumulateRootVaryParam: function() {
|
||||
return accumulateRootVaryParam;
|
||||
},
|
||||
accumulateVaryParam: function() {
|
||||
return accumulateVaryParam;
|
||||
},
|
||||
createResponseVaryParamsAccumulator: function() {
|
||||
return createResponseVaryParamsAccumulator;
|
||||
},
|
||||
createVaryParamsAccumulator: function() {
|
||||
return createVaryParamsAccumulator;
|
||||
},
|
||||
createVaryingParams: function() {
|
||||
return createVaryingParams;
|
||||
},
|
||||
createVaryingSearchParams: function() {
|
||||
return createVaryingSearchParams;
|
||||
},
|
||||
emptyVaryParamsAccumulator: function() {
|
||||
return emptyVaryParamsAccumulator;
|
||||
},
|
||||
finishAccumulatingVaryParams: function() {
|
||||
return finishAccumulatingVaryParams;
|
||||
},
|
||||
getMetadataVaryParamsAccumulator: function() {
|
||||
return getMetadataVaryParamsAccumulator;
|
||||
},
|
||||
getMetadataVaryParamsThenable: function() {
|
||||
return getMetadataVaryParamsThenable;
|
||||
},
|
||||
getRootParamsVaryParamsAccumulator: function() {
|
||||
return getRootParamsVaryParamsAccumulator;
|
||||
},
|
||||
getVaryParamsThenable: function() {
|
||||
return getVaryParamsThenable;
|
||||
},
|
||||
getViewportVaryParamsAccumulator: function() {
|
||||
return getViewportVaryParamsAccumulator;
|
||||
}
|
||||
});
|
||||
const _workunitasyncstorageexternal = require("./work-unit-async-storage.external");
|
||||
function createSegmentVaryParamsAccumulator() {
|
||||
const accumulator = {
|
||||
varyParams: new Set(),
|
||||
status: 'pending',
|
||||
value: new Set(),
|
||||
then (onfulfilled) {
|
||||
if (onfulfilled) {
|
||||
if (accumulator.status === 'pending') {
|
||||
accumulator.resolvers.push(onfulfilled);
|
||||
} else {
|
||||
onfulfilled(accumulator.value);
|
||||
}
|
||||
}
|
||||
},
|
||||
resolvers: []
|
||||
};
|
||||
return accumulator;
|
||||
}
|
||||
/**
|
||||
* A singleton accumulator that's already resolved to an empty Set. Use this for
|
||||
* segments where we know upfront that no params will be accessed, such as
|
||||
* client components or segments without user code.
|
||||
*
|
||||
* Benefits:
|
||||
* - No need to accumulate or resolve later
|
||||
* - Resilient: resolves correctly even if other tracking fails
|
||||
* - Memory efficient: reuses the same object
|
||||
*/ const emptySet = new Set();
|
||||
const emptyVaryParamsAccumulator = {
|
||||
varyParams: emptySet,
|
||||
status: 'fulfilled',
|
||||
value: emptySet,
|
||||
then (onfulfilled) {
|
||||
if (onfulfilled) {
|
||||
onfulfilled(emptySet);
|
||||
}
|
||||
},
|
||||
resolvers: []
|
||||
};
|
||||
function createResponseVaryParamsAccumulator() {
|
||||
// Create the head and rootParams accumulators as top-level fields.
|
||||
// Segment accumulators are added to the segments set as they are created.
|
||||
const head = createSegmentVaryParamsAccumulator();
|
||||
const rootParams = createSegmentVaryParamsAccumulator();
|
||||
const segments = new Set();
|
||||
return {
|
||||
head,
|
||||
rootParams,
|
||||
segments
|
||||
};
|
||||
}
|
||||
function createVaryParamsAccumulator() {
|
||||
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
||||
if (workUnitStore) {
|
||||
switch(workUnitStore.type){
|
||||
case 'prerender':
|
||||
case 'prerender-runtime':
|
||||
{
|
||||
const responseAccumulator = workUnitStore.varyParamsAccumulator;
|
||||
if (responseAccumulator !== null) {
|
||||
const accumulator = createSegmentVaryParamsAccumulator();
|
||||
responseAccumulator.segments.add(accumulator);
|
||||
return accumulator;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
case 'prerender-ppr':
|
||||
case 'prerender-legacy':
|
||||
case 'request':
|
||||
case 'cache':
|
||||
case 'private-cache':
|
||||
case 'prerender-client':
|
||||
case 'validation-client':
|
||||
case 'unstable-cache':
|
||||
case 'generate-static-params':
|
||||
break;
|
||||
default:
|
||||
workUnitStore;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function getMetadataVaryParamsAccumulator() {
|
||||
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
||||
if (workUnitStore) {
|
||||
switch(workUnitStore.type){
|
||||
case 'prerender':
|
||||
case 'prerender-runtime':
|
||||
{
|
||||
const responseAccumulator = workUnitStore.varyParamsAccumulator;
|
||||
if (responseAccumulator !== null) {
|
||||
return responseAccumulator.head;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
case 'prerender-ppr':
|
||||
case 'prerender-legacy':
|
||||
case 'request':
|
||||
case 'cache':
|
||||
case 'private-cache':
|
||||
case 'prerender-client':
|
||||
case 'validation-client':
|
||||
case 'unstable-cache':
|
||||
case 'generate-static-params':
|
||||
return null;
|
||||
default:
|
||||
workUnitStore;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function getVaryParamsThenable(accumulator) {
|
||||
return accumulator;
|
||||
}
|
||||
function getMetadataVaryParamsThenable() {
|
||||
const accumulator = getMetadataVaryParamsAccumulator();
|
||||
if (accumulator !== null) {
|
||||
return getVaryParamsThenable(accumulator);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
const getViewportVaryParamsAccumulator = getMetadataVaryParamsAccumulator;
|
||||
function getRootParamsVaryParamsAccumulator() {
|
||||
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
||||
if (workUnitStore) {
|
||||
switch(workUnitStore.type){
|
||||
case 'prerender':
|
||||
case 'prerender-runtime':
|
||||
{
|
||||
const responseAccumulator = workUnitStore.varyParamsAccumulator;
|
||||
if (responseAccumulator !== null) {
|
||||
return responseAccumulator.rootParams;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
case 'prerender-ppr':
|
||||
case 'prerender-legacy':
|
||||
case 'request':
|
||||
case 'cache':
|
||||
case 'private-cache':
|
||||
case 'prerender-client':
|
||||
case 'validation-client':
|
||||
case 'unstable-cache':
|
||||
case 'generate-static-params':
|
||||
return null;
|
||||
default:
|
||||
workUnitStore;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function accumulateVaryParam(accumulator, paramName) {
|
||||
accumulator.varyParams.add(paramName);
|
||||
}
|
||||
function accumulateRootVaryParam(paramName) {
|
||||
const rootParamsAccumulator = getRootParamsVaryParamsAccumulator();
|
||||
if (rootParamsAccumulator !== null) {
|
||||
accumulateVaryParam(rootParamsAccumulator, paramName);
|
||||
}
|
||||
}
|
||||
function createVaryingParams(accumulator, originalParamsObject, optionalCatchAllParamName) {
|
||||
if (optionalCatchAllParamName !== null) {
|
||||
// When there's an optional catch-all param with no value (e.g.,
|
||||
// [[...slug]] at /), the param doesn't exist as a property on the params
|
||||
// object. Use a Proxy to track all param access — both existing params
|
||||
// and the missing optional param — including enumeration patterns like
|
||||
// Object.keys(), spread, for...in, and `in` checks.
|
||||
return new Proxy(originalParamsObject, {
|
||||
get (target, prop, receiver) {
|
||||
if (typeof prop === 'string') {
|
||||
if (prop === optionalCatchAllParamName || Object.prototype.hasOwnProperty.call(target, prop)) {
|
||||
accumulateVaryParam(accumulator, prop);
|
||||
}
|
||||
}
|
||||
return Reflect.get(target, prop, receiver);
|
||||
},
|
||||
has (target, prop) {
|
||||
if (prop === optionalCatchAllParamName) {
|
||||
accumulateVaryParam(accumulator, optionalCatchAllParamName);
|
||||
}
|
||||
return Reflect.has(target, prop);
|
||||
},
|
||||
ownKeys (target) {
|
||||
// Enumerating the params object means the user's code may depend on
|
||||
// which params are present, so conservatively track the optional
|
||||
// param as accessed.
|
||||
accumulateVaryParam(accumulator, optionalCatchAllParamName);
|
||||
return Reflect.ownKeys(target);
|
||||
}
|
||||
});
|
||||
}
|
||||
// When there's no optional catch-all, all params exist as properties on the
|
||||
// object, so we can use defineProperty getters instead of a Proxy. This is
|
||||
// faster because the engine can optimize property access on regular objects
|
||||
// more aggressively than Proxy trap calls.
|
||||
const underlyingParamsWithVarying = {};
|
||||
for(const paramName in originalParamsObject){
|
||||
Object.defineProperty(underlyingParamsWithVarying, paramName, {
|
||||
get () {
|
||||
accumulateVaryParam(accumulator, paramName);
|
||||
return originalParamsObject[paramName];
|
||||
},
|
||||
enumerable: true
|
||||
});
|
||||
}
|
||||
return underlyingParamsWithVarying;
|
||||
}
|
||||
function createVaryingSearchParams(accumulator, originalSearchParamsObject) {
|
||||
const underlyingSearchParamsWithVarying = {};
|
||||
for(const searchParamName in originalSearchParamsObject){
|
||||
Object.defineProperty(underlyingSearchParamsWithVarying, searchParamName, {
|
||||
get () {
|
||||
// TODO: Unlike path params, we don't vary track each search param
|
||||
// individually. The entire search string is treated as a single param.
|
||||
// This may change in the future.
|
||||
accumulateVaryParam(accumulator, '?');
|
||||
return originalSearchParamsObject[searchParamName];
|
||||
},
|
||||
enumerable: true
|
||||
});
|
||||
}
|
||||
return underlyingSearchParamsWithVarying;
|
||||
}
|
||||
async function finishAccumulatingVaryParams(responseAccumulator) {
|
||||
const rootVaryParams = responseAccumulator.rootParams.varyParams;
|
||||
// Resolve head
|
||||
finishSegmentAccumulator(responseAccumulator.head, rootVaryParams);
|
||||
// Resolve each segment
|
||||
for (const segmentAccumulator of responseAccumulator.segments){
|
||||
finishSegmentAccumulator(segmentAccumulator, rootVaryParams);
|
||||
}
|
||||
// Now that the thenables are resolved, Flight should be able to flush the
|
||||
// vary params into the response stream. This work gets scheduled internally
|
||||
// by Flight using a microtask as soon as we notify the thenable listeners.
|
||||
//
|
||||
// We need to ensure that Flight's pending queues are emptied before this
|
||||
// function returns; the caller will abort the prerender immediately after.
|
||||
// We can't use a macrotask, because that would allow dynamic IO to sneak
|
||||
// into the response. So we use microtasks instead.
|
||||
//
|
||||
// The exact number of awaits here isn't important (indeed, one seems to be
|
||||
// sufficient, at the time of writing), as long as we wait enough ticks for
|
||||
// Flight to finish writing the response.
|
||||
//
|
||||
// Anything that remains in Flight's internal queue after these awaits must
|
||||
// be actual dynamic IO, not caused by pending vary params tasks. In other
|
||||
// words, failing to do this would cause us to treat a fully static prerender
|
||||
// as if it were partially dynamic.
|
||||
await Promise.resolve();
|
||||
await Promise.resolve();
|
||||
await Promise.resolve();
|
||||
}
|
||||
function finishSegmentAccumulator(accumulator, rootVaryParams) {
|
||||
if (accumulator.status !== 'pending') {
|
||||
return;
|
||||
}
|
||||
const merged = new Set(accumulator.varyParams);
|
||||
for (const param of rootVaryParams){
|
||||
merged.add(param);
|
||||
}
|
||||
accumulator.value = merged;
|
||||
accumulator.status = 'fulfilled';
|
||||
for (const resolver of accumulator.resolvers){
|
||||
resolver(merged);
|
||||
}
|
||||
accumulator.resolvers = [];
|
||||
}
|
||||
|
||||
//# sourceMappingURL=vary-params.js.map
|
||||
232
build/node_modules/next/dist/server/app-render/walk-tree-with-flight-router-state.js
generated
vendored
Normal file
232
build/node_modules/next/dist/server/app-render/walk-tree-with-flight-router-state.js
generated
vendored
Normal file
@@ -0,0 +1,232 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
createFullTreeFlightDataForNavigation: null,
|
||||
walkTreeWithFlightRouterState: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
createFullTreeFlightDataForNavigation: function() {
|
||||
return createFullTreeFlightDataForNavigation;
|
||||
},
|
||||
walkTreeWithFlightRouterState: function() {
|
||||
return walkTreeWithFlightRouterState;
|
||||
}
|
||||
});
|
||||
const _matchsegments = require("../../client/components/match-segments");
|
||||
const _getcssinlinedlinktags = require("./get-css-inlined-link-tags");
|
||||
const _getpreloadablefonts = require("./get-preloadable-fonts");
|
||||
const _createflightrouterstatefromloadertree = require("./create-flight-router-state-from-loader-tree");
|
||||
const _hasloadingcomponentintree = require("./has-loading-component-in-tree");
|
||||
const _segment = require("../../shared/lib/segment");
|
||||
const _createcomponenttree = require("./create-component-tree");
|
||||
const _getsegmentparam = require("../../shared/lib/router/utils/get-segment-param");
|
||||
async function walkTreeWithFlightRouterState({ loaderTreeToFilter, parentParams, flightRouterState, parentIsInsideSharedLayout, rscHead, injectedCSS, injectedJS, injectedFontPreloadTags, rootLayoutIncluded, ctx, preloadCallbacks, MetadataOutlet, hintTree }) {
|
||||
const { renderOpts: { nextFontManifest, experimental }, query, isPrefetch, getDynamicParamFromSegment, parsedRequestHeaders } = ctx;
|
||||
const [segment, parallelRoutes, modules] = loaderTreeToFilter;
|
||||
const parallelRoutesKeys = Object.keys(parallelRoutes);
|
||||
const { layout } = modules;
|
||||
const isLayout = typeof layout !== 'undefined';
|
||||
/**
|
||||
* Checks if the current segment is a root layout.
|
||||
*/ const rootLayoutAtThisLevel = isLayout && !rootLayoutIncluded;
|
||||
/**
|
||||
* Checks if the current segment or any level above it has a root layout.
|
||||
*/ const rootLayoutIncludedAtThisLevelOrAbove = rootLayoutIncluded || rootLayoutAtThisLevel;
|
||||
// Because this function walks to a deeper point in the tree to start rendering we have to track the dynamic parameters up to the point where rendering starts
|
||||
const segmentParam = getDynamicParamFromSegment(loaderTreeToFilter);
|
||||
const currentParams = // Handle null case where dynamic param is optional
|
||||
segmentParam && segmentParam.value !== null ? {
|
||||
...parentParams,
|
||||
[segmentParam.param]: segmentParam.value
|
||||
} : parentParams;
|
||||
const actualSegment = (0, _segment.addSearchParamsIfPageSegment)(segmentParam ? segmentParam.treeSegment : segment, query);
|
||||
/**
|
||||
* Decide if the current segment is where rendering has to start.
|
||||
*/ const renderComponentsOnThisLevel = // No further router state available
|
||||
!flightRouterState || // Segment in router state does not match current segment
|
||||
!(0, _matchsegments.matchSegment)(actualSegment, flightRouterState[0]) || // Explicit refresh
|
||||
flightRouterState[3] === 'refetch';
|
||||
// Pre-PPR, the `loading` component signals to the router how deep to render the component tree
|
||||
// to ensure prefetches are quick and inexpensive. If there's no `loading` component anywhere in the tree being rendered,
|
||||
// the prefetch will be short-circuited to avoid requesting a potentially very expensive subtree. If there's a `loading`
|
||||
// somewhere in the tree, we'll recursively render the component tree up until we encounter that loading component, and then stop.
|
||||
// Check if we're inside the "new" part of the navigation — inside the
|
||||
// shared layout. In the case of a prefetch, this can be true even if the
|
||||
// segment matches, because the client might send a matching segment to
|
||||
// indicate that it already has the data in its cache. But in order to find
|
||||
// the correct loading boundary, we still need to track where the shared
|
||||
// layout begins.
|
||||
//
|
||||
// TODO: We should rethink the protocol for dynamic requests. It might not
|
||||
// make sense for the client to send a FlightRouterState, since that type is
|
||||
// overloaded with other concerns.
|
||||
const isInsideSharedLayout = renderComponentsOnThisLevel || parentIsInsideSharedLayout || flightRouterState[3] === 'inside-shared-layout';
|
||||
if (isInsideSharedLayout && !experimental.isRoutePPREnabled && // If PPR is disabled, and this is a request for the route tree, then we
|
||||
// never render any components. Only send the router state.
|
||||
(parsedRequestHeaders.isRouteTreePrefetchRequest || // Otherwise, check for the presence of a `loading` component.
|
||||
isPrefetch && !Boolean(modules.loading) && !(0, _hasloadingcomponentintree.hasLoadingComponentInTree)(loaderTreeToFilter))) {
|
||||
// Send only the router state.
|
||||
// TODO: Even for a dynamic route, we should cache these responses,
|
||||
// because they do not contain any render data (neither segment data nor
|
||||
// the head). They can be made even more cacheable once we move the route
|
||||
// params into a separate data structure.
|
||||
const overriddenSegment = flightRouterState && // TODO: Why does canSegmentBeOverridden exist? Why don't we always just
|
||||
// use `actualSegment`? Is it to avoid overwriting some state that's
|
||||
// tracked by the client? Dig deeper to see if we can simplify this.
|
||||
canSegmentBeOverridden(actualSegment, flightRouterState[0]) ? flightRouterState[0] : actualSegment;
|
||||
const routerState = parsedRequestHeaders.isRouteTreePrefetchRequest ? await (0, _createflightrouterstatefromloadertree.createRouteTreePrefetch)(loaderTreeToFilter, hintTree, getDynamicParamFromSegment) : await (0, _createflightrouterstatefromloadertree.createFlightRouterStateFromLoaderTree)(loaderTreeToFilter, hintTree, getDynamicParamFromSegment, query);
|
||||
return [
|
||||
[
|
||||
overriddenSegment,
|
||||
routerState,
|
||||
null,
|
||||
[
|
||||
null,
|
||||
null
|
||||
],
|
||||
true
|
||||
]
|
||||
];
|
||||
}
|
||||
// Similar to the previous branch. This flag is sent by the client to request
|
||||
// only the metadata for a page. No segment data.
|
||||
if (flightRouterState && flightRouterState[3] === 'metadata-only') {
|
||||
const overriddenSegment = flightRouterState && canSegmentBeOverridden(actualSegment, flightRouterState[0]) ? flightRouterState[0] : actualSegment;
|
||||
const routerState = parsedRequestHeaders.isRouteTreePrefetchRequest ? await (0, _createflightrouterstatefromloadertree.createRouteTreePrefetch)(loaderTreeToFilter, hintTree, getDynamicParamFromSegment) : await (0, _createflightrouterstatefromloadertree.createFlightRouterStateFromLoaderTree)(loaderTreeToFilter, hintTree, getDynamicParamFromSegment, query);
|
||||
return [
|
||||
[
|
||||
overriddenSegment,
|
||||
routerState,
|
||||
null,
|
||||
rscHead,
|
||||
false
|
||||
]
|
||||
];
|
||||
}
|
||||
if (renderComponentsOnThisLevel) {
|
||||
const overriddenSegment = flightRouterState && // TODO: Why does canSegmentBeOverridden exist? Why don't we always just
|
||||
// use `actualSegment`? Is it to avoid overwriting some state that's
|
||||
// tracked by the client? Dig deeper to see if we can simplify this.
|
||||
canSegmentBeOverridden(actualSegment, flightRouterState[0]) ? flightRouterState[0] : actualSegment;
|
||||
const routerState = await (0, _createflightrouterstatefromloadertree.createFlightRouterStateFromLoaderTree)(// Create router state using the slice of the loaderTree
|
||||
loaderTreeToFilter, hintTree, getDynamicParamFromSegment, query);
|
||||
// Create component tree using the slice of the loaderTree
|
||||
const seedData = await (0, _createcomponenttree.createComponentTree)(// This ensures flightRouterPath is valid and filters down the tree
|
||||
{
|
||||
ctx,
|
||||
loaderTree: loaderTreeToFilter,
|
||||
parentParams: currentParams,
|
||||
parentOptionalCatchAllParamName: null,
|
||||
parentRuntimePrefetchable: false,
|
||||
injectedCSS,
|
||||
injectedJS,
|
||||
injectedFontPreloadTags,
|
||||
// This is intentionally not "rootLayoutIncludedAtThisLevelOrAbove" as createComponentTree starts at the current level and does a check for "rootLayoutAtThisLevel" too.
|
||||
rootLayoutIncluded,
|
||||
preloadCallbacks,
|
||||
authInterrupts: experimental.authInterrupts,
|
||||
MetadataOutlet
|
||||
});
|
||||
return [
|
||||
[
|
||||
overriddenSegment,
|
||||
routerState,
|
||||
seedData,
|
||||
rscHead,
|
||||
false
|
||||
]
|
||||
];
|
||||
}
|
||||
// If we are not rendering on this level we need to check if the current
|
||||
// segment has a layout. If so, we need to track all the used CSS to make
|
||||
// the result consistent.
|
||||
const layoutPath = layout == null ? void 0 : layout[1];
|
||||
const injectedCSSWithCurrentLayout = new Set(injectedCSS);
|
||||
const injectedJSWithCurrentLayout = new Set(injectedJS);
|
||||
const injectedFontPreloadTagsWithCurrentLayout = new Set(injectedFontPreloadTags);
|
||||
if (layoutPath) {
|
||||
(0, _getcssinlinedlinktags.getLinkAndScriptTags)(layoutPath, injectedCSSWithCurrentLayout, injectedJSWithCurrentLayout, true);
|
||||
(0, _getpreloadablefonts.getPreloadableFonts)(nextFontManifest, layoutPath, injectedFontPreloadTagsWithCurrentLayout);
|
||||
}
|
||||
const paths = [];
|
||||
// Walk through all parallel routes.
|
||||
for (const parallelRouteKey of parallelRoutesKeys){
|
||||
var _hintTree_slots;
|
||||
const parallelRoute = parallelRoutes[parallelRouteKey];
|
||||
const subPaths = await walkTreeWithFlightRouterState({
|
||||
ctx,
|
||||
loaderTreeToFilter: parallelRoute,
|
||||
parentParams: currentParams,
|
||||
flightRouterState: flightRouterState && flightRouterState[1][parallelRouteKey],
|
||||
parentIsInsideSharedLayout: isInsideSharedLayout,
|
||||
rscHead,
|
||||
injectedCSS: injectedCSSWithCurrentLayout,
|
||||
injectedJS: injectedJSWithCurrentLayout,
|
||||
injectedFontPreloadTags: injectedFontPreloadTagsWithCurrentLayout,
|
||||
rootLayoutIncluded: rootLayoutIncludedAtThisLevelOrAbove,
|
||||
preloadCallbacks,
|
||||
MetadataOutlet,
|
||||
hintTree: (hintTree == null ? void 0 : (_hintTree_slots = hintTree.slots) == null ? void 0 : _hintTree_slots[parallelRouteKey]) ?? null
|
||||
});
|
||||
for (const subPath of subPaths){
|
||||
paths.push([
|
||||
actualSegment,
|
||||
parallelRouteKey,
|
||||
...subPath
|
||||
]);
|
||||
}
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
async function createFullTreeFlightDataForNavigation({ loaderTree, rscHead, injectedCSS, injectedJS, injectedFontPreloadTags, ctx, preloadCallbacks, MetadataOutlet }) {
|
||||
var _ctx_renderOpts_prefetchHints;
|
||||
const { renderOpts: { experimental }, query, getDynamicParamFromSegment, pagePath } = ctx;
|
||||
const hintTreeForInitialRender = ((_ctx_renderOpts_prefetchHints = ctx.renderOpts.prefetchHints) == null ? void 0 : _ctx_renderOpts_prefetchHints[pagePath]) ?? null;
|
||||
const routerState = await (0, _createflightrouterstatefromloadertree.createFlightRouterStateFromLoaderTree)(loaderTree, hintTreeForInitialRender, getDynamicParamFromSegment, query);
|
||||
const rootSegment = routerState[0];
|
||||
const seedData = await (0, _createcomponenttree.createComponentTree)({
|
||||
ctx,
|
||||
loaderTree,
|
||||
parentParams: {},
|
||||
parentOptionalCatchAllParamName: null,
|
||||
parentRuntimePrefetchable: false,
|
||||
injectedCSS,
|
||||
injectedJS,
|
||||
injectedFontPreloadTags,
|
||||
rootLayoutIncluded: false,
|
||||
preloadCallbacks,
|
||||
authInterrupts: experimental.authInterrupts,
|
||||
MetadataOutlet
|
||||
});
|
||||
return [
|
||||
[
|
||||
// TODO: app-render slices this Segment off.
|
||||
// why is that valid, and why are we including it in the first place?
|
||||
rootSegment,
|
||||
routerState,
|
||||
seedData,
|
||||
rscHead,
|
||||
false
|
||||
]
|
||||
];
|
||||
}
|
||||
/*
|
||||
* This function is used to determine if an existing segment can be overridden
|
||||
* by the incoming segment.
|
||||
*/ const canSegmentBeOverridden = (existingSegment, segment)=>{
|
||||
var _getSegmentParam;
|
||||
if (Array.isArray(existingSegment) || !Array.isArray(segment)) {
|
||||
return false;
|
||||
}
|
||||
return ((_getSegmentParam = (0, _getsegmentparam.getSegmentParam)(existingSegment)) == null ? void 0 : _getSegmentParam.paramName) === segment[0];
|
||||
};
|
||||
|
||||
//# sourceMappingURL=walk-tree-with-flight-router-state.js.map
|
||||
14
build/node_modules/next/dist/server/app-render/work-async-storage-instance.js
generated
vendored
Normal file
14
build/node_modules/next/dist/server/app-render/work-async-storage-instance.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "workAsyncStorageInstance", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return workAsyncStorageInstance;
|
||||
}
|
||||
});
|
||||
const _asynclocalstorage = require("./async-local-storage");
|
||||
const workAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)();
|
||||
|
||||
//# sourceMappingURL=work-async-storage-instance.js.map
|
||||
13
build/node_modules/next/dist/server/app-render/work-async-storage.external.js
generated
vendored
Normal file
13
build/node_modules/next/dist/server/app-render/work-async-storage.external.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "workAsyncStorage", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _workasyncstorageinstance.workAsyncStorageInstance;
|
||||
}
|
||||
});
|
||||
const _workasyncstorageinstance = require("./work-async-storage-instance");
|
||||
|
||||
//# sourceMappingURL=work-async-storage.external.js.map
|
||||
14
build/node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js
generated
vendored
Normal file
14
build/node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "workUnitAsyncStorageInstance", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return workUnitAsyncStorageInstance;
|
||||
}
|
||||
});
|
||||
const _asynclocalstorage = require("./async-local-storage");
|
||||
const workUnitAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)();
|
||||
|
||||
//# sourceMappingURL=work-unit-async-storage-instance.js.map
|
||||
280
build/node_modules/next/dist/server/app-render/work-unit-async-storage.external.js
generated
vendored
Normal file
280
build/node_modules/next/dist/server/app-render/work-unit-async-storage.external.js
generated
vendored
Normal file
@@ -0,0 +1,280 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
getCacheSignal: null,
|
||||
getDraftModeProviderForCacheScope: null,
|
||||
getHmrRefreshHash: null,
|
||||
getPrerenderResumeDataCache: null,
|
||||
getRenderResumeDataCache: null,
|
||||
getServerComponentsHmrCache: null,
|
||||
getStagedRenderingController: null,
|
||||
isHmrRefresh: null,
|
||||
isInEarlyRenderStage: null,
|
||||
throwForMissingRequestStore: null,
|
||||
throwInvariantForMissingStore: null,
|
||||
workUnitAsyncStorage: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
getCacheSignal: function() {
|
||||
return getCacheSignal;
|
||||
},
|
||||
getDraftModeProviderForCacheScope: function() {
|
||||
return getDraftModeProviderForCacheScope;
|
||||
},
|
||||
getHmrRefreshHash: function() {
|
||||
return getHmrRefreshHash;
|
||||
},
|
||||
getPrerenderResumeDataCache: function() {
|
||||
return getPrerenderResumeDataCache;
|
||||
},
|
||||
getRenderResumeDataCache: function() {
|
||||
return getRenderResumeDataCache;
|
||||
},
|
||||
getServerComponentsHmrCache: function() {
|
||||
return getServerComponentsHmrCache;
|
||||
},
|
||||
getStagedRenderingController: function() {
|
||||
return getStagedRenderingController;
|
||||
},
|
||||
isHmrRefresh: function() {
|
||||
return isHmrRefresh;
|
||||
},
|
||||
isInEarlyRenderStage: function() {
|
||||
return isInEarlyRenderStage;
|
||||
},
|
||||
throwForMissingRequestStore: function() {
|
||||
return throwForMissingRequestStore;
|
||||
},
|
||||
throwInvariantForMissingStore: function() {
|
||||
return throwInvariantForMissingStore;
|
||||
},
|
||||
workUnitAsyncStorage: function() {
|
||||
return _workunitasyncstorageinstance.workUnitAsyncStorageInstance;
|
||||
}
|
||||
});
|
||||
const _workunitasyncstorageinstance = require("./work-unit-async-storage-instance");
|
||||
const _approuterheaders = require("../../client/components/app-router-headers");
|
||||
const _invarianterror = require("../../shared/lib/invariant-error");
|
||||
const _stagedrendering = require("./staged-rendering");
|
||||
function isInEarlyRenderStage(requestStore) {
|
||||
const stagedRendering = requestStore.stagedRendering;
|
||||
if (stagedRendering) {
|
||||
return stagedRendering.currentStage === _stagedrendering.RenderStage.EarlyStatic || stagedRendering.currentStage === _stagedrendering.RenderStage.EarlyRuntime;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function throwForMissingRequestStore(callingExpression) {
|
||||
throw Object.defineProperty(new Error(`\`${callingExpression}\` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context`), "__NEXT_ERROR_CODE", {
|
||||
value: "E251",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
function throwInvariantForMissingStore() {
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('Expected workUnitAsyncStorage to have a store.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E696",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
function getPrerenderResumeDataCache(workUnitStore) {
|
||||
switch(workUnitStore.type){
|
||||
case 'prerender':
|
||||
case 'prerender-runtime':
|
||||
case 'prerender-ppr':
|
||||
return workUnitStore.prerenderResumeDataCache;
|
||||
case 'prerender-client':
|
||||
case 'validation-client':
|
||||
// TODO eliminate fetch caching in client scope and stop exposing this data
|
||||
// cache during SSR.
|
||||
return workUnitStore.prerenderResumeDataCache;
|
||||
case 'request':
|
||||
{
|
||||
// In dev, we might fill caches even during a dynamic request.
|
||||
if (workUnitStore.prerenderResumeDataCache) {
|
||||
return workUnitStore.prerenderResumeDataCache;
|
||||
}
|
||||
// fallthrough
|
||||
}
|
||||
case 'prerender-legacy':
|
||||
case 'cache':
|
||||
case 'private-cache':
|
||||
case 'unstable-cache':
|
||||
case 'generate-static-params':
|
||||
return null;
|
||||
default:
|
||||
return workUnitStore;
|
||||
}
|
||||
}
|
||||
function getRenderResumeDataCache(workUnitStore) {
|
||||
switch(workUnitStore.type){
|
||||
case 'request':
|
||||
case 'prerender':
|
||||
case 'prerender-runtime':
|
||||
case 'prerender-client':
|
||||
case 'validation-client':
|
||||
if (workUnitStore.renderResumeDataCache) {
|
||||
// If we are in a prerender, we might have a render resume data cache
|
||||
// that is used to read from prefilled caches.
|
||||
return workUnitStore.renderResumeDataCache;
|
||||
}
|
||||
// fallthrough
|
||||
case 'prerender-ppr':
|
||||
// Otherwise we return the mutable resume data cache here as an immutable
|
||||
// version of the cache as it can also be used for reading.
|
||||
return workUnitStore.prerenderResumeDataCache ?? null;
|
||||
case 'cache':
|
||||
case 'private-cache':
|
||||
case 'unstable-cache':
|
||||
case 'prerender-legacy':
|
||||
case 'generate-static-params':
|
||||
return null;
|
||||
default:
|
||||
return workUnitStore;
|
||||
}
|
||||
}
|
||||
function getHmrRefreshHash(workUnitStore) {
|
||||
if (process.env.__NEXT_DEV_SERVER) {
|
||||
switch(workUnitStore.type){
|
||||
case 'cache':
|
||||
case 'private-cache':
|
||||
case 'prerender':
|
||||
case 'prerender-runtime':
|
||||
return workUnitStore.hmrRefreshHash;
|
||||
case 'request':
|
||||
var _workUnitStore_cookies_get;
|
||||
return (_workUnitStore_cookies_get = workUnitStore.cookies.get(_approuterheaders.NEXT_HMR_REFRESH_HASH_COOKIE)) == null ? void 0 : _workUnitStore_cookies_get.value;
|
||||
case 'prerender-client':
|
||||
case 'validation-client':
|
||||
case 'prerender-ppr':
|
||||
case 'prerender-legacy':
|
||||
case 'unstable-cache':
|
||||
case 'generate-static-params':
|
||||
break;
|
||||
default:
|
||||
workUnitStore;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function isHmrRefresh(workUnitStore) {
|
||||
if (process.env.__NEXT_DEV_SERVER) {
|
||||
switch(workUnitStore.type){
|
||||
case 'cache':
|
||||
case 'private-cache':
|
||||
case 'request':
|
||||
return workUnitStore.isHmrRefresh ?? false;
|
||||
case 'prerender':
|
||||
case 'prerender-client':
|
||||
case 'validation-client':
|
||||
case 'prerender-runtime':
|
||||
case 'prerender-ppr':
|
||||
case 'prerender-legacy':
|
||||
case 'unstable-cache':
|
||||
case 'generate-static-params':
|
||||
break;
|
||||
default:
|
||||
workUnitStore;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function getServerComponentsHmrCache(workUnitStore) {
|
||||
if (process.env.__NEXT_DEV_SERVER) {
|
||||
switch(workUnitStore.type){
|
||||
case 'cache':
|
||||
case 'private-cache':
|
||||
case 'request':
|
||||
return workUnitStore.serverComponentsHmrCache;
|
||||
case 'prerender':
|
||||
case 'prerender-client':
|
||||
case 'validation-client':
|
||||
case 'prerender-runtime':
|
||||
case 'prerender-ppr':
|
||||
case 'prerender-legacy':
|
||||
case 'unstable-cache':
|
||||
case 'generate-static-params':
|
||||
break;
|
||||
default:
|
||||
workUnitStore;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function getDraftModeProviderForCacheScope(workStore, workUnitStore) {
|
||||
if (workStore.isDraftMode) {
|
||||
switch(workUnitStore.type){
|
||||
case 'cache':
|
||||
case 'private-cache':
|
||||
case 'unstable-cache':
|
||||
case 'prerender-runtime':
|
||||
case 'request':
|
||||
return workUnitStore.draftMode;
|
||||
case 'prerender':
|
||||
case 'prerender-client':
|
||||
case 'validation-client':
|
||||
case 'prerender-ppr':
|
||||
case 'prerender-legacy':
|
||||
case 'generate-static-params':
|
||||
break;
|
||||
default:
|
||||
workUnitStore;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function getStagedRenderingController(workUnitStore) {
|
||||
switch(workUnitStore.type){
|
||||
case 'request':
|
||||
case 'prerender-runtime':
|
||||
return workUnitStore.stagedRendering ?? null;
|
||||
case 'prerender':
|
||||
case 'prerender-client':
|
||||
case 'validation-client':
|
||||
case 'prerender-ppr':
|
||||
case 'prerender-legacy':
|
||||
case 'cache':
|
||||
case 'private-cache':
|
||||
case 'unstable-cache':
|
||||
case 'generate-static-params':
|
||||
return null;
|
||||
default:
|
||||
return workUnitStore;
|
||||
}
|
||||
}
|
||||
function getCacheSignal(workUnitStore) {
|
||||
switch(workUnitStore.type){
|
||||
case 'prerender':
|
||||
case 'prerender-client':
|
||||
case 'validation-client':
|
||||
case 'prerender-runtime':
|
||||
return workUnitStore.cacheSignal;
|
||||
case 'request':
|
||||
{
|
||||
// In dev, we might fill caches even during a dynamic request.
|
||||
if (workUnitStore.cacheSignal) {
|
||||
return workUnitStore.cacheSignal;
|
||||
}
|
||||
// fallthrough
|
||||
}
|
||||
case 'prerender-ppr':
|
||||
case 'prerender-legacy':
|
||||
case 'cache':
|
||||
case 'private-cache':
|
||||
case 'unstable-cache':
|
||||
case 'generate-static-params':
|
||||
return null;
|
||||
default:
|
||||
return workUnitStore;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=work-unit-async-storage.external.js.map
|
||||
Reference in New Issue
Block a user