nuxt-og-image 6.7.2 → 6.7.3
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/chunks/tw4.cjs +7 -7
- package/dist/chunks/tw4.mjs +7 -7
- package/dist/chunks/uno.cjs +6 -6
- package/dist/chunks/uno.mjs +6 -6
- package/dist/cli.cjs +5 -12
- package/dist/cli.mjs +3 -10
- package/dist/devtools/lib/og-image/shared/urlEncoding.ts +5 -4
- package/dist/module.cjs +5 -5
- package/dist/module.json +1 -1
- package/dist/module.mjs +5 -5
- package/dist/runtime/app/plugins/__zero-runtime/og-image-canonical-urls.server.js +4 -6
- package/dist/runtime/app/plugins/__zero-runtime/route-rule-og-image.server.js +4 -6
- package/dist/runtime/app/plugins/og-image-canonical-urls.server.d.ts +1 -2
- package/dist/runtime/app/plugins/og-image-canonical-urls.server.js +1 -7
- package/dist/runtime/app/plugins/route-rule-og-image.server.d.ts +1 -2
- package/dist/runtime/app/plugins/route-rule-og-image.server.js +1 -7
- package/dist/runtime/app/utils/plugins.d.ts +2 -3
- package/dist/runtime/app/utils/plugins.js +5 -5
- package/dist/runtime/server/og-image/context.js +3 -3
- package/dist/runtime/server/util/cache.js +2 -2
- package/dist/runtime/server/util/kit.js +2 -2
- package/dist/runtime/shared/hash.d.ts +10 -0
- package/dist/runtime/shared/hash.js +5 -0
- package/dist/runtime/shared/urlEncoding.d.ts +3 -2
- package/dist/runtime/shared/urlEncoding.js +9 -9
- package/dist/shared/{nuxt-og-image.BCK8Adm4.cjs → nuxt-og-image.BRBtdkUp.cjs} +570 -81
- package/dist/shared/{nuxt-og-image.Pfj5JkJd.mjs → nuxt-og-image.Bv8VSGTj.mjs} +499 -10
- package/dist/shared/nuxt-og-image.CJa2KCie.mjs +189 -0
- package/dist/shared/nuxt-og-image.CMYbz66P.cjs +193 -0
- package/package.json +41 -39
- package/types/virtual.d.ts +9 -0
- package/dist/shared/nuxt-og-image.DQkJQHaN.cjs +0 -689
- package/dist/shared/nuxt-og-image.LgUGeaz-.mjs +0 -660
package/dist/chunks/tw4.cjs
CHANGED
|
@@ -4,23 +4,20 @@ const promises = require('node:fs/promises');
|
|
|
4
4
|
const node_url = require('node:url');
|
|
5
5
|
const exsolve = require('exsolve');
|
|
6
6
|
const pathe = require('pathe');
|
|
7
|
-
const module$1 = require('../shared/nuxt-og-image.
|
|
7
|
+
const module$1 = require('../shared/nuxt-og-image.BRBtdkUp.cjs');
|
|
8
8
|
require('node:crypto');
|
|
9
9
|
require('node:fs');
|
|
10
10
|
require('@nuxt/kit');
|
|
11
11
|
require('defu');
|
|
12
|
+
require('fnv1a-64');
|
|
12
13
|
require('nuxt-site-config/kit');
|
|
13
|
-
require('ohash');
|
|
14
14
|
require('pkg-types');
|
|
15
15
|
require('std-env');
|
|
16
16
|
require('oxc-walker');
|
|
17
|
-
require('../shared/nuxt-og-image.DQkJQHaN.cjs');
|
|
18
|
-
require('magicast');
|
|
19
|
-
require('magicast/helpers');
|
|
20
|
-
require('../../dist/runtime/logger.js');
|
|
21
|
-
require('nypm');
|
|
22
17
|
require('nuxtseo-shared/kit');
|
|
18
|
+
require('../../dist/runtime/logger.js');
|
|
23
19
|
require('chrome-launcher');
|
|
20
|
+
require('nypm');
|
|
24
21
|
require('nuxtseo-shared/devtools');
|
|
25
22
|
require('unstorage');
|
|
26
23
|
require('unstorage/drivers/fs-lite');
|
|
@@ -33,6 +30,9 @@ require('@vue/compiler-sfc');
|
|
|
33
30
|
require('ofetch');
|
|
34
31
|
require('ultrahtml');
|
|
35
32
|
require('../../dist/runtime/server/og-image/core/transforms/emojis/emoji-utils.js');
|
|
33
|
+
require('../shared/nuxt-og-image.CMYbz66P.cjs');
|
|
34
|
+
require('magicast');
|
|
35
|
+
require('magicast/helpers');
|
|
36
36
|
|
|
37
37
|
const RE_GRADIENT_STOP_PREFIX = /^(from|via|to)-/;
|
|
38
38
|
const RE_COLOR_SHADE = /^(.+)-(\d+)$/;
|
package/dist/chunks/tw4.mjs
CHANGED
|
@@ -2,23 +2,20 @@ import { readFile } from 'node:fs/promises';
|
|
|
2
2
|
import { pathToFileURL } from 'node:url';
|
|
3
3
|
import { resolveModulePath } from 'exsolve';
|
|
4
4
|
import { dirname, join } from 'pathe';
|
|
5
|
-
import { e as extractVariantBaseClasses, r as resolveVariantPrefixes, h as resolveExtractedVars, i as resolveVarsDeep, s as simplifyCss, p as postProcessStyles, l as loadLightningCss, a as extractCssVars, c as extractUniversalVars, d as extractPerClassVars, g as extractVarsFromCss, f as extractClassStyles } from '../shared/nuxt-og-image.
|
|
5
|
+
import { e as extractVariantBaseClasses, r as resolveVariantPrefixes, h as resolveExtractedVars, i as resolveVarsDeep, s as simplifyCss, p as postProcessStyles, l as loadLightningCss, a as extractCssVars, c as extractUniversalVars, d as extractPerClassVars, g as extractVarsFromCss, f as extractClassStyles } from '../shared/nuxt-og-image.Bv8VSGTj.mjs';
|
|
6
6
|
import 'node:crypto';
|
|
7
7
|
import 'node:fs';
|
|
8
8
|
import '@nuxt/kit';
|
|
9
9
|
import 'defu';
|
|
10
|
+
import 'fnv1a-64';
|
|
10
11
|
import 'nuxt-site-config/kit';
|
|
11
|
-
import 'ohash';
|
|
12
12
|
import 'pkg-types';
|
|
13
13
|
import 'std-env';
|
|
14
14
|
import 'oxc-walker';
|
|
15
|
-
import '../shared/nuxt-og-image.LgUGeaz-.mjs';
|
|
16
|
-
import 'magicast';
|
|
17
|
-
import 'magicast/helpers';
|
|
18
|
-
import '../../dist/runtime/logger.js';
|
|
19
|
-
import 'nypm';
|
|
20
15
|
import 'nuxtseo-shared/kit';
|
|
16
|
+
import '../../dist/runtime/logger.js';
|
|
21
17
|
import 'chrome-launcher';
|
|
18
|
+
import 'nypm';
|
|
22
19
|
import 'nuxtseo-shared/devtools';
|
|
23
20
|
import 'unstorage';
|
|
24
21
|
import 'unstorage/drivers/fs-lite';
|
|
@@ -31,6 +28,9 @@ import '@vue/compiler-sfc';
|
|
|
31
28
|
import 'ofetch';
|
|
32
29
|
import 'ultrahtml';
|
|
33
30
|
import '../../dist/runtime/server/og-image/core/transforms/emojis/emoji-utils.js';
|
|
31
|
+
import '../shared/nuxt-og-image.CJa2KCie.mjs';
|
|
32
|
+
import 'magicast';
|
|
33
|
+
import 'magicast/helpers';
|
|
34
34
|
|
|
35
35
|
const RE_GRADIENT_STOP_PREFIX = /^(from|via|to)-/;
|
|
36
36
|
const RE_COLOR_SHADE = /^(.+)-(\d+)$/;
|
package/dist/chunks/uno.cjs
CHANGED
|
@@ -3,23 +3,20 @@
|
|
|
3
3
|
const promises = require('node:fs/promises');
|
|
4
4
|
const defu = require('defu');
|
|
5
5
|
const logger_js = require('../../dist/runtime/logger.js');
|
|
6
|
-
const module$1 = require('../shared/nuxt-og-image.
|
|
6
|
+
const module$1 = require('../shared/nuxt-og-image.BRBtdkUp.cjs');
|
|
7
7
|
require('node:crypto');
|
|
8
8
|
require('node:fs');
|
|
9
9
|
require('node:url');
|
|
10
10
|
require('@nuxt/kit');
|
|
11
|
+
require('fnv1a-64');
|
|
11
12
|
require('nuxt-site-config/kit');
|
|
12
|
-
require('ohash');
|
|
13
13
|
require('pathe');
|
|
14
14
|
require('pkg-types');
|
|
15
15
|
require('std-env');
|
|
16
16
|
require('oxc-walker');
|
|
17
|
-
require('../shared/nuxt-og-image.DQkJQHaN.cjs');
|
|
18
|
-
require('magicast');
|
|
19
|
-
require('magicast/helpers');
|
|
20
|
-
require('nypm');
|
|
21
17
|
require('nuxtseo-shared/kit');
|
|
22
18
|
require('chrome-launcher');
|
|
19
|
+
require('nypm');
|
|
23
20
|
require('nuxtseo-shared/devtools');
|
|
24
21
|
require('unstorage');
|
|
25
22
|
require('unstorage/drivers/fs-lite');
|
|
@@ -33,6 +30,9 @@ require('ofetch');
|
|
|
33
30
|
require('ultrahtml');
|
|
34
31
|
require('../../dist/runtime/server/og-image/core/transforms/emojis/emoji-utils.js');
|
|
35
32
|
require('exsolve');
|
|
33
|
+
require('../shared/nuxt-og-image.CMYbz66P.cjs');
|
|
34
|
+
require('magicast');
|
|
35
|
+
require('magicast/helpers');
|
|
36
36
|
|
|
37
37
|
const RE_SVG_DATA_URL = /url\("data:image\/svg\+xml[;,]([^"]+)"\)/;
|
|
38
38
|
const RE_UTF8_PREFIX = /^utf8,/;
|
package/dist/chunks/uno.mjs
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import { defu } from 'defu';
|
|
3
3
|
import { logger } from '../../dist/runtime/logger.js';
|
|
4
|
-
import { e as extractVariantBaseClasses, s as simplifyCss, a as extractCssVars, b as extractPropertyInitialValues, c as extractUniversalVars, d as extractPerClassVars, f as extractClassStyles, p as postProcessStyles, r as resolveVariantPrefixes, g as extractVarsFromCss, h as resolveExtractedVars } from '../shared/nuxt-og-image.
|
|
4
|
+
import { e as extractVariantBaseClasses, s as simplifyCss, a as extractCssVars, b as extractPropertyInitialValues, c as extractUniversalVars, d as extractPerClassVars, f as extractClassStyles, p as postProcessStyles, r as resolveVariantPrefixes, g as extractVarsFromCss, h as resolveExtractedVars } from '../shared/nuxt-og-image.Bv8VSGTj.mjs';
|
|
5
5
|
import 'node:crypto';
|
|
6
6
|
import 'node:fs';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import '@nuxt/kit';
|
|
9
|
+
import 'fnv1a-64';
|
|
9
10
|
import 'nuxt-site-config/kit';
|
|
10
|
-
import 'ohash';
|
|
11
11
|
import 'pathe';
|
|
12
12
|
import 'pkg-types';
|
|
13
13
|
import 'std-env';
|
|
14
14
|
import 'oxc-walker';
|
|
15
|
-
import '../shared/nuxt-og-image.LgUGeaz-.mjs';
|
|
16
|
-
import 'magicast';
|
|
17
|
-
import 'magicast/helpers';
|
|
18
|
-
import 'nypm';
|
|
19
15
|
import 'nuxtseo-shared/kit';
|
|
20
16
|
import 'chrome-launcher';
|
|
17
|
+
import 'nypm';
|
|
21
18
|
import 'nuxtseo-shared/devtools';
|
|
22
19
|
import 'unstorage';
|
|
23
20
|
import 'unstorage/drivers/fs-lite';
|
|
@@ -31,6 +28,9 @@ import 'ofetch';
|
|
|
31
28
|
import 'ultrahtml';
|
|
32
29
|
import '../../dist/runtime/server/og-image/core/transforms/emojis/emoji-utils.js';
|
|
33
30
|
import 'exsolve';
|
|
31
|
+
import '../shared/nuxt-og-image.CJa2KCie.mjs';
|
|
32
|
+
import 'magicast';
|
|
33
|
+
import 'magicast/helpers';
|
|
34
34
|
|
|
35
35
|
const RE_SVG_DATA_URL = /url\("data:image\/svg\+xml[;,]([^"]+)"\)/;
|
|
36
36
|
const RE_UTF8_PREFIX = /^utf8,/;
|
package/dist/cli.cjs
CHANGED
|
@@ -10,14 +10,10 @@ const nypm = require('nypm');
|
|
|
10
10
|
const oxcWalker = require('oxc-walker');
|
|
11
11
|
const pathe = require('pathe');
|
|
12
12
|
const ultrahtml = require('ultrahtml');
|
|
13
|
-
const
|
|
13
|
+
const fonts = require('./shared/nuxt-og-image.CMYbz66P.cjs');
|
|
14
14
|
require('magicast');
|
|
15
15
|
require('magicast/helpers');
|
|
16
16
|
require('../dist/runtime/logger.js');
|
|
17
|
-
require('std-env');
|
|
18
|
-
require('defu');
|
|
19
|
-
require('nuxtseo-shared/kit');
|
|
20
|
-
require('chrome-launcher');
|
|
21
17
|
|
|
22
18
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
23
19
|
function _interopNamespaceCompat(e) {
|
|
@@ -193,14 +189,11 @@ const RENDERERS = [
|
|
|
193
189
|
}
|
|
194
190
|
];
|
|
195
191
|
const EDGE_PRESETS = ["cloudflare", "cloudflare-pages", "cloudflare-module", "vercel-edge", "netlify-edge"];
|
|
196
|
-
function getRendererDeps(renderer, isEdge
|
|
192
|
+
function getRendererDeps(renderer, isEdge) {
|
|
197
193
|
switch (renderer) {
|
|
198
194
|
case "satori":
|
|
199
195
|
return isEdge ? ["satori", "@resvg/resvg-js", "@resvg/resvg-wasm"] : ["satori", "@resvg/resvg-js"];
|
|
200
196
|
case "takumi":
|
|
201
|
-
if (options.installSpec) {
|
|
202
|
-
return isEdge ? [dependencies.TAKUMI_CORE_INSTALL_SPEC, dependencies.TAKUMI_WASM_INSTALL_SPEC] : [dependencies.TAKUMI_CORE_INSTALL_SPEC];
|
|
203
|
-
}
|
|
204
197
|
return isEdge ? ["@takumi-rs/core", "@takumi-rs/wasm"] : ["@takumi-rs/core"];
|
|
205
198
|
case "browser":
|
|
206
199
|
return isEdge ? [] : ["playwright-core"];
|
|
@@ -561,7 +554,7 @@ async function installRendererDeps(renderers, isEdge) {
|
|
|
561
554
|
const pmName = pm?.name || "npm";
|
|
562
555
|
const allDeps = [];
|
|
563
556
|
for (const renderer of renderers) {
|
|
564
|
-
allDeps.push(...getRendererDeps(renderer, isEdge
|
|
557
|
+
allDeps.push(...getRendererDeps(renderer, isEdge));
|
|
565
558
|
}
|
|
566
559
|
const uniqueDeps = [...new Set(allDeps)];
|
|
567
560
|
if (uniqueDeps.length === 0)
|
|
@@ -713,7 +706,7 @@ async function runMigrate(args2) {
|
|
|
713
706
|
if (dryRun) {
|
|
714
707
|
p__namespace.log.info(`Would remove defaults.component: '${migrationCheck.defaultComponentName}'`);
|
|
715
708
|
} else {
|
|
716
|
-
const result = await
|
|
709
|
+
const result = await fonts.migrateDefaultsComponent(cwd).catch((err) => {
|
|
717
710
|
p__namespace.log.warn(`Failed to migrate defaults.component: ${err.message}`);
|
|
718
711
|
return { migrated: false, componentName: null, message: err.message };
|
|
719
712
|
});
|
|
@@ -727,7 +720,7 @@ async function runMigrate(args2) {
|
|
|
727
720
|
if (dryRun) {
|
|
728
721
|
p__namespace.log.info("Would migrate ogImage.fonts to @nuxt/fonts config");
|
|
729
722
|
} else {
|
|
730
|
-
const result = await
|
|
723
|
+
const result = await fonts.migrateFontsConfig(cwd).catch((err) => {
|
|
731
724
|
p__namespace.log.warn(`Failed to migrate fonts config: ${err.message}`);
|
|
732
725
|
return { migrated: false, message: err.message };
|
|
733
726
|
});
|
package/dist/cli.mjs
CHANGED
|
@@ -8,14 +8,10 @@ import { detectPackageManager, removeDependency, addDependency } from 'nypm';
|
|
|
8
8
|
import { parseAndWalk } from 'oxc-walker';
|
|
9
9
|
import { dirname, resolve, join, relative, basename } from 'pathe';
|
|
10
10
|
import { parse, walkSync, ELEMENT_NODE } from 'ultrahtml';
|
|
11
|
-
import { m as migrateDefaultsComponent, a as migrateFontsConfig
|
|
11
|
+
import { m as migrateDefaultsComponent, a as migrateFontsConfig } from './shared/nuxt-og-image.CJa2KCie.mjs';
|
|
12
12
|
import 'magicast';
|
|
13
13
|
import 'magicast/helpers';
|
|
14
14
|
import '../dist/runtime/logger.js';
|
|
15
|
-
import 'std-env';
|
|
16
|
-
import 'defu';
|
|
17
|
-
import 'nuxtseo-shared/kit';
|
|
18
|
-
import 'chrome-launcher';
|
|
19
15
|
|
|
20
16
|
const __dirname$1 = dirname(fileURLToPath(import.meta.url));
|
|
21
17
|
const communityDir = resolve(__dirname$1, "runtime/app/components/Templates/Community");
|
|
@@ -176,14 +172,11 @@ const RENDERERS = [
|
|
|
176
172
|
}
|
|
177
173
|
];
|
|
178
174
|
const EDGE_PRESETS = ["cloudflare", "cloudflare-pages", "cloudflare-module", "vercel-edge", "netlify-edge"];
|
|
179
|
-
function getRendererDeps(renderer, isEdge
|
|
175
|
+
function getRendererDeps(renderer, isEdge) {
|
|
180
176
|
switch (renderer) {
|
|
181
177
|
case "satori":
|
|
182
178
|
return isEdge ? ["satori", "@resvg/resvg-js", "@resvg/resvg-wasm"] : ["satori", "@resvg/resvg-js"];
|
|
183
179
|
case "takumi":
|
|
184
|
-
if (options.installSpec) {
|
|
185
|
-
return isEdge ? [TAKUMI_CORE_INSTALL_SPEC, TAKUMI_WASM_INSTALL_SPEC] : [TAKUMI_CORE_INSTALL_SPEC];
|
|
186
|
-
}
|
|
187
180
|
return isEdge ? ["@takumi-rs/core", "@takumi-rs/wasm"] : ["@takumi-rs/core"];
|
|
188
181
|
case "browser":
|
|
189
182
|
return isEdge ? [] : ["playwright-core"];
|
|
@@ -544,7 +537,7 @@ async function installRendererDeps(renderers, isEdge) {
|
|
|
544
537
|
const pmName = pm?.name || "npm";
|
|
545
538
|
const allDeps = [];
|
|
546
539
|
for (const renderer of renderers) {
|
|
547
|
-
allDeps.push(...getRendererDeps(renderer, isEdge
|
|
540
|
+
allDeps.push(...getRendererDeps(renderer, isEdge));
|
|
548
541
|
}
|
|
549
542
|
const uniqueDeps = [...new Set(allDeps)];
|
|
550
543
|
if (uniqueDeps.length === 0)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { digest } from 'ohash/crypto'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* URL encoding for OG image options (Cloudinary/IPX style)
|
|
@@ -421,11 +421,12 @@ export function buildOgImageUrl(
|
|
|
421
421
|
}
|
|
422
422
|
|
|
423
423
|
/**
|
|
424
|
-
* Sign encoded params using a keyed
|
|
425
|
-
* Returns first 16 chars of the base64url
|
|
424
|
+
* Sign encoded params using a keyed SHA-256 digest (cross-runtime, sync).
|
|
425
|
+
* Returns first 16 chars of the base64url digest for URL brevity.
|
|
426
|
+
* Must stay cryptographic — a fast hash here would make signatures forgeable.
|
|
426
427
|
*/
|
|
427
428
|
export function signEncodedParams(encoded: string, secret: string): string {
|
|
428
|
-
return
|
|
429
|
+
return digest(`${secret}:${encoded}`).slice(0, 16)
|
|
429
430
|
}
|
|
430
431
|
|
|
431
432
|
/**
|
package/dist/module.cjs
CHANGED
|
@@ -6,16 +6,17 @@ require('node:fs/promises');
|
|
|
6
6
|
require('node:url');
|
|
7
7
|
require('@nuxt/kit');
|
|
8
8
|
require('defu');
|
|
9
|
+
require('fnv1a-64');
|
|
9
10
|
require('nuxt-site-config/kit');
|
|
10
|
-
require('ohash');
|
|
11
11
|
require('pathe');
|
|
12
12
|
require('pkg-types');
|
|
13
13
|
require('std-env');
|
|
14
|
-
const module$1 = require('./shared/nuxt-og-image.
|
|
15
|
-
require('./shared/nuxt-og-image.DQkJQHaN.cjs');
|
|
14
|
+
const module$1 = require('./shared/nuxt-og-image.BRBtdkUp.cjs');
|
|
16
15
|
require('nuxtseo-shared/kit');
|
|
17
16
|
require('../dist/runtime/logger.js');
|
|
18
17
|
require('oxc-walker');
|
|
18
|
+
require('chrome-launcher');
|
|
19
|
+
require('nypm');
|
|
19
20
|
require('nuxtseo-shared/devtools');
|
|
20
21
|
require('unstorage');
|
|
21
22
|
require('unstorage/drivers/fs-lite');
|
|
@@ -29,10 +30,9 @@ require('ofetch');
|
|
|
29
30
|
require('ultrahtml');
|
|
30
31
|
require('../dist/runtime/server/og-image/core/transforms/emojis/emoji-utils.js');
|
|
31
32
|
require('exsolve');
|
|
33
|
+
require('./shared/nuxt-og-image.CMYbz66P.cjs');
|
|
32
34
|
require('magicast');
|
|
33
35
|
require('magicast/helpers');
|
|
34
|
-
require('nypm');
|
|
35
|
-
require('chrome-launcher');
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -4,16 +4,17 @@ import 'node:fs/promises';
|
|
|
4
4
|
import 'node:url';
|
|
5
5
|
import '@nuxt/kit';
|
|
6
6
|
import 'defu';
|
|
7
|
+
import 'fnv1a-64';
|
|
7
8
|
import 'nuxt-site-config/kit';
|
|
8
|
-
import 'ohash';
|
|
9
9
|
import 'pathe';
|
|
10
10
|
import 'pkg-types';
|
|
11
11
|
import 'std-env';
|
|
12
|
-
export { m as default } from './shared/nuxt-og-image.
|
|
13
|
-
import './shared/nuxt-og-image.LgUGeaz-.mjs';
|
|
12
|
+
export { m as default } from './shared/nuxt-og-image.Bv8VSGTj.mjs';
|
|
14
13
|
import 'nuxtseo-shared/kit';
|
|
15
14
|
import '../dist/runtime/logger.js';
|
|
16
15
|
import 'oxc-walker';
|
|
16
|
+
import 'chrome-launcher';
|
|
17
|
+
import 'nypm';
|
|
17
18
|
import 'nuxtseo-shared/devtools';
|
|
18
19
|
import 'unstorage';
|
|
19
20
|
import 'unstorage/drivers/fs-lite';
|
|
@@ -27,7 +28,6 @@ import 'ofetch';
|
|
|
27
28
|
import 'ultrahtml';
|
|
28
29
|
import '../dist/runtime/server/og-image/core/transforms/emojis/emoji-utils.js';
|
|
29
30
|
import 'exsolve';
|
|
31
|
+
import './shared/nuxt-og-image.CJa2KCie.mjs';
|
|
30
32
|
import 'magicast';
|
|
31
33
|
import 'magicast/helpers';
|
|
32
|
-
import 'nypm';
|
|
33
|
-
import 'chrome-launcher';
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { defineNuxtPlugin } from "#app";
|
|
2
|
-
import { ogImageCanonicalUrls
|
|
3
|
-
export default defineNuxtPlugin({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
setup(nuxtApp);
|
|
7
|
-
}
|
|
2
|
+
import { ogImageCanonicalUrls } from "../../utils/plugins.js";
|
|
3
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
4
|
+
if (import.meta.dev || import.meta.prerender) {
|
|
5
|
+
return ogImageCanonicalUrls(nuxtApp);
|
|
8
6
|
}
|
|
9
7
|
});
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { defineNuxtPlugin } from "#app";
|
|
2
|
-
import { routeRuleOgImage
|
|
3
|
-
export default defineNuxtPlugin({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
setup(nuxtApp);
|
|
7
|
-
}
|
|
2
|
+
import { routeRuleOgImage } from "../../utils/plugins.js";
|
|
3
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
4
|
+
if (import.meta.dev || import.meta.prerender) {
|
|
5
|
+
return routeRuleOgImage(nuxtApp);
|
|
8
6
|
}
|
|
9
7
|
});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default _default;
|
|
1
|
+
export { ogImageCanonicalUrls as default } from '../utils/plugins.js';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default _default;
|
|
1
|
+
export { routeRuleOgImage as default } from '../utils/plugins.js';
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare
|
|
3
|
-
export declare function routeRuleOgImage(nuxtApp: NuxtSSRContext['nuxt']): void;
|
|
1
|
+
export declare const ogImageCanonicalUrls: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
|
|
2
|
+
export declare const routeRuleOgImage: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
|
|
@@ -3,12 +3,12 @@ import { defu } from "defu";
|
|
|
3
3
|
import { createRouter as createRadixRouter, toRouteMatcher } from "radix3";
|
|
4
4
|
import { parseURL, withoutBase } from "ufo";
|
|
5
5
|
import { toValue } from "vue";
|
|
6
|
-
import { useRequestEvent } from "#app";
|
|
6
|
+
import { defineNuxtPlugin, useRequestEvent } from "#app";
|
|
7
7
|
import { withSiteUrl } from "#site-config/app/composables";
|
|
8
8
|
import { createOgImageMeta, getOgImagePath } from "../../app/utils.js";
|
|
9
9
|
import { isInternalRoute } from "../../shared.js";
|
|
10
10
|
const RE_COMMA = /,/g;
|
|
11
|
-
export
|
|
11
|
+
export const ogImageCanonicalUrls = defineNuxtPlugin((nuxtApp) => {
|
|
12
12
|
nuxtApp.hooks.hook("app:rendered", async (ctx) => {
|
|
13
13
|
const { ssrContext } = ctx;
|
|
14
14
|
const e = useRequestEvent();
|
|
@@ -52,8 +52,8 @@ export function ogImageCanonicalUrls(nuxtApp) {
|
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
});
|
|
55
|
-
}
|
|
56
|
-
export
|
|
55
|
+
});
|
|
56
|
+
export const routeRuleOgImage = defineNuxtPlugin((nuxtApp) => {
|
|
57
57
|
nuxtApp.hooks.hook("app:rendered", async (ctx) => {
|
|
58
58
|
const { ssrContext } = ctx;
|
|
59
59
|
const e = useRequestEvent();
|
|
@@ -92,4 +92,4 @@ export function routeRuleOgImage(nuxtApp) {
|
|
|
92
92
|
prerenderPaths.set(ogKey, prerenderPath);
|
|
93
93
|
}
|
|
94
94
|
});
|
|
95
|
-
}
|
|
95
|
+
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { defu } from "defu";
|
|
2
2
|
import { createError, getQuery } from "h3";
|
|
3
3
|
import { useNitroApp } from "nitropack/runtime";
|
|
4
|
-
import { hash } from "ohash";
|
|
5
4
|
import { parseURL, withoutLeadingSlash, withoutTrailingSlash, withQuery } from "ufo";
|
|
6
5
|
import { normalizeKey } from "unstorage";
|
|
7
6
|
import { prerenderOptionsCache } from "#og-image-cache";
|
|
@@ -9,6 +8,7 @@ import { getSiteConfig } from "#site-config/server/composables/getSiteConfig";
|
|
|
9
8
|
import { createSitePathResolver } from "#site-config/server/composables/utils";
|
|
10
9
|
import { logger } from "../../logger.js";
|
|
11
10
|
import { decodeOgImageParams, extractEncodedSegment, sanitizeProps, separateProps, verifyOgImageSignature } from "../../shared.js";
|
|
11
|
+
import { hashKey } from "../../shared/hash.js";
|
|
12
12
|
import { autoEjectCommunityTemplate } from "../util/auto-eject.js";
|
|
13
13
|
import { createNitroRouteRuleMatcher } from "../util/kit.js";
|
|
14
14
|
import { normaliseOptions } from "../util/options.js";
|
|
@@ -28,10 +28,10 @@ export function resolvePathCacheKey(e, path, resolvedOptions) {
|
|
|
28
28
|
import.meta.prerender ? "" : siteConfig.url
|
|
29
29
|
];
|
|
30
30
|
if (resolvedOptions)
|
|
31
|
-
hashParts.push(
|
|
31
|
+
hashParts.push(hashKey(resolvedOptions));
|
|
32
32
|
return [
|
|
33
33
|
!basePath || basePath === "/" ? "index" : basePath,
|
|
34
|
-
|
|
34
|
+
hashKey(hashParts)
|
|
35
35
|
].join(":");
|
|
36
36
|
}
|
|
37
37
|
export async function resolveContext(e) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { fnv1a64Base36 } from "fnv1a-64";
|
|
1
2
|
import { createError, getQuery, handleCacheHeaders, setHeader, setHeaders } from "h3";
|
|
2
3
|
import { useStorage } from "nitropack/runtime";
|
|
3
|
-
import { digest } from "ohash";
|
|
4
4
|
import { withTrailingSlash } from "ufo";
|
|
5
5
|
import { prefixStorage } from "unstorage";
|
|
6
6
|
import { logger } from "../../logger.js";
|
|
@@ -83,7 +83,7 @@ export async function useOgImageBufferCache(ctx, options) {
|
|
|
83
83
|
const headers = {
|
|
84
84
|
// avoid multi-tenancy cache issues
|
|
85
85
|
"Vary": "accept-encoding, host",
|
|
86
|
-
"etag": `W/"${
|
|
86
|
+
"etag": `W/"${fnv1a64Base36(value)}"`,
|
|
87
87
|
"last-modified": (/* @__PURE__ */ new Date()).toUTCString(),
|
|
88
88
|
"cache-control": `public, max-age=${maxAge}, s-maxage=${maxAge}, immutable`
|
|
89
89
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { defu } from "defu";
|
|
2
2
|
import { useRuntimeConfig } from "nitropack/runtime";
|
|
3
|
-
import { hash } from "ohash";
|
|
4
3
|
import { createRouter as createRadixRouter, toRouteMatcher } from "radix3";
|
|
5
4
|
import { withoutBase, withoutTrailingSlash } from "ufo";
|
|
5
|
+
import { getIslandHash } from "#og-image/island-hash";
|
|
6
6
|
export { withoutQuery } from "nuxtseo-shared/utils";
|
|
7
7
|
export function fetchIsland(e, component, props, timeout) {
|
|
8
|
-
const hashId =
|
|
8
|
+
const hashId = getIslandHash({ name: component, props });
|
|
9
9
|
const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
|
|
10
10
|
return e.$fetch(`/__nuxt_island/${component}_${hashId}.json`, {
|
|
11
11
|
params: {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hash an arbitrary value into a short, stable string key.
|
|
3
|
+
*
|
|
4
|
+
* Values are serialized to a canonical representation (equal structures hash
|
|
5
|
+
* equally regardless of key order), then digested with fnv1a-64. Matches the
|
|
6
|
+
* approach Nuxt uses for `useAsyncData`/`useFetch` keys.
|
|
7
|
+
*
|
|
8
|
+
* Non-cryptographic — never use for signatures or integrity checks.
|
|
9
|
+
*/
|
|
10
|
+
export declare function hashKey(value: unknown): string;
|
|
@@ -38,8 +38,9 @@ export interface BuildOgImageUrlResult {
|
|
|
38
38
|
*/
|
|
39
39
|
export declare function buildOgImageUrl(options: Record<string, any>, extension?: string, isStatic?: boolean, defaults?: Record<string, any>, secret?: string): BuildOgImageUrlResult;
|
|
40
40
|
/**
|
|
41
|
-
* Sign encoded params using a keyed
|
|
42
|
-
* Returns first 16 chars of the base64url
|
|
41
|
+
* Sign encoded params using a keyed SHA-256 digest (cross-runtime, sync).
|
|
42
|
+
* Returns first 16 chars of the base64url digest for URL brevity.
|
|
43
|
+
* Must stay cryptographic — a fast hash here would make signatures forgeable.
|
|
43
44
|
*/
|
|
44
45
|
export declare function signEncodedParams(encoded: string, secret: string): string;
|
|
45
46
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { digest } from "ohash/crypto";
|
|
2
2
|
const MAX_PATH_LENGTH = 200;
|
|
3
3
|
const RE_BASE64_PADDING = /=/g;
|
|
4
4
|
const RE_BASE64_PLUS = /\+/g;
|
|
@@ -85,13 +85,13 @@ function b64Decode(str) {
|
|
|
85
85
|
return Buffer.from(padded, "base64").toString("utf8");
|
|
86
86
|
}
|
|
87
87
|
function simpleHash(str) {
|
|
88
|
-
let
|
|
88
|
+
let hash = 0;
|
|
89
89
|
for (let i = 0; i < str.length; i++) {
|
|
90
90
|
const char = str.charCodeAt(i);
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
hash = (hash << 5) - hash + char;
|
|
92
|
+
hash = hash & hash;
|
|
93
93
|
}
|
|
94
|
-
return Math.abs(
|
|
94
|
+
return Math.abs(hash).toString(36);
|
|
95
95
|
}
|
|
96
96
|
export function hashOgImageOptions(options, componentHash, version) {
|
|
97
97
|
const { _path, _hash, ...hashableOptions } = options;
|
|
@@ -233,10 +233,10 @@ export function buildOgImageUrl(options, extension = "png", isStatic = false, de
|
|
|
233
233
|
const encoded = encodeOgImageParams(options, defaults);
|
|
234
234
|
const prefix = isStatic ? "/_og/s" : "/_og/d";
|
|
235
235
|
if (isStatic && (encoded.length > MAX_PATH_LENGTH || encoded.includes("%"))) {
|
|
236
|
-
const
|
|
236
|
+
const hash = hashOgImageOptions(options);
|
|
237
237
|
return {
|
|
238
|
-
url: `${prefix}/o_${
|
|
239
|
-
hash
|
|
238
|
+
url: `${prefix}/o_${hash}.${extension}`,
|
|
239
|
+
hash
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
242
|
const segment = encoded || "default";
|
|
@@ -246,7 +246,7 @@ export function buildOgImageUrl(options, extension = "png", isStatic = false, de
|
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
248
|
export function signEncodedParams(encoded, secret) {
|
|
249
|
-
return
|
|
249
|
+
return digest(`${secret}:${encoded}`).slice(0, 16);
|
|
250
250
|
}
|
|
251
251
|
export function verifyOgImageSignature(encoded, signature, secret) {
|
|
252
252
|
const expected = signEncodedParams(encoded, secret);
|