nuxt-og-image 3.0.0-rc.3 → 3.0.0-rc.31
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 +4 -4
- package/dist/client/200.html +228 -15
- package/dist/client/404.html +228 -15
- package/dist/client/_nuxt/IconCSS.V7-3N1ew.js +1 -0
- package/dist/client/_nuxt/IconCSS.avVk0m4D.css +1 -0
- package/dist/client/_nuxt/abap.bJqzlTLD.js +816 -0
- package/dist/client/_nuxt/actionscript-3.NUzLYz6e.js +1 -0
- package/dist/client/_nuxt/ada.HSb8VHJ5.js +1 -0
- package/dist/client/_nuxt/andromeeda.TE0Toi4a.js +1 -0
- package/dist/client/_nuxt/angular-html.ulaXK71i.js +16 -0
- package/dist/client/_nuxt/angular-ts.CpB8xVpe.js +666 -0
- package/dist/client/_nuxt/apache.TpqIaH_y.js +1 -0
- package/dist/client/_nuxt/apex.rLr5RF8N.js +274 -0
- package/dist/client/_nuxt/apl.XB4V8Q_3.js +87 -0
- package/dist/client/_nuxt/applescript.uEUaUzem.js +38 -0
- package/dist/client/_nuxt/ara.yxVemEif.js +21 -0
- package/dist/client/_nuxt/asm.N3zWSyW8.js +1 -0
- package/dist/client/_nuxt/astro.5Up4Y-tq.js +1 -0
- package/dist/client/_nuxt/aurora-x.23vffHpO.js +1 -0
- package/dist/client/_nuxt/awk.tQAliBPt.js +1 -0
- package/dist/client/_nuxt/ayu-dark.09-XTo9D.js +1 -0
- package/dist/client/_nuxt/ballerina.j08zL6tL.js +62 -0
- package/dist/client/_nuxt/bat.4hprCtpO.js +1 -0
- package/dist/client/_nuxt/beancount.B4bgLeBI.js +1 -0
- package/dist/client/_nuxt/berry.99Qqo7Pl.js +1 -0
- package/dist/client/_nuxt/bibtex.PUS4KD1G.js +1 -0
- package/dist/client/_nuxt/bicep.U1vZFTkg.js +1 -0
- package/dist/client/_nuxt/blade.dLd1FX1V.js +831 -0
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/e8c2abb1-c2da-455e-a7e8-26f4f28b10f9.json +1 -0
- package/dist/client/_nuxt/c.1HqcaTLZ.js +81 -0
- package/dist/client/_nuxt/cadence.wPBjDAPG.js +1 -0
- package/dist/client/_nuxt/catppuccin-frappe.3zzElYQH.js +1 -0
- package/dist/client/_nuxt/catppuccin-latte.7_seQpm6.js +1 -0
- package/dist/client/_nuxt/catppuccin-macchiato.xyLZ1Mzm.js +1 -0
- package/dist/client/_nuxt/catppuccin-mocha.sKQhYBeR.js +1 -0
- package/dist/client/_nuxt/clarity.9V3ikNUm.js +1 -0
- package/dist/client/_nuxt/clojure.m464_LIc.js +1 -0
- package/dist/client/_nuxt/cmake.YiKLaZ9A.js +1 -0
- package/dist/client/_nuxt/cobol.yHzQax91.js +1 -0
- package/dist/client/_nuxt/codeql.i7fhVOvX.js +1 -0
- package/dist/client/_nuxt/coffee.UjKhX0iS.js +100 -0
- package/dist/client/_nuxt/cpp.UIU91NPT.js +186 -0
- package/dist/client/_nuxt/crystal.ePodXjZr.js +25 -0
- package/dist/client/_nuxt/csharp.xHVQI8QI.js +756 -0
- package/dist/client/_nuxt/css.tuEqSfZX.js +505 -0
- package/dist/client/_nuxt/csv.REIP-dDb.js +1 -0
- package/dist/client/_nuxt/cue.ts9p4IYJ.js +1 -0
- package/dist/client/_nuxt/cypher.y2dXjvht.js +1 -0
- package/dist/client/_nuxt/d.91KOtcJM.js +1 -0
- package/dist/client/_nuxt/dark-plus.kgh98KCl.js +1 -0
- package/dist/client/_nuxt/dart.ATU8nP6d.js +1 -0
- package/dist/client/_nuxt/dax.M4oDHFBw.js +29 -0
- package/dist/client/_nuxt/diff.-l9-nN5b.js +1 -0
- package/dist/client/_nuxt/docker.FKXxym4E.js +1 -0
- package/dist/client/_nuxt/dracula-soft.E92bUq8i.js +1 -0
- package/dist/client/_nuxt/dracula.mNVTF5-9.js +1 -0
- package/dist/client/_nuxt/dream-maker.5lPMrnJr.js +52 -0
- package/dist/client/_nuxt/elixir.dYoE9A9d.js +17 -0
- package/dist/client/_nuxt/elm.AR6G1sGv.js +1 -0
- package/dist/client/_nuxt/entry.DjkITzvC.css +1 -0
- package/dist/client/_nuxt/entry.LuO6Nylf.js +134 -0
- package/dist/client/_nuxt/erb.vCu37omy.js +1 -0
- package/dist/client/_nuxt/erlang._Br9gip-.js +1 -0
- package/dist/client/_nuxt/{error-404.b7c0506a.js → error-404.DE_aZn4X.js} +1 -1
- package/dist/client/_nuxt/error-404.DkXpI38i.css +1 -0
- package/dist/client/_nuxt/{error-500.c45b2f29.js → error-500.4nIEY5y_.js} +1 -1
- package/dist/client/_nuxt/fish.k6NZEVUm.js +5 -0
- package/dist/client/_nuxt/fortran-fixed-form.5oVt_150.js +1 -0
- package/dist/client/_nuxt/fortran-free-form.l6j6vfmD.js +1 -0
- package/dist/client/_nuxt/fsharp.5TASvPJ1.js +1 -0
- package/dist/client/_nuxt/gdresource.7GKJFf55.js +1 -0
- package/dist/client/_nuxt/gdscript.E1_SGClP.js +44 -0
- package/dist/client/_nuxt/gdshader.6pjKCTQy.js +1 -0
- package/dist/client/_nuxt/gherkin.hgsyILVZ.js +1 -0
- package/dist/client/_nuxt/git-commit.RtAxFnK2.js +1 -0
- package/dist/client/_nuxt/git-rebase.-_3Z3F37.js +1 -0
- package/dist/client/_nuxt/github-dark-dimmed.yDYFqRVv.js +1 -0
- package/dist/client/_nuxt/github-dark.WrpzPehD.js +1 -0
- package/dist/client/_nuxt/github-light.QjB713Ax.js +1 -0
- package/dist/client/_nuxt/glimmer-js.8faD3vw8.js +13 -0
- package/dist/client/_nuxt/glimmer-ts.I8Eofu1P.js +13 -0
- package/dist/client/_nuxt/glsl.yLv_V-GM.js +1 -0
- package/dist/client/_nuxt/gnuplot.fIlAWhXw.js +266 -0
- package/dist/client/_nuxt/go.U2NlzxIl.js +1 -0
- package/dist/client/_nuxt/graphql.aYTh5yPU.js +4 -0
- package/dist/client/_nuxt/groovy.Z1Lrhk2B.js +37 -0
- package/dist/client/_nuxt/hack.9pFjhnG2.js +86 -0
- package/dist/client/_nuxt/haml.DYCf5dhF.js +1 -0
- package/dist/client/_nuxt/handlebars.Z9TIkDUw.js +1 -0
- package/dist/client/_nuxt/haskell.HW0BBkRd.js +559 -0
- package/dist/client/_nuxt/hcl.M9siRbiv.js +1 -0
- package/dist/client/_nuxt/hjson.fLk7JbZa.js +50 -0
- package/dist/client/_nuxt/hlsl.Do_j-o-7.js +1 -0
- package/dist/client/_nuxt/html.ZVb9jHrO.js +74 -0
- package/dist/client/_nuxt/http.McgS7Vpm.js +1 -0
- package/dist/client/_nuxt/imba.guICF3zN.js +223 -0
- package/dist/client/_nuxt/ini.T6bxBy5-.js +1 -0
- package/dist/client/_nuxt/java.tY-NU26U.js +68 -0
- package/dist/client/_nuxt/javascript.JMZ6uy5M.js +699 -0
- package/dist/client/_nuxt/jinja.H2a5aKFq.js +1 -0
- package/dist/client/_nuxt/jison.hEN1Pilr.js +1 -0
- package/dist/client/_nuxt/json.xL80yL3n.js +25 -0
- package/dist/client/_nuxt/json5.NRuQoh_0.js +17 -0
- package/dist/client/_nuxt/jsonc.Bb1R3obU.js +25 -0
- package/dist/client/_nuxt/jsonl.Yjg0VwMG.js +25 -0
- package/dist/client/_nuxt/jsonnet.WK26vH-O.js +1 -0
- package/dist/client/_nuxt/jssm.eioTUq4-.js +1 -0
- package/dist/client/_nuxt/jsx.3LZ_BoLB.js +699 -0
- package/dist/client/_nuxt/julia.zN5MNt1V.js +9 -0
- package/dist/client/_nuxt/kotlin.1iwCeGA4.js +1 -0
- package/dist/client/_nuxt/kusto.UpRCclYC.js +1 -0
- package/dist/client/_nuxt/latex.Pwsy_OsJ.js +3 -0
- package/dist/client/_nuxt/less.Mq8TrjER.js +159 -0
- package/dist/client/_nuxt/light-plus.TzXGjDsL.js +1 -0
- package/dist/client/_nuxt/liquid.UuwAmqmc.js +14 -0
- package/dist/client/_nuxt/lisp.iIZdsWzX.js +1 -0
- package/dist/client/_nuxt/logo.WuHqTpFy.js +1 -0
- package/dist/client/_nuxt/lua.OGbZEs3U.js +1 -0
- package/dist/client/_nuxt/make.8zIAVqFD.js +1 -0
- package/dist/client/_nuxt/markdown.Y8p9X7h3.js +129 -0
- package/dist/client/_nuxt/marko.gbQhFTQa.js +8 -0
- package/dist/client/_nuxt/material-theme-darker.e1lAwchJ.js +1 -0
- package/dist/client/_nuxt/material-theme-lighter.y77yPuAI.js +1 -0
- package/dist/client/_nuxt/material-theme-ocean.oIMAIpse.js +1 -0
- package/dist/client/_nuxt/material-theme-palenight.Z44VU5rQ.js +1 -0
- package/dist/client/_nuxt/material-theme.49YjOoAR.js +1 -0
- package/dist/client/_nuxt/matlab.LaB98_jd.js +70 -0
- package/dist/client/_nuxt/mdc.NowVT77H.js +76 -0
- package/dist/client/_nuxt/mdx.VhCSg2DJ.js +1 -0
- package/dist/client/_nuxt/mermaid.WuNnVULj.js +1 -0
- package/dist/client/_nuxt/min-dark._Ja8ZF5C.js +1 -0
- package/dist/client/_nuxt/min-light.N1m_6E3S.js +1 -0
- package/dist/client/_nuxt/mojo.zLNDSfD9.js +519 -0
- package/dist/client/_nuxt/monokai.WLw4Glvg.js +1 -0
- package/dist/client/_nuxt/narrat.KYi2rZr0.js +7 -0
- package/dist/client/_nuxt/nextflow.lYJjOZ_l.js +1 -0
- package/dist/client/_nuxt/nginx.CrBM8z2W.js +1 -0
- package/dist/client/_nuxt/night-owl.GWZK5Ce7.js +1 -0
- package/dist/client/_nuxt/nim.16czfBCm.js +1 -0
- package/dist/client/_nuxt/nix.z3u_V08Q.js +1 -0
- package/dist/client/_nuxt/nord.1NrVtx79.js +1 -0
- package/dist/client/_nuxt/nushell.GDk9yul-.js +1 -0
- package/dist/client/_nuxt/objective-c.Eci2Q5FN.js +109 -0
- package/dist/client/_nuxt/objective-cpp.nGsV46Zk.js +239 -0
- package/dist/client/_nuxt/ocaml.oQRvlYTD.js +1 -0
- package/dist/client/_nuxt/one-dark-pro.qlkgvdEn.js +1 -0
- package/dist/client/_nuxt/onig.mBJmD8D5.js +1 -0
- package/dist/client/_nuxt/pascal.aIRIFbih.js +1 -0
- package/dist/client/_nuxt/perl._x09KDDb.js +1 -0
- package/dist/client/_nuxt/php.2PDLwZAX.js +771 -0
- package/dist/client/_nuxt/plsql.vhhXsReo.js +1 -0
- package/dist/client/_nuxt/poimandres.oZrO-I17.js +1 -0
- package/dist/client/_nuxt/postcss.57yKeRpx.js +1 -0
- package/dist/client/_nuxt/powerquery.wBQvr9E-.js +1 -0
- package/dist/client/_nuxt/powershell.6Y_bsqLY.js +1 -0
- package/dist/client/_nuxt/prisma.fG9Ut-9i.js +1 -0
- package/dist/client/_nuxt/prolog.vggnm0Hd.js +1 -0
- package/dist/client/_nuxt/proto.yigfBmiL.js +1 -0
- package/dist/client/_nuxt/pug.ieZS468c.js +1 -0
- package/dist/client/_nuxt/puppet.NqXa_cO1.js +1 -0
- package/dist/client/_nuxt/purescript.NA5qsvV2.js +7 -0
- package/dist/client/_nuxt/python.V9Nu427R.js +518 -0
- package/dist/client/_nuxt/r.xMXDrvl2.js +1 -0
- package/dist/client/_nuxt/raku.NSWyGF40.js +1 -0
- package/dist/client/_nuxt/razor.wPI2afgP.js +40 -0
- package/dist/client/_nuxt/red.sV5NnIRC.js +1 -0
- package/dist/client/_nuxt/reg.Dr-lXfN9.js +1 -0
- package/dist/client/_nuxt/rel.vATIbX_E.js +1 -0
- package/dist/client/_nuxt/riscv.L73dAZEB.js +13 -0
- package/dist/client/_nuxt/rose-pine-dawn.qPi4euik.js +1 -0
- package/dist/client/_nuxt/rose-pine-moon.Im6VgKOx.js +1 -0
- package/dist/client/_nuxt/rose-pine._tQyNI4L.js +1 -0
- package/dist/client/_nuxt/rst.Nzb5IGfi.js +1 -0
- package/dist/client/_nuxt/ruby.oOCDDplm.js +80 -0
- package/dist/client/_nuxt/rust.yNm59Dur.js +1 -0
- package/dist/client/_nuxt/sas.fTu4QUYF.js +1 -0
- package/dist/client/_nuxt/sass.URKSWxt9.js +2 -0
- package/dist/client/_nuxt/scala.7DKpDMtV.js +5 -0
- package/dist/client/_nuxt/scheme.S0VUhbaV.js +136 -0
- package/dist/client/_nuxt/scss.9u5wOjnF.js +90 -0
- package/dist/client/_nuxt/shaderlab.MYTNW71C.js +1 -0
- package/dist/client/_nuxt/shellscript.82BvnTib.js +4 -0
- package/dist/client/_nuxt/shellsession.e2TODbDv.js +1 -0
- package/dist/client/_nuxt/slack-dark.1ZggNzwg.js +1 -0
- package/dist/client/_nuxt/slack-ochin.IcMt0x71.js +1 -0
- package/dist/client/_nuxt/smalltalk.ymyryZ3T.js +1 -0
- package/dist/client/_nuxt/solarized-dark.3DcwRX9o.js +1 -0
- package/dist/client/_nuxt/solarized-light.iUVMuJ2F.js +1 -0
- package/dist/client/_nuxt/solidity.rGqtk2dD.js +1 -0
- package/dist/client/_nuxt/sparql.b6B4dWwT.js +1 -0
- package/dist/client/_nuxt/splunk.OYnOZZCZ.js +1 -0
- package/dist/client/_nuxt/sql.KWFjTZGI.js +21 -0
- package/dist/client/_nuxt/ssh-config.jdYjUr9x.js +1 -0
- package/dist/client/_nuxt/stata.cF_ucIcM.js +3 -0
- package/dist/client/_nuxt/stylus.sPHLw37c.js +15 -0
- package/dist/client/_nuxt/svelte.j-bqdsch.js +1 -0
- package/dist/client/_nuxt/swift.YwiPyWKn.js +544 -0
- package/dist/client/_nuxt/synthwave-84.QD7ZGwpp.js +1 -0
- package/dist/client/_nuxt/system-verilog.gwJe9XJI.js +9 -0
- package/dist/client/_nuxt/tasl.IM3fg-4x.js +1 -0
- package/dist/client/_nuxt/tcl.h_zrCUh3.js +1 -0
- package/dist/client/_nuxt/tex.uNByjuDB.js +1 -0
- package/dist/client/_nuxt/tokyo-night.3j08uV2M.js +1 -0
- package/dist/client/_nuxt/toml.p_xIKQcU.js +69 -0
- package/dist/client/_nuxt/tsx.7LxggtAE.js +699 -0
- package/dist/client/_nuxt/turtle.qvOLXpiq.js +1 -0
- package/dist/client/_nuxt/twig.p6WenPmw.js +40 -0
- package/dist/client/_nuxt/typescript.HpdcmTOD.js +666 -0
- package/dist/client/_nuxt/v.BcVLQyAr.js +1 -0
- package/dist/client/_nuxt/vanilla-picker.P0dws0ou.js +8 -0
- package/dist/client/_nuxt/vb.nfm3ZogP.js +1 -0
- package/dist/client/_nuxt/verilog.32GaFvLA.js +1 -0
- package/dist/client/_nuxt/vhdl.BgfvI7C9.js +515 -0
- package/dist/client/_nuxt/viml.Ob-szSvk.js +1 -0
- package/dist/client/_nuxt/vitesse-black.uLlG6AUB.js +1 -0
- package/dist/client/_nuxt/vitesse-dark.5VceXvs6.js +1 -0
- package/dist/client/_nuxt/vitesse-light.HOMMxGxw.js +1 -0
- package/dist/client/_nuxt/vue-html.TGyjH-sv.js +1 -0
- package/dist/client/_nuxt/vue.AKvPdve9.js +6 -0
- package/dist/client/_nuxt/vyper.0ItMHLZu.js +575 -0
- package/dist/client/_nuxt/wasm.5qeU6UJI.js +1 -0
- package/dist/client/_nuxt/wenyan.gl1zQYA8.js +1 -0
- package/dist/client/_nuxt/wgsl.KpVp-DWl.js +1 -0
- package/dist/client/_nuxt/wolfram.K_QzNdW-.js +1 -0
- package/dist/client/_nuxt/xml.GygmfNh9.js +1 -0
- package/dist/client/_nuxt/xsl.TptR0G-3.js +1 -0
- package/dist/client/_nuxt/yaml.zytfnWoA.js +200 -0
- package/dist/client/_nuxt/zenscript.htRIWiQY.js +2 -0
- package/dist/client/_nuxt/zig.VzlkOal1.js +1 -0
- package/dist/client/index.html +228 -15
- package/dist/module.d.mts +10 -3
- package/dist/module.d.ts +10 -3
- package/dist/module.json +2 -2
- package/dist/module.mjs +197 -121
- package/dist/runtime/nitro/og-image/bindings/chromium/chrome-launcher.mjs +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.mjs +36 -0
- package/dist/runtime/nitro/og-image/bindings/chromium/playwright.d.ts +2 -0
- package/dist/runtime/nitro/og-image/bindings/chromium/playwright.mjs +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.mjs +7 -0
- package/dist/runtime/nitro/og-image/bindings/css-inline/wasm-fs.d.ts +8 -0
- package/dist/runtime/nitro/og-image/bindings/css-inline/wasm-fs.mjs +8 -0
- package/dist/runtime/nitro/og-image/bindings/css-inline/wasm.d.ts +8 -0
- package/dist/runtime/nitro/og-image/bindings/css-inline/wasm.mjs +8 -0
- package/dist/runtime/{core → nitro/og-image}/bindings/resvg/wasm-fs.mjs +1 -1
- package/dist/runtime/{core → nitro/og-image}/bindings/resvg/wasm.mjs +1 -1
- package/dist/runtime/{core → nitro/og-image}/bindings/satori/wasm-fs.mjs +1 -1
- package/dist/runtime/{core → nitro/og-image}/bindings/satori/wasm.mjs +1 -1
- package/dist/runtime/nitro/og-image/cache.d.ts +7 -0
- package/dist/runtime/{core/cache/htmlPayload.mjs → nitro/og-image/cache.mjs} +3 -0
- package/dist/runtime/{core/renderers → nitro/og-image}/chromium/screenshot.mjs +1 -1
- package/dist/runtime/nitro/og-image/context.d.ts +5 -0
- package/dist/runtime/nitro/og-image/context.mjs +177 -0
- package/dist/runtime/nitro/og-image/instances.d.ts +2 -0
- package/dist/runtime/nitro/og-image/instances.mjs +10 -0
- package/dist/runtime/{core/font/fetch.d.ts → nitro/og-image/satori/font.d.ts} +1 -1
- package/dist/runtime/nitro/og-image/satori/font.mjs +32 -0
- package/dist/runtime/{core/renderers → nitro/og-image}/satori/instances.d.ts +0 -2
- package/dist/runtime/{core/renderers → nitro/og-image}/satori/instances.mjs +2 -11
- package/dist/runtime/nitro/og-image/satori/plugins/encoding.mjs +17 -0
- package/dist/runtime/nitro/og-image/satori/plugins/imageSrc.mjs +82 -0
- package/dist/runtime/{core/renderers/satori/index.mjs → nitro/og-image/satori/renderer.mjs} +28 -15
- package/dist/runtime/{core/html/applyEmojis.d.ts → nitro/og-image/satori/transforms/emojis.d.ts} +3 -1
- package/dist/runtime/{core/html/applyEmojis.mjs → nitro/og-image/satori/transforms/emojis.mjs} +6 -2
- package/dist/runtime/{core/html/applyInlineCss.d.ts → nitro/og-image/satori/transforms/inlineCss.d.ts} +1 -1
- package/dist/runtime/nitro/og-image/satori/transforms/inlineCss.mjs +39 -0
- package/dist/runtime/{core/renderers → nitro/og-image}/satori/vnodes.mjs +7 -5
- package/dist/runtime/nitro/og-image/templates/html.d.ts +2 -0
- package/dist/runtime/{core/html/devIframeTemplate.mjs → nitro/og-image/templates/html.mjs} +17 -9
- package/dist/runtime/nitro/plugins/nuxt-content.mjs +7 -4
- package/dist/runtime/nitro/plugins/prerender.d.ts +1 -1
- package/dist/runtime/nitro/plugins/prerender.mjs +8 -16
- package/dist/runtime/{server/routes/__og-image__ → nitro/routes}/debug.json.d.ts +1 -5
- package/dist/runtime/{server/routes/__og-image__ → nitro/routes}/debug.json.mjs +1 -7
- package/dist/runtime/{server/routes/__og-image__/font-[name]-[weight].[extension].mjs → nitro/routes/font.mjs} +22 -3
- package/dist/runtime/{server/routes/__og-image__ → nitro/routes}/image.mjs +9 -12
- package/dist/runtime/nitro/tsconfig.json +3 -0
- package/dist/runtime/{cache.d.ts → nitro/util/cache.d.ts} +1 -1
- package/dist/runtime/nitro/util/encoding.d.ts +3 -0
- package/dist/runtime/nitro/util/encoding.mjs +15 -0
- package/dist/runtime/nitro/util/kit.d.ts +6 -0
- package/dist/runtime/nitro/util/kit.mjs +32 -0
- package/dist/runtime/{components → nuxt/components}/OgImage/OgImage.d.ts +2 -2
- package/dist/runtime/{components → nuxt/components}/OgImage/OgImageScreenshot.d.ts +2 -2
- package/dist/runtime/{components → nuxt/components}/Templates/Community/NuxtSeo.vue +2 -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 → nuxt/composables}/defineOgImage.mjs +6 -11
- package/dist/runtime/{composables → nuxt/composables}/defineOgImageComponent.d.ts +1 -1
- package/dist/runtime/{composables → nuxt/composables}/defineOgImageScreenshot.d.ts +1 -1
- package/dist/runtime/nuxt/composables/mock.d.ts +0 -0
- package/dist/runtime/nuxt/composables/mock.mjs +6 -0
- package/dist/runtime/nuxt/plugins/og-image-canonical-urls.server.mjs +10 -3
- package/dist/runtime/nuxt/plugins/route-rule-og-image.server.mjs +1 -1
- package/dist/runtime/nuxt/utils.d.ts +2 -1
- package/dist/runtime/nuxt/utils.mjs +5 -3
- package/dist/runtime/{utils.pure.d.ts → pure.d.ts} +3 -0
- package/dist/runtime/{utils.pure.mjs → pure.mjs} +19 -1
- package/dist/runtime/{utils.d.ts → shared.d.ts} +1 -1
- package/dist/runtime/{utils.mjs → shared.mjs} +1 -1
- package/dist/runtime/types.d.ts +9 -3
- package/dist/types.d.mts +2 -2
- package/package.json +71 -46
- package/dist/client/_nuxt/IconCSS.a9e1bda0.js +0 -1
- package/dist/client/_nuxt/IconCSS.f0b56d3e.css +0 -1
- package/dist/client/_nuxt/builds/meta/f6f30fc8-72d3-4090-90f8-10aeee14e041.json +0 -1
- package/dist/client/_nuxt/entry.a30f63d0.css +0 -1
- package/dist/client/_nuxt/entry.dd086114.js +0 -108
- package/dist/client/_nuxt/error-404.b751fa02.css +0 -1
- package/dist/client/_nuxt/vanilla-picker-NKbIFE8h.23409a58.js +0 -8
- 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/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/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.mjs +0 -36
- 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/imageSrc.mjs +0 -75
- package/dist/runtime/core/utils/resolveRendererContext.d.ts +0 -3
- package/dist/runtime/core/utils/resolveRendererContext.mjs +0 -96
- package/dist/runtime/nitro/utils.d.ts +0 -2
- package/dist/runtime/nitro/utils.mjs +0 -17
- 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/client/_nuxt/{error-500.69009e70.css → error-500.SLhS9LVu.css} +0 -0
- /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 → nitro/og-image}/bindings/resvg/node.mjs +0 -0
- /package/dist/runtime/{core → nitro/og-image}/bindings/resvg/wasm-fs.d.ts +0 -0
- /package/dist/runtime/{core → nitro/og-image}/bindings/resvg/wasm.d.ts +0 -0
- /package/dist/runtime/{core → nitro/og-image}/bindings/satori/node.d.ts +0 -0
- /package/dist/runtime/{core → nitro/og-image}/bindings/satori/node.mjs +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 → nitro/og-image}/bindings/sharp/node.mjs +0 -0
- /package/dist/runtime/{core/renderers/chromium/index.d.ts → nitro/og-image/chromium/renderer.d.ts} +0 -0
- /package/dist/runtime/{core/renderers/chromium/index.mjs → nitro/og-image/chromium/renderer.mjs} +0 -0
- /package/dist/runtime/{core/renderers → nitro/og-image}/chromium/screenshot.d.ts +0 -0
- /package/dist/runtime/{core/renderers → nitro/og-image}/satori/plugins/emojis.d.ts +0 -0
- /package/dist/runtime/{core/renderers → nitro/og-image}/satori/plugins/emojis.mjs +0 -0
- /package/dist/runtime/{core/renderers → nitro/og-image}/satori/plugins/encoding.d.ts +0 -0
- /package/dist/runtime/{core/renderers → nitro/og-image}/satori/plugins/flex.d.ts +0 -0
- /package/dist/runtime/{core/renderers → nitro/og-image}/satori/plugins/flex.mjs +0 -0
- /package/dist/runtime/{core/renderers → nitro/og-image}/satori/plugins/imageSrc.d.ts +0 -0
- /package/dist/runtime/{core/renderers → nitro/og-image}/satori/plugins/twClasses.d.ts +0 -0
- /package/dist/runtime/{core/renderers → nitro/og-image}/satori/plugins/twClasses.mjs +0 -0
- /package/dist/runtime/{core/renderers → nitro/og-image}/satori/plugins/unocss.d.ts +0 -0
- /package/dist/runtime/{core/renderers → nitro/og-image}/satori/plugins/unocss.mjs +0 -0
- /package/dist/runtime/{core/renderers/satori/index.d.ts → nitro/og-image/satori/renderer.d.ts} +0 -0
- /package/dist/runtime/{core/renderers → nitro/og-image}/satori/utils.d.ts +0 -0
- /package/dist/runtime/{core/renderers → nitro/og-image}/satori/utils.mjs +0 -0
- /package/dist/runtime/{core/renderers → nitro/og-image}/satori/vnodes.d.ts +0 -0
- /package/dist/runtime/{server/routes/__og-image__/font-[name]-[weight].[extension].d.ts → nitro/routes/font.d.ts} +0 -0
- /package/dist/runtime/{server/routes/__og-image__ → nitro/routes}/image.d.ts +0 -0
- /package/dist/runtime/{cache.mjs → nitro/util/cache.mjs} +0 -0
- /package/dist/runtime/{core/utils → nitro/util}/wasm.d.ts +0 -0
- /package/dist/runtime/{core/utils → nitro/util}/wasm.mjs +0 -0
- /package/dist/runtime/{components → nuxt/components}/OgImage/OgImage.mjs +0 -0
- /package/dist/runtime/{components → nuxt/components}/OgImage/OgImageScreenshot.mjs +0 -0
- /package/dist/runtime/{components → nuxt/components}/Templates/Community/BrandedLogo.vue +0 -0
- /package/dist/runtime/{components → nuxt/components}/Templates/Community/Nuxt.vue +0 -0
- /package/dist/runtime/{components → nuxt/components}/Templates/Community/Pergel.vue +0 -0
- /package/dist/runtime/{components → nuxt/components}/Templates/Community/SimpleBlog.vue +0 -0
- /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 → nuxt/composables}/defineOgImageComponent.mjs +0 -0
- /package/dist/runtime/{composables → nuxt/composables}/defineOgImageScreenshot.mjs +0 -0
package/dist/module.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
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, addTemplate, loadNuxtModuleInstance, createResolver, resolvePath, tryResolveModule, defineNuxtModule, useLogger, addImports, hasNuxtModule, addServerPlugin, addServerHandler, addComponentsDir, addComponent, addPlugin } from '@nuxt/kit';
|
|
4
5
|
import { assertSiteConfig, installNuxtSiteConfig } from 'nuxt-site-config-kit';
|
|
5
|
-
import { provider, env,
|
|
6
|
+
import { provider, env, isCI, isDevelopment } from 'std-env';
|
|
6
7
|
import { hash } from 'ohash';
|
|
7
|
-
import { relative, dirname } from 'pathe';
|
|
8
|
+
import { relative, dirname, basename, isAbsolute, join } from 'pathe';
|
|
8
9
|
import { defu } from 'defu';
|
|
9
|
-
import {
|
|
10
|
+
import { readPackageJSON } from 'pkg-types';
|
|
11
|
+
import { createStorage } from 'unstorage';
|
|
12
|
+
import fsDriver from 'unstorage/drivers/fs';
|
|
10
13
|
import { ensureDependencyInstalled } from 'nypm';
|
|
11
14
|
import { onDevToolsInitialized, extendServerRpc } from '@nuxt/devtools-kit';
|
|
12
|
-
import { readFile, writeFile } from 'node:fs/promises';
|
|
13
15
|
import { createHash } from 'node:crypto';
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
const version = "3.0.0-rc.3";
|
|
16
|
+
import { Launcher } from 'chrome-launcher';
|
|
17
|
+
import { $fetch } from 'ofetch';
|
|
18
18
|
|
|
19
19
|
const autodetectableProviders = {
|
|
20
20
|
azure_static: "azure",
|
|
@@ -56,22 +56,24 @@ const awsLambda = {
|
|
|
56
56
|
"sharp": false
|
|
57
57
|
// 0.33.x has issues
|
|
58
58
|
};
|
|
59
|
+
const WebContainer = {
|
|
60
|
+
"chromium": false,
|
|
61
|
+
"css-inline": "wasm-fs",
|
|
62
|
+
"resvg": "wasm-fs",
|
|
63
|
+
"satori": "wasm-fs",
|
|
64
|
+
"sharp": false
|
|
65
|
+
};
|
|
59
66
|
const RuntimeCompatibility = {
|
|
60
67
|
"nitro-dev": NodeRuntime,
|
|
61
68
|
"nitro-prerender": NodeRuntime,
|
|
62
69
|
"node-server": NodeRuntime,
|
|
63
|
-
"stackblitz":
|
|
64
|
-
|
|
65
|
-
"css-inline": false,
|
|
66
|
-
"resvg": "wasm-fs",
|
|
67
|
-
"satori": "wasm-fs",
|
|
68
|
-
"sharp": false
|
|
69
|
-
},
|
|
70
|
+
"stackblitz": WebContainer,
|
|
71
|
+
"codesandbox": WebContainer,
|
|
70
72
|
"aws-lambda": awsLambda,
|
|
71
73
|
"netlify": awsLambda,
|
|
72
74
|
"netlify-edge": {
|
|
73
75
|
"chromium": false,
|
|
74
|
-
"css-inline":
|
|
76
|
+
"css-inline": "wasm",
|
|
75
77
|
"resvg": "wasm",
|
|
76
78
|
"satori": "node",
|
|
77
79
|
"sharp": false,
|
|
@@ -86,7 +88,7 @@ const RuntimeCompatibility = {
|
|
|
86
88
|
"vercel": awsLambda,
|
|
87
89
|
"vercel-edge": {
|
|
88
90
|
"chromium": false,
|
|
89
|
-
"css-inline":
|
|
91
|
+
"css-inline": "wasm",
|
|
90
92
|
"resvg": "wasm",
|
|
91
93
|
"satori": "node",
|
|
92
94
|
"sharp": false,
|
|
@@ -96,14 +98,15 @@ const RuntimeCompatibility = {
|
|
|
96
98
|
}
|
|
97
99
|
},
|
|
98
100
|
"cloudflare-pages": cloudflare,
|
|
99
|
-
"cloudflare": cloudflare
|
|
101
|
+
"cloudflare": cloudflare,
|
|
102
|
+
"cloudflare-module": cloudflare
|
|
100
103
|
};
|
|
101
104
|
function detectTarget(options = {}) {
|
|
102
105
|
return options?.static ? autodetectableStaticProviders[provider] : autodetectableProviders[provider];
|
|
103
106
|
}
|
|
104
107
|
function resolveNitroPreset(nitroConfig) {
|
|
105
|
-
if (provider === "stackblitz")
|
|
106
|
-
return
|
|
108
|
+
if (provider === "stackblitz" || provider === "codesandbox")
|
|
109
|
+
return provider;
|
|
107
110
|
let preset;
|
|
108
111
|
if (nitroConfig && nitroConfig?.preset)
|
|
109
112
|
preset = nitroConfig.preset;
|
|
@@ -123,16 +126,18 @@ function applyNitroPresetCompatibility(nitroConfig, options) {
|
|
|
123
126
|
const { resolve } = options;
|
|
124
127
|
const satoriEnabled = typeof options.compatibility?.satori !== "undefined" ? !!options.compatibility.satori : !!compatibility.satori;
|
|
125
128
|
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/
|
|
129
|
+
nitroConfig.alias["#nuxt-og-image/renderers/satori"] = satoriEnabled ? resolve("./runtime/nitro/og-image/satori/renderer") : "unenv/runtime/mock/empty";
|
|
130
|
+
nitroConfig.alias["#nuxt-og-image/renderers/chromium"] = chromiumEnabled ? resolve("./runtime/nitro/og-image/chromium/renderer") : "unenv/runtime/mock/empty";
|
|
128
131
|
const resolvedCompatibility = {};
|
|
129
132
|
function applyBinding(key) {
|
|
130
133
|
let binding = options.compatibility?.[key];
|
|
131
134
|
if (typeof binding === "undefined")
|
|
132
135
|
binding = compatibility[key];
|
|
136
|
+
if (key === "chromium" && binding === "node")
|
|
137
|
+
binding = "playwright";
|
|
133
138
|
resolvedCompatibility[key] = binding;
|
|
134
139
|
return {
|
|
135
|
-
[`#nuxt-og-image/bindings/${key}`]: binding === false ? "unenv/runtime/mock/empty" : resolve(`./runtime/
|
|
140
|
+
[`#nuxt-og-image/bindings/${key}`]: binding === false ? "unenv/runtime/mock/empty" : resolve(`./runtime/nitro/og-image/bindings/${key}/${binding}`)
|
|
136
141
|
};
|
|
137
142
|
}
|
|
138
143
|
nitroConfig.alias = defu(
|
|
@@ -204,6 +209,15 @@ export {}
|
|
|
204
209
|
nuxt.hooks.hook("prepare:types", ({ references }) => {
|
|
205
210
|
references.push({ path: resolve(nuxt.options.buildDir, `module/${module}.d.ts`) });
|
|
206
211
|
});
|
|
212
|
+
nuxt.hooks.hook("nitro:config", (config) => {
|
|
213
|
+
config.typescript = config.typescript || {};
|
|
214
|
+
config.typescript.tsConfig = config.typescript.tsConfig || {};
|
|
215
|
+
config.typescript.tsConfig.include = config.typescript.tsConfig.include || [];
|
|
216
|
+
config.typescript.tsConfig.include.push(`./module/${module}.d.ts`);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function isNuxtGenerate(nuxt = useNuxt()) {
|
|
220
|
+
return nuxt.options._generate || nuxt.options.nitro.static || nuxt.options.nitro.preset === "static";
|
|
207
221
|
}
|
|
208
222
|
|
|
209
223
|
const DEVTOOLS_UI_ROUTE = "/__nuxt-og-image";
|
|
@@ -295,7 +309,7 @@ function setupGenerateHandler(options, resolve, nuxt = useNuxt()) {
|
|
|
295
309
|
function setupPrerenderHandler(options, resolve, nuxt = useNuxt()) {
|
|
296
310
|
nuxt.hooks.hook("nitro:init", async (nitro) => {
|
|
297
311
|
nitro.hooks.hook("prerender:config", async (nitroConfig) => {
|
|
298
|
-
applyNitroPresetCompatibility(nitroConfig, { compatibility: options.compatibility
|
|
312
|
+
applyNitroPresetCompatibility(nitroConfig, { compatibility: options.compatibility?.prerender, resolve });
|
|
299
313
|
nitroConfig.wasm = nitroConfig.wasm || {};
|
|
300
314
|
nitroConfig.wasm.esmImport = false;
|
|
301
315
|
const prerenderingPages = (nuxt.options.nitro.prerender?.routes || []).some((r) => r && (!r.includes(".") || r.includes("*")));
|
|
@@ -327,14 +341,16 @@ async function setupBuildHandler(config, resolve, nuxt = useNuxt()) {
|
|
|
327
341
|
return;
|
|
328
342
|
const configuredEntry = nitro.options.rollupConfig?.output.entryFileNames;
|
|
329
343
|
let serverEntry = resolve(_nitro.options.output.serverDir, typeof configuredEntry === "string" ? configuredEntry : "index.mjs");
|
|
330
|
-
|
|
344
|
+
const isCloudflarePagesOrModule = target === "cloudflare-pages" || target === "cloudflare-module";
|
|
345
|
+
if (isCloudflarePagesOrModule)
|
|
331
346
|
serverEntry = resolve(dirname(serverEntry), "./chunks/wasm.mjs");
|
|
332
347
|
const contents = await readFile(serverEntry, "utf-8");
|
|
333
348
|
const resvgHash = sha1(await readFile(await resolvePath("@resvg/resvg-wasm/index_bg.wasm")));
|
|
334
349
|
const yogaHash = sha1(await readFile(await resolvePath("yoga-wasm-web/dist/yoga.wasm")));
|
|
350
|
+
const cssInlineHash = sha1(await readFile(await resolvePath("@css-inline/css-inline-wasm/index_bg.wasm")));
|
|
335
351
|
const postfix = target === "vercel-edge" ? "?module" : "";
|
|
336
|
-
const path =
|
|
337
|
-
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" });
|
|
352
|
+
const path = isCloudflarePagesOrModule ? `../wasm/` : `./wasm/`;
|
|
353
|
+
await writeFile(serverEntry, contents.replaceAll('"@resvg/resvg-wasm/index_bg.wasm"', `"${path}index_bg-${resvgHash}.wasm${postfix}"`).replaceAll('"@css-inline/css-inline-wasm/index_bg.wasm"', `"${path}index_bg-${cssInlineHash}.wasm${postfix}"`).replaceAll('"yoga-wasm-web/dist/yoga.wasm"', `"${path}yoga-${yogaHash}.wasm${postfix}"`), { encoding: "utf-8" });
|
|
338
354
|
});
|
|
339
355
|
});
|
|
340
356
|
}
|
|
@@ -342,20 +358,46 @@ function sha1(source) {
|
|
|
342
358
|
return createHash("sha1").update(source).digest("hex").slice(0, 16);
|
|
343
359
|
}
|
|
344
360
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
361
|
+
const isUndefinedOrTruthy = (v) => typeof v === "undefined" || v !== false;
|
|
362
|
+
function checkLocalChrome() {
|
|
363
|
+
if (isCI)
|
|
364
|
+
return false;
|
|
365
|
+
let hasChromeLocally = false;
|
|
366
|
+
try {
|
|
367
|
+
hasChromeLocally = !!Launcher.getFirstInstallation();
|
|
368
|
+
} catch {
|
|
369
|
+
}
|
|
370
|
+
return hasChromeLocally;
|
|
371
|
+
}
|
|
372
|
+
async function checkPlaywrightDependency() {
|
|
373
|
+
return !!await tryResolveModule("playwright");
|
|
374
|
+
}
|
|
375
|
+
async function downloadFont(font, storage, mirror) {
|
|
376
|
+
const { name, weight } = font;
|
|
377
|
+
const key = `${name}-${weight}.ttf.base64`;
|
|
378
|
+
if (await storage.hasItem(key))
|
|
379
|
+
return true;
|
|
380
|
+
const host = typeof mirror === "undefined" ? "fonts.googleapis.com" : mirror === true ? "fonts.font.im" : mirror;
|
|
381
|
+
const css = await $fetch(`https://${host}/css2?family=${name}:wght@${weight}`, {
|
|
382
|
+
timeout: 10 * 1e3,
|
|
383
|
+
// 10 second timeout
|
|
384
|
+
headers: {
|
|
385
|
+
// Make sure it returns TTF.
|
|
386
|
+
"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"
|
|
387
|
+
}
|
|
388
|
+
}).catch(() => {
|
|
389
|
+
return false;
|
|
357
390
|
});
|
|
358
|
-
|
|
391
|
+
if (!css)
|
|
392
|
+
return false;
|
|
393
|
+
const ttfResource = css.match(/src: url\((.+)\) format\('(opentype|truetype)'\)/);
|
|
394
|
+
if (ttfResource?.[1]) {
|
|
395
|
+
const buf = await $fetch(ttfResource[1], { baseURL: host, responseType: "arrayBuffer" });
|
|
396
|
+
const base64Font = Buffer.from(buf).toString("base64");
|
|
397
|
+
await storage.setItem(key, base64Font);
|
|
398
|
+
return true;
|
|
399
|
+
}
|
|
400
|
+
return false;
|
|
359
401
|
}
|
|
360
402
|
|
|
361
403
|
function normaliseFontInput(fonts) {
|
|
@@ -365,7 +407,7 @@ function normaliseFontInput(fonts) {
|
|
|
365
407
|
return {
|
|
366
408
|
cacheKey: f,
|
|
367
409
|
name,
|
|
368
|
-
weight: weight ||
|
|
410
|
+
weight: weight || 400,
|
|
369
411
|
style: "normal",
|
|
370
412
|
path: void 0
|
|
371
413
|
};
|
|
@@ -383,7 +425,7 @@ const module = defineNuxtModule({
|
|
|
383
425
|
meta: {
|
|
384
426
|
name: "nuxt-og-image",
|
|
385
427
|
compatibility: {
|
|
386
|
-
nuxt: "^3.
|
|
428
|
+
nuxt: "^3.9.0",
|
|
387
429
|
bridge: false
|
|
388
430
|
},
|
|
389
431
|
configKey: "ogImage"
|
|
@@ -395,6 +437,7 @@ const module = defineNuxtModule({
|
|
|
395
437
|
emojis: "noto",
|
|
396
438
|
renderer: "satori",
|
|
397
439
|
component: "NuxtSeo",
|
|
440
|
+
extension: "png",
|
|
398
441
|
width: 1200,
|
|
399
442
|
height: 600,
|
|
400
443
|
// default is to cache the image for 3 day (72 hours)
|
|
@@ -407,23 +450,27 @@ const module = defineNuxtModule({
|
|
|
407
450
|
};
|
|
408
451
|
},
|
|
409
452
|
async setup(config, nuxt) {
|
|
410
|
-
const
|
|
453
|
+
const { resolve } = createResolver(import.meta.url);
|
|
454
|
+
const { name, version } = await readPackageJSON(resolve("../package.json"));
|
|
455
|
+
const logger = useLogger(name);
|
|
411
456
|
logger.level = config.debug || nuxt.options.debug ? 4 : 3;
|
|
412
457
|
if (config.enabled === false) {
|
|
413
458
|
logger.debug("The module is disabled, skipping setup.");
|
|
459
|
+
["defineOgImage", "defineOgImageComponent", "defineOgImageScreenshot"].forEach((name2) => {
|
|
460
|
+
addImports({ name: name2, from: resolve(`./runtime/nuxt/composables/mock`) });
|
|
461
|
+
});
|
|
414
462
|
return;
|
|
415
463
|
}
|
|
416
464
|
if (config.enabled && !nuxt.options.ssr) {
|
|
417
465
|
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 }`).");
|
|
418
466
|
return;
|
|
419
467
|
}
|
|
420
|
-
|
|
468
|
+
nuxt.options.build.transpile.push(resolve("./runtime"));
|
|
421
469
|
const preset = resolveNitroPreset(nuxt.options.nitro);
|
|
422
470
|
const targetCompatibility = getPresetNitroPresetCompatibility(preset);
|
|
423
471
|
const hasSharpDependency = !!await tryResolveModule("sharp");
|
|
424
472
|
const userConfiguredExtension = config.defaults.extension;
|
|
425
473
|
const hasConfiguredJpegs = userConfiguredExtension && ["jpeg", "jpg"].includes(userConfiguredExtension);
|
|
426
|
-
config.defaults.extension = userConfiguredExtension || (hasSharpDependency && targetCompatibility.sharp ? "jpg" : "png");
|
|
427
474
|
if (hasConfiguredJpegs && config.defaults.renderer !== "chromium") {
|
|
428
475
|
if (hasSharpDependency && !targetCompatibility.sharp) {
|
|
429
476
|
logger.warn(`Rendering JPEGs requires sharp which does not work with ${preset}. Images will be rendered as PNG at runtime.`);
|
|
@@ -442,32 +489,32 @@ const module = defineNuxtModule({
|
|
|
442
489
|
prerender: { sharp: false }
|
|
443
490
|
});
|
|
444
491
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
prerender: { chromium: "node" }
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
} else if (!hasChromeLocally && nuxt.options.dev && config.compatibility?.dev?.chromium === "node") {
|
|
469
|
-
await ensureChromium(logger);
|
|
492
|
+
const hasChromeLocally = checkLocalChrome();
|
|
493
|
+
const hasPlaywrightDependency = await checkPlaywrightDependency();
|
|
494
|
+
const chromeCompatibilityFlags = {
|
|
495
|
+
prerender: config.compatibility?.prerender?.chromium,
|
|
496
|
+
dev: config.compatibility?.dev?.chromium,
|
|
497
|
+
runtime: config.compatibility?.runtime?.chromium
|
|
498
|
+
};
|
|
499
|
+
const chromiumBinding = {
|
|
500
|
+
dev: null,
|
|
501
|
+
prerender: null,
|
|
502
|
+
runtime: null
|
|
503
|
+
};
|
|
504
|
+
if (nuxt.options.dev) {
|
|
505
|
+
if (isUndefinedOrTruthy(chromeCompatibilityFlags.dev))
|
|
506
|
+
chromiumBinding.dev = hasChromeLocally ? "chrome-launcher" : hasPlaywrightDependency ? "playwright" : "on-demand";
|
|
507
|
+
} else {
|
|
508
|
+
if (isUndefinedOrTruthy(chromeCompatibilityFlags.prerender))
|
|
509
|
+
chromiumBinding.prerender = hasChromeLocally ? "chrome-launcher" : hasPlaywrightDependency ? "playwright" : "on-demand";
|
|
510
|
+
if (isUndefinedOrTruthy(chromeCompatibilityFlags.runtime))
|
|
511
|
+
chromiumBinding.runtime = hasPlaywrightDependency ? "playwright" : null;
|
|
470
512
|
}
|
|
513
|
+
config.compatibility = defu(config.compatibility, {
|
|
514
|
+
runtime: { chromium: chromiumBinding.runtime },
|
|
515
|
+
dev: { chromium: chromiumBinding.dev },
|
|
516
|
+
prerender: { chromium: chromiumBinding.prerender }
|
|
517
|
+
});
|
|
471
518
|
await import('@resvg/resvg-js').catch(() => {
|
|
472
519
|
logger.warn("ReSVG is missing dependencies for environment. Falling back to WASM version, this may slow down PNG rendering.");
|
|
473
520
|
config.compatibility = defu(config.compatibility, {
|
|
@@ -483,67 +530,80 @@ const module = defineNuxtModule({
|
|
|
483
530
|
await installNuxtSiteConfig();
|
|
484
531
|
if (hasNuxtModule("@nuxt/content"))
|
|
485
532
|
addServerPlugin(resolve("./runtime/nitro/plugins/nuxt-content"));
|
|
486
|
-
if (!config.fonts.length)
|
|
487
|
-
config.fonts = [
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
533
|
+
if (!config.fonts.length) {
|
|
534
|
+
config.fonts = [
|
|
535
|
+
{ name: "Inter", weight: 400, path: resolve("./assets/Inter-400.ttf.base64") },
|
|
536
|
+
{ name: "Inter", weight: 700, path: resolve("./assets/Inter-700.ttf.base64") }
|
|
537
|
+
];
|
|
538
|
+
}
|
|
539
|
+
const serverFontsDir = resolve(nuxt.options.buildDir, "cache", `nuxt-og-image@${version}`, "_fonts");
|
|
540
|
+
const fontStorage = createStorage({
|
|
541
|
+
driver: fsDriver({
|
|
542
|
+
base: serverFontsDir
|
|
543
|
+
})
|
|
544
|
+
});
|
|
545
|
+
config.fonts = (await Promise.all(normaliseFontInput(config.fonts).map(async (f) => {
|
|
546
|
+
if (!f.key && !f.path) {
|
|
547
|
+
if (preset === "stackblitz") {
|
|
548
|
+
logger.warn(`The ${f.name}:${f.weight} font was skipped because remote fonts are not available in StackBlitz, please use a local font.`);
|
|
492
549
|
return false;
|
|
493
550
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
if (typeof f === "string" && f.startsWith("Inter:")) {
|
|
500
|
-
const [_, weight] = f.split(":");
|
|
501
|
-
return {
|
|
502
|
-
name: "Inter",
|
|
503
|
-
weight,
|
|
504
|
-
// nuxt server assets
|
|
505
|
-
key: `nuxt-og-image:fonts:inter-latin-ext-${weight}-normal.woff`
|
|
506
|
-
};
|
|
551
|
+
if (await downloadFont(f, fontStorage, config.googleFontMirror)) {
|
|
552
|
+
f.key = `nuxt-og-image:fonts:${f.name}-${f.weight}.ttf.base64`;
|
|
553
|
+
} else {
|
|
554
|
+
logger.warn(`Failed to download font ${f.name}:${f.weight}. You may be offline or behind a firewall blocking Google. Consider setting \`googleFontMirror: true\`.`);
|
|
555
|
+
return false;
|
|
507
556
|
}
|
|
508
|
-
|
|
509
|
-
|
|
557
|
+
} else if (f.path) {
|
|
558
|
+
const extension = basename(f.path).split(".").pop();
|
|
559
|
+
if (!["woff", "ttf", "otf", "base64"].includes(extension)) {
|
|
560
|
+
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.`);
|
|
510
561
|
return false;
|
|
511
562
|
}
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
563
|
+
if (!isAbsolute(f.path)) {
|
|
564
|
+
f.path = join(nuxt.options.rootDir, nuxt.options.dir.public, f.path);
|
|
565
|
+
}
|
|
566
|
+
if (!existsSync(f.path)) {
|
|
567
|
+
logger.warn(`The ${f.name}:${f.weight} font was skipped because the file does not exist at path ${f.path}.`);
|
|
568
|
+
return false;
|
|
569
|
+
}
|
|
570
|
+
const fontData = await readFile(f.path, "base64");
|
|
571
|
+
f.key = `nuxt-og-image:fonts:${f.name}-${f.weight}.ttf.base64`;
|
|
572
|
+
await fontStorage.setItem(`${basename(f.path)}.base64`, fontData);
|
|
573
|
+
delete f.path;
|
|
574
|
+
}
|
|
575
|
+
return f;
|
|
576
|
+
}))).filter(Boolean);
|
|
577
|
+
nuxt.options.nitro.serverAssets = nuxt.options.nitro.serverAssets || [];
|
|
578
|
+
nuxt.options.nitro.serverAssets.push({ baseName: "nuxt-og-image:fonts", dir: serverFontsDir });
|
|
519
579
|
nuxt.options.experimental.componentIslands = true;
|
|
520
580
|
addServerHandler({
|
|
521
581
|
lazy: true,
|
|
522
582
|
route: "/__og-image__/font/**",
|
|
523
|
-
handler: resolve("./runtime/
|
|
583
|
+
handler: resolve("./runtime/nitro/routes/font")
|
|
524
584
|
});
|
|
525
585
|
if (config.debug || nuxt.options.dev) {
|
|
526
586
|
addServerHandler({
|
|
527
587
|
lazy: true,
|
|
528
588
|
route: "/__og-image__/debug.json",
|
|
529
|
-
handler: resolve("./runtime/
|
|
589
|
+
handler: resolve("./runtime/nitro/routes/debug.json")
|
|
530
590
|
});
|
|
531
591
|
}
|
|
532
592
|
addServerHandler({
|
|
533
593
|
lazy: true,
|
|
534
594
|
route: "/__og-image__/image/**",
|
|
535
|
-
handler: resolve("./runtime/
|
|
595
|
+
handler: resolve("./runtime/nitro/routes/image")
|
|
536
596
|
});
|
|
537
597
|
nuxt.options.optimization.treeShake.composables.client["nuxt-og-image"] = [];
|
|
538
|
-
["defineOgImage", "defineOgImageComponent", "defineOgImageScreenshot"].forEach((
|
|
598
|
+
["defineOgImage", "defineOgImageComponent", "defineOgImageScreenshot"].forEach((name2) => {
|
|
539
599
|
addImports({
|
|
540
|
-
name,
|
|
541
|
-
from: resolve(`./runtime/composables/${
|
|
600
|
+
name: name2,
|
|
601
|
+
from: resolve(`./runtime/nuxt/composables/${name2}`)
|
|
542
602
|
});
|
|
543
|
-
nuxt.options.optimization.treeShake.composables.client["nuxt-og-image"].push(
|
|
603
|
+
nuxt.options.optimization.treeShake.composables.client["nuxt-og-image"].push(name2);
|
|
544
604
|
});
|
|
545
605
|
await addComponentsDir({
|
|
546
|
-
path: resolve("./runtime/components/Templates/Community"),
|
|
606
|
+
path: resolve("./runtime/nuxt/components/Templates/Community"),
|
|
547
607
|
island: true,
|
|
548
608
|
watch: true
|
|
549
609
|
});
|
|
@@ -551,10 +611,10 @@ const module = defineNuxtModule({
|
|
|
551
611
|
// new
|
|
552
612
|
"OgImage",
|
|
553
613
|
"OgImageScreenshot"
|
|
554
|
-
].forEach((
|
|
614
|
+
].forEach((name2) => {
|
|
555
615
|
addComponent({
|
|
556
|
-
name,
|
|
557
|
-
filePath: resolve(`./runtime/components/OgImage/${
|
|
616
|
+
name: name2,
|
|
617
|
+
filePath: resolve(`./runtime/nuxt/components/OgImage/${name2}`),
|
|
558
618
|
...config.componentOptions
|
|
559
619
|
});
|
|
560
620
|
});
|
|
@@ -569,13 +629,13 @@ const module = defineNuxtModule({
|
|
|
569
629
|
if (component.pascalName.startsWith(dir) || component.kebabName.startsWith(dir) || component.shortPath.includes(`/${dir}/`))
|
|
570
630
|
valid = true;
|
|
571
631
|
});
|
|
572
|
-
if (component.filePath.includes(resolve("./runtime/components/Templates")))
|
|
632
|
+
if (component.filePath.includes(resolve("./runtime/nuxt/components/Templates")))
|
|
573
633
|
valid = true;
|
|
574
634
|
if (valid && fs.existsSync(component.filePath)) {
|
|
575
635
|
component.island = true;
|
|
576
636
|
component.mode = "server";
|
|
577
637
|
let category = "app";
|
|
578
|
-
if (component.filePath.includes(resolve("./runtime/components/Templates/Community")))
|
|
638
|
+
if (component.filePath.includes(resolve("./runtime/nuxt/components/Templates/Community")))
|
|
579
639
|
category = "community";
|
|
580
640
|
const componentFile = fs.readFileSync(component.filePath, "utf-8");
|
|
581
641
|
const credits = componentFile.split("\n").find((line) => line.startsWith(" * @credits"))?.replace("* @credits", "").trim();
|
|
@@ -603,9 +663,9 @@ const module = defineNuxtModule({
|
|
|
603
663
|
nuxt.options.nitro.virtual["#nuxt-og-image/component-names.mjs"] = () => {
|
|
604
664
|
return `export const componentNames = ${JSON.stringify(ogImageComponentCtx.components)}`;
|
|
605
665
|
};
|
|
606
|
-
let unoCssConfig = {
|
|
666
|
+
let unoCssConfig = {};
|
|
607
667
|
nuxt.hook("tailwindcss:config", (tailwindConfig) => {
|
|
608
|
-
unoCssConfig = defu(tailwindConfig.theme
|
|
668
|
+
unoCssConfig = defu(tailwindConfig.theme?.extend, { ...tailwindConfig.theme, extend: void 0 });
|
|
609
669
|
});
|
|
610
670
|
nuxt.hook("unocss:config", (_unoCssConfig) => {
|
|
611
671
|
unoCssConfig = { ..._unoCssConfig.theme };
|
|
@@ -616,7 +676,10 @@ const module = defineNuxtModule({
|
|
|
616
676
|
extendTypes("nuxt-og-image", ({ typesPath }) => {
|
|
617
677
|
const componentImports = ogImageComponentCtx.components.map((component) => {
|
|
618
678
|
const relativeComponentPath = relative(resolve(nuxt.options.rootDir, nuxt.options.buildDir, "module"), component.path);
|
|
619
|
-
|
|
679
|
+
const name2 = config.componentDirs.sort((a, b) => b.length - a.length).reduce((name3, dir) => {
|
|
680
|
+
return name3.replace(new RegExp(`^${dir}`), "");
|
|
681
|
+
}, component.pascalName);
|
|
682
|
+
return ` '${name2}': typeof import('${relativeComponentPath}')['default']`;
|
|
620
683
|
}).join("\n");
|
|
621
684
|
return `
|
|
622
685
|
declare module 'nitropack' {
|
|
@@ -628,7 +691,7 @@ declare module 'nitropack' {
|
|
|
628
691
|
}
|
|
629
692
|
interface NitroRuntimeHooks {
|
|
630
693
|
'nuxt-og-image:context': (ctx: import('${typesPath}').OgImageRenderEventContext) => void | Promise<void>
|
|
631
|
-
'nuxt-og-image:satori:vnodes': (vnodes: import('${typesPath}').VNode, ctx:
|
|
694
|
+
'nuxt-og-image:satori:vnodes': (vnodes: import('${typesPath}').VNode, ctx: import('${typesPath}').OgImageRenderEventContext) => void | Promise<void>
|
|
632
695
|
}
|
|
633
696
|
}
|
|
634
697
|
|
|
@@ -637,6 +700,9 @@ declare module '#nuxt-og-image/components' {
|
|
|
637
700
|
${componentImports}
|
|
638
701
|
}
|
|
639
702
|
}
|
|
703
|
+
declare module '#nuxt-og-image/unocss-config' {
|
|
704
|
+
export type theme = any
|
|
705
|
+
}
|
|
640
706
|
`;
|
|
641
707
|
});
|
|
642
708
|
const cacheEnabled = typeof config.runtimeCacheStorage !== "undefined" && config.runtimeCacheStorage !== false;
|
|
@@ -650,11 +716,19 @@ ${componentImports}
|
|
|
650
716
|
}
|
|
651
717
|
nuxt.hooks.hook("modules:done", async () => {
|
|
652
718
|
const normalisedFonts = normaliseFontInput(config.fonts);
|
|
653
|
-
if (!
|
|
719
|
+
if (!isNuxtGenerate() && nuxt.options.build) {
|
|
720
|
+
nuxt.options.nitro = nuxt.options.nitro || {};
|
|
654
721
|
nuxt.options.nitro.prerender = nuxt.options.nitro.prerender || {};
|
|
655
722
|
nuxt.options.nitro.prerender.routes = nuxt.options.nitro.prerender.routes || [];
|
|
656
|
-
normalisedFonts.filter((f) => !f.path && !f.key).forEach((
|
|
657
|
-
|
|
723
|
+
normalisedFonts.filter((f) => !f.path && !f.key).forEach((entry, key) => {
|
|
724
|
+
const { name: name2, weight } = entry;
|
|
725
|
+
if (preset !== "cloudflare" && preset !== "cloudflare-module") {
|
|
726
|
+
entry.path = `/__og-image__/font/${name2}/${weight}.ttf`;
|
|
727
|
+
nuxt.options.nitro.prerender.routes.unshift(entry.path);
|
|
728
|
+
}
|
|
729
|
+
if (name2 === "Inter" && [400, 700].includes(Number(weight)))
|
|
730
|
+
entry.key = `nuxt-og-image:fonts:inter-latin-ext-${weight}-normal.woff`;
|
|
731
|
+
normalisedFonts[key] = entry;
|
|
658
732
|
});
|
|
659
733
|
}
|
|
660
734
|
const hasColorModeModule = hasNuxtModule("@nuxtjs/color-mode");
|
|
@@ -677,7 +751,9 @@ ${componentImports}
|
|
|
677
751
|
// convert the fonts to uniform type to fix ts issue
|
|
678
752
|
fonts: normalisedFonts,
|
|
679
753
|
hasNuxtIcon: hasNuxtModule("nuxt-icon"),
|
|
680
|
-
colorPreference
|
|
754
|
+
colorPreference,
|
|
755
|
+
// @ts-expect-error runtime type
|
|
756
|
+
isNuxtContentDocumentDriven: !!nuxt.options.content?.documentDriven
|
|
681
757
|
};
|
|
682
758
|
nuxt.hooks.callHook("nuxt-og-image:runtime-config", runtimeConfig);
|
|
683
759
|
nuxt.options.runtimeConfig["nuxt-og-image"] = runtimeConfig;
|
|
@@ -685,7 +761,7 @@ ${componentImports}
|
|
|
685
761
|
if (nuxt.options.dev) {
|
|
686
762
|
setupDevHandler(config, resolve);
|
|
687
763
|
setupDevToolsUI(config, resolve);
|
|
688
|
-
} else if (
|
|
764
|
+
} else if (isNuxtGenerate()) {
|
|
689
765
|
setupGenerateHandler(config, resolve);
|
|
690
766
|
} else if (nuxt.options.build) {
|
|
691
767
|
await setupBuildHandler(config, resolve);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import playwrightCore from "playwright-core";
|
|
2
|
+
import { Launcher } from "chrome-launcher";
|
|
3
|
+
const chromePath = Launcher.getFirstInstallation();
|
|
4
|
+
export async function createBrowser() {
|
|
5
|
+
return playwrightCore.chromium.launch({
|
|
6
|
+
headless: true,
|
|
7
|
+
executablePath: chromePath
|
|
8
|
+
});
|
|
9
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { execa } from "execa";
|
|
2
|
+
import terminate from "terminate";
|
|
3
|
+
import { createConsola } from "consola";
|
|
4
|
+
import playwrightCore from "playwright-core";
|
|
5
|
+
let installedChromium = false;
|
|
6
|
+
let installChromiumPromise;
|
|
7
|
+
export async function createBrowser() {
|
|
8
|
+
if (installChromiumPromise)
|
|
9
|
+
await installChromiumPromise;
|
|
10
|
+
if (!installedChromium) {
|
|
11
|
+
installChromiumPromise = new Promise((_resolve) => {
|
|
12
|
+
const logger = createConsola().withTag("Nuxt OG Image");
|
|
13
|
+
logger.info("Installing Chromium install for og:image generation...");
|
|
14
|
+
const installChromeProcess = execa("npx", ["playwright", "install", "chromium"], {
|
|
15
|
+
stdio: "inherit"
|
|
16
|
+
});
|
|
17
|
+
installChromeProcess.stderr?.pipe(process.stderr);
|
|
18
|
+
new Promise((resolve) => {
|
|
19
|
+
installChromeProcess.on("exit", (e) => {
|
|
20
|
+
if (e !== 0)
|
|
21
|
+
logger.error("Failed to install Playwright dependency for og:image generation. Trying anyway...");
|
|
22
|
+
resolve(true);
|
|
23
|
+
});
|
|
24
|
+
}).then(() => {
|
|
25
|
+
installChromeProcess.pid && terminate(installChromeProcess.pid);
|
|
26
|
+
logger.info("Installed Chromium install for og:image generation.");
|
|
27
|
+
_resolve();
|
|
28
|
+
});
|
|
29
|
+
}).then(() => {
|
|
30
|
+
installedChromium = true;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return await playwrightCore.chromium.launch({
|
|
34
|
+
headless: true
|
|
35
|
+
});
|
|
36
|
+
}
|