0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-30 22:03:56 -05:00

fix: don't add the symbol at runtime

This commit is contained in:
Princesseuh 2024-05-27 14:47:03 -04:00
parent 095083ed6c
commit 6469054883
No known key found for this signature in database
GPG key ID: 105BBD6D57F2B0C0
2 changed files with 3 additions and 4 deletions

View file

@ -3,7 +3,7 @@ import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url'; import { fileURLToPath, pathToFileURL } from 'node:url';
import type * as vite from 'vite'; import type * as vite from 'vite';
import { prependForwardSlash, slash } from '../../core/path.js'; import { prependForwardSlash, slash } from '../../core/path.js';
import type { ImageMetadata } from '../types.js'; import type { ImageMetadata, image_metadata } from '../types.js';
import { imageMetadata } from './metadata.js'; import { imageMetadata } from './metadata.js';
type FileEmitter = vite.Rollup.EmitFile; type FileEmitter = vite.Rollup.EmitFile;
@ -30,7 +30,7 @@ export async function emitESMImage(
const fileMetadata = await imageMetadata(fileData, id); const fileMetadata = await imageMetadata(fileData, id);
const emittedImage: Omit<ImageMetadata, 'fsPath'> = { const emittedImage: Omit<ImageMetadata, 'fsPath' | typeof image_metadata> = {
src: '', src: '',
...fileMetadata, ...fileMetadata,
}; };

View file

@ -5,7 +5,7 @@ import { lookup as probe } from '../utils/vendor/image-size/lookup.js';
export async function imageMetadata( export async function imageMetadata(
data: Uint8Array, data: Uint8Array,
src?: string src?: string
): Promise<Omit<ImageMetadata, 'src' | 'fsPath'>> { ): Promise<Omit<ImageMetadata, 'src' | 'fsPath' | typeof image_metadata>> {
try { try {
const result = probe(data); const result = probe(data);
if (!result.height || !result.width || !result.type) { if (!result.height || !result.width || !result.type) {
@ -23,7 +23,6 @@ export async function imageMetadata(
height: isPortrait ? width : height, height: isPortrait ? width : height,
format: type as ImageInputFormat, format: type as ImageInputFormat,
orientation, orientation,
[image_metadata]: true,
}; };
} catch (e) { } catch (e) {
throw new AstroError({ throw new AstroError({