@prunellejs/images 0.0.0-stage → 0.7.2

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/src/plugin.ts ADDED
@@ -0,0 +1,468 @@
1
+ // @prunellejs/images — Build-time AVIF/WebP responsive image optimization with content-hashed disk cache.
2
+ // Built strictly on the public PrunellePlugin API (bunPlugins + build(ctx).emitAsset).
3
+
4
+ import type { BunPlugin } from 'bun'
5
+ import type { CheckPluginContext, PrunellePlugin } from 'prunelle/config'
6
+ import type { ShareCardDefaults } from './card'
7
+ import type { ImageAsset } from './helpers'
8
+ import type { CachedImageMeta, VariantPipelineConfig } from './pipeline'
9
+ import type { RuntimeImageStore } from './runtime'
10
+ import { existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs'
11
+ import { dirname, extname, join, relative, resolve } from 'node:path'
12
+ import { CONTENT_IMAGE_RESOLVER_SERVICE, definePlugin, isInside } from 'prunelle/config'
13
+ import { getAppContext } from 'prunelle/internal/server'
14
+ import type { KnownImages } from './cache'
15
+ import { knownImages, removeUnusedOgAndMd, runtimeStoreLimits } from './cache'
16
+ import { SHARE_CARD_CONFIG_SERVICE } from './card'
17
+ import { readImageDimensions } from './dimensions'
18
+ import { stripImageMetadata } from './metadata'
19
+ import {
20
+ ALLOWED_IMAGE_EXTS,
21
+ assembleImageAsset,
22
+ computeImageKey,
23
+ encodeVariants,
24
+ identifyImageAsync,
25
+
26
+
27
+ planVariantJobs,
28
+ readCachedMeta,
29
+ writeFileAtomic,
30
+ } from './pipeline'
31
+ import {
32
+ computeEtag,
33
+ createRuntimeImageStore,
34
+ encodeVariantToBytesAsync,
35
+ enterBuildPhase,
36
+ flushBuildPhase,
37
+ hasMagick,
38
+ isBuildPhase,
39
+ leaveBuildPhase,
40
+ mimeForImageExt,
41
+ queueBuildTask,
42
+ registerRuntimeImageMiddleware,
43
+ RUNTIME_IMAGE_STORE_SERVICE,
44
+ } from './runtime'
45
+
46
+ export { CONTENT_IMAGE_RESOLVER_SERVICE }
47
+
48
+ export interface ImagesPluginOptions {
49
+ widths?: number[] | undefined
50
+ formats?: ('avif' | 'webp')[] | undefined
51
+ quality?: number | undefined
52
+ avifQuality?: number | undefined
53
+ cacheDir?: string | undefined
54
+ /** Remove stale cache files unused by the current build (default: true). */
55
+ pruneCache?: boolean | undefined
56
+ /** Optional defaults for build-time `shareCard()` OG image generation. */
57
+ card?: ShareCardDefaults | undefined
58
+ /** Default `sizes` attribute for relative images auto-optimized inside `@prunellejs/content` Markdown. */
59
+ markdownSizes?: string | undefined
60
+ }
61
+
62
+ const DEFAULT_WIDTHS = [320, 640, 960, 1280, 1920]
63
+ const DEFAULT_FORMATS: ('avif' | 'webp')[] = ['avif', 'webp']
64
+ const PUBLIC_IMAGE = /\.(?:png|jpe?g|webp)$/i
65
+ const PERSONAL_METADATA = new Set(['exif', 'xmp', 'iptc'])
66
+
67
+ function walkPublicImages(dir: string, out: string[] = []): string[] {
68
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
69
+ const abs = join(dir, entry.name)
70
+ if (entry.isDirectory())
71
+ walkPublicImages(abs, out)
72
+ else if (entry.isFile() && PUBLIC_IMAGE.test(entry.name))
73
+ out.push(abs)
74
+ }
75
+ return out
76
+ }
77
+
78
+ // Files in publicDir are served as they are, so a photo there hands its GPS position and camera serial to every visitor.
79
+ function publicImageMetadataWarnings(root: string, publicDir: string): string[] {
80
+ if (!existsSync(publicDir))
81
+ return []
82
+ const warnings: string[] = []
83
+ for (const abs of walkPublicImages(publicDir).sort()) {
84
+ const kinds = stripImageMetadata(new Uint8Array(readFileSync(abs))).removed.filter(kind => PERSONAL_METADATA.has(kind))
85
+ if (kinds.length > 0) {
86
+ const rel = relative(root, abs).replace(/\\/g, '/')
87
+ warnings.push(`@prunellejs/images: ${rel} carries ${kinds.map(k => k.toUpperCase()).join(' and ')} metadata (GPS position, camera serial) that every visitor can download: import it from src/ so the build strips it, or strip it yourself (\`magick ${rel} +profile "!icc,*" ${rel}\`, which keeps the ICC colour profile).`)
88
+ }
89
+ }
90
+ return warnings
91
+ }
92
+
93
+ function checkImages(ctx: CheckPluginContext): void {
94
+ if (!hasMagick())
95
+ ctx.error(MISSING_MAGICK_MESSAGE)
96
+ for (const warning of publicImageMetadataWarnings(ctx.root, ctx.publicDir ?? join(ctx.root, 'public')))
97
+ ctx.warn(warning)
98
+ }
99
+
100
+ const MISSING_MAGICK_MESSAGE = '@prunellejs/images: ImageMagick ("magick") was not found on PATH; AVIF/WebP optimization is disabled. Install ImageMagick to enable responsive image optimization.'
101
+
102
+ interface PersistedImagesConfig extends KnownImages {
103
+ cacheDirRel: string
104
+ widths: number[]
105
+ formats: ('avif' | 'webp')[]
106
+ quality: number
107
+ avifQuality: number
108
+ markdownSizes?: string | undefined
109
+ card?: ShareCardDefaults | undefined
110
+ }
111
+
112
+ export function images(options: ImagesPluginOptions = {}): PrunellePlugin {
113
+ const widths = (options.widths ?? DEFAULT_WIDTHS).slice().sort((a, b) => a - b)
114
+ const formats = options.formats ?? DEFAULT_FORMATS
115
+ const quality = options.quality ?? 80
116
+ const avifQuality = options.avifQuality ?? 55
117
+ const cacheDirRel = options.cacheDir ?? '.prunelle-cache/images'
118
+ const pruneCache = options.pruneCache ?? true
119
+
120
+ const emittedAssets = new Map<string, Uint8Array>()
121
+ const activeCacheFiles = new Set<string>()
122
+ let lastCacheRoot: string | undefined
123
+ let warnedMissingMagick = false
124
+
125
+ function warnMissingMagickOnce(): void {
126
+ if (!warnedMissingMagick) {
127
+ warnedMissingMagick = true
128
+ console.warn(MISSING_MAGICK_MESSAGE)
129
+ }
130
+ }
131
+
132
+ return definePlugin({
133
+ name: '@prunellejs/images',
134
+ check: checkImages,
135
+ bunPlugins: ({ root, assetPrefix }): BunPlugin[] => {
136
+ const cacheRoot = resolve(root, cacheDirRel)
137
+ lastCacheRoot = cacheRoot
138
+ const prefix = assetPrefix.replace(/\/$/, '')
139
+ const pipelineCfg: VariantPipelineConfig = { widths, formats, quality, avifQuality, cachePrefix: '' }
140
+ const magickAvailable = hasMagick()
141
+ if (!magickAvailable)
142
+ warnMissingMagickOnce()
143
+
144
+ return [{
145
+ name: 'prunelle-images',
146
+ setup(b) {
147
+ b.onLoad({ filter: /\.(?:png|jpe?g|webp|avif)$/i }, async (args) => {
148
+ if (args.path.includes('/node_modules/'))
149
+ return undefined
150
+
151
+ const rawBytes = stripImageMetadata(new Uint8Array(readFileSync(args.path))).bytes
152
+ const { hash, stem, rawFileName } = computeImageKey(args.path, rawBytes, pipelineCfg)
153
+ const emitRaw = (width: number, height: number) => {
154
+ const rel = `img/${rawFileName}`
155
+ emittedAssets.set(rel, rawBytes)
156
+ const asset: ImageAsset = { src: `${prefix}/${rel}`, width, height }
157
+ return { contents: `export default ${JSON.stringify(asset)};\n`, loader: 'js' as const }
158
+ }
159
+
160
+ if (!magickAvailable) {
161
+ const dims = readImageDimensions(rawBytes)
162
+ if (dims === undefined)
163
+ throw new Error(`@prunellejs/images: could not determine dimensions for "${args.path}" (ImageMagick is unavailable and binary header could not be parsed)`)
164
+ return emitRaw(dims.width, dims.height)
165
+ }
166
+
167
+ mkdirSync(cacheRoot, { recursive: true })
168
+ const metaName = `${stem}-${hash}.json`
169
+ const metaPath = join(cacheRoot, metaName)
170
+ activeCacheFiles.add(metaName)
171
+ let meta = readCachedMeta(metaPath, cacheRoot, '')
172
+
173
+ if (meta === undefined) {
174
+ const dims = readImageDimensions(rawBytes) ?? await identifyImageAsync(args.path)
175
+ if (dims === undefined)
176
+ throw new Error(`@prunellejs/images: could not determine dimensions for "${args.path}"`)
177
+
178
+ const jobs = planVariantJobs(dims, stem, hash, cacheRoot, pipelineCfg)
179
+ const encoded = await encodeVariants(args.path, jobs)
180
+ const files: CachedImageMeta['files'] = encoded.map(job => ({ rel: `img/${job.fileName}`, width: job.width, format: job.format }))
181
+ if (files.length === 0)
182
+ return emitRaw(dims.width, dims.height)
183
+
184
+ meta = { width: dims.width, height: dims.height, files }
185
+ // Kept only once every variant is in: a variant left out by a failed run is tried again by the next build.
186
+ if (files.length === jobs.length)
187
+ writeFileAtomic(metaPath, JSON.stringify(meta))
188
+ }
189
+
190
+ const asset = assembleImageAsset(meta, cacheRoot, '', prefix, (rel, fileName, cachedFile) => {
191
+ activeCacheFiles.add(fileName)
192
+ if (!emittedAssets.has(rel))
193
+ emittedAssets.set(rel, new Uint8Array(readFileSync(cachedFile)))
194
+ })
195
+ return { contents: `export default ${JSON.stringify(asset)};\n`, loader: 'js' }
196
+ })
197
+ },
198
+ }]
199
+ },
200
+ build(ctx) {
201
+ enterBuildPhase(ctx.outDir)
202
+ const publicDir = join(ctx.outDir, 'public')
203
+ const cacheDir = resolve(ctx.root, cacheDirRel)
204
+ const cardWithSite: ShareCardDefaults | undefined = options.card !== undefined || ctx.site !== undefined
205
+ ? { ...(ctx.site !== undefined ? { site: ctx.site } : {}), ...options.card }
206
+ : undefined
207
+ const persisted: PersistedImagesConfig = {
208
+ cacheDirRel,
209
+ widths,
210
+ formats,
211
+ quality,
212
+ avifQuality,
213
+ markdownSizes: options.markdownSizes,
214
+ card: cardWithSite,
215
+ }
216
+ ctx.setData(persisted as unknown as Record<string, unknown>)
217
+ ctx.provide(SHARE_CARD_CONFIG_SERVICE, { ...cardWithSite, publicDir, cacheDir } satisfies ShareCardDefaults)
218
+ ctx.provide(CONTENT_IMAGE_RESOLVER_SERVICE, createMarkdownImageResolver({
219
+ root: resolve(ctx.root),
220
+ outPublicDir: publicDir,
221
+ cacheDir,
222
+ widths,
223
+ formats,
224
+ quality,
225
+ avifQuality,
226
+ sizes: options.markdownSizes,
227
+ }))
228
+ for (const [rel, bytes] of emittedAssets)
229
+ ctx.emitAsset(rel, bytes)
230
+ if (pruneCache && !ctx.dev && lastCacheRoot !== undefined && activeCacheFiles.size > 0 && existsSync(lastCacheRoot)) {
231
+ for (const entry of readdirSync(lastCacheRoot)) {
232
+ if (!entry.startsWith('og-') && !entry.startsWith('md-') && !activeCacheFiles.has(entry))
233
+ rmSync(join(lastCacheRoot, entry), { force: true })
234
+ }
235
+ }
236
+ emittedAssets.clear()
237
+ activeCacheFiles.clear()
238
+ },
239
+ async afterPrerender(ctx) {
240
+ await flushBuildPhase(ctx.outDir)
241
+ ctx.setData(knownImages(ctx.publicFiles))
242
+ // Only a build that rendered pages registered the cards and variants it uses: without one the runtime still reads those cache files.
243
+ if (pruneCache && lastCacheRoot !== undefined && ctx.routes.some(route => Object.keys(route.prerendered ?? {}).length > 0))
244
+ removeUnusedOgAndMd(lastCacheRoot, ctx.publicFiles)
245
+ },
246
+ server(api) {
247
+ const persisted = api.getBuildData<PersistedImagesConfig>()
248
+ const publicDir = join(api.outDir, 'public')
249
+ const cacheDir = resolve(api.root, persisted?.cacheDirRel ?? cacheDirRel)
250
+ const runtimeStore = createRuntimeImageStore(...runtimeStoreLimits(persisted))
251
+ api.provide(RUNTIME_IMAGE_STORE_SERVICE, runtimeStore)
252
+ registerRuntimeImageMiddleware(api, runtimeStore)
253
+ api.onShutdown(() => {
254
+ if (isBuildPhase(api.outDir))
255
+ leaveBuildPhase(api.outDir)
256
+ })
257
+ api.provide(SHARE_CARD_CONFIG_SERVICE, {
258
+ ...(api.site !== undefined ? { site: api.site } : {}),
259
+ ...(persisted?.card ?? options.card),
260
+ publicDir,
261
+ cacheDir,
262
+ } satisfies ShareCardDefaults)
263
+ api.provide(CONTENT_IMAGE_RESOLVER_SERVICE, createMarkdownImageResolver({
264
+ root: resolve(api.root),
265
+ cacheDir,
266
+ widths: persisted?.widths ?? widths,
267
+ formats: persisted?.formats ?? formats,
268
+ quality: persisted?.quality ?? quality,
269
+ avifQuality: persisted?.avifQuality ?? avifQuality,
270
+ sizes: persisted?.markdownSizes ?? options.markdownSizes,
271
+ }))
272
+ },
273
+ })
274
+ }
275
+
276
+ export interface OptimizeImageFileOptions {
277
+ outPublicDir?: string | undefined
278
+ cacheDir?: string | undefined
279
+ widths?: number[] | undefined
280
+ formats?: ('avif' | 'webp')[] | undefined
281
+ quality?: number | undefined
282
+ avifQuality?: number | undefined
283
+ }
284
+
285
+ function optimizeForRuntime(
286
+ absPath: string,
287
+ ext: string,
288
+ rawBytes: Uint8Array<ArrayBuffer>,
289
+ dims: { width: number, height: number },
290
+ stem: string,
291
+ hash: string,
292
+ rawFileName: string,
293
+ cacheRoot: string,
294
+ pipelineCfg: VariantPipelineConfig,
295
+ runtimeStore: RuntimeImageStore,
296
+ ): ImageAsset {
297
+ const rawMime = mimeForImageExt(ext)
298
+ if (!hasMagick()) {
299
+ runtimeStore.setStatic(`/img/${rawFileName}`, rawBytes, rawMime)
300
+ return { src: `/img/${rawFileName}`, width: dims.width, height: dims.height }
301
+ }
302
+ const metaPath = join(cacheRoot, `md-${stem}-${hash}.json`)
303
+ const cachedMeta = readCachedMeta(metaPath, cacheRoot, 'md-')
304
+ if (cachedMeta !== undefined) {
305
+ return assembleImageAsset(cachedMeta, cacheRoot, 'md-', '', (_rel, fileName, cachedFile) => {
306
+ const mime = mimeForImageExt(extname(fileName))
307
+ runtimeStore.setLazy(`/img/${fileName}`, async () => {
308
+ try {
309
+ const bytes = new Uint8Array(await Bun.file(cachedFile).arrayBuffer())
310
+ return { body: bytes, contentType: mime, etag: computeEtag(bytes) }
311
+ }
312
+ catch {
313
+ return { body: rawBytes, contentType: rawMime, etag: computeEtag(rawBytes), fallback: true }
314
+ }
315
+ })
316
+ })
317
+ }
318
+ const jobs = planVariantJobs(dims, stem, hash, cacheRoot, pipelineCfg)
319
+ const plannedMeta: CachedImageMeta = {
320
+ width: dims.width,
321
+ height: dims.height,
322
+ files: jobs.map(j => ({ rel: `img/${j.fileName}`, width: j.width, format: j.format })),
323
+ }
324
+ const jobByFile = new Map(jobs.map(j => [j.fileName, j]))
325
+ return assembleImageAsset(plannedMeta, cacheRoot, 'md-', '', (_rel, fileName) => {
326
+ const job = jobByFile.get(fileName)!
327
+ const targetMime = mimeForImageExt(`.${job.format}`)
328
+ runtimeStore.setLazy(`/img/${fileName}`, async () => {
329
+ const encoded = await encodeVariantToBytesAsync(absPath, job.width, job.format, job.quality)
330
+ if (encoded !== undefined)
331
+ return { body: encoded, contentType: targetMime, etag: computeEtag(encoded) }
332
+ return { body: rawBytes, contentType: rawMime, etag: computeEtag(rawBytes), fallback: true }
333
+ })
334
+ })
335
+ }
336
+
337
+ /** Optimize a local image file (e.g. from Markdown) with non-blocking encoding and runtime in-memory serving for --compile. */
338
+ export function optimizeImageFile(absPath: string, options: OptimizeImageFileOptions = {}): ImageAsset {
339
+ const ext = extname(absPath).toLowerCase()
340
+ if (!ALLOWED_IMAGE_EXTS.has(ext))
341
+ throw new Error(`@prunellejs/images: unsupported image extension "${ext || '(none)'}" for "${absPath}"`)
342
+
343
+ const pipelineCfg: VariantPipelineConfig = {
344
+ widths: (options.widths ?? [640, 1280]).slice().sort((a, b) => a - b),
345
+ formats: options.formats ?? ['webp'],
346
+ quality: options.quality ?? 80,
347
+ avifQuality: options.avifQuality ?? 55,
348
+ cachePrefix: 'md-',
349
+ }
350
+ const appCtx = getAppContext()
351
+ const rawBytes = stripImageMetadata(new Uint8Array(readFileSync(absPath))).bytes
352
+ const dims = readImageDimensions(rawBytes)
353
+ if (dims === undefined)
354
+ throw new Error(`@prunellejs/images: could not determine dimensions for "${absPath}"`)
355
+
356
+ const { hash, stem, rawFileName } = computeImageKey(absPath, rawBytes, pipelineCfg)
357
+ const cacheRoot = resolve(options.cacheDir ?? '.prunelle-cache/images')
358
+ const inBuild = appCtx !== undefined && isBuildPhase(appCtx.outDir)
359
+
360
+ // Runtime server mode (including --compile): never write to dist/public or block on Bun.spawnSync.
361
+ const runtimeStore = options.outPublicDir === undefined ? appCtx?.inject(RUNTIME_IMAGE_STORE_SERVICE) : undefined
362
+ if (runtimeStore !== undefined && !inBuild)
363
+ return optimizeForRuntime(absPath, ext, rawBytes, dims, stem, hash, rawFileName, cacheRoot, pipelineCfg, runtimeStore)
364
+
365
+ const outPublicDir = resolve(options.outPublicDir ?? appCtx?.publicDir ?? 'dist/public')
366
+ const imgOutDir = join(outPublicDir, 'img')
367
+ mkdirSync(imgOutDir, { recursive: true })
368
+ const emitRaw = (): ImageAsset => {
369
+ writeFileSync(join(imgOutDir, rawFileName), rawBytes)
370
+ appCtx?.registerPublicFile(`img/${rawFileName}`)
371
+ return { src: `/img/${rawFileName}`, width: dims.width, height: dims.height }
372
+ }
373
+
374
+ if (!hasMagick())
375
+ return emitRaw()
376
+
377
+ const metaPath = join(cacheRoot, `md-${stem}-${hash}.json`)
378
+ const cachedMeta = readCachedMeta(metaPath, cacheRoot, 'md-')
379
+ if (cachedMeta !== undefined) {
380
+ return assembleImageAsset(cachedMeta, cacheRoot, 'md-', '', (_rel, fileName, cachedFile) => {
381
+ writeFileSync(join(imgOutDir, fileName), readFileSync(cachedFile))
382
+ appCtx?.registerPublicFile(`img/${fileName}`)
383
+ })
384
+ }
385
+
386
+ if (!inBuild)
387
+ return emitRaw()
388
+
389
+ // Build / prerender mode: queue non-blocking async Bun.spawn encoding and flush in afterPrerender().
390
+ const jobs = planVariantJobs(dims, stem, hash, cacheRoot, pipelineCfg)
391
+ const plannedMeta: CachedImageMeta = {
392
+ width: dims.width,
393
+ height: dims.height,
394
+ files: jobs.map(j => ({ rel: `img/${j.fileName}`, width: j.width, format: j.format })),
395
+ }
396
+ queueBuildTask(appCtx.outDir, (async () => {
397
+ mkdirSync(cacheRoot, { recursive: true })
398
+ mkdirSync(imgOutDir, { recursive: true })
399
+ const encoded = await encodeVariants(absPath, jobs)
400
+ for (const job of encoded)
401
+ writeFileSync(join(imgOutDir, job.fileName), readFileSync(job.cachedFile))
402
+ const files = encoded.map(job => ({ rel: `img/${job.fileName}`, width: job.width, format: job.format }))
403
+ if (files.length === jobs.length)
404
+ writeFileAtomic(metaPath, JSON.stringify({ width: dims.width, height: dims.height, files }))
405
+ })())
406
+ return assembleImageAsset(plannedMeta, cacheRoot, 'md-', '', (_rel, fileName) => {
407
+ appCtx.registerPublicFile(`img/${fileName}`)
408
+ })
409
+ }
410
+
411
+ export interface MarkdownImageResolverOptions extends OptimizeImageFileOptions {
412
+ sizes?: string | undefined
413
+ /** Project root boundary confining resolved relative Markdown image paths. */
414
+ root?: string | undefined
415
+ }
416
+
417
+ /** Creates a `@prunellejs/content` `resolveImage` function backed by `optimizeImageFile()`. Automatically wired by `images()`. */
418
+ export function createMarkdownImageResolver(options: MarkdownImageResolverOptions = {}) {
419
+ const sizes = options.sizes ?? '(min-width: 48rem) 42rem, 100vw'
420
+ return (src: string, file: string | undefined) => {
421
+ if (!file || !src.startsWith('.'))
422
+ return undefined
423
+ const absFile = resolve(file)
424
+ let boundary: string
425
+ if (options.root !== undefined) {
426
+ boundary = resolve(options.root)
427
+ }
428
+ else {
429
+ const prunelleRoot = getAppContext()?.root
430
+ boundary = (typeof prunelleRoot === 'string' && prunelleRoot !== '' && isInside(resolve(prunelleRoot), absFile))
431
+ ? resolve(prunelleRoot)
432
+ : dirname(absFile)
433
+ }
434
+
435
+ const abs = resolve(dirname(absFile), src)
436
+ if (!isInside(boundary, abs))
437
+ return undefined
438
+ if (!ALLOWED_IMAGE_EXTS.has(extname(abs).toLowerCase()))
439
+ return undefined
440
+ if (!existsSync(abs))
441
+ return undefined
442
+
443
+ let realBoundary: string
444
+ let realTarget: string
445
+ try {
446
+ realBoundary = realpathSync(boundary)
447
+ realTarget = realpathSync(abs)
448
+ }
449
+ catch {
450
+ return undefined
451
+ }
452
+ if (!isInside(realBoundary, realTarget))
453
+ return undefined
454
+ if (!ALLOWED_IMAGE_EXTS.has(extname(realTarget).toLowerCase()))
455
+ return undefined
456
+
457
+ const asset = optimizeImageFile(realTarget, options)
458
+ const srcset = asset.webpSrcset ?? asset.avifSrcset
459
+ return {
460
+ src: asset.src,
461
+ ...(srcset !== undefined ? { srcset } : {}),
462
+ ...(asset.avifSrcset !== undefined && asset.webpSrcset !== undefined ? { avifSrcset: asset.avifSrcset } : {}),
463
+ ...(srcset !== undefined ? { sizes } : {}),
464
+ width: asset.width,
465
+ height: asset.height,
466
+ }
467
+ }
468
+ }