Initial boiler plate project
This commit is contained in:
61
node_modules/next/dist/server/app-render/static/static-renderer.d.ts
generated
vendored
Normal file
61
node_modules/next/dist/server/app-render/static/static-renderer.d.ts
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
/// <reference types="react" />
|
||||
import type { Options as RenderToReadableStreamOptions, ResumeOptions } from 'react-dom/server.edge';
|
||||
import type { Options as PrerenderOptions } from 'react-dom/static.edge';
|
||||
type RenderResult = {
|
||||
stream: ReadableStream<Uint8Array>;
|
||||
postponed?: object | null;
|
||||
resumed?: boolean;
|
||||
};
|
||||
export interface Renderer {
|
||||
render(children: JSX.Element): Promise<RenderResult>;
|
||||
}
|
||||
export declare class ServerRenderer implements Renderer {
|
||||
private readonly options;
|
||||
private readonly renderToReadableStream;
|
||||
constructor(options: RenderToReadableStreamOptions);
|
||||
render(children: JSX.Element): Promise<RenderResult>;
|
||||
}
|
||||
export declare class VoidRenderer implements Renderer {
|
||||
render(_children: JSX.Element): Promise<RenderResult>;
|
||||
}
|
||||
/**
|
||||
* This represents all the possible configuration options for each of the
|
||||
* available renderers. We pick the specific options we need for each renderer
|
||||
* to help the `createStaticRenderer` function. If more options are added to
|
||||
* this type they should be added to the `createStaticRenderer` function as
|
||||
* well.
|
||||
*/
|
||||
type StreamOptions = Pick<ResumeOptions & RenderToReadableStreamOptions & PrerenderOptions, 'onError' | 'onPostpone' | 'onHeaders' | 'maxHeadersLength' | 'nonce' | 'bootstrapScripts' | 'formState' | 'signal'>;
|
||||
export declare const DYNAMIC_DATA: 1;
|
||||
export declare const DYNAMIC_HTML: 2;
|
||||
type DynamicDataPostponedState = typeof DYNAMIC_DATA;
|
||||
type DynamicHTMLPostponedState = [typeof DYNAMIC_HTML, object];
|
||||
export type PostponedState = DynamicDataPostponedState | DynamicHTMLPostponedState;
|
||||
export declare function getDynamicHTMLPostponedState(data: object): DynamicHTMLPostponedState;
|
||||
export declare function getDynamicDataPostponedState(): DynamicDataPostponedState;
|
||||
type Options = {
|
||||
/**
|
||||
* Whether or not PPR is enabled. This is used to determine which renderer to
|
||||
* use.
|
||||
*/
|
||||
ppr: boolean;
|
||||
/**
|
||||
* Whether or not this is a static generation render. This is used to
|
||||
* determine which renderer to use.
|
||||
*/
|
||||
isStaticGeneration: boolean;
|
||||
/**
|
||||
* The postponed state for the render. This is only used when resuming a
|
||||
* prerender that has postponed.
|
||||
*/
|
||||
postponed: null | PostponedState;
|
||||
/**
|
||||
* The options for any of the renderers. This is a union of all the possible
|
||||
* options for each renderer. If additional configuration options are required
|
||||
* for a renderer, they should be added to the `StreamOptions` type and then
|
||||
* added via the `createStaticRenderer` function.
|
||||
*/
|
||||
streamOptions: StreamOptions;
|
||||
};
|
||||
export declare function createStaticRenderer({ ppr, isStaticGeneration, postponed, streamOptions: { signal, onError, onPostpone, onHeaders, maxHeadersLength, nonce, bootstrapScripts, formState, }, }: Options): Renderer;
|
||||
export {};
|
||||
165
node_modules/next/dist/server/app-render/static/static-renderer.js
generated
vendored
Normal file
165
node_modules/next/dist/server/app-render/static/static-renderer.js
generated
vendored
Normal file
@ -0,0 +1,165 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
DYNAMIC_DATA: null,
|
||||
DYNAMIC_HTML: null,
|
||||
ServerRenderer: null,
|
||||
VoidRenderer: null,
|
||||
createStaticRenderer: null,
|
||||
getDynamicDataPostponedState: null,
|
||||
getDynamicHTMLPostponedState: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
DYNAMIC_DATA: function() {
|
||||
return DYNAMIC_DATA;
|
||||
},
|
||||
DYNAMIC_HTML: function() {
|
||||
return DYNAMIC_HTML;
|
||||
},
|
||||
ServerRenderer: function() {
|
||||
return ServerRenderer;
|
||||
},
|
||||
VoidRenderer: function() {
|
||||
return VoidRenderer;
|
||||
},
|
||||
createStaticRenderer: function() {
|
||||
return createStaticRenderer;
|
||||
},
|
||||
getDynamicDataPostponedState: function() {
|
||||
return getDynamicDataPostponedState;
|
||||
},
|
||||
getDynamicHTMLPostponedState: function() {
|
||||
return getDynamicHTMLPostponedState;
|
||||
}
|
||||
});
|
||||
class StaticRenderer {
|
||||
constructor(options){
|
||||
this.options = options;
|
||||
this.prerender = process.env.__NEXT_EXPERIMENTAL_REACT ? require("react-dom/static.edge").prerender : null;
|
||||
}
|
||||
async render(children) {
|
||||
const { prelude, postponed } = await this.prerender(children, this.options);
|
||||
return {
|
||||
stream: prelude,
|
||||
postponed
|
||||
};
|
||||
}
|
||||
}
|
||||
class StaticResumeRenderer {
|
||||
constructor(postponed, options){
|
||||
this.postponed = postponed;
|
||||
this.options = options;
|
||||
this.resume = require("react-dom/server.edge").resume;
|
||||
}
|
||||
async render(children) {
|
||||
const stream = await this.resume(children, this.postponed, this.options);
|
||||
return {
|
||||
stream,
|
||||
resumed: true
|
||||
};
|
||||
}
|
||||
}
|
||||
class ServerRenderer {
|
||||
constructor(options){
|
||||
this.options = options;
|
||||
this.renderToReadableStream = require("react-dom/server.edge").renderToReadableStream;
|
||||
}
|
||||
async render(children) {
|
||||
const stream = await this.renderToReadableStream(children, this.options);
|
||||
return {
|
||||
stream
|
||||
};
|
||||
}
|
||||
}
|
||||
class VoidRenderer {
|
||||
async render(_children) {
|
||||
return {
|
||||
stream: new ReadableStream({
|
||||
start (controller) {
|
||||
// Close the stream immediately
|
||||
controller.close();
|
||||
}
|
||||
}),
|
||||
resumed: false
|
||||
};
|
||||
}
|
||||
}
|
||||
const DYNAMIC_DATA = 1;
|
||||
const DYNAMIC_HTML = 2;
|
||||
function getDynamicHTMLPostponedState(data) {
|
||||
return [
|
||||
DYNAMIC_HTML,
|
||||
data
|
||||
];
|
||||
}
|
||||
function getDynamicDataPostponedState() {
|
||||
return DYNAMIC_DATA;
|
||||
}
|
||||
function createStaticRenderer({ ppr, isStaticGeneration, postponed, streamOptions: { signal, onError, onPostpone, onHeaders, maxHeadersLength, nonce, bootstrapScripts, formState } }) {
|
||||
if (ppr) {
|
||||
if (isStaticGeneration) {
|
||||
// This is a Prerender
|
||||
return new StaticRenderer({
|
||||
signal,
|
||||
onError,
|
||||
onPostpone,
|
||||
// We want to capture headers because we may not end up with a shell
|
||||
// and being able to send headers is the next best thing
|
||||
onHeaders,
|
||||
maxHeadersLength,
|
||||
bootstrapScripts
|
||||
});
|
||||
} else {
|
||||
// This is a Resume
|
||||
if (postponed === DYNAMIC_DATA) {
|
||||
// The HTML was complete, we don't actually need to render anything
|
||||
return new VoidRenderer();
|
||||
} else if (postponed) {
|
||||
const reactPostponedState = postponed[1];
|
||||
// The HTML had dynamic holes and we need to resume it
|
||||
return new StaticResumeRenderer(reactPostponedState, {
|
||||
signal,
|
||||
onError,
|
||||
onPostpone,
|
||||
nonce
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isStaticGeneration) {
|
||||
// This is a static render (without PPR)
|
||||
return new ServerRenderer({
|
||||
signal,
|
||||
onError,
|
||||
// We don't pass onHeaders. In static builds we will either have no output
|
||||
// or the entire page. In either case preload headers aren't necessary and could
|
||||
// alter the prioritiy of relative loading of resources so we opt to keep them
|
||||
// as tags exclusively.
|
||||
nonce,
|
||||
bootstrapScripts,
|
||||
formState
|
||||
});
|
||||
}
|
||||
// This is a dynamic render (without PPR)
|
||||
return new ServerRenderer({
|
||||
signal,
|
||||
onError,
|
||||
// Static renders are streamed in realtime so sending headers early is
|
||||
// generally good because it will likely go out before the shell is ready.
|
||||
onHeaders,
|
||||
maxHeadersLength,
|
||||
nonce,
|
||||
bootstrapScripts,
|
||||
formState
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=static-renderer.js.map
|
||||
1
node_modules/next/dist/server/app-render/static/static-renderer.js.map
generated
vendored
Normal file
1
node_modules/next/dist/server/app-render/static/static-renderer.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/server/app-render/static/static-renderer.ts"],"names":["DYNAMIC_DATA","DYNAMIC_HTML","ServerRenderer","VoidRenderer","createStaticRenderer","getDynamicDataPostponedState","getDynamicHTMLPostponedState","StaticRenderer","constructor","options","prerender","process","env","__NEXT_EXPERIMENTAL_REACT","require","render","children","prelude","postponed","stream","StaticResumeRenderer","resume","resumed","renderToReadableStream","_children","ReadableStream","start","controller","close","data","ppr","isStaticGeneration","streamOptions","signal","onError","onPostpone","onHeaders","maxHeadersLength","nonce","bootstrapScripts","formState","reactPostponedState"],"mappings":";;;;;;;;;;;;;;;;;;;;IA4FaA,YAAY;eAAZA;;IACAC,YAAY;eAAZA;;IA9CAC,cAAc;eAAdA;;IAYAC,YAAY;eAAZA;;IAgFGC,oBAAoB;eAApBA;;IAhCAC,4BAA4B;eAA5BA;;IANAC,4BAA4B;eAA5BA;;;AArFhB,MAAMC;IAMJC,YAAY,AAAiBC,OAAyB,CAAE;aAA3BA,UAAAA;aAJZC,YAAaC,QAAQC,GAAG,CAACC,yBAAyB,GAC/DC,QAAQ,yBAAyBJ,SAAS,GAC1C;IAEqD;IAEzD,MAAaK,OAAOC,QAAqB,EAAE;QACzC,MAAM,EAAEC,OAAO,EAAEC,SAAS,EAAE,GAAG,MAAM,IAAI,CAACR,SAAS,CAACM,UAAU,IAAI,CAACP,OAAO;QAE1E,OAAO;YAAEU,QAAQF;YAASC;QAAU;IACtC;AACF;AAEA,MAAME;IAIJZ,YACE,AAAiBU,SAAiB,EAClC,AAAiBT,OAAsB,CACvC;aAFiBS,YAAAA;aACAT,UAAAA;aALFY,SAASP,QAAQ,yBAC/BO,MAAM;IAKN;IAEH,MAAaN,OAAOC,QAAqB,EAAE;QACzC,MAAMG,SAAS,MAAM,IAAI,CAACE,MAAM,CAACL,UAAU,IAAI,CAACE,SAAS,EAAE,IAAI,CAACT,OAAO;QAEvE,OAAO;YAAEU;YAAQG,SAAS;QAAK;IACjC;AACF;AAEO,MAAMpB;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O,IAAI7B,eAAe;YACxB+B;YACAC;YACA,0EAA0E;YAC1E,gFAAgF;YAChF,8EAA8E;YAC9E,uBAAuB;YACvBI;YACAC;YACAC;QACF;IACF;IAEA,yCAAyC;IACzC,OAAO,IAAItC,eAAe;QACxB+B;QACAC;QACA,sEAAsE;QACtE,0EAA0E;QAC1EE;QACAC;QACAC;QACAC;QACAC;IACF;AACF"}
|
||||
Reference in New Issue
Block a user