nuxt-og-image 3.0.0-rc.9 → 3.0.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 +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/d105fb01-545e-4b40-b706-5b2d4c655752.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 +426 -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 +185 -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} +15 -3
- 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 +86 -59
- 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,128 @@ 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")) ; else {
|
|
404
|
+
const strippedCode = stripLiteral(code);
|
|
405
|
+
if (!COMPOSABLE_RE.test(code)) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
for (const match of strippedCode.matchAll(COMPOSABLE_RE_GLOBAL)) {
|
|
409
|
+
s.overwrite(match.index, match.index + match[0].length, `${match[1]} import.meta.prerender && ${match[2]}`);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (s.hasChanged()) {
|
|
413
|
+
return {
|
|
414
|
+
code: s.toString(),
|
|
415
|
+
map: s.generateMap({ hires: true })
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
});
|
|
349
421
|
|
|
350
|
-
async function
|
|
351
|
-
|
|
352
|
-
const
|
|
353
|
-
|
|
422
|
+
async function getNuxtModuleOptions(module, nuxt = useNuxt()) {
|
|
423
|
+
const moduleMeta = (typeof module === "string" ? { name: module } : await module.getMeta?.()) || {};
|
|
424
|
+
const { nuxtModule } = await loadNuxtModuleInstance(module, nuxt);
|
|
425
|
+
let moduleEntry;
|
|
426
|
+
for (const m of nuxt.options.modules) {
|
|
427
|
+
if (Array.isArray(m) && m.length >= 2) {
|
|
428
|
+
const _module = m[0];
|
|
429
|
+
const _moduleEntryName = typeof _module === "string" ? _module : (await _module.getMeta?.())?.name || "";
|
|
430
|
+
if (_moduleEntryName === moduleMeta.name)
|
|
431
|
+
moduleEntry = m;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
let inlineOptions = {};
|
|
435
|
+
if (moduleEntry)
|
|
436
|
+
inlineOptions = moduleEntry[1];
|
|
437
|
+
if (nuxtModule.getOptions)
|
|
438
|
+
return nuxtModule.getOptions(inlineOptions, nuxt);
|
|
439
|
+
return inlineOptions;
|
|
440
|
+
}
|
|
441
|
+
function extendTypes(module, template) {
|
|
442
|
+
const nuxt = useNuxt();
|
|
443
|
+
const { resolve } = createResolver(import.meta.url);
|
|
444
|
+
addTemplate({
|
|
445
|
+
filename: `module/${module}.d.ts`,
|
|
446
|
+
getContents: async () => {
|
|
447
|
+
const typesPath = relative$1(resolve(nuxt.options.rootDir, nuxt.options.buildDir, "module"), resolve("runtime/types"));
|
|
448
|
+
const s = await template({ typesPath });
|
|
449
|
+
return `// Generated by ${module}
|
|
450
|
+
${s}
|
|
451
|
+
export {}
|
|
452
|
+
`;
|
|
453
|
+
}
|
|
354
454
|
});
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
455
|
+
nuxt.hooks.hook("prepare:types", ({ references }) => {
|
|
456
|
+
references.push({ path: resolve(nuxt.options.buildDir, `module/${module}.d.ts`) });
|
|
457
|
+
});
|
|
458
|
+
nuxt.hooks.hook("nitro:config", (config) => {
|
|
459
|
+
config.typescript = config.typescript || {};
|
|
460
|
+
config.typescript.tsConfig = config.typescript.tsConfig || {};
|
|
461
|
+
config.typescript.tsConfig.include = config.typescript.tsConfig.include || [];
|
|
462
|
+
config.typescript.tsConfig.include.push(`./module/${module}.d.ts`);
|
|
362
463
|
});
|
|
363
|
-
|
|
464
|
+
}
|
|
465
|
+
function isNuxtGenerate(nuxt = useNuxt()) {
|
|
466
|
+
return nuxt.options._generate || nuxt.options.nitro.static || nuxt.options.nitro.preset === "static";
|
|
364
467
|
}
|
|
365
468
|
|
|
366
469
|
function normaliseFontInput(fonts) {
|
|
@@ -370,7 +473,7 @@ function normaliseFontInput(fonts) {
|
|
|
370
473
|
return {
|
|
371
474
|
cacheKey: f,
|
|
372
475
|
name,
|
|
373
|
-
weight: weight ||
|
|
476
|
+
weight: weight || 400,
|
|
374
477
|
style: "normal",
|
|
375
478
|
path: void 0
|
|
376
479
|
};
|
|
@@ -384,11 +487,53 @@ function normaliseFontInput(fonts) {
|
|
|
384
487
|
});
|
|
385
488
|
}
|
|
386
489
|
|
|
490
|
+
const isUndefinedOrTruthy = (v) => typeof v === "undefined" || v !== false;
|
|
491
|
+
function checkLocalChrome() {
|
|
492
|
+
if (isCI)
|
|
493
|
+
return false;
|
|
494
|
+
let hasChromeLocally = false;
|
|
495
|
+
try {
|
|
496
|
+
hasChromeLocally = !!Launcher.getFirstInstallation();
|
|
497
|
+
} catch {
|
|
498
|
+
}
|
|
499
|
+
return hasChromeLocally;
|
|
500
|
+
}
|
|
501
|
+
async function checkPlaywrightDependency() {
|
|
502
|
+
return !!await tryResolveModule("playwright");
|
|
503
|
+
}
|
|
504
|
+
async function downloadFont(font, storage, mirror) {
|
|
505
|
+
const { name, weight } = font;
|
|
506
|
+
const key = `${name}-${weight}.ttf.base64`;
|
|
507
|
+
if (await storage.hasItem(key))
|
|
508
|
+
return true;
|
|
509
|
+
const host = typeof mirror === "undefined" ? "fonts.googleapis.com" : mirror === true ? "fonts.font.im" : mirror;
|
|
510
|
+
const css = await $fetch(`https://${host}/css2?family=${name}:wght@${weight}`, {
|
|
511
|
+
timeout: 10 * 1e3,
|
|
512
|
+
// 10 second timeout
|
|
513
|
+
headers: {
|
|
514
|
+
// Make sure it returns TTF.
|
|
515
|
+
"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"
|
|
516
|
+
}
|
|
517
|
+
}).catch(() => {
|
|
518
|
+
return false;
|
|
519
|
+
});
|
|
520
|
+
if (!css)
|
|
521
|
+
return false;
|
|
522
|
+
const ttfResource = css.match(/src: url\((.+)\) format\('(opentype|truetype)'\)/);
|
|
523
|
+
if (ttfResource?.[1]) {
|
|
524
|
+
const buf = await $fetch(ttfResource[1], { baseURL: host, responseType: "arrayBuffer" });
|
|
525
|
+
const base64Font = Buffer.from(buf).toString("base64");
|
|
526
|
+
await storage.setItem(key, base64Font);
|
|
527
|
+
return true;
|
|
528
|
+
}
|
|
529
|
+
return false;
|
|
530
|
+
}
|
|
531
|
+
|
|
387
532
|
const module = defineNuxtModule({
|
|
388
533
|
meta: {
|
|
389
534
|
name: "nuxt-og-image",
|
|
390
535
|
compatibility: {
|
|
391
|
-
nuxt: "
|
|
536
|
+
nuxt: ">=3.10.3",
|
|
392
537
|
bridge: false
|
|
393
538
|
},
|
|
394
539
|
configKey: "ogImage"
|
|
@@ -400,6 +545,7 @@ const module = defineNuxtModule({
|
|
|
400
545
|
emojis: "noto",
|
|
401
546
|
renderer: "satori",
|
|
402
547
|
component: "NuxtSeo",
|
|
548
|
+
extension: "png",
|
|
403
549
|
width: 1200,
|
|
404
550
|
height: 600,
|
|
405
551
|
// default is to cache the image for 3 day (72 hours)
|
|
@@ -412,24 +558,44 @@ const module = defineNuxtModule({
|
|
|
412
558
|
};
|
|
413
559
|
},
|
|
414
560
|
async setup(config, nuxt) {
|
|
415
|
-
const
|
|
561
|
+
const { resolve } = createResolver(import.meta.url);
|
|
562
|
+
const { name, version } = await readPackageJSON(resolve("../package.json"));
|
|
563
|
+
const logger = useLogger(name);
|
|
416
564
|
logger.level = config.debug || nuxt.options.debug ? 4 : 3;
|
|
417
565
|
if (config.enabled === false) {
|
|
418
566
|
logger.debug("The module is disabled, skipping setup.");
|
|
567
|
+
["defineOgImage", "defineOgImageComponent", "defineOgImageScreenshot"].forEach((name2) => {
|
|
568
|
+
addImports({ name: name2, from: resolve(`./runtime/nuxt/composables/mock`) });
|
|
569
|
+
});
|
|
419
570
|
return;
|
|
420
571
|
}
|
|
421
572
|
if (config.enabled && !nuxt.options.ssr) {
|
|
422
573
|
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
574
|
return;
|
|
424
575
|
}
|
|
425
|
-
|
|
576
|
+
nuxt.options.alias["#nuxt-og-image-utils"] = resolve("./runtime/shared");
|
|
577
|
+
nuxt.options.alias["#nuxt-og-image-cache"] = resolve("./runtime/nitro/og-image/cache/lru");
|
|
426
578
|
const preset = resolveNitroPreset(nuxt.options.nitro);
|
|
427
579
|
const targetCompatibility = getPresetNitroPresetCompatibility(preset);
|
|
428
|
-
|
|
580
|
+
if (config.zeroRuntime) {
|
|
581
|
+
config.compatibility = defu(config.compatibility, {
|
|
582
|
+
runtime: {
|
|
583
|
+
chromium: false,
|
|
584
|
+
// should already be false
|
|
585
|
+
satori: false
|
|
586
|
+
}
|
|
587
|
+
});
|
|
588
|
+
if (!nuxt.options.dev) {
|
|
589
|
+
addBuildPlugin(TreeShakeComposablesPlugin, { server: true, client: true, build: true });
|
|
590
|
+
nuxt.options.alias["#nuxt-og-image-cache"] = resolve("./runtime/nitro/og-image/cache/mock");
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
let isUsingSharp = false;
|
|
429
594
|
const userConfiguredExtension = config.defaults.extension;
|
|
430
595
|
const hasConfiguredJpegs = userConfiguredExtension && ["jpeg", "jpg"].includes(userConfiguredExtension);
|
|
431
|
-
config.
|
|
432
|
-
|
|
596
|
+
if (!!config.sharpOptions || hasConfiguredJpegs && config.defaults.renderer !== "chromium") {
|
|
597
|
+
isUsingSharp = true;
|
|
598
|
+
const hasSharpDependency = !!await tryResolveModule("sharp");
|
|
433
599
|
if (hasSharpDependency && !targetCompatibility.sharp) {
|
|
434
600
|
logger.warn(`Rendering JPEGs requires sharp which does not work with ${preset}. Images will be rendered as PNG at runtime.`);
|
|
435
601
|
config.compatibility = defu(config.compatibility, {
|
|
@@ -440,39 +606,40 @@ const module = defineNuxtModule({
|
|
|
440
606
|
await ensureDependencies(["sharp"]);
|
|
441
607
|
logger.warn("Support for `sharp` is limited so check the compatibility guide.");
|
|
442
608
|
}
|
|
443
|
-
}
|
|
609
|
+
}
|
|
610
|
+
if (!isUsingSharp) {
|
|
444
611
|
config.compatibility = defu(config.compatibility, {
|
|
445
612
|
runtime: { sharp: false },
|
|
446
613
|
dev: { sharp: false },
|
|
447
614
|
prerender: { sharp: false }
|
|
448
615
|
});
|
|
449
616
|
}
|
|
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);
|
|
617
|
+
const hasChromeLocally = checkLocalChrome();
|
|
618
|
+
const hasPlaywrightDependency = await checkPlaywrightDependency();
|
|
619
|
+
const chromeCompatibilityFlags = {
|
|
620
|
+
prerender: config.compatibility?.prerender?.chromium,
|
|
621
|
+
dev: config.compatibility?.dev?.chromium,
|
|
622
|
+
runtime: config.compatibility?.runtime?.chromium
|
|
623
|
+
};
|
|
624
|
+
const chromiumBinding = {
|
|
625
|
+
dev: null,
|
|
626
|
+
prerender: null,
|
|
627
|
+
runtime: null
|
|
628
|
+
};
|
|
629
|
+
if (nuxt.options.dev) {
|
|
630
|
+
if (isUndefinedOrTruthy(chromeCompatibilityFlags.dev))
|
|
631
|
+
chromiumBinding.dev = hasChromeLocally ? "chrome-launcher" : hasPlaywrightDependency ? "playwright" : "on-demand";
|
|
632
|
+
} else {
|
|
633
|
+
if (isUndefinedOrTruthy(chromeCompatibilityFlags.prerender))
|
|
634
|
+
chromiumBinding.prerender = hasChromeLocally ? "chrome-launcher" : hasPlaywrightDependency ? "playwright" : "on-demand";
|
|
635
|
+
if (isUndefinedOrTruthy(chromeCompatibilityFlags.runtime))
|
|
636
|
+
chromiumBinding.runtime = hasPlaywrightDependency ? "playwright" : null;
|
|
475
637
|
}
|
|
638
|
+
config.compatibility = defu(config.compatibility, {
|
|
639
|
+
runtime: { chromium: chromiumBinding.runtime },
|
|
640
|
+
dev: { chromium: chromiumBinding.dev },
|
|
641
|
+
prerender: { chromium: chromiumBinding.prerender }
|
|
642
|
+
});
|
|
476
643
|
await import('@resvg/resvg-js').catch(() => {
|
|
477
644
|
logger.warn("ReSVG is missing dependencies for environment. Falling back to WASM version, this may slow down PNG rendering.");
|
|
478
645
|
config.compatibility = defu(config.compatibility, {
|
|
@@ -486,101 +653,137 @@ const module = defineNuxtModule({
|
|
|
486
653
|
}
|
|
487
654
|
});
|
|
488
655
|
await installNuxtSiteConfig();
|
|
489
|
-
if (hasNuxtModule("@nuxt/content"))
|
|
656
|
+
if (hasNuxtModule("@nuxt/content")) {
|
|
490
657
|
addServerPlugin(resolve("./runtime/nitro/plugins/nuxt-content"));
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
658
|
+
}
|
|
659
|
+
if (!config.fonts.length) {
|
|
660
|
+
config.fonts = [
|
|
661
|
+
{ name: "Inter", weight: 400, path: resolve("./runtime/assets/Inter-400.ttf.base64"), absolutePath: true },
|
|
662
|
+
{ name: "Inter", weight: 700, path: resolve("./runtime/assets/Inter-700.ttf.base64"), absolutePath: true }
|
|
663
|
+
];
|
|
664
|
+
}
|
|
665
|
+
let publicDirAbs = nuxt.options.dir.public;
|
|
666
|
+
if (!isAbsolute(publicDirAbs)) {
|
|
667
|
+
publicDirAbs = publicDirAbs in nuxt.options.alias ? nuxt.options.alias[publicDirAbs] : resolve(nuxt.options.rootDir, publicDirAbs);
|
|
668
|
+
}
|
|
669
|
+
const serverFontsDir = resolve(nuxt.options.buildDir, "cache", `nuxt-og-image@${version}`, "_fonts");
|
|
670
|
+
const fontStorage = createStorage({
|
|
671
|
+
driver: fsDriver({
|
|
672
|
+
base: serverFontsDir
|
|
673
|
+
})
|
|
674
|
+
});
|
|
675
|
+
config.fonts = (await Promise.all(normaliseFontInput(config.fonts).map(async (f) => {
|
|
676
|
+
if (!f.key && !f.path) {
|
|
677
|
+
if (preset === "stackblitz") {
|
|
678
|
+
logger.warn(`The ${f.name}:${f.weight} font was skipped because remote fonts are not available in StackBlitz, please use a local font.`);
|
|
497
679
|
return false;
|
|
498
680
|
}
|
|
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
|
-
};
|
|
681
|
+
if (await downloadFont(f, fontStorage, config.googleFontMirror)) {
|
|
682
|
+
f.key = `nuxt-og-image:fonts:${f.name}-${f.weight}.ttf.base64`;
|
|
683
|
+
} else {
|
|
684
|
+
logger.warn(`Failed to download font ${f.name}:${f.weight}. You may be offline or behind a firewall blocking Google. Consider setting \`googleFontMirror: true\`.`);
|
|
685
|
+
return false;
|
|
512
686
|
}
|
|
513
|
-
|
|
514
|
-
|
|
687
|
+
} else if (f.path) {
|
|
688
|
+
const extension = basename(f.path.replace(".base64", "")).split(".").pop();
|
|
689
|
+
if (!["woff", "ttf", "otf"].includes(extension)) {
|
|
690
|
+
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
691
|
return false;
|
|
516
692
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
693
|
+
if (!f.absolutePath)
|
|
694
|
+
f.path = resolve(publicDirAbs, withoutLeadingSlash(f.path));
|
|
695
|
+
if (!existsSync(f.path)) {
|
|
696
|
+
logger.warn(`The ${f.name}:${f.weight} font was skipped because the file does not exist at path ${f.path}.`);
|
|
697
|
+
return false;
|
|
698
|
+
}
|
|
699
|
+
const fontData = await readFile(f.path, f.path.endsWith(".base64") ? "utf-8" : "base64");
|
|
700
|
+
f.key = `nuxt-og-image:fonts:${f.name}-${f.weight}.${extension}.base64`;
|
|
701
|
+
await fontStorage.setItem(`${f.name}-${f.weight}.${extension}.base64`, fontData);
|
|
702
|
+
delete f.path;
|
|
703
|
+
delete f.absolutePath;
|
|
704
|
+
}
|
|
705
|
+
return f;
|
|
706
|
+
}))).filter(Boolean);
|
|
707
|
+
const fontKeys = config.fonts.map((f) => f.key?.split(":").pop());
|
|
708
|
+
const fontStorageKeys = await fontStorage.getKeys();
|
|
709
|
+
await Promise.all(fontStorageKeys.filter((key) => !fontKeys.includes(key)).map(async (key) => {
|
|
710
|
+
logger.info(`Nuxt OG Image removing outdated cached font file \`${key}\``);
|
|
711
|
+
await fontStorage.removeItem(key);
|
|
712
|
+
}));
|
|
713
|
+
if (!config.zeroRuntime) {
|
|
714
|
+
nuxt.options.nitro.serverAssets = nuxt.options.nitro.serverAssets || [];
|
|
715
|
+
nuxt.options.nitro.serverAssets.push({ baseName: "nuxt-og-image:fonts", dir: serverFontsDir });
|
|
523
716
|
}
|
|
524
717
|
nuxt.options.experimental.componentIslands = true;
|
|
718
|
+
const basePath = config.zeroRuntime ? "./runtime/nitro/routes/__zero-runtime" : "./runtime/nitro/routes";
|
|
525
719
|
addServerHandler({
|
|
526
720
|
lazy: true,
|
|
527
721
|
route: "/__og-image__/font/**",
|
|
528
|
-
handler: resolve(
|
|
722
|
+
handler: resolve(`${basePath}/font`)
|
|
529
723
|
});
|
|
530
724
|
if (config.debug || nuxt.options.dev) {
|
|
531
725
|
addServerHandler({
|
|
532
726
|
lazy: true,
|
|
533
727
|
route: "/__og-image__/debug.json",
|
|
534
|
-
handler: resolve("./runtime/
|
|
728
|
+
handler: resolve("./runtime/nitro/routes/debug.json")
|
|
535
729
|
});
|
|
536
730
|
}
|
|
537
731
|
addServerHandler({
|
|
538
732
|
lazy: true,
|
|
539
733
|
route: "/__og-image__/image/**",
|
|
540
|
-
handler: resolve(
|
|
734
|
+
handler: resolve(`${basePath}/image`)
|
|
735
|
+
});
|
|
736
|
+
addServerHandler({
|
|
737
|
+
lazy: true,
|
|
738
|
+
route: "/__og-image__/static/**",
|
|
739
|
+
handler: resolve(`${basePath}/image`)
|
|
541
740
|
});
|
|
542
741
|
nuxt.options.optimization.treeShake.composables.client["nuxt-og-image"] = [];
|
|
543
|
-
["defineOgImage", "defineOgImageComponent", "defineOgImageScreenshot"].forEach((
|
|
742
|
+
["defineOgImage", "defineOgImageComponent", "defineOgImageScreenshot"].forEach((name2) => {
|
|
544
743
|
addImports({
|
|
545
|
-
name,
|
|
546
|
-
from: resolve(`./runtime/composables/${
|
|
744
|
+
name: name2,
|
|
745
|
+
from: resolve(`./runtime/nuxt/composables/${name2}`)
|
|
547
746
|
});
|
|
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
|
|
747
|
+
nuxt.options.optimization.treeShake.composables.client["nuxt-og-image"].push(name2);
|
|
554
748
|
});
|
|
749
|
+
if (!config.zeroRuntime || nuxt.options.dev) {
|
|
750
|
+
await addComponentsDir({
|
|
751
|
+
path: resolve("./runtime/nuxt/components/Templates/Community"),
|
|
752
|
+
island: true
|
|
753
|
+
// watch: true,
|
|
754
|
+
});
|
|
755
|
+
}
|
|
555
756
|
[
|
|
556
757
|
// new
|
|
557
758
|
"OgImage",
|
|
558
759
|
"OgImageScreenshot"
|
|
559
|
-
].forEach((
|
|
760
|
+
].forEach((name2) => {
|
|
560
761
|
addComponent({
|
|
561
|
-
name,
|
|
562
|
-
filePath: resolve(`./runtime/components/OgImage/${
|
|
762
|
+
name: name2,
|
|
763
|
+
filePath: resolve(`./runtime/nuxt/components/OgImage/${name2}`),
|
|
563
764
|
...config.componentOptions
|
|
564
765
|
});
|
|
565
766
|
});
|
|
566
|
-
|
|
567
|
-
addPlugin({ mode: "server", src: resolve(
|
|
767
|
+
const basePluginPath = `./runtime/nuxt/plugins${config.zeroRuntime ? "/__zero-runtime" : ""}`;
|
|
768
|
+
addPlugin({ mode: "server", src: resolve(`${basePluginPath}/route-rule-og-image.server`) });
|
|
769
|
+
addPlugin({ mode: "server", src: resolve(`${basePluginPath}/og-image-canonical-urls.server`) });
|
|
568
770
|
const ogImageComponentCtx = { components: [] };
|
|
569
771
|
nuxt.hook("components:extend", (components) => {
|
|
570
772
|
ogImageComponentCtx.components = [];
|
|
571
773
|
components.forEach((component) => {
|
|
572
774
|
let valid = false;
|
|
573
775
|
config.componentDirs.forEach((dir) => {
|
|
574
|
-
if (component.pascalName.startsWith(dir) || component.kebabName.startsWith(dir) || component.shortPath.includes(`/${dir}/`))
|
|
776
|
+
if (component.pascalName.startsWith(dir) || component.kebabName.startsWith(dir) || component.shortPath.includes(`/${dir}/`)) {
|
|
575
777
|
valid = true;
|
|
778
|
+
}
|
|
576
779
|
});
|
|
577
|
-
if (component.filePath.includes(resolve("./runtime/components/Templates")))
|
|
780
|
+
if (component.filePath.includes(resolve("./runtime/nuxt/components/Templates")))
|
|
578
781
|
valid = true;
|
|
579
782
|
if (valid && fs.existsSync(component.filePath)) {
|
|
580
783
|
component.island = true;
|
|
581
784
|
component.mode = "server";
|
|
582
785
|
let category = "app";
|
|
583
|
-
if (component.filePath.includes(resolve("./runtime/components/Templates/Community")))
|
|
786
|
+
if (component.filePath.includes(resolve("./runtime/nuxt/components/Templates/Community")))
|
|
584
787
|
category = "community";
|
|
585
788
|
const componentFile = fs.readFileSync(component.filePath, "utf-8");
|
|
586
789
|
const credits = componentFile.split("\n").find((line) => line.startsWith(" * @credits"))?.replace("* @credits", "").trim();
|
|
@@ -608,9 +811,9 @@ const module = defineNuxtModule({
|
|
|
608
811
|
nuxt.options.nitro.virtual["#nuxt-og-image/component-names.mjs"] = () => {
|
|
609
812
|
return `export const componentNames = ${JSON.stringify(ogImageComponentCtx.components)}`;
|
|
610
813
|
};
|
|
611
|
-
let unoCssConfig = {
|
|
814
|
+
let unoCssConfig = {};
|
|
612
815
|
nuxt.hook("tailwindcss:config", (tailwindConfig) => {
|
|
613
|
-
unoCssConfig = defu(tailwindConfig.theme
|
|
816
|
+
unoCssConfig = defu(tailwindConfig.theme?.extend, { ...tailwindConfig.theme, extend: void 0 });
|
|
614
817
|
});
|
|
615
818
|
nuxt.hook("unocss:config", (_unoCssConfig) => {
|
|
616
819
|
unoCssConfig = { ..._unoCssConfig.theme };
|
|
@@ -620,8 +823,11 @@ const module = defineNuxtModule({
|
|
|
620
823
|
};
|
|
621
824
|
extendTypes("nuxt-og-image", ({ typesPath }) => {
|
|
622
825
|
const componentImports = ogImageComponentCtx.components.map((component) => {
|
|
623
|
-
const relativeComponentPath = relative(resolve(nuxt.options.rootDir, nuxt.options.buildDir, "module"), component.path);
|
|
624
|
-
|
|
826
|
+
const relativeComponentPath = relative$1(resolve(nuxt.options.rootDir, nuxt.options.buildDir, "module"), component.path);
|
|
827
|
+
const name2 = config.componentDirs.sort((a, b) => b.length - a.length).reduce((name3, dir) => {
|
|
828
|
+
return name3.replace(new RegExp(`^${dir}`), "");
|
|
829
|
+
}, component.pascalName);
|
|
830
|
+
return ` '${name2}': typeof import('${relativeComponentPath}')['default']`;
|
|
625
831
|
}).join("\n");
|
|
626
832
|
return `
|
|
627
833
|
declare module 'nitropack' {
|
|
@@ -642,11 +848,14 @@ declare module '#nuxt-og-image/components' {
|
|
|
642
848
|
${componentImports}
|
|
643
849
|
}
|
|
644
850
|
}
|
|
851
|
+
declare module '#nuxt-og-image/unocss-config' {
|
|
852
|
+
export type theme = any
|
|
853
|
+
}
|
|
645
854
|
`;
|
|
646
855
|
});
|
|
647
856
|
const cacheEnabled = typeof config.runtimeCacheStorage !== "undefined" && config.runtimeCacheStorage !== false;
|
|
648
857
|
const runtimeCacheStorage = typeof config.runtimeCacheStorage === "boolean" ? "default" : config.runtimeCacheStorage.driver;
|
|
649
|
-
let baseCacheKey = runtimeCacheStorage === "default" ? `/cache/nuxt-og-image
|
|
858
|
+
let baseCacheKey = runtimeCacheStorage === "default" ? `/cache/nuxt-og-image/${version}` : `/nuxt-og-image/${version}`;
|
|
650
859
|
if (!cacheEnabled)
|
|
651
860
|
baseCacheKey = false;
|
|
652
861
|
if (!nuxt.options.dev && config.runtimeCacheStorage && typeof config.runtimeCacheStorage === "object") {
|
|
@@ -659,14 +868,6 @@ ${componentImports}
|
|
|
659
868
|
nuxt.options.nitro = nuxt.options.nitro || {};
|
|
660
869
|
nuxt.options.nitro.prerender = nuxt.options.nitro.prerender || {};
|
|
661
870
|
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
871
|
}
|
|
671
872
|
const hasColorModeModule = hasNuxtModule("@nuxtjs/color-mode");
|
|
672
873
|
const colorModeOptions = hasColorModeModule ? await getNuxtModuleOptions("@nuxtjs/color-mode") : {};
|
|
@@ -680,15 +881,18 @@ ${componentImports}
|
|
|
680
881
|
// binding options
|
|
681
882
|
satoriOptions: config.satoriOptions || {},
|
|
682
883
|
resvgOptions: config.resvgOptions || {},
|
|
683
|
-
sharpOptions: config.sharpOptions || {},
|
|
884
|
+
sharpOptions: config.sharpOptions === true ? {} : config.sharpOptions || {},
|
|
885
|
+
publicStoragePath: `root${publicDirAbs.replace(nuxt.options.rootDir, "").replaceAll("/", ":")}`,
|
|
684
886
|
defaults: config.defaults,
|
|
685
887
|
debug: config.debug,
|
|
686
888
|
// avoid adding credentials
|
|
687
889
|
baseCacheKey,
|
|
688
890
|
// convert the fonts to uniform type to fix ts issue
|
|
689
891
|
fonts: normalisedFonts,
|
|
690
|
-
hasNuxtIcon: hasNuxtModule("nuxt-icon"),
|
|
691
|
-
colorPreference
|
|
892
|
+
hasNuxtIcon: hasNuxtModule("nuxt-icon") || hasNuxtModule("@nuxt/icon"),
|
|
893
|
+
colorPreference,
|
|
894
|
+
// @ts-expect-error runtime type
|
|
895
|
+
isNuxtContentDocumentDriven: config.strictNuxtContentPaths || !!nuxt.options.content?.documentDriven
|
|
692
896
|
};
|
|
693
897
|
nuxt.hooks.callHook("nuxt-og-image:runtime-config", runtimeConfig);
|
|
694
898
|
nuxt.options.runtimeConfig["nuxt-og-image"] = runtimeConfig;
|