@stati/core 1.27.2 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/errors.d.ts +10 -0
- package/dist/config/errors.d.ts.map +1 -0
- package/dist/config/errors.js +10 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +15 -2
- package/dist/constants.d.ts +26 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +23 -0
- package/dist/core/build.d.ts.map +1 -1
- package/dist/core/build.js +96 -24
- package/dist/core/isg/builder.d.ts +14 -2
- package/dist/core/isg/builder.d.ts.map +1 -1
- package/dist/core/isg/builder.js +41 -7
- package/dist/core/isg/deps.d.ts +9 -0
- package/dist/core/isg/deps.d.ts.map +1 -1
- package/dist/core/isg/deps.js +30 -1
- package/dist/core/isg/hash.d.ts +10 -0
- package/dist/core/isg/hash.d.ts.map +1 -1
- package/dist/core/isg/hash.js +14 -0
- package/dist/core/isg/index.d.ts +2 -1
- package/dist/core/isg/index.d.ts.map +1 -1
- package/dist/core/isg/index.js +1 -1
- package/dist/core/isg/manifest.js +8 -0
- package/dist/core/markdown.d.ts +10 -1
- package/dist/core/markdown.d.ts.map +1 -1
- package/dist/core/markdown.js +13 -3
- package/dist/core/templates.d.ts +12 -1
- package/dist/core/templates.d.ts.map +1 -1
- package/dist/core/templates.js +61 -6
- package/dist/core/utils/fs.utils.d.ts +21 -1
- package/dist/core/utils/fs.utils.d.ts.map +1 -1
- package/dist/core/utils/fs.utils.js +61 -0
- package/dist/core/utils/index.d.ts +1 -1
- package/dist/core/utils/index.d.ts.map +1 -1
- package/dist/core/utils/index.js +1 -1
- package/dist/images/config.d.ts +52 -0
- package/dist/images/config.d.ts.map +1 -0
- package/dist/images/config.js +200 -0
- package/dist/images/index.d.ts +15 -0
- package/dist/images/index.d.ts.map +1 -0
- package/dist/images/index.js +11 -0
- package/dist/images/manifest.d.ts +36 -0
- package/dist/images/manifest.d.ts.map +1 -0
- package/dist/images/manifest.js +69 -0
- package/dist/images/markdown-rule.d.ts +26 -0
- package/dist/images/markdown-rule.d.ts.map +1 -0
- package/dist/images/markdown-rule.js +60 -0
- package/dist/images/markup.d.ts +39 -0
- package/dist/images/markup.d.ts.map +1 -0
- package/dist/images/markup.js +72 -0
- package/dist/images/og.d.ts +52 -0
- package/dist/images/og.d.ts.map +1 -0
- package/dist/images/og.js +165 -0
- package/dist/images/plan.d.ts +101 -0
- package/dist/images/plan.d.ts.map +1 -0
- package/dist/images/plan.js +128 -0
- package/dist/images/provider.d.ts +35 -0
- package/dist/images/provider.d.ts.map +1 -0
- package/dist/images/provider.js +70 -0
- package/dist/images/resolve.d.ts +45 -0
- package/dist/images/resolve.d.ts.map +1 -0
- package/dist/images/resolve.js +51 -0
- package/dist/images/runtime.d.ts +258 -0
- package/dist/images/runtime.d.ts.map +1 -0
- package/dist/images/runtime.js +659 -0
- package/dist/images/sources.d.ts +47 -0
- package/dist/images/sources.d.ts.map +1 -0
- package/dist/images/sources.js +97 -0
- package/dist/images/utils/image-probe.utils.d.ts +30 -0
- package/dist/images/utils/image-probe.utils.d.ts.map +1 -0
- package/dist/images/utils/image-probe.utils.js +307 -0
- package/dist/images/utils/index.d.ts +7 -0
- package/dist/images/utils/index.d.ts.map +1 -0
- package/dist/images/utils/index.js +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/metrics/noop.d.ts.map +1 -1
- package/dist/metrics/noop.js +3 -0
- package/dist/metrics/recorder.d.ts.map +1 -1
- package/dist/metrics/recorder.js +3 -0
- package/dist/metrics/types.d.ts +8 -0
- package/dist/metrics/types.d.ts.map +1 -1
- package/dist/seo/auto-inject.d.ts +3 -0
- package/dist/seo/auto-inject.d.ts.map +1 -1
- package/dist/seo/auto-inject.js +1 -0
- package/dist/seo/generator.d.ts +24 -0
- package/dist/seo/generator.d.ts.map +1 -1
- package/dist/seo/generator.js +65 -1
- package/dist/seo/index.d.ts +1 -1
- package/dist/seo/index.d.ts.map +1 -1
- package/dist/seo/index.js +1 -1
- package/dist/types/config.d.ts +5 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/content.d.ts +21 -2
- package/dist/types/content.d.ts.map +1 -1
- package/dist/types/images.d.ts +185 -0
- package/dist/types/images.d.ts.map +1 -0
- package/dist/types/images.js +8 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/isg.d.ts +7 -0
- package/dist/types/isg.d.ts.map +1 -1
- package/dist/types/seo.d.ts +9 -0
- package/dist/types/seo.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content hashes and probe results for source images, cached by file size and
|
|
3
|
+
* modification time so unchanged photos are not read again.
|
|
4
|
+
* @module images/sources
|
|
5
|
+
*/
|
|
6
|
+
import type { ImageProbeResult } from './utils/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Cached facts about one source image.
|
|
9
|
+
*/
|
|
10
|
+
export interface SourceInfo {
|
|
11
|
+
/** File size in bytes when inspected */
|
|
12
|
+
size: number;
|
|
13
|
+
/** Modification time when inspected */
|
|
14
|
+
mtimeMs: number;
|
|
15
|
+
/** SHA-256 of the file bytes, hex */
|
|
16
|
+
hash: string;
|
|
17
|
+
/** Header probe, or null for formats Stati cannot read */
|
|
18
|
+
probe: ImageProbeResult | null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Inspects a source image synchronously, for template helpers that cannot await.
|
|
22
|
+
*
|
|
23
|
+
* @param filePath - Absolute path of the image
|
|
24
|
+
* @returns Facts about the image, or null if it does not exist
|
|
25
|
+
*/
|
|
26
|
+
export declare function inspectSourceSync(filePath: string): SourceInfo | null;
|
|
27
|
+
/**
|
|
28
|
+
* Inspects a source image.
|
|
29
|
+
*
|
|
30
|
+
* @param filePath - Absolute path of the image
|
|
31
|
+
* @returns Facts about the image, or null if it does not exist
|
|
32
|
+
*/
|
|
33
|
+
export declare function inspectSource(filePath: string): Promise<SourceInfo | null>;
|
|
34
|
+
/**
|
|
35
|
+
* Seeds the cache, for example from the images manifest of a previous build.
|
|
36
|
+
* Entries are still checked against the file's size and modification time before use.
|
|
37
|
+
*/
|
|
38
|
+
export declare function seedSourceCache(entries: Record<string, SourceInfo>): void;
|
|
39
|
+
/**
|
|
40
|
+
* Returns the cached facts for the given paths, for saving in the images manifest.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getSourceCacheEntries(paths: Iterable<string>): Record<string, SourceInfo>;
|
|
43
|
+
/**
|
|
44
|
+
* Clears the cache. Used by tests.
|
|
45
|
+
*/
|
|
46
|
+
export declare function clearSourceCache(): void;
|
|
47
|
+
//# sourceMappingURL=sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../src/images/sources.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAChC;AAsBD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAarE;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAchF;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,IAAI,CAMzE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAOzF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content hashes and probe results for source images, cached by file size and
|
|
3
|
+
* modification time so unchanged photos are not read again.
|
|
4
|
+
* @module images/sources
|
|
5
|
+
*/
|
|
6
|
+
import { createHash } from 'node:crypto';
|
|
7
|
+
import { readFileBuffer, readFileBufferSync, stat, statSyncOrNull, pathExists, } from '../core/utils/index.js';
|
|
8
|
+
import { probeImage } from './utils/index.js';
|
|
9
|
+
/** Keyed by absolute path with forward slashes. */
|
|
10
|
+
const sourceCache = new Map();
|
|
11
|
+
function cacheKey(filePath) {
|
|
12
|
+
return filePath.replace(/\\/g, '/');
|
|
13
|
+
}
|
|
14
|
+
function inspectBytes(bytes, size, mtimeMs) {
|
|
15
|
+
return {
|
|
16
|
+
size,
|
|
17
|
+
mtimeMs,
|
|
18
|
+
hash: createHash('sha256').update(bytes).digest('hex'),
|
|
19
|
+
probe: probeImage(bytes),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function isCurrent(info, size, mtimeMs) {
|
|
23
|
+
return info !== undefined && info.size === size && info.mtimeMs === mtimeMs;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Inspects a source image synchronously, for template helpers that cannot await.
|
|
27
|
+
*
|
|
28
|
+
* @param filePath - Absolute path of the image
|
|
29
|
+
* @returns Facts about the image, or null if it does not exist
|
|
30
|
+
*/
|
|
31
|
+
export function inspectSourceSync(filePath) {
|
|
32
|
+
const stats = statSyncOrNull(filePath);
|
|
33
|
+
if (!stats || !stats.isFile())
|
|
34
|
+
return null;
|
|
35
|
+
const key = cacheKey(filePath);
|
|
36
|
+
const cached = sourceCache.get(key);
|
|
37
|
+
if (isCurrent(cached, stats.size, stats.mtimeMs))
|
|
38
|
+
return cached;
|
|
39
|
+
const bytes = readFileBufferSync(filePath);
|
|
40
|
+
if (!bytes)
|
|
41
|
+
return null;
|
|
42
|
+
const info = inspectBytes(bytes, stats.size, stats.mtimeMs);
|
|
43
|
+
sourceCache.set(key, info);
|
|
44
|
+
return info;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Inspects a source image.
|
|
48
|
+
*
|
|
49
|
+
* @param filePath - Absolute path of the image
|
|
50
|
+
* @returns Facts about the image, or null if it does not exist
|
|
51
|
+
*/
|
|
52
|
+
export async function inspectSource(filePath) {
|
|
53
|
+
if (!(await pathExists(filePath)))
|
|
54
|
+
return null;
|
|
55
|
+
const stats = await stat(filePath);
|
|
56
|
+
if (!stats.isFile())
|
|
57
|
+
return null;
|
|
58
|
+
const key = cacheKey(filePath);
|
|
59
|
+
const cached = sourceCache.get(key);
|
|
60
|
+
if (isCurrent(cached, stats.size, stats.mtimeMs))
|
|
61
|
+
return cached;
|
|
62
|
+
const bytes = await readFileBuffer(filePath);
|
|
63
|
+
if (!bytes)
|
|
64
|
+
return null;
|
|
65
|
+
const info = inspectBytes(bytes, stats.size, stats.mtimeMs);
|
|
66
|
+
sourceCache.set(key, info);
|
|
67
|
+
return info;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Seeds the cache, for example from the images manifest of a previous build.
|
|
71
|
+
* Entries are still checked against the file's size and modification time before use.
|
|
72
|
+
*/
|
|
73
|
+
export function seedSourceCache(entries) {
|
|
74
|
+
for (const [path, info] of Object.entries(entries)) {
|
|
75
|
+
if (!sourceCache.has(cacheKey(path))) {
|
|
76
|
+
sourceCache.set(cacheKey(path), info);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Returns the cached facts for the given paths, for saving in the images manifest.
|
|
82
|
+
*/
|
|
83
|
+
export function getSourceCacheEntries(paths) {
|
|
84
|
+
const entries = {};
|
|
85
|
+
for (const path of paths) {
|
|
86
|
+
const info = sourceCache.get(cacheKey(path));
|
|
87
|
+
if (info)
|
|
88
|
+
entries[cacheKey(path)] = info;
|
|
89
|
+
}
|
|
90
|
+
return entries;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Clears the cache. Used by tests.
|
|
94
|
+
*/
|
|
95
|
+
export function clearSourceCache() {
|
|
96
|
+
sourceCache.clear();
|
|
97
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads intrinsic dimensions from image file headers without decoding pixels.
|
|
3
|
+
* Covers PNG (and APNG), JPEG (with EXIF orientation), GIF, WebP and AVIF.
|
|
4
|
+
* @module images/utils/image-probe
|
|
5
|
+
*/
|
|
6
|
+
import type { ImageSourceFormat } from '../../types/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* What a header probe found out about an image.
|
|
9
|
+
*/
|
|
10
|
+
export interface ImageProbeResult {
|
|
11
|
+
/** Detected format */
|
|
12
|
+
format: ImageSourceFormat;
|
|
13
|
+
/** Display width in pixels, with EXIF or `irot` rotation applied */
|
|
14
|
+
width: number;
|
|
15
|
+
/** Display height in pixels, with EXIF or `irot` rotation applied */
|
|
16
|
+
height: number;
|
|
17
|
+
/** JPEG EXIF orientation (1-8), when present */
|
|
18
|
+
orientation?: number;
|
|
19
|
+
/** Whether the file holds more than one frame (animated GIF, APNG, WebP or AVIF) */
|
|
20
|
+
animated: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Probes an image buffer for its format, dimensions and animation.
|
|
24
|
+
*
|
|
25
|
+
* @param buffer - The full file contents
|
|
26
|
+
* @returns The probe result, or `null` when the format is unsupported or the header is
|
|
27
|
+
* truncated or corrupt
|
|
28
|
+
*/
|
|
29
|
+
export declare function probeImage(buffer: Buffer): ImageProbeResult | null;
|
|
30
|
+
//# sourceMappingURL=image-probe.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-probe.utils.d.ts","sourceRoot":"","sources":["../../../src/images/utils/image-probe.utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sBAAsB;IACtB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oFAAoF;IACpF,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAYlE"}
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads intrinsic dimensions from image file headers without decoding pixels.
|
|
3
|
+
* Covers PNG (and APNG), JPEG (with EXIF orientation), GIF, WebP and AVIF.
|
|
4
|
+
* @module images/utils/image-probe
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Probes an image buffer for its format, dimensions and animation.
|
|
8
|
+
*
|
|
9
|
+
* @param buffer - The full file contents
|
|
10
|
+
* @returns The probe result, or `null` when the format is unsupported or the header is
|
|
11
|
+
* truncated or corrupt
|
|
12
|
+
*/
|
|
13
|
+
export function probeImage(buffer) {
|
|
14
|
+
try {
|
|
15
|
+
if (isPng(buffer))
|
|
16
|
+
return probePng(buffer);
|
|
17
|
+
if (isJpeg(buffer))
|
|
18
|
+
return probeJpeg(buffer);
|
|
19
|
+
if (isGif(buffer))
|
|
20
|
+
return probeGif(buffer);
|
|
21
|
+
if (isWebp(buffer))
|
|
22
|
+
return probeWebp(buffer);
|
|
23
|
+
if (isIsoBmff(buffer))
|
|
24
|
+
return probeAvif(buffer);
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
// Reading past the end of a truncated file throws a RangeError
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function hasPositiveSize(width, height) {
|
|
33
|
+
return Number.isFinite(width) && Number.isFinite(height) && width > 0 && height > 0;
|
|
34
|
+
}
|
|
35
|
+
function ascii(buffer, start, length) {
|
|
36
|
+
return buffer.toString('latin1', start, start + length);
|
|
37
|
+
}
|
|
38
|
+
// --- PNG -------------------------------------------------------------------
|
|
39
|
+
const PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];
|
|
40
|
+
function isPng(buffer) {
|
|
41
|
+
return buffer.length >= 24 && PNG_SIGNATURE.every((byte, i) => buffer[i] === byte);
|
|
42
|
+
}
|
|
43
|
+
function probePng(buffer) {
|
|
44
|
+
if (ascii(buffer, 12, 4) !== 'IHDR')
|
|
45
|
+
return null;
|
|
46
|
+
const width = buffer.readUInt32BE(16);
|
|
47
|
+
const height = buffer.readUInt32BE(20);
|
|
48
|
+
if (!hasPositiveSize(width, height))
|
|
49
|
+
return null;
|
|
50
|
+
// An APNG declares its frames in an acTL chunk before the first IDAT
|
|
51
|
+
let animated = false;
|
|
52
|
+
let offset = 8;
|
|
53
|
+
while (offset + 8 <= buffer.length) {
|
|
54
|
+
const length = buffer.readUInt32BE(offset);
|
|
55
|
+
const type = ascii(buffer, offset + 4, 4);
|
|
56
|
+
if (type === 'IDAT' || type === 'IEND')
|
|
57
|
+
break;
|
|
58
|
+
if (type === 'acTL' && offset + 12 <= buffer.length) {
|
|
59
|
+
animated = buffer.readUInt32BE(offset + 8) > 1;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
offset += 12 + length;
|
|
63
|
+
}
|
|
64
|
+
return { format: 'png', width, height, animated };
|
|
65
|
+
}
|
|
66
|
+
// --- JPEG ------------------------------------------------------------------
|
|
67
|
+
function isJpeg(buffer) {
|
|
68
|
+
return buffer.length >= 4 && buffer[0] === 0xff && buffer[1] === 0xd8;
|
|
69
|
+
}
|
|
70
|
+
/** Start-of-frame markers that carry the image size (excludes DHT, JPG and DAC). */
|
|
71
|
+
const SOF_MARKERS = new Set([
|
|
72
|
+
0xc0, 0xc1, 0xc2, 0xc3, 0xc5, 0xc6, 0xc7, 0xc9, 0xca, 0xcb, 0xcd, 0xce, 0xcf,
|
|
73
|
+
]);
|
|
74
|
+
function probeJpeg(buffer) {
|
|
75
|
+
let offset = 2;
|
|
76
|
+
let orientation;
|
|
77
|
+
while (offset + 4 <= buffer.length) {
|
|
78
|
+
if (buffer[offset] !== 0xff)
|
|
79
|
+
return null;
|
|
80
|
+
const marker = buffer[offset + 1];
|
|
81
|
+
// Fill bytes and markers without a length
|
|
82
|
+
if (marker === 0xff) {
|
|
83
|
+
offset += 1;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (marker === 0x01 || (marker >= 0xd0 && marker <= 0xd9)) {
|
|
87
|
+
offset += 2;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
// Start of scan: the size should already have been found
|
|
91
|
+
if (marker === 0xda)
|
|
92
|
+
return null;
|
|
93
|
+
const length = buffer.readUInt16BE(offset + 2);
|
|
94
|
+
if (length < 2)
|
|
95
|
+
return null;
|
|
96
|
+
if (marker === 0xe1 && orientation === undefined) {
|
|
97
|
+
orientation = readExifOrientation(buffer, offset + 4, length - 2);
|
|
98
|
+
}
|
|
99
|
+
if (SOF_MARKERS.has(marker)) {
|
|
100
|
+
let height = buffer.readUInt16BE(offset + 5);
|
|
101
|
+
let width = buffer.readUInt16BE(offset + 7);
|
|
102
|
+
if (!hasPositiveSize(width, height))
|
|
103
|
+
return null;
|
|
104
|
+
// Orientations 5-8 rotate the image by 90 degrees, swapping its display size
|
|
105
|
+
if (orientation !== undefined && orientation >= 5 && orientation <= 8) {
|
|
106
|
+
[width, height] = [height, width];
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
format: 'jpeg',
|
|
110
|
+
width,
|
|
111
|
+
height,
|
|
112
|
+
animated: false,
|
|
113
|
+
...(orientation !== undefined && { orientation }),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
offset += 2 + length;
|
|
117
|
+
}
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Reads the orientation tag (0x0112) from an APP1 EXIF segment.
|
|
122
|
+
*/
|
|
123
|
+
function readExifOrientation(buffer, start, length) {
|
|
124
|
+
const end = Math.min(start + length, buffer.length);
|
|
125
|
+
if (end - start < 14 || ascii(buffer, start, 6) !== 'Exif\0\0') {
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
const tiff = start + 6;
|
|
129
|
+
const byteOrder = ascii(buffer, tiff, 2);
|
|
130
|
+
if (byteOrder !== 'II' && byteOrder !== 'MM')
|
|
131
|
+
return undefined;
|
|
132
|
+
const little = byteOrder === 'II';
|
|
133
|
+
const read16 = (pos) => (little ? buffer.readUInt16LE(pos) : buffer.readUInt16BE(pos));
|
|
134
|
+
const read32 = (pos) => (little ? buffer.readUInt32LE(pos) : buffer.readUInt32BE(pos));
|
|
135
|
+
if (read16(tiff + 2) !== 42)
|
|
136
|
+
return undefined;
|
|
137
|
+
const ifd = tiff + read32(tiff + 4);
|
|
138
|
+
if (ifd + 2 > end)
|
|
139
|
+
return undefined;
|
|
140
|
+
const entries = read16(ifd);
|
|
141
|
+
for (let i = 0; i < entries; i++) {
|
|
142
|
+
const entry = ifd + 2 + i * 12;
|
|
143
|
+
if (entry + 12 > end)
|
|
144
|
+
return undefined;
|
|
145
|
+
if (read16(entry) === 0x0112) {
|
|
146
|
+
const value = read16(entry + 8);
|
|
147
|
+
return value >= 1 && value <= 8 ? value : undefined;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
// --- GIF -------------------------------------------------------------------
|
|
153
|
+
function isGif(buffer) {
|
|
154
|
+
const signature = ascii(buffer, 0, 6);
|
|
155
|
+
return buffer.length >= 13 && (signature === 'GIF87a' || signature === 'GIF89a');
|
|
156
|
+
}
|
|
157
|
+
function colorTableSize(flags) {
|
|
158
|
+
return flags & 0x80 ? 3 * 2 ** ((flags & 0x07) + 1) : 0;
|
|
159
|
+
}
|
|
160
|
+
/** Skips a chain of data sub-blocks and returns the offset after the terminator. */
|
|
161
|
+
function skipSubBlocks(buffer, offset) {
|
|
162
|
+
while (offset < buffer.length) {
|
|
163
|
+
const size = buffer[offset];
|
|
164
|
+
offset += 1;
|
|
165
|
+
if (size === 0)
|
|
166
|
+
return offset;
|
|
167
|
+
offset += size;
|
|
168
|
+
}
|
|
169
|
+
return offset;
|
|
170
|
+
}
|
|
171
|
+
function probeGif(buffer) {
|
|
172
|
+
const width = buffer.readUInt16LE(6);
|
|
173
|
+
const height = buffer.readUInt16LE(8);
|
|
174
|
+
if (!hasPositiveSize(width, height))
|
|
175
|
+
return null;
|
|
176
|
+
// Count image descriptors; a second one means the GIF is animated
|
|
177
|
+
let frames = 0;
|
|
178
|
+
let offset = 13 + colorTableSize(buffer[10]);
|
|
179
|
+
while (offset < buffer.length && frames < 2) {
|
|
180
|
+
const block = buffer[offset];
|
|
181
|
+
if (block === 0x21) {
|
|
182
|
+
offset = skipSubBlocks(buffer, offset + 2);
|
|
183
|
+
}
|
|
184
|
+
else if (block === 0x2c) {
|
|
185
|
+
frames += 1;
|
|
186
|
+
if (offset + 10 > buffer.length)
|
|
187
|
+
break;
|
|
188
|
+
offset += 10 + colorTableSize(buffer[offset + 9]);
|
|
189
|
+
offset = skipSubBlocks(buffer, offset + 1);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
break; // Trailer (0x3b) or unexpected data
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return { format: 'gif', width, height, animated: frames > 1 };
|
|
196
|
+
}
|
|
197
|
+
// --- WebP ------------------------------------------------------------------
|
|
198
|
+
function isWebp(buffer) {
|
|
199
|
+
// Shorter chunks than each format needs throw while reading, which probeImage turns into null
|
|
200
|
+
return buffer.length >= 16 && ascii(buffer, 0, 4) === 'RIFF' && ascii(buffer, 8, 4) === 'WEBP';
|
|
201
|
+
}
|
|
202
|
+
function probeWebp(buffer) {
|
|
203
|
+
const chunk = ascii(buffer, 12, 4);
|
|
204
|
+
let width;
|
|
205
|
+
let height;
|
|
206
|
+
let animated = false;
|
|
207
|
+
if (chunk === 'VP8 ') {
|
|
208
|
+
// Lossy: a frame tag, then the 9d 01 2a start code and 14-bit dimensions
|
|
209
|
+
if (buffer[23] !== 0x9d || buffer[24] !== 0x01 || buffer[25] !== 0x2a)
|
|
210
|
+
return null;
|
|
211
|
+
width = buffer.readUInt16LE(26) & 0x3fff;
|
|
212
|
+
height = buffer.readUInt16LE(28) & 0x3fff;
|
|
213
|
+
}
|
|
214
|
+
else if (chunk === 'VP8L') {
|
|
215
|
+
// Lossless: a 0x2f signature, then width-1 and height-1 as 14-bit fields
|
|
216
|
+
if (buffer[20] !== 0x2f)
|
|
217
|
+
return null;
|
|
218
|
+
const bits = buffer.readUInt32LE(21);
|
|
219
|
+
width = (bits & 0x3fff) + 1;
|
|
220
|
+
height = ((bits >> 14) & 0x3fff) + 1;
|
|
221
|
+
}
|
|
222
|
+
else if (chunk === 'VP8X') {
|
|
223
|
+
// Extended: feature flags, then 24-bit canvas width-1 and height-1
|
|
224
|
+
animated = (buffer[20] & 0x02) !== 0;
|
|
225
|
+
width = buffer.readUIntLE(24, 3) + 1;
|
|
226
|
+
height = buffer.readUIntLE(27, 3) + 1;
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
if (!hasPositiveSize(width, height))
|
|
232
|
+
return null;
|
|
233
|
+
return { format: 'webp', width, height, animated };
|
|
234
|
+
}
|
|
235
|
+
function isIsoBmff(buffer) {
|
|
236
|
+
return buffer.length >= 16 && ascii(buffer, 4, 4) === 'ftyp';
|
|
237
|
+
}
|
|
238
|
+
/** Lists the boxes between `start` and `end`. */
|
|
239
|
+
function readBoxes(buffer, start, end) {
|
|
240
|
+
const boxes = [];
|
|
241
|
+
let offset = start;
|
|
242
|
+
while (offset + 8 <= end) {
|
|
243
|
+
let size = buffer.readUInt32BE(offset);
|
|
244
|
+
const type = ascii(buffer, offset + 4, 4);
|
|
245
|
+
let header = 8;
|
|
246
|
+
if (size === 1) {
|
|
247
|
+
if (offset + 16 > end)
|
|
248
|
+
break;
|
|
249
|
+
size = Number(buffer.readBigUInt64BE(offset + 8));
|
|
250
|
+
header = 16;
|
|
251
|
+
}
|
|
252
|
+
else if (size === 0) {
|
|
253
|
+
size = end - offset;
|
|
254
|
+
}
|
|
255
|
+
if (size < header || offset + size > end)
|
|
256
|
+
break;
|
|
257
|
+
boxes.push({ type, start: offset + header, end: offset + size });
|
|
258
|
+
offset += size;
|
|
259
|
+
}
|
|
260
|
+
return boxes;
|
|
261
|
+
}
|
|
262
|
+
function probeAvif(buffer) {
|
|
263
|
+
const [ftyp] = readBoxes(buffer, 0, buffer.length);
|
|
264
|
+
if (!ftyp || ftyp.type !== 'ftyp')
|
|
265
|
+
return null;
|
|
266
|
+
// Major brand, then compatible brands after the minor version
|
|
267
|
+
const brands = [ascii(buffer, ftyp.start, 4)];
|
|
268
|
+
for (let pos = ftyp.start + 8; pos + 4 <= ftyp.end; pos += 4) {
|
|
269
|
+
brands.push(ascii(buffer, pos, 4));
|
|
270
|
+
}
|
|
271
|
+
if (!brands.includes('avif') && !brands.includes('avis'))
|
|
272
|
+
return null;
|
|
273
|
+
const animated = brands.includes('avis');
|
|
274
|
+
const meta = readBoxes(buffer, ftyp.end, buffer.length).find((box) => box.type === 'meta');
|
|
275
|
+
if (!meta)
|
|
276
|
+
return null;
|
|
277
|
+
// meta is a full box: skip its version and flags
|
|
278
|
+
const iprp = readBoxes(buffer, meta.start + 4, meta.end).find((box) => box.type === 'iprp');
|
|
279
|
+
if (!iprp)
|
|
280
|
+
return null;
|
|
281
|
+
const ipco = readBoxes(buffer, iprp.start, iprp.end).find((box) => box.type === 'ipco');
|
|
282
|
+
if (!ipco)
|
|
283
|
+
return null;
|
|
284
|
+
let width = 0;
|
|
285
|
+
let height = 0;
|
|
286
|
+
let rotated = false;
|
|
287
|
+
for (const property of readBoxes(buffer, ipco.start, ipco.end)) {
|
|
288
|
+
if (property.type === 'ispe' && property.start + 12 <= property.end) {
|
|
289
|
+
// Several ispe boxes can exist (thumbnails, alpha planes); the primary image is the largest
|
|
290
|
+
const w = buffer.readUInt32BE(property.start + 4);
|
|
291
|
+
const h = buffer.readUInt32BE(property.start + 8);
|
|
292
|
+
if (w * h > width * height) {
|
|
293
|
+
width = w;
|
|
294
|
+
height = h;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
else if (property.type === 'irot' && property.start < property.end) {
|
|
298
|
+
// Rotation in 90-degree steps; odd steps swap the display size
|
|
299
|
+
rotated = (buffer[property.start] & 0x03) % 2 === 1;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
if (!hasPositiveSize(width, height))
|
|
303
|
+
return null;
|
|
304
|
+
if (rotated)
|
|
305
|
+
[width, height] = [height, width];
|
|
306
|
+
return { format: 'avif', width, height, animated };
|
|
307
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/images/utils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export type { SiteConfig, StatiConfig, PageModel, FrontMatter, BuildContext, Pag
|
|
|
23
23
|
export type { SEOMetadata, SEOConfig, SEOContext, SEOValidationResult, SEOTagType, RobotsConfig, OpenGraphConfig, OpenGraphImage, OpenGraphArticle, TwitterCardConfig, AuthorConfig, } from './types/index.js';
|
|
24
24
|
export type { SitemapConfig, SitemapEntry, SitemapGenerationResult, ChangeFrequency, } from './types/index.js';
|
|
25
25
|
export type { RSSConfig, RSSFeedConfig, RSSGenerationResult } from './types/index.js';
|
|
26
|
+
export type { ImagesConfig, ResponsiveImagesConfig, OgImagesConfig, OgImageFontConfig, ImagesQualityConfig, ImageVariantFormat, ImageOutputFormat, ImageSourceFormat, ImageProvider, VariantRequest, VariantOutput, OgImageRequest, OgFont, OgDefaults, GeneratedOgImage, } from './types/index.js';
|
|
26
27
|
export type { BuildOptions, MetricsOptions, BuildResult, DevServerOptions, PreviewServerOptions, InvalidationResult, } from './core/index.js';
|
|
27
28
|
export { build, createDevServer, createPreviewServer, invalidate } from './core/index.js';
|
|
28
29
|
export type { BuildMetrics, MetricsMeta, MetricsFlags, MetricsTotals, MetricsPhases, MetricsCounts, MetricsISG, PageTiming, IncrementalMetrics, MetricRecorder, MetricRecorderOptions, PhaseName, CounterName, } from './metrics/index.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,YAAY,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,EACV,OAAO,EACP,SAAS,EACT,SAAS,EACT,UAAU,EACV,YAAY,GACb,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,WAAW,EACX,SAAS,EACT,UAAU,EACV,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,aAAa,EACb,YAAY,EACZ,uBAAuB,EACvB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE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WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAE7D"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,YAAY,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,EACV,OAAO,EACP,SAAS,EACT,SAAS,EACT,UAAU,EACV,YAAY,GACb,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,WAAW,EACX,SAAS,EACT,UAAU,EACV,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,aAAa,EACb,YAAY,EACZ,uBAAuB,EACvB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGtF,YAAY,EACV,YAAY,EACZ,sBAAsB,EACtB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,aAAa,EACb,cAAc,EACd,MAAM,EACN,UAAU,EACV,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,YAAY,EACZ,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG1F,YAAY,EACV,YAAY,EACZ,WAAW,EACX,Y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,OAAO,KAAK,EACV,cAAc,EAOf,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"noop.d.ts","sourceRoot":"","sources":["../../src/metrics/noop.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,cAAc,EAOf,MAAM,YAAY,CAAC;AAqGpB;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,cAAyC,CAAC"}
|
package/dist/metrics/noop.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../../src/metrics/recorder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EAQtB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../../src/metrics/recorder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EAQtB,MAAM,YAAY,CAAC;AAsOpB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,qBAA0B,GAAG,cAAc,CAaxF"}
|
package/dist/metrics/recorder.js
CHANGED
package/dist/metrics/types.d.ts
CHANGED
|
@@ -128,6 +128,8 @@ export interface MetricsPhases {
|
|
|
128
128
|
readonly hookBeforeRenderTotalMs?: number;
|
|
129
129
|
/** Aggregate time spent in afterRender hooks across all pages */
|
|
130
130
|
readonly hookAfterRenderTotalMs?: number;
|
|
131
|
+
/** Waiting for image jobs and saving the images manifest */
|
|
132
|
+
readonly imageSettleMs?: number;
|
|
131
133
|
}
|
|
132
134
|
/**
|
|
133
135
|
* Phase names as a union type for type safety.
|
|
@@ -143,6 +145,12 @@ export interface MetricsCounts {
|
|
|
143
145
|
readonly assetsCopied: number;
|
|
144
146
|
readonly templatesLoaded: number;
|
|
145
147
|
readonly markdownFilesProcessed: number;
|
|
148
|
+
/** Image files generated or copied this build */
|
|
149
|
+
readonly imagesGenerated?: number;
|
|
150
|
+
/** Image jobs whose files were reused from an earlier build */
|
|
151
|
+
readonly imagesCached?: number;
|
|
152
|
+
/** Image jobs that failed */
|
|
153
|
+
readonly imagesFailed?: number;
|
|
146
154
|
}
|
|
147
155
|
/**
|
|
148
156
|
* Counter names as a union type for type safety.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/metrics/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,gDAAgD;IAChD,QAAQ,CAAC,aAAa,EAAE,GAAG,CAAC;IAE5B,mBAAmB;IACnB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAE3B,+BAA+B;IAC/B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAE/B,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAE/B,aAAa;IACb,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAE/B,wBAAwB;IACxB,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IAEzB,qEAAqE;IACrE,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IAE7C,kDAAkD;IAClD,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAC3C;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,mCAAmC;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,oCAAoC;IACpC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,gCAAgC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,wCAAwC;IACxC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,sBAAsB;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,sC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AAG,IAAI,CAAC;IAEtD;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpD;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/C;;;OAGG;IACH,gBAAgB,CACd,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,OAAO,EACf,eAAe,CAAC,EAAE,MAAM,GACvB,IAAI,CAAC;IAER;;OAEG;IACH,cAAc,IAAI,IAAI,CAAC;IAEvB;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;IAElD;;OAEG;IACH,qBAAqB,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAEzD;;OAEG;IACH,QAAQ,IAAI,YAAY,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import type { PageModel } from '../types/content.js';
|
|
6
6
|
import type { StatiConfig } from '../types/config.js';
|
|
7
7
|
import type { Logger } from '../types/logging.js';
|
|
8
|
+
import type { GeneratedOgImage } from '../types/images.js';
|
|
8
9
|
/**
|
|
9
10
|
* Options for auto-injection
|
|
10
11
|
*/
|
|
@@ -19,6 +20,8 @@ export interface AutoInjectOptions {
|
|
|
19
20
|
logger: Logger;
|
|
20
21
|
/** Enable debug logging */
|
|
21
22
|
debug?: boolean;
|
|
23
|
+
/** Open Graph image generated for the page */
|
|
24
|
+
generatedImage?: GeneratedOgImage | undefined;
|
|
22
25
|
}
|
|
23
26
|
/**
|
|
24
27
|
* Automatically injects SEO metadata into HTML if not already present
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-inject.d.ts","sourceRoot":"","sources":["../../src/seo/auto-inject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"auto-inject.d.ts","sourceRoot":"","sources":["../../src/seo/auto-inject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAK3D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,+CAA+C;IAC/C,IAAI,EAAE,SAAS,CAAC;IAChB,yBAAyB;IACzB,MAAM,EAAE,WAAW,CAAC;IACpB,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8CAA8C;IAC9C,cAAc,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;CAC/C;AAmBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM,CA2D9E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAK/E"}
|
package/dist/seo/auto-inject.js
CHANGED