nuxt-og-image 3.0.0-rc.30 → 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/dist/client/200.html +52 -50
- package/dist/client/404.html +52 -50
- package/dist/client/_nuxt/{IconCSS.CZ8ZjA39.js → IconCSS.V7-3N1ew.js} +1 -1
- package/dist/client/_nuxt/IconCSS.avVk0m4D.css +1 -0
- package/dist/client/_nuxt/{angular-html.ngCY688K.js → angular-html.ulaXK71i.js} +1 -1
- package/dist/client/_nuxt/{angular-ts.JfRveWw0.js → angular-ts.CpB8xVpe.js} +2 -2
- package/dist/client/_nuxt/{apl.ojEktQcO.js → apl.XB4V8Q_3.js} +1 -1
- package/dist/client/_nuxt/{astro.bVipJGkW.js → astro.5Up4Y-tq.js} +1 -1
- package/dist/client/_nuxt/{blade.HvKjdph-.js → blade.dLd1FX1V.js} +1 -1
- 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/{cobol.DIpfQcy2.js → cobol.yHzQax91.js} +1 -1
- package/dist/client/_nuxt/{coffee.09Ode5TL.js → coffee.UjKhX0iS.js} +1 -1
- package/dist/client/_nuxt/{crystal.KqWgScGa.js → crystal.ePodXjZr.js} +1 -1
- package/dist/client/_nuxt/{csharp.SlsguwGx.js → csharp.xHVQI8QI.js} +5 -4
- package/dist/client/_nuxt/{elixir.Q1fiwhg2.js → elixir.dYoE9A9d.js} +1 -1
- package/dist/client/_nuxt/{entry.OczI2MjB.css → entry.DjkITzvC.css} +1 -1
- package/dist/client/_nuxt/{entry.v1zp98GR.js → entry.LuO6Nylf.js} +59 -59
- package/dist/client/_nuxt/{erb.K_ppY6Ln.js → erb.vCu37omy.js} +1 -1
- package/dist/client/_nuxt/{error-404.VV5ycc25.js → error-404.DE_aZn4X.js} +1 -1
- package/dist/client/_nuxt/{error-500.VNY3c4OJ.js → error-500.4nIEY5y_.js} +1 -1
- 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/glimmer-js.8faD3vw8.js +13 -0
- package/dist/client/_nuxt/glimmer-ts.I8Eofu1P.js +13 -0
- package/dist/client/_nuxt/go.U2NlzxIl.js +1 -0
- package/dist/client/_nuxt/{graphql.Mw2TwDQV.js → graphql.aYTh5yPU.js} +1 -1
- package/dist/client/_nuxt/{hack.8bxbrxw3.js → hack.9pFjhnG2.js} +1 -1
- package/dist/client/_nuxt/{haml.9njXWWYk.js → haml.DYCf5dhF.js} +1 -1
- package/dist/client/_nuxt/{handlebars.e6aZXt-Z.js → handlebars.Z9TIkDUw.js} +1 -1
- package/dist/client/_nuxt/{html.q2IluNCo.js → html.ZVb9jHrO.js} +1 -1
- package/dist/client/_nuxt/{http.suDZEQUg.js → http.McgS7Vpm.js} +1 -1
- package/dist/client/_nuxt/{imba.Shm_xfQD.js → imba.guICF3zN.js} +1 -1
- package/dist/client/_nuxt/{javascript.4rbEI_qn.js → javascript.JMZ6uy5M.js} +1 -1
- package/dist/client/_nuxt/{jinja.E4nwqofd.js → jinja.H2a5aKFq.js} +1 -1
- package/dist/client/_nuxt/{jison.gkHJeffy.js → jison.hEN1Pilr.js} +1 -1
- package/dist/client/_nuxt/{jsx.O5ZRGASz.js → jsx.3LZ_BoLB.js} +1 -1
- package/dist/client/_nuxt/{julia.ku4F-e-8.js → julia.zN5MNt1V.js} +2 -2
- package/dist/client/_nuxt/latex.Pwsy_OsJ.js +3 -0
- package/dist/client/_nuxt/{liquid.O0W9gNJ1.js → liquid.UuwAmqmc.js} +1 -1
- package/dist/client/_nuxt/{marko.sELZHXF6.js → marko.gbQhFTQa.js} +1 -1
- package/dist/client/_nuxt/{nim.OZ1TiK9r.js → nim.16czfBCm.js} +1 -1
- package/dist/client/_nuxt/{perl.CaKiGeyl.js → perl._x09KDDb.js} +1 -1
- package/dist/client/_nuxt/{php.Q2jqa0n_.js → php.2PDLwZAX.js} +1 -1
- package/dist/client/_nuxt/{pug.dmyiUMO7.js → pug.ieZS468c.js} +1 -1
- package/dist/client/_nuxt/{razor.X4IfBpol.js → razor.wPI2afgP.js} +1 -1
- package/dist/client/_nuxt/{rst.GKtlS3h3.js → rst.Nzb5IGfi.js} +1 -1
- package/dist/client/_nuxt/{ruby.P9eGVNW4.js → ruby.oOCDDplm.js} +1 -1
- package/dist/client/_nuxt/rust.yNm59Dur.js +1 -0
- package/dist/client/_nuxt/{svelte.6zdtIlwM.js → svelte.j-bqdsch.js} +1 -1
- package/dist/client/_nuxt/{tsx.vbVEYvAd.js → tsx.7LxggtAE.js} +1 -1
- package/dist/client/_nuxt/{twig.h5iAhXmS.js → twig.p6WenPmw.js} +1 -1
- package/dist/client/_nuxt/{typescript.IWNmnGsa.js → typescript.HpdcmTOD.js} +1 -1
- package/dist/client/_nuxt/{vue-html.B2XvVFLk.js → vue-html.TGyjH-sv.js} +1 -1
- package/dist/client/_nuxt/{vue.CmUal76M.js → vue.AKvPdve9.js} +1 -1
- package/dist/client/index.html +52 -50
- package/dist/module.d.mts +6 -0
- package/dist/module.d.ts +6 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +97 -44
- package/dist/runtime/{core → nitro/og-image}/bindings/css-inline/wasm-fs.mjs +1 -1
- package/dist/runtime/{core → nitro/og-image}/bindings/css-inline/wasm.mjs +1 -1
- 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 +0 -10
- package/dist/runtime/{core/renderers → nitro/og-image}/satori/plugins/encoding.mjs +1 -1
- package/dist/runtime/{core/renderers → nitro/og-image}/satori/plugins/imageSrc.mjs +2 -4
- package/dist/runtime/{core/renderers/satori/index.mjs → nitro/og-image/satori/renderer.mjs} +24 -12
- 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/{core/html/applyInlineCss.mjs → nitro/og-image/satori/transforms/inlineCss.mjs} +1 -1
- package/dist/runtime/{core/renderers → nitro/og-image}/satori/vnodes.mjs +5 -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} +15 -8
- package/dist/runtime/nitro/plugins/nuxt-content.mjs +1 -1
- package/dist/runtime/nitro/plugins/prerender.mjs +4 -5
- package/dist/runtime/nitro/routes/{__og-image__/debug.json.d.ts → debug.json.d.ts} +1 -1
- package/dist/runtime/nitro/routes/{__og-image__/debug.json.mjs → debug.json.mjs} +1 -1
- package/dist/runtime/nitro/routes/{__og-image__/font-[name]-[weight].[extension].mjs → font.mjs} +2 -9
- package/dist/runtime/nitro/routes/{__og-image__/image.mjs → image.mjs} +6 -10
- 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/{kit.mjs → util/kit.mjs} +9 -0
- package/dist/runtime/{components → nuxt/components}/OgImage/OgImage.d.ts +1 -1
- package/dist/runtime/{components → nuxt/components}/OgImage/OgImageScreenshot.d.ts +1 -1
- package/dist/runtime/{components → nuxt/components}/Templates/Community/NuxtSeo.vue +1 -1
- package/dist/runtime/{composables → nuxt/composables}/defineOgImage.d.ts +1 -1
- package/dist/runtime/{composables → nuxt/composables}/defineOgImage.mjs +3 -3
- 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 +1 -1
- package/dist/runtime/nuxt/plugins/route-rule-og-image.server.mjs +1 -1
- package/dist/runtime/nuxt/utils.d.ts +1 -1
- package/dist/runtime/nuxt/utils.mjs +1 -1
- package/dist/runtime/{utils.pure.d.ts → pure.d.ts} +1 -0
- package/dist/runtime/{utils.pure.mjs → pure.mjs} +10 -0
- 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 +4 -0
- package/package.json +13 -11
- package/dist/client/_nuxt/IconCSS.UISSK5sv.css +0 -1
- package/dist/client/_nuxt/builds/meta/bb98bdc4-cb43-44eb-b961-cca8b9050d48.json +0 -1
- package/dist/client/_nuxt/fsharp.37PDbGQ_.js +0 -1
- package/dist/client/_nuxt/glimmer-js.OxCy_kio.js +0 -1
- package/dist/client/_nuxt/glimmer-ts.ZLbawe8H.js +0 -1
- package/dist/client/_nuxt/go.2bJKq9hO.js +0 -1
- package/dist/client/_nuxt/latex.6xV8tHRw.js +0 -3
- package/dist/client/_nuxt/rust.FLHuhIzG.js +0 -1
- 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 -39
- 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 -4
- package/dist/runtime/core/options/extract.mjs +0 -58
- package/dist/runtime/core/options/fetch.d.ts +0 -3
- package/dist/runtime/core/options/fetch.mjs +0 -32
- package/dist/runtime/core/utils/resolveRendererContext.d.ts +0 -3
- package/dist/runtime/core/utils/resolveRendererContext.mjs +0 -92
- package/dist/runtime/nitro/kit.d.ts +0 -3
- package/dist/runtime/nitro/utils.d.ts +0 -2
- package/dist/runtime/nitro/utils.mjs +0 -16
- 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/{core → nitro/og-image}/bindings/chromium/chrome-launcher.d.ts +0 -0
- /package/dist/runtime/{core → nitro/og-image}/bindings/chromium/chrome-launcher.mjs +0 -0
- /package/dist/runtime/{core → nitro/og-image}/bindings/chromium/on-demand.d.ts +0 -0
- /package/dist/runtime/{core → nitro/og-image}/bindings/chromium/on-demand.mjs +0 -0
- /package/dist/runtime/{core → nitro/og-image}/bindings/chromium/playwright.d.ts +0 -0
- /package/dist/runtime/{core → nitro/og-image}/bindings/chromium/playwright.mjs +0 -0
- /package/dist/runtime/{core → nitro/og-image}/bindings/css-inline/node.d.ts +0 -0
- /package/dist/runtime/{core → nitro/og-image}/bindings/css-inline/node.mjs +0 -0
- /package/dist/runtime/{core → nitro/og-image}/bindings/css-inline/wasm-fs.d.ts +0 -0
- /package/dist/runtime/{core → nitro/og-image}/bindings/css-inline/wasm.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/nitro/routes/{__og-image__/font-[name]-[weight].[extension].d.ts → font.d.ts} +0 -0
- /package/dist/runtime/nitro/routes/{__og-image__/image.d.ts → 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/UnJs.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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=Object.freeze({displayName:"Rust",name:"rust",patterns:[{begin:"(<)(\\[)",beginCaptures:{1:{name:"punctuation.brackets.angle.rust"},2:{name:"punctuation.brackets.square.rust"}},comment:"boxed slice literal",end:">",endCaptures:{0:{name:"punctuation.brackets.angle.rust"}},patterns:[{include:"#block-comments"},{include:"#comments"},{include:"#gtypes"},{include:"#lvariables"},{include:"#lifetimes"},{include:"#punctuation"},{include:"#types"}]},{captures:{1:{name:"keyword.operator.macro.dollar.rust"},3:{name:"keyword.other.crate.rust"},4:{name:"entity.name.type.metavariable.rust"},6:{name:"keyword.operator.key-value.rust"},7:{name:"variable.other.metavariable.specifier.rust"}},comment:"macro type metavariables",match:"(\\$)((crate)|([A-Z][A-Za-z0-9_]*))((:)(block|expr|ident|item|lifetime|literal|meta|path?|stmt|tt|ty|vis))?",name:"meta.macro.metavariable.type.rust",patterns:[{include:"#keywords"}]},{captures:{1:{name:"keyword.operator.macro.dollar.rust"},2:{name:"variable.other.metavariable.name.rust"},4:{name:"keyword.operator.key-value.rust"},5:{name:"variable.other.metavariable.specifier.rust"}},comment:"macro metavariables",match:"(\\$)([a-z][A-Za-z0-9_]*)((:)(block|expr|ident|item|lifetime|literal|meta|path?|stmt|tt|ty|vis))?",name:"meta.macro.metavariable.rust",patterns:[{include:"#keywords"}]},{captures:{1:{name:"entity.name.function.macro.rules.rust"},3:{name:"entity.name.function.macro.rust"},4:{name:"entity.name.type.macro.rust"},5:{name:"punctuation.brackets.curly.rust"}},comment:"macro rules",match:"\\b(macro_rules!)\\s+(([a-z0-9_]+)|([A-Z][a-z0-9_]*))\\s+(\\{)",name:"meta.macro.rules.rust"},{captures:{1:{name:"storage.type.rust"},2:{name:"entity.name.module.rust"}},comment:"modules",match:"(mod)\\s+((?:r#(?!crate|[Ss]elf|super))?[a-z][A-Za-z0-9_]*)"},{begin:"\\b(extern)\\s+(crate)",beginCaptures:{1:{name:"storage.type.rust"},2:{name:"keyword.other.crate.rust"}},comment:"external crate imports",end:";",endCaptures:{0:{name:"punctuation.semi.rust"}},name:"meta.import.rust",patterns:[{include:"#block-comments"},{include:"#comments"},{include:"#keywords"},{include:"#punctuation"}]},{begin:"\\b(use)\\s",beginCaptures:{1:{name:"keyword.other.rust"}},comment:"use statements",end:";",endCaptures:{0:{name:"punctuation.semi.rust"}},name:"meta.use.rust",patterns:[{include:"#block-comments"},{include:"#comments"},{include:"#keywords"},{include:"#namespaces"},{include:"#punctuation"},{include:"#types"},{include:"#lvariables"}]},{include:"#block-comments"},{include:"#comments"},{include:"#attributes"},{include:"#lvariables"},{include:"#constants"},{include:"#gtypes"},{include:"#functions"},{include:"#types"},{include:"#keywords"},{include:"#lifetimes"},{include:"#macros"},{include:"#namespaces"},{include:"#punctuation"},{include:"#strings"},{include:"#variables"}],repository:{attributes:{begin:"(#)(\\!?)(\\[)",beginCaptures:{1:{name:"punctuation.definition.attribute.rust"},3:{name:"punctuation.brackets.attribute.rust"}},comment:"attributes",end:"\\]",endCaptures:{0:{name:"punctuation.brackets.attribute.rust"}},name:"meta.attribute.rust",patterns:[{include:"#block-comments"},{include:"#comments"},{include:"#keywords"},{include:"#lifetimes"},{include:"#punctuation"},{include:"#strings"},{include:"#gtypes"},{include:"#types"}]},"block-comments":{patterns:[{comment:"empty block comments",match:"/\\*\\*/",name:"comment.block.rust"},{begin:"/\\*\\*",comment:"block documentation comments",end:"\\*/",name:"comment.block.documentation.rust",patterns:[{include:"#block-comments"}]},{begin:"/\\*(?!\\*)",comment:"block comments",end:"\\*/",name:"comment.block.rust",patterns:[{include:"#block-comments"}]}]},comments:{patterns:[{comment:"documentation comments",match:"^\\s*///.*",name:"comment.line.documentation.rust"},{comment:"line comments",match:"\\s*//.*",name:"comment.line.double-slash.rust"}]},constants:{patterns:[{comment:"ALL CAPS constants",match:"\\b[A-Z]{2}[A-Z0-9_]*\\b",name:"constant.other.caps.rust"},{captures:{1:{name:"storage.type.rust"},2:{name:"constant.other.caps.rust"}},comment:"constant declarations",match:"\\b(const)\\s+([A-Z][A-Za-z0-9_]*)\\b"},{captures:{1:{name:"punctuation.separator.dot.decimal.rust"},2:{name:"keyword.operator.exponent.rust"},3:{name:"keyword.operator.exponent.sign.rust"},4:{name:"constant.numeric.decimal.exponent.mantissa.rust"},5:{name:"entity.name.type.numeric.rust"}},comment:"decimal integers and floats",match:"\\b\\d[\\d_]*(\\.?)[\\d_]*(?:(E|e)([+-]?)([\\d_]+))?(f32|f64|i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b",name:"constant.numeric.decimal.rust"},{captures:{1:{name:"entity.name.type.numeric.rust"}},comment:"hexadecimal integers",match:"\\b0x[\\da-fA-F_]+(i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b",name:"constant.numeric.hex.rust"},{captures:{1:{name:"entity.name.type.numeric.rust"}},comment:"octal integers",match:"\\b0o[0-7_]+(i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b",name:"constant.numeric.oct.rust"},{captures:{1:{name:"entity.name.type.numeric.rust"}},comment:"binary integers",match:"\\b0b[01_]+(i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b",name:"constant.numeric.bin.rust"},{comment:"booleans",match:"\\b(true|false)\\b",name:"constant.language.bool.rust"}]},escapes:{captures:{1:{name:"constant.character.escape.backslash.rust"},2:{name:"constant.character.escape.bit.rust"},3:{name:"constant.character.escape.unicode.rust"},4:{name:"constant.character.escape.unicode.punctuation.rust"},5:{name:"constant.character.escape.unicode.punctuation.rust"}},comment:"escapes: ASCII, byte, Unicode, quote, regex",match:"(\\\\)(?:(?:(x[0-7][\\da-fA-F])|(u(\\{)[\\da-fA-F]{4,6}(\\}))|.))",name:"constant.character.escape.rust"},functions:{patterns:[{captures:{1:{name:"keyword.other.rust"},2:{name:"punctuation.brackets.round.rust"}},comment:"pub as a function",match:"\\b(pub)(\\()"},{begin:"\\b(fn)\\s+((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)((\\()|(<))",beginCaptures:{1:{name:"keyword.other.fn.rust"},2:{name:"entity.name.function.rust"},4:{name:"punctuation.brackets.round.rust"},5:{name:"punctuation.brackets.angle.rust"}},comment:"function definition",end:"\\{|;",endCaptures:{0:{name:"punctuation.brackets.curly.rust"}},name:"meta.function.definition.rust",patterns:[{include:"#block-comments"},{include:"#comments"},{include:"#keywords"},{include:"#lvariables"},{include:"#constants"},{include:"#gtypes"},{include:"#functions"},{include:"#lifetimes"},{include:"#macros"},{include:"#namespaces"},{include:"#punctuation"},{include:"#strings"},{include:"#types"},{include:"#variables"}]},{begin:"((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)(\\()",beginCaptures:{1:{name:"entity.name.function.rust"},2:{name:"punctuation.brackets.round.rust"}},comment:"function/method calls, chaining",end:"\\)",endCaptures:{0:{name:"punctuation.brackets.round.rust"}},name:"meta.function.call.rust",patterns:[{include:"#block-comments"},{include:"#comments"},{include:"#attributes"},{include:"#keywords"},{include:"#lvariables"},{include:"#constants"},{include:"#gtypes"},{include:"#functions"},{include:"#lifetimes"},{include:"#macros"},{include:"#namespaces"},{include:"#punctuation"},{include:"#strings"},{include:"#types"},{include:"#variables"}]},{begin:"((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)(?=::<.*>\\()",beginCaptures:{1:{name:"entity.name.function.rust"}},comment:"function/method calls with turbofish",end:"\\)",endCaptures:{0:{name:"punctuation.brackets.round.rust"}},name:"meta.function.call.rust",patterns:[{include:"#block-comments"},{include:"#comments"},{include:"#attributes"},{include:"#keywords"},{include:"#lvariables"},{include:"#constants"},{include:"#gtypes"},{include:"#functions"},{include:"#lifetimes"},{include:"#macros"},{include:"#namespaces"},{include:"#punctuation"},{include:"#strings"},{include:"#types"},{include:"#variables"}]}]},gtypes:{patterns:[{comment:"option types",match:"\\b(Some|None)\\b",name:"entity.name.type.option.rust"},{comment:"result types",match:"\\b(Ok|Err)\\b",name:"entity.name.type.result.rust"}]},interpolations:{captures:{1:{name:"punctuation.definition.interpolation.rust"},2:{name:"punctuation.definition.interpolation.rust"}},comment:"curly brace interpolations",match:'({)[^"{}]*(})',name:"meta.interpolation.rust"},keywords:{patterns:[{comment:"control flow keywords",match:"\\b(await|break|continue|do|else|for|if|loop|match|return|try|while|yield)\\b",name:"keyword.control.rust"},{comment:"storage keywords",match:"\\b(extern|let|macro|mod)\\b",name:"keyword.other.rust storage.type.rust"},{comment:"const keyword",match:"\\b(const)\\b",name:"storage.modifier.rust"},{comment:"type keyword",match:"\\b(type)\\b",name:"keyword.declaration.type.rust storage.type.rust"},{comment:"enum keyword",match:"\\b(enum)\\b",name:"keyword.declaration.enum.rust storage.type.rust"},{comment:"trait keyword",match:"\\b(trait)\\b",name:"keyword.declaration.trait.rust storage.type.rust"},{comment:"struct keyword",match:"\\b(struct)\\b",name:"keyword.declaration.struct.rust storage.type.rust"},{comment:"storage modifiers",match:"\\b(abstract|static)\\b",name:"storage.modifier.rust"},{comment:"other keywords",match:"\\b(as|async|become|box|dyn|move|final|impl|in|override|priv|pub|ref|typeof|union|unsafe|unsized|use|virtual|where)\\b",name:"keyword.other.rust"},{comment:"fn",match:"\\bfn\\b",name:"keyword.other.fn.rust"},{comment:"crate",match:"\\bcrate\\b",name:"keyword.other.crate.rust"},{comment:"mut",match:"\\bmut\\b",name:"storage.modifier.mut.rust"},{comment:"logical operators",match:"(\\^|\\||\\|\\||&&|<<|>>|!)(?!=)",name:"keyword.operator.logical.rust"},{comment:"logical AND, borrow references",match:"&(?![&=])",name:"keyword.operator.borrow.and.rust"},{comment:"assignment operators",match:"(\\+=|-=|\\*=|/=|%=|\\^=|&=|\\|=|<<=|>>=)",name:"keyword.operator.assignment.rust"},{comment:"single equal",match:"(?<![<>])=(?!=|>)",name:"keyword.operator.assignment.equal.rust"},{comment:"comparison operators",match:"(=(=)?(?!>)|!=|<=|(?<!=)>=)",name:"keyword.operator.comparison.rust"},{comment:"math operators",match:"(([+%]|(\\*(?!\\w)))(?!=))|(-(?!>))|(/(?!/))",name:"keyword.operator.math.rust"},{captures:{1:{name:"punctuation.brackets.round.rust"},2:{name:"punctuation.brackets.square.rust"},3:{name:"punctuation.brackets.curly.rust"},4:{name:"keyword.operator.comparison.rust"},5:{name:"punctuation.brackets.round.rust"},6:{name:"punctuation.brackets.square.rust"},7:{name:"punctuation.brackets.curly.rust"}},comment:"less than, greater than (special case)",match:"(?:\\b|(?:(\\))|(\\])|(\\})))[ \\t]+([<>])[ \\t]+(?:\\b|(?:(\\()|(\\[)|(\\{)))"},{comment:"namespace operator",match:"::",name:"keyword.operator.namespace.rust"},{captures:{1:{name:"keyword.operator.dereference.rust"}},comment:"dereference asterisk",match:"(\\*)(?=\\w+)"},{comment:"subpattern binding",match:"@",name:"keyword.operator.subpattern.rust"},{comment:"dot access",match:"\\.(?!\\.)",name:"keyword.operator.access.dot.rust"},{comment:"ranges, range patterns",match:"\\.{2}(=|\\.)?",name:"keyword.operator.range.rust"},{comment:"colon",match:":(?!:)",name:"keyword.operator.key-value.rust"},{comment:"dashrocket, skinny arrow",match:"->",name:"keyword.operator.arrow.skinny.rust"},{comment:"hashrocket, fat arrow",match:"=>",name:"keyword.operator.arrow.fat.rust"},{comment:"dollar macros",match:"\\$",name:"keyword.operator.macro.dollar.rust"},{comment:"question mark operator, questionably sized, macro kleene matcher",match:"\\?",name:"keyword.operator.question.rust"}]},lifetimes:{patterns:[{captures:{1:{name:"punctuation.definition.lifetime.rust"},2:{name:"entity.name.type.lifetime.rust"}},comment:"named lifetime parameters",match:"(['])([a-zA-Z_][0-9a-zA-Z_]*)(?!['])\\b"},{captures:{1:{name:"keyword.operator.borrow.rust"},2:{name:"punctuation.definition.lifetime.rust"},3:{name:"entity.name.type.lifetime.rust"}},comment:"borrowing references to named lifetimes",match:"(\\&)(['])([a-zA-Z_][0-9a-zA-Z_]*)(?!['])\\b"}]},lvariables:{patterns:[{comment:"self",match:"\\b[Ss]elf\\b",name:"variable.language.self.rust"},{comment:"super",match:"\\bsuper\\b",name:"variable.language.super.rust"}]},macros:{patterns:[{captures:{2:{name:"entity.name.function.macro.rust"},3:{name:"entity.name.type.macro.rust"}},comment:"macros",match:"(([a-z_][A-Za-z0-9_]*!)|([A-Z_][A-Za-z0-9_]*!))",name:"meta.macro.rust"}]},namespaces:{patterns:[{captures:{1:{name:"entity.name.namespace.rust"},2:{name:"keyword.operator.namespace.rust"}},comment:"namespace (non-type, non-function path segment)",match:"(?<![A-Za-z0-9_])([A-Za-z0-9_]+)((?<!super|self)::)"}]},punctuation:{patterns:[{comment:"comma",match:",",name:"punctuation.comma.rust"},{comment:"curly braces",match:"[{}]",name:"punctuation.brackets.curly.rust"},{comment:"parentheses, round brackets",match:"[()]",name:"punctuation.brackets.round.rust"},{comment:"semicolon",match:";",name:"punctuation.semi.rust"},{comment:"square brackets",match:"[\\[\\]]",name:"punctuation.brackets.square.rust"},{comment:"angle brackets",match:"(?<!=)[<>]",name:"punctuation.brackets.angle.rust"}]},strings:{patterns:[{begin:'(b?)(")',beginCaptures:{1:{name:"string.quoted.byte.raw.rust"},2:{name:"punctuation.definition.string.rust"}},comment:"double-quoted strings and byte strings",end:'"',endCaptures:{0:{name:"punctuation.definition.string.rust"}},name:"string.quoted.double.rust",patterns:[{include:"#escapes"},{include:"#interpolations"}]},{begin:'(b?r)(#*)(")',beginCaptures:{1:{name:"string.quoted.byte.raw.rust"},2:{name:"punctuation.definition.string.raw.rust"},3:{name:"punctuation.definition.string.rust"}},comment:"double-quoted raw strings and raw byte strings",end:'(")(\\2)',endCaptures:{1:{name:"punctuation.definition.string.rust"},2:{name:"punctuation.definition.string.raw.rust"}},name:"string.quoted.double.rust"},{begin:"(b)?(')",beginCaptures:{1:{name:"string.quoted.byte.raw.rust"},2:{name:"punctuation.definition.char.rust"}},comment:"characters and bytes",end:"'",endCaptures:{0:{name:"punctuation.definition.char.rust"}},name:"string.quoted.single.char.rust",patterns:[{include:"#escapes"}]}]},types:{patterns:[{captures:{1:{name:"entity.name.type.numeric.rust"}},comment:"numeric types",match:"(?<![A-Za-z])(f32|f64|i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)\\b"},{begin:"\\b(_?[A-Z][A-Za-z0-9_]*)(<)",beginCaptures:{1:{name:"entity.name.type.rust"},2:{name:"punctuation.brackets.angle.rust"}},comment:"parameterized types",end:">",endCaptures:{0:{name:"punctuation.brackets.angle.rust"}},patterns:[{include:"#block-comments"},{include:"#comments"},{include:"#keywords"},{include:"#lvariables"},{include:"#lifetimes"},{include:"#punctuation"},{include:"#types"},{include:"#variables"}]},{comment:"primitive types",match:"\\b(bool|char|str)\\b",name:"entity.name.type.primitive.rust"},{captures:{1:{name:"keyword.declaration.trait.rust storage.type.rust"},2:{name:"entity.name.type.trait.rust"}},comment:"trait declarations",match:"\\b(trait)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b"},{captures:{1:{name:"keyword.declaration.struct.rust storage.type.rust"},2:{name:"entity.name.type.struct.rust"}},comment:"struct declarations",match:"\\b(struct)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b"},{captures:{1:{name:"keyword.declaration.enum.rust storage.type.rust"},2:{name:"entity.name.type.enum.rust"}},comment:"enum declarations",match:"\\b(enum)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b"},{captures:{1:{name:"keyword.declaration.type.rust storage.type.rust"},2:{name:"entity.name.type.declaration.rust"}},comment:"type declarations",match:"\\b(type)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b"},{comment:"types",match:"\\b_?[A-Z][A-Za-z0-9_]*\\b(?!!)",name:"entity.name.type.rust"}]},variables:{patterns:[{comment:"variables",match:"\\b(?<!(?<!\\.)\\.)(?:r#(?!(crate|[Ss]elf|super)))?[a-z0-9_]+\\b",name:"variable.other.rust"}]}},scopeName:"source.rust",aliases:["rs"]});var t=[e];export{t as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const emojiCache: import("unstorage/dist/shared/unstorage.745f9650").a<string>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function toBase64Image(fileName: string, data: string | ArrayBuffer): string;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Buffer } from "node:buffer";
|
|
2
|
-
export function toBase64Image(fileName, data) {
|
|
3
|
-
const base64 = typeof data === "string" ? data : Buffer.from(data).toString("base64");
|
|
4
|
-
let type = "image/jpeg";
|
|
5
|
-
const ext = fileName.split(".").pop();
|
|
6
|
-
if (ext === "svg")
|
|
7
|
-
type = "image/svg+xml";
|
|
8
|
-
else if (ext === "png")
|
|
9
|
-
type = "image/png";
|
|
10
|
-
return `data:${type};base64,${base64}`;
|
|
11
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { useStorage } from "#internal/nitro";
|
|
2
|
-
import { useNitroOrigin } from "#imports";
|
|
3
|
-
import { assets } from "#internal/nitro/virtual/server-assets";
|
|
4
|
-
export async function loadFont({ e }, font) {
|
|
5
|
-
const { name, weight } = font;
|
|
6
|
-
let data;
|
|
7
|
-
if (import.meta.dev || import.meta.prerender) {
|
|
8
|
-
if (font.key && await assets.hasItem(font.key))
|
|
9
|
-
data = await assets.getItemRaw(font.key);
|
|
10
|
-
}
|
|
11
|
-
if (!data) {
|
|
12
|
-
if (font.path) {
|
|
13
|
-
if (import.meta.dev || import.meta.prerender) {
|
|
14
|
-
const key = `root:public${font.path.replace("./", ":").replace("/", ":")}`;
|
|
15
|
-
if (await useStorage().hasItem(key))
|
|
16
|
-
data = await useStorage().getItemRaw(key);
|
|
17
|
-
if (!data) {
|
|
18
|
-
data = await e.$fetch(font.path, {
|
|
19
|
-
responseType: "arrayBuffer"
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
} else {
|
|
23
|
-
data = await e.$fetch(font.path, {
|
|
24
|
-
baseURL: useNitroOrigin(e),
|
|
25
|
-
responseType: "arrayBuffer"
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
} else {
|
|
29
|
-
data = await e.$fetch(`/__og-image__/font/${name}/${weight}.ttf`, {
|
|
30
|
-
responseType: "arrayBuffer",
|
|
31
|
-
query: {
|
|
32
|
-
font
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
font.data = data;
|
|
38
|
-
return font;
|
|
39
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { createError } from "h3";
|
|
2
|
-
import { hash } from "ohash";
|
|
3
|
-
export function fetchIsland({ options, e }) {
|
|
4
|
-
if (!options.component) {
|
|
5
|
-
throw createError({
|
|
6
|
-
statusCode: 500,
|
|
7
|
-
statusMessage: `[Nuxt OG Image] Rendering an invalid component. Received options: ${JSON.stringify(options)}.`
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
const hashId = hash([options.component, options]);
|
|
11
|
-
const props = typeof options.props !== "undefined" ? options.props : options;
|
|
12
|
-
return e.$fetch(`/__nuxt_island/${options.component}_${hashId}.json`, {
|
|
13
|
-
params: {
|
|
14
|
-
props: JSON.stringify(props)
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { OgImageOptions } from '../../types';
|
|
2
|
-
export declare function htmlDecodeQuotes(html: string): string;
|
|
3
|
-
export declare function decodeHtml(html: string): string;
|
|
4
|
-
export declare function extractAndNormaliseOgImageOptions(html: string): OgImageOptions | false;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export function htmlDecodeQuotes(html) {
|
|
2
|
-
return html.replace(/"/g, '"').replace(/'/g, "'").replace(/'/g, "'");
|
|
3
|
-
}
|
|
4
|
-
export function decodeHtml(html) {
|
|
5
|
-
return html.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/¢/g, "\xA2").replace(/£/g, "\xA3").replace(/¥/g, "\xA5").replace(/€/g, "\u20AC").replace(/©/g, "\xA9").replace(/®/g, "\xAE").replace(/"/g, '"').replace(/'/g, "'").replace(/'/g, "'").replace(///g, "/").replace(/&#([0-9]+);/g, (full, int) => {
|
|
6
|
-
return String.fromCharCode(Number.parseInt(int));
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
function decodeObjectHtmlEntities(obj) {
|
|
10
|
-
Object.entries(obj).forEach(([key, value]) => {
|
|
11
|
-
if (typeof value === "string")
|
|
12
|
-
obj[key] = decodeHtml(value);
|
|
13
|
-
});
|
|
14
|
-
return obj;
|
|
15
|
-
}
|
|
16
|
-
export function extractAndNormaliseOgImageOptions(html) {
|
|
17
|
-
const htmlPayload = html.match(/<script.+id="nuxt-og-image-options"[^>]*>(.+?)<\/script>/)?.[1];
|
|
18
|
-
if (!htmlPayload)
|
|
19
|
-
return false;
|
|
20
|
-
let options;
|
|
21
|
-
try {
|
|
22
|
-
const payload2 = JSON.parse(htmlPayload);
|
|
23
|
-
Object.entries(payload2).forEach(([key, value]) => {
|
|
24
|
-
if (!value)
|
|
25
|
-
delete payload2[key];
|
|
26
|
-
});
|
|
27
|
-
options = payload2;
|
|
28
|
-
} catch (e) {
|
|
29
|
-
if (import.meta.dev)
|
|
30
|
-
console.warn("Failed to parse #nuxt-og-image-options", e, options);
|
|
31
|
-
}
|
|
32
|
-
if (!options)
|
|
33
|
-
return false;
|
|
34
|
-
const description = html.match(/<meta[^>]+name="description"[^>]*>/)?.[0];
|
|
35
|
-
if (description) {
|
|
36
|
-
const [, content] = description.match(/content="([^"]+)"/) || [];
|
|
37
|
-
if (content && !options.props.description)
|
|
38
|
-
options.props.description = content;
|
|
39
|
-
}
|
|
40
|
-
const payload = decodeObjectHtmlEntities(options);
|
|
41
|
-
if (import.meta.dev) {
|
|
42
|
-
const socialPreview = {};
|
|
43
|
-
const socialMetaTags = html.match(/<meta[^>]+(property|name)="(twitter|og):([^"]+)"[^>]*>/g);
|
|
44
|
-
if (socialMetaTags) {
|
|
45
|
-
socialMetaTags.forEach((tag) => {
|
|
46
|
-
const [, , type, key] = tag.match(/(property|name)="(twitter|og):([^"]+)"/);
|
|
47
|
-
const value = tag.match(/content="([^"]+)"/)?.[1];
|
|
48
|
-
if (!value)
|
|
49
|
-
return;
|
|
50
|
-
if (!socialPreview[type])
|
|
51
|
-
socialPreview[type] = {};
|
|
52
|
-
socialPreview[type][key] = value;
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
payload.socialPreview = socialPreview;
|
|
56
|
-
}
|
|
57
|
-
return payload;
|
|
58
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { createError } from "h3";
|
|
2
|
-
import { htmlPayloadCache } from "../cache/htmlPayload.mjs";
|
|
3
|
-
import { extractAndNormaliseOgImageOptions } from "./extract.mjs";
|
|
4
|
-
export async function fetchPathHtmlAndExtractOptions(e, path, key) {
|
|
5
|
-
const cachedHtmlPayload = await htmlPayloadCache.getItem(key);
|
|
6
|
-
if (cachedHtmlPayload && cachedHtmlPayload.expiresAt < Date.now())
|
|
7
|
-
return cachedHtmlPayload.value;
|
|
8
|
-
let html;
|
|
9
|
-
try {
|
|
10
|
-
html = await e.$fetch(path);
|
|
11
|
-
} catch (err) {
|
|
12
|
-
return createError({
|
|
13
|
-
statusCode: 500,
|
|
14
|
-
statusMessage: `[Nuxt OG Image] Failed to read the path ${path} for og-image extraction. ${err.message}.`
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
if (typeof html !== "string") {
|
|
18
|
-
return createError({
|
|
19
|
-
statusCode: 500,
|
|
20
|
-
statusMessage: `[Nuxt OG Image] Got invalid response from ${path} for og-image extraction.`
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
const payload = extractAndNormaliseOgImageOptions(html);
|
|
24
|
-
if (payload) {
|
|
25
|
-
await htmlPayloadCache.setItem(key, {
|
|
26
|
-
// 60 minutes for prerender, 10 seconds for runtime
|
|
27
|
-
expiresAt: Date.now() + 1e3 * (import.meta.prerender ? 60 * 60 : 10),
|
|
28
|
-
value: payload
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
return payload;
|
|
32
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { parseURL, withQuery, withoutTrailingSlash } from "ufo";
|
|
2
|
-
import { createError, getQuery } from "h3";
|
|
3
|
-
import { defu } from "defu";
|
|
4
|
-
import { fetchPathHtmlAndExtractOptions } from "../options/fetch.mjs";
|
|
5
|
-
import { prerenderOptionsCache } from "../cache/prerender.mjs";
|
|
6
|
-
import { useChromiumRenderer, useSatoriRenderer } from "../renderers/satori/instances.mjs";
|
|
7
|
-
import { separateProps, useOgImageRuntimeConfig } from "../../utils.mjs";
|
|
8
|
-
import { resolvePathCacheKey } from "../../nitro/utils.mjs";
|
|
9
|
-
import { createNitroRouteRuleMatcher } from "../../nitro/kit.mjs";
|
|
10
|
-
import { useNitroApp } from "#internal/nitro/app";
|
|
11
|
-
export async function resolveRendererContext(e) {
|
|
12
|
-
const runtimeConfig = useOgImageRuntimeConfig();
|
|
13
|
-
const path = parseURL(e.path).pathname;
|
|
14
|
-
const extension = path.split(".").pop();
|
|
15
|
-
if (!extension) {
|
|
16
|
-
return createError({
|
|
17
|
-
statusCode: 400,
|
|
18
|
-
statusMessage: `[Nuxt OG Image] Missing OG Image type.`
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
if (!["png", "jpeg", "jpg", "svg", "html", "json"].includes(extension)) {
|
|
22
|
-
return createError({
|
|
23
|
-
statusCode: 400,
|
|
24
|
-
statusMessage: `[Nuxt OG Image] Unknown OG Image type ${extension}.`
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
let queryParams = { ...getQuery(e) };
|
|
28
|
-
queryParams.props = JSON.parse(queryParams.props || "{}");
|
|
29
|
-
queryParams = separateProps(queryParams);
|
|
30
|
-
let basePath = withoutTrailingSlash(
|
|
31
|
-
path.replace(`/__og-image__/image`, "").replace(`/og.${extension}`, "")
|
|
32
|
-
);
|
|
33
|
-
if (queryParams._query)
|
|
34
|
-
basePath = withQuery(basePath, JSON.parse(queryParams._query));
|
|
35
|
-
const isDebugJsonPayload = extension === "json" && runtimeConfig.debug;
|
|
36
|
-
const key = resolvePathCacheKey(e, basePath);
|
|
37
|
-
let options = queryParams.options;
|
|
38
|
-
if (!options) {
|
|
39
|
-
if (import.meta.prerender)
|
|
40
|
-
options = await prerenderOptionsCache?.getItem(key);
|
|
41
|
-
if (!options) {
|
|
42
|
-
const payload = await fetchPathHtmlAndExtractOptions(e, basePath, key);
|
|
43
|
-
if (payload instanceof Error)
|
|
44
|
-
return payload;
|
|
45
|
-
options = payload;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
delete queryParams.options;
|
|
49
|
-
const routeRuleMatcher = createNitroRouteRuleMatcher();
|
|
50
|
-
const routeRules = routeRuleMatcher(basePath);
|
|
51
|
-
if (typeof routeRules.ogImage === "undefined" && !options) {
|
|
52
|
-
return createError({
|
|
53
|
-
statusCode: 400,
|
|
54
|
-
statusMessage: "The route is missing the Nuxt OG Image payload or route rules."
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
const ogImageRouteRules = separateProps(routeRules.ogImage);
|
|
58
|
-
options = defu(queryParams, ogImageRouteRules, options, runtimeConfig.defaults);
|
|
59
|
-
if (!options) {
|
|
60
|
-
return createError({
|
|
61
|
-
statusCode: 404,
|
|
62
|
-
statusMessage: "[Nuxt OG Image] OG Image not found."
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
let renderer;
|
|
66
|
-
switch (options.renderer) {
|
|
67
|
-
case "satori":
|
|
68
|
-
renderer = await useSatoriRenderer();
|
|
69
|
-
break;
|
|
70
|
-
case "chromium":
|
|
71
|
-
renderer = await useChromiumRenderer();
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
if (!renderer || renderer.__unenv__) {
|
|
75
|
-
throw createError({
|
|
76
|
-
statusCode: 400,
|
|
77
|
-
statusMessage: `[Nuxt OG Image] Renderer ${options.renderer} is missing.`
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
const ctx = {
|
|
81
|
-
e,
|
|
82
|
-
key,
|
|
83
|
-
renderer,
|
|
84
|
-
isDebugJsonPayload,
|
|
85
|
-
extension,
|
|
86
|
-
basePath,
|
|
87
|
-
options,
|
|
88
|
-
_nitro: useNitroApp()
|
|
89
|
-
};
|
|
90
|
-
await ctx._nitro.hooks.callHook("nuxt-og-image:context", ctx);
|
|
91
|
-
return ctx;
|
|
92
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { withoutLeadingSlash, withoutTrailingSlash } from "ufo";
|
|
2
|
-
import { hash } from "ohash";
|
|
3
|
-
import { normalizeKey } from "unstorage";
|
|
4
|
-
import { getQuery } from "h3";
|
|
5
|
-
export function resolvePathCacheKey(e, path) {
|
|
6
|
-
const siteConfig = e.context.siteConfig.get();
|
|
7
|
-
const basePath = withoutTrailingSlash(withoutLeadingSlash(normalizeKey(path || e.path)));
|
|
8
|
-
return [
|
|
9
|
-
!basePath || basePath === "/" ? "index" : basePath,
|
|
10
|
-
hash([
|
|
11
|
-
basePath,
|
|
12
|
-
siteConfig.url,
|
|
13
|
-
hash(getQuery(e))
|
|
14
|
-
])
|
|
15
|
-
].join(":");
|
|
16
|
-
}
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/runtime/{core/renderers/chromium/index.d.ts → nitro/og-image/chromium/renderer.d.ts}
RENAMED
|
File without changes
|
/package/dist/runtime/{core/renderers/chromium/index.mjs → nitro/og-image/chromium/renderer.mjs}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/runtime/{core/renderers/satori/index.d.ts → nitro/og-image/satori/renderer.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/runtime/nitro/routes/{__og-image__/font-[name]-[weight].[extension].d.ts → font.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|