@repdf/preview 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +381 -0
- package/dist/preview/.next/BUILD_ID +1 -1
- package/dist/preview/.next/build-manifest.json +27 -29
- package/dist/preview/.next/cache/.previewinfo +1 -0
- package/dist/preview/.next/cache/.rscinfo +1 -0
- package/dist/preview/.next/cache/.tsbuildinfo +1 -1
- package/dist/preview/.next/cache/webpack/client-production/0.pack +0 -0
- package/dist/preview/.next/cache/webpack/client-production/index.pack +0 -0
- package/dist/preview/.next/cache/webpack/edge-server-production/0.pack +0 -0
- package/dist/preview/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/dist/preview/.next/cache/webpack/server-production/0.pack +0 -0
- package/dist/preview/.next/cache/webpack/server-production/index.pack +0 -0
- package/dist/preview/.next/diagnostics/build-diagnostics.json +6 -0
- package/dist/preview/.next/diagnostics/framework.json +1 -0
- package/dist/preview/.next/export-marker.json +6 -1
- package/dist/preview/.next/images-manifest.json +67 -1
- package/dist/preview/.next/next-minimal-server.js.nft.json +1 -1
- package/dist/preview/.next/next-server.js.nft.json +1 -1
- package/dist/preview/.next/prerender-manifest.json +11 -1
- package/dist/preview/.next/react-loadable-manifest.json +2 -2
- package/dist/preview/.next/required-server-files.js +334 -0
- package/dist/preview/.next/required-server-files.json +334 -1
- package/dist/preview/.next/routes-manifest.json +105 -1
- package/dist/preview/.next/server/chunks/18.js +1 -0
- package/dist/preview/.next/server/chunks/504.js +1 -0
- package/dist/preview/.next/server/chunks/539.js +4 -0
- package/dist/preview/.next/server/chunks/619.js +6 -0
- package/dist/preview/.next/server/chunks/934.js +5 -0
- package/dist/preview/.next/server/chunks/937.js +19 -0
- package/dist/preview/.next/server/chunks/985.js +1 -0
- package/dist/preview/.next/server/dynamic-css-manifest.js +1 -0
- package/dist/preview/.next/server/functions-config-manifest.json +4 -1
- package/dist/preview/.next/server/middleware-build-manifest.js +1 -1
- package/dist/preview/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/preview/.next/server/pages/_app.js +1 -1
- package/dist/preview/.next/server/pages/_app.js.nft.json +1 -1
- package/dist/preview/.next/server/pages/_document.js +1 -1
- package/dist/preview/.next/server/pages/_document.js.nft.json +1 -1
- package/dist/preview/.next/server/pages/_error.js +1 -1
- package/dist/preview/.next/server/pages/_error.js.nft.json +1 -1
- package/dist/preview/.next/server/pages/api/component.js +4 -4
- package/dist/preview/.next/server/pages/api/component.js.nft.json +1 -1
- package/dist/preview/.next/server/pages/api/pdf.js +2 -2
- package/dist/preview/.next/server/pages/api/pdf.js.nft.json +1 -1
- package/dist/preview/.next/server/pages/api/trpc/[trpc].js +1 -1
- package/dist/preview/.next/server/pages/api/trpc/[trpc].js.nft.json +1 -1
- package/dist/preview/.next/server/pages/en/404.html +1 -1
- package/dist/preview/.next/server/pages/en/500.html +1 -1
- package/dist/preview/.next/server/pages/en/test.html +1 -1
- package/dist/preview/.next/server/pages/index.js +3 -3
- package/dist/preview/.next/server/pages/index.js.nft.json +1 -1
- package/dist/preview/.next/server/pages/preview/[...relTemplatePath].js +1 -1
- package/dist/preview/.next/server/pages/preview/[...relTemplatePath].js.nft.json +1 -1
- package/dist/preview/.next/server/pages/test.js.nft.json +1 -1
- package/dist/preview/.next/server/pages-manifest.json +13 -1
- package/dist/preview/.next/server/webpack-api-runtime.js +1 -1
- package/dist/preview/.next/server/webpack-runtime.js +1 -1
- package/dist/preview/.next/static/chunks/440-7f86160d543d19eb.js +1 -0
- package/dist/preview/.next/static/chunks/framework-c1a985c867714b4b.js +1 -0
- package/dist/preview/.next/static/chunks/main-3c8a75f1bd6d0687.js +5 -0
- package/dist/preview/.next/static/chunks/pages/_app-6411e6a26996cdef.js +182 -0
- package/dist/preview/.next/static/chunks/pages/_error-4911830c68e733ed.js +1 -0
- package/dist/preview/.next/static/chunks/pages/index-303e0eb1a2330d43.js +55 -0
- package/dist/preview/.next/static/chunks/pages/preview/[...relTemplatePath]-9bf0ebcb9e9f9c65.js +1 -0
- package/dist/preview/.next/static/chunks/pages/test-787280cd6c1cdb85.js +1 -0
- package/dist/preview/.next/static/chunks/webpack-6f363cd1990801ba.js +1 -0
- package/dist/preview/.next/static/css/a1c9c82f00c72350.css +1 -0
- package/dist/preview/.next/static/uQjdkl4yTW6Zpf-3uNg2P/_buildManifest.js +1 -0
- package/dist/preview/.next/trace +9 -13
- package/dist/preview/.next/trace-build +1 -0
- package/dist/preview/.next/types/routes.d.ts +58 -0
- package/dist/preview/.next/types/validator.ts +97 -0
- package/package.json +47 -47
- package/dist/index.js +0 -267
- package/dist/preview/.next/server/chunks/239.js +0 -6
- package/dist/preview/.next/server/chunks/276.js +0 -1
- package/dist/preview/.next/server/chunks/444.js +0 -4
- package/dist/preview/.next/server/chunks/903.js +0 -1
- package/dist/preview/.next/server/font-manifest.json +0 -1
- package/dist/preview/.next/static/KcxCEfbjkQZ7a2n1JJAmW/_buildManifest.js +0 -1
- package/dist/preview/.next/static/chunks/64-33135d2a0b032c99.js +0 -1
- package/dist/preview/.next/static/chunks/837-9d4cc2d57e81e85c.js +0 -1
- package/dist/preview/.next/static/chunks/framework-e0f347a11a70369e.js +0 -1
- package/dist/preview/.next/static/chunks/main-32f0addb06a02100.js +0 -1
- package/dist/preview/.next/static/chunks/pages/_app-7fa4f80c08ce0ec4.js +0 -182
- package/dist/preview/.next/static/chunks/pages/_error-0577f827b4afb66a.js +0 -1
- package/dist/preview/.next/static/chunks/pages/index-0ad3d9cfeac8a6ab.js +0 -1
- package/dist/preview/.next/static/chunks/pages/preview/[...relTemplatePath]-e0152b67b748423c.js +0 -1
- package/dist/preview/.next/static/chunks/pages/test-1b0ec700afcdd64b.js +0 -1
- package/dist/preview/.next/static/chunks/webpack-0b5d8249fb15f5f3.js +0 -1
- package/dist/preview/.next/static/css/2f58a14ea86bceaa.css +0 -3
- /package/dist/{index.d.ts → index.d.mts} +0 -0
- /package/dist/preview/.next/{server/chunks/font-manifest.json → dynamic-css-manifest.json} +0 -0
- /package/dist/preview/.next/static/{KcxCEfbjkQZ7a2n1JJAmW → uQjdkl4yTW6Zpf-3uNg2P}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var
|
|
1
|
+
"use strict";(()=>{var a={};a.id=87,a.ids=[87],a.modules={139:a=>{a.exports=require("node:cluster")},162:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{config:()=>p,default:()=>o,handler:()=>n});var e=c(4336),f=c(6869),g=c(822),h=c(6537),i=c(2420),j=c(8082),k=c(1952),l=c(9232),m=a([i]);i=(m.then?(await m)():m)[0];let o=(0,h.M)(i,"default"),p=(0,h.M)(i,"config"),q=new g.PagesAPIRouteModule({definition:{kind:f.A.PAGES_API,page:"/api/pdf",pathname:"/api/pdf",bundlePath:"",filename:""},userland:i,distDir:".next",relativeProjectDir:""});async function n(a,b,c){q.isDev&&(0,l.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/pdf",f=await q.prepare(a,b,{srcPage:d});if(!f){b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve());return}let{query:g,params:h,prerenderManifest:i,routerServerContext:m}=f;try{let c=a.method||"GET",e=(0,j.getTracer)(),f=e.getActiveScopeSpan(),l=q.instrumentationOnRequestError.bind(q),n=async f=>q.render(a,b,{query:{...g,...h},params:h,allowedRevalidateHeaderKeys:[],multiZoneDraftMode:!1,trustHostHeader:!1,previewProps:i.preview,propagateError:!1,dev:q.isDev,page:"/api/pdf",internalRevalidate:null==m?void 0:m.revalidate,onError:(...b)=>l(a,...b)}).finally(()=>{if(!f)return;f.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let a=e.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==k.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let g=a.get("next.route");if(g){let a=`${c} ${g}`;f.setAttributes({"next.route":g,"http.route":g,"next.span_name":a}),f.updateName(a)}else f.updateName(`${c} ${d}`)});f?await n(f):await e.withPropagatedContext(a.headers,()=>e.trace(k.BaseServerSpan.handleRequest,{spanName:`${c} ${d}`,kind:j.SpanKind.SERVER,attributes:{"http.method":c,"http.target":a.url}},n))}catch(a){if(q.isDev)throw a;(0,e.sendError)(b,500,"Internal Server Error")}finally{null==c.waitUntil||c.waitUntil.call(c,Promise.resolve())}}d()}catch(a){d(a)}})},481:a=>{a.exports=require("node:readline")},610:a=>{a.exports=require("node:dns")},643:a=>{a.exports=require("node:perf_hooks")},714:a=>{a.exports=require("node:vm")},802:a=>{a.exports=import("clsx")},1152:a=>{a.exports=require("esbuild")},1314:a=>{a.exports=require("node:dgram")},1421:a=>{a.exports=require("node:child_process")},1455:a=>{a.exports=require("node:fs/promises")},1692:a=>{a.exports=require("node:tls")},1708:a=>{a.exports=require("node:process")},1792:a=>{a.exports=require("node:querystring")},2420:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{default:()=>k});var e=c(8312),f=c(6751),g=c(3776),h=c(6520),i=c(9049),j=a([e]);async function k(a,b){let c,d,j,{relativeTemplatePath:k,previewPropGroup:l}=a.query;if(!k||"string"!=typeof k)return b.status(400).json({html:"Missing or invalid relativeTemplatePath parameter"});try{c=(0,i.X)(l)}catch(a){return b.status(400).json({error:a.message})}let m=performance.now();try{d=await (0,h.getPdfComponent)(`${(0,f.s)()}/${k}`)}catch(a){return b.status(400).json({error:a.message})}let n=performance.now()-m;if(g.A.debug({ms:n.toFixed(2),template:k},"pdf API: getPdfComponent complete"),"error"in d){let a=d.error;return b.status(500).json({error:a.message})}let o=d.pdfComponent,p=o.PreviewSettings?.pdfSettings||{},q=(0,i.B)(o.PreviewSettings?.previewProps,c),r=performance.now(),s=await d.render(d.createElement(o,q)),t=performance.now()-r;g.A.debug({ms:t.toFixed(2),template:k},"pdf API: HTML render complete");let u=performance.now();try{j=await (0,e.X5)()}catch(a){if(a instanceof e.Us)return b.setHeader("Content-Type","text/html"),b.status(503).send(`<!DOCTYPE html>
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<style>
|
|
@@ -59,4 +59,4 @@
|
|
|
59
59
|
<p class="hint">Checked common paths for macOS, Linux, and Windows. Set CHROME_PATH to override.</p>
|
|
60
60
|
</div>
|
|
61
61
|
</body>
|
|
62
|
-
</html>`);throw
|
|
62
|
+
</html>`);throw a}let v=performance.now()-u;g.A.debug({ms:v.toFixed(2)},"pdf API: browser acquired");let w=await j.newPage(),x=performance.now();await w.setContent(s,{waitUntil:"networkidle0"}),await w.emulateMediaType("screen");let y=await w.pdf({outline:!0,format:"a4",printBackground:!0,...p});await w.close();let z=performance.now()-x;return g.A.debug({ms:z.toFixed(2)},"pdf API: Puppeteer PDF generation complete"),b.setHeader("Content-Type","application/pdf"),b.setHeader("Cache-Control","no-store, max-age=0"),b.setHeader("Server-Timing",`compile;dur=${n.toFixed(2)}, render;dur=${t.toFixed(2)}, browser;dur=${v.toFixed(2)}, pdf;dur=${z.toFixed(2)}`),b.status(200).send(Buffer.from(y))}e=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},2467:a=>{a.exports=require("node:http2")},3024:a=>{a.exports=require("node:fs")},3027:a=>{a.exports=require("stacktrace-parser")},3053:a=>{a.exports=require("node:diagnostics_channel")},3136:a=>{a.exports=require("node:url")},3308:a=>{a.exports=require("node:constants")},3429:a=>{a.exports=require("node:util/types")},3700:a=>{a.exports=require("node:punycode")},4552:a=>{a.exports=require("pino")},4573:a=>{a.exports=require("node:buffer")},4589:a=>{a.exports=require("node:assert")},4708:a=>{a.exports=require("node:https")},5510:a=>{a.exports=require("source-map-js")},5538:a=>{a.exports=require("node:repl")},5600:a=>{a.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},5919:a=>{a.exports=require("node:worker_threads")},5979:a=>{a.exports=import("tailwind-merge")},6193:a=>{a.exports=require("node:string_decoder")},6564:a=>{a.exports=require("node:domain")},6592:a=>{a.exports=require("node:inspector")},6698:a=>{a.exports=require("node:async_hooks")},6760:a=>{a.exports=require("node:path")},7030:a=>{a.exports=require("node:net")},7066:a=>{a.exports=require("node:tty")},7067:a=>{a.exports=require("node:http")},7075:a=>{a.exports=require("node:stream")},7540:a=>{a.exports=require("node:console")},7598:a=>{a.exports=require("node:crypto")},7975:a=>{a.exports=require("node:util")},7997:a=>{a.exports=require("node:timers")},8161:a=>{a.exports=require("node:os")},8312:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Us:()=>l,X5:()=>i});var e=c(3024),f=c(8856),g=c(3776),h=a([f]);f=(h.then?(await h)():h)[0];let j=null,k={darwin:["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome","/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary","/Applications/Chromium.app/Contents/MacOS/Chromium"],linux:["/usr/bin/google-chrome-stable","/usr/bin/google-chrome","/usr/bin/chromium-browser","/usr/bin/chromium","/snap/bin/chromium"],win32:["C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe","C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",`${process.env.LOCALAPPDATA??""}\\Google\\Chrome\\Application\\chrome.exe`]};class l extends Error{constructor(){super("Could not find a Chrome or Chromium installation. Install Chrome or set the CHROME_PATH environment variable."),this.name="ChromeNotFoundError"}}async function i(){if(j?.connected)return j;let a=function(){if(process.env.CHROME_PATH&&(0,e.existsSync)(process.env.CHROME_PATH))return process.env.CHROME_PATH;for(let a of k[process.platform]??[])if((0,e.existsSync)(a))return a;return null}();if(!a)throw new l;return j&&!j.connected?g.A.info("browser disconnected, creating a new instance"):g.A.info(`using Chrome at: ${a}`),j=await f.default.launch({headless:!0,executablePath:a,args:["--no-sandbox","--disable-setuid-sandbox"]})}d()}catch(a){d(a)}})},8474:a=>{a.exports=require("node:events")},8500:a=>{a.exports=require("node:timers/promises")},8522:a=>{a.exports=require("node:zlib")},8732:a=>{a.exports=require("react/jsx-runtime")},8856:a=>{a.exports=import("puppeteer-core")},8877:a=>{a.exports=require("node:v8")},8995:a=>{a.exports=require("node:module")},9049:(a,b,c)=>{c.d(b,{B:()=>e,X:()=>d});let d=a=>{if(a){if(Array.isArray(a))throw Error("previewPropChoice must not be an array");let b=parseInt(a,10);if(isNaN(b))throw Error("previewPropChoice must be a valid number or undefined");return b}return 0},e=(a,b)=>{let c;if(Array.isArray(a))if(a.length<b)throw Error("Invalid preview prop choice");else c=a[b]||{};else c={};return c}}};var b=require("../../webpack-api-runtime.js");b.C(a);var c=b.X(0,[18,539],()=>b(b.s=162));module.exports=c})();
|