Giter Site home page Giter Site logo

risu729 / astro-better-image-service Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 0.0 31.18 MB

Astro integration for image compression and conversion, superseding Astro's default image service.

Home Page: https://npmjs.com/astro-better-image-service

License: Other

TypeScript 88.18% JavaScript 3.27% Astro 8.55%
astro images

astro-better-image-service's Issues

Add sharp to `package.json#dependencies`

It is a transitive dependency and the version is overridden by package.json#override.

It was the workaround for a bug of bun install which throws an error if the version of the same package in dependencies and transitive dependencies collides.
The bug only occurs when no global cache exists, but it was a significant problem while using Renovate.

oven-sh/bun#7729

Since astro now specifies sharp@^0.33.3 in its optionalDependencies, this workaround is no more needed.

Type not assignable error when both `astro-better-image-service` and `astro` are in dependencies

tsc throws an error like the one below when the astro version is directly specified in dependencies and it is of transient dependency through astro-better-image-service.
A change in the type of Vite configuration causes the error.

astro.config.ts(191,3): error TS2322: Type 'AstroIntegration' is not assignable to type 'false | AstroIntegration | (false | AstroIntegration | null | undefined)[] | null | undefined'.
  Type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/dist/@types/astro").AstroIntegration' is not assignable to type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/astro/dist/@types/astro").AstroIntegration'.
    The types of 'hooks['astro:config:setup']' are incompatible between these types.
      Type '(options: { config: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/dist/@types/astro").AstroConfig; command: "build" | "dev" | "preview"; ... 10 more ...; logger: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_m...' is not assignable to type '(options: { config: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro/dist/@types/astro").AstroConfig; command: "build" | "dev" | "preview"; isRestart: boolean; updateConfig: (newConfig: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro/dist/type-utils").DeepPartial<...>) => import(...'.
        Types of parameters 'options' and 'options' are incompatible.
          Type '{ config: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro/dist/@types/astro").AstroConfig; command: "build" | "dev" | "preview"; isRestart: boolean; updateConfig: (newConfig: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro/dist/type-utils").DeepPartial<...>) => import("/home/run...' is not assignable to type '{ config: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/dist/@types/astro").AstroConfig; command: "build" | "dev" | "preview"; ... 10 more ...; logger: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/ast...'.
            The types of 'config.integrations' are incompatible between these types.
              Type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/astro/dist/@types/astro").AstroIntegration[]' is not assignable to type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/dist/@types/astro").AstroIntegration[]'.
                Type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/astro/dist/@types/astro").AstroIntegration' is not assignable to type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/dist/@types/astro").AstroIntegration'.
                  The types of 'hooks['astro:config:setup']' are incompatible between these types.
                    Type '(options: { config: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro/dist/@types/astro").AstroConfig; command: "build" | "dev" | "preview"; isRestart: boolean; updateConfig: (newConfig: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro/dist/type-utils").DeepPartial<...>) => import(...' is not assignable to type '(options: { config: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/dist/@types/astro").AstroConfig; command: "build" | "dev" | "preview"; ... 10 more ...; logger: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_m...'.
                      Types of parameters 'options' and 'options' are incompatible.
                        Type '{ config: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/dist/@types/astro").AstroConfig; command: "build" | "dev" | "preview"; ... 10 more ...; logger: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/ast...' is not assignable to type '{ config: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro/dist/@types/astro").AstroConfig; command: "build" | "dev" | "preview"; isRestart: boolean; updateConfig: (newConfig: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro/dist/type-utils").DeepPartial<...>) => import("/home/run...'.
                          The types of 'config.vite.plugins' are incompatible between these types.
                            Type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/node_modules/vite/dist/node/index").PluginOption[]' is not assignable to type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/vite/dist/node/index").PluginOption[]'.
                              Type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/vite/dist/node/index").PluginOption'.
                                Type 'Plugin<any>' is not assignable to type 'PluginOption'.
                                  Type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/node_modules/vite/dist/node/index").Plugin<any>' is not assignable to type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/vite/dist/node/index").Plugin<any>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
                                    Types of property 'apply' are incompatible.
                                      Type '"build" | "serve" | ((this: void, config: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/node_modules/vite/dist/node/index").UserConfig, env: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/node_mod...' is not assignable to type '"build" | "serve" | ((this: void, config: import("/home/runner/work/astrolarva/astrolarva/node_modules/vite/dist/node/index").UserConfig, env: import("/home/runner/work/astrolarva/astrolarva/node_modules/vite/dist/node/index").ConfigEnv) => boolean)'.
                                        Type '(this: void, config: UserConfig, env: ConfigEnv) => boolean' is not assignable to type '"build" | "serve" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean)'.
                                          Type '(this: void, config: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/node_modules/vite/dist/node/index").UserConfig, env: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/node_modules/vite/dist/node/i...' is not assignable to type '(this: void, config: import("/home/runner/work/astrolarva/astrolarva/node_modules/vite/dist/node/index").UserConfig, env: import("/home/runner/work/astrolarva/astrolarva/node_modules/vite/dist/node/index").ConfigEnv) => boolean'.
                                            Types of parameters 'config' and 'config' are incompatible.
                                              Type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/vite/dist/node/index").UserConfig' is not assignable to type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/node_modules/vite/dist/node/index").UserConfig' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
                                                Types of property 'plugins' are incompatible.
                                                  Type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/vite/dist/node/index").PluginOption[]' is not assignable to type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/node_modules/vite/dist/node/index").PluginOption[]'.
                                                    Type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/node_modules/vite/dist/node/index").PluginOption'.
                                                      Type 'Plugin<any>' is not assignable to type 'PluginOption'.
                                                        Type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/vite/dist/node/index").Plugin<any>' is not assignable to type 'import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/node_modules/vite/dist/node/index").Plugin<any>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
                                                          Types of property 'apply' are incompatible.
                                                            Type '"build" | "serve" | ((this: void, config: import("/home/runner/work/astrolarva/astrolarva/node_modules/vite/dist/node/index").UserConfig, env: import("/home/runner/work/astrolarva/astrolarva/node_modules/vite/dist/node/index").ConfigEnv) => boolean)' is not assignable to type '"build" | "serve" | ((this: void, config: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/node_modules/vite/dist/node/index").UserConfig, env: import("/home/runner/work/astrolarva/astrolarva/node_modules/astro-better-image-service/node_modules/astro/node_mod...'.
                                                              Type '(this: void, config: UserConfig, env: ConfigEnv) => boolean' is not assignable to type '"build" | "serve" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean)'.
error: "tsc" exited with code 2
Error: Process completed with exit code 2.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

bun
package.json
  • astro 4.11.3
  • sharp 0.33.4
  • svgo 3.3.2
  • @biomejs/biome 1.8.3
  • @commitlint/cli 19.3.0
  • @commitlint/config-conventional 19.2.2
  • @commitlint/cz-commitlint 19.2.0
  • @commitlint/types 19.0.3
  • @cspell/cspell-types 8.9.1
  • @playwright/test 1.45.0
  • @total-typescript/tsconfig 1.0.4
  • @tsconfig/bun 1.0.6
  • @tsconfig/strictest 2.0.5
  • @types/bun 1.1.6
  • @types/ignore-walk 4.0.3
  • @types/node 20.14.9
  • ajv 8.16.0
  • ajv-draft-04 1.0.0
  • ajv-formats 3.0.1
  • commitizen 4.3.0
  • cspell 8.9.1
  • husky 9.0.11
  • ignore-sync 7.0.1
  • ignore-walk 6.0.5
  • json5 2.2.3
  • jsonc-parser 3.3.1
  • knip 5.23.3
  • markdownlint-cli2 0.13.0
  • prettier 3.3.2
  • renovate 37.421.5
  • semantic-release 24.0.0
  • ts-graphviz 2.1.2
  • typescript 5.5.2
github-actions
.github/workflows/e2e.yml
  • actions/checkout v4.1.7@692973e3d937129bcbf40652eb9f2f61becf3332
  • jdx/mise-action v2.0.6@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
  • actions/cache v4.0.2@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
  • actions/cache v4.0.2@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
  • actions/upload-artifact v4.3.3@65462800fd760344b1a7b4382951275a0abb4808
  • actions/checkout v4.1.7@692973e3d937129bcbf40652eb9f2f61becf3332
  • jdx/mise-action v2.0.6@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
  • actions/cache v4.0.2@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
  • actions/cache v4.0.2@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
  • actions/cache v4.0.2@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
  • actions/cache v4.0.2@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
  • actions/upload-artifact v4.3.3@65462800fd760344b1a7b4382951275a0abb4808
  • Kesin11/actions-timeline v2.1.2@518da3e0348d81936d2582859c88984728434d78
  • ubuntu 24.04
  • ubuntu 24.04
  • ubuntu 24.04
.github/workflows/lint.yml
  • actions/checkout v4.1.7@692973e3d937129bcbf40652eb9f2f61becf3332
  • jdx/mise-action v2.0.6@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
  • actions/checkout v4.1.7@692973e3d937129bcbf40652eb9f2f61becf3332
  • jdx/mise-action v2.0.6@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
  • actions/checkout v4.1.7@692973e3d937129bcbf40652eb9f2f61becf3332
  • jdx/mise-action v2.0.6@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
  • Kesin11/actions-timeline v2.1.2@518da3e0348d81936d2582859c88984728434d78
  • ubuntu 24.04
  • ubuntu 24.04
  • ubuntu 24.04
  • ubuntu 24.04
.github/workflows/release.yml
  • actions/checkout v4.1.7@692973e3d937129bcbf40652eb9f2f61becf3332
  • jdx/mise-action v2.0.6@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
  • Kesin11/actions-timeline v2.1.2@518da3e0348d81936d2582859c88984728434d78
  • ubuntu 24.04
  • ubuntu 24.04
.github/workflows/unit.yml
  • actions/checkout v4.1.7@692973e3d937129bcbf40652eb9f2f61becf3332
  • jdx/mise-action v2.0.6@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
  • Kesin11/actions-timeline v2.1.2@518da3e0348d81936d2582859c88984728434d78
  • ubuntu 24.04
  • ubuntu 24.04
regex
mise.toml
  • bun 1.1.17
  • actionlint 1.7.1
  • shellcheck 0.10.0
  • yamlfmt 0.13.0
mise.toml
  • node 22.3.0
  • ubi 0.0.32
  • yamllint 1.35.1
mise.toml
  • taplo-cli 0.9.0
mise.toml
  • suzuki-shunsuke/ghalint 0.2.12
  • suzuki-shunsuke/pinact 0.2.1
  • lycheeverse/lychee 0.15.1
  • crate-ci/typos 1.22.9

  • Check this box to trigger a request for Renovate to run again on this repository

`actions/cache/save` throws a warning: `Cache already exists.`

I configured it to always try to save the cache to extend the lifetime, but it seems it cannot save if a cache with the same key.

https://github.com/risu729/astro-better-image-service/actions/runs/9037210483/job/24835735526#step:9:9

/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/astro-better-image-service/astro-better-image-service --files-from manifest.txt --use-compress-program zstdmt
Failed to save: Unable to reserve cache with key playwright-browsers-Linux-1.44.0, another job may be creating this cache. More details: Cache already exists. Scope: refs/heads/main, Key: playwright-browsers-Linux-1.44.0, Version: b11b119dfd10565044882f81f06d3a[7](https://github.com/risu729/astro-better-image-service/actions/runs/9037210483/job/24835735526#step:9:8)5b1602bec6f8658ac905dd63583b2a885
Warning: Cache save failed.

Append the source of default image service's compression settings in README

In README, I mentioned the below.

The default image service uses the default compression settings of sharp, in which the compression ratio is medium.

I found the source of it in the Astro Discord server so I will append it to README.

astro-compress sets the compression level to the maximum, whereas astro:assets uses the default settings
We most likely could tune up the settings a bit, though we need to be careful about it taking too much time (notably because of SSR doing it at runtime)
ref: https://discord.com/channels/830184174198718474/830184175176122389/1168307099571331155

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.