/opt/canhelp/node_modules/next/dist/esm/server
NameSizeModeActions
after/-0755rm
api-utils/-0755rm
app-render/-0755rm
async-storage/-0755rm
base-http/-0755rm
dev/-0755rm
instrumentation/-0755rm
lib/-0755rm
node-environment-extensions/-0755rm
normalizers/-0755rm
og/-0755rm
request/-0755rm
response-cache/-0755rm
resume-data-cache/-0755rm
route-definitions/-0755rm
route-matcher-managers/-0755rm
route-matcher-providers/-0755rm
route-matchers/-0755rm
route-matches/-0755rm
route-modules/-0755rm
stream-utils/-0755rm
typescript/-0755rm
use-cache/-0755rm
web/-0755rm
accept-header.js38520644editdlrm
accept-header.js.map64540644editdlrm
base-server.js965210644editdlrm
base-server.js.map1621330644editdlrm
body-streams.js29790644editdlrm
body-streams.js.map54080644editdlrm
cache-dir.js3240644editdlrm
cache-dir.js.map6980644editdlrm
ci-info.js6560644editdlrm
ci-info.js.map13170644editdlrm
client-component-renderer-logger.js17390644editdlrm
client-component-renderer-logger.js.map29840644editdlrm
config-schema.js273500644editdlrm
config-schema.js.map541600644editdlrm
config-shared.js66020644editdlrm
config-shared.js.map580730644editdlrm
config-utils.js56760644editdlrm
config-utils.js.map65820644editdlrm
config.js714880644editdlrm
config.js.map996810644editdlrm
create-deduped-by-callsite-server-error-logger.js23300644editdlrm
create-deduped-by-callsite-server-error-logger.js.map36410644editdlrm
crypto-utils.js23300644editdlrm
crypto-utils.js.map42990644editdlrm
dynamic-rendering-utils.js29840644editdlrm
dynamic-rendering-utils.js.map48830644editdlrm
font-utils.js15540644editdlrm
font-utils.js.map30730644editdlrm
get-app-route-from-entrypoint.js4520644editdlrm
get-app-route-from-entrypoint.js.map8520644editdlrm
get-page-files.js5470644editdlrm
get-page-files.js.map16990644editdlrm
get-route-from-entrypoint.js7940644editdlrm
get-route-from-entrypoint.js.map13980644editdlrm
htmlescape.js5100644editdlrm
htmlescape.js.map9610644editdlrm
image-optimizer.js334240644editdlrm
image-optimizer.js.map553920644editdlrm
internal-utils.js5780644editdlrm
internal-utils.js.map13080644editdlrm
load-components.js62050644editdlrm
load-components.js.map131850644editdlrm
load-default-error-components.js15560644editdlrm
load-default-error-components.js.map38870644editdlrm
load-manifest.external.js23080644editdlrm
load-manifest.external.js.map57630644editdlrm
match-bundle.js3200644editdlrm
match-bundle.js.map7050644editdlrm
next-server.js654510644editdlrm
next-server.js.map1101450644editdlrm
next-typescript.js910644editdlrm
next-typescript.js.map2150644editdlrm
next.js135400644editdlrm
next.js.map269300644editdlrm
node-environment-baseline.js8760644editdlrm
node-environment-baseline.js.map15540644editdlrm
node-environment.js7570644editdlrm
node-environment.js.map11650644editdlrm
node-polyfill-crypto.js5440644editdlrm
node-polyfill-crypto.js.map10130644editdlrm
optimize-amp.js3600644editdlrm
optimize-amp.js.map8230644editdlrm
patch-error-inspect.js175330644editdlrm
patch-error-inspect.js.map285930644editdlrm
pipe-readable.js50210644editdlrm
pipe-readable.js.map77020644editdlrm
post-process.js18000644editdlrm
post-process.js.map39970644editdlrm
ReactDOMServerPages.d.ts380644editdlrm
ReactDOMServerPages.js5840644editdlrm
ReactDOMServerPages.js.map9560644editdlrm
render-result.js72040644editdlrm
render-result.js.map142390644editdlrm
render.js534870644editdlrm
render.js.map854420644editdlrm
request-meta.js13410644editdlrm
request-meta.js.map94330644editdlrm
require-hook.js22770644editdlrm
require-hook.js.map43970644editdlrm
require.js30420644editdlrm
require.js.map61070644editdlrm
revalidation-utils.js29170644editdlrm
revalidation-utils.js.map57080644editdlrm
route-kind.js8290644editdlrm
route-kind.js.map9270644editdlrm
send-payload.js21740644editdlrm
send-payload.js.map42120644editdlrm
send-response.js30400644editdlrm
send-response.js.map45980644editdlrm
serve-static.js13340644editdlrm
serve-static.js.map26030644editdlrm
server-route-utils.js10610644editdlrm
server-route-utils.js.map19990644editdlrm
server-utils.js153150644editdlrm
server-utils.js.map261390644editdlrm
setup-http-agent-env.js8320644editdlrm
setup-http-agent-env.js.map14390644editdlrm
utils.js26720644editdlrm
utils.js.map41390644editdlrm
Edit: /opt/canhelp/node_modules/next/dist/esm/server/render-result.js (7204B)
import { chainStreams, streamFromBuffer, streamFromString, streamToString } from './stream-utils/node-web-streams-helper'; import { isAbortError, pipeToNodeResponse } from './pipe-readable'; import { InvariantError } from '../shared/lib/invariant-error'; export default class RenderResult { static #_ = /** * A render result that represents an empty response. This is used to * represent a response that was not found or was already sent. */ this.EMPTY = new RenderResult(null, { metadata: {}, contentType: null }); /** * Creates a new RenderResult instance from a static response. * * @param value the static response value * @param contentType the content type of the response * @returns a new RenderResult instance */ static fromStatic(value, contentType) { return new RenderResult(value, { metadata: {}, contentType }); } constructor(response, { contentType, waitUntil, metadata }){ this.response = response; this.contentType = contentType; this.metadata = metadata; this.waitUntil = waitUntil; } assignMetadata(metadata) { Object.assign(this.metadata, metadata); } /** * Returns true if the response is null. It can be null if the response was * not found or was already sent. */ get isNull() { return this.response === null; } /** * Returns false if the response is a string. It can be a string if the page * was prerendered. If it's not, then it was generated dynamically. */ get isDynamic() { return typeof this.response !== 'string'; } toUnchunkedString(stream = false) { if (this.response === null) { // If the response is null, return an empty string. This behavior is // intentional as we're now providing the `RenderResult.EMPTY` value. return ''; } if (typeof this.response !== 'string') { if (!stream) { throw Object.defineProperty(new InvariantError('dynamic responses cannot be unchunked. This is a bug in Next.js'), "__NEXT_ERROR_CODE", { value: "E732", enumerable: false, configurable: true }); } return streamToString(this.readable); } return this.response; } /** * Returns a readable stream of the response. */ get readable() { if (this.response === null) { // If the response is null, return an empty stream. This behavior is // intentional as we're now providing the `RenderResult.EMPTY` value. return new ReadableStream({ start (controller) { controller.close(); } }); } if (typeof this.response === 'string') { return streamFromString(this.response); } if (Buffer.isBuffer(this.response)) { return streamFromBuffer(this.response); } // If the response is an array of streams, then chain them together. if (Array.isArray(this.response)) { return chainStreams(...this.response); } return this.response; } /** * Coerces the response to an array of streams. This will convert the response * to an array of streams if it is not already one. * * @returns An array of streams */ coerce() { if (this.response === null) { // If the response is null, return an empty stream. This behavior is // intentional as we're now providing the `RenderResult.EMPTY` value. return []; } if (typeof this.response === 'string') { return [ streamFromString(this.response) ]; } else if (Array.isArray(this.response)) { return this.response; } else if (Buffer.isBuffer(this.response)) { return [ streamFromBuffer(this.response) ]; } else { return [ this.response ]; } } /** * Unshifts a new stream to the response. This will convert the response to an * array of streams if it is not already one and will add the new stream to * the start of the array. When this response is piped, all of the streams * will be piped one after the other. * * @param readable The new stream to unshift */ unshift(readable) { // Coerce the response to an array of streams. this.response = this.coerce(); // Add the new stream to the start of the array. this.response.unshift(readable); } /** * Chains a new stream to the response. This will convert the response to an * array of streams if it is not already one and will add the new stream to * the end. When this response is piped, all of the streams will be piped * one after the other. * * @param readable The new stream to chain */ push(readable) { // Coerce the response to an array of streams. this.response = this.coerce(); // Add the new stream to the end of the array. this.response.push(readable); } /** * Pipes the response to a writable stream. This will close/cancel the * writable stream if an error is encountered. If this doesn't throw, then * the writable stream will be closed or aborted. * * @param writable Writable stream to pipe the response to */ async pipeTo(writable) { try { await this.readable.pipeTo(writable, { // We want to close the writable stream ourselves so that we can wait // for the waitUntil promise to resolve before closing it. If an error // is encountered, we'll abort the writable stream if we swallowed the // error. preventClose: true }); // If there is a waitUntil promise, wait for it to resolve before // closing the writable stream. if (this.waitUntil) await this.waitUntil; // Close the writable stream. await writable.close(); } catch (err) { // If this is an abort error, we should abort the writable stream (as we // took ownership of it when we started piping). We don't need to re-throw // because we handled the error. if (isAbortError(err)) { // Abort the writable stream if an error is encountered. await writable.abort(err); return; } // We're not aborting the writer here as when this method throws it's not // clear as to how so the caller should assume it's their responsibility // to clean up the writer. throw err; } } /** * Pipes the response to a node response. This will close/cancel the node * response if an error is encountered. * * @param res */ async pipeToNodeResponse(res) { await pipeToNodeResponse(this.readable, res, this.waitUntil); } } //# sourceMappingURL=render-result.js.map