Giter Club home page Giter Club logo

imgit's Introduction

imgit's People

Contributors

elringus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

fryuni

imgit's Issues

Sniff MIME

Instead of resolving content MIME type via file extension, consider using file --mime-type utility available by default on Linux and Mac. On Windows similar is available via file utility available on choco.

Remote image being processed as a video

I got this on my markdown:

![xkcd about workflow](https://imgs.xkcd.com/comics/workflow.png)

Imgit tries to invoke ffmpeg and convert it to av1, which throws this error:

21:00:09 [ERROR] [vite] [imgit] Command failed: ffmpeg -y -loglevel error -i "/home/lotus/Workspace/blog/public/imgit/fetched/imgs.xkcd.com-comics-workflow.png" -c:v libaom-av1 -still-picture 1 -crf 23 -cpu-used 5 -an -filter_complex "[0:v]scale=iw*1:-1" "/home/lotus/Workspace/blog/public/imgit/encoded/[email protected]"
Unrecognized option 'still-picture'.
Error splitting the argument list: Option not found

ffmpeg info:

ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.3.0 (GCC)
  configuration: --disable-static --prefix=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ffmpeg-6.0 --target_os=linux --arch=x86_64 --pkg-config=pkg-config --enable-gpl --enable-version3 --disable-nonfree --enable-shared --enable-pic --disable-small --enable-runtime-cpudetect --disable-gray --enable-swscale-alpha --enable-hardcoded-tables --enable-safe-bitstream-reader --enable-pthreads --disable-w32threads --disable-os2threads --enable-network --enable-pixelutils --datadir=/nix/store/5zl2754g2r43yp553634fzbligcvj172-ffmpeg-6.0-data/share/ffmpeg --enable-ffmpeg --disable-ffplay --enable-ffprobe --bindir=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ffmpeg-6.0-bin/bin --enable-avcodec --enable-avdevice --enable-avfilter --enable-avformat --enable-avutil --enable-postproc --enable-swresample --enable-swscale --libdir=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ffmpeg-6.0-lib/lib --incdir=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ffmpeg-6.0-dev/include --enable-doc --enable-htmlpages --enable-manpages --mandir=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ffmpeg-6.0-man/share/man --enable-podpages --enable-txtpages --docdir=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ffmpeg-6.0-doc/share/doc/ffmpeg --enable-alsa --enable-bzlib --disable-libcelt --disable-cuda --disable-cuda-llvm --enable-libdav1d --disable-libfdk-aac --disable-libflite --enable-fontconfig --enable-libfreetype --disable-frei0r --disable-libfribidi --disable-libgme --enable-gnutls --disable-libgsm --disable-ladspa --enable-libmp3lame --disable-libaom --enable-libass --disable-libbluray --disable-libbs2b --disable-libdc1394 --enable-libdrm --enable-iconv --disable-libjack --disable-libmfx --disable-libmodplug --disable-libmysofa --enable-libopus --disable-librsvg --enable-libsrt --enable-libssh --disable-libtensorflow --enable-libtheora --enable-libv4l2 --enable-v4l2-m2m --enable-vaapi --enable-vdpau --enable-libvorbis --disable-libvmaf --enable-libvpx --disable-libwebp --disable-xlib --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-libxcb-shape --disable-libxml2 --enable-lzma --enable-cuvid --enable-nvdec --enable-nvenc --disable-openal --disable-opencl --disable-libopencore-amrnb --disable-opengl --disable-libopenh264 --disable-libopenjpeg --disable-libopenmpt --enable-libpulse --disable-librav1e --enable-libsvtav1 --disable-librtmp --enable-sdl2 --enable-libsoxr --enable-libspeex --disable-libvidstab --disable-libvo-amrwbenc --enable-libx264 --enable-libx265 --disable-libxavs --enable-libxvid --disable-libzmq --enable-libzimg --enable-zlib --disable-vulkan --disable-libglslang --disable-libsmbclient --disable-debug --enable-optimizations --disable-extra-warnings --disable-stripping
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Hyper fast Audio and Video encoder

Invalid type declarations for covariant field in AstroIntegration

The type declared for the Astro plugin specifies unknown[] for Vite's plugin config. This is incompatible with the real AstroIntegration type from astro.

astro.config.mts:110:5 - error TS2322: Type 'AstroIntegration' is not assignable to type 'false | AstroIntegration | (false | AstroIntegration | null | undefined)[] | null | undefined'.
  Type 'AstroIntegration' is not assignable to type 'import("/home/lotus/Workspace/blog/node_modules/.pnpm/[email protected][email protected]/node_modules/astro/dist/@types/astro").AstroIntegration'.
    The types of 'hooks['astro:config:setup']' are incompatible between these types.
      Type '((options: { injectScript: AstroInjector; updateConfig: (config: { vite: { plugins: unknown[]; }; }) => void; }) => void | Promise<void>) | undefined' is not assignable to type '((options: { config: AstroConfig; command: "build" | "dev" | "preview"; isRestart: boolean; updateConfig: (newConfig: DeepPartial<AstroConfig>) => AstroConfig; ... 8 more ...; logger: AstroIntegrationLogger; }) => void | Promise<...>) | undefined'.
        Type '(options: { injectScript: AstroInjector; updateConfig: (config: { vite: { plugins: unknown[]; }; }) => void; }) => void | Promise<void>' is not assignable to type '(options: { config: AstroConfig; command: "build" | "dev" | "preview"; isRestart: boolean; updateConfig: (newConfig: DeepPartial<AstroConfig>) => AstroConfig; ... 8 more ...; logger: AstroIntegrationLogger; }) => void | Promise<...>'.
          Types of parameters 'options' and 'options' are incompatible.
            Type '{ config: AstroConfig; command: "build" | "dev" | "preview"; isRestart: boolean; updateConfig: (newConfig: DeepPartial<AstroConfig>) => AstroConfig; ... 8 more ...; logger: AstroIntegrationLogger; }' is not assignable to type '{ injectScript: AstroInjector; updateConfig: (config: { vite: { plugins: unknown[]; }; }) => void; }'.
              Types of property 'updateConfig' are incompatible.
                Type '(newConfig: DeepPartial<AstroConfig>) => AstroConfig' is not assignable to type '(config: { vite: { plugins: unknown[]; }; }) => void'.
                  Types of parameters 'newConfig' and 'config' are incompatible.
                    Type '{ vite: { plugins: unknown[]; }; }' is not assignable to type 'DeepPartial<AstroConfig>'.
                      The types of 'vite.plugins' are incompatible between these types.
                        Type 'unknown[]' is not assignable to type 'DeepPartial<PluginOption[] | undefined>'.
                          Type 'unknown' is not assignable to type 'PluginOption'.

110     imgit({}),
Print of the error formatted

image

updateConfig: (config: { vite: { plugins: unknown[] } }) => void;

That plugins: unknown[] is inside a function parameter, making the type of updateConfig contravariant over it. But the updateConfig field is itself part of a function parameter, meaning that astro:config:setup and by extension AstroIntegration contravariant over updateConfig. Transitively, AstroIntegration is covariant over the plugins field.

This means that assigning this AstroIntegration type over Astro's actual type would require unknown to be assignable to Vite's PluginOption, but of course unknown is not assignable to anything except itself by definition (since it is a top type).

The field should either:

  • Be properly typed using Vite's PluginOption
  • Be typed as a subtype of Vite's PluginOptions, possibly with only the used properties
  • Be typed with any, which is both a top and bottom type and accepts any assignment in both directions

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.