nuxt-og-image 3.0.0-rc.9 → 3.0.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/README.md +8 -24
- package/dist/client/200.html +274 -15
- package/dist/client/404.html +274 -15
- package/dist/client/_nuxt/0OCEc-sb.js +1 -0
- package/dist/client/_nuxt/16nqZaIT.js +1 -0
- package/dist/client/_nuxt/3Ts0ZrM4.js +4 -0
- package/dist/client/_nuxt/44JOqR_V.js +1 -0
- package/dist/client/_nuxt/4FkZXfg1.js +3 -0
- package/dist/client/_nuxt/4WleZr1P.js +1 -0
- package/dist/client/_nuxt/5HixFuyr.js +1 -0
- package/dist/client/_nuxt/5bRVBCrv.js +1 -0
- package/dist/client/_nuxt/7LPQ6a13.js +2 -0
- package/dist/client/_nuxt/8WiSp-0_.js +1 -0
- package/dist/client/_nuxt/9CfBjzQa.js +1 -0
- package/dist/client/_nuxt/B-9EjyZr.js +1 -0
- package/dist/client/_nuxt/B-a2BbyY.js +1 -0
- package/dist/client/_nuxt/B0LoMq2b.js +1 -0
- package/dist/client/_nuxt/B1ejXUAS.js +1 -0
- package/dist/client/_nuxt/B2DkETJQ.js +1 -0
- package/dist/client/_nuxt/B3LRAdDP.js +1 -0
- package/dist/client/_nuxt/B3a86pAO.js +1 -0
- package/dist/client/_nuxt/B5La0Eyp.js +1 -0
- package/dist/client/_nuxt/B6E6ObS_.js +8 -0
- package/dist/client/_nuxt/B7-FEXAT.js +1 -0
- package/dist/client/_nuxt/B9HI_aQy.js +1 -0
- package/dist/client/_nuxt/B9vFkdfw.js +1 -0
- package/dist/client/_nuxt/BAGvEKUB.js +1 -0
- package/dist/client/_nuxt/BAp2aEeE.js +1 -0
- package/dist/client/_nuxt/BB9S_66N.js +1 -0
- package/dist/client/_nuxt/BBDuFDsq.js +1 -0
- package/dist/client/_nuxt/BC7ivatP.js +1 -0
- package/dist/client/_nuxt/BCOu96sC.js +1 -0
- package/dist/client/_nuxt/BD3t3nJY.js +1 -0
- package/dist/client/_nuxt/BDJ7po1j.js +1 -0
- package/dist/client/_nuxt/BGk6HrHT.js +1 -0
- package/dist/client/_nuxt/BHSTd-7M.js +1 -0
- package/dist/client/_nuxt/BITGhEdf.js +1 -0
- package/dist/client/_nuxt/BKFBoKT4.js +1 -0
- package/dist/client/_nuxt/BKNiEhql.js +1 -0
- package/dist/client/_nuxt/BLmvGqlk.js +1 -0
- package/dist/client/_nuxt/BMRpS3Xo.js +1 -0
- package/dist/client/_nuxt/BMkdSFOr.js +1 -0
- package/dist/client/_nuxt/BNgG76gt.js +1 -0
- package/dist/client/_nuxt/BNofkYSZ.js +165 -0
- package/dist/client/_nuxt/BOp3HRET.js +1 -0
- package/dist/client/_nuxt/BPhJoBd6.js +1 -0
- package/dist/client/_nuxt/BQnHL-cn.js +1 -0
- package/dist/client/_nuxt/BS9sT-GQ.js +1 -0
- package/dist/client/_nuxt/BSB_bK09.js +1 -0
- package/dist/client/_nuxt/BTtaZsq5.js +1 -0
- package/dist/client/_nuxt/BU83OF-G.js +1 -0
- package/dist/client/_nuxt/BUeIC4cT.js +1 -0
- package/dist/client/_nuxt/BXF7Vm5l.js +1 -0
- package/dist/client/_nuxt/BXP-NDAE.js +1 -0
- package/dist/client/_nuxt/BXUVD3TH.js +1 -0
- package/dist/client/_nuxt/BXWtGw2n.js +6 -0
- package/dist/client/_nuxt/BYLuaE_S.js +3 -0
- package/dist/client/_nuxt/BYelj_cE.js +1 -0
- package/dist/client/_nuxt/B_Sdu6N9.js +1 -0
- package/dist/client/_nuxt/BaWyeHV_.js +1 -0
- package/dist/client/_nuxt/Ba_2pva2.js +1 -0
- package/dist/client/_nuxt/BbJj1K1w.js +1 -0
- package/dist/client/_nuxt/BeX7BQ1y.js +1 -0
- package/dist/client/_nuxt/BeocmOPF.js +1 -0
- package/dist/client/_nuxt/BfVRrWqI.js +1 -0
- package/dist/client/_nuxt/BgEvnnZj.js +1 -0
- package/dist/client/_nuxt/Bgrlo6mM.js +1 -0
- package/dist/client/_nuxt/BiVAY1KT.js +1 -0
- package/dist/client/_nuxt/Bl6w8nq6.js +29 -0
- package/dist/client/_nuxt/BmUjtHPt.js +1 -0
- package/dist/client/_nuxt/Bn5gmY5k.js +1 -0
- package/dist/client/_nuxt/BnYPtiAB.js +1 -0
- package/dist/client/_nuxt/BotTw_1M.js +1 -0
- package/dist/client/_nuxt/BpDWT_aG.js +1 -0
- package/dist/client/_nuxt/BpqPLH6b.js +1 -0
- package/dist/client/_nuxt/Br4herk8.js +1 -0
- package/dist/client/_nuxt/Brmco9EZ.js +2 -0
- package/dist/client/_nuxt/Bs9WCFOo.js +1 -0
- package/dist/client/_nuxt/BsvsQ1iS.js +1 -0
- package/dist/client/_nuxt/BtPWTO6-.js +1 -0
- package/dist/client/_nuxt/BuqjW-Uc.js +1 -0
- package/dist/client/_nuxt/BvCdDh2R.js +1 -0
- package/dist/client/_nuxt/BwUg_Rem.js +1 -0
- package/dist/client/_nuxt/Bxuka25Y.js +1 -0
- package/dist/client/_nuxt/BxwAa5i0.js +1 -0
- package/dist/client/_nuxt/BxwkrKyP.js +3 -0
- package/dist/client/_nuxt/ByN1NmdT.js +11 -0
- package/dist/client/_nuxt/C2Z2wNnw.js +1 -0
- package/dist/client/_nuxt/C3wf4cjV.js +27 -0
- package/dist/client/_nuxt/C5J_9lw5.js +1 -0
- package/dist/client/_nuxt/C6doOGgB.js +1 -0
- package/dist/client/_nuxt/C7n-thn-.js +1 -0
- package/dist/client/_nuxt/C7oZ9nno.js +1 -0
- package/dist/client/_nuxt/C7xspq5a.js +1 -0
- package/dist/client/_nuxt/C86elO-m.js +1 -0
- package/dist/client/_nuxt/C8DXlOXe.js +1 -0
- package/dist/client/_nuxt/C9CNr0dZ.js +1 -0
- package/dist/client/_nuxt/CA2blNRc.js +1 -0
- package/dist/client/_nuxt/CA9nliXM.js +1 -0
- package/dist/client/_nuxt/CCW61mLD.js +1 -0
- package/dist/client/_nuxt/CDNnVXJ3.js +1 -0
- package/dist/client/_nuxt/CDP-pALJ.js +1 -0
- package/dist/client/_nuxt/CFTaR7kf.js +1 -0
- package/dist/client/_nuxt/CFy8Z7mU.js +1 -0
- package/dist/client/_nuxt/CGmujMTu.js +1 -0
- package/dist/client/_nuxt/CHDuk4cg.js +1 -0
- package/dist/client/_nuxt/CJYoS41Z.js +1 -0
- package/dist/client/_nuxt/CKK8qrH7.js +3 -0
- package/dist/client/_nuxt/CKqhLkpw.js +1 -0
- package/dist/client/_nuxt/CLTURUqp.js +9 -0
- package/dist/client/_nuxt/CO7HdiM_.js +1 -0
- package/dist/client/_nuxt/CPQn-Lhb.js +1 -0
- package/dist/client/_nuxt/CPw9RxLe.js +1 -0
- package/dist/client/_nuxt/CRDKj6ck.js +1 -0
- package/dist/client/_nuxt/CRUEGcu5.js +1 -0
- package/dist/client/_nuxt/CRlnGVMD.js +1 -0
- package/dist/client/_nuxt/CS6sTstm.js +4 -0
- package/dist/client/_nuxt/CSPPpfsQ.js +1 -0
- package/dist/client/_nuxt/CTeQKLZv.js +1 -0
- package/dist/client/_nuxt/CTsPJjdJ.js +1 -0
- package/dist/client/_nuxt/CUNQUWO_.js +1 -0
- package/dist/client/_nuxt/CV5B5C80.js +1 -0
- package/dist/client/_nuxt/CZZ6oYdA.js +1 -0
- package/dist/client/_nuxt/CZkFsSlX.js +1 -0
- package/dist/client/_nuxt/C_g069vW.js +1 -0
- package/dist/client/_nuxt/C_h5G2He.js +20 -0
- package/dist/client/_nuxt/CaR_I2C-.js +1 -0
- package/dist/client/_nuxt/Cb48SAmt.js +1 -0
- package/dist/client/_nuxt/Cda-MJFk.js +1 -0
- package/dist/client/_nuxt/CeIpHJfZ.js +12 -0
- package/dist/client/_nuxt/CgwOUXSn.js +1 -0
- package/dist/client/_nuxt/ChH25C4w.js +1 -0
- package/dist/client/_nuxt/CidHYXz9.js +1 -0
- package/dist/client/_nuxt/ClPxYbPx.js +1 -0
- package/dist/client/_nuxt/Clj_IpB8.js +1 -0
- package/dist/client/_nuxt/CmN1UzhW.js +1 -0
- package/dist/client/_nuxt/Crs1WKlG.js +1 -0
- package/dist/client/_nuxt/CsTmP73Z.js +1 -0
- package/dist/client/_nuxt/CsW3I34-.js +1 -0
- package/dist/client/_nuxt/CsuMf1xJ.js +1 -0
- package/dist/client/_nuxt/CsyjKwr8.js +1 -0
- package/dist/client/_nuxt/Ctb_e1-I.js +1 -0
- package/dist/client/_nuxt/CvHWZNAB.js +1 -0
- package/dist/client/_nuxt/CxK4ekaG.js +1 -0
- package/dist/client/_nuxt/CyUS7F7b.js +17 -0
- package/dist/client/_nuxt/Cz-n9WvF.js +1 -0
- package/dist/client/_nuxt/Cz3ygVR-.js +1 -0
- package/dist/client/_nuxt/CzK8D06Z.js +1 -0
- package/dist/client/_nuxt/CzPA46E-.js +1 -0
- package/dist/client/_nuxt/D0N_qbs7.js +2 -0
- package/dist/client/_nuxt/D0pnavP-.js +1 -0
- package/dist/client/_nuxt/D3VXSfF0.js +1 -0
- package/dist/client/_nuxt/D46m5Xd3.js +1 -0
- package/dist/client/_nuxt/D4miJ1xw.js +1 -0
- package/dist/client/_nuxt/D5lQfeOG.js +1 -0
- package/dist/client/_nuxt/D6oCKXcX.js +1 -0
- package/dist/client/_nuxt/D71BffLY.js +1 -0
- package/dist/client/_nuxt/D8V69RRQ.js +1 -0
- package/dist/client/_nuxt/DBLgxP_1.js +2 -0
- package/dist/client/_nuxt/DCmDdbvy.js +1 -0
- package/dist/client/_nuxt/DDG_rSGg.js +8 -0
- package/dist/client/_nuxt/DDK5Hw8n.js +1 -0
- package/dist/client/_nuxt/DFHN_7lU.js +3 -0
- package/dist/client/_nuxt/DFaziNDp.js +1 -0
- package/dist/client/_nuxt/DFsxFixh.js +1 -0
- package/dist/client/_nuxt/DGhhRy1e.js +1 -0
- package/dist/client/_nuxt/DIw1DfnK.js +1 -0
- package/dist/client/_nuxt/DJNHLfzP.js +1 -0
- package/dist/client/_nuxt/DJOPMAPO.js +10 -0
- package/dist/client/_nuxt/DKgh9jPU.js +20 -0
- package/dist/client/_nuxt/DNR26wTC.js +1 -0
- package/dist/client/_nuxt/DO04iIl4.js +1 -0
- package/dist/client/_nuxt/DOOuMSMh.js +1 -0
- package/dist/client/_nuxt/DOqtC9FP.js +1 -0
- package/dist/client/_nuxt/DQ-rpzxz.js +1 -0
- package/dist/client/_nuxt/DRuVOcqL.js +1 -0
- package/dist/client/_nuxt/DSmiUmWA.js +1 -0
- package/dist/client/_nuxt/DSv7Jr7N.js +5 -0
- package/dist/client/_nuxt/DTMFIK7w.js +1 -0
- package/dist/client/_nuxt/DV9_Ze0W.js +1 -0
- package/dist/client/_nuxt/DXZpi2gR.js +1 -0
- package/dist/client/_nuxt/DXdsTRaC.js +1 -0
- package/dist/client/_nuxt/DXtfa3TF.js +1 -0
- package/dist/client/_nuxt/DYgwfmdY.js +1 -0
- package/dist/client/_nuxt/DYikCEmq.js +1 -0
- package/dist/client/_nuxt/DYrknm32.js +1 -0
- package/dist/client/_nuxt/D_lsq3cR.js +1 -0
- package/dist/client/_nuxt/D_nC6SfZ.js +1 -0
- package/dist/client/_nuxt/Dc3u8CCo.js +1 -0
- package/dist/client/_nuxt/DeVv6D4_.js +1 -0
- package/dist/client/_nuxt/Df4vQnuo.js +1 -0
- package/dist/client/_nuxt/Di1G_BEd.js +1 -0
- package/dist/client/_nuxt/DjTlIhuc.js +1 -0
- package/dist/client/_nuxt/Dk2kDqHs.js +1 -0
- package/dist/client/_nuxt/DkIL16gc.js +2 -0
- package/dist/client/_nuxt/DkfuXiRx.js +204 -0
- package/dist/client/_nuxt/DmixpzPA.js +1 -0
- package/dist/client/_nuxt/DnLUQrgA.js +1 -0
- package/dist/client/_nuxt/Dnd6U92I.js +25 -0
- package/dist/client/_nuxt/DofIr7ih.js +1 -0
- package/dist/client/_nuxt/DrUHIbQf.js +1 -0
- package/dist/client/_nuxt/DrhOmAGa.js +1 -0
- package/dist/client/_nuxt/DsO5WfEU.js +1 -0
- package/dist/client/_nuxt/DsclqnHy.js +4 -0
- package/dist/client/_nuxt/Dwk9V841.js +1 -0
- package/dist/client/_nuxt/DyLIn2qo.js +1 -0
- package/dist/client/_nuxt/DzhYcJWo.js +1 -0
- package/dist/client/_nuxt/Dziqk49f.js +1 -0
- package/dist/client/_nuxt/E5r7Moxb.js +16 -0
- package/dist/client/_nuxt/FJDVp-XM.js +1 -0
- package/dist/client/_nuxt/FMRyFT8D.js +1 -0
- package/dist/client/_nuxt/GACPk8cj.js +16 -0
- package/dist/client/_nuxt/H94RPpLS.js +1 -0
- package/dist/client/_nuxt/HrnDn_2Q.js +1 -0
- package/dist/client/_nuxt/HxmVvryO.js +1 -0
- package/dist/client/_nuxt/JYC31MTV.js +1 -0
- package/dist/client/_nuxt/Jl0QvYgb.js +1 -0
- package/dist/client/_nuxt/KA8c-whL.js +1 -0
- package/dist/client/_nuxt/KEYLhlmT.js +1 -0
- package/dist/client/_nuxt/KN-DOLVO.js +1 -0
- package/dist/client/_nuxt/Ka_J5llu.js +1 -0
- package/dist/client/_nuxt/KuNYkU7X.js +1 -0
- package/dist/client/_nuxt/MS3qTAOR.js +1 -0
- package/dist/client/_nuxt/N3zwmhmW.js +1 -0
- package/dist/client/_nuxt/O4cDyHwR.js +1 -0
- package/dist/client/_nuxt/OPd3ySAa.js +1 -0
- package/dist/client/_nuxt/Opso89zU.js +16 -0
- package/dist/client/_nuxt/P3XzCKkX.js +1 -0
- package/dist/client/_nuxt/PBlC1IT3.js +1 -0
- package/dist/client/_nuxt/PauOf_jS.js +1 -0
- package/dist/client/_nuxt/Qj0mFepl.js +14 -0
- package/dist/client/_nuxt/R9SNgiQ9.js +1 -0
- package/dist/client/_nuxt/Rc0-bMtX.js +1 -0
- package/dist/client/_nuxt/TYaudu4O.js +1 -0
- package/dist/client/_nuxt/UREJT2Bw.js +1 -0
- package/dist/client/_nuxt/VRCUJX8G.js +1 -0
- package/dist/client/_nuxt/VntNkNt1.js +1 -0
- package/dist/client/_nuxt/Ys9ZunwU.js +1 -0
- package/dist/client/_nuxt/YxQm0tCS.js +1 -0
- package/dist/client/_nuxt/alpzPJ78.js +1 -0
- package/dist/client/_nuxt/bEygH-WE.js +3 -0
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/c0255dff-4096-412a-b1f2-8c73ec29c527.json +1 -0
- package/dist/client/_nuxt/cW9vKj3g.js +1 -0
- package/dist/client/_nuxt/eJKZXzCK.js +1 -0
- package/dist/client/_nuxt/eQYbbmqd.js +16 -0
- package/dist/client/_nuxt/entry.DtsycVcr.css +1 -0
- package/dist/client/_nuxt/error-404.D2eZnIkK.css +1 -0
- package/dist/client/_nuxt/error-500.BJ-KsTwR.css +1 -0
- package/dist/client/_nuxt/gwSZkKbG.js +1 -0
- package/dist/client/_nuxt/hXH8Gyq8.js +1 -0
- package/dist/client/_nuxt/i0hkWYmE.js +1 -0
- package/dist/client/_nuxt/iSbrOpM4.js +1 -0
- package/dist/client/_nuxt/ithPx4uF.js +1 -0
- package/dist/client/_nuxt/jDrCW69G.js +1 -0
- package/dist/client/_nuxt/jaXbsbtS.js +1 -0
- package/dist/client/_nuxt/kveMaAK5.js +1 -0
- package/dist/client/_nuxt/lBoe4CZw.js +1 -0
- package/dist/client/_nuxt/lPxKsdjn.js +1 -0
- package/dist/client/_nuxt/lRZxrFTT.js +1 -0
- package/dist/client/_nuxt/mvTh5Gok.js +1 -0
- package/dist/client/_nuxt/pCnzZaOt.js +1 -0
- package/dist/client/_nuxt/qpF8edk8.js +1 -0
- package/dist/client/_nuxt/qvnQm5y7.js +1 -0
- package/dist/client/_nuxt/qwoaayiL.js +1 -0
- package/dist/client/_nuxt/qxoleWdb.js +1 -0
- package/dist/client/_nuxt/rS0jd3Ly.js +1 -0
- package/dist/client/_nuxt/sMI-pExk.js +1 -0
- package/dist/client/_nuxt/t1S7pxBA.js +1 -0
- package/dist/client/_nuxt/t6MJYFCU.js +5 -0
- package/dist/client/_nuxt/tEd5xQ4M.js +1 -0
- package/dist/client/_nuxt/xGgVA17b.js +1 -0
- package/dist/client/_nuxt/xPNGhBYe.js +1 -0
- package/dist/client/_nuxt/xuIuMB9j.js +1 -0
- package/dist/client/_nuxt/yvfKceIB.js +1 -0
- package/dist/client/_nuxt/z5DqfkHR.js +1 -0
- package/dist/client/index.html +274 -15
- package/dist/module.d.mts +23 -108
- package/dist/module.d.ts +23 -108
- package/dist/module.json +6 -2
- package/dist/module.mjs +430 -222
- package/dist/runtime/assets/Inter-400.ttf.base64 +1 -0
- package/dist/runtime/assets/Inter-700.ttf.base64 +1 -0
- package/dist/runtime/nitro/og-image/bindings/chromium/chrome-launcher.js +9 -0
- package/dist/runtime/nitro/og-image/bindings/chromium/on-demand.d.ts +2 -0
- package/dist/runtime/nitro/og-image/bindings/chromium/on-demand.js +35 -0
- package/dist/runtime/nitro/og-image/bindings/chromium/playwright.d.ts +2 -0
- package/dist/runtime/nitro/og-image/bindings/chromium/playwright.js +6 -0
- package/dist/runtime/nitro/og-image/bindings/css-inline/node.d.ts +8 -0
- package/dist/runtime/nitro/og-image/bindings/css-inline/node.js +7 -0
- package/dist/runtime/nitro/og-image/bindings/css-inline/wasm-fs.d.ts +7 -0
- package/dist/runtime/nitro/og-image/bindings/css-inline/wasm-fs.js +8 -0
- package/dist/runtime/nitro/og-image/bindings/css-inline/wasm.d.ts +7 -0
- package/dist/runtime/nitro/og-image/bindings/css-inline/wasm.js +7 -0
- package/dist/runtime/{core → nitro/og-image}/bindings/resvg/wasm-fs.d.ts +1 -1
- package/dist/runtime/{core/bindings/resvg/wasm-fs.mjs → nitro/og-image/bindings/resvg/wasm-fs.js} +1 -1
- package/dist/runtime/{core → nitro/og-image}/bindings/resvg/wasm.d.ts +1 -1
- package/dist/runtime/nitro/og-image/bindings/resvg/wasm.js +5 -0
- package/dist/runtime/{core/bindings/satori/wasm-fs.mjs → nitro/og-image/bindings/satori/wasm-fs.js} +1 -1
- package/dist/runtime/{core/bindings/satori/wasm.mjs → nitro/og-image/bindings/satori/wasm.js} +2 -3
- package/dist/runtime/nitro/og-image/cache/lru.d.ts +9 -0
- package/dist/runtime/nitro/og-image/cache/lru.js +15 -0
- package/dist/runtime/nitro/og-image/cache/mock.d.ts +9 -0
- package/dist/runtime/nitro/og-image/cache/mock.js +9 -0
- package/dist/runtime/{core/renderers/chromium/index.d.ts → nitro/og-image/chromium/renderer.d.ts} +1 -1
- package/dist/runtime/{core/renderers/chromium/index.mjs → nitro/og-image/chromium/renderer.js} +2 -2
- package/dist/runtime/{core/renderers → nitro/og-image}/chromium/screenshot.d.ts +1 -2
- package/dist/runtime/{core/renderers/chromium/screenshot.mjs → nitro/og-image/chromium/screenshot.js} +2 -2
- package/dist/runtime/nitro/og-image/context.d.ts +5 -0
- package/dist/runtime/nitro/og-image/context.js +181 -0
- package/dist/runtime/nitro/og-image/instances.d.ts +2 -0
- package/dist/runtime/nitro/og-image/instances.js +10 -0
- package/dist/runtime/nitro/og-image/satori/font.d.ts +3 -0
- package/dist/runtime/nitro/og-image/satori/font.js +39 -0
- package/dist/runtime/{core/renderers → nitro/og-image}/satori/instances.d.ts +3 -4
- package/dist/runtime/{core/renderers/satori/instances.mjs → nitro/og-image/satori/instances.js} +2 -11
- package/dist/runtime/nitro/og-image/satori/plugins/classes.js +17 -0
- package/dist/runtime/{core/renderers/satori/plugins/emojis.mjs → nitro/og-image/satori/plugins/emojis.js} +2 -2
- package/dist/runtime/nitro/og-image/satori/plugins/encoding.js +17 -0
- package/dist/runtime/nitro/og-image/satori/plugins/flex.js +35 -0
- package/dist/runtime/nitro/og-image/satori/plugins/imageSrc.js +89 -0
- package/dist/runtime/{core/renderers/satori/plugins/unocss.mjs → nitro/og-image/satori/plugins/unocss.js} +2 -2
- package/dist/runtime/{core/renderers/satori/index.d.ts → nitro/og-image/satori/renderer.d.ts} +1 -1
- package/dist/runtime/{core/renderers/satori/index.mjs → nitro/og-image/satori/renderer.js} +26 -17
- package/dist/runtime/{core/html/applyEmojis.d.ts → nitro/og-image/satori/transforms/emojis.d.ts} +2 -2
- package/dist/runtime/nitro/og-image/satori/transforms/emojis.js +3593 -0
- package/dist/runtime/nitro/og-image/satori/transforms/inlineCss.d.ts +3 -0
- package/dist/runtime/nitro/og-image/satori/transforms/inlineCss.js +50 -0
- package/dist/runtime/{core/renderers → nitro/og-image}/satori/utils.d.ts +2 -2
- package/dist/runtime/{core/renderers/satori/utils.mjs → nitro/og-image/satori/utils.js} +9 -5
- package/dist/runtime/{core/renderers → nitro/og-image}/satori/vnodes.d.ts +1 -1
- package/dist/runtime/nitro/og-image/satori/vnodes.js +38 -0
- package/dist/runtime/nitro/og-image/templates/html.d.ts +2 -0
- package/dist/runtime/{core/html/devIframeTemplate.mjs → nitro/og-image/templates/html.js} +31 -29
- package/dist/runtime/nitro/plugins/__zero-runtime/nuxt-content.d.ts +2 -0
- package/dist/runtime/nitro/plugins/__zero-runtime/nuxt-content.js +9 -0
- package/dist/runtime/nitro/plugins/nuxt-content.d.ts +1 -1
- package/dist/runtime/nitro/plugins/nuxt-content.js +5 -0
- package/dist/runtime/nitro/plugins/prerender.js +33 -0
- package/dist/runtime/nitro/routes/__zero-runtime/font.js +8 -0
- package/dist/runtime/nitro/routes/__zero-runtime/image.js +8 -0
- package/dist/runtime/{server/routes/__og-image__ → nitro/routes}/debug.json.d.ts +1 -1
- package/dist/runtime/{server/routes/__og-image__/debug.json.mjs → nitro/routes/debug.json.js} +2 -2
- package/dist/runtime/nitro/routes/font.d.ts +2 -0
- package/dist/runtime/nitro/routes/font.js +3 -0
- package/dist/runtime/nitro/routes/image.d.ts +2 -0
- package/dist/runtime/nitro/routes/image.js +3 -0
- package/dist/runtime/nitro/tsconfig.json +3 -0
- package/dist/runtime/{cache.d.ts → nitro/util/cache.d.ts} +2 -2
- package/dist/runtime/{cache.mjs → nitro/util/cache.js} +5 -4
- package/dist/runtime/nitro/util/encoding.d.ts +3 -0
- package/dist/runtime/nitro/util/encoding.js +15 -0
- package/dist/runtime/nitro/util/eventHandlers.d.ts +3 -0
- package/dist/runtime/nitro/util/eventHandlers.js +155 -0
- package/dist/runtime/nitro/util/kit.d.ts +6 -0
- package/dist/runtime/nitro/util/kit.js +32 -0
- package/dist/runtime/nitro/util/logger.d.ts +1 -0
- package/dist/runtime/nitro/util/logger.js +6 -0
- package/dist/runtime/nitro/util/options.d.ts +2 -0
- package/dist/runtime/nitro/util/options.js +18 -0
- package/dist/runtime/nitro/util/plugins.d.ts +2 -0
- package/dist/runtime/nitro/{plugins/nuxt-content.mjs → util/plugins.js} +12 -8
- package/dist/runtime/{core/utils → nitro/util}/wasm.d.ts +0 -1
- package/dist/runtime/{components → nuxt/components}/OgImage/OgImage.d.ts +2 -4
- package/dist/runtime/nuxt/components/OgImage/OgImageScreenshot.d.ts +3 -0
- package/dist/runtime/nuxt/components/Templates/Community/Frame.vue +64 -0
- package/dist/runtime/{components → nuxt/components}/Templates/Community/Nuxt.vue +6 -5
- package/dist/runtime/{components → nuxt/components}/Templates/Community/NuxtSeo.vue +7 -7
- package/dist/runtime/{components → nuxt/components}/Templates/Community/Pergel.vue +1 -2
- package/dist/runtime/{components → nuxt/components}/Templates/Community/UnJs.vue +2 -2
- package/dist/runtime/{composables → nuxt/composables}/defineOgImage.d.ts +1 -1
- package/dist/runtime/{composables/defineOgImage.mjs → nuxt/composables/defineOgImage.js} +12 -15
- package/dist/runtime/{composables → nuxt/composables}/defineOgImageComponent.d.ts +1 -1
- package/dist/runtime/{composables/defineOgImageComponent.mjs → nuxt/composables/defineOgImageComponent.js} +1 -1
- package/dist/runtime/nuxt/composables/defineOgImageScreenshot.d.ts +2 -0
- package/dist/runtime/nuxt/composables/mock.d.ts +5 -0
- package/dist/runtime/nuxt/composables/mock.js +6 -0
- package/dist/runtime/nuxt/plugins/__zero-runtime/og-image-canonical-urls.server.d.ts +2 -0
- package/dist/runtime/nuxt/plugins/__zero-runtime/og-image-canonical-urls.server.js +9 -0
- package/dist/runtime/nuxt/plugins/__zero-runtime/route-rule-og-image.server.d.ts +2 -0
- package/dist/runtime/nuxt/plugins/__zero-runtime/route-rule-og-image.server.js +9 -0
- package/dist/runtime/nuxt/plugins/og-image-canonical-urls.server.d.ts +1 -1
- package/dist/runtime/nuxt/plugins/og-image-canonical-urls.server.js +5 -0
- package/dist/runtime/nuxt/plugins/route-rule-og-image.server.d.ts +1 -1
- package/dist/runtime/nuxt/plugins/route-rule-og-image.server.js +5 -0
- package/dist/runtime/nuxt/utils/plugins.d.ts +3 -0
- package/dist/runtime/nuxt/utils/plugins.js +87 -0
- package/dist/runtime/nuxt/utils.d.ts +3 -2
- package/dist/runtime/nuxt/{utils.mjs → utils.js} +12 -7
- package/dist/runtime/{utils.pure.d.ts → pure.d.ts} +2 -1
- package/dist/runtime/{utils.pure.mjs → pure.js} +22 -3
- package/dist/runtime/{utils.d.ts → shared.d.ts} +2 -2
- package/dist/runtime/{utils.mjs → shared.js} +5 -4
- package/dist/runtime/types.d.ts +19 -10
- package/dist/types.d.mts +2 -13
- package/dist/types.d.ts +2 -13
- package/package.json +87 -60
- package/dist/client/_nuxt/IconCSS.d0e7b355.js +0 -1
- package/dist/client/_nuxt/IconCSS.f0b56d3e.css +0 -1
- package/dist/client/_nuxt/builds/meta/bb3d9bad-71c2-44e9-bdfb-e309e6d8b22d.json +0 -1
- package/dist/client/_nuxt/entry.a30f63d0.css +0 -1
- package/dist/client/_nuxt/entry.c7946b24.js +0 -108
- package/dist/client/_nuxt/error-404.1290b959.js +0 -1
- package/dist/client/_nuxt/error-404.b751fa02.css +0 -1
- package/dist/client/_nuxt/error-500.69009e70.css +0 -1
- package/dist/client/_nuxt/error-500.de7cdd09.js +0 -1
- package/dist/client/_nuxt/vanilla-picker-NKbIFE8h.23409a58.js +0 -8
- package/dist/runtime/components/OgImage/OgImageScreenshot.d.ts +0 -5
- package/dist/runtime/composables/defineOgImageScreenshot.d.ts +0 -2
- package/dist/runtime/core/bindings/chromium/node.mjs +0 -33
- package/dist/runtime/core/bindings/css-inline/node.d.ts +0 -2
- package/dist/runtime/core/bindings/css-inline/node.mjs +0 -2
- package/dist/runtime/core/bindings/resvg/wasm.mjs +0 -6
- package/dist/runtime/core/cache/emojis.d.ts +0 -1
- package/dist/runtime/core/cache/emojis.mjs +0 -5
- package/dist/runtime/core/cache/fonts.d.ts +0 -3
- package/dist/runtime/core/cache/fonts.mjs +0 -6
- package/dist/runtime/core/cache/htmlPayload.d.ts +0 -5
- package/dist/runtime/core/cache/htmlPayload.mjs +0 -6
- package/dist/runtime/core/cache/prerender.d.ts +0 -2
- package/dist/runtime/core/cache/prerender.mjs +0 -5
- package/dist/runtime/core/env/assets.d.ts +0 -1
- package/dist/runtime/core/env/assets.mjs +0 -11
- package/dist/runtime/core/font/fetch.d.ts +0 -2
- package/dist/runtime/core/font/fetch.mjs +0 -36
- package/dist/runtime/core/html/applyEmojis.mjs +0 -37
- package/dist/runtime/core/html/applyInlineCss.d.ts +0 -3
- package/dist/runtime/core/html/applyInlineCss.mjs +0 -32
- package/dist/runtime/core/html/devIframeTemplate.d.ts +0 -2
- package/dist/runtime/core/html/fetchIsland.d.ts +0 -3
- package/dist/runtime/core/html/fetchIsland.mjs +0 -17
- package/dist/runtime/core/options/extract.d.ts +0 -3
- package/dist/runtime/core/options/extract.mjs +0 -49
- package/dist/runtime/core/options/fetch.d.ts +0 -3
- package/dist/runtime/core/options/fetch.mjs +0 -32
- package/dist/runtime/core/renderers/satori/plugins/encoding.mjs +0 -8
- package/dist/runtime/core/renderers/satori/plugins/flex.mjs +0 -10
- package/dist/runtime/core/renderers/satori/plugins/imageSrc.mjs +0 -75
- package/dist/runtime/core/renderers/satori/plugins/twClasses.mjs +0 -8
- package/dist/runtime/core/renderers/satori/vnodes.mjs +0 -31
- package/dist/runtime/core/utils/resolveRendererContext.d.ts +0 -3
- package/dist/runtime/core/utils/resolveRendererContext.mjs +0 -97
- package/dist/runtime/nitro/plugins/prerender.mjs +0 -36
- package/dist/runtime/nitro/utils.d.ts +0 -2
- package/dist/runtime/nitro/utils.mjs +0 -16
- package/dist/runtime/nuxt/plugins/og-image-canonical-urls.server.mjs +0 -43
- package/dist/runtime/nuxt/plugins/route-rule-og-image.server.mjs +0 -37
- package/dist/runtime/server/assets/inter-latin-ext-400-normal.woff +0 -0
- package/dist/runtime/server/assets/inter-latin-ext-700-normal.woff +0 -0
- package/dist/runtime/server/routes/__og-image__/font-[name]-[weight].[extension].mjs +0 -49
- package/dist/runtime/server/routes/__og-image__/image.mjs +0 -91
- package/dist/runtime/{core/bindings/chromium/node.d.ts → nitro/og-image/bindings/chromium/chrome-launcher.d.ts} +0 -0
- package/dist/runtime/{core → nitro/og-image}/bindings/resvg/node.d.ts +0 -0
- package/dist/runtime/{core/bindings/resvg/node.mjs → nitro/og-image/bindings/resvg/node.js} +0 -0
- package/dist/runtime/{core → nitro/og-image}/bindings/satori/node.d.ts +0 -0
- package/dist/runtime/{core/bindings/satori/node.mjs → nitro/og-image/bindings/satori/node.js} +0 -0
- package/dist/runtime/{core → nitro/og-image}/bindings/satori/wasm-fs.d.ts +0 -0
- package/dist/runtime/{core → nitro/og-image}/bindings/satori/wasm.d.ts +0 -0
- package/dist/runtime/{core → nitro/og-image}/bindings/sharp/node.d.ts +0 -0
- package/dist/runtime/{core/bindings/sharp/node.mjs → nitro/og-image/bindings/sharp/node.js} +0 -0
- package/dist/runtime/{core/renderers/satori/plugins/emojis.d.ts → nitro/og-image/satori/plugins/classes.d.ts} +0 -0
- package/dist/runtime/{core/renderers/satori/plugins/encoding.d.ts → nitro/og-image/satori/plugins/emojis.d.ts} +0 -0
- package/dist/runtime/{core/renderers/satori/plugins/flex.d.ts → nitro/og-image/satori/plugins/encoding.d.ts} +0 -0
- package/dist/runtime/{core/renderers/satori/plugins/imageSrc.d.ts → nitro/og-image/satori/plugins/flex.d.ts} +0 -0
- package/dist/runtime/{core/renderers/satori/plugins/twClasses.d.ts → nitro/og-image/satori/plugins/imageSrc.d.ts} +0 -0
- package/dist/runtime/{core/renderers → nitro/og-image}/satori/plugins/unocss.d.ts +0 -0
- package/dist/runtime/{server/routes/__og-image__/font-[name]-[weight].[extension].d.ts → nitro/routes/__zero-runtime/font.d.ts} +0 -0
- package/dist/runtime/{server/routes/__og-image__ → nitro/routes/__zero-runtime}/image.d.ts +0 -0
- package/dist/runtime/{core/utils/wasm.mjs → nitro/util/wasm.js} +0 -0
- package/dist/runtime/{components/OgImage/OgImage.mjs → nuxt/components/OgImage/OgImage.js} +1 -1
- package/dist/runtime/{components/OgImage/OgImageScreenshot.mjs → nuxt/components/OgImage/OgImageScreenshot.js} +1 -1
- package/dist/runtime/{components → nuxt/components}/Templates/Community/BrandedLogo.vue +0 -0
- package/dist/runtime/{components → nuxt/components}/Templates/Community/SimpleBlog.vue +1 -1
- /package/dist/runtime/{components → nuxt/components}/Templates/Community/Wave.vue +0 -0
- /package/dist/runtime/{components → nuxt/components}/Templates/Community/WithEmoji.vue +0 -0
- /package/dist/runtime/{composables/defineOgImageScreenshot.mjs → nuxt/composables/defineOgImageScreenshot.js} +0 -0
- /package/dist/runtime/{types.mjs → types.js} +0 -0
package/dist/module.mjs
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
|
-
import {
|
|
3
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { useNuxt, tryResolveModule, addTemplate, useLogger, resolvePath, loadNuxtModuleInstance, createResolver, defineNuxtModule, addImports, addBuildPlugin, hasNuxtModule, addServerPlugin, addServerHandler, addComponentsDir, addComponent, addPlugin } from '@nuxt/kit';
|
|
5
|
+
import { defu } from 'defu';
|
|
4
6
|
import { assertSiteConfig, installNuxtSiteConfig } from 'nuxt-site-config-kit';
|
|
5
|
-
import { provider, env, isDevelopment, isCI } from 'std-env';
|
|
6
7
|
import { hash } from 'ohash';
|
|
7
|
-
import { relative,
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { dirname, relative as relative$1, isAbsolute, basename } from 'pathe';
|
|
9
|
+
import { readPackageJSON } from 'pkg-types';
|
|
10
|
+
import { provider, env, isCI, isDevelopment } from 'std-env';
|
|
11
|
+
import { parseURL, parseQuery, withoutLeadingSlash } from 'ufo';
|
|
12
|
+
import { createStorage } from 'unstorage';
|
|
13
|
+
import fsDriver from 'unstorage/drivers/fs';
|
|
14
|
+
import { createHash } from 'node:crypto';
|
|
10
15
|
import { ensureDependencyInstalled } from 'nypm';
|
|
16
|
+
import { colorize } from 'consola/utils';
|
|
17
|
+
import { relative } from 'node:path';
|
|
11
18
|
import { onDevToolsInitialized, extendServerRpc } from '@nuxt/devtools-kit';
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
import { pathToFileURL } from 'node:url';
|
|
20
|
+
import MagicString from 'magic-string';
|
|
21
|
+
import { stripLiteral } from 'strip-literal';
|
|
22
|
+
import { createUnplugin } from 'unplugin';
|
|
23
|
+
import { Launcher } from 'chrome-launcher';
|
|
24
|
+
import { $fetch } from 'ofetch';
|
|
18
25
|
|
|
19
26
|
const autodetectableProviders = {
|
|
20
27
|
azure_static: "azure",
|
|
@@ -31,7 +38,8 @@ const autodetectableStaticProviders = {
|
|
|
31
38
|
};
|
|
32
39
|
const NodeRuntime = {
|
|
33
40
|
// node-server runtime
|
|
34
|
-
"chromium": "
|
|
41
|
+
"chromium": "on-demand",
|
|
42
|
+
// this gets changed build start
|
|
35
43
|
"css-inline": "node",
|
|
36
44
|
"resvg": "node",
|
|
37
45
|
"satori": "node",
|
|
@@ -45,33 +53,36 @@ const cloudflare = {
|
|
|
45
53
|
"satori": "node",
|
|
46
54
|
"sharp": false,
|
|
47
55
|
"wasm": {
|
|
48
|
-
esmImport: true
|
|
56
|
+
esmImport: true,
|
|
57
|
+
lazy: true
|
|
49
58
|
}
|
|
50
59
|
};
|
|
51
60
|
const awsLambda = {
|
|
52
61
|
"chromium": false,
|
|
53
|
-
"css-inline": "
|
|
62
|
+
"css-inline": "wasm",
|
|
54
63
|
"resvg": "node",
|
|
55
64
|
"satori": "node",
|
|
56
65
|
"sharp": false
|
|
57
66
|
// 0.33.x has issues
|
|
58
67
|
};
|
|
68
|
+
const WebContainer = {
|
|
69
|
+
"chromium": false,
|
|
70
|
+
"css-inline": "wasm-fs",
|
|
71
|
+
"resvg": "wasm-fs",
|
|
72
|
+
"satori": "wasm-fs",
|
|
73
|
+
"sharp": false
|
|
74
|
+
};
|
|
59
75
|
const RuntimeCompatibility = {
|
|
60
76
|
"nitro-dev": NodeRuntime,
|
|
61
77
|
"nitro-prerender": NodeRuntime,
|
|
62
78
|
"node-server": NodeRuntime,
|
|
63
|
-
"stackblitz":
|
|
64
|
-
|
|
65
|
-
"css-inline": false,
|
|
66
|
-
"resvg": "wasm-fs",
|
|
67
|
-
"satori": "wasm-fs",
|
|
68
|
-
"sharp": false
|
|
69
|
-
},
|
|
79
|
+
"stackblitz": WebContainer,
|
|
80
|
+
"codesandbox": WebContainer,
|
|
70
81
|
"aws-lambda": awsLambda,
|
|
71
82
|
"netlify": awsLambda,
|
|
72
83
|
"netlify-edge": {
|
|
73
84
|
"chromium": false,
|
|
74
|
-
"css-inline":
|
|
85
|
+
"css-inline": "wasm",
|
|
75
86
|
"resvg": "wasm",
|
|
76
87
|
"satori": "node",
|
|
77
88
|
"sharp": false,
|
|
@@ -87,28 +98,36 @@ const RuntimeCompatibility = {
|
|
|
87
98
|
"vercel-edge": {
|
|
88
99
|
"chromium": false,
|
|
89
100
|
"css-inline": false,
|
|
101
|
+
// size constraint (2mb is max)
|
|
90
102
|
"resvg": "wasm",
|
|
91
103
|
"satori": "node",
|
|
92
104
|
"sharp": false,
|
|
93
105
|
"wasm": {
|
|
94
106
|
// lowers workers kb size
|
|
95
|
-
esmImport: true
|
|
107
|
+
esmImport: true,
|
|
108
|
+
lazy: true
|
|
96
109
|
}
|
|
97
110
|
},
|
|
98
111
|
"cloudflare-pages": cloudflare,
|
|
99
|
-
"cloudflare": cloudflare
|
|
112
|
+
"cloudflare": cloudflare,
|
|
113
|
+
"cloudflare-module": cloudflare
|
|
100
114
|
};
|
|
101
115
|
function detectTarget(options = {}) {
|
|
102
116
|
return options?.static ? autodetectableStaticProviders[provider] : autodetectableProviders[provider];
|
|
103
117
|
}
|
|
104
118
|
function resolveNitroPreset(nitroConfig) {
|
|
105
|
-
if (provider === "stackblitz")
|
|
106
|
-
return
|
|
119
|
+
if (provider === "stackblitz" || provider === "codesandbox")
|
|
120
|
+
return provider;
|
|
121
|
+
const nuxt = useNuxt();
|
|
122
|
+
if (nuxt.options.dev)
|
|
123
|
+
return "nitro-dev";
|
|
124
|
+
if (nuxt.options._generate)
|
|
125
|
+
return "nitro-prerender";
|
|
107
126
|
let preset;
|
|
108
127
|
if (nitroConfig && nitroConfig?.preset)
|
|
109
128
|
preset = nitroConfig.preset;
|
|
110
129
|
if (!preset)
|
|
111
|
-
preset = env.NITRO_PRESET || detectTarget() || "node-server";
|
|
130
|
+
preset = env.NITRO_PRESET || env.SERVER_PRESET || detectTarget() || "node-server";
|
|
112
131
|
return preset.replace("_", "-");
|
|
113
132
|
}
|
|
114
133
|
function getPresetNitroPresetCompatibility(target) {
|
|
@@ -117,22 +136,31 @@ function getPresetNitroPresetCompatibility(target) {
|
|
|
117
136
|
compatibility = RuntimeCompatibility["nitro-dev"];
|
|
118
137
|
return compatibility;
|
|
119
138
|
}
|
|
120
|
-
function applyNitroPresetCompatibility(nitroConfig, options) {
|
|
139
|
+
async function applyNitroPresetCompatibility(nitroConfig, options) {
|
|
121
140
|
const target = resolveNitroPreset(nitroConfig);
|
|
122
141
|
const compatibility = getPresetNitroPresetCompatibility(target);
|
|
142
|
+
const hasCssInlineNode = !!await tryResolveModule("@css-inline/css-inline");
|
|
143
|
+
const hasCssInlineWasm = !!await tryResolveModule("@css-inline/css-inline-wasm");
|
|
123
144
|
const { resolve } = options;
|
|
124
145
|
const satoriEnabled = typeof options.compatibility?.satori !== "undefined" ? !!options.compatibility.satori : !!compatibility.satori;
|
|
125
146
|
const chromiumEnabled = typeof options.compatibility?.chromium !== "undefined" ? !!options.compatibility.chromium : !!compatibility.chromium;
|
|
126
|
-
nitroConfig.alias["#nuxt-og-image/renderers/satori"] = satoriEnabled ? resolve("./runtime/
|
|
127
|
-
nitroConfig.alias["#nuxt-og-image/renderers/chromium"] = chromiumEnabled ? resolve("./runtime/
|
|
147
|
+
nitroConfig.alias["#nuxt-og-image/renderers/satori"] = satoriEnabled ? resolve("./runtime/nitro/og-image/satori/renderer") : "unenv/runtime/mock/empty";
|
|
148
|
+
nitroConfig.alias["#nuxt-og-image/renderers/chromium"] = chromiumEnabled ? resolve("./runtime/nitro/og-image/chromium/renderer") : "unenv/runtime/mock/empty";
|
|
128
149
|
const resolvedCompatibility = {};
|
|
129
150
|
function applyBinding(key) {
|
|
130
151
|
let binding = options.compatibility?.[key];
|
|
131
152
|
if (typeof binding === "undefined")
|
|
132
153
|
binding = compatibility[key];
|
|
154
|
+
if (key === "chromium" && binding === "node")
|
|
155
|
+
binding = "playwright";
|
|
156
|
+
if (key === "css-inline" && typeof binding === "string") {
|
|
157
|
+
if (binding === "node" && !hasCssInlineNode || ["wasm", "wasm-fs"].includes(binding) && !hasCssInlineWasm) {
|
|
158
|
+
binding = false;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
133
161
|
resolvedCompatibility[key] = binding;
|
|
134
162
|
return {
|
|
135
|
-
[`#nuxt-og-image/bindings/${key}`]: binding === false ? "unenv/runtime/mock/empty" : resolve(`./runtime/
|
|
163
|
+
[`#nuxt-og-image/bindings/${key}`]: binding === false ? "unenv/runtime/mock/empty" : resolve(`./runtime/nitro/og-image/bindings/${key}/${binding}`)
|
|
136
164
|
};
|
|
137
165
|
}
|
|
138
166
|
nitroConfig.alias = defu(
|
|
@@ -168,45 +196,66 @@ function ensureDependencies(dep, nuxt = useNuxt()) {
|
|
|
168
196
|
}));
|
|
169
197
|
}
|
|
170
198
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
if (moduleEntry)
|
|
185
|
-
inlineOptions = moduleEntry[1];
|
|
186
|
-
if (nuxtModule.getOptions)
|
|
187
|
-
return nuxtModule.getOptions(inlineOptions, nuxt);
|
|
188
|
-
return inlineOptions;
|
|
189
|
-
}
|
|
190
|
-
function extendTypes(module, template) {
|
|
191
|
-
const nuxt = useNuxt();
|
|
192
|
-
const { resolve } = createResolver(import.meta.url);
|
|
193
|
-
addTemplate({
|
|
194
|
-
filename: `module/${module}.d.ts`,
|
|
195
|
-
getContents: async () => {
|
|
196
|
-
const typesPath = relative(resolve(nuxt.options.rootDir, nuxt.options.buildDir, "module"), resolve("runtime/types"));
|
|
197
|
-
const s = await template({ typesPath });
|
|
198
|
-
return `// Generated by ${module}
|
|
199
|
-
${s}
|
|
200
|
-
export {}
|
|
201
|
-
`;
|
|
202
|
-
}
|
|
199
|
+
const logger = useLogger("@nuxtjs/og-image");
|
|
200
|
+
const gray = (s) => colorize("gray", s);
|
|
201
|
+
|
|
202
|
+
async function setupBuildHandler(config, resolve, nuxt = useNuxt()) {
|
|
203
|
+
nuxt.options.nitro.storage = nuxt.options.nitro.storage || {};
|
|
204
|
+
if (typeof config.runtimeCacheStorage === "object")
|
|
205
|
+
nuxt.options.nitro.storage["og-image"] = config.runtimeCacheStorage;
|
|
206
|
+
nuxt.hooks.hook("nitro:config", async (nitroConfig) => {
|
|
207
|
+
await applyNitroPresetCompatibility(nitroConfig, { compatibility: config.compatibility?.runtime, resolve });
|
|
208
|
+
nitroConfig.alias.electron = "unenv/runtime/mock/proxy-cjs";
|
|
209
|
+
nitroConfig.alias.bufferutil = "unenv/runtime/mock/proxy-cjs";
|
|
210
|
+
nitroConfig.alias["utf-8-validate"] = "unenv/runtime/mock/proxy-cjs";
|
|
211
|
+
nitroConfig.alias.queue = "unenv/runtime/mock/proxy-cjs";
|
|
203
212
|
});
|
|
204
|
-
nuxt.hooks.hook("
|
|
205
|
-
|
|
213
|
+
nuxt.hooks.hook("nitro:init", async (nitro) => {
|
|
214
|
+
nitro.hooks.hook("compiled", async (_nitro) => {
|
|
215
|
+
const target = resolveNitroPreset(_nitro.options);
|
|
216
|
+
const compatibility = getPresetNitroPresetCompatibility(target);
|
|
217
|
+
if (compatibility.wasm?.esmImport !== true)
|
|
218
|
+
return;
|
|
219
|
+
const configuredEntry = nitro.options.rollupConfig?.output.entryFileNames;
|
|
220
|
+
let serverEntry = resolve(_nitro.options.output.serverDir, typeof configuredEntry === "string" ? configuredEntry : "index.mjs");
|
|
221
|
+
const isCloudflarePagesOrModule = target === "cloudflare-pages" || target === "cloudflare-module";
|
|
222
|
+
if (isCloudflarePagesOrModule) {
|
|
223
|
+
serverEntry = [
|
|
224
|
+
resolve(dirname(serverEntry), "./chunks/wasm.mjs"),
|
|
225
|
+
resolve(dirname(serverEntry), "./chunks/_/wasm.mjs")
|
|
226
|
+
].filter(existsSync)[0] || serverEntry;
|
|
227
|
+
const routesPath = resolve(nitro.options.output.publicDir, "_routes.json");
|
|
228
|
+
const routes = await readFile(routesPath).then((buffer) => JSON.parse(buffer.toString()));
|
|
229
|
+
const preSize = routes.exclude.length;
|
|
230
|
+
routes.exclude = routes.exclude.filter((path2) => !path2.startsWith("/__og-image__/static"));
|
|
231
|
+
routes.exclude.push("/__og-image__/static/*");
|
|
232
|
+
if (preSize !== routes.exclude.length) {
|
|
233
|
+
logger.info(`Optimizing CloudFlare \`_routes.json\` for prerendered OG Images ${gray(`(${100 - Math.round(routes.exclude.length / preSize * 100)}% smaller)`)}`);
|
|
234
|
+
}
|
|
235
|
+
await writeFile(routesPath, JSON.stringify(routes, void 0, 2));
|
|
236
|
+
}
|
|
237
|
+
const contents = await readFile(serverEntry, "utf-8");
|
|
238
|
+
const resvgHash = await resolveFilePathSha1("@resvg/resvg-wasm/index_bg.wasm");
|
|
239
|
+
const yogaHash = await resolveFilePathSha1("yoga-wasm-web/dist/yoga.wasm");
|
|
240
|
+
const cssInlineHash = await resolveFilePathSha1("@css-inline/css-inline-wasm/index_bg.wasm");
|
|
241
|
+
const postfix = target === "vercel-edge" ? "?module" : "";
|
|
242
|
+
const path = isCloudflarePagesOrModule ? `../wasm/` : `./wasm/`;
|
|
243
|
+
await writeFile(serverEntry, contents.replaceAll('"@resvg/resvg-wasm/index_bg.wasm?module"', `"${path}index_bg-${resvgHash}.wasm${postfix}"`).replaceAll('"@css-inline/css-inline-wasm/index_bg.wasm?module"', `"${path}index_bg-${cssInlineHash}.wasm${postfix}"`).replaceAll('"yoga-wasm-web/dist/yoga.wasm?module"', `"${path}yoga-${yogaHash}.wasm${postfix}"`), { encoding: "utf-8" });
|
|
244
|
+
});
|
|
206
245
|
});
|
|
207
246
|
}
|
|
208
|
-
function
|
|
209
|
-
|
|
247
|
+
async function resolveFilePathSha1(path) {
|
|
248
|
+
const _path = await resolvePath(path);
|
|
249
|
+
return sha1(existsSync(_path) ? await readFile(_path) : path);
|
|
250
|
+
}
|
|
251
|
+
function sha1(source) {
|
|
252
|
+
return createHash("sha1").update(source).digest("hex").slice(0, 16);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function setupDevHandler(options, resolve, nuxt = useNuxt()) {
|
|
256
|
+
nuxt.hooks.hook("nitro:config", async (nitroConfig) => {
|
|
257
|
+
await applyNitroPresetCompatibility(nitroConfig, { compatibility: options.compatibility?.dev, resolve });
|
|
258
|
+
});
|
|
210
259
|
}
|
|
211
260
|
|
|
212
261
|
const DEVTOOLS_UI_ROUTE = "/__nuxt-og-image";
|
|
@@ -237,6 +286,7 @@ function setupDevToolsUI(options, resolve, nuxt = useNuxt()) {
|
|
|
237
286
|
onDevToolsInitialized(async () => {
|
|
238
287
|
const rpc = extendServerRpc("nuxt-og-image", {});
|
|
239
288
|
nuxt.hook("builder:watch", (e, path) => {
|
|
289
|
+
path = relative(nuxt.options.srcDir, resolve(nuxt.options.srcDir, path));
|
|
240
290
|
if ((e === "change" || e.includes("link")) && path.startsWith("pages")) {
|
|
241
291
|
rpc.broadcast.refreshRouteData(path).catch(() => {
|
|
242
292
|
});
|
|
@@ -269,15 +319,9 @@ function setupDevToolsUI(options, resolve, nuxt = useNuxt()) {
|
|
|
269
319
|
});
|
|
270
320
|
}
|
|
271
321
|
|
|
272
|
-
function setupDevHandler(options, resolve, nuxt = useNuxt()) {
|
|
273
|
-
nuxt.hooks.hook("nitro:config", async (nitroConfig) => {
|
|
274
|
-
applyNitroPresetCompatibility(nitroConfig, { compatibility: options.compatibility?.dev, resolve });
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
|
|
278
322
|
function setupGenerateHandler(options, resolve, nuxt = useNuxt()) {
|
|
279
323
|
nuxt.hooks.hook("nitro:config", async (nitroConfig) => {
|
|
280
|
-
applyNitroPresetCompatibility(nitroConfig, {
|
|
324
|
+
await applyNitroPresetCompatibility(nitroConfig, {
|
|
281
325
|
compatibility: {
|
|
282
326
|
"chromium": false,
|
|
283
327
|
"satori": false,
|
|
@@ -298,69 +342,132 @@ function setupGenerateHandler(options, resolve, nuxt = useNuxt()) {
|
|
|
298
342
|
function setupPrerenderHandler(options, resolve, nuxt = useNuxt()) {
|
|
299
343
|
nuxt.hooks.hook("nitro:init", async (nitro) => {
|
|
300
344
|
nitro.hooks.hook("prerender:config", async (nitroConfig) => {
|
|
301
|
-
nitroConfig
|
|
302
|
-
nitroConfig.serverAssets.push({ baseName: "nuxt-og-image:fonts", dir: resolve("./runtime/server/assets") });
|
|
303
|
-
applyNitroPresetCompatibility(nitroConfig, { compatibility: options.compatibility?.prerender, resolve });
|
|
345
|
+
await applyNitroPresetCompatibility(nitroConfig, { compatibility: options.compatibility?.prerender, resolve });
|
|
304
346
|
nitroConfig.wasm = nitroConfig.wasm || {};
|
|
305
347
|
nitroConfig.wasm.esmImport = false;
|
|
306
348
|
const prerenderingPages = (nuxt.options.nitro.prerender?.routes || []).some((r) => r && (!r.includes(".") || r.includes("*")));
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
349
|
+
if (prerenderingPages) {
|
|
350
|
+
assertSiteConfig("nuxt-og-image", {
|
|
351
|
+
url: "OG Image tags are required to be absolute URLs."
|
|
352
|
+
}, {
|
|
353
|
+
throwError: false
|
|
354
|
+
});
|
|
355
|
+
}
|
|
312
356
|
});
|
|
313
357
|
});
|
|
314
358
|
}
|
|
315
359
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
if (
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
serverEntry = resolve(dirname(serverEntry), "./chunks/wasm.mjs");
|
|
337
|
-
const contents = await readFile(serverEntry, "utf-8");
|
|
338
|
-
const resvgHash = sha1(await readFile(await resolvePath("@resvg/resvg-wasm/index_bg.wasm")));
|
|
339
|
-
const yogaHash = sha1(await readFile(await resolvePath("yoga-wasm-web/dist/yoga.wasm")));
|
|
340
|
-
const postfix = target === "vercel-edge" ? "?module" : "";
|
|
341
|
-
const path = target === "cloudflare-pages" ? `../wasm/` : `./wasm/`;
|
|
342
|
-
await writeFile(serverEntry, contents.replaceAll('"@resvg/resvg-wasm/index_bg.wasm"', `"${path}index_bg-${resvgHash}.wasm${postfix}"`).replaceAll('"yoga-wasm-web/dist/yoga.wasm"', `"${path}yoga-${yogaHash}.wasm${postfix}"`), { encoding: "utf-8" });
|
|
343
|
-
});
|
|
344
|
-
});
|
|
360
|
+
function isVue(id, opts = {}) {
|
|
361
|
+
const { search } = parseURL(decodeURIComponent(pathToFileURL(id).href));
|
|
362
|
+
if (id.endsWith(".vue") && !search) {
|
|
363
|
+
return true;
|
|
364
|
+
}
|
|
365
|
+
if (!search) {
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
368
|
+
const query = parseQuery(search);
|
|
369
|
+
if (query.nuxt_component) {
|
|
370
|
+
return false;
|
|
371
|
+
}
|
|
372
|
+
if (query.macro && (search === "?macro=true" || !opts.type || opts.type.includes("script"))) {
|
|
373
|
+
return true;
|
|
374
|
+
}
|
|
375
|
+
const type = "setup" in query ? "script" : query.type;
|
|
376
|
+
if (!("vue" in query) || opts.type && !opts.type.includes(type)) {
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
return true;
|
|
345
380
|
}
|
|
346
|
-
|
|
347
|
-
|
|
381
|
+
const JS_RE = /\.(?:[cm]?j|t)sx?$/;
|
|
382
|
+
function isJS(id) {
|
|
383
|
+
const { pathname } = parseURL(decodeURIComponent(pathToFileURL(id).href));
|
|
384
|
+
return JS_RE.test(pathname);
|
|
348
385
|
}
|
|
386
|
+
const TreeShakeComposablesPlugin = createUnplugin(() => {
|
|
387
|
+
const composableNames = [
|
|
388
|
+
"defineOgImage",
|
|
389
|
+
"defineOgImageComponent",
|
|
390
|
+
"defineOgImageScreenshot"
|
|
391
|
+
];
|
|
392
|
+
const regexp = `(^\\s*)(${composableNames.join("|")})(?=\\((?!\\) \\{))`;
|
|
393
|
+
const COMPOSABLE_RE = new RegExp(regexp, "m");
|
|
394
|
+
const COMPOSABLE_RE_GLOBAL = new RegExp(regexp, "gm");
|
|
395
|
+
return {
|
|
396
|
+
name: "nuxt-og-image:zero-runtime:transform",
|
|
397
|
+
enforce: "pre",
|
|
398
|
+
transformInclude(id) {
|
|
399
|
+
return isVue(id, { type: ["script"] }) || isJS(id);
|
|
400
|
+
},
|
|
401
|
+
transform(code, id) {
|
|
402
|
+
const s = new MagicString(code);
|
|
403
|
+
if (id.endsWith("components.islands.mjs")) {
|
|
404
|
+
for (const match of code.matchAll(/"OgImage.*": defineAsyncComponent\(.*\),?/g)) {
|
|
405
|
+
s.overwrite(match.index, match.index + match[0].length, "");
|
|
406
|
+
}
|
|
407
|
+
} else {
|
|
408
|
+
const strippedCode = stripLiteral(code);
|
|
409
|
+
if (!COMPOSABLE_RE.test(code)) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
for (const match of strippedCode.matchAll(COMPOSABLE_RE_GLOBAL)) {
|
|
413
|
+
s.overwrite(match.index, match.index + match[0].length, `${match[1]} import.meta.prerender && ${match[2]}`);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
if (s.hasChanged()) {
|
|
417
|
+
return {
|
|
418
|
+
code: s.toString(),
|
|
419
|
+
map: s.generateMap({ hires: true })
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
});
|
|
349
425
|
|
|
350
|
-
async function
|
|
351
|
-
|
|
352
|
-
const
|
|
353
|
-
|
|
426
|
+
async function getNuxtModuleOptions(module, nuxt = useNuxt()) {
|
|
427
|
+
const moduleMeta = (typeof module === "string" ? { name: module } : await module.getMeta?.()) || {};
|
|
428
|
+
const { nuxtModule } = await loadNuxtModuleInstance(module, nuxt);
|
|
429
|
+
let moduleEntry;
|
|
430
|
+
for (const m of nuxt.options.modules) {
|
|
431
|
+
if (Array.isArray(m) && m.length >= 2) {
|
|
432
|
+
const _module = m[0];
|
|
433
|
+
const _moduleEntryName = typeof _module === "string" ? _module : (await _module.getMeta?.())?.name || "";
|
|
434
|
+
if (_moduleEntryName === moduleMeta.name)
|
|
435
|
+
moduleEntry = m;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
let inlineOptions = {};
|
|
439
|
+
if (moduleEntry)
|
|
440
|
+
inlineOptions = moduleEntry[1];
|
|
441
|
+
if (nuxtModule.getOptions)
|
|
442
|
+
return nuxtModule.getOptions(inlineOptions, nuxt);
|
|
443
|
+
return inlineOptions;
|
|
444
|
+
}
|
|
445
|
+
function extendTypes(module, template) {
|
|
446
|
+
const nuxt = useNuxt();
|
|
447
|
+
const { resolve } = createResolver(import.meta.url);
|
|
448
|
+
addTemplate({
|
|
449
|
+
filename: `module/${module}.d.ts`,
|
|
450
|
+
getContents: async () => {
|
|
451
|
+
const typesPath = relative$1(resolve(nuxt.options.rootDir, nuxt.options.buildDir, "module"), resolve("runtime/types"));
|
|
452
|
+
const s = await template({ typesPath });
|
|
453
|
+
return `// Generated by ${module}
|
|
454
|
+
${s}
|
|
455
|
+
export {}
|
|
456
|
+
`;
|
|
457
|
+
}
|
|
354
458
|
});
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
459
|
+
nuxt.hooks.hook("prepare:types", ({ references }) => {
|
|
460
|
+
references.push({ path: resolve(nuxt.options.buildDir, `module/${module}.d.ts`) });
|
|
461
|
+
});
|
|
462
|
+
nuxt.hooks.hook("nitro:config", (config) => {
|
|
463
|
+
config.typescript = config.typescript || {};
|
|
464
|
+
config.typescript.tsConfig = config.typescript.tsConfig || {};
|
|
465
|
+
config.typescript.tsConfig.include = config.typescript.tsConfig.include || [];
|
|
466
|
+
config.typescript.tsConfig.include.push(`./module/${module}.d.ts`);
|
|
362
467
|
});
|
|
363
|
-
|
|
468
|
+
}
|
|
469
|
+
function isNuxtGenerate(nuxt = useNuxt()) {
|
|
470
|
+
return nuxt.options._generate || nuxt.options.nitro.static || nuxt.options.nitro.preset === "static";
|
|
364
471
|
}
|
|
365
472
|
|
|
366
473
|
function normaliseFontInput(fonts) {
|
|
@@ -370,7 +477,7 @@ function normaliseFontInput(fonts) {
|
|
|
370
477
|
return {
|
|
371
478
|
cacheKey: f,
|
|
372
479
|
name,
|
|
373
|
-
weight: weight ||
|
|
480
|
+
weight: weight || 400,
|
|
374
481
|
style: "normal",
|
|
375
482
|
path: void 0
|
|
376
483
|
};
|
|
@@ -384,11 +491,53 @@ function normaliseFontInput(fonts) {
|
|
|
384
491
|
});
|
|
385
492
|
}
|
|
386
493
|
|
|
494
|
+
const isUndefinedOrTruthy = (v) => typeof v === "undefined" || v !== false;
|
|
495
|
+
function checkLocalChrome() {
|
|
496
|
+
if (isCI)
|
|
497
|
+
return false;
|
|
498
|
+
let hasChromeLocally = false;
|
|
499
|
+
try {
|
|
500
|
+
hasChromeLocally = !!Launcher.getFirstInstallation();
|
|
501
|
+
} catch {
|
|
502
|
+
}
|
|
503
|
+
return hasChromeLocally;
|
|
504
|
+
}
|
|
505
|
+
async function checkPlaywrightDependency() {
|
|
506
|
+
return !!await tryResolveModule("playwright");
|
|
507
|
+
}
|
|
508
|
+
async function downloadFont(font, storage, mirror) {
|
|
509
|
+
const { name, weight } = font;
|
|
510
|
+
const key = `${name}-${weight}.ttf.base64`;
|
|
511
|
+
if (await storage.hasItem(key))
|
|
512
|
+
return true;
|
|
513
|
+
const host = typeof mirror === "undefined" ? "fonts.googleapis.com" : mirror === true ? "fonts.font.im" : mirror;
|
|
514
|
+
const css = await $fetch(`https://${host}/css2?family=${name}:wght@${weight}`, {
|
|
515
|
+
timeout: 10 * 1e3,
|
|
516
|
+
// 10 second timeout
|
|
517
|
+
headers: {
|
|
518
|
+
// Make sure it returns TTF.
|
|
519
|
+
"User-Agent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; de-at) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1"
|
|
520
|
+
}
|
|
521
|
+
}).catch(() => {
|
|
522
|
+
return false;
|
|
523
|
+
});
|
|
524
|
+
if (!css)
|
|
525
|
+
return false;
|
|
526
|
+
const ttfResource = css.match(/src: url\((.+)\) format\('(opentype|truetype)'\)/);
|
|
527
|
+
if (ttfResource?.[1]) {
|
|
528
|
+
const buf = await $fetch(ttfResource[1], { baseURL: host, responseType: "arrayBuffer" });
|
|
529
|
+
const base64Font = Buffer.from(buf).toString("base64");
|
|
530
|
+
await storage.setItem(key, base64Font);
|
|
531
|
+
return true;
|
|
532
|
+
}
|
|
533
|
+
return false;
|
|
534
|
+
}
|
|
535
|
+
|
|
387
536
|
const module = defineNuxtModule({
|
|
388
537
|
meta: {
|
|
389
538
|
name: "nuxt-og-image",
|
|
390
539
|
compatibility: {
|
|
391
|
-
nuxt: "
|
|
540
|
+
nuxt: ">=3.10.3",
|
|
392
541
|
bridge: false
|
|
393
542
|
},
|
|
394
543
|
configKey: "ogImage"
|
|
@@ -400,6 +549,7 @@ const module = defineNuxtModule({
|
|
|
400
549
|
emojis: "noto",
|
|
401
550
|
renderer: "satori",
|
|
402
551
|
component: "NuxtSeo",
|
|
552
|
+
extension: "png",
|
|
403
553
|
width: 1200,
|
|
404
554
|
height: 600,
|
|
405
555
|
// default is to cache the image for 3 day (72 hours)
|
|
@@ -412,24 +562,44 @@ const module = defineNuxtModule({
|
|
|
412
562
|
};
|
|
413
563
|
},
|
|
414
564
|
async setup(config, nuxt) {
|
|
415
|
-
const
|
|
565
|
+
const { resolve } = createResolver(import.meta.url);
|
|
566
|
+
const { name, version } = await readPackageJSON(resolve("../package.json"));
|
|
567
|
+
const logger = useLogger(name);
|
|
416
568
|
logger.level = config.debug || nuxt.options.debug ? 4 : 3;
|
|
417
569
|
if (config.enabled === false) {
|
|
418
570
|
logger.debug("The module is disabled, skipping setup.");
|
|
571
|
+
["defineOgImage", "defineOgImageComponent", "defineOgImageScreenshot"].forEach((name2) => {
|
|
572
|
+
addImports({ name: name2, from: resolve(`./runtime/nuxt/composables/mock`) });
|
|
573
|
+
});
|
|
419
574
|
return;
|
|
420
575
|
}
|
|
421
576
|
if (config.enabled && !nuxt.options.ssr) {
|
|
422
577
|
logger.warn("Nuxt OG Image is enabled but SSR is disabled.\n\nYou should enable SSR (`ssr: true`) or disable the module (`ogImage: { enabled: false }`).");
|
|
423
578
|
return;
|
|
424
579
|
}
|
|
425
|
-
|
|
580
|
+
nuxt.options.alias["#nuxt-og-image-utils"] = resolve("./runtime/shared");
|
|
581
|
+
nuxt.options.alias["#nuxt-og-image-cache"] = resolve("./runtime/nitro/og-image/cache/lru");
|
|
426
582
|
const preset = resolveNitroPreset(nuxt.options.nitro);
|
|
427
583
|
const targetCompatibility = getPresetNitroPresetCompatibility(preset);
|
|
428
|
-
|
|
584
|
+
if (config.zeroRuntime) {
|
|
585
|
+
config.compatibility = defu(config.compatibility, {
|
|
586
|
+
runtime: {
|
|
587
|
+
chromium: false,
|
|
588
|
+
// should already be false
|
|
589
|
+
satori: false
|
|
590
|
+
}
|
|
591
|
+
});
|
|
592
|
+
if (!nuxt.options.dev) {
|
|
593
|
+
addBuildPlugin(TreeShakeComposablesPlugin, { server: true, client: true, build: true });
|
|
594
|
+
nuxt.options.alias["#nuxt-og-image-cache"] = resolve("./runtime/nitro/og-image/cache/mock");
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
let isUsingSharp = false;
|
|
429
598
|
const userConfiguredExtension = config.defaults.extension;
|
|
430
599
|
const hasConfiguredJpegs = userConfiguredExtension && ["jpeg", "jpg"].includes(userConfiguredExtension);
|
|
431
|
-
config.
|
|
432
|
-
|
|
600
|
+
if (!!config.sharpOptions || hasConfiguredJpegs && config.defaults.renderer !== "chromium") {
|
|
601
|
+
isUsingSharp = true;
|
|
602
|
+
const hasSharpDependency = !!await tryResolveModule("sharp");
|
|
433
603
|
if (hasSharpDependency && !targetCompatibility.sharp) {
|
|
434
604
|
logger.warn(`Rendering JPEGs requires sharp which does not work with ${preset}. Images will be rendered as PNG at runtime.`);
|
|
435
605
|
config.compatibility = defu(config.compatibility, {
|
|
@@ -440,39 +610,40 @@ const module = defineNuxtModule({
|
|
|
440
610
|
await ensureDependencies(["sharp"]);
|
|
441
611
|
logger.warn("Support for `sharp` is limited so check the compatibility guide.");
|
|
442
612
|
}
|
|
443
|
-
}
|
|
613
|
+
}
|
|
614
|
+
if (!isUsingSharp) {
|
|
444
615
|
config.compatibility = defu(config.compatibility, {
|
|
445
616
|
runtime: { sharp: false },
|
|
446
617
|
dev: { sharp: false },
|
|
447
618
|
prerender: { sharp: false }
|
|
448
619
|
});
|
|
449
620
|
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
prerender: { chromium: "node" }
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
} else if (!hasChromeLocally && nuxt.options.dev && config.compatibility?.dev?.chromium === "node") {
|
|
474
|
-
await ensureChromium(logger);
|
|
621
|
+
const hasChromeLocally = checkLocalChrome();
|
|
622
|
+
const hasPlaywrightDependency = await checkPlaywrightDependency();
|
|
623
|
+
const chromeCompatibilityFlags = {
|
|
624
|
+
prerender: config.compatibility?.prerender?.chromium,
|
|
625
|
+
dev: config.compatibility?.dev?.chromium,
|
|
626
|
+
runtime: config.compatibility?.runtime?.chromium
|
|
627
|
+
};
|
|
628
|
+
const chromiumBinding = {
|
|
629
|
+
dev: null,
|
|
630
|
+
prerender: null,
|
|
631
|
+
runtime: null
|
|
632
|
+
};
|
|
633
|
+
if (nuxt.options.dev) {
|
|
634
|
+
if (isUndefinedOrTruthy(chromeCompatibilityFlags.dev))
|
|
635
|
+
chromiumBinding.dev = hasChromeLocally ? "chrome-launcher" : hasPlaywrightDependency ? "playwright" : "on-demand";
|
|
636
|
+
} else {
|
|
637
|
+
if (isUndefinedOrTruthy(chromeCompatibilityFlags.prerender))
|
|
638
|
+
chromiumBinding.prerender = hasChromeLocally ? "chrome-launcher" : hasPlaywrightDependency ? "playwright" : "on-demand";
|
|
639
|
+
if (isUndefinedOrTruthy(chromeCompatibilityFlags.runtime))
|
|
640
|
+
chromiumBinding.runtime = hasPlaywrightDependency ? "playwright" : null;
|
|
475
641
|
}
|
|
642
|
+
config.compatibility = defu(config.compatibility, {
|
|
643
|
+
runtime: { chromium: chromiumBinding.runtime },
|
|
644
|
+
dev: { chromium: chromiumBinding.dev },
|
|
645
|
+
prerender: { chromium: chromiumBinding.prerender }
|
|
646
|
+
});
|
|
476
647
|
await import('@resvg/resvg-js').catch(() => {
|
|
477
648
|
logger.warn("ReSVG is missing dependencies for environment. Falling back to WASM version, this may slow down PNG rendering.");
|
|
478
649
|
config.compatibility = defu(config.compatibility, {
|
|
@@ -486,101 +657,137 @@ const module = defineNuxtModule({
|
|
|
486
657
|
}
|
|
487
658
|
});
|
|
488
659
|
await installNuxtSiteConfig();
|
|
489
|
-
if (hasNuxtModule("@nuxt/content"))
|
|
660
|
+
if (hasNuxtModule("@nuxt/content")) {
|
|
490
661
|
addServerPlugin(resolve("./runtime/nitro/plugins/nuxt-content"));
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
662
|
+
}
|
|
663
|
+
if (!config.fonts.length) {
|
|
664
|
+
config.fonts = [
|
|
665
|
+
{ name: "Inter", weight: 400, path: resolve("./runtime/assets/Inter-400.ttf.base64"), absolutePath: true },
|
|
666
|
+
{ name: "Inter", weight: 700, path: resolve("./runtime/assets/Inter-700.ttf.base64"), absolutePath: true }
|
|
667
|
+
];
|
|
668
|
+
}
|
|
669
|
+
let publicDirAbs = nuxt.options.dir.public;
|
|
670
|
+
if (!isAbsolute(publicDirAbs)) {
|
|
671
|
+
publicDirAbs = publicDirAbs in nuxt.options.alias ? nuxt.options.alias[publicDirAbs] : resolve(nuxt.options.rootDir, publicDirAbs);
|
|
672
|
+
}
|
|
673
|
+
const serverFontsDir = resolve(nuxt.options.buildDir, "cache", `nuxt-og-image@${version}`, "_fonts");
|
|
674
|
+
const fontStorage = createStorage({
|
|
675
|
+
driver: fsDriver({
|
|
676
|
+
base: serverFontsDir
|
|
677
|
+
})
|
|
678
|
+
});
|
|
679
|
+
config.fonts = (await Promise.all(normaliseFontInput(config.fonts).map(async (f) => {
|
|
680
|
+
if (!f.key && !f.path) {
|
|
681
|
+
if (preset === "stackblitz") {
|
|
682
|
+
logger.warn(`The ${f.name}:${f.weight} font was skipped because remote fonts are not available in StackBlitz, please use a local font.`);
|
|
497
683
|
return false;
|
|
498
684
|
}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
if (typeof f === "string" && f.startsWith("Inter:")) {
|
|
505
|
-
const [_, weight] = f.split(":");
|
|
506
|
-
return {
|
|
507
|
-
name: "Inter",
|
|
508
|
-
weight,
|
|
509
|
-
// nuxt server assets
|
|
510
|
-
key: `nuxt-og-image:fonts:inter-latin-ext-${weight}-normal.woff`
|
|
511
|
-
};
|
|
685
|
+
if (await downloadFont(f, fontStorage, config.googleFontMirror)) {
|
|
686
|
+
f.key = `nuxt-og-image:fonts:${f.name}-${f.weight}.ttf.base64`;
|
|
687
|
+
} else {
|
|
688
|
+
logger.warn(`Failed to download font ${f.name}:${f.weight}. You may be offline or behind a firewall blocking Google. Consider setting \`googleFontMirror: true\`.`);
|
|
689
|
+
return false;
|
|
512
690
|
}
|
|
513
|
-
|
|
514
|
-
|
|
691
|
+
} else if (f.path) {
|
|
692
|
+
const extension = basename(f.path.replace(".base64", "")).split(".").pop();
|
|
693
|
+
if (!["woff", "ttf", "otf"].includes(extension)) {
|
|
694
|
+
logger.warn(`The ${f.name}:${f.weight} font was skipped because the file extension ${extension} is not supported. Only woff, ttf and otf are supported.`);
|
|
515
695
|
return false;
|
|
516
696
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
697
|
+
if (!f.absolutePath)
|
|
698
|
+
f.path = resolve(publicDirAbs, withoutLeadingSlash(f.path));
|
|
699
|
+
if (!existsSync(f.path)) {
|
|
700
|
+
logger.warn(`The ${f.name}:${f.weight} font was skipped because the file does not exist at path ${f.path}.`);
|
|
701
|
+
return false;
|
|
702
|
+
}
|
|
703
|
+
const fontData = await readFile(f.path, f.path.endsWith(".base64") ? "utf-8" : "base64");
|
|
704
|
+
f.key = `nuxt-og-image:fonts:${f.name}-${f.weight}.${extension}.base64`;
|
|
705
|
+
await fontStorage.setItem(`${f.name}-${f.weight}.${extension}.base64`, fontData);
|
|
706
|
+
delete f.path;
|
|
707
|
+
delete f.absolutePath;
|
|
708
|
+
}
|
|
709
|
+
return f;
|
|
710
|
+
}))).filter(Boolean);
|
|
711
|
+
const fontKeys = config.fonts.map((f) => f.key?.split(":").pop());
|
|
712
|
+
const fontStorageKeys = await fontStorage.getKeys();
|
|
713
|
+
await Promise.all(fontStorageKeys.filter((key) => !fontKeys.includes(key)).map(async (key) => {
|
|
714
|
+
logger.info(`Nuxt OG Image removing outdated cached font file \`${key}\``);
|
|
715
|
+
await fontStorage.removeItem(key);
|
|
716
|
+
}));
|
|
717
|
+
if (!config.zeroRuntime) {
|
|
718
|
+
nuxt.options.nitro.serverAssets = nuxt.options.nitro.serverAssets || [];
|
|
719
|
+
nuxt.options.nitro.serverAssets.push({ baseName: "nuxt-og-image:fonts", dir: serverFontsDir });
|
|
523
720
|
}
|
|
524
721
|
nuxt.options.experimental.componentIslands = true;
|
|
722
|
+
const basePath = config.zeroRuntime ? "./runtime/nitro/routes/__zero-runtime" : "./runtime/nitro/routes";
|
|
525
723
|
addServerHandler({
|
|
526
724
|
lazy: true,
|
|
527
725
|
route: "/__og-image__/font/**",
|
|
528
|
-
handler: resolve(
|
|
726
|
+
handler: resolve(`${basePath}/font`)
|
|
529
727
|
});
|
|
530
728
|
if (config.debug || nuxt.options.dev) {
|
|
531
729
|
addServerHandler({
|
|
532
730
|
lazy: true,
|
|
533
731
|
route: "/__og-image__/debug.json",
|
|
534
|
-
handler: resolve("./runtime/
|
|
732
|
+
handler: resolve("./runtime/nitro/routes/debug.json")
|
|
535
733
|
});
|
|
536
734
|
}
|
|
537
735
|
addServerHandler({
|
|
538
736
|
lazy: true,
|
|
539
737
|
route: "/__og-image__/image/**",
|
|
540
|
-
handler: resolve(
|
|
738
|
+
handler: resolve(`${basePath}/image`)
|
|
739
|
+
});
|
|
740
|
+
addServerHandler({
|
|
741
|
+
lazy: true,
|
|
742
|
+
route: "/__og-image__/static/**",
|
|
743
|
+
handler: resolve(`${basePath}/image`)
|
|
541
744
|
});
|
|
542
745
|
nuxt.options.optimization.treeShake.composables.client["nuxt-og-image"] = [];
|
|
543
|
-
["defineOgImage", "defineOgImageComponent", "defineOgImageScreenshot"].forEach((
|
|
746
|
+
["defineOgImage", "defineOgImageComponent", "defineOgImageScreenshot"].forEach((name2) => {
|
|
544
747
|
addImports({
|
|
545
|
-
name,
|
|
546
|
-
from: resolve(`./runtime/composables/${
|
|
748
|
+
name: name2,
|
|
749
|
+
from: resolve(`./runtime/nuxt/composables/${name2}`)
|
|
547
750
|
});
|
|
548
|
-
nuxt.options.optimization.treeShake.composables.client["nuxt-og-image"].push(
|
|
549
|
-
});
|
|
550
|
-
await addComponentsDir({
|
|
551
|
-
path: resolve("./runtime/components/Templates/Community"),
|
|
552
|
-
island: true,
|
|
553
|
-
watch: true
|
|
751
|
+
nuxt.options.optimization.treeShake.composables.client["nuxt-og-image"].push(name2);
|
|
554
752
|
});
|
|
753
|
+
if (!config.zeroRuntime || nuxt.options.dev) {
|
|
754
|
+
await addComponentsDir({
|
|
755
|
+
path: resolve("./runtime/nuxt/components/Templates/Community"),
|
|
756
|
+
island: true
|
|
757
|
+
// watch: true,
|
|
758
|
+
});
|
|
759
|
+
}
|
|
555
760
|
[
|
|
556
761
|
// new
|
|
557
762
|
"OgImage",
|
|
558
763
|
"OgImageScreenshot"
|
|
559
|
-
].forEach((
|
|
764
|
+
].forEach((name2) => {
|
|
560
765
|
addComponent({
|
|
561
|
-
name,
|
|
562
|
-
filePath: resolve(`./runtime/components/OgImage/${
|
|
766
|
+
name: name2,
|
|
767
|
+
filePath: resolve(`./runtime/nuxt/components/OgImage/${name2}`),
|
|
563
768
|
...config.componentOptions
|
|
564
769
|
});
|
|
565
770
|
});
|
|
566
|
-
|
|
567
|
-
addPlugin({ mode: "server", src: resolve(
|
|
771
|
+
const basePluginPath = `./runtime/nuxt/plugins${config.zeroRuntime ? "/__zero-runtime" : ""}`;
|
|
772
|
+
addPlugin({ mode: "server", src: resolve(`${basePluginPath}/route-rule-og-image.server`) });
|
|
773
|
+
addPlugin({ mode: "server", src: resolve(`${basePluginPath}/og-image-canonical-urls.server`) });
|
|
568
774
|
const ogImageComponentCtx = { components: [] };
|
|
569
775
|
nuxt.hook("components:extend", (components) => {
|
|
570
776
|
ogImageComponentCtx.components = [];
|
|
571
777
|
components.forEach((component) => {
|
|
572
778
|
let valid = false;
|
|
573
779
|
config.componentDirs.forEach((dir) => {
|
|
574
|
-
if (component.pascalName.startsWith(dir) || component.kebabName.startsWith(dir) || component.shortPath.includes(`/${dir}/`))
|
|
780
|
+
if (component.pascalName.startsWith(dir) || component.kebabName.startsWith(dir) || component.shortPath.includes(`/${dir}/`)) {
|
|
575
781
|
valid = true;
|
|
782
|
+
}
|
|
576
783
|
});
|
|
577
|
-
if (component.filePath.includes(resolve("./runtime/components/Templates")))
|
|
784
|
+
if (component.filePath.includes(resolve("./runtime/nuxt/components/Templates")))
|
|
578
785
|
valid = true;
|
|
579
786
|
if (valid && fs.existsSync(component.filePath)) {
|
|
580
787
|
component.island = true;
|
|
581
788
|
component.mode = "server";
|
|
582
789
|
let category = "app";
|
|
583
|
-
if (component.filePath.includes(resolve("./runtime/components/Templates/Community")))
|
|
790
|
+
if (component.filePath.includes(resolve("./runtime/nuxt/components/Templates/Community")))
|
|
584
791
|
category = "community";
|
|
585
792
|
const componentFile = fs.readFileSync(component.filePath, "utf-8");
|
|
586
793
|
const credits = componentFile.split("\n").find((line) => line.startsWith(" * @credits"))?.replace("* @credits", "").trim();
|
|
@@ -608,9 +815,9 @@ const module = defineNuxtModule({
|
|
|
608
815
|
nuxt.options.nitro.virtual["#nuxt-og-image/component-names.mjs"] = () => {
|
|
609
816
|
return `export const componentNames = ${JSON.stringify(ogImageComponentCtx.components)}`;
|
|
610
817
|
};
|
|
611
|
-
let unoCssConfig = {
|
|
818
|
+
let unoCssConfig = {};
|
|
612
819
|
nuxt.hook("tailwindcss:config", (tailwindConfig) => {
|
|
613
|
-
unoCssConfig = defu(tailwindConfig.theme
|
|
820
|
+
unoCssConfig = defu(tailwindConfig.theme?.extend, { ...tailwindConfig.theme, extend: void 0 });
|
|
614
821
|
});
|
|
615
822
|
nuxt.hook("unocss:config", (_unoCssConfig) => {
|
|
616
823
|
unoCssConfig = { ..._unoCssConfig.theme };
|
|
@@ -620,8 +827,11 @@ const module = defineNuxtModule({
|
|
|
620
827
|
};
|
|
621
828
|
extendTypes("nuxt-og-image", ({ typesPath }) => {
|
|
622
829
|
const componentImports = ogImageComponentCtx.components.map((component) => {
|
|
623
|
-
const relativeComponentPath = relative(resolve(nuxt.options.rootDir, nuxt.options.buildDir, "module"), component.path);
|
|
624
|
-
|
|
830
|
+
const relativeComponentPath = relative$1(resolve(nuxt.options.rootDir, nuxt.options.buildDir, "module"), component.path);
|
|
831
|
+
const name2 = config.componentDirs.sort((a, b) => b.length - a.length).reduce((name3, dir) => {
|
|
832
|
+
return name3.replace(new RegExp(`^${dir}`), "");
|
|
833
|
+
}, component.pascalName);
|
|
834
|
+
return ` '${name2}': typeof import('${relativeComponentPath}')['default']`;
|
|
625
835
|
}).join("\n");
|
|
626
836
|
return `
|
|
627
837
|
declare module 'nitropack' {
|
|
@@ -642,11 +852,14 @@ declare module '#nuxt-og-image/components' {
|
|
|
642
852
|
${componentImports}
|
|
643
853
|
}
|
|
644
854
|
}
|
|
855
|
+
declare module '#nuxt-og-image/unocss-config' {
|
|
856
|
+
export type theme = any
|
|
857
|
+
}
|
|
645
858
|
`;
|
|
646
859
|
});
|
|
647
860
|
const cacheEnabled = typeof config.runtimeCacheStorage !== "undefined" && config.runtimeCacheStorage !== false;
|
|
648
861
|
const runtimeCacheStorage = typeof config.runtimeCacheStorage === "boolean" ? "default" : config.runtimeCacheStorage.driver;
|
|
649
|
-
let baseCacheKey = runtimeCacheStorage === "default" ? `/cache/nuxt-og-image
|
|
862
|
+
let baseCacheKey = runtimeCacheStorage === "default" ? `/cache/nuxt-og-image/${version}` : `/nuxt-og-image/${version}`;
|
|
650
863
|
if (!cacheEnabled)
|
|
651
864
|
baseCacheKey = false;
|
|
652
865
|
if (!nuxt.options.dev && config.runtimeCacheStorage && typeof config.runtimeCacheStorage === "object") {
|
|
@@ -659,14 +872,6 @@ ${componentImports}
|
|
|
659
872
|
nuxt.options.nitro = nuxt.options.nitro || {};
|
|
660
873
|
nuxt.options.nitro.prerender = nuxt.options.nitro.prerender || {};
|
|
661
874
|
nuxt.options.nitro.prerender.routes = nuxt.options.nitro.prerender.routes || [];
|
|
662
|
-
normalisedFonts.filter((f) => !f.path && !f.key).forEach((entry, key) => {
|
|
663
|
-
const { name, weight } = entry;
|
|
664
|
-
entry.path = `/__og-image__/font/${name.toLowerCase()}/${weight}.ttf`;
|
|
665
|
-
nuxt.options.nitro.prerender.routes.unshift(entry.path);
|
|
666
|
-
if (name === "Inter" && [400, 700].includes(Number(weight)))
|
|
667
|
-
entry.key = `nuxt-og-image:fonts:inter-latin-ext-${weight}-normal.woff`;
|
|
668
|
-
normalisedFonts[key] = entry;
|
|
669
|
-
});
|
|
670
875
|
}
|
|
671
876
|
const hasColorModeModule = hasNuxtModule("@nuxtjs/color-mode");
|
|
672
877
|
const colorModeOptions = hasColorModeModule ? await getNuxtModuleOptions("@nuxtjs/color-mode") : {};
|
|
@@ -680,15 +885,18 @@ ${componentImports}
|
|
|
680
885
|
// binding options
|
|
681
886
|
satoriOptions: config.satoriOptions || {},
|
|
682
887
|
resvgOptions: config.resvgOptions || {},
|
|
683
|
-
sharpOptions: config.sharpOptions || {},
|
|
888
|
+
sharpOptions: config.sharpOptions === true ? {} : config.sharpOptions || {},
|
|
889
|
+
publicStoragePath: `root${publicDirAbs.replace(nuxt.options.rootDir, "").replaceAll("/", ":")}`,
|
|
684
890
|
defaults: config.defaults,
|
|
685
891
|
debug: config.debug,
|
|
686
892
|
// avoid adding credentials
|
|
687
893
|
baseCacheKey,
|
|
688
894
|
// convert the fonts to uniform type to fix ts issue
|
|
689
895
|
fonts: normalisedFonts,
|
|
690
|
-
hasNuxtIcon: hasNuxtModule("nuxt-icon"),
|
|
691
|
-
colorPreference
|
|
896
|
+
hasNuxtIcon: hasNuxtModule("nuxt-icon") || hasNuxtModule("@nuxt/icon"),
|
|
897
|
+
colorPreference,
|
|
898
|
+
// @ts-expect-error runtime type
|
|
899
|
+
isNuxtContentDocumentDriven: config.strictNuxtContentPaths || !!nuxt.options.content?.documentDriven
|
|
692
900
|
};
|
|
693
901
|
nuxt.hooks.callHook("nuxt-og-image:runtime-config", runtimeConfig);
|
|
694
902
|
nuxt.options.runtimeConfig["nuxt-og-image"] = runtimeConfig;
|