@lomray/vite-ssr-boost 8.4.0-beta.4 → 8.4.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -0
- package/adapters/express/prepare-server.js +1 -1
- package/adapters/express/prepare-server.js.map +1 -1
- package/adapters/express/render.js +1 -1
- package/adapters/express/render.js.map +1 -1
- package/adapters/express/route-assets.d.ts +8 -0
- package/adapters/express/route-assets.js +2 -0
- package/adapters/express/route-assets.js.map +1 -0
- package/browser/entry.js.map +1 -1
- package/cli/commands.d.ts +1 -0
- package/cli/commands.js +2 -0
- package/cli/commands.js.map +1 -0
- package/cli/helpers/enable-shortcuts.d.ts +5 -0
- package/cli/helpers/enable-shortcuts.js +2 -0
- package/cli/helpers/enable-shortcuts.js.map +1 -0
- package/cli/run-prod.js +1 -1
- package/cli/run-prod.js.map +1 -1
- package/cli/start.d.ts +10 -0
- package/cli/start.js +2 -0
- package/cli/start.js.map +1 -0
- package/cli.js +1 -1
- package/cli.js.map +1 -1
- package/cloudflare.d.ts +5 -3
- package/cloudflare.js +1 -1
- package/cloudflare.js.map +1 -1
- package/core/cache-control.d.ts +4 -0
- package/core/cache-control.js +1 -1
- package/core/cache-control.js.map +1 -1
- package/core/conditional-request.d.ts +2 -1
- package/core/conditional-request.js +1 -1
- package/core/conditional-request.js.map +1 -1
- package/core/copy-loader-headers.d.ts +1 -1
- package/core/copy-loader-headers.js +1 -1
- package/core/copy-loader-headers.js.map +1 -1
- package/core/document-headers.js +1 -1
- package/core/document-headers.js.map +1 -1
- package/core/handler.js +1 -1
- package/core/handler.js.map +1 -1
- package/core/render.js +1 -1
- package/core/render.js.map +1 -1
- package/core/spa-html.js.map +1 -1
- package/core/spa-shell.js +1 -1
- package/core/spa-shell.js.map +1 -1
- package/core/ssr-policy.d.ts +37 -4
- package/core/ssr-policy.js +1 -1
- package/core/ssr-policy.js.map +1 -1
- package/helpers/print-server-info.js +1 -1
- package/helpers/print-server-info.js.map +1 -1
- package/http.d.ts +12 -0
- package/node/production.d.ts +3 -3
- package/package.json +5 -3
- package/services/build.d.ts +4 -0
- package/services/build.js +1 -1
- package/services/build.js.map +1 -1
- package/services/diagnostics.d.ts +18 -1
- package/services/diagnostics.js.map +1 -1
- package/services/production-config.d.ts +15 -0
- package/services/production-config.js +2 -0
- package/services/production-config.js.map +1 -0
- package/services/request-timeline.d.ts +31 -2
- package/services/request-timeline.js +1 -1
- package/services/request-timeline.js.map +1 -1
- package/services/route-asset-preparer.js.map +1 -1
- package/services/route-assets-memory.d.ts +20 -8
- package/services/route-assets-memory.js +1 -1
- package/services/route-assets-memory.js.map +1 -1
- package/services/server-config.d.ts +1 -0
- package/services/server-config.js +1 -1
- package/services/server-config.js.map +1 -1
- package/services/ssr-manifest.d.ts +4 -4
- package/services/ssr-manifest.js +1 -1
- package/services/ssr-manifest.js.map +1 -1
- package/testing/browser-observer.d.ts +13 -7
- package/testing/browser-observer.js +1 -1
- package/testing/browser-observer.js.map +1 -1
- package/testing/create-handler.d.ts +1 -0
- package/testing/create-handler.js.map +1 -1
- package/testing/deferred.js.map +1 -1
- package/testing/edge.d.ts +12 -0
- package/testing/edge.js.map +1 -1
- package/testing/parse-response.js.map +1 -1
- package/testing/playwright.d.ts +2 -0
- package/testing/playwright.js +1 -1
- package/testing/playwright.js.map +1 -1
- package/testing/requests.d.ts +3 -0
- package/testing/requests.js.map +1 -1
- package/testing/response.d.ts +49 -3
- package/testing/response.js +1 -1
- package/testing/response.js.map +1 -1
- package/testing.d.ts +12 -0
- package/testing.js.map +1 -1
package/core/render.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"react";import{matchRoutes as t,createStaticRouter as r,StaticRouterProvider as s}from"react-router";import o from"../constants/stream-error.js";import{ServerProvider as a}from"../context/server.js";import n from"./compose-html.js";import i from"./data-stream.js";import c,{hasCookie as d}from"./document-headers.js";import l from"./head-response.js";import{mergeResponseHeaders as m}from"./headers.js";import h from"./transform-html.js";import u from"../helpers/build-custom-state.js";import p from"../helpers/obtain-stream-error.js";import{createTimeline as C}from"../services/request-timeline.js";const f="text/html",w="Content-Type",x=async({createApp:d,handler:C,renderToStream:x,policy:y,spaShell:R},S,{abortDelay:b=15e3,getState:q,hydration:v="footer",nonce:g,bootstrapScriptContent:E,onError:j,onResponse:k,onRouterReady:H,onShellError:P,onShellReady:T,prepare:A,routerRequestContext:B,documentHeaders:D,sessionCookie:L,protectPrivate:_},$)=>{const I=y?.select(S.request,S.diagnostics)??"ssr";if(y?.active&&!S.response.headers.has("Cache-Control")&&S.response.headers.set("Cache-Control","no-store"),"spa"===I)return S.isSpa=!0,S.isStream=!1,S.matches=t(C.dataRoutes,new URL(S.request.url),y?.basename)??[],S.html=R(S.html),await(A?.({context:S,executionContext:$})),D&&(S.response.headers=c(D,{sessionCookie:L,protectPrivate:_})(S)),S.response.status=200,S.response.headers.set(w,"text/html; charset=utf-8"),new Response("HEAD"===S.request.method?null:S.html.header+S.html.footer,{headers:S.response.headers,status:200});const U=await C.query(S.request,{requestContext:B??S});if(S.timeline?.record("router.query"),U instanceof Response)return l(S.request,m(U,S.response.headers));S.routerContext=U,S.matches=U.matches;const z=new i(U,S.diagnostics,g,S.timeline);try{await(A?.({context:S,executionContext:$})),S.timeline?.record("prepare")}catch(e){throw z.cancel(),e}const{isStream:F=!0}=await(H?.({context:S}))??{};S.isStream=F,S.serverContext={basename:S.routerContext.basename,isServer:!0,response:null};const G=r(C.dataRoutes,S.routerContext),J=e.createElement(a,{context:S.serverContext},d(e.createElement(s,{router:G,context:S.routerContext,hydrate:!1}),S)),K=new AbortController;let M,N,O=!1;const Q=()=>X(S.request.signal.reason),V=()=>clearTimeout(Y),W=()=>{V(),S.request.signal.removeEventListener("abort",Q)},X=e=>{O||(O=!0,M=e,S.timeline?.abort(e),W(),S.didError??=o.RenderCancel,z.abort(),K.abort(e),N?.abort(e))},Y=setTimeout(()=>{S.didError=o.RenderTimeout,S.timeline?.abort(new Error(`SSR render timed out after ${b}ms`)),X()},b);S.request.signal.aborted?X(S.request.signal.reason):S.request.signal.addEventListener("abort",Q,{once:!0});try{N=await x(J,{nonce:g,bootstrapScriptContent:"early"===v&&F?`(window.__ssrBoostStream = window.__ssrBoostStream || []).push(["shell"]);${E??""};document.currentScript?.remove();`:E,onError:e=>{const t=p(e);!O||t.code!==o.RenderAborted&&e!==K.signal.reason||(t.code=S.didError===o.RenderTimeout?o.RenderTimeout:o.RenderCancel);const{code:r}=t;S.didError??=r,j?.({context:S,error:t})},signal:K.signal}),O&&N.abort(M),Promise.all([N.allReady,z.done]).then(V,V),await N.shellReady,S.timeline?.record("shell.ready"),F||await Promise.all([N.allReady,z.done])}catch(e){return X(e),await(N?.stream.cancel(e).catch(()=>{})),((e,t,r)=>{const s=t instanceof Error?t:new Error(String(t)),o=r?.({context:e,error:s})||"<!doctype html><p>Internal Server Error</p>",a=new Headers(e.response.headers);return a.set(w,f),new Response("HEAD"===e.request.method?null:o,{headers:a,status:500})})(S,e,P)}try{const e=S.serverContext.response;if(e&&(Z=e,Boolean(Z&&Z.status>=300&&Z.status<400&&Z.headers.has("Location"))))return X(),await N.stream.cancel().catch(()=>{}),l(S.request,m(e,S.response.headers));const{header:t,footer:r,headers:s,status:o}=((e,{getState:t,onShellReady:r,hydration:s,nonce:o,documentHeaders:a,sessionCookie:n,protectPrivate:i},d)=>{const l=e.serverContext.response;e.response.status=l?.status??e.response.status??e.routerContext.statusCode??200,e.response.headers.has(w)||e.response.headers.set(w,f);const m=r?.({context:e})??{},h="early"===s&&e.isStream,p=u(t?.({context:e}),e.diagnostics,o,Boolean(h));let C=m.header||e.html.header;const x=m.footer||e.html.footer;e.diagnostics?.inspectShell({header:C,footer:x});let y=x;return h?C+=p+d.state(!0):y=p+d.state(!1)+d.take()+y,a&&(e.response.headers=c(a,{sessionCookie:n,protectPrivate:i})(e)),{header:C,footer:y,headers:new Headers(e.response.headers),status:e.response.status}})(S,{getState:q,onShellReady:T,hydration:v,nonce:g,documentHeaders:D,sessionCookie:L,protectPrivate:_},z);if("HEAD"===S.request.method||[204,205,304].includes(o))return X(),await N.stream.cancel().catch(()=>{}),new Response(null,{headers:s,status:o});const a=n(t,N.stream,r,X,W,z,S.timeline,"early"===v&&F),i=h(a,k?(e,t)=>k({context:S,html:e,isEnd:t}):void 0,S.diagnostics);return N.start(),new Response(i,{headers:s,status:o})}catch(e){throw X(e),N.stream.locked||await N.stream.cancel(e).catch(()=>{}),e}var Z},y=async(e,t,r,s)=>{const o=t.timeline??C(t.request,Boolean(t.diagnostics));o&&(t.timeline=o);try{const a=await x(e,t,r,s);return t.diagnostics?.inspectCachePolicy(a.headers,Boolean(
|
|
1
|
+
import e from"react";import{matchRoutes as t,createStaticRouter as r,StaticRouterProvider as s}from"react-router";import o from"../constants/stream-error.js";import{ServerProvider as a}from"../context/server.js";import n from"./compose-html.js";import i from"./data-stream.js";import c,{hasCookie as d}from"./document-headers.js";import l from"./head-response.js";import{mergeResponseHeaders as m}from"./headers.js";import h from"./transform-html.js";import u from"../helpers/build-custom-state.js";import p from"../helpers/obtain-stream-error.js";import{createTimeline as C}from"../services/request-timeline.js";const f="text/html",w="Content-Type",x=async({createApp:d,handler:C,renderToStream:x,policy:y,spaShell:R},S,{abortDelay:b=15e3,getState:q,hydration:v="footer",nonce:g,bootstrapScriptContent:E,onError:j,onResponse:k,onRouterReady:H,onShellError:P,onShellReady:T,prepare:A,routerRequestContext:B,documentHeaders:D,sessionCookie:L,protectPrivate:_},$)=>{const I=y?.select(S.request,S.diagnostics)??"ssr";if(y?.active&&!S.response.headers.has("Cache-Control")&&S.response.headers.set("Cache-Control","no-store"),"spa"===I)return S.isSpa=!0,S.isStream=!1,S.matches=t(C.dataRoutes,new URL(S.request.url),y?.basename)??[],S.html=R(S.html),await(A?.({context:S,executionContext:$})),D&&(S.response.headers=c(D,{sessionCookie:L,protectPrivate:_})(S)),S.response.status=200,S.response.headers.set(w,"text/html; charset=utf-8"),new Response("HEAD"===S.request.method?null:S.html.header+S.html.footer,{headers:S.response.headers,status:200});const U=await C.query(S.request,{requestContext:B??S});if(S.timeline?.record("router.query"),U instanceof Response)return l(S.request,m(U,S.response.headers));S.routerContext=U,S.matches=U.matches;const z=new i(U,S.diagnostics,g,S.timeline);try{await(A?.({context:S,executionContext:$})),S.timeline?.record("prepare")}catch(e){throw z.cancel(),e}const{isStream:F=!0}=await(H?.({context:S}))??{};S.isStream=F,S.serverContext={basename:S.routerContext.basename,isServer:!0,response:null};const G=r(C.dataRoutes,S.routerContext),J=e.createElement(a,{context:S.serverContext},d(e.createElement(s,{router:G,context:S.routerContext,hydrate:!1}),S)),K=new AbortController;let M,N,O=!1;const Q=()=>X(S.request.signal.reason),V=()=>clearTimeout(Y),W=()=>{V(),S.request.signal.removeEventListener("abort",Q)},X=e=>{O||(O=!0,M=e,S.timeline?.abort(e),W(),S.didError??=o.RenderCancel,z.abort(),K.abort(e),N?.abort(e))},Y=setTimeout(()=>{S.didError=o.RenderTimeout,S.timeline?.abort(new Error(`SSR render timed out after ${b}ms`)),X()},b);S.request.signal.aborted?X(S.request.signal.reason):S.request.signal.addEventListener("abort",Q,{once:!0});try{N=await x(J,{nonce:g,bootstrapScriptContent:"early"===v&&F?`(window.__ssrBoostStream = window.__ssrBoostStream || []).push(["shell"]);${E??""};document.currentScript?.remove();`:E,onError:e=>{const t=p(e);!O||t.code!==o.RenderAborted&&e!==K.signal.reason||(t.code=S.didError===o.RenderTimeout?o.RenderTimeout:o.RenderCancel);const{code:r}=t;S.didError??=r,j?.({context:S,error:t})},signal:K.signal}),O&&N.abort(M),Promise.all([N.allReady,z.done]).then(V,V),await N.shellReady,S.timeline?.record("shell.ready"),F||await Promise.all([N.allReady,z.done])}catch(e){return X(e),await(N?.stream.cancel(e).catch(()=>{})),((e,t,r)=>{const s=t instanceof Error?t:new Error(String(t)),o=r?.({context:e,error:s})||"<!doctype html><p>Internal Server Error</p>",a=new Headers(e.response.headers);return a.set(w,f),new Response("HEAD"===e.request.method?null:o,{headers:a,status:500})})(S,e,P)}try{const e=S.serverContext.response;if(e&&(Z=e,Boolean(Z&&Z.status>=300&&Z.status<400&&Z.headers.has("Location"))))return X(),await N.stream.cancel().catch(()=>{}),l(S.request,m(e,S.response.headers));const{header:t,footer:r,headers:s,status:o}=((e,{getState:t,onShellReady:r,hydration:s,nonce:o,documentHeaders:a,sessionCookie:n,protectPrivate:i},d)=>{const l=e.serverContext.response;e.response.status=l?.status??e.response.status??e.routerContext.statusCode??200,e.response.headers.has(w)||e.response.headers.set(w,f);const m=r?.({context:e})??{},h="early"===s&&e.isStream,p=u(t?.({context:e}),e.diagnostics,o,Boolean(h));let C=m.header||e.html.header;const x=m.footer||e.html.footer;e.diagnostics?.inspectShell({header:C,footer:x});let y=x;return h?C+=p+d.state(!0):y=p+d.state(!1)+d.take()+y,a&&(e.response.headers=c(a,{sessionCookie:n,protectPrivate:i})(e)),{header:C,footer:y,headers:new Headers(e.response.headers),status:e.response.status}})(S,{getState:q,onShellReady:T,hydration:v,nonce:g,documentHeaders:D,sessionCookie:L,protectPrivate:_},z);if("HEAD"===S.request.method||[204,205,304].includes(o))return X(),await N.stream.cancel().catch(()=>{}),new Response(null,{headers:s,status:o});const a=n(t,N.stream,r,X,W,z,S.timeline,"early"===v&&F),i=h(a,k?(e,t)=>k({context:S,html:e,isEnd:t}):void 0,S.diagnostics);return N.start(),new Response(i,{headers:s,status:o})}catch(e){throw X(e),N.stream.locked||await N.stream.cancel(e).catch(()=>{}),e}var Z},y=async(e,t,r,s)=>{const o=t.timeline??C(t.request,Boolean(t.diagnostics));o&&(t.timeline=o);try{const a=await x(e,t,r,s),{sessionCookie:n}=r;return t.diagnostics?.inspectCachePolicy(a.headers,Boolean(n&&d(t.request,n))),o?.response(a)??a}catch(e){throw o?.abort(e),o?.end(),e}};export{y as default};
|
|
2
2
|
//# sourceMappingURL=render.js.map
|
package/core/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sources":["../../src/core/render.tsx"],"sourcesContent":[null],"names":["HTML_CONTENT_TYPE","CONTENT_TYPE","renderResponse","async","createApp","handler","renderToStream","policy","spaShell","context","abortDelay","getState","hydration","nonce","bootstrapScriptContent","onError","onResponse","onRouterReady","onShellError","onShellReady","prepare","routerRequestContext","documentHeaders","rules","sessionCookie","protectPrivate","executionContext","mode","select","request","diagnostics","active","response","headers","has","set","isSpa","isStream","matches","matchRoutes","dataRoutes","URL","url","basename","html","status","Response","method","header","footer","queried","query","requestContext","timeline","record","headResponse","mergeResponseHeaders","routerContext","dataStream","DataStream","error","cancel","serverContext","isServer","router","createStaticRouter","node","React","createElement","ServerProvider","StaticRouterProvider","hydrate","renderController","AbortController","abortReason","output","hasAborted","onRequestAbort","abort","signal","reason","clearAbortTimer","clearTimeout","abortTimer","cleanup","removeEventListener","didError","StreamError","RenderCancel","setTimeout","RenderTimeout","Error","aborted","addEventListener","once","streamError","obtainStreamError","code","RenderAborted","Promise","all","allReady","done","then","shellReady","stream","catch","shellError","String","Headers","createShellErrorResponse","serverResponse","Boolean","statusCode","shell","isEarly","customState","buildCustomState","shellFooter","inspectShell","state","take","prepareHtmlResponse","includes","body","composeHtml","transformed","transformHtml","isEnd","undefined","start","locked","render","params","options","createTimeline","inspectCachePolicy","hasCookie","end"],"mappings":"
|
|
1
|
+
{"version":3,"file":"render.js","sources":["../../src/core/render.tsx"],"sourcesContent":[null],"names":["HTML_CONTENT_TYPE","CONTENT_TYPE","renderResponse","async","createApp","handler","renderToStream","policy","spaShell","context","abortDelay","getState","hydration","nonce","bootstrapScriptContent","onError","onResponse","onRouterReady","onShellError","onShellReady","prepare","routerRequestContext","documentHeaders","rules","sessionCookie","protectPrivate","executionContext","mode","select","request","diagnostics","active","response","headers","has","set","isSpa","isStream","matches","matchRoutes","dataRoutes","URL","url","basename","html","status","Response","method","header","footer","queried","query","requestContext","timeline","record","headResponse","mergeResponseHeaders","routerContext","dataStream","DataStream","error","cancel","serverContext","isServer","router","createStaticRouter","node","React","createElement","ServerProvider","StaticRouterProvider","hydrate","renderController","AbortController","abortReason","output","hasAborted","onRequestAbort","abort","signal","reason","clearAbortTimer","clearTimeout","abortTimer","cleanup","removeEventListener","didError","StreamError","RenderCancel","setTimeout","RenderTimeout","Error","aborted","addEventListener","once","streamError","obtainStreamError","code","RenderAborted","Promise","all","allReady","done","then","shellReady","stream","catch","shellError","String","Headers","createShellErrorResponse","serverResponse","Boolean","statusCode","shell","isEarly","customState","buildCustomState","shellFooter","inspectShell","state","take","prepareHtmlResponse","includes","body","composeHtml","transformed","transformHtml","isEnd","undefined","start","locked","render","params","options","createTimeline","inspectCachePolicy","hasCookie","end"],"mappings":"qmBAmJA,MAAMA,EAAoB,YACpBC,EAAe,eA2FfC,EAAiBC,OACnBC,YAAWC,UAASC,iBAAgBC,SAAQC,YAC9CC,GAEEC,aAAa,KACbC,WACAC,YAAY,SACZC,QACAC,yBACAC,UACAC,aACAC,gBACAC,eACAC,eACAC,UACAC,uBACAC,gBAAiBC,EACjBC,gBACAC,kBAEFC,KAEA,MAAMC,EAAOpB,GAAQqB,OAAOnB,EAAQoB,QAASpB,EAAQqB,cAAgB,MAMrE,GAJIvB,GAAQwB,SAAWtB,EAAQuB,SAASC,QAAQC,IAAI,kBAClDzB,EAAQuB,SAASC,QAAQE,IAAI,gBAAiB,YAGnC,QAATR,EAiBF,OAhBAlB,EAAQ2B,OAAQ,EAChB3B,EAAQ4B,UAAW,EACnB5B,EAAQ6B,QACNC,EAAYlC,EAAQmC,WAAY,IAAIC,IAAIhC,EAAQoB,QAAQa,KAAMnC,GAAQoC,WAAa,GACrFlC,EAAQmC,KAAOpC,EAAUC,EAAQmC,YAE3BxB,IAAU,CAAEX,UAASiB,sBAGvBH,IACFd,EAAQuB,SAASC,QAAUX,EAAgBC,EAAO,CAAEC,gBAAeC,kBAAxCH,CAA0Db,IAGvFA,EAAQuB,SAASa,OAAS,IAC1BpC,EAAQuB,SAASC,QAAQE,IAAIlC,EAAc,4BAEp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,QAAiB9B,EAAemI,EAAQ5H,EAAS6H,EAAS5G,IAC1DF,cAAEA,GAAkB8G,EAO1B,OALA7H,EAAQqB,aAAa0G,mBACnBxG,EAASC,QACT+E,QAAQxF,GAAiBiH,EAAUhI,EAAQoB,QAASL,KAG/C6B,GAAUrB,SAASA,IAAaA,CACzC,CAAE,MAAO4B,GAGP,MAFAP,GAAUyB,MAAMlB,GAChBP,GAAUqF,MACJ9E,CACR"}
|
package/core/spa-html.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spa-html.js","sources":["../../src/core/spa-html.ts"],"sourcesContent":[null],"names":["createSpaHtml","html","rootId","isMarked","result","replace","tag","id","exec","test"],"mappings":"AAIA,MAAMA,EAAgB,CAACC,EAAcC,EAAS,UAC5C,IAAIC,GAAW,
|
|
1
|
+
{"version":3,"file":"spa-html.js","sources":["../../src/core/spa-html.ts"],"sourcesContent":[null],"names":["createSpaHtml","html","rootId","isMarked","result","replace","tag","id","exec","test"],"mappings":"AAIA,MAAMA,EAAgB,CAACC,EAAcC,EAAS,UAC5C,IAAIC,GAAW,EAKf,MAAMC,EAASH,EAAKI,QAAQ,iBAAmBC,IAC7C,MAAMC,EAAK,2BAA2BC,KAAKF,KAAO,GAElD,OAAIC,IAAOL,EACFI,GAGTH,GAAW,EAEJ,uBAAuBM,KAAKH,GAC/BA,EAAID,QAAQ,qCAAsC,sBAClDC,EAAID,QAAQ,2BAA4B,4BAM9C,OAAOF,EACHC,EACAA,EAAOC,QAAQ,iBAAmBC,GAChC,uBAAuBG,KAAKH,GACxBA,EAAID,QAAQ,qCAAsC,sBAClDC,EAAID,QAAQ,WAAY"}
|
package/core/spa-shell.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"./spa-html.js";const r=()=>{let r,o;return
|
|
1
|
+
import e from"./spa-html.js";const r=()=>{let r,t;return o=>{const{header:a,footer:f}=o;return r?.header===a&&r?.footer===f||(r={...o},t={header:e(a),footer:f}),{...t}}};export{r as default};
|
|
2
2
|
//# sourceMappingURL=spa-shell.js.map
|
package/core/spa-shell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spa-shell.js","sources":["../../src/core/spa-shell.ts"],"sourcesContent":[null],"names":["createSpaShell","source","shell","html","header","footer","createSpaHtml"],"mappings":"6BAOA,MAAMA,EAAiB,KACrB,IAAIC,EACAC,
|
|
1
|
+
{"version":3,"file":"spa-shell.js","sources":["../../src/core/spa-shell.ts"],"sourcesContent":[null],"names":["createSpaShell","source","shell","html","header","footer","createSpaHtml"],"mappings":"6BAOA,MAAMA,EAAiB,KACrB,IAAIC,EACAC,EAKJ,OAAQC,IACN,MAAMC,OAAEA,EAAMC,OAAEA,GAAWF,EAO3B,OALIF,GAAQG,SAAWA,GAAUH,GAAQI,SAAWA,IAClDJ,EAAS,IAAKE,GACdD,EAAQ,CAAEE,OAAQE,EAAcF,GAASC,WAGpC,IAAKH"}
|
package/core/ssr-policy.d.ts
CHANGED
|
@@ -2,9 +2,12 @@ import type { StaticHandler } from 'react-router';
|
|
|
2
2
|
import type Diagnostics from '../services/diagnostics.js';
|
|
3
3
|
type TRenderMode = 'ssr' | 'spa';
|
|
4
4
|
interface ISsrPolicy {
|
|
5
|
+
/** Select all routes by default. */
|
|
5
6
|
mode?: 'all' | 'include' | 'exclude';
|
|
6
7
|
routes?: (string | RegExp)[];
|
|
8
|
+
/** Render crawlers with SSR by default, regardless of route policy. */
|
|
7
9
|
bots?: 'ssr' | 'policy';
|
|
10
|
+
/** Return undefined to keep the matched policy decision. */
|
|
8
11
|
decide?: (params: {
|
|
9
12
|
request: Request;
|
|
10
13
|
url: URL;
|
|
@@ -27,25 +30,55 @@ declare const routePaths: (routes: StaticHandler["dataRoutes"], parent?: string)
|
|
|
27
30
|
* Snapshot environment policy when the application entry/handler is created at startup.
|
|
28
31
|
*/
|
|
29
32
|
declare class SsrPolicy {
|
|
33
|
+
/**
|
|
34
|
+
* Skip policy work when every request uses SSR.
|
|
35
|
+
*/
|
|
30
36
|
readonly active: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Keep policy paths aligned with the router's mount path.
|
|
39
|
+
*/
|
|
31
40
|
readonly basename: string;
|
|
41
|
+
/**
|
|
42
|
+
* Retain compiled inclusion and exclusion checks.
|
|
43
|
+
*/
|
|
32
44
|
protected readonly patterns: IPolicyPattern[];
|
|
45
|
+
/**
|
|
46
|
+
* Choose how unmatched requests are rendered.
|
|
47
|
+
*/
|
|
33
48
|
protected readonly mode: NonNullable<ISsrPolicy['mode']>;
|
|
49
|
+
/**
|
|
50
|
+
* Control whether crawlers bypass route policy.
|
|
51
|
+
*/
|
|
34
52
|
protected readonly bots: NonNullable<ISsrPolicy['bots']>;
|
|
53
|
+
/**
|
|
54
|
+
* Allow application decisions after route matching.
|
|
55
|
+
*/
|
|
35
56
|
protected readonly decide?: ISsrPolicy['decide'];
|
|
57
|
+
/**
|
|
58
|
+
* Identify the effective configuration in diagnostics.
|
|
59
|
+
*/
|
|
36
60
|
protected readonly source: string;
|
|
61
|
+
/**
|
|
62
|
+
* Retain declared paths for policy diagnostics.
|
|
63
|
+
*/
|
|
37
64
|
protected readonly paths: ReturnType<typeof routePaths>;
|
|
65
|
+
/**
|
|
66
|
+
* Inspect configured patterns only once per policy.
|
|
67
|
+
*/
|
|
38
68
|
protected hasInspected: boolean;
|
|
39
|
-
constructor({ mode, routes, bots, decide }?: ISsrPolicy, dataRoutes?: StaticHandler['dataRoutes'], basename?: string, env?: string | undefined);
|
|
40
69
|
/**
|
|
41
|
-
*
|
|
42
|
-
* A global 404 catch-all must not hide a misspelled policy.
|
|
70
|
+
* Compile the startup policy with environment overrides taking precedence.
|
|
43
71
|
*/
|
|
44
|
-
|
|
72
|
+
constructor({ mode, routes, bots, decide }?: ISsrPolicy, dataRoutes?: StaticHandler['dataRoutes'], basename?: string, env?: string | undefined);
|
|
45
73
|
/**
|
|
46
74
|
* Crawler protection wins over both runtime decisions and environment rollback rules.
|
|
47
75
|
*/
|
|
48
76
|
select(request: Request, diagnostics?: Diagnostics): TRenderMode;
|
|
77
|
+
/**
|
|
78
|
+
* Explain typos using declared paths, including concrete URLs for dynamic route ids.
|
|
79
|
+
* A global 404 catch-all must not hide a misspelled policy.
|
|
80
|
+
*/
|
|
81
|
+
protected inspect(diagnostics?: Diagnostics): void;
|
|
49
82
|
}
|
|
50
83
|
export type { ISsrPolicy, TRenderMode };
|
|
51
84
|
export default SsrPolicy;
|
package/core/ssr-policy.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{isbot as t}from"isbot";import{pathToRegexp as e}from"path-to-regexp";import{matchPath as s}from"react-router";const i=(t,s)=>{if(""===t)throw new Error("SSR route patterns cannot be empty.");const i="string"==typeof t?e(t).regexp:new RegExp(t.source,t.flags);return{pattern:t,exclude:s,test:t=>(i.lastIndex=0,i.test(t))}},r=(t,e="")=>t.flatMap(t=>{const
|
|
1
|
+
import{isbot as t}from"isbot";import{pathToRegexp as e}from"path-to-regexp";import{matchPath as s}from"react-router";const i=(t,s)=>{if(""===t)throw new Error("SSR route patterns cannot be empty.");const i="string"==typeof t?e(t).regexp:new RegExp(t.source,t.flags);return{pattern:t,exclude:s,test:t=>(i.lastIndex=0,i.test(t))}},r=(t,e="")=>t.flatMap(({id:t,path:s,children:i})=>{const a=(s?.startsWith("/")?s:`${e}/${s??""}`).replace(/\/+/g,"/").replace(/\/$/,"")||"/";return[{id:t,path:a},...r(i??[],a)]});class a{active;basename;patterns;mode;bots;decide;source;paths;hasInspected=!1;constructor({mode:t="all",routes:e=[],bots:s="ssr",decide:a}={},o=[],n="/",c=("undefined"==typeof process?void 0:process.env.SSR_BOOST_SSR_ROUTES)){if(this.basename=n,this.bots=s,this.paths=r(o).map(t=>({...t,path:`${n.replace(/\/$/,"")}${t.path}`})),void 0!==c){const t=c.split(",").map(t=>t.trim()).filter(Boolean);this.mode=t.length?t.some(t=>!t.startsWith("!"))?"include":"exclude":"all",this.patterns=t.map(t=>{const e=t.startsWith("!");return i(e?t.slice(1):t,e)}),this.source="SSR_BOOST_SSR_ROUTES"}else this.mode=t,this.patterns="all"===t?[]:e.map(e=>i(e,"exclude"===t)),this.decide=a,this.source="config";this.active="all"!==this.mode||Boolean(this.decide)}select(e,i){if(!this.active)return"ssr";this.inspect(i);const{url:r,headers:a}=e,o=new URL(r),n=t(a.get("user-agent")),c=this.patterns.filter(({test:t})=>t(o.pathname)),p=c.find(({exclude:t})=>t);let h=p||"include"===this.mode&&!c.length?"spa":"ssr",d=`${this.source} ${this.mode}`;if(n&&"ssr"===this.bots)h="ssr",d="bots: ssr";else{const t=this.decide?.({request:e,url:o,isBot:n});void 0!==t&&(h=t,d="config decide")}const l=p?.pattern??c[0]?.pattern??[...this.paths].reverse().find(({path:t})=>s(t,o.pathname))?.path??"(unmatched URL)";return i?.policyDecision(String(l),h,d),h}inspect(t){if(t&&!this.hasInspected){this.hasInspected=!0;for(const{pattern:e,test:i}of this.patterns){this.paths.some(({path:t})=>"/*"!==t&&(i(t)||"string"==typeof e&&Boolean(s(t,e))))||t.policyUnmatched(String(e))}}}}export{a as default};
|
|
2
2
|
//# sourceMappingURL=ssr-policy.js.map
|
package/core/ssr-policy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-policy.js","sources":["../../src/core/ssr-policy.ts"],"sourcesContent":[null],"names":["compilePattern","pattern","exclude","Error","regexp","pathToRegexp","RegExp","source","flags","test","pathname","lastIndex","routePaths","routes","parent","flatMap","
|
|
1
|
+
{"version":3,"file":"ssr-policy.js","sources":["../../src/core/ssr-policy.ts"],"sourcesContent":[null],"names":["compilePattern","pattern","exclude","Error","regexp","pathToRegexp","RegExp","source","flags","test","pathname","lastIndex","routePaths","routes","parent","flatMap","id","path","routePath","children","startsWith","replace","SsrPolicy","active","basename","patterns","mode","bots","decide","paths","hasInspected","constructor","dataRoutes","env","process","undefined","SSR_BOOST_SSR_ROUTES","this","map","route","values","split","value","trim","filter","Boolean","length","some","isExcluded","slice","select","request","diagnostics","inspect","url","requestUrl","headers","URL","isBot","isbot","get","matched","excluded","find","decision","reverse","matchPath","policyDecision","String","policyUnmatched"],"mappings":"qHA6BA,MAAMA,EAAiB,CAACC,EAA0BC,KAChD,GAAgB,KAAZD,EACF,MAAM,IAAIE,MAAM,uCAGlB,MAAMC,EACe,iBAAZH,EACHI,EAAaJ,GAASG,OACtB,IAAIE,OAAOL,EAAQM,OAAQN,EAAQO,OAEzC,MAAO,CACLP,UACAC,UAKAO,KAAOC,IACLN,EAAOO,UAAY,EAEZP,EAAOK,KAAKC,MAQnBE,EAAa,CACjBC,EACAC,EAAS,KAETD,EAAOE,QAAQ,EAAGC,KAAIC,KAAMC,EAAWC,eACrC,MAAMF,GACHC,GAAWE,WAAW,KAAOF,EAAY,GAAGJ,KAAUI,GAAa,MACjEG,QAAQ,OAAQ,KAChBA,QAAQ,MAAO,KAAO,IAE3B,MAAO,CAAC,CAAEL,KAAIC,WAAWL,EAAWO,GAAY,GAAIF,MAMxD,MAAMK,EAIYC,OAKAC,SAKGC,SAKAC,KAKAC,KAKAC,OAKArB,OAKAsB,MAKTC,cAAe,EAKzB,WAAAC,EACEL,KAAEA,EAAO,MAAKb,OAAEA,EAAS,GAAEc,KAAEA,EAAO,MAAKC,OAAEA,GAAuB,GAClEI,EAA0C,GAC1CR,EAAW,IACXS,GAAyB,oBAAZC,aAA0BC,EAAYD,QAAQD,IAAIG,uBAa/D,GAXAC,KAAKb,SAAWA,EAChBa,KAAKV,KAAOA,EAKZU,KAAKR,MAAQjB,EAAWoB,GAAYM,IAAKC,IAAK,IACzCA,EACHtB,KAAM,GAAGO,EAASH,QAAQ,MAAO,MAAMkB,EAAMtB,eAGnCkB,IAARF,EAAmB,CACrB,MAAMO,EAASP,EACZQ,MAAM,KACNH,IAAKI,GAAUA,EAAMC,QACrBC,OAAOC,SAEVR,KAAKX,KAAQc,EAAOM,OAEhBN,EAAOO,KAAML,IAAWA,EAAMtB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ACT,CAMU,OAAA2B,CAAQD,GAChB,GAAKA,IAAef,KAAKP,aAAzB,CAIAO,KAAKP,cAAe,EAEpB,IAAK,MAAM7B,QAAEA,EAAOQ,KAAEA,KAAU4B,KAAKZ,SAAU,CAI5BY,KAAKR,MAAMkB,KAC1B,EAAG9B,UACQ,OAATA,IACCR,EAAKQ,IAA6B,iBAAZhB,GAAwB4C,QAAQqB,EAAUjD,EAAMhB,OAIzEmD,EAAYiB,gBAAgBD,OAAOnE,GAEvC,CAjBA,CAkBF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"node:fs";import{performance as o}from"node:perf_hooks";import r from"chalk";import
|
|
1
|
+
import e from"node:fs";import{performance as o}from"node:perf_hooks";import r from"chalk";import t from"../constants/cli-actions.js";import s from"../constants/cli-name.js";import{getMarkerFile as n}from"./dev-marker.js";import i from"./print-server-urls.js";import m from"./resolve-server-urls.js";async function a(a,{server:l,version:d="unknown"}={}){const{action:p}=a.getPluginConfig()??{},{isProd:f,host:c,root:g,isSPA:h,base:v}=a.getParams(),u=n(g),w=a.getLogger(),b=global.viteBoostStartTime??o.now(),S=r.dim(`ready in ${r.reset(r.bold(Math.ceil(o.now()-b)))} ms`);w.info(`\n ${r.green(`${r.bold(s.toUpperCase())} v${d}`)} ${S}\n`,{clear:!w.hasWarned});const $=a.getVite()?.config,j=!$?.mode&&!e.existsSync(u),P=l?await m(l,{host:c,isHttps:Boolean($?.server.https),rawBase:$?.rawBase??new URL(v??"/","http://localhost").pathname}):null,k=$?.mode||j?a.mode:`production ${r.red("NODE_ENV=development")}`,y=h?"SPA":"SSR";if(w.info(r.dim(r.green(" ➜"))+r.dim(" Mode: ")+r.blue(k)),w.info(r.dim(r.green(" ➜"))+r.dim(" Type: ")+r.blue(y)),f)P&&i(P,e=>w.info(e));else{const e=a.getVite();e.resolvedUrls=P,e.printUrls()}p===t.dev&&w.info(r.dim(r.green(" ➜"))+r.dim(" press ")+r.bold("h")+r.dim(" to show help"))}export{a as default};
|
|
2
2
|
//# sourceMappingURL=print-server-info.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print-server-info.js","sources":["../../src/helpers/print-server-info.ts"],"sourcesContent":[null],"names":["async","printServerInfo","config","server","version","action","getPluginConfig","isProd","host","root","isSPA","getParams","devMarker","getMarkerFile","Logger","getLogger","perfStart","global","viteBoostStartTime","performance","now","startupDurationString","chalk","dim","reset","bold","Math","ceil","info","green","cliName","toUpperCase","clear","hasWarned","viteConfig","getVite","isProdBuild","mode","fs","existsSync","resolvedUrls","resolveServerUrls","isHttps","Boolean","https","rawBase","red","type","blue","printServerUrls","msg","vite","printUrls","CliActions","dev"],"mappings":"2SAoBAA,eAAeC,EACbC,GACAC,OAAEA,EAAMC,QAAEA,EAAU,WAAsC,IAE1D,MAAMC,OAAEA,GAAWH,EAAOI,mBAAqB,CAAA,GACzCC,OAAEA,EAAMC,KAAEA,EAAIC,KAAEA,EAAIC,MAAEA,
|
|
1
|
+
{"version":3,"file":"print-server-info.js","sources":["../../src/helpers/print-server-info.ts"],"sourcesContent":[null],"names":["async","printServerInfo","config","server","version","action","getPluginConfig","isProd","host","root","isSPA","base","getParams","devMarker","getMarkerFile","Logger","getLogger","perfStart","global","viteBoostStartTime","performance","now","startupDurationString","chalk","dim","reset","bold","Math","ceil","info","green","cliName","toUpperCase","clear","hasWarned","viteConfig","getVite","isProdBuild","mode","fs","existsSync","resolvedUrls","resolveServerUrls","isHttps","Boolean","https","rawBase","URL","pathname","red","type","blue","printServerUrls","msg","vite","printUrls","CliActions","dev"],"mappings":"2SAoBAA,eAAeC,EACbC,GACAC,OAAEA,EAAMC,QAAEA,EAAU,WAAsC,IAE1D,MAAMC,OAAEA,GAAWH,EAAOI,mBAAqB,CAAA,GACzCC,OAAEA,EAAMC,KAAEA,EAAIC,KAAEA,EAAIC,MAAEA,EAAKC,KAAEA,GAAST,EAAOU,YAC7CC,EAAYC,EAAcL,GAE1BM,EAASb,EAAOc,YAChBC,EAAYC,OAAOC,oBAAsBC,EAAYC,MACrDC,EAAwBC,EAAMC,IAClC,YAAYD,EAAME,MAAMF,EAAMG,KAAKC,KAAKC,KAAKR,EAAYC,MAAQJ,WAGnEF,EAAOc,KACL,OAAON,EAAMO,MACX,GAAGP,EAAMG,KAAKK,EAAQC,mBAAmB5B,SACrCkB,MACN,CAAEW,OAAQlB,EAAOmB,YAGnB,MAAMC,EAAkEjC,EAAOkC,WAAWlC,OACpFmC,GAAeF,GAAYG,OAASC,EAAGC,WAAW3B,GAClD4B,EAAetC,QACXuC,EAAkBvC,EAAQ,CAC9BK,OACAmC,QAASC,QAAQT,GAAYhC,OAAO0C,OACpCC,QAASX,GAAYW,SAAW,IAAIC,IAAIpC,GAAQ,IAAK,oBAAoBqC,WAE3E,KACEV,EACJH,GAAYG,MAAQD,EAChBnC,EAAOoC,KACP,cAAcf,EAAM0B,IAAI,0BACxBC,EAAOxC,EAAQ,MAAQ,MAK7B,GAHAK,EAAOc,KAAKN,EAAMC,IAAID,EAAMO,MAAM,QAAUP,EAAMC,IAAI,eAAiBD,EAAM4B,KAAKb,IAClFvB,EAAOc,KAAKN,EAAMC,IAAID,EAAMO,MAAM,QAAUP,EAAMC,IAAI,eAAiBD,EAAM4B,KAAKD,IAE7E3C,EAKMkC,GACTW,EAAgBX,EAAeY,GAAQtC,EAAOc,KAAKwB,QANxC,CACX,MAAMC,EAAOpD,EAAOkC,UAEpBkB,EAAKb,aAAeA,EACpBa,EAAKC,WACP,CAIIlD,IAAWmD,EAAWC,KACxB1C,EAAOc,KACLN,EAAMC,IAAID,EAAMO,MAAM,QACpBP,EAAMC,IAAI,YACVD,EAAMG,KAAK,KACXH,EAAMC,IAAI,iBAGlB"}
|
package/http.d.ts
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-only HTTP helpers use Fetch primitives and can also run on the edge.
|
|
3
|
+
*/
|
|
1
4
|
export { default as cacheControl } from './core/cache-control.js';
|
|
2
5
|
export type { ICachePolicy } from './core/cache-control.js';
|
|
6
|
+
/**
|
|
7
|
+
* Evaluate conditional requests against application-supplied validators.
|
|
8
|
+
*/
|
|
3
9
|
export { default as conditionalRequest } from './core/conditional-request.js';
|
|
4
10
|
export type { IConditionalValidators } from './core/conditional-request.js';
|
|
11
|
+
/**
|
|
12
|
+
* Copy explicitly allowed loader and action headers to a document response.
|
|
13
|
+
*/
|
|
5
14
|
export { default as copyLoaderHeaders } from './core/copy-loader-headers.js';
|
|
15
|
+
/**
|
|
16
|
+
* Apply document header rules with credential protection.
|
|
17
|
+
*/
|
|
6
18
|
export { default as documentHeaders } from './core/document-headers.js';
|
|
7
19
|
export type { IDocumentHeaderContext, IDocumentHeaderRule, IDocumentHeadersOptions, IDocumentRuleContext, } from './core/document-headers.js';
|
package/node/production.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ interface ILoadHtmlShellOptions {
|
|
|
4
4
|
indexFile: string;
|
|
5
5
|
outlet?: string;
|
|
6
6
|
}
|
|
7
|
-
type
|
|
7
|
+
type TRouteAssetPreparerOptions = ({
|
|
8
8
|
buildDir: string;
|
|
9
9
|
manifest?: never;
|
|
10
10
|
} | {
|
|
@@ -20,6 +20,6 @@ declare const loadHtmlShell: ({ indexFile, outlet, }: ILoadHtmlShellOptions) =>
|
|
|
20
20
|
/**
|
|
21
21
|
* Inject matched route assets using a manifest cache owned by this preparer.
|
|
22
22
|
*/
|
|
23
|
-
declare const createRouteAssetPreparer: <TAppProps = Record<string, any>>({ buildDir, manifest, modulePreload, }:
|
|
23
|
+
declare const createRouteAssetPreparer: <TAppProps = Record<string, any>>({ buildDir, manifest, modulePreload, }: TRouteAssetPreparerOptions) => NonNullable<ICreateHandlerOptions<TAppProps>["prepare"]>;
|
|
24
24
|
export { createRouteAssetPreparer, loadHtmlShell };
|
|
25
|
-
export type { IHtmlShell, ILoadHtmlShellOptions, IRouteAssetPreparerOptions, TRouteAssetsManifest };
|
|
25
|
+
export type { IHtmlShell, ILoadHtmlShellOptions, TRouteAssetPreparerOptions as IRouteAssetPreparerOptions, TRouteAssetsManifest, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lomray/vite-ssr-boost",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.1-beta.1",
|
|
4
4
|
"description": "SSR and streaming for existing Vite + React Router apps in Data mode, without Framework mode",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -95,7 +95,8 @@
|
|
|
95
95
|
"test:coverage": "vitest run --coverage",
|
|
96
96
|
"test:browser": "playwright test --config playwright.config.mjs",
|
|
97
97
|
"test:worker:packed": "node scripts/test-packed-worker.mjs",
|
|
98
|
-
"test:worker:browser": "playwright test --config playwright.worker.config.mjs"
|
|
98
|
+
"test:worker:browser": "playwright test --config playwright.worker.config.mjs",
|
|
99
|
+
"test:skills": "node scripts/test-skills.mjs"
|
|
99
100
|
},
|
|
100
101
|
"dependencies": {
|
|
101
102
|
"chalk": "^6.0.0",
|
|
@@ -168,7 +169,8 @@
|
|
|
168
169
|
"vite": "^8.2.2",
|
|
169
170
|
"vitepress": "^1.6.4",
|
|
170
171
|
"vitest": "^5.0.0",
|
|
171
|
-
"wrangler": "^4.129.0"
|
|
172
|
+
"wrangler": "^4.129.0",
|
|
173
|
+
"yaml": "^2.9.0"
|
|
172
174
|
},
|
|
173
175
|
"peerDependencies": {
|
|
174
176
|
"@babel/generator": ">=7.23.0",
|
package/services/build.d.ts
CHANGED
|
@@ -106,6 +106,10 @@ declare class Build {
|
|
|
106
106
|
* Build assets manifest file
|
|
107
107
|
*/
|
|
108
108
|
protected buildManifest(): void;
|
|
109
|
+
/**
|
|
110
|
+
* Persist only the resolved serving settings, with paths relative to the build output.
|
|
111
|
+
*/
|
|
112
|
+
protected writeProductionConfig(): void;
|
|
109
113
|
/**
|
|
110
114
|
* Change general directive Disallow to Allow in robots.txt.
|
|
111
115
|
*/
|
package/services/build.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import i from"node:child_process";import s from"node:fs";import
|
|
1
|
+
import i from"node:child_process";import s from"node:fs";import e from"node:path";import t from"chalk";import{resolveConfig as o}from"vite";import r from"../cli/diagnostic-codes.js";import n from"../cli/helpers/vite-reset-cache.js";import l from"../helpers/create-focus-only.js";import{createDevMarker as c}from"../helpers/dev-marker.js";import d from"../helpers/plugin-config.js";import a from"../helpers/process-stop.js";import u from"./server-config.js";import h from"./ssr-manifest.js";class p{isProd;nodeEnv;buildDir;viteConfig;pluginConfig;params={mode:"",clientOptions:"",serverOptions:"",focusOnly:"app",isWatch:!1,isUnlockRobots:!1,isEject:!1,isServerless:!1,isNoWarnings:!1};abortController=null;runningBuild=[];hasPreviewModeExitListener=!1;diagnosticCodes=new Set;constructor(i){this.params={...this.params,...i}}async makeConfig(){const{mode:i}=this.params;this.viteConfig=await o({},"build",i,"production"),this.pluginConfig=d(this.viteConfig),this.buildDir=e.resolve(this.viteConfig.root,this.viteConfig.build.outDir),this.nodeEnv=process.env.NODE_ENV||"production",this.isProd="production"===this.nodeEnv}clearBuildFolder(){s.existsSync(this.buildDir)&&s.rmSync(this.buildDir,{recursive:!0})}getIsProd(){return this.isProd}getNodeEnv(){return this.nodeEnv}getRunningBuildNames(){return this.runningBuild.map(({name:i})=>i)}promisifyProcess(i,s=!1){const e=new Promise((e,t)=>{i.on("exit",i=>{e(i)}),i.on("close",i=>{e(i)}),i.on("error",i=>{t(i)}),s&&i.stderr?.on("data",i=>{const s=Buffer.from(i).toString();(s.includes("warning")||s.includes("WARNING"))&&e(1)})});i.stdout?.pipe(process.stdout),i.stderr?.pipe(process.stderr);for(const s of[i.stdout,i.stderr]){let i="";s?.on("data",s=>{const e=i+Buffer.from(s).toString();r.filter(i=>e.includes(i)).forEach(i=>this.diagnosticCodes.add(i)),i=e.slice(-80)})}return{promise:e,command:i}}buildManifest(){console.info(t.blue("Building routes manifest file"));const i=u.init({isProd:this.isProd,mode:this.params.mode},{root:this.viteConfig.root,clientFile:this.pluginConfig.clientFile});h.get(i,{buildDir:this.viteConfig.build.outDir,viteAliases:this.viteConfig.resolve.alias,basename:this.viteConfig.base,renderBuiltUrl:this.viteConfig?.experimental?.renderBuiltUrl}).buildRoutesManifest()}writeProductionConfig(){const{base:i,mode:t}=this.viteConfig,{indexFile:o="index.html",serverFile:r="server.ts"}=this.pluginConfig,n={version:1,root:"..",base:i??"/",mode:t??this.params.mode,publicDir:"client",indexFile:e.posix.join("client",o),serverFile:`server/${e.parse(r).name}.js`},l=e.join(this.buildDir,"server");s.mkdirSync(l,{recursive:!0}),s.writeFileSync(e.join(l,"ssr-boost.json"),`${JSON.stringify(n,null,2)}\n`)}unlockRobots(){const i=`${this.buildDir}/client/robots.txt`;if(!s.existsSync(i))return void console.warn(`Failed to unlock robots.txt, file not exist: ${i}`);const e=s.readFileSync(i,{encoding:"utf-8"}).replace(/Disallow: \/$/m,"Allow: /");s.writeFileSync(i,e,{encoding:"utf-8"}),console.info(t.blue("\nrobots.txt unlocked."))}eject(){const i=`${this.buildDir}/server/start.js`;s.writeFileSync(i,"import runProd from '../cli/run-prod.js';\n\nconst VERSION = process.env.VERSION || \"1.0.0\";\nconst PORT = process.env.PORT || 3000;\nconst IS_HOST = process.env.IS_HOST || \"0\";\nconst ONLY_CLIENT = process.env.ONLY_CLIENT || \"0\";\n\nawait runProd({\n version: VERSION,\n isHost: IS_HOST === '1',\n isPrintInfo: true,\n port: PORT,\n onlyClient: ONLY_CLIENT === '1',\n });\n",{encoding:"utf-8"})}createServerless(){const i=`${this.buildDir}/server/serverless.js`;s.writeFileSync(i,"import runServerless from '../cli/run-serverless.js';\n\nexport default await runServerless({ version: process.env.VERSION || \"1.0.0\" });\n",{encoding:"utf-8"})}async spawnBuild(s,e,t={}){const{mode:o,isNoWarnings:r}=this.params,{focusOnly:n=this.params.focusOnly,shouldWait:c=!1,env:d={}}=t,a=o&&!e.includes("--mode")?`--mode ${o}`:"",u=this.promisifyProcess(i.spawn(`vite build ${e} ${a} --emptyOutDir`,{signal:this.abortController.signal,stdio:[process.stdin,"pipe","pipe"],shell:!0,env:{...process.env,...d,FORCE_COLOR:"2",SSR_BOOST_IS_SSR:l(n).isOnlyClient()?"0":"1",SSR_BOOST_ACTION:global.viteBoostAction}}),r);this.runningBuild.push({name:s,buildProcess:u}),c&&await this.waitLastBuild()}async waitLastBuild(){const i=this.runningBuild.at(-1);if(!i)return;const s=await i.buildProcess.promise;a(s,!0)}runPreviewMode(){this.hasPreviewModeExitListener||(process.on("exit",()=>{this.abortController.abort()}),this.hasPreviewModeExitListener=!0);const{onFinish:i}=this.params;let s=this.runningBuild.length;const e=t=>{Buffer.from(t).toString().includes("built in")&&(s-=1,s||(this.runningBuild.forEach(({buildProcess:i})=>{i.command.stdout?.removeListener("data",e)}),c(this.isProd,this.viteConfig),this.writeProductionConfig(),i?.()))};this.runningBuild.forEach(({buildProcess:i})=>{i.command.stdout?.on("data",e)})}async build(){await this.makeConfig(),await n(),this.clearBuildFolder(),this.diagnosticCodes.clear();const{clientOptions:i,serverOptions:t,onFinish:o,isWatch:r,focusOnly:d,isEject:a,isServerless:u,isUnlockRobots:h}=this.params,{outDir:p}=this.viteConfig.build,f=l(d);this.abortController=new AbortController,this.runningBuild=[],f.isClient()&&await this.spawnBuild("client",`${i} --outDir ${p}/client`,{shouldWait:!r}),f.isServer()&&(await this.spawnBuild("server",`${t} --outDir ${p}/server --ssr ${this.pluginConfig.serverFile}`,{shouldWait:!r}),r||(this.buildManifest(),a&&this.eject(),u&&this.createServerless()));const{entrypoint:m}=this.pluginConfig;if(m?.length&&f.isEntrypoint())for(const{name:i,type:s,serverFile:e,buildOptions:t=""}of m){const o=e&&"ssr"===s?`--ssr ${e}`:"";await this.spawnBuild(i,`${t} ${o} --outDir ${p}/${i}`,{shouldWait:!r,focusOnly:"ssr"===s?"server":"client",env:{SSR_BOOST_CUSTOM_ENTRYPOINT_BUILD_NAME:i}})}r?this.runPreviewMode():(h&&this.unlockRobots(),c(this.isProd,this.viteConfig),this.writeProductionConfig(),s.mkdirSync(this.buildDir,{recursive:!0}),s.writeFileSync(e.join(this.buildDir,"ssr-boost-diagnostics.json"),JSON.stringify({codes:[...this.diagnosticCodes].sort((i,s)=>i.localeCompare(s))},null,2)),o?.())}}export{p as default};
|
|
2
2
|
//# sourceMappingURL=build.js.map
|
package/services/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sources":["../../src/services/build.ts"],"sourcesContent":[null],"names":["Build","isProd","nodeEnv","buildDir","viteConfig","pluginConfig","params","mode","clientOptions","serverOptions","focusOnly","isWatch","isUnlockRobots","isEject","isServerless","isNoWarnings","abortController","runningBuild","hasPreviewModeExitListener","diagnosticCodes","Set","constructor","this","makeConfig","resolveConfig","getPluginConfig","path","resolve","root","build","outDir","process","env","NODE_ENV","clearBuildFolder","fs","existsSync","rmSync","recursive","getIsProd","getNodeEnv","getRunningBuildNames","map","name","promisifyProcess","command","isRejectWarnings","promise","Promise","reject","on","code","message","stderr","buff","msg","Buffer","from","toString","includes","stdout","pipe","stream","tail","chunk","text","DIAGNOSTIC_CODES","filter","forEach","add","slice","buildManifest","console","info","chalk","blue","serverConfig","ServerConfig","init","clientFile","SsrManifest","get","viteAliases","alias","basename","base","renderBuiltUrl","experimental","buildRoutesManifest","unlockRobots","robotsFile","warn","data","readFileSync","encoding","replace","
|
|
1
|
+
{"version":3,"file":"build.js","sources":["../../src/services/build.ts"],"sourcesContent":[null],"names":["Build","isProd","nodeEnv","buildDir","viteConfig","pluginConfig","params","mode","clientOptions","serverOptions","focusOnly","isWatch","isUnlockRobots","isEject","isServerless","isNoWarnings","abortController","runningBuild","hasPreviewModeExitListener","diagnosticCodes","Set","constructor","this","makeConfig","resolveConfig","getPluginConfig","path","resolve","root","build","outDir","process","env","NODE_ENV","clearBuildFolder","fs","existsSync","rmSync","recursive","getIsProd","getNodeEnv","getRunningBuildNames","map","name","promisifyProcess","command","isRejectWarnings","promise","Promise","reject","on","code","message","stderr","buff","msg","Buffer","from","toString","includes","stdout","pipe","stream","tail","chunk","text","DIAGNOSTIC_CODES","filter","forEach","add","slice","buildManifest","console","info","chalk","blue","serverConfig","ServerConfig","init","clientFile","SsrManifest","get","viteAliases","alias","basename","base","renderBuiltUrl","experimental","buildRoutesManifest","writeProductionConfig","indexFile","serverFile","config","version","publicDir","posix","join","parse","directory","mkdirSync","writeFileSync","JSON","stringify","unlockRobots","robotsFile","warn","data","readFileSync","encoding","replace","eject","entrypoint","createServerless","spawnBuild","buildOptions","shouldWait","modeOpt","buildProcess","childProcess","spawn","signal","stdio","stdin","shell","FORCE_COLOR","SSR_BOOST_IS_SSR","createFocusOnly","isOnlyClient","SSR_BOOST_ACTION","global","viteBoostAction","push","waitLastBuild","latestProcess","at","exitCode","processStop","runPreviewMode","abort","onFinish","buildCount","length","listener","removeListener","createDevMarker","viteResetCache","clear","focus","AbortController","isClient","isServer","isEntrypoint","type","cliOptions","SSR_BOOST_CUSTOM_ENTRYPOINT_BUILD_NAME","codes","sort","a","b","localeCompare"],"mappings":"0eA0DA,MAAMA,EAIMC,OAKAC,QAKAC,SAKAC,WAKAC,aAKAC,OAAuB,CAC/BC,KAAM,GACNC,cAAe,GACfC,cAAe,GACfC,UAAW,MACXC,SAAS,EACTC,gBAAgB,EAChBC,SAAS,EACTC,cAAc,EACdC,cAAc,GAMNC,gBAA0C,KAK1CC,aAAgE,GAKhEC,4BAA6B,EAE7BC,gBAAkB,IAAIC,IAKhC,WAAAC,CAAmBf,GACjBgB,KAAKhB,OAAS,IAAKgB,KAAKhB,UAAWA,EACrC,CAKU,gBAAMiB,GACd,MAAMhB,KAAEA,GAASe,KAAKhB,OAEtBgB,KAAKlB,iBAAmBoB,EAAc,CAAA,EAAI,QAASjB,EAAM,cACzDe,KAAKjB,aAAeoB,EAAgBH,KAAKlB,YACzCkB,KAAKnB,SAAWuB,EAAKC,QAAQL,KAAKlB,WAAWwB,KAAMN,KAAKlB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AAKlB,YAClCkB,KAAKmE,wBACLtD,EAAGgE,UAAU7E,KAAKnB,SAAU,CAAEmC,WAAW,IACzCH,EAAGiE,cACD1E,EAAKsE,KAAK1E,KAAKnB,SAAU,8BACzBkG,KAAKC,UACH,CAAEqD,MAAO,IAAIrI,KAAKH,iBAAiByI,KAAK,CAACC,EAAGC,IAAMD,EAAEE,cAAcD,KAClE,KACA,IAGJnB,MACF"}
|
|
@@ -26,10 +26,27 @@ declare const walkSerializable: (value: unknown, report: (issue: ISerializationI
|
|
|
26
26
|
* Inspect one development response while allowing every chunk to stream immediately.
|
|
27
27
|
*/
|
|
28
28
|
declare class Diagnostics {
|
|
29
|
+
/**
|
|
30
|
+
* Identify the route in request diagnostics.
|
|
31
|
+
*/
|
|
29
32
|
protected readonly route: string;
|
|
33
|
+
/**
|
|
34
|
+
* Deliver warnings and optional policy decisions through the runtime logger.
|
|
35
|
+
*/
|
|
30
36
|
protected readonly logger: Pick<Logger, 'warn'> & Partial<Pick<Logger, 'info'>>;
|
|
31
37
|
protected chunks: string[];
|
|
32
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Attach route context and the logger used for request diagnostics.
|
|
40
|
+
*/
|
|
41
|
+
constructor(
|
|
42
|
+
/**
|
|
43
|
+
* Identify the route in request diagnostics.
|
|
44
|
+
*/
|
|
45
|
+
route: string,
|
|
46
|
+
/**
|
|
47
|
+
* Deliver warnings and optional policy decisions through the runtime logger.
|
|
48
|
+
*/
|
|
49
|
+
logger?: Pick<Logger, 'warn'> & Partial<Pick<Logger, 'info'>>);
|
|
33
50
|
/**
|
|
34
51
|
* Emit each concrete message once per process, including across handler instances.
|
|
35
52
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.js","sources":["../../src/services/diagnostics.ts"],"sourcesContent":[null],"names":["OUTLET","HYDRATION","warnedKey","Symbol","for","registry","globalThis","isDiagnosticsEnabled","enabled","env","process","undefined","SSR_BOOST_DIAGNOSTICS","NODE_ENV","formatDiagnostic","code","sentence","toLowerCase","splitHtmlShell","html","file","outlet","parts","split","length","Error","JSON","stringify","valueType","value","bigint","symbol","prototype","Object","getPrototypeOf","name","constructor","walkSerializable","report","path","ancestors","Set","streamed","type","Promise","Date","RegExp","reason","object","Map","Array","isArray","has","add","entries","flatMap","key","child","index","map","String","suffix","test","delete","Diagnostics","route","logger","chunks","Logger","this","warn","detail","message","warned","deprecatedReqRes","policyDecision","pattern","mode","source","reported","info","policyUnmatched","inspectShell","header","footer","includes","inspectCachePolicy","headers","hasSessionCookie","get","inspectRouterState","loaderData","actionData","kind","data","streamAborted","count","inspectStreamValue","id","inspectState","state","inspectOnResponse","append","push","complete","join","markers","marker","set","markup","replace","_tag","opening","content","match","matchAll","attribute","total"],"mappings":"2BAqBA,MAAMA,EAAS,0BACTC,EAAY,qCACZC,EAAYC,OAAOC,IAAI,sCAEvBC,EAAWC,WAKXC,EAAwBC,IAC5B,MAAMC,EAAyB,oBAAZC,aAA0BC,EAAYD,QAAQD,IAEjE,MAAmC,MAA/BA,GAAKG,uBAAgE,MAA/BH,GAAKG,sBACR,MAA9BH,EAAIG,sBAGNJ,GAA6B,eAAlBC,GAAKI,UAMnBC,EAAmB,CAACC,EAAuBC,IAC/C,eAAeD,MAASC,gFAAuFD,EAAKE,gBAKhHC,EAAiB,CAACC,EAAcC,EAAcC,EAASrB,KAC3D,MAAMsB,EAAQH,EAAKI,MAAMF,GAEzB,IAAKA,GAA2B,IAAjBC,EAAME,OACnB,MAAM,IAAIC,MACRX,EACE,2BACA,yBAAyBY,KAAKC,UAAUP,6CAAgDM,KAAKC,UAAUN,QAK7G,OAAOC,GAMHM,EAAaC,IACjB,GAAc,OAAVA,EACF,MAAO,OAGT,GAAqB,iBAAVA,EAAoB,CAG7B,MAFsC,CAAEC,OAAQ,SAAUC,OAAQ,iBAE9CF,WAAiBA,CACvC,CAEA,MAAMG,EAAYC,OAAOC,eAAeL,GAClCM,EAAOH,GAAWI,aAAaD,KAErC,MAAuB,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C5D,CAEAF,EAAUuB,OAAOf,IAMnB,MAAMgB,
|
|
1
|
+
{"version":3,"file":"diagnostics.js","sources":["../../src/services/diagnostics.ts"],"sourcesContent":[null],"names":["OUTLET","HYDRATION","warnedKey","Symbol","for","registry","globalThis","isDiagnosticsEnabled","enabled","env","process","undefined","SSR_BOOST_DIAGNOSTICS","NODE_ENV","formatDiagnostic","code","sentence","toLowerCase","splitHtmlShell","html","file","outlet","parts","split","length","Error","JSON","stringify","valueType","value","bigint","symbol","prototype","Object","getPrototypeOf","name","constructor","walkSerializable","report","path","ancestors","Set","streamed","type","Promise","Date","RegExp","reason","object","Map","Array","isArray","has","add","entries","flatMap","key","child","index","map","String","suffix","test","delete","Diagnostics","route","logger","chunks","Logger","this","warn","detail","message","warned","deprecatedReqRes","policyDecision","pattern","mode","source","reported","info","policyUnmatched","inspectShell","header","footer","includes","inspectCachePolicy","headers","hasSessionCookie","get","inspectRouterState","loaderData","actionData","kind","data","streamAborted","count","inspectStreamValue","id","inspectState","state","inspectOnResponse","append","push","complete","join","markers","marker","set","markup","replace","_tag","opening","content","match","matchAll","attribute","total"],"mappings":"2BAqBA,MAAMA,EAAS,0BACTC,EAAY,qCACZC,EAAYC,OAAOC,IAAI,sCAEvBC,EAAWC,WAKXC,EAAwBC,IAC5B,MAAMC,EAAyB,oBAAZC,aAA0BC,EAAYD,QAAQD,IAEjE,MAAmC,MAA/BA,GAAKG,uBAAgE,MAA/BH,GAAKG,sBACR,MAA9BH,EAAIG,sBAGNJ,GAA6B,eAAlBC,GAAKI,UAMnBC,EAAmB,CAACC,EAAuBC,IAC/C,eAAeD,MAASC,gFAAuFD,EAAKE,gBAKhHC,EAAiB,CAACC,EAAcC,EAAcC,EAASrB,KAC3D,MAAMsB,EAAQH,EAAKI,MAAMF,GAEzB,IAAKA,GAA2B,IAAjBC,EAAME,OACnB,MAAM,IAAIC,MACRX,EACE,2BACA,yBAAyBY,KAAKC,UAAUP,6CAAgDM,KAAKC,UAAUN,QAK7G,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EAAQjB,IAAIkB,IAAW,GAAK,IAG7CE,EAAS1F,EACZ2F,QAAQ,mBAAoB,IAC5BA,QACC,uFACA,CAACC,EAAMC,EAAiB7E,EAAc8E,KACpC,GAA2B,WAAvB9E,EAAKlB,cAA4B,CAC/B,4CAA4C6C,KAAKmD,IACnDjB,EAAM/F,GAGR,IAAK,MAAMiH,KAASD,EAAQE,SAAS,mCACnCnB,EAAM,QAAQkB,EAAM,OAExB,CAEA,OAAOF,IAIb,IAAK,MAAME,KAASL,EAAOM,SAAS,sDAAuD,CACzF,MAAMhF,EAAO+E,EAAM,GAAGjG,cAET,SAATkB,GAA4B,SAATA,GACrB6D,EAAM,IAAI7D,MAGZ,IAAK,MAAMiF,KAAaF,EAAM,GAAGC,SAC/B,sDACC,CACD,MAAMtF,EAAQuF,EAAU,IAAMA,EAAU,IAAMA,EAAU,GAErB,OAA/BA,EAAU,GAAGnG,eAA0B,UAAU6C,KAAKjC,IACxDmE,EAAM,OAAOnE,KAEjB,CACF,CAEK6E,EAAQtD,IAAInD,IACfoE,KAAKC,KACH,oCACA,gCAAgC5C,KAAKC,UAAU0C,KAAKJ,iBAAiBhE,0DAIzE,IAAK,MAAO0G,EAAQU,KAAUX,EACxBW,EAAQ,GACVhD,KAAKC,KACH,6BACA,gCAAgC5C,KAAKC,UAAU0C,KAAKJ,kBAAkB0C,8EAI9E"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface IProductionConfig {
|
|
2
|
+
version: 1;
|
|
3
|
+
root: string;
|
|
4
|
+
base: string;
|
|
5
|
+
mode: string;
|
|
6
|
+
publicDir: string;
|
|
7
|
+
indexFile: string;
|
|
8
|
+
serverFile: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Read relocatable build settings while retaining conventional paths for older builds.
|
|
12
|
+
*/
|
|
13
|
+
declare const loadProductionConfig: (buildDir?: string) => IProductionConfig | undefined;
|
|
14
|
+
export type { IProductionConfig };
|
|
15
|
+
export default loadProductionConfig;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import o from"node:fs";import r from"node:path";const e=e=>{const t=[e,"./build","./dist"].find(r=>r&&o.existsSync(r));if(!t)return;const s=r.resolve(t,"server/ssr-boost.json");let i;try{i=o.readFileSync(s,"utf8")}catch(o){if("ENOENT"===o.code)return;throw o}const n=JSON.parse(i);if(1!==n?.version||["root","base","mode","publicDir","indexFile","serverFile"].some(o=>"string"!=typeof n[o]))throw new Error(`Invalid production configuration: ${s}. Run ssr-boost build again.`);return{...n,root:r.resolve(r.dirname(s),n.root)}};export{e as default};
|
|
2
|
+
//# sourceMappingURL=production-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"production-config.js","sources":["../../src/services/production-config.ts"],"sourcesContent":[null],"names":["loadProductionConfig","buildDir","directory","find","candidate","fs","existsSync","filename","path","resolve","contents","readFileSync","error","code","config","JSON","parse","version","some","key","Error","root","dirname"],"mappings":"gDAgBA,MAAMA,EAAwBC,IAC5B,MAAMC,EAAY,CAACD,EAAU,UAAW,UAAUE,KAC/CC,GAAcA,GAAaC,EAAGC,WAAWF,IAG5C,IAAKF,EACH,OAGF,MAAMK,EAAWC,EAAKC,QAAQP,EAAW,yBACzC,IAAIQ,EAEJ,IACEA,EAAWL,EAAGM,aAAaJ,EAAU,OACvC,CAAE,MAAOK,GACP,GAA8C,WAAzCA,EAAgCC,KACnC,OAGF,MAAMD,CACR,CAEA,MAAME,EAASC,KAAKC,MAAMN,GAE1B,GACsB,IAApBI,GAAQG,SACR,CAAC,OAAQ,OAAQ,OAAQ,YAAa,YAAa,cAAcC,KAC9DC,GAA0D,iBAA3CL,EAAOK,IAGzB,MAAM,IAAIC,MAAM,qCAAqCb,iCAGvD,MAAO,IAAKO,EAAQO,KAAMb,EAAKC,QAAQD,EAAKc,QAAQf,GAAWO,EAAOO"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
type TRequestStage = 'router.query' | 'prepare' | 'shell.ready' | 'state.emitted' | 'stream.resolve' | 'stream.reject' | 'body.end' | 'response.end' | 'abort';
|
|
2
2
|
interface ITimelineEvent {
|
|
3
3
|
stage: TRequestStage;
|
|
4
|
+
/** Milliseconds since the request timeline started. */
|
|
4
5
|
at: number;
|
|
5
6
|
id?: number;
|
|
6
7
|
placement?: 'early' | 'footer';
|
|
@@ -8,20 +9,48 @@ interface ITimelineEvent {
|
|
|
8
9
|
}
|
|
9
10
|
/** Request-local observations; never constructed on the disabled path. */
|
|
10
11
|
declare class RequestTimeline {
|
|
12
|
+
/**
|
|
13
|
+
* Retain request metadata and its cancellation signal.
|
|
14
|
+
*/
|
|
11
15
|
protected readonly request: Request;
|
|
16
|
+
/**
|
|
17
|
+
* Retain observations in emission order.
|
|
18
|
+
*/
|
|
12
19
|
readonly events: ITimelineEvent[];
|
|
20
|
+
/**
|
|
21
|
+
* Anchor event offsets to a monotonic clock.
|
|
22
|
+
*/
|
|
13
23
|
readonly started: number;
|
|
24
|
+
/**
|
|
25
|
+
* Prevent observations after response completion.
|
|
26
|
+
*/
|
|
14
27
|
protected ended: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Record only the first cancellation reason.
|
|
30
|
+
*/
|
|
15
31
|
protected aborted: boolean;
|
|
16
|
-
|
|
17
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Observe cancellation from the request's signal.
|
|
34
|
+
*/
|
|
35
|
+
constructor(
|
|
36
|
+
/**
|
|
37
|
+
* Retain request metadata and its cancellation signal.
|
|
38
|
+
*/
|
|
39
|
+
request: Request);
|
|
18
40
|
/** Offsets mark completion/emission, not the beginning of a stage. */
|
|
19
41
|
record(stage: TRequestStage, detail?: Omit<ITimelineEvent, 'stage' | 'at'>): void;
|
|
42
|
+
/**
|
|
43
|
+
* Attach the first cancellation reason to the timeline.
|
|
44
|
+
*/
|
|
20
45
|
abort(reason?: unknown): void;
|
|
21
46
|
/** Emit one JSON line only when explicitly requested in development. */
|
|
22
47
|
end(): void;
|
|
23
48
|
/** Observe final transformed bytes without reading ahead of the consumer. */
|
|
24
49
|
response(response: Response): Response;
|
|
50
|
+
/**
|
|
51
|
+
* Forward request cancellation without losing the timeline receiver.
|
|
52
|
+
*/
|
|
53
|
+
protected onAbort: () => void;
|
|
25
54
|
}
|
|
26
55
|
/** Keep the constructor, event array and clock reads behind the enablement check. */
|
|
27
56
|
declare const createTimeline: (request: Request, diagnostics: boolean) => RequestTimeline | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=e=>{if(e instanceof Error)return e.message;if("string"==typeof e)return e;try{return JSON.stringify(e)??"Render cancelled"}catch{return"Unserializable abort reason"}};class t{request;events=[];started=performance.now();ended=!1;aborted=!1;constructor(e){this.request=e
|
|
1
|
+
const e=e=>{if(e instanceof Error)return e.message;if("string"==typeof e)return e;try{return JSON.stringify(e)??"Render cancelled"}catch{return"Unserializable abort reason"}};class t{request;events=[];started=performance.now();ended=!1;aborted=!1;constructor(e){this.request=e;const{signal:t}=e;t.aborted?this.onAbort():t.addEventListener("abort",this.onAbort,{once:!0})}record(e,t){this.ended||this.events.push({stage:e,at:performance.now()-this.started,...t})}abort(t){this.aborted||(this.aborted=!0,this.record("abort",{reason:e(t)}))}end(){this.ended||(this.record("response.end"),this.ended=!0,this.request.signal.removeEventListener("abort",this.onAbort),"undefined"!=typeof process&&"1"===process.env.SSR_BOOST_TIMELINE&&"production"!==process.env.NODE_ENV&&console.info(JSON.stringify({type:"SSR_BOOST_TIMELINE",method:this.request.method,path:new URL(this.request.url).pathname,timeline:this.events})))}response(e){const{body:t}=e;if(!t)return this.end(),e;const r=t.getReader();let s=!1;const n=()=>{s=!0,r.releaseLock(),this.end()},o=new ReadableStream({cancel:async e=>{s=!0,this.abort(e);try{await r.cancel(e)}finally{n()}},pull:async e=>{try{const{done:t,value:o}=await r.read();if(s)return;t?(n(),e.close()):e.enqueue(o)}catch(t){s||(this.abort(t),n(),e.error(t))}}},{highWaterMark:0});return new Response(o,e)}onAbort=()=>this.abort(this.request.signal.reason)}const r=(e,r)=>r||"undefined"!=typeof process&&"1"===process.env.SSR_BOOST_TIMELINE?new t(e):void 0;export{r as createTimeline,t as default};
|
|
2
2
|
//# sourceMappingURL=request-timeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-timeline.js","sources":["../../src/services/request-timeline.ts"],"sourcesContent":[null],"names":["describeReason","reason","Error","message","JSON","stringify","RequestTimeline","request","events","started","performance","now","ended","aborted","constructor","this","signal","onAbort","addEventListener","once","
|
|
1
|
+
{"version":3,"file":"request-timeline.js","sources":["../../src/services/request-timeline.ts"],"sourcesContent":[null],"names":["describeReason","reason","Error","message","JSON","stringify","RequestTimeline","request","events","started","performance","now","ended","aborted","constructor","this","signal","onAbort","addEventListener","once","record","stage","detail","push","at","abort","end","removeEventListener","process","env","SSR_BOOST_TIMELINE","NODE_ENV","console","info","type","method","path","URL","url","pathname","timeline","response","body","responseBody","reader","getReader","isStopped","finish","releaseLock","ReadableStream","cancel","async","pull","controller","done","isDone","value","read","close","enqueue","error","highWaterMark","Response","createTimeline","diagnostics","undefined"],"mappings":"AAsBA,MAAMA,EAAkBC,IACtB,GAAIA,aAAkBC,MACpB,OAAOD,EAAOE,QAGhB,GAAsB,iBAAXF,EACT,OAAOA,EAGT,IACE,OAAOG,KAAKC,UAAUJ,IAAW,kBACnC,CAAE,MACA,MAAO,6BACT,GAIF,MAAMK,EA4BiBC,QAxBLC,OAA2B,GAK3BC,QAAUC,YAAYC,MAK5BC,OAAQ,EAKRC,SAAU,EAKpB,WAAAC,CAIqBP,GAAAQ,KAAAR,QAAAA,EAEnB,MAAMS,OAAEA,GAAWT,EAEfS,EAAOH,QACTE,KAAKE,UAELD,EAAOE,iBAAiB,QAASH,KAAKE,QAAS,CAAEE,MAAM,GAE3D,CAGO,MAAAC,CAAOC,EAAsBC,GAC7BP,KAAKH,OACRG,KAAKP,OAAOe,KAAK,CAAEF,QAAOG,GAAId,YAAYC,MAAQI,KAAKN,WAAYa,GAEvE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AIC,mBAC1D,IAAIxB,EAAgBC,QACpB0D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-asset-preparer.js","sources":["../../src/services/route-asset-preparer.ts"],"sourcesContent":[null],"names":["createAssetPreparer","assets","async","context","executionContext","hints","injectAssets","Boolean","onEarlyHints","has"],"mappings":"AAMA,MAAMA,EACJC,
|
|
1
|
+
{"version":3,"file":"route-asset-preparer.js","sources":["../../src/services/route-asset-preparer.ts"],"sourcesContent":[null],"names":["createAssetPreparer","assets","async","context","executionContext","hints","injectAssets","Boolean","onEarlyHints","has"],"mappings":"AAMA,MAAMA,EACJC,GAKOC,OAASC,UAASC,uBACvB,MAAMC,EAAQJ,EAAOK,aAAaH,EAASI,QAAQH,GAAkBI,eAEjEH,EAAMI,IAAI,eACNL,GAAkBI,eAAeH"}
|